@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | $sql = 'SELECT rowid, type, rulevalue, status'; |
356 | 356 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'emailcollector_emailcollectorfilter'; |
357 | - $sql .= ' WHERE fk_emailcollector = ' . ((int)$this->id); |
|
357 | + $sql .= ' WHERE fk_emailcollector = ' . ((int) $this->id); |
|
358 | 358 | //$sql.= ' ORDER BY position'; |
359 | 359 | |
360 | 360 | $resql = $this->db->query($sql); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | $sql = 'SELECT rowid, type, actionparam, status'; |
388 | 388 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'emailcollector_emailcollectoraction'; |
389 | - $sql .= ' WHERE fk_emailcollector = ' . ((int)$this->id); |
|
389 | + $sql .= ' WHERE fk_emailcollector = ' . ((int) $this->id); |
|
390 | 390 | $sql .= ' ORDER BY position'; |
391 | 391 | |
392 | 392 | $resql = $this->db->query($sql); |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
618 | 618 | $sql .= ' fk_user_creat, fk_user_modif'; |
619 | 619 | $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
620 | - $sql .= ' WHERE t.rowid = ' . ((int)$id); |
|
620 | + $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
621 | 621 | $result = $this->db->query($sql); |
622 | 622 | if ($result) { |
623 | 623 | if ($this->db->num_rows($result)) { |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | } |
1126 | 1126 | |
1127 | 1127 | if ($rule['type'] == 'from') { |
1128 | - $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1128 | + $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1129 | 1129 | if (count($tmprulevaluearray) >= 2) { |
1130 | 1130 | foreach ($tmprulevaluearray as $tmprulevalue) { |
1131 | 1131 | $search .= ($search ? ' ' : '') . $not . 'FROM "' . str_replace('"', '', $tmprulevalue) . '"'; |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | if ($rule['type'] == 'to') { |
1138 | - $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1138 | + $tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def' |
|
1139 | 1139 | if (count($tmprulevaluearray) >= 2) { |
1140 | 1140 | foreach ($tmprulevaluearray as $tmprulevalue) { |
1141 | 1141 | $search .= ($search ? ' ' : '') . $not . 'TO "' . str_replace('"', '', $tmprulevalue) . '"'; |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | } |
1323 | 1323 | } |
1324 | 1324 | |
1325 | - $arrayofemailtodelete = array(); // Track email to delete to make the deletion at end. |
|
1325 | + $arrayofemailtodelete = array(); // Track email to delete to make the deletion at end. |
|
1326 | 1326 | |
1327 | 1327 | // Loop on each email found |
1328 | 1328 | if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) { |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | // $operationslog .= " - ".dol_escape_htmltag((string) $imapemail); |
1393 | 1393 | $msgid = str_replace(array('<', '>'), '', $overview['message_id']); |
1394 | 1394 | } else { |
1395 | - $operationslog .= " - " . dol_escape_htmltag((string)$imapemail); |
|
1395 | + $operationslog .= " - " . dol_escape_htmltag((string) $imapemail); |
|
1396 | 1396 | $msgid = str_replace(array('<', '>'), '', $overview[0]->message_id); |
1397 | 1397 | } |
1398 | 1398 | $operationslog .= " - MsgId: " . $msgid . " - References: " . dol_escape_htmltag($headers['References'] ?? '') . " - Subject: " . dol_escape_htmltag($headers['Subject']); |
@@ -1654,15 +1654,15 @@ discard block |
||
1654 | 1654 | $tmpdate = $overview['date']->toDate(); |
1655 | 1655 | $tmptimezone = $tmpdate->getTimezone()->getName(); |
1656 | 1656 | |
1657 | - $dateemail = dol_stringtotime((string)$overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00" |
|
1657 | + $dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00" |
|
1658 | 1658 | if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) { |
1659 | 1659 | if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) { |
1660 | - $dateemail -= (3600 * (int)$reg[2]); |
|
1661 | - $dateemail -= (60 * (int)$reg[3]); |
|
1660 | + $dateemail -= (3600 * (int) $reg[2]); |
|
1661 | + $dateemail -= (60 * (int) $reg[3]); |
|
1662 | 1662 | } |
1663 | 1663 | if ($reg[1] == '-' && ($reg[2] != '00' || $reg[3] != '00')) { |
1664 | - $dateemail += (3600 * (int)$reg[2]); |
|
1665 | - $dateemail += (60 * (int)$reg[3]); |
|
1664 | + $dateemail += (3600 * (int) $reg[2]); |
|
1665 | + $dateemail += (60 * (int) $reg[3]); |
|
1666 | 1666 | } |
1667 | 1667 | } |
1668 | 1668 | $subject = $overview['subject']; |
@@ -1674,7 +1674,7 @@ discard block |
||
1674 | 1674 | $to = $overview[0]->to; |
1675 | 1675 | $sendtocc = !empty($overview[0]->cc) ? $overview[0]->cc : ''; |
1676 | 1676 | $sendtobcc = !empty($overview[0]->bcc) ? $overview[0]->bcc : ''; |
1677 | - $dateemail = dol_stringtotime((string)$overview[0]->udate, 'gmt'); |
|
1677 | + $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt'); |
|
1678 | 1678 | $subject = $overview[0]->subject; |
1679 | 1679 | //var_dump($msgid);exit; |
1680 | 1680 | } |
@@ -1739,15 +1739,15 @@ discard block |
||
1739 | 1739 | foreach ($arrayofreferences as $reference) { |
1740 | 1740 | //print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n"; |
1741 | 1741 | if (!empty($trackidfoundintorecipienttype)) { |
1742 | - $resultsearchtrackid = -1; // trackid found |
|
1742 | + $resultsearchtrackid = -1; // trackid found |
|
1743 | 1743 | $reg[1] = $trackidfoundintorecipienttype; |
1744 | 1744 | $reg[2] = $trackidfoundintorecipientid; |
1745 | 1745 | } elseif (!empty($trackidfoundintomsgidtype)) { |
1746 | - $resultsearchtrackid = -1; // trackid found |
|
1746 | + $resultsearchtrackid = -1; // trackid found |
|
1747 | 1747 | $reg[1] = $trackidfoundintomsgidtype; |
1748 | 1748 | $reg[2] = $trackidfoundintomsgidid; |
1749 | 1749 | } else { |
1750 | - $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@' . preg_quote($host, '/') . '/', $reference, $reg); // trackid found or not |
|
1750 | + $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@' . preg_quote($host, '/') . '/', $reference, $reg); // trackid found or not |
|
1751 | 1751 | if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) { |
1752 | 1752 | $resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@' . preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/') . '/', $reference, $reg); // trackid found |
1753 | 1753 | } |
@@ -2045,7 +2045,7 @@ discard block |
||
2045 | 2045 | |
2046 | 2046 | // Make Operation |
2047 | 2047 | dol_syslog("Execute action " . $operation['type'] . " actionparam=" . $operation['actionparam'] . ' thirdpartystatic->id=' . $thirdpartystatic->id . ' contactstatic->id=' . $contactstatic->id . ' projectstatic->id=' . $projectstatic->id); |
2048 | - dol_syslog("Execute action fk_element_id=" . $fk_element_id . " fk_element_type=" . $fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object |
|
2048 | + dol_syslog("Execute action fk_element_id=" . $fk_element_id . " fk_element_type=" . $fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object |
|
2049 | 2049 | |
2050 | 2050 | // Try to guess if this is an email in or out. |
2051 | 2051 | $actioncode = 'EMAIL_IN'; |
@@ -2098,7 +2098,7 @@ discard block |
||
2098 | 2098 | $operationslog .= '<br>Ticket not found using trackid=' . $trackid . ' or msgid=' . $msgid; |
2099 | 2099 | $ticketalreadyexists = 0; |
2100 | 2100 | } else { |
2101 | - $operationslog .= '<br>Ticket already found using trackid=' . $trackid . ' or msgid=' . $msgid; // We change the operation type to do |
|
2101 | + $operationslog .= '<br>Ticket already found using trackid=' . $trackid . ' or msgid=' . $msgid; // We change the operation type to do |
|
2102 | 2102 | $ticketalreadyexists = 1; |
2103 | 2103 | $operation['type'] = 'recordevent'; |
2104 | 2104 | } |
@@ -2472,8 +2472,8 @@ discard block |
||
2472 | 2472 | $actioncomm->label = $langs->trans("ActionAC_" . $actioncode) . ' - ' . $langs->trans("MailFrom") . ' ' . $from; |
2473 | 2473 | $actioncomm->note_private = $descriptionfull; |
2474 | 2474 | $actioncomm->fk_project = $projectstatic->id; |
2475 | - $actioncomm->datep = $dateemail; // date of email |
|
2476 | - $actioncomm->datef = $dateemail; // date of email |
|
2475 | + $actioncomm->datep = $dateemail; // date of email |
|
2476 | + $actioncomm->datef = $dateemail; // date of email |
|
2477 | 2477 | $actioncomm->percentage = -1; // Not applicable |
2478 | 2478 | $actioncomm->socid = $thirdpartystatic->id; |
2479 | 2479 | $actioncomm->contact_id = $contactstatic->id; |
@@ -2671,7 +2671,7 @@ discard block |
||
2671 | 2671 | } |
2672 | 2672 | $hookmanager->initHooks(array('emailcolector')); |
2673 | 2673 | $parameters = array('arrayobject' => $arrayobject); |
2674 | - $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks |
|
2674 | + $reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks |
|
2675 | 2675 | if ($reshook > 0) { |
2676 | 2676 | $arrayobject = $hookmanager->resArray; |
2677 | 2677 | } |
@@ -2760,7 +2760,7 @@ discard block |
||
2760 | 2760 | $percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent'); |
2761 | 2761 | |
2762 | 2762 | $projecttocreate->title = $subject; |
2763 | - $projecttocreate->date_start = $date; // date of email |
|
2763 | + $projecttocreate->date_start = $date; // date of email |
|
2764 | 2764 | $projecttocreate->date_end = 0; |
2765 | 2765 | $projecttocreate->opp_status = $id_opp_status; |
2766 | 2766 | $projecttocreate->opp_percent = $percent_opp_status; |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | $file = ''; |
2786 | 2786 | $classname = ''; |
2787 | 2787 | $reldir = ''; |
2788 | - $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); |
|
2788 | + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
|
2789 | 2789 | foreach ($dirmodels as $reldir) { |
2790 | 2790 | $file = dol_buildpath($reldir . "core/modules/project/" . $modele . '.php', 0); |
2791 | 2791 | if (file_exists($file)) { |
@@ -2840,7 +2840,7 @@ discard block |
||
2840 | 2840 | if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) { |
2841 | 2841 | foreach ($attachments as $attachment) { |
2842 | 2842 | // $attachment->save($destdir.'/'); |
2843 | - $typeattachment = (string)$attachment->getDisposition(); |
|
2843 | + $typeattachment = (string) $attachment->getDisposition(); |
|
2844 | 2844 | $filename = $attachment->getFilename(); |
2845 | 2845 | $content = $attachment->getContent(); |
2846 | 2846 | $this->saveAttachment($destdir, $filename, $content); |
@@ -2925,7 +2925,7 @@ discard block |
||
2925 | 2925 | $file = ''; |
2926 | 2926 | $classname = ''; |
2927 | 2927 | $reldir = ''; |
2928 | - $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); |
|
2928 | + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
|
2929 | 2929 | foreach ($dirmodels as $reldir) { |
2930 | 2930 | $file = dol_buildpath($reldir . "core/modules/ticket/" . $modele . '.php', 0); |
2931 | 2931 | if (file_exists($file)) { |
@@ -2975,7 +2975,7 @@ discard block |
||
2975 | 2975 | if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) { |
2976 | 2976 | foreach ($attachments as $attachment) { |
2977 | 2977 | // $attachment->save($destdir.'/'); |
2978 | - $typeattachment = (string)$attachment->getDisposition(); |
|
2978 | + $typeattachment = (string) $attachment->getDisposition(); |
|
2979 | 2979 | $filename = $attachment->getFilename(); |
2980 | 2980 | $content = $attachment->getContent(); |
2981 | 2981 | $this->saveAttachment($destdir, $filename, $content); |
@@ -3022,7 +3022,7 @@ discard block |
||
3022 | 3022 | $candidaturetocreate->note_private = $descriptionfull; |
3023 | 3023 | $candidaturetocreate->entity = $conf->entity; |
3024 | 3024 | $candidaturetocreate->email_msgid = $msgid; |
3025 | - $candidaturetocreate->email_date = $date; // date of email |
|
3025 | + $candidaturetocreate->email_date = $date; // date of email |
|
3026 | 3026 | $candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT; |
3027 | 3027 | //$candidaturetocreate->fk_contact = $contactstatic->id; |
3028 | 3028 | |
@@ -3324,8 +3324,8 @@ discard block |
||
3324 | 3324 | { |
3325 | 3325 | if (function_exists('mb_convert_encoding')) { |
3326 | 3326 | // change spaces by entropy because mb_convert fail with spaces |
3327 | - $str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
3328 | - $str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
3327 | + $str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
3328 | + $str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used |
|
3329 | 3329 | // if mb_convert work |
3330 | 3330 | if ($str = mb_convert_encoding($str, "UTF-7")) { |
3331 | 3331 | // change characters |
@@ -3851,7 +3851,7 @@ discard block |
||
3851 | 3851 | if (is_object($imapemail)) { |
3852 | 3852 | return $imapemail->getAttributes()["uid"]; |
3853 | 3853 | } else { |
3854 | - return (string)$imapemail; |
|
3854 | + return (string) $imapemail; |
|
3855 | 3855 | } |
3856 | 3856 | } |
3857 | 3857 | } |
@@ -367,18 +367,18 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * Create an invoice using a contract. |
|
371 | - * |
|
372 | - * @param int $contractid Id of the contract |
|
373 | - * @return Object Object with cleaned properties |
|
374 | - * |
|
375 | - * @url POST /createfromcontract/{contractid} |
|
376 | - * |
|
377 | - * @throws RestException 400 |
|
378 | - * @throws RestException 401 |
|
379 | - * @throws RestException 404 |
|
380 | - * @throws RestException 405 |
|
381 | - */ |
|
370 | + * Create an invoice using a contract. |
|
371 | + * |
|
372 | + * @param int $contractid Id of the contract |
|
373 | + * @return Object Object with cleaned properties |
|
374 | + * |
|
375 | + * @url POST /createfromcontract/{contractid} |
|
376 | + * |
|
377 | + * @throws RestException 400 |
|
378 | + * @throws RestException 401 |
|
379 | + * @throws RestException 404 |
|
380 | + * @throws RestException 405 |
|
381 | + */ |
|
382 | 382 | public function createInvoiceFromContract($contractid) |
383 | 383 | { |
384 | 384 | |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | ]; |
1728 | 1728 | } |
1729 | 1729 | |
1730 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1730 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1731 | 1731 | /** |
1732 | 1732 | * Clean sensible object datas |
1733 | 1733 | * |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | */ |
1737 | 1737 | protected function _cleanObjectDatas($object) |
1738 | 1738 | { |
1739 | - // phpcs:enable |
|
1739 | + // phpcs:enable |
|
1740 | 1740 | $object = parent::_cleanObjectDatas($object); |
1741 | 1741 | |
1742 | 1742 | unset($object->note); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | |
1833 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1833 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
1834 | 1834 | /** |
1835 | 1835 | * Clean sensible object datas |
1836 | 1836 | * |
@@ -1839,7 +1839,7 @@ discard block |
||
1839 | 1839 | */ |
1840 | 1840 | protected function _cleanTemplateObjectDatas($object) |
1841 | 1841 | { |
1842 | - // phpcs:enable |
|
1842 | + // phpcs:enable |
|
1843 | 1843 | $object = parent::_cleanObjectDatas($object); |
1844 | 1844 | |
1845 | 1845 | unset($object->note); |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | /** |
417 | 417 | * @var float Multicurrency total VAT amount (TVA = "Taxe sur la Valeur Ajoutée" in French) |
418 | 418 | */ |
419 | - public $multicurrency_total_tva; // Private to call DolDeprecationHandler |
|
419 | + public $multicurrency_total_tva; // Private to call DolDeprecationHandler |
|
420 | 420 | /** |
421 | 421 | * @var float Multicurrency total amount including taxes (TTC = "Toutes Taxes Comprises" in French) |
422 | 422 | */ |
423 | - public $multicurrency_total_ttc; // Internal value for deprecation |
|
423 | + public $multicurrency_total_ttc; // Internal value for deprecation |
|
424 | 424 | /** |
425 | 425 | * @var float Multicurrency total localta1 |
426 | 426 | */ |
@@ -472,12 +472,12 @@ discard block |
||
472 | 472 | * @var float Total amount excluding taxes (HT = "Hors Taxe" in French) |
473 | 473 | * @see update_price() |
474 | 474 | */ |
475 | - public $total_ht; // not in database |
|
475 | + public $total_ht; // not in database |
|
476 | 476 | /** |
477 | 477 | * @var float Total VAT amount (TVA = "Taxe sur la Valeur Ajoutée" in French) |
478 | 478 | * @see update_price() |
479 | 479 | */ |
480 | - public $total_tva; // not in database |
|
480 | + public $total_tva; // not in database |
|
481 | 481 | /** |
482 | 482 | * @var float Total local tax 1 amount |
483 | 483 | * @see update_price() |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | $sql .= " WHERE entity IN (" . getEntity($element) . ")"; |
768 | 768 | |
769 | 769 | if ($id > 0) { |
770 | - $sql .= " AND rowid = " . ((int)$id); |
|
770 | + $sql .= " AND rowid = " . ((int) $id); |
|
771 | 771 | } elseif ($ref) { |
772 | 772 | $sql .= " AND ref = '" . $db->escape($ref) . "'"; |
773 | 773 | } elseif ($ref_ext) { |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | return -1; |
779 | 779 | } |
780 | 780 | if ($ref || $ref_ext) { // Because the same ref can exists in 2 different entities, we force the current one in priority |
781 | - $sql .= " AND entity = " . ((int)$conf->entity); |
|
781 | + $sql .= " AND entity = " . ((int) $conf->entity); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | dol_syslog(get_class() . "::isExistingObject", LOG_DEBUG); |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | global $db; |
816 | 816 | |
817 | - $sql = "SELECT " . $field_select . " FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int)$fk_object_where); |
|
817 | + $sql = "SELECT " . $field_select . " FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int) $fk_object_where); |
|
818 | 818 | $resql = $db->query($sql); |
819 | 819 | |
820 | 820 | $TRes = array(); |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | |
844 | 844 | global $db; |
845 | 845 | |
846 | - $sql = "SELECT COUNT(*) as nb FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int)$fk_object_where); |
|
846 | + $sql = "SELECT COUNT(*) as nb FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int) $fk_object_where); |
|
847 | 847 | $resql = $db->query($sql); |
848 | 848 | $n = 0; |
849 | 849 | if ($resql) { |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | |
873 | 873 | global $db; |
874 | 874 | |
875 | - $sql = "DELETE FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int)$fk_object_where); |
|
875 | + $sql = "DELETE FROM " . $db->prefix() . $table_element . " WHERE " . $field_where . " = " . ((int) $fk_object_where); |
|
876 | 876 | $resql = $db->query($sql); |
877 | 877 | |
878 | 878 | if (empty($resql)) { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | public static function commonReplaceThirdparty(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) |
898 | 898 | { |
899 | 899 | foreach ($tables as $table) { |
900 | - $sql = 'UPDATE ' . $dbs->prefix() . $table . ' SET fk_soc = ' . ((int)$dest_id) . ' WHERE fk_soc = ' . ((int)$origin_id); |
|
900 | + $sql = 'UPDATE ' . $dbs->prefix() . $table . ' SET fk_soc = ' . ((int) $dest_id) . ' WHERE fk_soc = ' . ((int) $origin_id); |
|
901 | 901 | |
902 | 902 | if (!$dbs->query($sql)) { |
903 | 903 | if ($ignoreerrors) { |
@@ -926,7 +926,7 @@ discard block |
||
926 | 926 | public static function commonReplaceProduct(DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) |
927 | 927 | { |
928 | 928 | foreach ($tables as $table) { |
929 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . $table . ' SET fk_product = ' . ((int)$dest_id) . ' WHERE fk_product = ' . ((int)$origin_id); |
|
929 | + $sql = 'UPDATE ' . MAIN_DB_PREFIX . $table . ' SET fk_product = ' . ((int) $dest_id) . ' WHERE fk_product = ' . ((int) $origin_id); |
|
930 | 930 | |
931 | 931 | if (!$dbs->query($sql)) { |
932 | 932 | if ($ignoreerrors) { |
@@ -996,14 +996,14 @@ discard block |
||
996 | 996 | } |
997 | 997 | $enabled = 1; |
998 | 998 | if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) { |
999 | - $enabled = (int)dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2'); |
|
999 | + $enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2'); |
|
1000 | 1000 | } |
1001 | 1001 | if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key])) { |
1002 | - $enabled = (int)dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2'); |
|
1002 | + $enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2'); |
|
1003 | 1003 | } |
1004 | 1004 | $perms = 1; |
1005 | 1005 | if ($perms && isset($extrafields->attributes[$this->table_element]['perms'][$key])) { |
1006 | - $perms = (int)dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2'); |
|
1006 | + $perms = (int) dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2'); |
|
1007 | 1007 | } |
1008 | 1008 | if (empty($enabled)) { |
1009 | 1009 | continue; // 0 = Never visible field |
@@ -1017,7 +1017,7 @@ discard block |
||
1017 | 1017 | if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { |
1018 | 1018 | $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); |
1019 | 1019 | } |
1020 | - $labelextra = $langs->trans((string)$extrafields->attributes[$this->table_element]['label'][$key]); |
|
1020 | + $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
|
1021 | 1021 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
1022 | 1022 | $data[$key] = '<br><b><u>' . $labelextra . '</u></b>'; |
1023 | 1023 | } else { |
@@ -1157,9 +1157,9 @@ discard block |
||
1157 | 1157 | } elseif ($type == 'boolean') { |
1158 | 1158 | $morecss = ''; |
1159 | 1159 | } else { |
1160 | - if (is_numeric($size) && round((float)$size) < 12) { |
|
1160 | + if (is_numeric($size) && round((float) $size) < 12) { |
|
1161 | 1161 | $morecss = 'minwidth100'; |
1162 | - } elseif (is_numeric($size) && round((float)$size) <= 48) { |
|
1162 | + } elseif (is_numeric($size) && round((float) $size) <= 48) { |
|
1163 | 1163 | $morecss = 'minwidth200'; |
1164 | 1164 | } else { |
1165 | 1165 | $morecss = 'minwidth400'; |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
1219 | 1219 | } |
1220 | 1220 | } elseif ($type == 'select') { |
1221 | - $value = isset($param['options'][(string)$value]) ? $param['options'][(string)$value] : ''; |
|
1221 | + $value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : ''; |
|
1222 | 1222 | if (strpos($value, "|") !== false) { |
1223 | 1223 | $value = $langs->trans(explode('|', $value)[0]); |
1224 | 1224 | } elseif (!is_numeric($value)) { |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | if ($selectkey == 'rowid' && empty($value)) { |
1258 | 1258 | $sql .= " WHERE " . $selectkey . " = 0"; |
1259 | 1259 | } elseif ($selectkey == 'rowid') { |
1260 | - $sql .= " WHERE " . $selectkey . " = " . ((int)$value); |
|
1260 | + $sql .= " WHERE " . $selectkey . " = " . ((int) $value); |
|
1261 | 1261 | } else { |
1262 | 1262 | $sql .= " WHERE " . $selectkey . " = '" . $this->db->escape($value) . "'"; |
1263 | 1263 | } |
@@ -1315,9 +1315,9 @@ discard block |
||
1315 | 1315 | dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING); |
1316 | 1316 | } |
1317 | 1317 | } elseif ($type == 'radio') { |
1318 | - $value = $param['options'][(string)$value]; |
|
1318 | + $value = $param['options'][(string) $value]; |
|
1319 | 1319 | } elseif ($type == 'checkbox') { |
1320 | - $value_arr = explode(',', (string)$value); |
|
1320 | + $value_arr = explode(',', (string) $value); |
|
1321 | 1321 | $value = ''; |
1322 | 1322 | if (is_array($value_arr) && count($value_arr) > 0) { |
1323 | 1323 | $toprint = array(); |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | if ($source == 'external' || $source == 'thirdparty') { // external contact (socpeople) |
1742 | 1742 | $sql .= " LEFT JOIN " . $this->db->prefix() . "socpeople t on ec.fk_socpeople = t.rowid"; |
1743 | 1743 | } |
1744 | - $sql .= " WHERE ec.element_id = " . ((int)$this->id); |
|
1744 | + $sql .= " WHERE ec.element_id = " . ((int) $this->id); |
|
1745 | 1745 | $sql .= " AND ec.fk_c_type_contact = tc.rowid"; |
1746 | 1746 | $sql .= " AND tc.element = '" . $this->db->escape($this->element) . "'"; |
1747 | 1747 | if ($code) { |
@@ -1750,18 +1750,18 @@ discard block |
||
1750 | 1750 | if ($source == 'internal') { |
1751 | 1751 | $sql .= " AND tc.source = 'internal'"; |
1752 | 1752 | if ($status >= 0) { |
1753 | - $sql .= " AND t.statut = " . ((int)$status); |
|
1753 | + $sql .= " AND t.statut = " . ((int) $status); |
|
1754 | 1754 | } |
1755 | 1755 | } |
1756 | 1756 | if ($source == 'external' || $source == 'thirdparty') { |
1757 | 1757 | $sql .= " AND tc.source = 'external'"; |
1758 | 1758 | if ($status >= 0) { |
1759 | - $sql .= " AND t.statut = " . ((int)$status); // t is llx_socpeople |
|
1759 | + $sql .= " AND t.statut = " . ((int) $status); // t is llx_socpeople |
|
1760 | 1760 | } |
1761 | 1761 | } |
1762 | 1762 | $sql .= " AND tc.active = 1"; |
1763 | 1763 | if ($statusoflink >= 0) { |
1764 | - $sql .= " AND ec.statut = " . ((int)$statusoflink); |
|
1764 | + $sql .= " AND ec.statut = " . ((int) $statusoflink); |
|
1765 | 1765 | } |
1766 | 1766 | $sql .= " ORDER BY t.lastname ASC"; |
1767 | 1767 | |
@@ -1889,9 +1889,9 @@ discard block |
||
1889 | 1889 | // Insert into database |
1890 | 1890 | $sql = "INSERT INTO " . $this->db->prefix() . "element_contact"; |
1891 | 1891 | $sql .= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; |
1892 | - $sql .= " VALUES (" . $this->id . ", " . ((int)$fk_socpeople) . " , "; |
|
1892 | + $sql .= " VALUES (" . $this->id . ", " . ((int) $fk_socpeople) . " , "; |
|
1893 | 1893 | $sql .= "'" . $this->db->idate($datecreate) . "'"; |
1894 | - $sql .= ", 4, " . ((int)$id_type_contact); |
|
1894 | + $sql .= ", 4, " . ((int) $id_type_contact); |
|
1895 | 1895 | $sql .= ")"; |
1896 | 1896 | |
1897 | 1897 | $resql = $this->db->query($sql); |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | |
1979 | 1979 | if (!$error && empty($notrigger)) { |
1980 | 1980 | // Call trigger |
1981 | - $this->context['contact_id'] = ((int)$rowid); |
|
1981 | + $this->context['contact_id'] = ((int) $rowid); |
|
1982 | 1982 | $result = $this->call_trigger(strtoupper($this->element) . '_DELETE_CONTACT', $user); |
1983 | 1983 | if ($result < 0) { |
1984 | 1984 | $error++; |
@@ -1990,7 +1990,7 @@ discard block |
||
1990 | 1990 | dol_syslog(get_class($this) . "::delete_contact", LOG_DEBUG); |
1991 | 1991 | |
1992 | 1992 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "element_contact"; |
1993 | - $sql .= " WHERE rowid = " . ((int)$rowid); |
|
1993 | + $sql .= " WHERE rowid = " . ((int) $rowid); |
|
1994 | 1994 | |
1995 | 1995 | $result = $this->db->query($sql); |
1996 | 1996 | if (!$result) { |
@@ -2039,7 +2039,7 @@ discard block |
||
2039 | 2039 | } |
2040 | 2040 | |
2041 | 2041 | $sql = "DELETE FROM " . $this->db->prefix() . "element_contact"; |
2042 | - $sql .= " WHERE element_id = " . ((int)$this->id); |
|
2042 | + $sql .= " WHERE element_id = " . ((int) $this->id); |
|
2043 | 2043 | $sql .= " AND fk_c_type_contact IN (" . $this->db->sanitize($listId) . ")"; |
2044 | 2044 | |
2045 | 2045 | dol_syslog(get_class($this) . "::delete_linked_contact", LOG_DEBUG); |
@@ -2126,7 +2126,7 @@ discard block |
||
2126 | 2126 | $sql = "SELECT ec.datecreate, ec.statut, ec.fk_socpeople, ec.fk_c_type_contact,"; |
2127 | 2127 | $sql .= " tc.code, tc.libelle as type_label"; |
2128 | 2128 | $sql .= " FROM (" . $this->db->prefix() . "element_contact as ec, " . $this->db->prefix() . "c_type_contact as tc)"; |
2129 | - $sql .= " WHERE ec.rowid =" . ((int)$rowid); |
|
2129 | + $sql .= " WHERE ec.rowid =" . ((int) $rowid); |
|
2130 | 2130 | $sql .= " AND ec.fk_c_type_contact = tc.rowid"; |
2131 | 2131 | $sql .= " AND tc.element = '" . $this->db->escape($this->element) . "'"; |
2132 | 2132 | |
@@ -2163,12 +2163,12 @@ discard block |
||
2163 | 2163 | $sql = "UPDATE " . $this->db->prefix() . "element_contact set"; |
2164 | 2164 | $sql .= " statut = " . $statut; |
2165 | 2165 | if ($type_contact_id) { |
2166 | - $sql .= ", fk_c_type_contact = " . ((int)$type_contact_id); |
|
2166 | + $sql .= ", fk_c_type_contact = " . ((int) $type_contact_id); |
|
2167 | 2167 | } |
2168 | 2168 | if ($fk_socpeople) { |
2169 | - $sql .= ", fk_socpeople = " . ((int)$fk_socpeople); |
|
2169 | + $sql .= ", fk_socpeople = " . ((int) $fk_socpeople); |
|
2170 | 2170 | } |
2171 | - $sql .= " where rowid = " . ((int)$rowid); |
|
2171 | + $sql .= " where rowid = " . ((int) $rowid); |
|
2172 | 2172 | $resql = $this->db->query($sql); |
2173 | 2173 | if ($resql) { |
2174 | 2174 | return 0; |
@@ -2302,7 +2302,7 @@ discard block |
||
2302 | 2302 | $sql .= " " . $this->db->prefix() . "socpeople as c,"; |
2303 | 2303 | } |
2304 | 2304 | $sql .= " " . $this->db->prefix() . "c_type_contact as tc"; |
2305 | - $sql .= " WHERE ec.element_id = " . ((int)$id); |
|
2305 | + $sql .= " WHERE ec.element_id = " . ((int) $id); |
|
2306 | 2306 | $sql .= " AND ec.fk_socpeople = c.rowid"; |
2307 | 2307 | if ($source == 'internal') { |
2308 | 2308 | $sql .= " AND c.entity IN (" . getEntity('user') . ")"; |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | } |
2319 | 2319 | $sql .= " AND tc.active = 1"; |
2320 | 2320 | if ($status) { |
2321 | - $sql .= " AND ec.statut = " . ((int)$status); |
|
2321 | + $sql .= " AND ec.statut = " . ((int) $status); |
|
2322 | 2322 | } |
2323 | 2323 | |
2324 | 2324 | dol_syslog(get_class($this) . "::getIdContact", LOG_DEBUG); |
@@ -2467,7 +2467,7 @@ discard block |
||
2467 | 2467 | if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) { // If data not already loaded |
2468 | 2468 | $sql = "SELECT rowid, code, libelle as label, coder"; |
2469 | 2469 | $sql .= " FROM " . $this->db->prefix() . "c_barcode_type"; |
2470 | - $sql .= " WHERE rowid = " . ((int)$idtype); |
|
2470 | + $sql .= " WHERE rowid = " . ((int) $idtype); |
|
2471 | 2471 | dol_syslog(get_class($this) . '::fetch_barcode', LOG_DEBUG); |
2472 | 2472 | $resql = $this->db->query($sql); |
2473 | 2473 | if ($resql) { |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | if (!empty($element)) { |
2587 | 2587 | $sql .= " AND entity IN (" . getEntity($element) . ")"; |
2588 | 2588 | } else { |
2589 | - $sql .= " AND entity = " . ((int)$conf->entity); |
|
2589 | + $sql .= " AND entity = " . ((int) $conf->entity); |
|
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | dol_syslog(get_class($this) . '::fetchObjectFrom', LOG_DEBUG); |
@@ -2622,7 +2622,7 @@ discard block |
||
2622 | 2622 | $result = false; |
2623 | 2623 | if (!empty($id) && !empty($field) && !empty($table)) { |
2624 | 2624 | $sql = "SELECT " . $field . " FROM " . $this->db->prefix() . $table; |
2625 | - $sql .= " WHERE rowid = " . ((int)$id); |
|
2625 | + $sql .= " WHERE rowid = " . ((int) $id); |
|
2626 | 2626 | |
2627 | 2627 | dol_syslog(get_class($this) . '::getValueFrom', LOG_DEBUG); |
2628 | 2628 | $resql = $this->db->query($sql); |
@@ -2683,7 +2683,7 @@ discard block |
||
2683 | 2683 | if ($trigkey) { |
2684 | 2684 | $sql = "SELECT " . $field; |
2685 | 2685 | $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
2686 | - $sql .= " WHERE " . $id_field . " = " . ((int)$id); |
|
2686 | + $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
2687 | 2687 | |
2688 | 2688 | $resql = $this->db->query($sql); |
2689 | 2689 | if ($resql) { |
@@ -2711,7 +2711,7 @@ discard block |
||
2711 | 2711 | if ($format == 'text') { |
2712 | 2712 | $sql .= $field . " = '" . $this->db->escape($value) . "'"; |
2713 | 2713 | } elseif ($format == 'int') { |
2714 | - $sql .= $field . " = " . ((int)$value); |
|
2714 | + $sql .= $field . " = " . ((int) $value); |
|
2715 | 2715 | } elseif ($format == 'date') { |
2716 | 2716 | $sql .= $field . " = " . ($value ? "'" . $this->db->idate($value) . "'" : "null"); |
2717 | 2717 | } elseif ($format == 'dategmt') { |
@@ -2720,13 +2720,13 @@ discard block |
||
2720 | 2720 | |
2721 | 2721 | if ($fk_user_field) { |
2722 | 2722 | if (!empty($fuser) && is_object($fuser)) { |
2723 | - $sql .= ", " . $fk_user_field . " = " . ((int)$fuser->id); |
|
2723 | + $sql .= ", " . $fk_user_field . " = " . ((int) $fuser->id); |
|
2724 | 2724 | } elseif (empty($fuser) || $fuser != 'none') { |
2725 | - $sql .= ", " . $fk_user_field . " = " . ((int)$user->id); |
|
2725 | + $sql .= ", " . $fk_user_field . " = " . ((int) $user->id); |
|
2726 | 2726 | } |
2727 | 2727 | } |
2728 | 2728 | |
2729 | - $sql .= " WHERE " . $id_field . " = " . ((int)$id); |
|
2729 | + $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
2730 | 2730 | |
2731 | 2731 | $resql = $this->db->query($sql); |
2732 | 2732 | if ($resql) { |
@@ -2795,7 +2795,7 @@ discard block |
||
2795 | 2795 | $sql .= " FROM " . $this->db->prefix() . $this->table_element . ' as t'; |
2796 | 2796 | |
2797 | 2797 | if (!empty($id)) { |
2798 | - $sql .= ' WHERE t.rowid = ' . ((int)$id); |
|
2798 | + $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
2799 | 2799 | } elseif (!empty($ref)) { |
2800 | 2800 | $sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'"; |
2801 | 2801 | } else { |
@@ -2882,17 +2882,17 @@ discard block |
||
2882 | 2882 | } |
2883 | 2883 | } elseif ($this->isInt($info)) { |
2884 | 2884 | if ($field == 'rowid') { |
2885 | - $this->id = (int)$obj->$field; |
|
2885 | + $this->id = (int) $obj->$field; |
|
2886 | 2886 | } else { |
2887 | 2887 | if ($this->isForcedToNullIfZero($info)) { |
2888 | 2888 | if (empty($obj->$field)) { |
2889 | 2889 | $this->$field = null; |
2890 | 2890 | } else { |
2891 | - $this->$field = (int)$obj->$field; |
|
2891 | + $this->$field = (int) $obj->$field; |
|
2892 | 2892 | } |
2893 | 2893 | } else { |
2894 | 2894 | if (isset($obj->$field) && (!is_null($obj->$field) || (array_key_exists('notnull', $info) && $info['notnull'] == 1))) { |
2895 | - $this->$field = (int)$obj->$field; |
|
2895 | + $this->$field = (int) $obj->$field; |
|
2896 | 2896 | } else { |
2897 | 2897 | $this->$field = null; |
2898 | 2898 | } |
@@ -2903,11 +2903,11 @@ discard block |
||
2903 | 2903 | if (empty($obj->$field)) { |
2904 | 2904 | $this->$field = null; |
2905 | 2905 | } else { |
2906 | - $this->$field = (float)$obj->$field; |
|
2906 | + $this->$field = (float) $obj->$field; |
|
2907 | 2907 | } |
2908 | 2908 | } else { |
2909 | 2909 | if (isset($obj->$field) && (!is_null($obj->$field) || (array_key_exists('notnull', $info) && $info['notnull'] == 1))) { |
2910 | - $this->$field = (float)$obj->$field; |
|
2910 | + $this->$field = (float) $obj->$field; |
|
2911 | 2911 | } else { |
2912 | 2912 | $this->$field = null; |
2913 | 2913 | } |
@@ -2919,7 +2919,7 @@ discard block |
||
2919 | 2919 | |
2920 | 2920 | // If there is no 'ref' field, we force property ->ref to ->id for a better compatibility with common functions. |
2921 | 2921 | if (!isset($this->fields['ref']) && isset($this->id)) { |
2922 | - $this->ref = (string)$this->id; |
|
2922 | + $this->ref = (string) $this->id; |
|
2923 | 2923 | } |
2924 | 2924 | } |
2925 | 2925 | |
@@ -3063,7 +3063,7 @@ discard block |
||
3063 | 3063 | } |
3064 | 3064 | } |
3065 | 3065 | $sql .= " FROM " . $this->db->prefix() . $table_element . "_extrafields"; |
3066 | - $sql .= " WHERE fk_object = " . ((int)$rowid); |
|
3066 | + $sql .= " WHERE fk_object = " . ((int) $rowid); |
|
3067 | 3067 | |
3068 | 3068 | //dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose |
3069 | 3069 | $resql = $this->db->query($sql); |
@@ -3110,8 +3110,8 @@ discard block |
||
3110 | 3110 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
3111 | 3111 | //var_dump($conf->disable_compute); |
3112 | 3112 | if (empty($conf->disable_compute)) { |
3113 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
3114 | - $objectoffield = $this; // we can use it inside computed formula |
|
3113 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
3114 | + $objectoffield = $this; // we can use it inside computed formula |
|
3115 | 3115 | $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
3116 | 3116 | } |
3117 | 3117 | } |
@@ -3188,15 +3188,15 @@ discard block |
||
3188 | 3188 | $sql .= " LEFT JOIN " . $this->db->prefix() . "societe_commerciaux as sc ON " . $aliastablesociete . ".rowid = sc.fk_soc"; |
3189 | 3189 | } |
3190 | 3190 | if ($fieldid == 'rowid') { |
3191 | - $sql .= " WHERE te." . $fieldid . " < " . ((int)$this->id); |
|
3191 | + $sql .= " WHERE te." . $fieldid . " < " . ((int) $this->id); |
|
3192 | 3192 | } else { |
3193 | 3193 | $sql .= " WHERE te." . $fieldid . " < '" . $this->db->escape($this->ref) . "'"; // ->ref must always be defined (set to id if field does not exists) |
3194 | 3194 | } |
3195 | 3195 | if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) { |
3196 | - $sql .= " AND sc.fk_user = " . ((int)$user->id); |
|
3196 | + $sql .= " AND sc.fk_user = " . ((int) $user->id); |
|
3197 | 3197 | } |
3198 | 3198 | if ($restrictiononfksoc == 2 && !$user->hasRight('societe', 'client', 'voir') && !$socid) { |
3199 | - $sql .= " AND (sc.fk_user = " . ((int)$user->id) . ' OR te.fk_soc IS NULL)'; |
|
3199 | + $sql .= " AND (sc.fk_user = " . ((int) $user->id) . ' OR te.fk_soc IS NULL)'; |
|
3200 | 3200 | } |
3201 | 3201 | |
3202 | 3202 | $filtermax = $filter; |
@@ -3235,13 +3235,13 @@ discard block |
||
3235 | 3235 | $sql .= ' AND parenttable.entity IN (' . getEntity($tmparray[1]) . ')'; |
3236 | 3236 | } |
3237 | 3237 | if ($restrictiononfksoc == 1 && $socid && $this->element != 'societe') { |
3238 | - $sql .= ' AND te.fk_soc = ' . ((int)$socid); |
|
3238 | + $sql .= ' AND te.fk_soc = ' . ((int) $socid); |
|
3239 | 3239 | } |
3240 | 3240 | if ($restrictiononfksoc == 2 && $socid && $this->element != 'societe') { |
3241 | - $sql .= ' AND (te.fk_soc = ' . ((int)$socid) . ' OR te.fk_soc IS NULL)'; |
|
3241 | + $sql .= ' AND (te.fk_soc = ' . ((int) $socid) . ' OR te.fk_soc IS NULL)'; |
|
3242 | 3242 | } |
3243 | 3243 | if ($restrictiononfksoc && $socid && $this->element == 'societe') { |
3244 | - $sql .= ' AND te.rowid = ' . ((int)$socid); |
|
3244 | + $sql .= ' AND te.rowid = ' . ((int) $socid); |
|
3245 | 3245 | } |
3246 | 3246 | //print 'socid='.$socid.' restrictiononfksoc='.$restrictiononfksoc.' ismultientitymanaged = '.$this->ismultientitymanaged.' filter = '.$filter.' -> '.$sql."<br>"; |
3247 | 3247 | |
@@ -3267,12 +3267,12 @@ discard block |
||
3267 | 3267 | $sql .= " LEFT JOIN " . $this->db->prefix() . "societe_commerciaux as sc ON " . $aliastablesociete . ".rowid = sc.fk_soc"; |
3268 | 3268 | } |
3269 | 3269 | if ($fieldid == 'rowid') { |
3270 | - $sql .= " WHERE te." . $fieldid . " > " . ((int)$this->id); |
|
3270 | + $sql .= " WHERE te." . $fieldid . " > " . ((int) $this->id); |
|
3271 | 3271 | } else { |
3272 | 3272 | $sql .= " WHERE te." . $fieldid . " > '" . $this->db->escape($this->ref) . "'"; // ->ref must always be defined (set to id if field does not exists) |
3273 | 3273 | } |
3274 | 3274 | if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) { |
3275 | - $sql .= " AND (sc.fk_user = " . ((int)$user->id); |
|
3275 | + $sql .= " AND (sc.fk_user = " . ((int) $user->id); |
|
3276 | 3276 | if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { |
3277 | 3277 | $userschilds = $user->getAllChildIds(); |
3278 | 3278 | $sql .= " OR sc.fk_user IN (" . $this->db->sanitize(implode(',', $userschilds)) . ")"; |
@@ -3280,7 +3280,7 @@ discard block |
||
3280 | 3280 | $sql .= ')'; |
3281 | 3281 | } |
3282 | 3282 | if ($restrictiononfksoc == 2 && !$user->hasRight('societe', 'client', 'voir') && !$socid) { |
3283 | - $sql .= " AND (sc.fk_user = " . ((int)$user->id) . ' OR te.fk_soc IS NULL)'; |
|
3283 | + $sql .= " AND (sc.fk_user = " . ((int) $user->id) . ' OR te.fk_soc IS NULL)'; |
|
3284 | 3284 | } |
3285 | 3285 | |
3286 | 3286 | $filtermin = $filter; |
@@ -3321,13 +3321,13 @@ discard block |
||
3321 | 3321 | $sql .= ' AND parenttable.entity IN (' . getEntity($tmparray[1]) . ')'; |
3322 | 3322 | } |
3323 | 3323 | if ($restrictiononfksoc == 1 && $socid && $this->element != 'societe') { |
3324 | - $sql .= ' AND te.fk_soc = ' . ((int)$socid); |
|
3324 | + $sql .= ' AND te.fk_soc = ' . ((int) $socid); |
|
3325 | 3325 | } |
3326 | 3326 | if ($restrictiononfksoc == 2 && $socid && $this->element != 'societe') { |
3327 | - $sql .= ' AND (te.fk_soc = ' . ((int)$socid) . ' OR te.fk_soc IS NULL)'; |
|
3327 | + $sql .= ' AND (te.fk_soc = ' . ((int) $socid) . ' OR te.fk_soc IS NULL)'; |
|
3328 | 3328 | } |
3329 | 3329 | if ($restrictiononfksoc && $socid && $this->element == 'societe') { |
3330 | - $sql .= ' AND te.rowid = ' . ((int)$socid); |
|
3330 | + $sql .= ' AND te.rowid = ' . ((int) $socid); |
|
3331 | 3331 | } |
3332 | 3332 | //print 'socid='.$socid.' restrictiononfksoc='.$restrictiononfksoc.' ismultientitymanaged = '.$this->ismultientitymanaged.' filter = '.$filter.' -> '.$sql."<br>"; |
3333 | 3333 | // Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null |
@@ -3392,32 +3392,32 @@ discard block |
||
3392 | 3392 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
3393 | 3393 | if (!empty($this->fields['fk_project'])) { // Common case |
3394 | 3394 | if ($projectid) { |
3395 | - $sql .= " SET fk_project = " . ((int)$projectid); |
|
3395 | + $sql .= " SET fk_project = " . ((int) $projectid); |
|
3396 | 3396 | } else { |
3397 | 3397 | $sql .= " SET fk_project = NULL"; |
3398 | 3398 | } |
3399 | - $sql .= ' WHERE rowid = ' . ((int)$this->id); |
|
3399 | + $sql .= ' WHERE rowid = ' . ((int) $this->id); |
|
3400 | 3400 | } elseif ($this->table_element == 'actioncomm') { // Special case for actioncomm |
3401 | 3401 | if ($projectid) { |
3402 | - $sql .= " SET fk_project = " . ((int)$projectid); |
|
3402 | + $sql .= " SET fk_project = " . ((int) $projectid); |
|
3403 | 3403 | } else { |
3404 | 3404 | $sql .= " SET fk_project = NULL"; |
3405 | 3405 | } |
3406 | - $sql .= ' WHERE id = ' . ((int)$this->id); |
|
3406 | + $sql .= ' WHERE id = ' . ((int) $this->id); |
|
3407 | 3407 | } else { // Special case for old architecture objects |
3408 | 3408 | if ($projectid) { |
3409 | - $sql .= ' SET fk_projet = ' . ((int)$projectid); |
|
3409 | + $sql .= ' SET fk_projet = ' . ((int) $projectid); |
|
3410 | 3410 | } else { |
3411 | 3411 | $sql .= ' SET fk_projet = NULL'; |
3412 | 3412 | } |
3413 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
3413 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
3414 | 3414 | } |
3415 | 3415 | |
3416 | 3416 | $this->db->begin(); |
3417 | 3417 | |
3418 | 3418 | dol_syslog(get_class($this) . "::setProject", LOG_DEBUG); |
3419 | 3419 | if ($this->db->query($sql)) { |
3420 | - $this->fk_project = ((int)$projectid); |
|
3420 | + $this->fk_project = ((int) $projectid); |
|
3421 | 3421 | } else { |
3422 | 3422 | dol_print_error($this->db); |
3423 | 3423 | $error++; |
@@ -3477,8 +3477,8 @@ discard block |
||
3477 | 3477 | } |
3478 | 3478 | |
3479 | 3479 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
3480 | - $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int)$id) : 'NULL'); |
|
3481 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3480 | + $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
|
3481 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3482 | 3482 | |
3483 | 3483 | if ($this->db->query($sql)) { |
3484 | 3484 | $this->mode_reglement_id = $id; |
@@ -3528,7 +3528,7 @@ discard block |
||
3528 | 3528 | |
3529 | 3529 | $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element; |
3530 | 3530 | $sql .= " SET " . $fieldname . " = '" . $this->db->escape($code) . "'"; |
3531 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3531 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3532 | 3532 | |
3533 | 3533 | if ($this->db->query($sql)) { |
3534 | 3534 | $this->multicurrency_code = $code; |
@@ -3565,8 +3565,8 @@ discard block |
||
3565 | 3565 | $fieldname = 'multicurrency_tx'; |
3566 | 3566 | |
3567 | 3567 | $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element; |
3568 | - $sql .= " SET " . $fieldname . " = " . ((float)$rate); |
|
3569 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3568 | + $sql .= " SET " . $fieldname . " = " . ((float) $rate); |
|
3569 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3570 | 3570 | |
3571 | 3571 | if ($this->db->query($sql)) { |
3572 | 3572 | $this->multicurrency_tx = $rate; |
@@ -3788,7 +3788,7 @@ discard block |
||
3788 | 3788 | } |
3789 | 3789 | |
3790 | 3790 | if (empty($deposit_percent) || $deposit_percent < 0) { |
3791 | - $deposit_percent = (float)getDictionaryValue('c_payment_term', 'deposit_percent', $id); |
|
3791 | + $deposit_percent = (float) getDictionaryValue('c_payment_term', 'deposit_percent', $id); |
|
3792 | 3792 | } |
3793 | 3793 | |
3794 | 3794 | if ($deposit_percent > 100) { |
@@ -3796,11 +3796,11 @@ discard block |
||
3796 | 3796 | } |
3797 | 3797 | |
3798 | 3798 | $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element; |
3799 | - $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int)$id) : 'NULL'); |
|
3799 | + $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
|
3800 | 3800 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
3801 | 3801 | $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'" . $this->db->escape($deposit_percent) . "'"); |
3802 | 3802 | } |
3803 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3803 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3804 | 3804 | |
3805 | 3805 | if ($this->db->query($sql)) { |
3806 | 3806 | $this->cond_reglement_id = $id; |
@@ -3842,8 +3842,8 @@ discard block |
||
3842 | 3842 | } |
3843 | 3843 | |
3844 | 3844 | $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element; |
3845 | - $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int)$id) : 'NULL'); |
|
3846 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3845 | + $sql .= " SET " . $fieldname . " = " . (($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
|
3846 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3847 | 3847 | |
3848 | 3848 | if ($this->db->query($sql)) { |
3849 | 3849 | $this->transport_mode_id = $id; |
@@ -3877,8 +3877,8 @@ discard block |
||
3877 | 3877 | $fieldname = 'retained_warranty_fk_cond_reglement'; |
3878 | 3878 | |
3879 | 3879 | $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element; |
3880 | - $sql .= " SET " . $fieldname . " = " . ((int)$id); |
|
3881 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3880 | + $sql .= " SET " . $fieldname . " = " . ((int) $id); |
|
3881 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3882 | 3882 | |
3883 | 3883 | if ($this->db->query($sql)) { |
3884 | 3884 | $this->retained_warranty_fk_cond_reglement = $id; |
@@ -3909,8 +3909,8 @@ discard block |
||
3909 | 3909 | $fieldname = 'fk_address'; |
3910 | 3910 | } |
3911 | 3911 | |
3912 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET " . $fieldname . " = " . ((int)$id); |
|
3913 | - $sql .= " WHERE rowid = " . ((int)$this->id) . " AND fk_statut = 0"; |
|
3912 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET " . $fieldname . " = " . ((int) $id); |
|
3913 | + $sql .= " WHERE rowid = " . ((int) $this->id) . " AND fk_statut = 0"; |
|
3914 | 3914 | |
3915 | 3915 | if ($this->db->query($sql)) { |
3916 | 3916 | $this->fk_delivery_address = $id; |
@@ -3953,8 +3953,8 @@ discard block |
||
3953 | 3953 | dol_syslog(get_class($this) . '::setShippingMethod(' . $shipping_method_id . ')'); |
3954 | 3954 | |
3955 | 3955 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
3956 | - $sql .= " SET fk_shipping_method = " . ((int)$shipping_method_id); |
|
3957 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
3956 | + $sql .= " SET fk_shipping_method = " . ((int) $shipping_method_id); |
|
3957 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
3958 | 3958 | $resql = $this->db->query($sql); |
3959 | 3959 | if (!$resql) { |
3960 | 3960 | dol_syslog(get_class($this) . '::setShippingMethod Error ', LOG_DEBUG); |
@@ -4001,8 +4001,8 @@ discard block |
||
4001 | 4001 | dol_syslog(get_class($this) . '::setWarehouse(' . $warehouse_id . ')'); |
4002 | 4002 | |
4003 | 4003 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
4004 | - $sql .= " SET fk_warehouse = " . ((int)$warehouse_id); |
|
4005 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
4004 | + $sql .= " SET fk_warehouse = " . ((int) $warehouse_id); |
|
4005 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
4006 | 4006 | |
4007 | 4007 | if ($this->db->query($sql)) { |
4008 | 4008 | $this->warehouse_id = ($warehouse_id == 'NULL') ? null : $warehouse_id; |
@@ -4034,7 +4034,7 @@ discard block |
||
4034 | 4034 | |
4035 | 4035 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
4036 | 4036 | $sql .= " SET model_pdf = '" . $this->db->escape($newmodelpdf) . "'"; |
4037 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
4037 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
4038 | 4038 | |
4039 | 4039 | dol_syslog(get_class($this) . "::setDocModel", LOG_DEBUG); |
4040 | 4040 | $resql = $this->db->query($sql); |
@@ -4079,8 +4079,8 @@ discard block |
||
4079 | 4079 | dol_syslog(get_class($this) . '::setBankAccount(' . $fk_account . ')'); |
4080 | 4080 | |
4081 | 4081 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
4082 | - $sql .= " SET fk_account = " . ((int)$fk_account); |
|
4083 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
4082 | + $sql .= " SET fk_account = " . ((int) $fk_account); |
|
4083 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
4084 | 4084 | |
4085 | 4085 | $resql = $this->db->query($sql); |
4086 | 4086 | if (!$resql) { |
@@ -4165,7 +4165,7 @@ discard block |
||
4165 | 4165 | // Count number of lines to reorder (according to choice $renum) |
4166 | 4166 | $nl = 0; |
4167 | 4167 | $sql = "SELECT count(rowid) FROM " . $this->db->prefix() . $this->table_element_line; |
4168 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4168 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4169 | 4169 | if (!$renum) { |
4170 | 4170 | $sql .= " AND " . $fieldposition . " = 0"; |
4171 | 4171 | } |
@@ -4187,7 +4187,7 @@ discard block |
||
4187 | 4187 | |
4188 | 4188 | // We first search all lines that are parent lines (for multilevel details lines) |
4189 | 4189 | $sql = "SELECT rowid FROM " . $this->db->prefix() . $this->table_element_line; |
4190 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4190 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4191 | 4191 | if ($fk_parent_line) { |
4192 | 4192 | $sql .= ' AND fk_parent_line IS NULL'; |
4193 | 4193 | } |
@@ -4242,8 +4242,8 @@ discard block |
||
4242 | 4242 | $rows = array(); |
4243 | 4243 | |
4244 | 4244 | $sql = "SELECT rowid FROM " . $this->db->prefix() . $this->table_element_line; |
4245 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4246 | - $sql .= ' AND fk_parent_line = ' . ((int)$id); |
|
4245 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4246 | + $sql .= ' AND fk_parent_line = ' . ((int) $id); |
|
4247 | 4247 | $sql .= " ORDER BY " . $fieldposition . " ASC"; |
4248 | 4248 | |
4249 | 4249 | dol_syslog(get_class($this) . "::getChildrenOfLine search children lines for line " . $id, LOG_DEBUG); |
@@ -4276,8 +4276,8 @@ discard block |
||
4276 | 4276 | $fieldposition = 'position'; |
4277 | 4277 | } |
4278 | 4278 | |
4279 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int)$rang); |
|
4280 | - $sql .= ' WHERE rowid = ' . ((int)$rowid); |
|
4279 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int) $rang); |
|
4280 | + $sql .= ' WHERE rowid = ' . ((int) $rowid); |
|
4281 | 4281 | |
4282 | 4282 | dol_syslog(get_class($this) . "::updateRangOfLine", LOG_DEBUG); |
4283 | 4283 | if (!$this->db->query($sql)) { |
@@ -4305,7 +4305,7 @@ discard block |
||
4305 | 4305 | } |
4306 | 4306 | |
4307 | 4307 | $sql = "SELECT " . $fieldposition . " FROM " . $this->db->prefix() . $this->table_element_line; |
4308 | - $sql .= " WHERE rowid = " . ((int)$rowid); |
|
4308 | + $sql .= " WHERE rowid = " . ((int) $rowid); |
|
4309 | 4309 | |
4310 | 4310 | dol_syslog(get_class($this) . "::getRangOfLine", LOG_DEBUG); |
4311 | 4311 | $resql = $this->db->query($sql); |
@@ -4332,12 +4332,12 @@ discard block |
||
4332 | 4332 | $fieldposition = 'position'; |
4333 | 4333 | } |
4334 | 4334 | |
4335 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int)$rang); |
|
4336 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4337 | - $sql .= " AND " . $fieldposition . " = " . ((int)($rang - 1)); |
|
4335 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int) $rang); |
|
4336 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4337 | + $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
4338 | 4338 | if ($this->db->query($sql)) { |
4339 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int)($rang - 1)); |
|
4340 | - $sql .= ' WHERE rowid = ' . ((int)$rowid); |
|
4339 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
4340 | + $sql .= ' WHERE rowid = ' . ((int) $rowid); |
|
4341 | 4341 | if (!$this->db->query($sql)) { |
4342 | 4342 | dol_print_error($this->db); |
4343 | 4343 | } |
@@ -4386,8 +4386,8 @@ discard block |
||
4386 | 4386 | // Search the last rang with fk_parent_line |
4387 | 4387 | if ($fk_parent_line) { |
4388 | 4388 | $sql = "SELECT max(" . $positionfield . ") FROM " . $this->db->prefix() . $this->table_element_line; |
4389 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4390 | - $sql .= " AND fk_parent_line = " . ((int)$fk_parent_line); |
|
4389 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4390 | + $sql .= " AND fk_parent_line = " . ((int) $fk_parent_line); |
|
4391 | 4391 | |
4392 | 4392 | dol_syslog(get_class($this) . "::line_max", LOG_DEBUG); |
4393 | 4393 | $resql = $this->db->query($sql); |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | } else { |
4403 | 4403 | // If not, search the last rang of element |
4404 | 4404 | $sql = "SELECT max(" . $positionfield . ") FROM " . $this->db->prefix() . $this->table_element_line; |
4405 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4405 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4406 | 4406 | |
4407 | 4407 | dol_syslog(get_class($this) . "::line_max", LOG_DEBUG); |
4408 | 4408 | $resql = $this->db->query($sql); |
@@ -4431,12 +4431,12 @@ discard block |
||
4431 | 4431 | $fieldposition = 'position'; |
4432 | 4432 | } |
4433 | 4433 | |
4434 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int)$rang); |
|
4435 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4436 | - $sql .= " AND " . $fieldposition . " = " . ((int)($rang + 1)); |
|
4434 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int) $rang); |
|
4435 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4436 | + $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
4437 | 4437 | if ($this->db->query($sql)) { |
4438 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int)($rang + 1)); |
|
4439 | - $sql .= ' WHERE rowid = ' . ((int)$rowid); |
|
4438 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
4439 | + $sql .= ' WHERE rowid = ' . ((int) $rowid); |
|
4440 | 4440 | if (!$this->db->query($sql)) { |
4441 | 4441 | dol_print_error($this->db); |
4442 | 4442 | } |
@@ -4475,8 +4475,8 @@ discard block |
||
4475 | 4475 | } |
4476 | 4476 | |
4477 | 4477 | $sql = "SELECT rowid FROM " . $this->db->prefix() . $this->table_element_line; |
4478 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4479 | - $sql .= " AND " . $fieldposition . " = " . ((int)$rang); |
|
4478 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4479 | + $sql .= " AND " . $fieldposition . " = " . ((int) $rang); |
|
4480 | 4480 | $resql = $this->db->query($sql); |
4481 | 4481 | if ($resql) { |
4482 | 4482 | $row = $this->db->fetch_row($resql); |
@@ -4502,7 +4502,7 @@ discard block |
||
4502 | 4502 | |
4503 | 4503 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
4504 | 4504 | $sql .= " SET ref_ext = '" . $this->db->escape($ref_ext) . "'"; |
4505 | - $sql .= " WHERE " . (isset($this->table_rowid) ? $this->table_rowid : 'rowid') . " = " . ((int)$this->id); |
|
4505 | + $sql .= " WHERE " . (isset($this->table_rowid) ? $this->table_rowid : 'rowid') . " = " . ((int) $this->id); |
|
4506 | 4506 | |
4507 | 4507 | dol_syslog(get_class($this) . "::update_ref_ext", LOG_DEBUG); |
4508 | 4508 | if ($this->db->query($sql)) { |
@@ -4567,8 +4567,8 @@ discard block |
||
4567 | 4567 | } |
4568 | 4568 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
4569 | 4569 | $sql .= " SET note" . $newsuffix . " = " . (!empty($note) ? ("'" . $this->db->escape($note) . "'") : "NULL"); |
4570 | - $sql .= ", " . $fieldusermod . " = " . ((int)$user->id); |
|
4571 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
4570 | + $sql .= ", " . $fieldusermod . " = " . ((int) $user->id); |
|
4571 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
4572 | 4572 | |
4573 | 4573 | dol_syslog(get_class($this) . "::update_note", LOG_DEBUG); |
4574 | 4574 | if ($this->db->query($sql)) { |
@@ -4711,7 +4711,7 @@ discard block |
||
4711 | 4711 | } |
4712 | 4712 | $sql .= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
4713 | 4713 | $sql .= " FROM " . $this->db->prefix() . $this->table_element_line; |
4714 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
4714 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
4715 | 4715 | if ($exclspec) { |
4716 | 4716 | $product_field = 'product_type'; |
4717 | 4717 | if ($this->table_element_line == 'contratdet') { |
@@ -4762,7 +4762,7 @@ discard block |
||
4762 | 4762 | |
4763 | 4763 | if ($diff_on_current_total) { |
4764 | 4764 | // This should not happen, we should always have in table: total_ttc = total_ht + total_vat + total_localtax1 + total_localtax2 |
4765 | - $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num((float)$tmpcal[1]) . ", total_ttc = " . price2num((float)$tmpcal[2]) . " WHERE rowid = " . ((int)$obj->rowid); |
|
4765 | + $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num((float) $tmpcal[1]) . ", total_ttc = " . price2num((float) $tmpcal[2]) . " WHERE rowid = " . ((int) $obj->rowid); |
|
4766 | 4766 | dol_syslog('We found inconsistent data into detailed line (diff_on_current_total = ' . $diff_on_current_total . ') for line rowid = ' . $obj->rowid . " (ht=" . $obj->total_ht . " vat=" . $obj->total_tva . " tax1=" . $obj->total_localtax1 . " tax2=" . $obj->total_localtax2 . " ttc=" . $obj->total_ttc . "). We fix the total_vat and total_ttc of line by running sqlfix = " . $sqlfix, LOG_WARNING); |
4767 | 4767 | $resqlfix = $this->db->query($sqlfix); |
4768 | 4768 | if (!$resqlfix) { |
@@ -4773,7 +4773,7 @@ discard block |
||
4773 | 4773 | } elseif ($diff_when_using_price_ht) { |
4774 | 4774 | // After calculation from HT, total is consistent but we have found a difference between VAT part in calculation and into database and |
4775 | 4775 | // we ask to force the use of rounding on line (like done on calculation) so we force update of line |
4776 | - $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num((float)$tmpcal[1]) . ", total_ttc = " . price2num((float)$tmpcal[2]) . " WHERE rowid = " . ((int)$obj->rowid); |
|
4776 | + $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num((float) $tmpcal[1]) . ", total_ttc = " . price2num((float) $tmpcal[2]) . " WHERE rowid = " . ((int) $obj->rowid); |
|
4777 | 4777 | dol_syslog('We found a line with different rounding data into detailed line (diff_when_using_price_ht = ' . $diff_when_using_price_ht . ' and diff_on_current_total = ' . $diff_on_current_total . ') for line rowid = ' . $obj->rowid . " (total vat of line calculated=" . $tmpcal[1] . ", database=" . $obj->total_tva . "). We fix the total_vat and total_ttc of line by running sqlfix = " . $sqlfix); |
4778 | 4778 | $resqlfix = $this->db->query($sqlfix); |
4779 | 4779 | if (!$resqlfix) { |
@@ -4812,10 +4812,10 @@ discard block |
||
4812 | 4812 | } else { |
4813 | 4813 | $tmpvat = price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1); |
4814 | 4814 | } |
4815 | - $diff = price2num($total_tva_by_vats[$obj->vatrate] - (float)$tmpvat, 'MT', 1); |
|
4815 | + $diff = price2num($total_tva_by_vats[$obj->vatrate] - (float) $tmpvat, 'MT', 1); |
|
4816 | 4816 | //print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n"; |
4817 | 4817 | if ($diff) { |
4818 | - if (abs((float)$diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) { |
|
4818 | + if (abs((float) $diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) { |
|
4819 | 4819 | // If error is more than 10 times the accuracy of rounding. This should not happen. |
4820 | 4820 | $errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your lines may be corrupted. Try to edit each line manually to fix this before restarting.'; |
4821 | 4821 | dol_syslog($errmsg, LOG_WARNING); |
@@ -4824,10 +4824,10 @@ discard block |
||
4824 | 4824 | break; |
4825 | 4825 | } |
4826 | 4826 | if ($base_price_type == 'TTC') { |
4827 | - $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num($obj->total_tva - (float)$diff) . ", total_ht = " . price2num($obj->total_ht + (float)$diff) . " WHERE rowid = " . ((int)$obj->rowid); |
|
4827 | + $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num($obj->total_tva - (float) $diff) . ", total_ht = " . price2num($obj->total_ht + (float) $diff) . " WHERE rowid = " . ((int) $obj->rowid); |
|
4828 | 4828 | dol_syslog('We found a difference of ' . $diff . ' for line rowid = ' . $obj->rowid . ". We fix the total_vat and total_ht of line by running sqlfix = " . $sqlfix); |
4829 | 4829 | } else { |
4830 | - $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num($obj->total_tva - (float)$diff) . ", total_ttc = " . price2num($obj->total_ttc - (float)$diff) . " WHERE rowid = " . ((int)$obj->rowid); |
|
4830 | + $sqlfix = "UPDATE " . $this->db->prefix() . $this->table_element_line . " SET " . $fieldtva . " = " . price2num($obj->total_tva - (float) $diff) . ", total_ttc = " . price2num($obj->total_ttc - (float) $diff) . " WHERE rowid = " . ((int) $obj->rowid); |
|
4831 | 4831 | dol_syslog('We found a difference of ' . $diff . ' for line rowid = ' . $obj->rowid . ". We fix the total_vat and total_ttc of line by running sqlfix = " . $sqlfix); |
4832 | 4832 | } |
4833 | 4833 | |
@@ -4837,14 +4837,14 @@ discard block |
||
4837 | 4837 | dol_print_error($this->db, 'Failed to update line'); |
4838 | 4838 | } |
4839 | 4839 | |
4840 | - $this->total_tva = (float)price2num($this->total_tva - (float)$diff, '', 1); |
|
4841 | - $total_tva_by_vats[$obj->vatrate] = (float)price2num($total_tva_by_vats[$obj->vatrate] - (float)$diff, '', 1); |
|
4840 | + $this->total_tva = (float) price2num($this->total_tva - (float) $diff, '', 1); |
|
4841 | + $total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - (float) $diff, '', 1); |
|
4842 | 4842 | if ($base_price_type == 'TTC') { |
4843 | - $this->total_ht = (float)price2num($this->total_ht + (float)$diff, '', 1); |
|
4844 | - $total_ht_by_vats[$obj->vatrate] = (float)price2num($total_ht_by_vats[$obj->vatrate] + (float)$diff, '', 1); |
|
4843 | + $this->total_ht = (float) price2num($this->total_ht + (float) $diff, '', 1); |
|
4844 | + $total_ht_by_vats[$obj->vatrate] = (float) price2num($total_ht_by_vats[$obj->vatrate] + (float) $diff, '', 1); |
|
4845 | 4845 | } else { |
4846 | - $this->total_ttc = (float)price2num($this->total_ttc - (float)$diff, '', 1); |
|
4847 | - $total_ttc_by_vats[$obj->vatrate] = (float)price2num($total_ttc_by_vats[$obj->vatrate] - (float)$diff, '', 1); |
|
4846 | + $this->total_ttc = (float) price2num($this->total_ttc - (float) $diff, '', 1); |
|
4847 | + $total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - (float) $diff, '', 1); |
|
4848 | 4848 | } |
4849 | 4849 | } |
4850 | 4850 | } |
@@ -4877,11 +4877,11 @@ discard block |
||
4877 | 4877 | } |
4878 | 4878 | |
4879 | 4879 | // Clean total |
4880 | - $this->total_ht = (float)price2num($this->total_ht); |
|
4881 | - $this->total_tva = (float)price2num($this->total_tva); |
|
4882 | - $this->total_localtax1 = (float)price2num($this->total_localtax1); |
|
4883 | - $this->total_localtax2 = (float)price2num($this->total_localtax2); |
|
4884 | - $this->total_ttc = (float)price2num($this->total_ttc); |
|
4880 | + $this->total_ht = (float) price2num($this->total_ht); |
|
4881 | + $this->total_tva = (float) price2num($this->total_tva); |
|
4882 | + $this->total_localtax1 = (float) price2num($this->total_localtax1); |
|
4883 | + $this->total_localtax2 = (float) price2num($this->total_localtax2); |
|
4884 | + $this->total_ttc = (float) price2num($this->total_ttc); |
|
4885 | 4885 | |
4886 | 4886 | $this->db->free($resql); |
4887 | 4887 | |
@@ -4898,15 +4898,15 @@ discard block |
||
4898 | 4898 | |
4899 | 4899 | if (!$error && empty($nodatabaseupdate)) { |
4900 | 4900 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element . ' SET'; |
4901 | - $sql .= " " . $fieldht . " = " . ((float)price2num($this->total_ht, 'MT', 1)) . ","; |
|
4902 | - $sql .= " " . $fieldtva . " = " . ((float)price2num($this->total_tva, 'MT', 1)) . ","; |
|
4903 | - $sql .= " " . $fieldlocaltax1 . " = " . ((float)price2num($this->total_localtax1, 'MT', 1)) . ","; |
|
4904 | - $sql .= " " . $fieldlocaltax2 . " = " . ((float)price2num($this->total_localtax2, 'MT', 1)) . ","; |
|
4905 | - $sql .= " " . $fieldttc . " = " . ((float)price2num($this->total_ttc, 'MT', 1)); |
|
4906 | - $sql .= ", multicurrency_total_ht = " . ((float)price2num($this->multicurrency_total_ht, 'MT', 1)); |
|
4907 | - $sql .= ", multicurrency_total_tva = " . ((float)price2num($this->multicurrency_total_tva, 'MT', 1)); |
|
4908 | - $sql .= ", multicurrency_total_ttc = " . ((float)price2num($this->multicurrency_total_ttc, 'MT', 1)); |
|
4909 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
4901 | + $sql .= " " . $fieldht . " = " . ((float) price2num($this->total_ht, 'MT', 1)) . ","; |
|
4902 | + $sql .= " " . $fieldtva . " = " . ((float) price2num($this->total_tva, 'MT', 1)) . ","; |
|
4903 | + $sql .= " " . $fieldlocaltax1 . " = " . ((float) price2num($this->total_localtax1, 'MT', 1)) . ","; |
|
4904 | + $sql .= " " . $fieldlocaltax2 . " = " . ((float) price2num($this->total_localtax2, 'MT', 1)) . ","; |
|
4905 | + $sql .= " " . $fieldttc . " = " . ((float) price2num($this->total_ttc, 'MT', 1)); |
|
4906 | + $sql .= ", multicurrency_total_ht = " . ((float) price2num($this->multicurrency_total_ht, 'MT', 1)); |
|
4907 | + $sql .= ", multicurrency_total_tva = " . ((float) price2num($this->multicurrency_total_tva, 'MT', 1)); |
|
4908 | + $sql .= ", multicurrency_total_ttc = " . ((float) price2num($this->multicurrency_total_ttc, 'MT', 1)); |
|
4909 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
4910 | 4910 | |
4911 | 4911 | dol_syslog(get_class($this) . "::update_price", LOG_DEBUG); |
4912 | 4912 | $resql = $this->db->query($sql); |
@@ -4984,9 +4984,9 @@ discard block |
||
4984 | 4984 | $sql .= ", fk_target"; |
4985 | 4985 | $sql .= ", targettype"; |
4986 | 4986 | $sql .= ") VALUES ("; |
4987 | - $sql .= ((int)$origin_id); |
|
4987 | + $sql .= ((int) $origin_id); |
|
4988 | 4988 | $sql .= ", '" . $this->db->escape($origin) . "'"; |
4989 | - $sql .= ", " . ((int)$this->id); |
|
4989 | + $sql .= ", " . ((int) $this->id); |
|
4990 | 4990 | $sql .= ", '" . $this->db->escape($targettype) . "'"; |
4991 | 4991 | $sql .= ")"; |
4992 | 4992 | |
@@ -5119,19 +5119,19 @@ discard block |
||
5119 | 5119 | $sql .= " WHERE "; |
5120 | 5120 | if ($justsource || $justtarget) { |
5121 | 5121 | if ($justsource) { |
5122 | - $sql .= "fk_source = " . ((int)$sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
5122 | + $sql .= "fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
5123 | 5123 | if ($withtargettype) { |
5124 | 5124 | $sql .= " AND targettype = '" . $this->db->escape($targettype) . "'"; |
5125 | 5125 | } |
5126 | 5126 | } elseif ($justtarget) { |
5127 | - $sql .= "fk_target = " . ((int)$targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
5127 | + $sql .= "fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
5128 | 5128 | if ($withsourcetype) { |
5129 | 5129 | $sql .= " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
5130 | 5130 | } |
5131 | 5131 | } |
5132 | 5132 | } else { |
5133 | - $sql .= "(fk_source = " . ((int)$sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "')"; |
|
5134 | - $sql .= " " . $clause . " (fk_target = " . ((int)$targetid) . " AND targettype = '" . $this->db->escape($targettype) . "')"; |
|
5133 | + $sql .= "(fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "')"; |
|
5134 | + $sql .= " " . $clause . " (fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "')"; |
|
5135 | 5135 | if ($loadalsoobjects && $this->id > 0 && $sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') { |
5136 | 5136 | $this->linkedObjectsFullLoaded[$this->id] = true; |
5137 | 5137 | } |
@@ -5250,14 +5250,14 @@ discard block |
||
5250 | 5250 | |
5251 | 5251 | $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
5252 | 5252 | if ($updatesource) { |
5253 | - $sql .= "fk_source = " . ((int)$sourceid); |
|
5253 | + $sql .= "fk_source = " . ((int) $sourceid); |
|
5254 | 5254 | $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
5255 | - $sql .= " WHERE fk_target = " . ((int)$this->id); |
|
5255 | + $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
5256 | 5256 | $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
5257 | 5257 | } elseif ($updatetarget) { |
5258 | - $sql .= "fk_target = " . ((int)$targetid); |
|
5258 | + $sql .= "fk_target = " . ((int) $targetid); |
|
5259 | 5259 | $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
5260 | - $sql .= " WHERE fk_source = " . ((int)$this->id); |
|
5260 | + $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
5261 | 5261 | $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
5262 | 5262 | } |
5263 | 5263 | |
@@ -5340,11 +5340,11 @@ discard block |
||
5340 | 5340 | } |
5341 | 5341 | |
5342 | 5342 | $sql = "UPDATE " . $this->db->prefix() . $elementTable; |
5343 | - $sql .= " SET " . $fieldstatus . " = " . ((int)$status); |
|
5343 | + $sql .= " SET " . $fieldstatus . " = " . ((int) $status); |
|
5344 | 5344 | // If status = 1 = validated, update also fk_user_valid |
5345 | 5345 | // TODO Replace the test on $elementTable by doing a test on existence of the field in $this->fields |
5346 | 5346 | if ($status == 1 && in_array($elementTable, array('expensereport', 'inventory'))) { |
5347 | - $sql .= ", fk_user_valid = " . ((int)$user->id); |
|
5347 | + $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
5348 | 5348 | } |
5349 | 5349 | if ($status == 1 && in_array($elementTable, array('expensereport'))) { |
5350 | 5350 | $sql .= ", date_valid = '" . $this->db->idate(dol_now()) . "'"; |
@@ -5352,15 +5352,15 @@ discard block |
||
5352 | 5352 | if ($status == 1 && in_array($elementTable, array('inventory'))) { |
5353 | 5353 | $sql .= ", date_validation = '" . $this->db->idate(dol_now()) . "'"; |
5354 | 5354 | } |
5355 | - $sql .= " WHERE rowid = " . ((int)$elementId); |
|
5356 | - $sql .= " AND " . $fieldstatus . " <> " . ((int)$status); // We avoid update if status already correct |
|
5355 | + $sql .= " WHERE rowid = " . ((int) $elementId); |
|
5356 | + $sql .= " AND " . $fieldstatus . " <> " . ((int) $status); // We avoid update if status already correct |
|
5357 | 5357 | |
5358 | 5358 | dol_syslog(get_class($this) . "::setStatut", LOG_DEBUG); |
5359 | 5359 | $resql = $this->db->query($sql); |
5360 | 5360 | if ($resql) { |
5361 | 5361 | $error = 0; |
5362 | 5362 | |
5363 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
5363 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
5364 | 5364 | |
5365 | 5365 | if ($nb_rows_affected > 0) { |
5366 | 5366 | if (empty($trigkey)) { |
@@ -5405,7 +5405,7 @@ discard block |
||
5405 | 5405 | if ($fieldstatus == 'tosell') { |
5406 | 5406 | $this->status = $status; |
5407 | 5407 | } elseif ($fieldstatus == 'tobuy') { |
5408 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
5408 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
5409 | 5409 | } else { |
5410 | 5410 | $this->status = $status; |
5411 | 5411 | } |
@@ -5449,7 +5449,7 @@ discard block |
||
5449 | 5449 | $sql .= " FROM " . $this->db->prefix() . $this->table_element; |
5450 | 5450 | $sql .= " WHERE entity IN (" . getEntity($this->element) . ")"; |
5451 | 5451 | if (!empty($id)) { |
5452 | - $sql .= " AND rowid = " . ((int)$id); |
|
5452 | + $sql .= " AND rowid = " . ((int) $id); |
|
5453 | 5453 | } |
5454 | 5454 | if (!empty($ref)) { |
5455 | 5455 | $sql .= " AND ref = '" . $this->db->escape($ref) . "'"; |
@@ -5482,7 +5482,7 @@ discard block |
||
5482 | 5482 | public function getSpecialCode($lineid) |
5483 | 5483 | { |
5484 | 5484 | $sql = "SELECT special_code FROM " . $this->db->prefix() . $this->table_element_line; |
5485 | - $sql .= " WHERE rowid = " . ((int)$lineid); |
|
5485 | + $sql .= " WHERE rowid = " . ((int) $lineid); |
|
5486 | 5486 | $resql = $this->db->query($sql); |
5487 | 5487 | if ($resql) { |
5488 | 5488 | $row = $this->db->fetch_row($resql); |
@@ -5542,7 +5542,7 @@ discard block |
||
5542 | 5542 | |
5543 | 5543 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
5544 | 5544 | $sql .= " FROM " . $this->db->prefix() . $this->table_element_line; |
5545 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
5545 | + $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
5546 | 5546 | |
5547 | 5547 | dol_syslog(get_class($this) . '::getTotalDiscount', LOG_DEBUG); |
5548 | 5548 | $resql = $this->db->query($sql); |
@@ -5556,7 +5556,7 @@ discard block |
||
5556 | 5556 | $qty = $obj->qty; |
5557 | 5557 | $total_ht = $obj->total_ht; |
5558 | 5558 | |
5559 | - $total_discount_line = (float)price2num(($pu_ht * $qty) - $total_ht, 'MT'); |
|
5559 | + $total_discount_line = (float) price2num(($pu_ht * $qty) - $total_ht, 'MT'); |
|
5560 | 5560 | $total_discount += $total_discount_line; |
5561 | 5561 | |
5562 | 5562 | $i++; |
@@ -5564,7 +5564,7 @@ discard block |
||
5564 | 5564 | } |
5565 | 5565 | |
5566 | 5566 | //print $total_discount; exit; |
5567 | - return (float)price2num($total_discount); |
|
5567 | + return (float) price2num($total_discount); |
|
5568 | 5568 | } |
5569 | 5569 | |
5570 | 5570 | return null; |
@@ -5687,7 +5687,7 @@ discard block |
||
5687 | 5687 | |
5688 | 5688 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
5689 | 5689 | $sql .= " SET extraparams = " . (!empty($extraparams) ? "'" . $this->db->escape($extraparams) . "'" : "null"); |
5690 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
5690 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
5691 | 5691 | |
5692 | 5692 | dol_syslog(get_class($this) . "::setExtraParameters", LOG_DEBUG); |
5693 | 5693 | $resql = $this->db->query($sql); |
@@ -6239,7 +6239,7 @@ discard block |
||
6239 | 6239 | $sql .= ", busy"; |
6240 | 6240 | $sql .= ", mandatory"; |
6241 | 6241 | $sql .= ") VALUES ("; |
6242 | - $sql .= ((int)$resource_id); |
|
6242 | + $sql .= ((int) $resource_id); |
|
6243 | 6243 | $sql .= ", '" . $this->db->escape($resource_type) . "'"; |
6244 | 6244 | $sql .= ", '" . $this->db->escape($this->id) . "'"; |
6245 | 6245 | $sql .= ", '" . $this->db->escape($this->element) . "'"; |
@@ -6277,7 +6277,7 @@ discard block |
||
6277 | 6277 | $this->db->begin(); |
6278 | 6278 | |
6279 | 6279 | $sql = "DELETE FROM " . $this->db->prefix() . "element_resources"; |
6280 | - $sql .= " WHERE rowid = " . ((int)$rowid); |
|
6280 | + $sql .= " WHERE rowid = " . ((int) $rowid); |
|
6281 | 6281 | |
6282 | 6282 | dol_syslog(get_class($this) . "::delete_resource", LOG_DEBUG); |
6283 | 6283 | |
@@ -6339,7 +6339,7 @@ discard block |
||
6339 | 6339 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
6340 | 6340 | $maxheightmini = $tmparraysize['maxheightmini']; |
6341 | 6341 | //$quality = $tmparraysize['quality']; |
6342 | - $quality = 50; // For thumbs, we force quality to 50 |
|
6342 | + $quality = 50; // For thumbs, we force quality to 50 |
|
6343 | 6343 | |
6344 | 6344 | // Create small thumbs for company (Ratio is near 16/9) |
6345 | 6345 | // Used on logon for example |
@@ -6445,7 +6445,7 @@ discard block |
||
6445 | 6445 | $sql = "SELECT rowid, property, lang , value"; |
6446 | 6446 | $sql .= " FROM " . $this->db->prefix() . "object_lang"; |
6447 | 6447 | $sql .= " WHERE type_object = '" . $this->db->escape($element) . "'"; |
6448 | - $sql .= " AND fk_object = " . ((int)$this->id); |
|
6448 | + $sql .= " AND fk_object = " . ((int) $this->id); |
|
6449 | 6449 | |
6450 | 6450 | //dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose |
6451 | 6451 | $resql = $this->db->query($sql); |
@@ -6515,7 +6515,7 @@ discard block |
||
6515 | 6515 | |
6516 | 6516 | $enabled = 1; |
6517 | 6517 | if (isset($this->fields[$key]['enabled'])) { |
6518 | - $enabled = (int)dol_eval($this->fields[$key]['enabled'], 1, 1, '1'); |
|
6518 | + $enabled = (int) dol_eval($this->fields[$key]['enabled'], 1, 1, '1'); |
|
6519 | 6519 | } |
6520 | 6520 | /*$perms = 1; |
6521 | 6521 | if (isset($this->fields[$key]['perms'])) |
@@ -6662,7 +6662,7 @@ discard block |
||
6662 | 6662 | foreach ($new_array_languages as $key => $langcodearray) { // $key = 'name', 'town', ... |
6663 | 6663 | foreach ($langcodearray as $langcode => $value) { |
6664 | 6664 | $sql_del = "DELETE FROM " . $this->db->prefix() . "object_lang"; |
6665 | - $sql_del .= " WHERE fk_object = " . ((int)$this->id) . " AND property = '" . $this->db->escape($key) . "' AND type_object = '" . $this->db->escape($table_element) . "'"; |
|
6665 | + $sql_del .= " WHERE fk_object = " . ((int) $this->id) . " AND property = '" . $this->db->escape($key) . "' AND type_object = '" . $this->db->escape($table_element) . "'"; |
|
6666 | 6666 | $sql_del .= " AND lang = '" . $this->db->escape($langcode) . "'"; |
6667 | 6667 | $this->db->query($sql_del); |
6668 | 6668 | |
@@ -6830,7 +6830,7 @@ discard block |
||
6830 | 6830 | if (isset($this->oldcopy->array_options["options_" . $key]) && $this->array_options["options_" . $key] == $this->oldcopy->array_options["options_" . $key]) { // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
6831 | 6831 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
6832 | 6832 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_" . $key])) { |
6833 | - $new_array_options["options_" . $key] = dolEncrypt($this->array_options["options_" . $key]); // warning, must be called when on the master |
|
6833 | + $new_array_options["options_" . $key] = dolEncrypt($this->array_options["options_" . $key]); // warning, must be called when on the master |
|
6834 | 6834 | } else { |
6835 | 6835 | $new_array_options["options_" . $key] = $this->array_options["options_" . $key]; // Value is kept |
6836 | 6836 | } |
@@ -6850,7 +6850,7 @@ discard block |
||
6850 | 6850 | } |
6851 | 6851 | } else { |
6852 | 6852 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_" . $key])) { // dolibarr reversible encryption |
6853 | - $new_array_options["options_" . $key] = dolEncrypt($this->array_options["options_" . $key]); // warning, must be called when on the master |
|
6853 | + $new_array_options["options_" . $key] = dolEncrypt($this->array_options["options_" . $key]); // warning, must be called when on the master |
|
6854 | 6854 | } else { |
6855 | 6855 | $new_array_options["options_" . $key] = $this->array_options["options_" . $key]; // Value is kept |
6856 | 6856 | } |
@@ -6950,7 +6950,7 @@ discard block |
||
6950 | 6950 | $table_element = 'categories'; // For compatibility |
6951 | 6951 | } |
6952 | 6952 | |
6953 | - $sql = "SELECT COUNT(rowid) as nb FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int)$this->id); |
|
6953 | + $sql = "SELECT COUNT(rowid) as nb FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int) $this->id); |
|
6954 | 6954 | $resql = $this->db->query($sql); |
6955 | 6955 | if ($resql) { |
6956 | 6956 | $tmpobj = $this->db->fetch_object($resql); |
@@ -6966,7 +6966,7 @@ discard block |
||
6966 | 6966 | } else { |
6967 | 6967 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element . "_extrafields SET " . $key . " = '" . $this->db->escape($new_array_options["options_" . $key]) . "'"; |
6968 | 6968 | } |
6969 | - $sql .= " WHERE fk_object = " . ((int)$this->id); |
|
6969 | + $sql .= " WHERE fk_object = " . ((int) $this->id); |
|
6970 | 6970 | |
6971 | 6971 | $resql = $this->db->query($sql); |
6972 | 6972 | if (!$resql) { |
@@ -7135,7 +7135,7 @@ discard block |
||
7135 | 7135 | // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
7136 | 7136 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
7137 | 7137 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
7138 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7138 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7139 | 7139 | } else { |
7140 | 7140 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
7141 | 7141 | } |
@@ -7146,7 +7146,7 @@ discard block |
||
7146 | 7146 | // If value has changed |
7147 | 7147 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
7148 | 7148 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
7149 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7149 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7150 | 7150 | } else { |
7151 | 7151 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
7152 | 7152 | } |
@@ -7158,7 +7158,7 @@ discard block |
||
7158 | 7158 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
7159 | 7159 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
7160 | 7160 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
7161 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7161 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
7162 | 7162 | } else { |
7163 | 7163 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
7164 | 7164 | } |
@@ -7234,7 +7234,7 @@ discard block |
||
7234 | 7234 | |
7235 | 7235 | dol_syslog(get_class($this) . "::insertExtraFields delete then insert", LOG_DEBUG); |
7236 | 7236 | |
7237 | - $sql_del = "DELETE FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int)$this->id); |
|
7237 | + $sql_del = "DELETE FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int) $this->id); |
|
7238 | 7238 | $this->db->query($sql_del); |
7239 | 7239 | |
7240 | 7240 | $sql = "INSERT INTO " . $this->db->prefix() . $table_element . "_extrafields (fk_object"; |
@@ -7705,7 +7705,7 @@ discard block |
||
7705 | 7705 | // Test on 'enabled' ('enabled' is different than 'list' = 'visibility') |
7706 | 7706 | $enabled = 1; |
7707 | 7707 | if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) { |
7708 | - $enabled = (int)dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2'); |
|
7708 | + $enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2'); |
|
7709 | 7709 | } |
7710 | 7710 | if (empty($enabled)) { |
7711 | 7711 | continue; |
@@ -7713,12 +7713,12 @@ discard block |
||
7713 | 7713 | |
7714 | 7714 | $visibility = 1; |
7715 | 7715 | if (isset($extrafields->attributes[$this->table_element]['list'][$key])) { |
7716 | - $visibility = (int)dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2'); |
|
7716 | + $visibility = (int) dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2'); |
|
7717 | 7717 | } |
7718 | 7718 | |
7719 | 7719 | $perms = 1; |
7720 | 7720 | if ($perms && isset($extrafields->attributes[$this->table_element]['perms'][$key])) { |
7721 | - $perms = (int)dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2'); |
|
7721 | + $perms = (int) dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2'); |
|
7722 | 7722 | } |
7723 | 7723 | |
7724 | 7724 | if (($mode == 'create') && !in_array(abs($visibility), array(1, 3))) { |
@@ -8104,16 +8104,16 @@ discard block |
||
8104 | 8104 | $morecss = 'minwidth100imp'; |
8105 | 8105 | } elseif ($type == 'datetime' || $type == 'link') { // link means an foreign key to another primary id |
8106 | 8106 | $morecss = 'minwidth200imp'; |
8107 | - } elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', (string)$type)) { |
|
8107 | + } elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', (string) $type)) { |
|
8108 | 8108 | $morecss = 'maxwidth75'; |
8109 | 8109 | } elseif ($type == 'url') { |
8110 | 8110 | $morecss = 'minwidth400'; |
8111 | 8111 | } elseif ($type == 'boolean') { |
8112 | 8112 | $morecss = ''; |
8113 | 8113 | } else { |
8114 | - if (is_numeric($size) && round((float)$size) < 12) { |
|
8114 | + if (is_numeric($size) && round((float) $size) < 12) { |
|
8115 | 8115 | $morecss = 'minwidth100'; |
8116 | - } elseif (is_numeric($size) && round((float)$size) <= 48) { |
|
8116 | + } elseif (is_numeric($size) && round((float) $size) <= 48) { |
|
8117 | 8117 | $morecss = 'minwidth200'; |
8118 | 8118 | } else { |
8119 | 8119 | $morecss = 'minwidth400'; |
@@ -8158,11 +8158,11 @@ discard block |
||
8158 | 8158 | $out = '<input type="text" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '"' . ($newsize > 0 ? ' maxlength="' . $newsize . '"' : '') . ' value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . ($autofocusoncreate ? ' autofocus' : '') . '>'; |
8159 | 8159 | } elseif (in_array($type, array('real'))) { |
8160 | 8160 | $out = '<input type="text" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . ($autofocusoncreate ? ' autofocus' : '') . '>'; |
8161 | - } elseif (preg_match('/varchar/', (string)$type)) { |
|
8161 | + } elseif (preg_match('/varchar/', (string) $type)) { |
|
8162 | 8162 | $out = '<input type="text" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '"' . ($size > 0 ? ' maxlength="' . $size . '"' : '') . ' value="' . dol_escape_htmltag($value) . '"' . ($moreparam ? $moreparam : '') . ($autofocusoncreate ? ' autofocus' : '') . '>'; |
8163 | 8163 | } elseif (in_array($type, array('email', 'mail', 'phone', 'url', 'ip'))) { |
8164 | 8164 | $out = '<input type="text" class="flat ' . $morecss . '" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . ($autofocusoncreate ? ' autofocus' : '') . '>'; |
8165 | - } elseif (preg_match('/^text/', (string)$type)) { |
|
8165 | + } elseif (preg_match('/^text/', (string) $type)) { |
|
8166 | 8166 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
8167 | 8167 | if (!empty($param['options'])) { |
8168 | 8168 | // If the textarea field has a list of arrayofkeyval into its definition, we suggest a combo with possible values to fill the textarea. |
@@ -8212,14 +8212,14 @@ discard block |
||
8212 | 8212 | $out .= "</script>"; |
8213 | 8213 | } |
8214 | 8214 | $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); |
8215 | - $out .= (string)$doleditor->Create(1, '', true, '', '', '', $morecss); |
|
8215 | + $out .= (string) $doleditor->Create(1, '', true, '', '', '', $morecss); |
|
8216 | 8216 | } else { |
8217 | 8217 | $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
8218 | 8218 | } |
8219 | - } elseif (preg_match('/^html/', (string)$type)) { |
|
8219 | + } elseif (preg_match('/^html/', (string) $type)) { |
|
8220 | 8220 | if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field |
8221 | 8221 | $doleditor = new DolEditor($keyprefix . $key . $keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, isModEnabled('fckeditor') && getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_5, '90%'); |
8222 | - $out = (string)$doleditor->Create(1, '', true, '', '', $moreparam, $morecss); |
|
8222 | + $out = (string) $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); |
|
8223 | 8223 | } else { |
8224 | 8224 | $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . dol_escape_htmltag($value) . '" ' . ($moreparam ? $moreparam : '') . '>'; |
8225 | 8225 | } |
@@ -8236,7 +8236,7 @@ discard block |
||
8236 | 8236 | $value = price($value); |
8237 | 8237 | } |
8238 | 8238 | $out = '<input type="text" class="flat ' . $morecss . ' maxwidthonsmartphone" name="' . $keyprefix . $key . $keysuffix . '" id="' . $keyprefix . $key . $keysuffix . '" value="' . $value . '" ' . ($moreparam ? $moreparam : '') . '> ' . $langs->getCurrencySymbol($conf->currency); |
8239 | - } elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/', (string)$type)) { |
|
8239 | + } elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/', (string) $type)) { |
|
8240 | 8240 | if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. |
8241 | 8241 | $value = price($value); |
8242 | 8242 | } |
@@ -8251,7 +8251,7 @@ discard block |
||
8251 | 8251 | $tmpselect = ''; |
8252 | 8252 | $nbchoice = 0; |
8253 | 8253 | foreach ($param['options'] as $keyb => $valb) { |
8254 | - if ((string)$keyb == '') { |
|
8254 | + if ((string) $keyb == '') { |
|
8255 | 8255 | continue; |
8256 | 8256 | } |
8257 | 8257 | if (strpos($valb, "|") !== false) { |
@@ -8259,7 +8259,7 @@ discard block |
||
8259 | 8259 | } |
8260 | 8260 | $nbchoice++; |
8261 | 8261 | $tmpselect .= '<option value="' . $keyb . '"'; |
8262 | - $tmpselect .= (((string)$value == (string)$keyb) ? ' selected' : ''); |
|
8262 | + $tmpselect .= (((string) $value == (string) $keyb) ? ' selected' : ''); |
|
8263 | 8263 | if (!empty($parent)) { |
8264 | 8264 | $isDependList = 1; |
8265 | 8265 | } |
@@ -8355,7 +8355,7 @@ discard block |
||
8355 | 8355 | |
8356 | 8356 | // current object id can be use into filter |
8357 | 8357 | if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) { |
8358 | - $InfoFieldList[4] = str_replace('$ID$', (string)$objectid, $InfoFieldList[4]); |
|
8358 | + $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]); |
|
8359 | 8359 | } else { |
8360 | 8360 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
8361 | 8361 | } |
@@ -8374,7 +8374,7 @@ discard block |
||
8374 | 8374 | } |
8375 | 8375 | // Some tables may have field, some other not. For the moment we disable it. |
8376 | 8376 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
8377 | - $sqlwhere .= " AND entity = " . ((int)$conf->entity); |
|
8377 | + $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
8378 | 8378 | } |
8379 | 8379 | $sql .= $sqlwhere; |
8380 | 8380 | //print $sql; |
@@ -8535,7 +8535,7 @@ discard block |
||
8535 | 8535 | |
8536 | 8536 | // current object id can be use into filter |
8537 | 8537 | if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) { |
8538 | - $InfoFieldList[4] = str_replace('$ID$', (string)$objectid, $InfoFieldList[4]); |
|
8538 | + $InfoFieldList[4] = str_replace('$ID$', (string) $objectid, $InfoFieldList[4]); |
|
8539 | 8539 | } else { |
8540 | 8540 | $InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]); |
8541 | 8541 | } |
@@ -8552,7 +8552,7 @@ discard block |
||
8552 | 8552 | } |
8553 | 8553 | // Some tables may have field, some other not. For the moment we disable it. |
8554 | 8554 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
8555 | - $sqlwhere .= " AND entity = " . ((int)$conf->entity); |
|
8555 | + $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
8556 | 8556 | } |
8557 | 8557 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
8558 | 8558 | // print $sql; |
@@ -9257,7 +9257,7 @@ discard block |
||
9257 | 9257 | // If field is an implicit foreign key field (so type = 'integer:...') |
9258 | 9258 | if (isset($key_fields['type']) && preg_match('/^integer:/i', $key_fields['type']) && empty($values[$key])) { |
9259 | 9259 | if (isset($key_fields['default'])) { |
9260 | - $values[$key] = ((int)$key_fields['default']); |
|
9260 | + $values[$key] = ((int) $key_fields['default']); |
|
9261 | 9261 | } else { |
9262 | 9262 | $values[$key] = 'null'; |
9263 | 9263 | } |
@@ -9276,7 +9276,7 @@ discard block |
||
9276 | 9276 | if (!$error) { |
9277 | 9277 | $sql = "INSERT INTO " . $this->db->prefix() . $this->table_element; |
9278 | 9278 | $sql .= " (" . implode(", ", $keys) . ')'; |
9279 | - $sql .= " VALUES (" . implode(", ", $values) . ")"; // $values can contains 'abc' or 123 |
|
9279 | + $sql .= " VALUES (" . implode(", ", $values) . ")"; // $values can contains 'abc' or 123 |
|
9280 | 9280 | |
9281 | 9281 | $res = $this->db->query($sql); |
9282 | 9282 | if (!$res) { |
@@ -9297,7 +9297,7 @@ discard block |
||
9297 | 9297 | if (!$error) { |
9298 | 9298 | // @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset |
9299 | 9299 | if (array_key_exists('ref', $this->fields) && array_key_exists('notnull', $this->fields['ref']) && $this->fields['ref']['notnull'] > 0 && array_key_exists('default', $this->fields['ref']) && $this->fields['ref']['default'] == '(PROV)') { |
9300 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET ref = '(PROV" . ((int)$this->id) . ")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = " . ((int)$this->id); |
|
9300 | + $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET ref = '(PROV" . ((int) $this->id) . ")' WHERE (ref = '(PROV)' OR ref = '') AND rowid = " . ((int) $this->id); |
|
9301 | 9301 | $resqlupdate = $this->db->query($sql); |
9302 | 9302 | |
9303 | 9303 | if ($resqlupdate === false) { |
@@ -9326,7 +9326,7 @@ discard block |
||
9326 | 9326 | // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array |
9327 | 9327 | //if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object. |
9328 | 9328 | if (!is_object($line)) { |
9329 | - $line = (object)$line; |
|
9329 | + $line = (object) $line; |
|
9330 | 9330 | } |
9331 | 9331 | |
9332 | 9332 | $result = 0; |
@@ -9394,23 +9394,23 @@ discard block |
||
9394 | 9394 | $queryarray[$field] = 0; |
9395 | 9395 | } |
9396 | 9396 | } else { |
9397 | - $queryarray[$field] = (int)$this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9397 | + $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9398 | 9398 | } |
9399 | 9399 | } else { |
9400 | 9400 | $queryarray[$field] = null; |
9401 | 9401 | } |
9402 | 9402 | } elseif ($this->isInt($info) || $this->isFloat($info)) { |
9403 | 9403 | if ($field == 'entity' && is_null($this->{$field})) { |
9404 | - $queryarray[$field] = ((int)$conf->entity); |
|
9404 | + $queryarray[$field] = ((int) $conf->entity); |
|
9405 | 9405 | } else { |
9406 | 9406 | // $this->{$field} may be null, '', 0, '0', 123, '123' |
9407 | - if ((isset($this->{$field}) && ((string)$this->{$field}) != '') || !empty($info['notnull'])) { |
|
9407 | + if ((isset($this->{$field}) && ((string) $this->{$field}) != '') || !empty($info['notnull'])) { |
|
9408 | 9408 | if (!isset($this->{$field})) { |
9409 | 9409 | $queryarray[$field] = 0; |
9410 | 9410 | } elseif ($this->isInt($info)) { |
9411 | - $queryarray[$field] = (int)$this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9411 | + $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9412 | 9412 | } elseif ($this->isFloat($info)) { |
9413 | - $queryarray[$field] = (float)$this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9413 | + $queryarray[$field] = (float) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 |
|
9414 | 9414 | } |
9415 | 9415 | } else { |
9416 | 9416 | $queryarray[$field] = null; |
@@ -9445,9 +9445,9 @@ discard block |
||
9445 | 9445 | if (is_null($value)) { |
9446 | 9446 | return 'NULL'; |
9447 | 9447 | } elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) { |
9448 | - return price2num((string)$value); |
|
9448 | + return price2num((string) $value); |
|
9449 | 9449 | } elseif (preg_match('/int$/i', $fieldsentry['type'])) { |
9450 | - return (int)$value; |
|
9450 | + return (int) $value; |
|
9451 | 9451 | } elseif ($fieldsentry['type'] == 'boolean') { |
9452 | 9452 | if ($value) { |
9453 | 9453 | return 'true'; |
@@ -9479,7 +9479,7 @@ discard block |
||
9479 | 9479 | |
9480 | 9480 | $sql = "SELECT " . $objectline->getFieldList('l'); |
9481 | 9481 | $sql .= " FROM " . $this->db->prefix() . $objectline->table_element . " as l"; |
9482 | - $sql .= " WHERE l.fk_" . $this->db->escape($this->element) . " = " . ((int)$this->id); |
|
9482 | + $sql .= " WHERE l.fk_" . $this->db->escape($this->element) . " = " . ((int) $this->id); |
|
9483 | 9483 | if ($morewhere) { |
9484 | 9484 | $sql .= $morewhere; |
9485 | 9485 | } |
@@ -9588,7 +9588,7 @@ discard block |
||
9588 | 9588 | }*/ |
9589 | 9589 | } |
9590 | 9590 | |
9591 | - $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element . ' SET ' . implode(', ', $tmp) . ' WHERE rowid=' . ((int)$this->id); |
|
9591 | + $sql = 'UPDATE ' . $this->db->prefix() . $this->table_element . ' SET ' . implode(', ', $tmp) . ' WHERE rowid=' . ((int) $this->id); |
|
9592 | 9592 | |
9593 | 9593 | $this->db->begin(); |
9594 | 9594 | |
@@ -9602,7 +9602,7 @@ discard block |
||
9602 | 9602 | |
9603 | 9603 | // Update extrafield |
9604 | 9604 | if (!$error) { |
9605 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
9605 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
9606 | 9606 | if ($result < 0) { |
9607 | 9607 | $error++; |
9608 | 9608 | } |
@@ -9646,7 +9646,7 @@ discard block |
||
9646 | 9646 | |
9647 | 9647 | if ($forcechilddeletion) { // Force also delete of childtables that should lock deletion in standard case when option force is off |
9648 | 9648 | foreach ($this->childtables as $table) { |
9649 | - $sql = "DELETE FROM " . $this->db->prefix() . $table . " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
9649 | + $sql = "DELETE FROM " . $this->db->prefix() . $table . " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
9650 | 9650 | $resql = $this->db->query($sql); |
9651 | 9651 | if (!$resql) { |
9652 | 9652 | $this->error = $this->db->lasterror(); |
@@ -9700,7 +9700,7 @@ discard block |
||
9700 | 9700 | } |
9701 | 9701 | } else { |
9702 | 9702 | // Delete record in child table |
9703 | - $sql = "DELETE FROM " . $this->db->prefix() . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
9703 | + $sql = "DELETE FROM " . $this->db->prefix() . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
9704 | 9704 | |
9705 | 9705 | $resql = $this->db->query($sql); |
9706 | 9706 | if (!$resql) { |
@@ -9746,7 +9746,7 @@ discard block |
||
9746 | 9746 | } |
9747 | 9747 | |
9748 | 9748 | if (!$error) { |
9749 | - $sql = 'DELETE FROM ' . $this->db->prefix() . $this->table_element . ' WHERE rowid=' . ((int)$this->id); |
|
9749 | + $sql = 'DELETE FROM ' . $this->db->prefix() . $this->table_element . ' WHERE rowid=' . ((int) $this->id); |
|
9750 | 9750 | |
9751 | 9751 | $resql = $this->db->query($sql); |
9752 | 9752 | if (!$resql) { |
@@ -9787,7 +9787,7 @@ discard block |
||
9787 | 9787 | return -1; |
9788 | 9788 | } |
9789 | 9789 | |
9790 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
9790 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
9791 | 9791 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
9792 | 9792 | $tmparray = array_keys($this->childtables); |
9793 | 9793 | if (is_numeric($tmparray[0])) { |
@@ -9805,9 +9805,9 @@ discard block |
||
9805 | 9805 | $sql .= ", " . $this->db->prefix() . $element['parent'] . " as p"; |
9806 | 9806 | } |
9807 | 9807 | if (!empty($element['fk_element'])) { |
9808 | - $sql .= " WHERE c." . $element['fk_element'] . " = " . ((int)$id); |
|
9808 | + $sql .= " WHERE c." . $element['fk_element'] . " = " . ((int) $id); |
|
9809 | 9809 | } else { |
9810 | - $sql .= " WHERE c." . $this->fk_element . " = " . ((int)$id); |
|
9810 | + $sql .= " WHERE c." . $this->fk_element . " = " . ((int) $id); |
|
9811 | 9811 | } |
9812 | 9812 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
9813 | 9813 | $sql .= " AND c." . $element['parentkey'] . " = p.rowid"; |
@@ -9817,9 +9817,9 @@ discard block |
||
9817 | 9817 | } |
9818 | 9818 | if (!empty($entity)) { |
9819 | 9819 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
9820 | - $sql .= " AND p.entity = " . ((int)$entity); |
|
9820 | + $sql .= " AND p.entity = " . ((int) $entity); |
|
9821 | 9821 | } else { |
9822 | - $sql .= " AND c.entity = " . ((int)$entity); |
|
9822 | + $sql .= " AND c.entity = " . ((int) $entity); |
|
9823 | 9823 | } |
9824 | 9824 | } |
9825 | 9825 | |
@@ -9874,7 +9874,7 @@ discard block |
||
9874 | 9874 | $this->db->begin(); |
9875 | 9875 | |
9876 | 9876 | $sql = "SELECT rowid FROM " . $this->db->prefix() . $this->table_element; |
9877 | - $sql .= " WHERE " . $this->db->sanitize($parentField) . " = " . (int)$parentId; |
|
9877 | + $sql .= " WHERE " . $this->db->sanitize($parentField) . " = " . (int) $parentId; |
|
9878 | 9878 | |
9879 | 9879 | // Manage filter |
9880 | 9880 | $errormessage = ''; |
@@ -9891,7 +9891,7 @@ discard block |
||
9891 | 9891 | $error++; |
9892 | 9892 | } else { |
9893 | 9893 | while ($obj = $this->db->fetch_object($resql)) { |
9894 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
9894 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
9895 | 9895 | if ($result < 0) { |
9896 | 9896 | $error++; |
9897 | 9897 | $this->errors[] = $this->error; |
@@ -9968,7 +9968,7 @@ discard block |
||
9968 | 9968 | // Delete ecm_files_extrafields with mode 0 (using name) |
9969 | 9969 | $sql = "DELETE FROM " . $this->db->prefix() . "ecm_files_extrafields WHERE fk_object IN ("; |
9970 | 9970 | $sql .= " SELECT rowid FROM " . $this->db->prefix() . "ecm_files WHERE filename LIKE '" . $this->db->escape($this->ref) . "%'"; |
9971 | - $sql .= " AND filepath = '" . $this->db->escape($element) . "/" . $this->db->escape($this->ref) . "' AND entity = " . ((int)$conf->entity); // No need of getEntity here |
|
9971 | + $sql .= " AND filepath = '" . $this->db->escape($element) . "/" . $this->db->escape($this->ref) . "' AND entity = " . ((int) $conf->entity); // No need of getEntity here |
|
9972 | 9972 | $sql .= ")"; |
9973 | 9973 | |
9974 | 9974 | if (!$this->db->query($sql)) { |
@@ -9980,7 +9980,7 @@ discard block |
||
9980 | 9980 | // Delete ecm_files with mode 0 (using name) |
9981 | 9981 | $sql = "DELETE FROM " . $this->db->prefix() . "ecm_files"; |
9982 | 9982 | $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%'"; |
9983 | - $sql .= " AND filepath = '" . $this->db->escape($element) . "/" . $this->db->escape($this->ref) . "' AND entity = " . ((int)$conf->entity); // No need of getEntity here |
|
9983 | + $sql .= " AND filepath = '" . $this->db->escape($element) . "/" . $this->db->escape($this->ref) . "' AND entity = " . ((int) $conf->entity); // No need of getEntity here |
|
9984 | 9984 | |
9985 | 9985 | if (!$this->db->query($sql)) { |
9986 | 9986 | $this->error = $this->db->lasterror(); |
@@ -9992,7 +9992,7 @@ discard block |
||
9992 | 9992 | // Delete in database with mode 1 |
9993 | 9993 | if ($mode == 1) { |
9994 | 9994 | $sql = 'DELETE FROM ' . $this->db->prefix() . "ecm_files_extrafields"; |
9995 | - $sql .= " WHERE fk_object IN (SELECT rowid FROM " . $this->db->prefix() . "ecm_files WHERE src_object_type = '" . $this->db->escape($this->table_element . (empty($this->module) ? "" : "@" . $this->module)) . "' AND src_object_id = " . ((int)$this->id) . ")"; |
|
9995 | + $sql .= " WHERE fk_object IN (SELECT rowid FROM " . $this->db->prefix() . "ecm_files WHERE src_object_type = '" . $this->db->escape($this->table_element . (empty($this->module) ? "" : "@" . $this->module)) . "' AND src_object_id = " . ((int) $this->id) . ")"; |
|
9996 | 9996 | $resql = $this->db->query($sql); |
9997 | 9997 | if (!$resql) { |
9998 | 9998 | $this->error = $this->db->lasterror(); |
@@ -10001,7 +10001,7 @@ discard block |
||
10001 | 10001 | } |
10002 | 10002 | |
10003 | 10003 | $sql = 'DELETE FROM ' . $this->db->prefix() . "ecm_files"; |
10004 | - $sql .= " WHERE src_object_type = '" . $this->db->escape($this->table_element . (empty($this->module) ? "" : "@" . $this->module)) . "' AND src_object_id = " . ((int)$this->id); |
|
10004 | + $sql .= " WHERE src_object_type = '" . $this->db->escape($this->table_element . (empty($this->module) ? "" : "@" . $this->module)) . "' AND src_object_id = " . ((int) $this->id); |
|
10005 | 10005 | $resql = $this->db->query($sql); |
10006 | 10006 | if (!$resql) { |
10007 | 10007 | $this->error = $this->db->lasterror(); |
@@ -10065,18 +10065,18 @@ discard block |
||
10065 | 10065 | $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
10066 | 10066 | $sql .= " WHERE"; |
10067 | 10067 | if ($rowid > 0) { |
10068 | - $sql .= " rowid = " . ((int)$rowid); |
|
10068 | + $sql .= " rowid = " . ((int) $rowid); |
|
10069 | 10069 | } else { |
10070 | 10070 | if ($deletesource) { |
10071 | - $sql .= " fk_source = " . ((int)$sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
10072 | - $sql .= " AND fk_target = " . ((int)$this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
10071 | + $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
10072 | + $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
10073 | 10073 | } elseif ($deletetarget) { |
10074 | - $sql .= " fk_target = " . ((int)$targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
10075 | - $sql .= " AND fk_source = " . ((int)$this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
10074 | + $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
10075 | + $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
10076 | 10076 | } else { |
10077 | - $sql .= " (fk_source = " . ((int)$this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
10077 | + $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
10078 | 10078 | $sql .= " OR"; |
10079 | - $sql .= " (fk_target = " . ((int)$this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
10079 | + $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
10080 | 10080 | } |
10081 | 10081 | } |
10082 | 10082 | |
@@ -10120,7 +10120,7 @@ discard block |
||
10120 | 10120 | |
10121 | 10121 | dol_syslog(get_class($this) . "::deleteExtraFields delete", LOG_DEBUG); |
10122 | 10122 | |
10123 | - $sql_del = "DELETE FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int)$this->id); |
|
10123 | + $sql_del = "DELETE FROM " . $this->db->prefix() . $table_element . "_extrafields WHERE fk_object = " . ((int) $this->id); |
|
10124 | 10124 | |
10125 | 10125 | $resql = $this->db->query($sql_del); |
10126 | 10126 | if (!$resql) { |
@@ -10159,7 +10159,7 @@ discard block |
||
10159 | 10159 | |
10160 | 10160 | if (empty($error)) { |
10161 | 10161 | $sql = "DELETE FROM " . $this->db->prefix() . $this->table_element_line; |
10162 | - $sql .= " WHERE rowid = " . ((int)$idline); |
|
10162 | + $sql .= " WHERE rowid = " . ((int) $idline); |
|
10163 | 10163 | |
10164 | 10164 | $resql = $this->db->query($sql); |
10165 | 10165 | if (!$resql) { |
@@ -10213,8 +10213,8 @@ discard block |
||
10213 | 10213 | } |
10214 | 10214 | |
10215 | 10215 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
10216 | - $sql .= " SET " . $statusfield . " = " . ((int)$status); |
|
10217 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
10216 | + $sql .= " SET " . $statusfield . " = " . ((int) $status); |
|
10217 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
10218 | 10218 | |
10219 | 10219 | if ($this->db->query($sql)) { |
10220 | 10220 | if (!$error) { |
@@ -10265,8 +10265,8 @@ discard block |
||
10265 | 10265 | $statusfield = 'signed_status'; |
10266 | 10266 | |
10267 | 10267 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element; |
10268 | - $sql .= " SET " . $statusfield . " = " . ((int)$status); |
|
10269 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
10268 | + $sql .= " SET " . $statusfield . " = " . ((int) $status); |
|
10269 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
10270 | 10270 | |
10271 | 10271 | if ($this->db->query($sql)) { |
10272 | 10272 | if (!$error) { |
@@ -10323,7 +10323,7 @@ discard block |
||
10323 | 10323 | ); |
10324 | 10324 | foreach ($fields as $key => $value) { |
10325 | 10325 | if (array_key_exists($key, $this->fields)) { |
10326 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
10326 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
10327 | 10327 | } |
10328 | 10328 | } |
10329 | 10329 | |
@@ -10511,7 +10511,7 @@ discard block |
||
10511 | 10511 | |
10512 | 10512 | $sql = "INSERT INTO " . $this->db->prefix() . "categorie_" . (empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type]) . " (fk_categorie, fk_product)"; |
10513 | 10513 | $sql .= " SELECT fk_categorie, $toId FROM " . $this->db->prefix() . "categorie_" . (empty($categorystatic->MAP_CAT_TABLE[$type]) ? $type : $categorystatic->MAP_CAT_TABLE[$type]); |
10514 | - $sql .= " WHERE fk_product = " . ((int)$fromId); |
|
10514 | + $sql .= " WHERE fk_product = " . ((int) $fromId); |
|
10515 | 10515 | |
10516 | 10516 | if (!$this->db->query($sql)) { |
10517 | 10517 | $this->error = $this->db->lasterror(); |
@@ -10773,7 +10773,7 @@ discard block |
||
10773 | 10773 | $setsharekey = false; |
10774 | 10774 | if ($this->element == 'propal' || $this->element == 'proposal') { |
10775 | 10775 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
10776 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
10776 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
10777 | 10777 | } |
10778 | 10778 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
10779 | 10779 | $setsharekey = true; |
@@ -10831,7 +10831,7 @@ discard block |
||
10831 | 10831 | $ecmfile->gen_or_uploaded = 'generated'; |
10832 | 10832 | $ecmfile->description = ''; // indexed content |
10833 | 10833 | $ecmfile->keywords = ''; // keyword content |
10834 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
10834 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
10835 | 10835 | $ecmfile->src_object_id = $this->id; |
10836 | 10836 | |
10837 | 10837 | $result = $ecmfile->create($user); |
@@ -10848,7 +10848,7 @@ discard block |
||
10848 | 10848 | |
10849 | 10849 | if ($update_main_doc_field && !empty($this->table_element)) { |
10850 | 10850 | $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET last_main_doc = '" . $this->db->escape($ecmfile->filepath . "/" . $ecmfile->filename) . "'"; |
10851 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
10851 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
10852 | 10852 | |
10853 | 10853 | $resql = $this->db->query($sql); |
10854 | 10854 | if (!$resql) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | dol_get_fiche_head($head, 'ticket', $langs->trans("Contract"), -1, 'contract'); |
75 | 75 | |
76 | -$linkback = '<a href="' . constant('BASE_URL') . '/contrat/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">'; |
|
76 | +$linkback = '<a href="' . constant('BASE_URL') . '/contrat/list.php' . (!empty($socid) ? '?socid=' . $socid : '') . '">'; |
|
77 | 77 | $linkback .= $langs->trans("BackToList") . '</a>'; |
78 | 78 | |
79 | 79 | $morehtmlref = ''; |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | // Thirdparty |
135 | 135 | $morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
136 | 136 | // Project |
137 | -if (! empty($conf->projet->enabled)) { |
|
137 | +if (!empty($conf->projet->enabled)) { |
|
138 | 138 | |
139 | 139 | $langs->load("projects"); |
140 | 140 | $morehtmlref .= '<br>' . $langs->trans('Project') . ' : '; |
141 | - if (! empty($object->fk_project)) { |
|
141 | + if (!empty($object->fk_project)) { |
|
142 | 142 | $proj = new Project($db); |
143 | 143 | $proj->fetch($object->fk_project); |
144 | 144 | $morehtmlref .= '<a href="' . constant('BASE_URL') . '/projet/card.php?id='; |
@@ -4207,7 +4207,7 @@ discard block |
||
4207 | 4207 | } |
4208 | 4208 | |
4209 | 4209 | if (!is_object($user)) { |
4210 | - $user = new User($db); // To avoid error during migration |
|
4210 | + $user = new User($db); // To avoid error during migration |
|
4211 | 4211 | } |
4212 | 4212 | |
4213 | 4213 | dolibarr_install_syslog("upgrade2::migrate_reload_modules force=" . $force . ", listofmodule=" . implode(',', array_keys($listofmodule))); |
@@ -5038,7 +5038,7 @@ discard block |
||
5038 | 5038 | $error++; |
5039 | 5039 | } |
5040 | 5040 | |
5041 | - $current_contract = $obj->cid; |
|
5041 | + $current_contract = $obj->cid; |
|
5042 | 5042 | } |
5043 | 5043 | } else { |
5044 | 5044 | $error++; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public $error = ''; |
46 | 46 | |
47 | 47 | |
48 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
48 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
49 | 49 | /** |
50 | 50 | * Return list of active generation modules |
51 | 51 | * |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function liste_modeles($db, $maxfilenamelength = 0) |
57 | 57 | { |
58 | - // phpcs:enable |
|
58 | + // phpcs:enable |
|
59 | 59 | $type = 'user'; |
60 | 60 | $list = array(); |
61 | 61 |
@@ -1504,8 +1504,8 @@ |
||
1504 | 1504 | $actioncomm = new ActionComm($this->db); |
1505 | 1505 | $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
1506 | 1506 | $actioncomm->code = 'AC_' . $action; |
1507 | - $actioncomm->label = $object->actionmsg2; // Label of event |
|
1508 | - $actioncomm->note_private = $object->actionmsg; // Description |
|
1507 | + $actioncomm->label = $object->actionmsg2; // Label of event |
|
1508 | + $actioncomm->note_private = $object->actionmsg; // Description |
|
1509 | 1509 | $actioncomm->fk_project = $projectid; |
1510 | 1510 | $actioncomm->datep = $now; |
1511 | 1511 | $actioncomm->datef = $now; |
@@ -287,7 +287,7 @@ |
||
287 | 287 | print '<tr class="oddeven" id="tredit"><td>'; |
288 | 288 | print $langs->trans("Text"); |
289 | 289 | print '</td><td>'; |
290 | - $extendededitor = 0; // We force no WYSIWYG editor |
|
290 | + $extendededitor = 0; // We force no WYSIWYG editor |
|
291 | 291 | $doleditor = new DolEditor('USER_PUBLIC_MORE', getDolUserString('USER_PUBLIC_MORE', '', $object), '', 160, 'dolibarr_notes', '', false, false, $extendededitor, ROWS_5, '90%'); |
292 | 292 | $doleditor->Create(); |
293 | 293 | print "</td></tr>\n"; |