Clean code

This commit is contained in:
Laurent Destailleur 2025-10-23 14:31:45 +02:00
parent 1e84852825
commit 0346d901be
9 changed files with 11 additions and 13 deletions

View file

@ -3185,13 +3185,13 @@ if ($action == 'create' && $usercancreate) {
if ($totalWeight) {
print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
print '<td class="valuefield">';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
print '</td></tr>';
}
if ($totalVolume) {
print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
print '<td class="valuefield">';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_VOLUME_DEFAULT_UNIT', 'no'));
print '</td></tr>';
}

View file

@ -224,7 +224,7 @@ function displayBox($selectedDate, $month, $year)
</tr>
<tr class="dpDayNames">
<?php
$startday = isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1;
$startday = getDolGlobalInt('MAIN_START_WEEK', 1);
$day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday');
for ($i = 0; $i < 7; $i++) {
echo '<td width="', (int) (($i + 1) * 100 / 7) - (int) ($i * 100 / 7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n";

View file

@ -203,7 +203,7 @@ jQuery(function($){
dayNamesMin: tradDaysMin,
weekHeader: '<?php echo $langs->trans("Week"); ?>',
dateFormat: '<?php echo $langs->trans("FormatDateShortJQuery"); ?>', /* Note dd/mm/yy means year on 4 digit in jquery format */
firstDay: <?php echo(isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'); ?>,
firstDay: <?php echo getDolGlobalInt('MAIN_START_WEEK', 1); ?>,
isRTL: <?php echo($langs->trans("DIRECTION") == 'rtl' ? 'true' : 'false'); ?>,
showMonthAfterYear: false, /* TODO add specific to country */
yearSuffix: '' /* TODO add specific to country */

View file

@ -674,13 +674,11 @@ function dol_get_first_hour($date, $gm = 'tzserver')
*/
function dol_get_first_day_week($day, $month, $year, $gm = false)
{
global $conf;
//$day=2; $month=2; $year=2015;
$date = dol_mktime(0, 0, 0, $month, $day, $year, $gm);
//Checking conf of start week
$start_week = (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1);
$start_week = getDolGlobalInt('MAIN_START_WEEK', 1);
$tmparray = dol_getdate($date, true); // detail of current day

View file

@ -2318,7 +2318,7 @@ if ($action == 'create') {
if (!empty($object->trueWeight)) {
print ' (' . $langs->trans("SumOfProductWeights") . ': ';
}
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
if (!empty($object->trueWeight)) {
print ')';
}

View file

@ -1622,7 +1622,7 @@ while ($i < $imaxinloop) {
print '<td class="center">';
if (empty($object->trueWeight)) {
$tmparray = $object->getTotalWeightVolume();
print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
print $form->textwithpicto('', $langs->trans('EstimatedWeight'), 1);
} else {
print $object->trueWeight;

View file

@ -218,8 +218,8 @@ if ($object->id) {
print '<tr>';
print '<td>';
$htmlhelp = $langs->trans('NbUseDaysCPHelp');
$includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
$includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
$includesaturday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
$includesunday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
if ($includesaturday) {
$htmlhelp .= '<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Saturday"));
}

View file

@ -128,7 +128,7 @@ function displayRankInfos($selected_rank, $fk_skill, $inputname = 'TNote', $mode
$ret .= '</span>';
if (is_array($Lines) && !empty($Lines)) {
foreach ($Lines as $line) {
$MaxNumberSkill = isset($conf->global->HRM_MAXRANK) ? $conf->global->HRM_MAXRANK : Skill::DEFAULT_MAX_RANK_PER_SKILL;
$MaxNumberSkill = getDolGlobalInt('HRM_MAXRANK', Skill::DEFAULT_MAX_RANK_PER_SKILL);
if ($line->rankorder > $MaxNumberSkill) {
continue;
}

View file

@ -388,7 +388,7 @@ if ($action == 'afteradd') {
print ' <td class="center hideonsmartphone">#</td>';
$i = 0;
while ($i < 7) {
$numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
$numdayinweek = (($i + getDolGlobalInt('MAIN_START_WEEK', 1)) % 7);
if (!empty($conf->dol_optimize_smallscreen)) {
print ' <td class="center bold uppercase tdfordaytitle'.($i == 0 ? ' borderleft' : '').'">';
$labelshort = array(0 => 'SundayMin', 1 => 'MondayMin', 2 => 'TuesdayMin', 3 => 'WednesdayMin', 4 => 'ThursdayMin', 5 => 'FridayMin', 6 => 'SaturdayMin');