@@ -48,7 +48,7 @@ |
||
48 | 48 | $langs->load("receptions"); |
49 | 49 | |
50 | 50 | $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); |
51 | -'@phan-var-force Reception[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
51 | +'@phan-var-force Reception[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
52 | 52 | /** @var Reception[] $linkedObjectBlock */ |
53 | 53 | |
54 | 54 | $total = 0; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $langs->load("tasks"); |
49 | 49 | |
50 | 50 | $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); |
51 | -'@phan-var-force CommonObject[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
51 | +'@phan-var-force CommonObject[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
52 | 52 | /** @var Task[] $linkedObjectBlock */ |
53 | 53 | |
54 | 54 | $total = 0; |
@@ -241,7 +241,7 @@ |
||
241 | 241 | } |
242 | 242 | $sql .= " WHERE cf.entity IN (".getEntity('product').")"; |
243 | 243 | $sql .= " AND cfdi.batch = '".($db->escape($object->batch))."'"; |
244 | - $sql .= " AND cfdi.fk_product = " . (int) $object->fk_product; |
|
244 | + $sql .= " AND cfdi.fk_product = ".(int) $object->fk_product; |
|
245 | 245 | if (!empty($search_month)) { |
246 | 246 | $sql .= ' AND MONTH(cf.date_commande) IN ('.$db->sanitize((string) $search_month).')'; |
247 | 247 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | if (!$error) { |
415 | 415 | // Insert request |
416 | - $sql = 'INSERT INTO ' . $this->db->prefix() . $this->table_element . '('; |
|
416 | + $sql = 'INSERT INTO '.$this->db->prefix().$this->table_element.'('; |
|
417 | 417 | $sql .= 'entity,'; |
418 | 418 | $sql .= 'fk_product,'; |
419 | 419 | $sql .= 'batch,'; |
@@ -430,21 +430,21 @@ discard block |
||
430 | 430 | $sql .= 'fk_user_modif,'; |
431 | 431 | $sql .= 'import_key'; |
432 | 432 | $sql .= ') VALUES ('; |
433 | - $sql .= ' ' . (!isset($this->entity) ? $conf->entity : $this->entity) . ','; |
|
434 | - $sql .= ' ' . (!isset($this->fk_product) ? 'NULL' : $this->fk_product) . ','; |
|
435 | - $sql .= ' ' . (!isset($this->batch) ? 'NULL' : "'" . $this->db->escape($this->batch) . "'") . ','; |
|
436 | - $sql .= ' ' . (!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'" . $this->db->idate($this->eatby) . "'") . ','; |
|
437 | - $sql .= ' ' . (!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'" . $this->db->idate($this->sellby) . "'") . ','; |
|
438 | - $sql .= ' ' . (!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->eol_date) . "'") . ','; |
|
439 | - $sql .= ' ' . (!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->manufacturing_date) . "'") . ','; |
|
440 | - $sql .= ' ' . (!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->scrapping_date) . "'") . ','; |
|
433 | + $sql .= ' '.(!isset($this->entity) ? $conf->entity : $this->entity).','; |
|
434 | + $sql .= ' '.(!isset($this->fk_product) ? 'NULL' : $this->fk_product).','; |
|
435 | + $sql .= ' '.(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").','; |
|
436 | + $sql .= ' '.(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").','; |
|
437 | + $sql .= ' '.(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").','; |
|
438 | + $sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").','; |
|
439 | + $sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").','; |
|
440 | + $sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").','; |
|
441 | 441 | //$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").','; |
442 | 442 | $sql .= ' '.(empty($this->qc_frequency) ? 'NULL' : $this->qc_frequency).','; |
443 | 443 | $sql .= ' '.(empty($this->lifetime) ? 'NULL' : $this->lifetime).','; |
444 | - $sql .= ' ' . "'" . $this->db->idate(dol_now()) . "'" . ','; |
|
445 | - $sql .= ' ' . (!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat) . ','; |
|
446 | - $sql .= ' ' . (!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif) . ','; |
|
447 | - $sql .= ' ' . (!isset($this->import_key) ? 'NULL' : $this->import_key); |
|
444 | + $sql .= ' '."'".$this->db->idate(dol_now())."'".','; |
|
445 | + $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).','; |
|
446 | + $sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).','; |
|
447 | + $sql .= ' '.(!isset($this->import_key) ? 'NULL' : $this->import_key); |
|
448 | 448 | $sql .= ')'; |
449 | 449 | |
450 | 450 | $this->db->begin(); |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | $resql = $this->db->query($sql); |
453 | 453 | if (!$resql) { |
454 | 454 | $error++; |
455 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
455 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | if (!$error) { |
459 | - $this->id = $this->db->last_insert_id($this->db->prefix() . $this->table_element); |
|
459 | + $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element); |
|
460 | 460 | |
461 | 461 | // Actions on extra fields |
462 | 462 | if (!$error) { |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | } |
486 | 486 | |
487 | 487 | if ($error) { |
488 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
488 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
489 | 489 | return -1 * $error; |
490 | 490 | } else { |
491 | 491 | return $this->id; |
@@ -634,31 +634,31 @@ discard block |
||
634 | 634 | |
635 | 635 | if (!$error) { |
636 | 636 | // Update request |
637 | - $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element . ' SET'; |
|
638 | - $sql .= ' entity = ' . (isset($this->entity) ? $this->entity : "null") . ','; |
|
639 | - $sql .= ' fk_product = ' . (isset($this->fk_product) ? $this->fk_product : "null") . ','; |
|
640 | - $sql .= ' batch = ' . (isset($this->batch) ? "'" . $this->db->escape($this->batch) . "'" : "null") . ','; |
|
641 | - $sql .= ' eatby = ' . (!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'" . $this->db->idate($this->eatby) . "'" : 'null') . ','; |
|
642 | - $sql .= ' sellby = ' . (!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'" . $this->db->idate($this->sellby) . "'" : 'null') . ','; |
|
643 | - $sql .= ' eol_date = ' . (!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'" . $this->db->idate($this->eol_date) . "'" : 'null') . ','; |
|
644 | - $sql .= ' manufacturing_date = ' . (!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'" . $this->db->idate($this->manufacturing_date) . "'" : 'null') . ','; |
|
645 | - $sql .= ' scrapping_date = ' . (!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'" . $this->db->idate($this->scrapping_date) . "'" : 'null') . ','; |
|
637 | + $sql = 'UPDATE '.$this->db->prefix().$this->table_element.' SET'; |
|
638 | + $sql .= ' entity = '.(isset($this->entity) ? $this->entity : "null").','; |
|
639 | + $sql .= ' fk_product = '.(isset($this->fk_product) ? $this->fk_product : "null").','; |
|
640 | + $sql .= ' batch = '.(isset($this->batch) ? "'".$this->db->escape($this->batch)."'" : "null").','; |
|
641 | + $sql .= ' eatby = '.(!isset($this->eatby) || dol_strlen($this->eatby) != 0 ? "'".$this->db->idate($this->eatby)."'" : 'null').','; |
|
642 | + $sql .= ' sellby = '.(!isset($this->sellby) || dol_strlen($this->sellby) != 0 ? "'".$this->db->idate($this->sellby)."'" : 'null').','; |
|
643 | + $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').','; |
|
644 | + $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').','; |
|
645 | + $sql .= ' scrapping_date = '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) != 0 ? "'".$this->db->idate($this->scrapping_date)."'" : 'null').','; |
|
646 | 646 | //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').','; |
647 | 647 | $sql .= ' qc_frequency = '.(!empty($this->qc_frequency) ? (int) $this->qc_frequency : 'null').','; |
648 | 648 | $sql .= ' lifetime = '.(!empty($this->lifetime) ? (int) $this->lifetime : 'null').','; |
649 | - $sql .= ' datec = ' . (dol_strlen((string) $this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ','; |
|
650 | - $sql .= ' tms = ' . (dol_strlen((string) $this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : "'" . $this->db->idate(dol_now()) . "'") . ','; |
|
651 | - $sql .= ' fk_user_creat = ' . (isset($this->fk_user_creat) ? $this->fk_user_creat : "null") . ','; |
|
652 | - $sql .= ' fk_user_modif = ' . (isset($this->fk_user_modif) ? $this->fk_user_modif : "null") . ','; |
|
653 | - $sql .= ' import_key = ' . (isset($this->import_key) ? $this->import_key : "null"); |
|
654 | - $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
649 | + $sql .= ' datec = '.(dol_strlen((string) $this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').','; |
|
650 | + $sql .= ' tms = '.(dol_strlen((string) $this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; |
|
651 | + $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").','; |
|
652 | + $sql .= ' fk_user_modif = '.(isset($this->fk_user_modif) ? $this->fk_user_modif : "null").','; |
|
653 | + $sql .= ' import_key = '.(isset($this->import_key) ? $this->import_key : "null"); |
|
654 | + $sql .= ' WHERE rowid='.((int) $this->id); |
|
655 | 655 | |
656 | 656 | $this->db->begin(); |
657 | 657 | |
658 | 658 | $resql = $this->db->query($sql); |
659 | 659 | if (!$resql) { |
660 | 660 | $error++; |
661 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
661 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Actions on extra fields |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | if ($error) { |
690 | - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); |
|
690 | + dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); |
|
691 | 691 | return -1 * $error; |
692 | 692 | } else { |
693 | 693 | return 1; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | } |
931 | 931 | $sql .= " WHERE cf.entity IN (".getEntity('expedition').")"; |
932 | 932 | $sql .= " AND cfdi.batch = '".($this->db->escape($this->batch))."'"; |
933 | - $sql .= " AND cfdi.fk_product = " . (int) $this->fk_product; |
|
933 | + $sql .= " AND cfdi.fk_product = ".(int) $this->fk_product; |
|
934 | 934 | if (!$user->hasRight('societe', 'client', 'voir')) { |
935 | 935 | $sql .= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); |
936 | 936 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | $obj = $this->db->fetch_object($result); |
1096 | 1096 | $this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0; |
1097 | 1097 | $this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0; |
1098 | - $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
1098 | + $this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM() |
|
1099 | 1099 | } else { |
1100 | 1100 | $this->error = $this->db->error(); |
1101 | 1101 | $error++; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $langs->load("interventions"); |
43 | 43 | |
44 | 44 | $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); |
45 | -'@phan-var-force Fichinter[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
45 | +'@phan-var-force Fichinter[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
46 | 46 | /** @var Fichinter[] $linkedObjectBlock */ |
47 | 47 | |
48 | 48 | $ilink = 0; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | $langs->load("propal"); |
49 | 49 | |
50 | 50 | $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); |
51 | -'@phan-var-force Propal[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
51 | +'@phan-var-force Propal[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
52 | 52 | /** @var Propal[] $linkedObjectBlock */ |
53 | 53 | |
54 | 54 | $total = 0; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | |
52 | 52 | $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); |
53 | -$DELAYFORCACHE = 300; // 300 seconds |
|
53 | +$DELAYFORCACHE = 300; // 300 seconds |
|
54 | 54 | |
55 | 55 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $socid = ''; |
87 | 87 | } |
88 | 88 | |
89 | -$canedit = 1; // can read events of others |
|
89 | +$canedit = 1; // can read events of others |
|
90 | 90 | if (!$user->hasRight('agenda', 'myactions', 'read')) { |
91 | 91 | accessforbidden(); |
92 | 92 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $sql .= " ON bc.rowid = ba.fk_bookcal_calendar"; |
554 | 554 | $sql .= " WHERE bc.status = 1"; |
555 | 555 | $sql .= " AND ba.status = 1"; |
556 | - $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
556 | + $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
557 | 557 | if (!empty($filtert) && $filtert != '-1' && $filtert != '-2') { |
558 | 558 | $sql .= " AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).")"; |
559 | 559 | } |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | // Holiday calendar |
595 | 595 | if ($user->hasRight("holiday", "read")) { |
596 | 596 | $s .= ' |
597 | - <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday ? ' checked' : '') . '> |
|
597 | + <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday ? ' checked' : '').'> |
|
598 | 598 | <label for="check_holiday" class="labelcalendar"> |
599 | - <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span> |
|
599 | + <span class="check_holiday_text">' . $langs->trans("Holidays").'</span> |
|
600 | 600 | </label> |
601 | 601 | </div>'; |
602 | 602 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | // External calendars |
605 | 605 | if (count($showextcals) > 0) { |
606 | 606 | foreach ($showextcals as $val) { |
607 | - $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
607 | + $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
608 | 608 | |
609 | 609 | $s .= '<script type="text/javascript">'."\n"; |
610 | 610 | $s .= 'jQuery(document).ready(function () {'."\n"; |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | $s .= "\n".'<!-- End div to calendars selectors -->'."\n"; |
650 | 650 | } else { // If javascript off |
651 | 651 | $newparam = $param; // newparam is for birthday links |
652 | - $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.($showbirthday ? '1' : '0'), $newparam); // Always false @phpstan-ignore-line |
|
652 | + $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.($showbirthday ? '1' : '0'), $newparam); // Always false @phpstan-ignore-line |
|
653 | 653 | if (!preg_match('/showbirthday=/i', $newparam)) { |
654 | 654 | $newparam .= '&showbirthday=1'; |
655 | 655 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | // TODO Replace with a AND EXISTS |
699 | 699 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar"; |
700 | 700 | $sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
701 | - if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
701 | + if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
702 | 702 | $sql .= " AND ar.fk_element IN (".$db->sanitize($filtert).")"; |
703 | 703 | } elseif ($filtert == '-3') { |
704 | 704 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -709,14 +709,14 @@ discard block |
||
709 | 709 | } |
710 | 710 | |
711 | 711 | $sql .= " WHERE a.fk_action = ca.id"; |
712 | -$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
712 | +$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
713 | 713 | |
714 | 714 | // Condition on actioncode |
715 | 715 | if (!empty($actioncode)) { |
716 | 716 | if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { |
717 | 717 | if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode == 'AC_NON_AUTO') { |
718 | 718 | $sql .= " AND ca.type != 'systemauto'"; |
719 | - } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') { |
|
719 | + } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode == 'AC_ALL_AUTO') { |
|
720 | 720 | $sql .= " AND ca.type = 'systemauto'"; |
721 | 721 | } else { |
722 | 722 | if ((is_array($actioncode) && in_array('AC_OTH', $actioncode)) || $actioncode == 'AC_OTH') { |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | } else { |
730 | 730 | if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') { |
731 | 731 | $sql .= " AND ca.type != 'systemauto'"; |
732 | - } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') { |
|
732 | + } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') { |
|
733 | 733 | $sql .= " AND ca.type = 'systemauto'"; |
734 | 734 | } elseif ((is_array($actioncode) && !in_array('-1', $actioncode) && !in_array('-3', $actioncode)) || ($actioncode !== '-1' && $actioncode !== '-3')) { |
735 | 735 | if (is_array($actioncode)) { |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | // event->datep and event->datef must be GMT date. |
876 | 876 | if ($event->fulldayevent) { |
877 | 877 | $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); |
878 | - $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
878 | + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
879 | 879 | $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); |
880 | 880 | } else { |
881 | 881 | // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) |
@@ -951,8 +951,8 @@ discard block |
||
951 | 951 | // Loop on each day covered by action to prepare an index to show on calendar |
952 | 952 | $loop = true; |
953 | 953 | $j = 0; |
954 | - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
955 | - $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
954 | + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
955 | + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
956 | 956 | /* |
957 | 957 | print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; |
958 | 958 | print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; |
@@ -1154,9 +1154,9 @@ discard block |
||
1154 | 1154 | } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) { |
1155 | 1155 | $newevent->label .= ' ('.$langs->trans("Afternoon").')'; |
1156 | 1156 | } |
1157 | - $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1157 | + $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1158 | 1158 | } else { |
1159 | - $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1159 | + $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | $daykey += 60 * 60 * 24; |
@@ -1918,8 +1918,8 @@ discard block |
||
1918 | 1918 | // We are in a particular day for $username, now we scan all events |
1919 | 1919 | foreach ($eventarray as $daykey => $notused) { |
1920 | 1920 | $annee = (int) dol_print_date($daykey, '%Y', 'tzuserrel'); |
1921 | - $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1922 | - $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1921 | + $mois = (int) dol_print_date($daykey, '%m', 'tzuserrel'); |
|
1922 | + $jour = (int) dol_print_date($daykey, '%d', 'tzuserrel'); |
|
1923 | 1923 | //var_dump("daykey=$daykey day=$day jour=$jour, month=$month mois=$mois, year=$year annee=$annee ".dol_print_date($daykey, 'dayhour', 'gmt')); |
1924 | 1924 | //var_dump($notused); |
1925 | 1925 |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | */ |
51 | 51 | |
52 | 52 | $MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5); |
53 | -$DELAYFORCACHE = 300; // 300 seconds |
|
53 | +$DELAYFORCACHE = 300; // 300 seconds |
|
54 | 54 | |
55 | 55 | $action = GETPOST('action', 'aZ09'); |
56 | 56 | $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
57 | 57 | $mode = GETPOST('mode', 'aZ09'); |
58 | 58 | if (empty($mode) && preg_match('/show_/', $action)) { |
59 | - $mode = $action; // For backward compatibility |
|
59 | + $mode = $action; // For backward compatibility |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $disabledefaultvalues = GETPOSTINT('disabledefaultvalues'); |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS')); |
150 | 150 | } |
151 | 151 | |
152 | -$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
153 | -$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
152 | +$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app |
|
153 | +$defaultview = getDolUserString('AGENDA_DEFAULT_VIEW', $defaultview); // default for user |
|
154 | 154 | if (empty($mode) && !GETPOSTISSET('mode')) { |
155 | 155 | $mode = $defaultview; |
156 | 156 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | $viewmode .= '</div>'; |
566 | 566 | |
567 | -$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
567 | +$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools |
|
568 | 568 | |
569 | 569 | |
570 | 570 | $newparam = ''; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | $sql .= " ON bc.rowid = ba.fk_bookcal_calendar"; |
600 | 600 | $sql .= " WHERE bc.status = 1"; |
601 | 601 | $sql .= " AND ba.status = 1"; |
602 | - $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
602 | + $sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
603 | 603 | if (!empty($filtert) && $filtert != '-1') { |
604 | 604 | $sql .= " AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).")"; |
605 | 605 | } |
@@ -655,9 +655,9 @@ discard block |
||
655 | 655 | if ($user->hasRight("holiday", "read")) { |
656 | 656 | $s .= ' |
657 | 657 | <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday |
658 | - ? ' checked' : '') . '> |
|
658 | + ? ' checked' : '').'> |
|
659 | 659 | <label for="check_holiday" class="labelcalendar"> |
660 | - <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span> |
|
660 | + <span class="check_holiday_text">' . $langs->trans("Holidays").'</span> |
|
661 | 661 | </label> |
662 | 662 | </div>'; |
663 | 663 | } |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | $s .= '</script>'."\n"; |
684 | 684 | |
685 | 685 | foreach ($showextcals as $val) { |
686 | - $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
686 | + $htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char |
|
687 | 687 | |
688 | 688 | if (!empty($val['default']) || GETPOSTINT('check_ext'.$htmlname)) { |
689 | 689 | $default = "checked"; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) { |
774 | 774 | // TODO Replace with a AND EXISTS |
775 | 775 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'"; |
776 | - if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
776 | + if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') { |
|
777 | 777 | $sql .= " AND (ar.fk_element IN (".$db->sanitize($filtert).") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility |
778 | 778 | } elseif ($filtert == '-3') { |
779 | 779 | $sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")"; |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | $sql .= $hookmanager->resPrint; |
795 | 795 | |
796 | 796 | $sql .= " WHERE a.fk_action = ca.id"; |
797 | -$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
797 | +$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda |
|
798 | 798 | // Condition on actioncode |
799 | 799 | if (!empty($actioncode)) { |
800 | 800 | if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | } else { |
814 | 814 | if ((is_array($actioncode) && in_array('AC_NON_AUTO', $actioncode)) || $actioncode === 'AC_NON_AUTO') { |
815 | 815 | $sql .= " AND ca.type != 'systemauto'"; |
816 | - } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') { |
|
816 | + } elseif ((is_array($actioncode) && in_array('AC_ALL_AUTO', $actioncode)) || $actioncode === 'AC_ALL_AUTO') { |
|
817 | 817 | $sql .= " AND ca.type = 'systemauto'"; |
818 | 818 | } else { |
819 | 819 | if (is_array($actioncode)) { |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | * @param string $value |
825 | 825 | * @return bool |
826 | 826 | */ |
827 | - function ($value) { |
|
827 | + function($value) { |
|
828 | 828 | return ((string) $value !== '-1'); |
829 | 829 | } |
830 | 830 | ); |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | // event->datep and event->datef must be GMT date. |
952 | 952 | if ($event->fulldayevent) { |
953 | 953 | $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); |
954 | - $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
954 | + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz |
|
955 | 955 | $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); |
956 | 956 | } else { |
957 | 957 | // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | // Loop on each day covered by action to prepare an index to show on calendar |
1030 | 1030 | $loop = true; |
1031 | 1031 | $j = 0; |
1032 | - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1033 | - $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1032 | + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz |
|
1033 | + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz |
|
1034 | 1034 | /* |
1035 | 1035 | print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>'; |
1036 | 1036 | print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>'; |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | $sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved) |
1160 | 1160 | if ($mode == 'show_day') { |
1161 | 1161 | // Request only leaves for the current selected day |
1162 | - $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1162 | + $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time |
|
1163 | 1163 | } elseif ($mode == 'show_week') { |
1164 | 1164 | // Restrict on current month (we get more, but we will filter later) |
1165 | 1165 | $sql .= " AND x.date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; |
@@ -1244,9 +1244,9 @@ discard block |
||
1244 | 1244 | } elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) { |
1245 | 1245 | $newevent->label .= ' ('.$langs->trans("Afternoon").')'; |
1246 | 1246 | } |
1247 | - $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1247 | + $eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone. |
|
1248 | 1248 | } else { |
1249 | - $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1249 | + $eventarray[$daykey][] = $event; // We can use the event unchanged |
|
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | $daykey += 60 * 60 * 24; |
@@ -1759,7 +1759,7 @@ discard block |
||
1759 | 1759 | |
1760 | 1760 | for ($iter_day = 0; $iter_day < 7; $iter_day++) { |
1761 | 1761 | // Show days of the current week |
1762 | - $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1762 | + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server |
|
1763 | 1763 | $tmpday = (int) dol_print_date($curtime, '%d', 'tzuserrel'); |
1764 | 1764 | $tmpmonth = (int) dol_print_date($curtime, '%m', 'tzuserrel'); |
1765 | 1765 | $tmpyear = (int) dol_print_date($curtime, '%Y', 'tzuserrel'); |
@@ -1999,9 +1999,9 @@ discard block |
||
1999 | 1999 | $tmpholiday = new Holiday($db); |
2000 | 2000 | |
2001 | 2001 | foreach ($eventarray as $daykey => $notused) { // daykey is the 'YYYYMMDD' to show according to user |
2002 | - $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2003 | - $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2004 | - $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2002 | + $annee = (int) dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2003 | + $mois = (int) dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2004 | + $jour = (int) dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD' |
|
2005 | 2005 | |
2006 | 2006 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n"; |
2007 | 2007 | //print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' day='.$day.' month='.$month.' year='.$year."<br>\n"; |
@@ -2271,7 +2271,7 @@ discard block |
||
2271 | 2271 | $event->label = $titletoshow; |
2272 | 2272 | // Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user. |
2273 | 2273 | $titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : ''); |
2274 | - $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2274 | + $titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...' |
|
2275 | 2275 | $event->label = $savlabel; |
2276 | 2276 | } |
2277 | 2277 | |
@@ -2315,7 +2315,7 @@ discard block |
||
2315 | 2315 | $thirdparty = $cachethirdparties[$thirdparty_id]; |
2316 | 2316 | } |
2317 | 2317 | if (!empty($thirdparty->id)) { |
2318 | - $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2318 | + $linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2319 | 2319 | } |
2320 | 2320 | } |
2321 | 2321 | if (!empty($contact_id) && $contact_id > 0) { |
@@ -2330,7 +2330,7 @@ discard block |
||
2330 | 2330 | $linerelatedto .= ' '; |
2331 | 2331 | } |
2332 | 2332 | if (!empty($contact->id)) { |
2333 | - $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2333 | + $linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large |
|
2334 | 2334 | } |
2335 | 2335 | } |
2336 | 2336 | if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) { |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $langs->load("orders"); |
44 | 44 | |
45 | 45 | $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date,ref', 'desc', 0, 0, 1); |
46 | -'@phan-var-force Commande[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
46 | +'@phan-var-force Commande[] $linkedObjectBlock'; // Repeat because type lost after dol_sort_array) |
|
47 | 47 | /** @var Commande[] $linkedObjectBlock */ |
48 | 48 | |
49 | 49 | $total = 0; |