@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $langs->loadLangs(array("users", "companies", "agenda", "commercial", "other", "orders", "bills")); |
52 | 52 | |
53 | 53 | // Get Parameters |
54 | -$action = GETPOST('action', 'aZ09'); |
|
54 | +$action = GETPOST('action', 'aZ09'); |
|
55 | 55 | $massaction = GETPOST('massaction', 'alpha'); |
56 | -$confirm = GETPOST('confirm', 'alpha'); |
|
56 | +$confirm = GETPOST('confirm', 'alpha'); |
|
57 | 57 | $cancel = GETPOST('cancel', 'alpha'); |
58 | -$toselect = GETPOST('toselect', 'array'); |
|
58 | +$toselect = GETPOST('toselect', 'array'); |
|
59 | 59 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search |
60 | 60 | $optioncss = GETPOST('optioncss', 'alpha'); |
61 | 61 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $mode = GETPOST('mode', 'aZ09'); |
66 | 66 | if (empty($mode) && preg_match('/show_/', $action)) { |
67 | - $mode = $action; // For backward compatibility |
|
67 | + $mode = $action; // For backward compatibility |
|
68 | 68 | } |
69 | 69 | $resourceid = GETPOSTINT("search_resourceid") ? GETPOSTINT("search_resourceid") : GETPOSTINT("resourceid"); |
70 | 70 | $pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | if (isModEnabled('category') && $user->hasRight('agenda', 'myactions', 'create')) { |
422 | 422 | $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); |
423 | 423 | } |
424 | -if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) { |
|
424 | +if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { |
|
425 | 425 | $arrayofmassactions = array(); |
426 | 426 | } |
427 | 427 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | $event_owner_style = ''; |
998 | 998 | // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) |
999 | 999 | if ($obj->fk_user_action > 0 && $cache_user_list[$obj->fk_user_action]->color != '') { |
1000 | - $event_owner_style .= 'border-left: #' . $cache_user_list[$obj->fk_user_action]->color . ' 5px solid;'; |
|
1000 | + $event_owner_style .= 'border-left: #'.$cache_user_list[$obj->fk_user_action]->color.' 5px solid;'; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | // get event style for start and end date |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | } |
1033 | 1033 | $event_start_date_css = $event_end_date_css = $event_more_class; |
1034 | 1034 | |
1035 | - print '<tr class="oddeven' . ($event_more_class != '' ? ' '.$event_more_class : '') . '">'; |
|
1035 | + print '<tr class="oddeven'.($event_more_class != '' ? ' '.$event_more_class : '').'">'; |
|
1036 | 1036 | // Action column |
1037 | 1037 | if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
1038 | 1038 | print '<td class="nowrap center">'; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $offsetunit = GETPOST('offsetunittype_duration', 'aZ09'); |
83 | 83 | $remindertype = GETPOST('selectremindertype', 'aZ09'); |
84 | 84 | $modelmail = GETPOSTINT('actioncommsendmodel_mail'); |
85 | -$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
85 | +$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed |
|
86 | 86 | $private = GETPOST('private', 'alphanohtml'); |
87 | 87 | if ($complete == 'na' || $complete == -2) { |
88 | 88 | $complete = -1; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | if (GETPOSTISSET("contactid")) { |
459 | 459 | $object->contact_id = GETPOSTINT("contactid"); |
460 | 460 | |
461 | - $object->contact = $contact; // For backward compatibility |
|
461 | + $object->contact = $contact; // For backward compatibility |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | if (GETPOSTINT('socid') > 0) { |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | if (is_array($listofresourceid) && count($listofresourceid)) { |
553 | 553 | foreach ($listofresourceid as $resource_id => $val) { |
554 | 554 | $resource_type = 'dolresource'; |
555 | - $busy = 1;//GETPOSTINT('busy'); |
|
555 | + $busy = 1; //GETPOSTINT('busy'); |
|
556 | 556 | |
557 | 557 | // Resources association |
558 | 558 | if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) { |
@@ -568,24 +568,24 @@ discard block |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | $sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label"; |
571 | - $sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er"; |
|
572 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'"; |
|
573 | - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'"; |
|
574 | - $sql .= " WHERE er.resource_id = " . ((int) $resource_id); |
|
571 | + $sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er"; |
|
572 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'"; |
|
573 | + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'"; |
|
574 | + $sql .= " WHERE er.resource_id = ".((int) $resource_id); |
|
575 | 575 | $sql .= " AND er.busy = 1"; |
576 | 576 | $sql .= " AND ("; |
577 | 577 | |
578 | 578 | // event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end) |
579 | - $sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))"; |
|
579 | + $sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))"; |
|
580 | 580 | // event date end between ac.datep and ac.datep2 |
581 | 581 | if (!empty($eventDateEnd)) { |
582 | - $sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))"; |
|
582 | + $sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))"; |
|
583 | 583 | } |
584 | 584 | // event date start before ac.datep and event date end after ac.datep2 |
585 | 585 | $sql .= " OR ("; |
586 | - $sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'"; |
|
586 | + $sql .= "ac.datep >= '".$db->idate($eventDateStart)."'"; |
|
587 | 587 | if (!empty($eventDateEnd)) { |
588 | - $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')"; |
|
588 | + $sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')"; |
|
589 | 589 | } |
590 | 590 | $sql .= ")"; |
591 | 591 | |
@@ -599,9 +599,9 @@ discard block |
||
599 | 599 | if ($db->num_rows($resql) > 0) { |
600 | 600 | // Resource already in use |
601 | 601 | $error++; |
602 | - $object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : '; |
|
602 | + $object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : '; |
|
603 | 603 | while ($obj = $db->fetch_object($resql)) { |
604 | - $object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']'); |
|
604 | + $object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']'); |
|
605 | 605 | } |
606 | 606 | $object->errors[] = $object->error; |
607 | 607 | } |
@@ -706,12 +706,12 @@ discard block |
||
706 | 706 | if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) { |
707 | 707 | $firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear")); |
708 | 708 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel'); |
709 | - $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after |
|
709 | + $datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after |
|
710 | 710 | $dayoffset = 7; |
711 | 711 | $monthoffset = 0; |
712 | 712 | } elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) { |
713 | 713 | $firstday = $selectedrecurrulebymonthday; |
714 | - $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the week after |
|
714 | + $firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the week after |
|
715 | 715 | $datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel'); |
716 | 716 | $dayoffset = 0; |
717 | 717 | $monthoffset = 1; |
@@ -816,9 +816,9 @@ discard block |
||
816 | 816 | |
817 | 817 | // increment date for recurrent events |
818 | 818 | $datep = dol_time_plus_duree($datep, $dayoffset, 'd'); |
819 | - $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
819 | + $datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
820 | 820 | $datef = dol_time_plus_duree($datef, $dayoffset, 'd'); |
821 | - $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
821 | + $datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | if (!empty($backtopage) && !$error) { |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | $object->fetch($id); |
861 | 861 | $object->fetch_optionals(); |
862 | 862 | $object->fetch_userassigned(); |
863 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
863 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
864 | 864 | |
865 | 865 | // Clean parameters |
866 | 866 | if ($fulldayevent) { |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | $object->fetch($id); |
1140 | 1140 | $object->fetch_optionals(); |
1141 | 1141 | $object->fetch_userassigned(); |
1142 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1142 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1143 | 1143 | |
1144 | 1144 | if ($user->hasRight('agenda', 'myactions', 'delete') |
1145 | 1145 | || $user->hasRight('agenda', 'allactions', 'delete')) { |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { |
1162 | 1162 | $error = 0; |
1163 | 1163 | |
1164 | - $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
1164 | + $shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user. |
|
1165 | 1165 | $smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel'); |
1166 | 1166 | |
1167 | 1167 | $newdate = GETPOST('newdate', 'alpha'); |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | if (new_startdate > old_enddate) { |
1336 | 1336 | var timeDiff = old_enddate - old_startdate; |
1337 | 1337 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
1338 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
1338 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
1339 | 1339 | $("#p2day").val(new_enddate.getDate()); |
1340 | 1340 | $("#p2month").val(new_enddate.getMonth() + 1); |
1341 | 1341 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | $default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV'); |
1394 | 1394 | print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); |
1395 | 1395 | $selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default); |
1396 | - print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
1396 | + print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot |
|
1397 | 1397 | print '</td></tr>'; |
1398 | 1398 | } |
1399 | 1399 | |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | } |
1733 | 1733 | //var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject); |
1734 | 1734 | |
1735 | - if (! in_array($origin, array('societe', 'project', 'task', 'user'))) { |
|
1735 | + if (!in_array($origin, array('societe', 'project', 'task', 'user'))) { |
|
1736 | 1736 | // We do not use link for object that already contains a hard coded field to make links with agenda events |
1737 | 1737 | print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>'; |
1738 | 1738 | print '<td colspan="3">'; |
@@ -1821,7 +1821,7 @@ discard block |
||
1821 | 1821 | $("#addreminder").prop("checked", true); |
1822 | 1822 | |
1823 | 1823 | // Set period with default reminder period |
1824 | - $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\'); |
|
1824 | + $("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\'); |
|
1825 | 1825 | $("#select_offsetunittype_duration").select2("destroy"); |
1826 | 1826 | $("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\'); |
1827 | 1827 | $("#select_offsetunittype_duration").select2(); |
@@ -1918,7 +1918,7 @@ discard block |
||
1918 | 1918 | $object->socpeopleassigned[$id] = array('id' => $tmpid); |
1919 | 1919 | } |
1920 | 1920 | $object->contact_id = GETPOSTINT("contactid"); |
1921 | - $object->fk_project = GETPOSTINT("projectid"); |
|
1921 | + $object->fk_project = GETPOSTINT("projectid"); |
|
1922 | 1922 | |
1923 | 1923 | $object->note_private = GETPOST("note", 'restricthtml'); |
1924 | 1924 | } |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | if (new_startdate > old_enddate) { |
1997 | 1997 | var timeDiff = old_enddate - old_startdate; |
1998 | 1998 | var new_enddate = new Date(new_startdate.getTime() + timeDiff); |
1999 | - $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '")); |
|
1999 | + $("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'")); |
|
2000 | 2000 | $("#p2day").val(new_enddate.getDate()); |
2001 | 2001 | $("#p2month").val(new_enddate.getMonth() + 1); |
2002 | 2002 | $("#p2year").val(new_enddate.getFullYear()); |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | if ($backtopage) { |
2022 | 2022 | print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">'; |
2023 | 2023 | } |
2024 | - if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
2024 | + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { |
|
2025 | 2025 | print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">'; |
2026 | 2026 | } |
2027 | 2027 | |
@@ -2447,7 +2447,7 @@ discard block |
||
2447 | 2447 | }); |
2448 | 2448 | })'; |
2449 | 2449 | print '</script>'."\n"; |
2450 | - print '</div>'; // End of div for reminderparameters |
|
2450 | + print '</div>'; // End of div for reminderparameters |
|
2451 | 2451 | } |
2452 | 2452 | |
2453 | 2453 | print dol_get_fiche_end(); |
@@ -2719,7 +2719,7 @@ discard block |
||
2719 | 2719 | |
2720 | 2720 | // Priority |
2721 | 2721 | if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) { |
2722 | - print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>'; |
|
2722 | + print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>'; |
|
2723 | 2723 | print($object->priority ? $object->priority : ''); |
2724 | 2724 | print '</td></tr>'; |
2725 | 2725 | } |
@@ -576,8 +576,8 @@ discard block |
||
576 | 576 | $sql .= "ip"; |
577 | 577 | $sql .= ") VALUES ("; |
578 | 578 | $sql .= "'(PROV)', "; |
579 | - $sql .= "'".$this->db->idate($now)."', "; // date creation |
|
580 | - $sql .= "'".$this->db->idate($this->datep)."', "; // date start event |
|
579 | + $sql .= "'".$this->db->idate($now)."', "; // date creation |
|
580 | + $sql .= "'".$this->db->idate($this->datep)."', "; // date start event |
|
581 | 581 | $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", "; |
582 | 582 | $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape((string) $this->durationp)."'" : "null").", "; // deprecated |
583 | 583 | $sql .= (isset($this->type_id) ? $this->type_id : "null").","; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $resql = $this->db->query($sql); |
652 | 652 | if (!$resql) { |
653 | 653 | $error++; |
654 | - dol_syslog('Error to process userassigned: ' . $this->db->lasterror(), LOG_ERR); |
|
654 | + dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR); |
|
655 | 655 | $this->errors[] = $this->db->lasterror(); |
656 | 656 | } else { |
657 | 657 | $already_inserted[$val['id']] = true; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $resql = $this->db->query($sql); |
677 | 677 | if (!$resql) { |
678 | 678 | $error++; |
679 | - dol_syslog('Error to process socpeopleassigned: ' . $this->db->lasterror(), LOG_ERR); |
|
679 | + dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR); |
|
680 | 680 | $this->errors[] = $this->db->lasterror(); |
681 | 681 | } else { |
682 | 682 | $already_inserted[$id] = true; |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm"; |
1187 | 1187 | $sql .= " SET percent = '".$this->db->escape((string) $this->percentage)."'"; |
1188 | 1188 | $sql .= ", fk_action = ".(int) $this->type_id; |
1189 | - $sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null"); |
|
1189 | + $sql .= ", code = ".($code ? "'".$this->db->escape($code)."'" : "null"); |
|
1190 | 1190 | $sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null"); |
1191 | 1191 | $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); |
1192 | 1192 | $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; |
1343 | 1343 | // Fields from hook |
1344 | 1344 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
1345 | - $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
1345 | + $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
1346 | 1346 | if (!empty($hookmanager->resPrint)) { |
1347 | 1347 | $sql .= $hookmanager->resPrint; |
1348 | 1348 | } |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | } |
1372 | 1372 | // Fields where hook |
1373 | 1373 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
1374 | - $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
1374 | + $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
1375 | 1375 | if (!empty($hookmanager->resPrint)) { |
1376 | 1376 | $sql .= $hookmanager->resPrint; |
1377 | 1377 | } |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | $resql = $this->db->query($sql); |
1450 | 1450 | if ($resql) { |
1451 | - $response = null; // Ensure the variable is defined |
|
1451 | + $response = null; // Ensure the variable is defined |
|
1452 | 1452 | if (empty($load_state_board)) { |
1453 | 1453 | $agenda_static = new ActionComm($this->db); |
1454 | 1454 | $response = new WorkboardResponse(); |
@@ -1662,7 +1662,7 @@ discard block |
||
1662 | 1662 | |
1663 | 1663 | // show categories for this record only in ajax to not overload lists |
1664 | 1664 | if (isModEnabled('category') && !$nofetch) { |
1665 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
1665 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
1666 | 1666 | if (empty($form)) { |
1667 | 1667 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; |
1668 | 1668 | $form = new Form($this->db); |
@@ -1764,8 +1764,8 @@ discard block |
||
1764 | 1764 | } |
1765 | 1765 | if (!empty($this->note_private)) { |
1766 | 1766 | $tooltip .= '<br><hr>'; |
1767 | - $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
1768 | - $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
1767 | + $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
1768 | + $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
1769 | 1769 | $tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow)); |
1770 | 1770 | $tooltip .= '</div>'; |
1771 | 1771 | } |
@@ -2568,7 +2568,7 @@ discard block |
||
2568 | 2568 | */ |
2569 | 2569 | public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id) |
2570 | 2570 | { |
2571 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); |
|
2571 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm SET fk_element = '.((int) $dest_id).' WHERE elementtype="product" AND fk_element = '.((int) $origin_id); |
|
2572 | 2572 | // using $dbs, not $this->db because function is static |
2573 | 2573 | if (!$dbs->query($sql)) { |
2574 | 2574 | //$this->errors = $dbs->lasterror(); |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | //Select all action comm reminders |
2694 | 2694 | $sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder"; |
2695 | 2695 | $sql .= " WHERE typeremind = 'email'"; |
2696 | - $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
2696 | + $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
2697 | 2697 | $sql .= " AND dateremind <= '".$this->db->idate($now)."'"; |
2698 | 2698 | $sql .= " AND entity IN (".getEntity('actioncomm').")"; |
2699 | 2699 | $sql .= $this->db->order("dateremind", "ASC"); |
@@ -2702,7 +2702,7 @@ discard block |
||
2702 | 2702 | if ($resql) { |
2703 | 2703 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
2704 | 2704 | $formmail = new FormMail($this->db); |
2705 | - $to = null; // Ensure 'to' is defined for static analysis |
|
2705 | + $to = null; // Ensure 'to' is defined for static analysis |
|
2706 | 2706 | |
2707 | 2707 | while ($obj = $this->db->fetch_object($resql)) { |
2708 | 2708 | $res = $actionCommReminder->fetch($obj->id); |
@@ -34,17 +34,17 @@ discard block |
||
34 | 34 | |
35 | 35 | // Load Dolibarr environment |
36 | 36 | require '../../main.inc.php'; |
37 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php'; |
|
38 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; |
|
39 | -require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
|
40 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
37 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php'; |
|
38 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; |
|
39 | +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
|
40 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
41 | 41 | if (isModEnabled('project')) { |
42 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
42 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
43 | 43 | } |
44 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
45 | -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
46 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; |
|
47 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
44 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
45 | +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
46 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; |
|
47 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * @var Conf $conf |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | $page = 0; |
95 | 95 | } // If $page is not defined, or '' or -1 |
96 | 96 | $offset = $limit * $page; |
97 | -if (! $sortorder) { |
|
97 | +if (!$sortorder) { |
|
98 | 98 | $sortorder = 'DESC'; |
99 | 99 | } |
100 | -if (! $sortfield) { |
|
100 | +if (!$sortfield) { |
|
101 | 101 | $sortfield = 'f.titre'; |
102 | 102 | } |
103 | 103 | $pageprev = $page - 1; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $object = new FactureFournisseurRec($db); |
107 | 107 | if (($id > 0 || $title) && $action != 'create' && $action != 'add') { |
108 | 108 | $ret = $object->fetch($id, $title); |
109 | - if (! $ret) { |
|
109 | + if (!$ret) { |
|
110 | 110 | setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); |
111 | 111 | } |
112 | 112 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $now = dol_now(); |
141 | 141 | |
142 | 142 | $error = 0; |
143 | -$predef = ''; // Legacy? Used in several cards, always '' |
|
143 | +$predef = ''; // Legacy? Used in several cards, always '' |
|
144 | 144 | |
145 | 145 | $result = restrictedArea($user, 'supplier_invoicerec', $object->id, $objecttype); |
146 | 146 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $action = 'list'; |
154 | 154 | $massaction = ''; |
155 | 155 | } |
156 | -if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
|
156 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
|
157 | 157 | $massaction = ''; |
158 | 158 | } |
159 | 159 | |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | // Selection of new fields |
172 | - include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
|
172 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; |
|
173 | 173 | |
174 | 174 | // Set note |
175 | - include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once' |
|
175 | + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once' |
|
176 | 176 | |
177 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
177 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
178 | 178 | |
179 | - include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once' |
|
179 | + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once' |
|
180 | 180 | |
181 | 181 | // Create predefined invoice |
182 | 182 | if ($action == 'add' && $permissiontoadd) { |
183 | - if (! GETPOST('title', 'alphanohtml')) { |
|
183 | + if (!GETPOST('title', 'alphanohtml')) { |
|
184 | 184 | setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); |
185 | 185 | $action = "create"; |
186 | 186 | $error++; |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | - if (! $error) { |
|
206 | + if (!$error) { |
|
207 | 207 | $object->subtype = GETPOSTINT('subtype'); |
208 | 208 | $object->title = GETPOST('title', 'alphanohtml'); |
209 | - $object->libelle = GETPOST('libelle', 'alpha'); // deprecated |
|
209 | + $object->libelle = GETPOST('libelle', 'alpha'); // deprecated |
|
210 | 210 | $object->label = GETPOST('libelle', 'alpha'); |
211 | 211 | $object->fk_project = GETPOSTINT('projectid'); |
212 | 212 | $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | $action = "create"; |
253 | 253 | } |
254 | 254 | |
255 | - if (! $error) { |
|
255 | + if (!$error) { |
|
256 | 256 | $db->commit(); |
257 | 257 | |
258 | - header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); |
|
258 | + header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); |
|
259 | 259 | exit; |
260 | 260 | } else { |
261 | 261 | $db->rollback(); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $permissiontodelete) { |
273 | 273 | $object->delete($user); |
274 | 274 | |
275 | - header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php'); |
|
275 | + header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php'); |
|
276 | 276 | exit; |
277 | 277 | } |
278 | 278 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user); |
303 | 303 | |
304 | 304 | if ($result > 0) { |
305 | - $object->titre = $title; // deprecated |
|
305 | + $object->titre = $title; // deprecated |
|
306 | 306 | $object->title = $title; |
307 | 307 | $object->ref = $object->title; |
308 | 308 | } else { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $error++; |
350 | 350 | } |
351 | 351 | |
352 | - if (! $error) { |
|
352 | + if (!$error) { |
|
353 | 353 | $db->commit(); |
354 | 354 | } else { |
355 | 355 | $db->rollback(); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $error++; |
367 | 367 | } |
368 | 368 | |
369 | - if (! $error) { |
|
369 | + if (!$error) { |
|
370 | 370 | $db->commit(); |
371 | 371 | } else { |
372 | 372 | $db->rollback(); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | setEventMessages($line->error, $line->errors, 'errors'); |
418 | 418 | } |
419 | 419 | } elseif ($action == 'update_extras' && $permissiontoadd) { |
420 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
420 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
421 | 421 | |
422 | 422 | // Fill array 'array_options' with data from update form |
423 | 423 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $error++; |
426 | 426 | } |
427 | 427 | |
428 | - if (! $error) { |
|
428 | + if (!$error) { |
|
429 | 429 | $result = $object->insertExtraFields('BILLREC_MODIFY'); |
430 | 430 | if ($result < 0) { |
431 | 431 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -454,9 +454,9 @@ discard block |
||
454 | 454 | $tva_tx = ''; |
455 | 455 | } |
456 | 456 | |
457 | - $qty = GETPOST('qty' . $predef, 'alpha'); |
|
458 | - $qty = ($qty === '') ? '' : (float) price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2); |
|
459 | - $remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2); |
|
457 | + $qty = GETPOST('qty'.$predef, 'alpha'); |
|
458 | + $qty = ($qty === '') ? '' : (float) price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); |
|
459 | + $remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2); |
|
460 | 460 | |
461 | 461 | // Extrafields |
462 | 462 | $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | if (is_array($extralabelsline)) { |
466 | 466 | // Get extra fields |
467 | 467 | foreach ($extralabelsline as $key => $value) { |
468 | - unset($_POST["options_" . $key . $predef]); |
|
468 | + unset($_POST["options_".$key.$predef]); |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); |
478 | 478 | $error++; |
479 | 479 | } |
480 | - if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not '' |
|
480 | + if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) { // Unit price can be 0 but not '' |
|
481 | 481 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); |
482 | 482 | $error++; |
483 | 483 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
530 | - if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { |
|
530 | + if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { |
|
531 | 531 | $ret = $object->fetch($id); |
532 | 532 | if ($ret < 0) { |
533 | 533 | dol_print_error($db, $object->error); |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | $ret = $object->fetch_thirdparty(); |
537 | 537 | |
538 | 538 | // Clean parameters |
539 | - $date_start = dol_mktime(GETPOSTINT('date_start' . $predef . 'hour'), GETPOSTINT('date_start' . $predef . 'min'), GETPOSTINT('date_start' . $predef . 'sec'), GETPOSTINT('date_start' . $predef . 'month'), GETPOSTINT('date_start' . $predef . 'day'), GETPOSTINT('date_start' . $predef . 'year')); |
|
540 | - $date_end = dol_mktime(GETPOSTINT('date_end' . $predef . 'hour'), GETPOSTINT('date_end' . $predef . 'min'), GETPOSTINT('date_end' . $predef . 'sec'), GETPOSTINT('date_end' . $predef . 'month'), GETPOSTINT('date_end' . $predef . 'day'), GETPOSTINT('date_end' . $predef . 'year')); |
|
539 | + $date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year')); |
|
540 | + $date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year')); |
|
541 | 541 | $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); |
542 | 542 | |
543 | 543 | // Define special_code for special lines |
@@ -635,23 +635,23 @@ discard block |
||
635 | 635 | $outputlangs->load('products'); |
636 | 636 | } |
637 | 637 | if (!empty($prod->customcode)) { |
638 | - $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; |
|
638 | + $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; |
|
639 | 639 | } |
640 | 640 | if (!empty($prod->customcode) && !empty($prod->country_code)) { |
641 | 641 | $tmptxt .= ' - '; |
642 | 642 | } |
643 | 643 | if (!empty($prod->country_code)) { |
644 | - $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $outputlangs, 0); |
|
644 | + $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $outputlangs, 0); |
|
645 | 645 | } |
646 | 646 | } else { |
647 | 647 | if (!empty($prod->customcode)) { |
648 | - $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; |
|
648 | + $tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; |
|
649 | 649 | } |
650 | 650 | if (!empty($prod->customcode) && !empty($prod->country_code)) { |
651 | 651 | $tmptxt .= ' - '; |
652 | 652 | } |
653 | 653 | if (!empty($prod->country_code)) { |
654 | - $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $langs, 0); |
|
654 | + $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $langs, 0); |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | $tmptxt .= ')'; |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | $date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : null; |
678 | 678 | |
679 | 679 | // Margin |
680 | - $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); |
|
681 | - $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value |
|
680 | + $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); |
|
681 | + $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value |
|
682 | 682 | |
683 | 683 | // Local Taxes |
684 | 684 | $localtax1_tx = get_localtax((string) $tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | $action = ''; |
746 | 746 | } |
747 | 747 | } |
748 | - } elseif ($action == 'updateline' && $permissiontoadd && ! GETPOST('cancel', 'alpha')) { |
|
749 | - if (! $object->fetch($id) > 0) { |
|
748 | + } elseif ($action == 'updateline' && $permissiontoadd && !GETPOST('cancel', 'alpha')) { |
|
749 | + if (!$object->fetch($id) > 0) { |
|
750 | 750 | dol_print_error($db); |
751 | 751 | } |
752 | 752 | $object->fetch_thirdparty(); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $objectline->array_options = $array_options; |
782 | 782 | $result = $objectline->insertExtraFields(); |
783 | 783 | if ($result < 0) { |
784 | - setEventMessages($langs->trans('Error') . $result, null, 'errors'); |
|
784 | + setEventMessages($langs->trans('Error').$result, null, 'errors'); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
@@ -791,13 +791,13 @@ discard block |
||
791 | 791 | if (is_array($extralabelsline)) { |
792 | 792 | // Get extra fields |
793 | 793 | foreach ($extralabelsline as $key => $value) { |
794 | - unset($_POST["options_" . $key]); |
|
794 | + unset($_POST["options_".$key]); |
|
795 | 795 | } |
796 | 796 | } |
797 | 797 | |
798 | 798 | // Define special_code for special lines |
799 | 799 | $special_code = GETPOSTINT('special_code'); |
800 | - if (! GETPOST('qty', 'alpha')) { |
|
800 | + if (!GETPOST('qty', 'alpha')) { |
|
801 | 801 | $special_code = 3; |
802 | 802 | } |
803 | 803 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : 'NULL'; |
844 | 844 | |
845 | 845 | // Update line |
846 | - if (! $error) { |
|
846 | + if (!$error) { |
|
847 | 847 | $result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, (float) $pu_ht, (float) $qty, $remise_percent, (float) $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1); |
848 | 848 | if ($result >= 0) { |
849 | 849 | $object->fetch($object->id); // Reload lines |
@@ -920,10 +920,10 @@ discard block |
||
920 | 920 | if ($object->fetch($id) > 0) { |
921 | 921 | $result = $object->fetch_lines(); |
922 | 922 | |
923 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; |
|
924 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
923 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
924 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
925 | 925 | print '<input type="hidden" name="action" value="add">'; |
926 | - print '<input type="hidden" name="facid" value="' . $object->id . '">'; |
|
926 | + print '<input type="hidden" name="facid" value="'.$object->id.'">'; |
|
927 | 927 | |
928 | 928 | print dol_get_fiche_head([], '', '', 0); |
929 | 929 | |
@@ -940,17 +940,17 @@ discard block |
||
940 | 940 | $object->fetch_thirdparty(); |
941 | 941 | |
942 | 942 | // Title |
943 | - print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>'; |
|
944 | - print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '" autofocus>'; |
|
943 | + print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>'; |
|
944 | + print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>'; |
|
945 | 945 | print '</td></tr>'; |
946 | 946 | |
947 | 947 | // Ref supplier |
948 | - print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("RefSupplier") . '</td><td>'; |
|
949 | - print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">'; |
|
948 | + print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("RefSupplier").'</td><td>'; |
|
949 | + print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">'; |
|
950 | 950 | print '</td></tr>'; |
951 | 951 | |
952 | 952 | // Third party |
953 | - print '<tr><td class="titlefieldcreate">' . $langs->trans("Supplier") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'supplier') . '</td>'; |
|
953 | + print '<tr><td class="titlefieldcreate">'.$langs->trans("Supplier").'</td><td>'.$object->thirdparty->getNomUrl(1, 'supplier').'</td>'; |
|
954 | 954 | print '</tr>'; |
955 | 955 | |
956 | 956 | // Invoice subtype |
@@ -966,42 +966,42 @@ discard block |
||
966 | 966 | // Help for substitution key |
967 | 967 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object); |
968 | 968 | |
969 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')'; |
|
970 | - $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')'; |
|
971 | - $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')'; |
|
972 | - $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')'; |
|
973 | - $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')'; |
|
974 | - $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')'; |
|
975 | - $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')'; |
|
976 | - $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')'; |
|
977 | - $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')'; |
|
969 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')'; |
|
970 | + $substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')'; |
|
971 | + $substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')'; |
|
972 | + $substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')'; |
|
973 | + $substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')'; |
|
974 | + $substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')'; |
|
975 | + $substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')'; |
|
976 | + $substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')'; |
|
977 | + $substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')'; |
|
978 | 978 | // Only on template invoices |
979 | - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' .dol_print_date($object->date_when, 'dayhour') . ')' : ''); |
|
980 | - $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour') . ')' : ''); |
|
979 | + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')' : ''); |
|
980 | + $substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')' : ''); |
|
981 | 981 | $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count"); |
982 | 982 | $substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber"); |
983 | 983 | |
984 | - $htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>'; |
|
984 | + $htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; |
|
985 | 985 | foreach ($substitutionarray as $key => $val) { |
986 | - $htmltext .= $key . ' = ' . $langs->trans($val) . '<br>'; |
|
986 | + $htmltext .= $key.' = '.$langs->trans($val).'<br>'; |
|
987 | 987 | } |
988 | 988 | $htmltext .= '</i>'; |
989 | 989 | |
990 | 990 | // Label |
991 | - print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>'; |
|
992 | - print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">'; |
|
991 | + print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>'; |
|
992 | + print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">'; |
|
993 | 993 | print '</td></tr>'; |
994 | 994 | |
995 | 995 | // Author |
996 | - print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>"; |
|
996 | + print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>"; |
|
997 | 997 | |
998 | 998 | // Payment term |
999 | - print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>"; |
|
999 | + print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>"; |
|
1000 | 1000 | print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, ''); |
1001 | 1001 | print "</td></tr>"; |
1002 | 1002 | |
1003 | 1003 | // Payment mode |
1004 | - print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>"; |
|
1004 | + print "<tr><td>".$langs->trans("PaymentMode")."</td><td>"; |
|
1005 | 1005 | print img_picto('', 'payment', 'class="pictofixedwidth"'); |
1006 | 1006 | print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1); |
1007 | 1007 | print "</td></tr>"; |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | if (isModEnabled('project') && $formproject !== null && is_object($object->thirdparty) && $object->thirdparty->id > 0) { |
1011 | 1011 | $projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project; |
1012 | 1012 | $langs->load('projects'); |
1013 | - print '<tr><td>' . $langs->trans('Project') . '</td><td>'; |
|
1013 | + print '<tr><td>'.$langs->trans('Project').'</td><td>'; |
|
1014 | 1014 | $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''); |
1015 | - print ' <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $object->thirdparty->id . (!empty($id) ? '&id=' . $id : '')) . '">' . $langs->trans("AddProject") . '</a>'; |
|
1015 | + print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>'; |
|
1016 | 1016 | print '</td></tr>'; |
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | // Bank account |
1020 | 1020 | if ($object->fk_account > 0) { |
1021 | - print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>"; |
|
1022 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none'); |
|
1021 | + print "<tr><td>".$langs->trans('BankAccount')."</td><td>"; |
|
1022 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none'); |
|
1023 | 1023 | print "</td></tr>"; |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1036,8 +1036,8 @@ discard block |
||
1036 | 1036 | print $object->showOptionals($extrafields, 'create', $parameters); |
1037 | 1037 | |
1038 | 1038 | // Model pdf |
1039 | - print "<tr><td>" . $langs->trans('Model') . "</td><td>"; |
|
1040 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php'; |
|
1039 | + print "<tr><td>".$langs->trans('Model')."</td><td>"; |
|
1040 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php'; |
|
1041 | 1041 | $list = ModelePDFSuppliersInvoices::liste_modeles($db); |
1042 | 1042 | print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF); |
1043 | 1043 | print "</td></tr>"; |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | |
1070 | 1070 | // Autogeneration |
1071 | 1071 | $title = $langs->trans("Recurrence"); |
1072 | - print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', ''); |
|
1072 | + print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', ''); |
|
1073 | 1073 | |
1074 | 1074 | print '<span class="opacitymedium">'.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'</span><br><br>'; |
1075 | 1075 | |
@@ -1078,30 +1078,30 @@ discard block |
||
1078 | 1078 | print '<table class="border centpercent">'; |
1079 | 1079 | |
1080 | 1080 | // Frequency + unit |
1081 | - print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>"; |
|
1082 | - print "<input type='text' name='frequency' value='" . GETPOSTINT('frequency') . "' size='4' /> " . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); |
|
1081 | + print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>"; |
|
1082 | + print "<input type='text' name='frequency' value='".GETPOSTINT('frequency')."' size='4' /> ".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); |
|
1083 | 1083 | print "</td></tr>"; |
1084 | 1084 | |
1085 | 1085 | // Date next run |
1086 | - print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>"; |
|
1086 | + print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>"; |
|
1087 | 1087 | $date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')) : -1); |
1088 | 1088 | print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1); |
1089 | 1089 | print "</td></tr>"; |
1090 | 1090 | |
1091 | 1091 | // Number max of generation |
1092 | - print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>"; |
|
1093 | - print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />'; |
|
1092 | + print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>"; |
|
1093 | + print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />'; |
|
1094 | 1094 | print "</td></tr>"; |
1095 | 1095 | |
1096 | 1096 | // Auto validate the invoice |
1097 | - print "<tr><td>" . $langs->trans("StatusOfAutoGeneratedInvoices") . "</td><td>"; |
|
1097 | + print "<tr><td>".$langs->trans("StatusOfAutoGeneratedInvoices")."</td><td>"; |
|
1098 | 1098 | $select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated')); |
1099 | 1099 | print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); |
1100 | 1100 | print "</td></tr>"; |
1101 | 1101 | |
1102 | 1102 | // Auto generate document |
1103 | 1103 | if (getDolGlobalString('INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION')) { |
1104 | - print "<tr><td>" . $langs->trans("StatusOfGeneratedDocuments") . "</td><td>"; |
|
1104 | + print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>"; |
|
1105 | 1105 | $select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc')); |
1106 | 1106 | print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); |
1107 | 1107 | print "</td></tr>"; |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | print "</form>\n"; |
1146 | 1146 | } else { |
1147 | - dol_print_error(null, "Error, no invoice " . $object->id); |
|
1147 | + dol_print_error(null, "Error, no invoice ".$object->id); |
|
1148 | 1148 | } |
1149 | 1149 | } else { |
1150 | 1150 | // View mode |
@@ -1156,12 +1156,12 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | // Confirmation de la suppression d'une ligne produit |
1158 | 1158 | if ($action == 'ask_deleteline') { |
1159 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); |
|
1159 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); |
|
1160 | 1160 | } |
1161 | 1161 | |
1162 | 1162 | // Confirm delete of repeatable invoice |
1163 | 1163 | if ($action == 'ask_deleteinvoice') { |
1164 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); |
|
1164 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | print $formconfirm; |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | |
1176 | 1176 | // Recurring invoice content |
1177 | 1177 | |
1178 | - $linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>'; |
|
1178 | + $linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>'; |
|
1179 | 1179 | |
1180 | 1180 | $morehtmlref = ''; |
1181 | 1181 | if ($action != 'edittitle') { |
@@ -1188,33 +1188,33 @@ discard block |
||
1188 | 1188 | $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1); |
1189 | 1189 | $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); |
1190 | 1190 | // Thirdparty |
1191 | - $morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); |
|
1191 | + $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); |
|
1192 | 1192 | |
1193 | 1193 | // Project |
1194 | 1194 | if (isModEnabled('project') && $formproject !== null) { |
1195 | 1195 | $langs->load('projects'); |
1196 | - $morehtmlref .= '<br>' . $langs->trans('Project') . ' '; |
|
1196 | + $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
|
1197 | 1197 | if ($usercancreate) { |
1198 | 1198 | if ($action != 'classify') { |
1199 | - $morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; |
|
1199 | + $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
1200 | 1200 | } |
1201 | 1201 | if ($action == 'classify') { |
1202 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">'; |
|
1202 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
|
1203 | 1203 | $morehtmlref .= '<input type="hidden" name="action" value="classin">'; |
1204 | - $morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1204 | + $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">'; |
|
1205 | 1205 | $morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); |
1206 | - $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; |
|
1206 | + $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
|
1207 | 1207 | $morehtmlref .= '</form>'; |
1208 | 1208 | } else { |
1209 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); |
|
1209 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); |
|
1210 | 1210 | } |
1211 | 1211 | } else { |
1212 | 1212 | if (!empty($object->fk_project)) { |
1213 | 1213 | $project = new Project($db); |
1214 | 1214 | $project->fetch($object->fk_project); |
1215 | - $morehtmlref .= ' : ' . $project->getNomUrl(1); |
|
1215 | + $morehtmlref .= ' : '.$project->getNomUrl(1); |
|
1216 | 1216 | if ($project->title) { |
1217 | - $morehtmlref .= ' - ' . $project->title; |
|
1217 | + $morehtmlref .= ' - '.$project->title; |
|
1218 | 1218 | } |
1219 | 1219 | } else { |
1220 | 1220 | $morehtmlref .= ''; |
@@ -1240,34 +1240,34 @@ discard block |
||
1240 | 1240 | print "</td></tr>"; |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>'; |
|
1243 | + print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>'; |
|
1244 | 1244 | print $author->getNomUrl(-1); |
1245 | 1245 | print "</td></tr>"; |
1246 | 1246 | |
1247 | 1247 | // Label |
1248 | 1248 | print '<tr>'; |
1249 | - print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, (int) $usercancreate) . '</td>'; |
|
1250 | - print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>'; |
|
1249 | + print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, (int) $usercancreate).'</td>'; |
|
1250 | + print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>'; |
|
1251 | 1251 | print '</tr>'; |
1252 | 1252 | |
1253 | - print '<tr><td>' . $langs->trans('AmountHT') . '</td>'; |
|
1254 | - print '<td>' . price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
1253 | + print '<tr><td>'.$langs->trans('AmountHT').'</td>'; |
|
1254 | + print '<td>'.price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
1255 | 1255 | print '</tr>'; |
1256 | 1256 | |
1257 | - print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
1257 | + print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
1258 | 1258 | print '</tr>'; |
1259 | 1259 | |
1260 | 1260 | // Amount Local Taxes |
1261 | 1261 | if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) { // Localtax1 |
1262 | - print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
1263 | - print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>'; |
|
1262 | + print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
1263 | + print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; |
|
1264 | 1264 | } |
1265 | 1265 | if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) { // Localtax2 |
1266 | - print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
1267 | - print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>'; |
|
1266 | + print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
1267 | + print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>'; |
|
1268 | 1268 | } |
1269 | 1269 | |
1270 | - print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; |
|
1270 | + print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; |
|
1271 | 1271 | print '</tr>'; |
1272 | 1272 | |
1273 | 1273 | // Payment term |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | print $langs->trans('PaymentConditionsShort'); |
1277 | 1277 | print '</td>'; |
1278 | 1278 | if ($action != 'editconditions' && $usercancreate) { |
1279 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; |
|
1279 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; |
|
1280 | 1280 | } |
1281 | 1281 | print '</tr></table>'; |
1282 | 1282 | print '</td><td>'; |
1283 | 1283 | if ($action == 'editconditions') { |
1284 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->cond_reglement_id, 'cond_reglement_id'); |
|
1284 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id'); |
|
1285 | 1285 | } else { |
1286 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->cond_reglement_id, 'none'); |
|
1286 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->cond_reglement_id, 'none'); |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | print '</td></tr>'; |
@@ -1294,14 +1294,14 @@ discard block |
||
1294 | 1294 | print $langs->trans('PaymentMode'); |
1295 | 1295 | print '</td>'; |
1296 | 1296 | if ($action != 'editmode' && $usercancreate) { |
1297 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmode&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; |
|
1297 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; |
|
1298 | 1298 | } |
1299 | 1299 | print '</tr></table>'; |
1300 | 1300 | print '</td><td>'; |
1301 | 1301 | if ($action == 'editmode') { |
1302 | - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); |
|
1302 | + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); |
|
1303 | 1303 | } else { |
1304 | - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, (string) $object->mode_reglement_id, 'none'); |
|
1304 | + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, (string) $object->mode_reglement_id, 'none'); |
|
1305 | 1305 | } |
1306 | 1306 | print '</td></tr>'; |
1307 | 1307 | |
@@ -1311,14 +1311,14 @@ discard block |
||
1311 | 1311 | print $langs->trans('BankAccount'); |
1312 | 1312 | print '<td>'; |
1313 | 1313 | if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) { |
1314 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editbankaccount&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>'; |
|
1314 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; |
|
1315 | 1315 | } |
1316 | 1316 | print '</tr></table>'; |
1317 | 1317 | print '</td><td>'; |
1318 | 1318 | if ($action == 'editbankaccount') { |
1319 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'fk_account', 1); |
|
1319 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'fk_account', 1); |
|
1320 | 1320 | } else { |
1321 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none'); |
|
1321 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none'); |
|
1322 | 1322 | } |
1323 | 1323 | print "</td>"; |
1324 | 1324 | print '</tr>'; |
@@ -1332,18 +1332,18 @@ discard block |
||
1332 | 1332 | print $langs->trans('Model'); |
1333 | 1333 | print '<td>'; |
1334 | 1334 | if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) { |
1335 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editmodelpdf&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetModel'), 1) . '</a></td>'; |
|
1335 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>'; |
|
1336 | 1336 | } |
1337 | 1337 | print '</tr></table>'; |
1338 | 1338 | print '</td><td>'; |
1339 | 1339 | if ($action == 'editmodelpdf') { |
1340 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php'; |
|
1340 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php'; |
|
1341 | 1341 | $list = array(); |
1342 | 1342 | $models = ModelePDFSuppliersInvoices::liste_modeles($db); |
1343 | 1343 | foreach ($models as $k => $model) { |
1344 | - $list[] = str_replace(':', '|', $k) . ':' . $model; |
|
1344 | + $list[] = str_replace(':', '|', $k).':'.$model; |
|
1345 | 1345 | } |
1346 | - $select = 'select;' . implode(',', $list); |
|
1346 | + $select = 'select;'.implode(',', $list); |
|
1347 | 1347 | //TODO : Droits |
1348 | 1348 | print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select); |
1349 | 1349 | } else { |
@@ -1371,7 +1371,7 @@ discard block |
||
1371 | 1371 | |
1372 | 1372 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php'; |
1373 | 1373 | |
1374 | - print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>'; |
|
1374 | + print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>'; |
|
1375 | 1375 | |
1376 | 1376 | // if "frequency" is empty or = 0, the recurrence is disabled |
1377 | 1377 | print '<tr><td style="width: 50%">'; |
@@ -1379,23 +1379,23 @@ discard block |
||
1379 | 1379 | print $langs->trans('Frequency'); |
1380 | 1380 | print '</td>'; |
1381 | 1381 | if ($action != 'editfrequency' && $usercancreate) { |
1382 | - print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; |
|
1382 | + print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>'; |
|
1383 | 1383 | } |
1384 | 1384 | print '</tr></table>'; |
1385 | 1385 | print '</td><td>'; |
1386 | 1386 | if ($action == 'editfrequency') { |
1387 | - print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">'; |
|
1387 | + print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">'; |
|
1388 | 1388 | print '<input type="hidden" name="action" value="setfrequency">'; |
1389 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
1389 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
1390 | 1390 | print '<table class="nobordernopadding">'; |
1391 | 1391 | print '<tr><td>'; |
1392 | - print "<input type='text' name='frequency' value='" . $object->frequency . "' size='5' /> " . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); |
|
1392 | + print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); |
|
1393 | 1393 | print '</td>'; |
1394 | - print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>'; |
|
1394 | + print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>'; |
|
1395 | 1395 | print '</tr></table></form>'; |
1396 | 1396 | } else { |
1397 | 1397 | if ($object->frequency > 0) { |
1398 | - print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency); |
|
1398 | + print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); |
|
1399 | 1399 | } else { |
1400 | 1400 | print $langs->trans("NotARecurringInvoiceTemplate"); |
1401 | 1401 | } |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached'); |
1415 | 1415 | } |
1416 | 1416 | //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour')); |
1417 | - if (! $object->isMaxNbGenReached()) { |
|
1418 | - if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { |
|
1417 | + if (!$object->isMaxNbGenReached()) { |
|
1418 | + if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { |
|
1419 | 1419 | print img_warning($langs->trans("Late")); |
1420 | 1420 | } |
1421 | 1421 | } else { |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | print $langs->trans("StatusOfAutoGeneratedInvoices"); |
1449 | 1449 | } |
1450 | 1450 | print '</td><td>'; |
1451 | - $select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated'); |
|
1451 | + $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); |
|
1452 | 1452 | if ($action == 'auto_validate' || $object->frequency > 0) { |
1453 | 1453 | print $form->editfieldval($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select); |
1454 | 1454 | } |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | print '</td>'; |
1466 | 1466 | print '<td>'; |
1467 | - $select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc'); |
|
1467 | + $select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc'); |
|
1468 | 1468 | if ($action == 'generate_pdf' || $object->frequency > 0) { |
1469 | 1469 | print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select); |
1470 | 1470 | } |
@@ -1488,7 +1488,7 @@ discard block |
||
1488 | 1488 | print '<table class="border centpercent tableforfield">'; |
1489 | 1489 | |
1490 | 1490 | // Nb of generation already done |
1491 | - print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>'; |
|
1491 | + print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>'; |
|
1492 | 1492 | print '<td>'; |
1493 | 1493 | print $object->nb_gen_done ? $object->nb_gen_done : '0'; |
1494 | 1494 | print '</td>'; |
@@ -1513,15 +1513,15 @@ discard block |
||
1513 | 1513 | print '<div class="clearboth"></div><br>'; |
1514 | 1514 | |
1515 | 1515 | // Lines |
1516 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOSTINT('lineid')) . '" method="POST"> |
|
1517 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
1518 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
1516 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOSTINT('lineid')).'" method="POST"> |
|
1517 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
1518 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
1519 | 1519 | <input type="hidden" name="mode" value=""> |
1520 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
1520 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
1521 | 1521 | '; |
1522 | 1522 | |
1523 | 1523 | if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { |
1524 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
1524 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | print '<div class="div-table-responsive-no-min">'; |
@@ -1578,24 +1578,24 @@ discard block |
||
1578 | 1578 | if (empty($object->suspended)) { |
1579 | 1579 | if ($usercancreate) { |
1580 | 1580 | if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { |
1581 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
1581 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; |
|
1582 | 1582 | } else { |
1583 | 1583 | if (empty($object->frequency) || $object->date_when <= $nowlasthour) { |
1584 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
1584 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; |
|
1585 | 1585 | } else { |
1586 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>'; |
|
1586 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; |
|
1587 | 1587 | } |
1588 | 1588 | } |
1589 | 1589 | } else { |
1590 | - print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>'; |
|
1590 | + print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>'; |
|
1591 | 1591 | } |
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | if ($usercancreate) { |
1595 | 1595 | if (empty($object->suspended)) { |
1596 | - print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=disable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Disable") . '</a></div>'; |
|
1596 | + print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>'; |
|
1597 | 1597 | } else { |
1598 | - print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=enable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Enable") . '</a></div>'; |
|
1598 | + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>'; |
|
1599 | 1599 | } |
1600 | 1600 | } |
1601 | 1601 |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | // Action clone object |
200 | 200 | if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { |
201 | 201 | $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid. |
202 | - '@phan-var-force FactureFournisseur $objectutil'; // Same object type for cloned object |
|
202 | + '@phan-var-force FactureFournisseur $objectutil'; // Same object type for cloned object |
|
203 | 203 | |
204 | 204 | if (GETPOST('newsupplierref', 'alphanohtml')) { |
205 | 205 | $objectutil->ref_supplier = GETPOST('newsupplierref', 'alphanohtml'); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $db->begin(); |
785 | 785 | |
786 | 786 | $error = 0; |
787 | - $tmpproject = 0; // Ensure a value |
|
787 | + $tmpproject = 0; // Ensure a value |
|
788 | 788 | |
789 | 789 | // Fill array 'array_options' with data from add form |
790 | 790 | $ret = $extrafields->setOptionalsFromPost(null, $object); |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $error++; |
793 | 793 | } |
794 | 794 | |
795 | - $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
795 | + $dateinvoice = dol_mktime(0, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server |
|
796 | 796 | $datedue = dol_mktime(0, 0, 0, GETPOSTINT('echmonth'), GETPOSTINT('echday'), GETPOSTINT('echyear'), 'tzserver'); |
797 | 797 | //var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour')); |
798 | 798 | //var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour')); |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); |
832 | 832 | $object->socid = GETPOSTINT('socid'); |
833 | 833 | $object->label = GETPOST('label', 'alphanohtml'); |
834 | - $object->libelle = $object->label; // deprecated |
|
834 | + $object->libelle = $object->label; // deprecated |
|
835 | 835 | $object->date = $dateinvoice; |
836 | 836 | $object->date_echeance = $datedue; |
837 | 837 | $object->note_public = GETPOST('note_public', 'restricthtml'); |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | $object->subtype = GETPOST('subtype', 'alphanohtml'); |
906 | 906 | $object->socid = GETPOSTINT('socid'); |
907 | 907 | $object->label = GETPOST('label', 'alphanohtml'); |
908 | - $object->libelle = $object->label; // Deprecated |
|
908 | + $object->libelle = $object->label; // Deprecated |
|
909 | 909 | $object->date = $dateinvoice; |
910 | 910 | $object->date_echeance = $datedue; |
911 | 911 | $object->note_public = GETPOST('note_public', 'restricthtml'); |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | $object->cond_reglement_id = (GETPOSTINT('type') == 3 ? 1 : GETPOST('cond_reglement_id')); |
1016 | 1016 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
1017 | 1017 | $object->fk_account = GETPOSTINT('fk_account'); |
1018 | - $object->amount = (float) price2num(GETPOST('amount')); // FIXME: FactureFournisseur::$amount is deprecated and not used? |
|
1018 | + $object->amount = (float) price2num(GETPOST('amount')); // FIXME: FactureFournisseur::$amount is deprecated and not used? |
|
1019 | 1019 | //$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); |
1020 | 1020 | //$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2); |
1021 | 1021 | $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
@@ -1068,28 +1068,28 @@ discard block |
||
1068 | 1068 | $tmpproject = GETPOSTINT('projectid'); |
1069 | 1069 | |
1070 | 1070 | // Creation invoice |
1071 | - $object->socid = GETPOSTINT('socid'); |
|
1072 | - $object->type = GETPOST('type', 'alphanohtml'); |
|
1073 | - $object->subtype = GETPOSTINT('subtype'); |
|
1074 | - $object->ref = GETPOST('ref', 'alphanohtml'); |
|
1075 | - $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
1071 | + $object->socid = GETPOSTINT('socid'); |
|
1072 | + $object->type = GETPOST('type', 'alphanohtml'); |
|
1073 | + $object->subtype = GETPOSTINT('subtype'); |
|
1074 | + $object->ref = GETPOST('ref', 'alphanohtml'); |
|
1075 | + $object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml'); |
|
1076 | 1076 | $object->socid = GETPOSTINT('socid'); |
1077 | 1077 | $object->label = GETPOST('label', 'alphanohtml'); |
1078 | - $object->libelle = $object->label; // deprecated |
|
1079 | - $object->date = $dateinvoice; |
|
1080 | - $object->date_echeance = $datedue; |
|
1081 | - $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
1082 | - $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
1078 | + $object->libelle = $object->label; // deprecated |
|
1079 | + $object->date = $dateinvoice; |
|
1080 | + $object->date_echeance = $datedue; |
|
1081 | + $object->note_public = GETPOST('note_public', 'restricthtml'); |
|
1082 | + $object->note_private = GETPOST('note_private', 'restricthtml'); |
|
1083 | 1083 | $object->cond_reglement_id = GETPOSTINT('cond_reglement_id'); |
1084 | 1084 | $object->mode_reglement_id = GETPOSTINT('mode_reglement_id'); |
1085 | 1085 | $object->fk_account = GETPOSTINT('fk_account'); |
1086 | 1086 | $object->vat_reverse_charge = GETPOST('vat_reverse_charge') == 'on' ? 1 : 0; |
1087 | 1087 | $object->fk_project = ($tmpproject > 0) ? $tmpproject : null; |
1088 | - $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
|
1088 | + $object->fk_incoterms = GETPOSTINT('incoterm_id'); |
|
1089 | 1089 | $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); |
1090 | 1090 | $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); |
1091 | - $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); |
|
1092 | - $object->transport_mode_id = GETPOSTINT('transport_mode_id'); |
|
1091 | + $object->multicurrency_tx = GETPOSTINT('originmulticurrency_tx'); |
|
1092 | + $object->transport_mode_id = GETPOSTINT('transport_mode_id'); |
|
1093 | 1093 | |
1094 | 1094 | // Auto calculation of date due if not filled by user |
1095 | 1095 | if (empty($object->date_echeance)) { |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | 0, |
1302 | 1302 | $object->lines[0]->date_start, |
1303 | 1303 | $object->lines[0]->date_end, |
1304 | - array(), // array_options |
|
1304 | + array(), // array_options |
|
1305 | 1305 | 0, |
1306 | 1306 | 0, |
1307 | 1307 | '', |
@@ -1439,7 +1439,7 @@ discard block |
||
1439 | 1439 | // Edit line |
1440 | 1440 | $db->begin(); |
1441 | 1441 | |
1442 | - if (! $object->fetch($id) > 0) { |
|
1442 | + if (!$object->fetch($id) > 0) { |
|
1443 | 1443 | dol_print_error($db); |
1444 | 1444 | } |
1445 | 1445 | $object->fetch_thirdparty(); |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); |
1611 | 1611 | } |
1612 | 1612 | |
1613 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1613 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
1614 | 1614 | |
1615 | 1615 | $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); |
1616 | 1616 | |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | |
1757 | 1757 | // Get vat rate |
1758 | 1758 | if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) |
1759 | - $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
1759 | + $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
1760 | 1760 | if (is_numeric($tmpidprodfournprice) && (int) $tmpidprodfournprice > 0) { |
1761 | 1761 | $tmpidprodfournprice = (int) $tmpidprodfournprice; |
1762 | 1762 | } else { |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | } |
2039 | 2039 | } |
2040 | 2040 | if ($action == 'update_extras' && $usercancreate) { |
2041 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
2041 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
2042 | 2042 | |
2043 | 2043 | // Fill array 'array_options' with data from add form |
2044 | 2044 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
@@ -2128,7 +2128,7 @@ discard block |
||
2128 | 2128 | // Mode creation |
2129 | 2129 | if ($action == 'create') { |
2130 | 2130 | $facturestatic = new FactureFournisseur($db); |
2131 | - $selectedLines = array(); // Ensure initialised |
|
2131 | + $selectedLines = array(); // Ensure initialised |
|
2132 | 2132 | |
2133 | 2133 | print load_fiche_titre($langs->trans('NewSupplierInvoice'), '', 'supplier_invoice'); |
2134 | 2134 | |
@@ -2323,7 +2323,7 @@ discard block |
||
2323 | 2323 | print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">'; |
2324 | 2324 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
2325 | 2325 | print '<input type="hidden" name="action" value="add">'; |
2326 | - print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
2326 | + print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change |
|
2327 | 2327 | |
2328 | 2328 | if (!empty($societe->id) && $societe->id > 0) { |
2329 | 2329 | print '<input type="hidden" name="socid" value="'.$societe->id.'">'."\n"; |
@@ -2407,7 +2407,7 @@ discard block |
||
2407 | 2407 | |
2408 | 2408 | $sql = 'SELECT r.rowid, r.titre as title, r.total_ttc'; |
2409 | 2409 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r'; |
2410 | - $sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid; |
|
2410 | + $sql .= ' WHERE r.fk_soc = '.(int) $invoice_predefined->socid; |
|
2411 | 2411 | |
2412 | 2412 | $resql = $db->query($sql); |
2413 | 2413 | if ($resql) { |
@@ -2474,7 +2474,7 @@ discard block |
||
2474 | 2474 | // Deposit - Down payment |
2475 | 2475 | if (!getDolGlobalString('INVOICE_DISABLE_DEPOSIT')) { |
2476 | 2476 | print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; |
2477 | - $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOSTINT('type') == 3 ? ' checked' : '') . '> '; |
|
2477 | + $tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOSTINT('type') == 3 ? ' checked' : '').'> '; |
|
2478 | 2478 | print '<script type="text/javascript"> |
2479 | 2479 | jQuery(document).ready(function() { |
2480 | 2480 | jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { |
@@ -2521,7 +2521,7 @@ discard block |
||
2521 | 2521 | print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1); |
2522 | 2522 | print '</td>'; |
2523 | 2523 | print '<td class="nowrap" style="padding-left: 5px">'; |
2524 | - print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="' . GETPOSTINT('valuedeposit') . '"/>'; |
|
2524 | + print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOSTINT('valuedeposit').'"/>'; |
|
2525 | 2525 | print '</td>'; |
2526 | 2526 | } |
2527 | 2527 | print '</tr></table>'; |
@@ -2771,8 +2771,8 @@ discard block |
||
2771 | 2771 | |
2772 | 2772 | // Vat reverse-charge by default |
2773 | 2773 | if (getDolGlobalString('ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE')) { |
2774 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
2775 | - print '<tr><td>' . $langs->trans('VATReverseCharge') . '</td><td>'; |
|
2774 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
2775 | + print '<tr><td>'.$langs->trans('VATReverseCharge').'</td><td>'; |
|
2776 | 2776 | // Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed |
2777 | 2777 | if (GETPOSTISSET('vat_reverse_charge')) { // Check if form was submitted previously |
2778 | 2778 | $vat_reverse_charge = (GETPOST('vat_reverse_charge', 'alpha') == 'on' || GETPOST('vat_reverse_charge', 'alpha') == '1') ? 1 : 0; |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | $vat_reverse_charge = 0; |
2783 | 2783 | } |
2784 | 2784 | |
2785 | - print '<input type="checkbox" name="vat_reverse_charge"'. (!empty($vat_reverse_charge) ? ' checked ' : '') . '>'; |
|
2785 | + print '<input type="checkbox" name="vat_reverse_charge"'.(!empty($vat_reverse_charge) ? ' checked ' : '').'>'; |
|
2786 | 2786 | print '</td></tr>'; |
2787 | 2787 | } |
2788 | 2788 | |
@@ -3351,7 +3351,7 @@ discard block |
||
3351 | 3351 | $creditnote->fetch($invoiceid); |
3352 | 3352 | $invoicecredits[] = $creditnote->getNomUrl(1); |
3353 | 3353 | } |
3354 | - print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits); |
|
3354 | + print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir").(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits); |
|
3355 | 3355 | print '</span>'; |
3356 | 3356 | } |
3357 | 3357 | if (isset($objectidnext) && $objectidnext > 0) { |
@@ -3498,12 +3498,12 @@ discard block |
||
3498 | 3498 | print '<input type="hidden" name="action" value="setvatreversecharge">'; |
3499 | 3499 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
3500 | 3500 | |
3501 | - print '<input type="checkbox" name="vat_reverse_charge"' . ($object->vat_reverse_charge == '1' ? ' checked ' : '') . '>'; |
|
3501 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').'>'; |
|
3502 | 3502 | |
3503 | 3503 | print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; |
3504 | 3504 | print '</form>'; |
3505 | 3505 | } else { |
3506 | - print '<input type="checkbox" name="vat_reverse_charge"'. ($object->vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>'; |
|
3506 | + print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').' disabled>'; |
|
3507 | 3507 | } |
3508 | 3508 | print '</td></tr>'; |
3509 | 3509 | } |
@@ -3571,15 +3571,15 @@ discard block |
||
3571 | 3571 | include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php'; |
3572 | 3572 | |
3573 | 3573 | print '<tr>'; |
3574 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
3575 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3574 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
3575 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3576 | 3576 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3577 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3577 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3578 | 3578 | } |
3579 | 3579 | print '</tr>'; |
3580 | 3580 | |
3581 | 3581 | print '<tr>'; |
3582 | - print '<td>' . $langs->trans('AmountVAT') . '</td>'; |
|
3582 | + print '<td>'.$langs->trans('AmountVAT').'</td>'; |
|
3583 | 3583 | print '<td class="nowrap amountcard right">'; |
3584 | 3584 | if (GETPOST('calculationrule')) { |
3585 | 3585 | $calculationrule = GETPOST('calculationrule', 'alpha'); |
@@ -3593,40 +3593,40 @@ discard block |
||
3593 | 3593 | } |
3594 | 3594 | // Show link for "recalculate" |
3595 | 3595 | if ($object->getVentilExportCompta() == 0) { |
3596 | - $s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>'; |
|
3597 | - $s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&token='.newToken().'&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>'; |
|
3596 | + $s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>'; |
|
3597 | + $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&token='.newToken().'&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>'; |
|
3598 | 3598 | $s .= ' / '; |
3599 | - $s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&token='.newToken().'&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>'; |
|
3599 | + $s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&token='.newToken().'&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>'; |
|
3600 | 3600 | print '<div class="inline-block">'; |
3601 | - print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); |
|
3601 | + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate'); |
|
3602 | 3602 | print ' '; |
3603 | 3603 | print '</div>'; |
3604 | 3604 | } |
3605 | 3605 | print '<span class="nowraponall">'.price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency).'</span>'; |
3606 | 3606 | print '</td>'; |
3607 | 3607 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3608 | - print '<td class="nowraponall amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3608 | + print '<td class="nowraponall amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3609 | 3609 | } |
3610 | 3610 | print '</tr>'; |
3611 | 3611 | |
3612 | 3612 | if ($societe->localtax1_assuj == "1") { //Localtax1 |
3613 | 3613 | print '<tr>'; |
3614 | - print '<td>' . $langs->transcountry("AmountLT1", $societe->country_code) . '</td>'; |
|
3615 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3614 | + print '<td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>'; |
|
3615 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3616 | 3616 | print '</tr>'; |
3617 | 3617 | } |
3618 | 3618 | if ($societe->localtax2_assuj == "1") { //Localtax2 |
3619 | 3619 | print '<tr>'; |
3620 | - print '<td>' . $langs->transcountry("AmountLT2", $societe->country_code) . '</td>'; |
|
3621 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3620 | + print '<td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>'; |
|
3621 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3622 | 3622 | print '</tr>'; |
3623 | 3623 | } |
3624 | 3624 | |
3625 | 3625 | print '<tr>'; |
3626 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
3627 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
3626 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
3627 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
3628 | 3628 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
3629 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
3629 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
3630 | 3630 | } |
3631 | 3631 | print '</tr>'; |
3632 | 3632 | |
@@ -4168,7 +4168,7 @@ discard block |
||
4168 | 4168 | } |
4169 | 4169 | |
4170 | 4170 | // Clone as predefined / Create template |
4171 | - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->status == 0 && $usercancreate) { |
|
4171 | + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->status == 0 && $usercancreate) { |
|
4172 | 4172 | if (!$objectidnext && count($object->lines) > 0) { |
4173 | 4173 | print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>'; |
4174 | 4174 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $action = GETPOST('action', 'alpha'); |
92 | 92 | $confirm = GETPOST('confirm', 'alpha'); |
93 | 93 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'purchaseordercard'; // To manage different context of search |
94 | -$cancel = GETPOST('cancel', 'alpha'); |
|
94 | +$cancel = GETPOST('cancel', 'alpha'); |
|
95 | 95 | $backtopage = GETPOST('backtopage', 'alpha'); |
96 | 96 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
97 | 97 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $result = restrictedArea($user, 'fournisseur', $object, 'commande_fournisseur', 'commande', 'fk_soc', 'rowid', $isdraft); |
155 | 155 | |
156 | 156 | // Common permissions |
157 | -$usercanread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire")); |
|
157 | +$usercanread = ($user->hasRight("fournisseur", "commande", "lire") || $user->hasRight("supplier_order", "lire")); |
|
158 | 158 | $usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); |
159 | 159 | $usercandelete = (($user->hasRight("fournisseur", "commande", "supprimer") || $user->hasRight("supplier_order", "supprimer")) || ($usercancreate && isset($object->status) && $object->status == $object::STATUS_DRAFT)); |
160 | 160 | |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | $usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight("fournisseur", "supplier_order_advance", "validate"))); |
163 | 163 | |
164 | 164 | // Additional area permissions |
165 | -$usercanapprove = $user->hasRight("fournisseur", "commande", "approuver"); |
|
166 | -$usercanapprovesecond = $user->hasRight("fournisseur", "commande", "approve2"); |
|
167 | -$usercanorder = $user->hasRight("fournisseur", "commande", "commander"); |
|
165 | +$usercanapprove = $user->hasRight("fournisseur", "commande", "approuver"); |
|
166 | +$usercanapprovesecond = $user->hasRight("fournisseur", "commande", "approve2"); |
|
167 | +$usercanorder = $user->hasRight("fournisseur", "commande", "commander"); |
|
168 | 168 | if (!isModEnabled('reception')) { |
169 | 169 | $usercanreceive = $user->hasRight("fournisseur", "commande", "receptionner"); |
170 | 170 | } else { |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | |
174 | 174 | // Permissions for includes |
175 | 175 | $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php |
176 | -$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
177 | -$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
176 | +$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php |
|
177 | +$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php |
|
178 | 178 | $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php |
179 | 179 | |
180 | 180 | // Project permission |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $idprod = GETPOSTINT('idprod'); |
470 | 470 | } |
471 | 471 | |
472 | - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
472 | + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' |
|
473 | 473 | |
474 | 474 | $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); |
475 | 475 | $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | // Get vat rate |
603 | 603 | $tva_npr = 0; |
604 | 604 | if (!GETPOSTISSET('tva_tx')) { // If vat rate not provided from the form (the form has the priority) |
605 | - $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
605 | + $tmpidprodfournprice = GETPOST('idprodfournprice', 'alpha'); // can be an id of price, or -1, -2, -99 or 'idprod_...' |
|
606 | 606 | if (is_numeric($tmpidprodfournprice) && (int) $tmpidprodfournprice > 0) { |
607 | 607 | $tmpidprodfournprice = (int) $tmpidprodfournprice; |
608 | 608 | } else { |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | $result = $object->delete($user); |
1204 | 1204 | if ($result > 0) { |
1205 | 1205 | $db->commit(); |
1206 | - header("Location: " . DOL_URL_ROOT . '/fourn/commande/list.php?restore_lastsearch_values=1'); |
|
1206 | + header("Location: ".DOL_URL_ROOT.'/fourn/commande/list.php?restore_lastsearch_values=1'); |
|
1207 | 1207 | exit; |
1208 | 1208 | } else { |
1209 | 1209 | $db->rollback(); |
@@ -1298,7 +1298,7 @@ discard block |
||
1298 | 1298 | |
1299 | 1299 | |
1300 | 1300 | if ($action == 'update_extras' && $permissiontoadd) { |
1301 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1301 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
1302 | 1302 | |
1303 | 1303 | // Fill array 'array_options' with data from add form |
1304 | 1304 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
@@ -1704,12 +1704,12 @@ discard block |
||
1704 | 1704 | $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); |
1705 | 1705 | $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); |
1706 | 1706 | $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); |
1707 | - $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0)); |
|
1707 | + $availability_id = (!empty($objectsrc->availability_id) ? $objectsrc->availability_id : (!empty($soc->availability_id) ? $soc->availability_id : 0)); |
|
1708 | 1708 | $shipping_method_id = (!empty($objectsrc->shipping_method_id) ? $objectsrc->shipping_method_id : (!empty($soc->shipping_method_id) ? $soc->shipping_method_id : 0)); |
1709 | 1709 | $demand_reason_id = (!empty($objectsrc->demand_reason_id) ? $objectsrc->demand_reason_id : (!empty($soc->demand_reason_id) ? $soc->demand_reason_id : 0)); |
1710 | 1710 | //$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_supplier_percent) ? $soc->remise_supplier_percent : 0)); |
1711 | 1711 | //$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); |
1712 | - $dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1; |
|
1712 | + $dateinvoice = getDolGlobalString('MAIN_AUTOFILL_DATE') ? '' : -1; |
|
1713 | 1713 | |
1714 | 1714 | $datelivraison = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); |
1715 | 1715 | |
@@ -1825,7 +1825,7 @@ discard block |
||
1825 | 1825 | // Payment term |
1826 | 1826 | print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; |
1827 | 1827 | print img_picto('', 'payment', 'class="pictofixedwidth"'); |
1828 | - print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1828 | + print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); |
|
1829 | 1829 | print '</td></tr>'; |
1830 | 1830 | |
1831 | 1831 | // Payment mode |
@@ -2117,7 +2117,7 @@ discard block |
||
2117 | 2117 | 'morecss' => 'minwidth300' |
2118 | 2118 | ) |
2119 | 2119 | ); |
2120 | - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
2120 | + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); |
|
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | // Confirmation of cancellation |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | $morehtmlref = '<div class="refidno">'; |
2187 | 2187 | // Ref supplier |
2188 | 2188 | $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1); |
2189 | - $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
2189 | + $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1); |
|
2190 | 2190 | // Thirdparty |
2191 | 2191 | $morehtmlref .= '<br>'; |
2192 | 2192 | if (getDolGlobalString('MAIN_CAN_EDIT_SUPPLIER_ON_SUPPLIER_ORDER') && !empty($usercancreate) && $action == 'edit_thirdparty') { |
@@ -2458,40 +2458,40 @@ discard block |
||
2458 | 2458 | |
2459 | 2459 | print '<tr>'; |
2460 | 2460 | // Amount HT |
2461 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>'; |
|
2462 | - print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2461 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>'; |
|
2462 | + print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2463 | 2463 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2464 | 2464 | // Multicurrency Amount HT |
2465 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2465 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2466 | 2466 | } |
2467 | 2467 | print '</tr>'; |
2468 | 2468 | |
2469 | 2469 | print '<tr>'; |
2470 | 2470 | // Amount VAT |
2471 | - print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>'; |
|
2472 | - print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2471 | + print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>'; |
|
2472 | + print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2473 | 2473 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2474 | 2474 | // Multicurrency Amount VAT |
2475 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2475 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2476 | 2476 | } |
2477 | 2477 | print '</tr>'; |
2478 | 2478 | |
2479 | 2479 | // Amount Local Taxes |
2480 | 2480 | if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { |
2481 | 2481 | print '<tr>'; |
2482 | - print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; |
|
2483 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2482 | + print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; |
|
2483 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2484 | 2484 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2485 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2485 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2486 | 2486 | } |
2487 | 2487 | print '</tr>'; |
2488 | 2488 | |
2489 | 2489 | if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { |
2490 | 2490 | print '<tr>'; |
2491 | - print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; |
|
2492 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>'; |
|
2491 | + print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; |
|
2492 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>'; |
|
2493 | 2493 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2494 | - print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2494 | + print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2495 | 2495 | } |
2496 | 2496 | print '</tr>'; |
2497 | 2497 | } |
@@ -2499,16 +2499,16 @@ discard block |
||
2499 | 2499 | |
2500 | 2500 | $alert = ''; |
2501 | 2501 | if (getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT') && $object->total_ht < $object->thirdparty->supplier_order_min_amount) { |
2502 | - $alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->supplier_order_min_amount)); |
|
2502 | + $alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->supplier_order_min_amount)); |
|
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | print '<tr>'; |
2506 | 2506 | // Amount TTC |
2507 | - print '<td>' . $langs->trans('AmountTTC') . '</td>'; |
|
2508 | - print '<td class="nowrap amountcard right">' . price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency) . $alert . '</td>'; |
|
2507 | + print '<td>'.$langs->trans('AmountTTC').'</td>'; |
|
2508 | + print '<td class="nowrap amountcard right">'.price($object->total_ttc, 0, $langs, 0, -1, -1, $conf->currency).$alert.'</td>'; |
|
2509 | 2509 | if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { |
2510 | 2510 | // Multicurrency Amount TTC |
2511 | - print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>'; |
|
2511 | + print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>'; |
|
2512 | 2512 | } |
2513 | 2513 | print '</tr>'; |
2514 | 2514 |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if ($action == 'update_extras' && $user->hasRight('societe', 'creer')) { |
186 | 186 | $object->fetch($id); |
187 | 187 | |
188 | - $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
188 | + $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty |
|
189 | 189 | |
190 | 190 | // Fill array 'array_options' with data from update form |
191 | 191 | $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | if ($object->accountancy_code_supplier_general > 0) { |
293 | 293 | print ' - '; |
294 | 294 | } |
295 | - $accountingAccountByDefault = '<span class="opacitymedium">' . $langs->trans("AccountingAccountByDefaultShort") . ": " . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')) . '</span>'; |
|
295 | + $accountingAccountByDefault = '<span class="opacitymedium">'.$langs->trans("AccountingAccountByDefaultShort").": ".length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER')).'</span>'; |
|
296 | 296 | print $accountingAccountByDefault; |
297 | 297 | } |
298 | 298 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | print '<td class="titlefield">'; |
337 | 337 | print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc')); |
338 | 338 | print '</td><td>'; |
339 | - print '<input type="checkbox" name="vat_reverse_charge" ' . ($object->vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>'; |
|
339 | + print '<input type="checkbox" name="vat_reverse_charge" '.($object->vat_reverse_charge == '1' ? ' checked' : '').' disabled>'; |
|
340 | 340 | print '</td>'; |
341 | 341 | print '</tr>'; |
342 | 342 | } |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | $this->id = $obj->rowid; |
349 | 349 | $this->rowid = $obj->rowid; |
350 | 350 | $this->fk_facture_fourn = $obj->fk_facture_fourn; |
351 | - $this->description = $obj->line_desc; |
|
352 | - $this->desc = $obj->line_desc; |
|
351 | + $this->description = $obj->line_desc; |
|
352 | + $this->desc = $obj->line_desc; |
|
353 | 353 | $this->date_start = $obj->date_start; |
354 | 354 | $this->date_end = $obj->date_end; |
355 | - $this->product_ref = $obj->product_ref; |
|
355 | + $this->product_ref = $obj->product_ref; |
|
356 | 356 | $this->ref_supplier = $obj->ref_supplier; |
357 | 357 | $this->product_desc = $obj->product_desc; |
358 | 358 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $this->localtax1_type = $obj->localtax1_type; |
366 | 366 | $this->localtax2_type = $obj->localtax2_type; |
367 | 367 | |
368 | - $this->qty = $obj->qty; |
|
368 | + $this->qty = $obj->qty; |
|
369 | 369 | $this->remise_percent = $obj->remise_percent; |
370 | 370 | $this->fk_remise_except = $obj->fk_remise_except; |
371 | 371 | //$this->tva = $obj->total_tva; // deprecated |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $this->fk_product = $obj->fk_product; |
378 | 378 | $this->product_type = $obj->product_type; |
379 | 379 | $this->product_label = $obj->product_label; |
380 | - $this->label = $obj->product_label; |
|
380 | + $this->label = $obj->product_label; |
|
381 | 381 | $this->info_bits = $obj->info_bits; |
382 | 382 | $this->fk_parent_line = $obj->fk_parent_line; |
383 | 383 | $this->special_code = $obj->special_code; |
@@ -697,8 +697,7 @@ discard block |
||
697 | 697 | $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape((string) $this->fk_parent_line)."'" : "null").","; |
698 | 698 | $product_label |
699 | 699 | = !empty($this->product_label) |
700 | - ? $this->product_label : |
|
701 | - (!empty($this->label) ? $this->label : null); |
|
700 | + ? $this->product_label : (!empty($this->label) ? $this->label : null); |
|
702 | 701 | $sql .= " ".(!empty($product_label) ? "'".$this->db->escape($product_label)."'" : "null").","; |
703 | 702 | $sql .= " '".$this->db->escape($this->desc ? $this->desc : $this->description)."',"; |
704 | 703 | $sql .= " '".$this->db->escape($this->ref_supplier)."',"; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $now = dol_now(); |
347 | 347 | |
348 | 348 | // Clean parameters |
349 | - $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
349 | + $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated |
|
350 | 350 | $this->title = empty($this->title) ? '' : $this->title; |
351 | 351 | $keyforref = $this->table_ref_field; |
352 | 352 | $this->ref = $this->$keyforref; |
@@ -410,32 +410,32 @@ discard block |
||
410 | 410 | $sql .= ", '".$this->db->idate($now)."'"; |
411 | 411 | $sql .= ", ".((int) $this->suspended); |
412 | 412 | $sql .= ", '".$this->db->escape($this->libelle)."'"; |
413 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
414 | - $sql .= ", " .((int) $user->id); |
|
415 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
416 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
417 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
418 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
419 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
420 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
421 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
422 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
423 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency; |
|
413 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
414 | + $sql .= ", ".((int) $user->id); |
|
415 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
416 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
417 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
418 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
419 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
420 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
421 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
422 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
423 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency; |
|
424 | 424 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; |
425 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx; |
|
426 | - $sql .= ", " . (int) $this->usenewprice; |
|
427 | - $sql .= ", " . (int) $this->frequency; |
|
425 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx; |
|
426 | + $sql .= ", ".(int) $this->usenewprice; |
|
427 | + $sql .= ", ".(int) $this->frequency; |
|
428 | 428 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; |
429 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
430 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
431 | - $sql .= ", " . (int) $this->nb_gen_done; |
|
432 | - $sql .= ", " . (int) $this->nb_gen_max; |
|
433 | - $sql .= ", " . (int) $this->auto_validate; |
|
434 | - $sql .= ", " . (int) $this->generate_pdf; |
|
429 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
430 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
431 | + $sql .= ", ".(int) $this->nb_gen_done; |
|
432 | + $sql .= ", ".(int) $this->nb_gen_max; |
|
433 | + $sql .= ", ".(int) $this->auto_validate; |
|
434 | + $sql .= ", ".(int) $this->generate_pdf; |
|
435 | 435 | $sql .= ')'; |
436 | 436 | |
437 | 437 | if ($this->db->query($sql)) { |
438 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec'); |
|
438 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec'); |
|
439 | 439 | |
440 | 440 | // Fields used into addline later |
441 | 441 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency; |
@@ -574,47 +574,47 @@ discard block |
||
574 | 574 | $error = 0; |
575 | 575 | |
576 | 576 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; |
577 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ; |
|
577 | + $sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',"; |
|
578 | 578 | $sql .= " subtype=".(isset($this->subtype) ? $this->db->escape((string) $this->subtype) : "null").","; |
579 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
580 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
|
579 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
580 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).','; |
|
581 | 581 | if (!empty($this->socid) && $this->socid > 0) { |
582 | - $sql .= " fk_soc = ". ((int) $this->socid). ','; |
|
582 | + $sql .= " fk_soc = ".((int) $this->socid).','; |
|
583 | 583 | } elseif (!empty($this->fk_soc) && $this->fk_soc > 0) { // For backward compatibility |
584 | - $sql .= " fk_soc = ". ((int) $this->fk_soc). ','; |
|
584 | + $sql .= " fk_soc = ".((int) $this->fk_soc).','; |
|
585 | 585 | } |
586 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
|
587 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
|
588 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
|
589 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; |
|
590 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; |
|
591 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; |
|
592 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; |
|
593 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; |
|
594 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ','; |
|
595 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; |
|
596 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; |
|
597 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; |
|
598 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; |
|
599 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; |
|
600 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; |
|
601 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; |
|
602 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; |
|
603 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; |
|
604 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; |
|
605 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; |
|
606 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; |
|
607 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; |
|
608 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; |
|
609 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; |
|
610 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; |
|
611 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; |
|
612 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; |
|
613 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; |
|
614 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; |
|
615 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; |
|
616 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
617 | - $sql .= " WHERE rowid = ". (int) $this->id; |
|
586 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).','; |
|
587 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').","; |
|
588 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').','; |
|
589 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).','; |
|
590 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).','; |
|
591 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).','; |
|
592 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).','; |
|
593 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).','; |
|
594 | + $sql .= " fk_user_modif = ".((int) $user->id).','; |
|
595 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').','; |
|
596 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').','; |
|
597 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').','; |
|
598 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').','; |
|
599 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').','; |
|
600 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',"; |
|
601 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',"; |
|
602 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').","; |
|
603 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').','; |
|
604 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').","; |
|
605 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).','; |
|
606 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).','; |
|
607 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).','; |
|
608 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).','; |
|
609 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).','; |
|
610 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).','; |
|
611 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',"; |
|
612 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').','; |
|
613 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').','; |
|
614 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).','; |
|
615 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).','; |
|
616 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
617 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
618 | 618 | |
619 | 619 | $this->db->begin(); |
620 | 620 | |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
676 | 676 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
677 | 677 | if ($rowid) { |
678 | - $sql .= ' AND f.rowid='. (int) $rowid; |
|
678 | + $sql .= ' AND f.rowid='.(int) $rowid; |
|
679 | 679 | } elseif ($ref) { |
680 | 680 | $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
681 | 681 | } else { |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | $this->id = $obj->rowid; |
693 | 693 | $this->titre = $obj->title; |
694 | 694 | $this->title = $obj->title; |
695 | - $this->subtype = $obj->subtype; |
|
695 | + $this->subtype = $obj->subtype; |
|
696 | 696 | $this->ref = $obj->title; |
697 | 697 | $this->ref_supplier = $obj->ref_supplier; |
698 | 698 | $this->entity = $obj->entity; |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
810 | 810 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
811 | 811 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
812 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id; |
|
812 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id; |
|
813 | 813 | $sql .= ' ORDER BY l.rang'; |
814 | 814 | |
815 | 815 | dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); |
@@ -850,14 +850,14 @@ discard block |
||
850 | 850 | $line->product_type = $objp->product_type; |
851 | 851 | $line->date_start = $objp->date_start; |
852 | 852 | $line->date_end = $objp->date_end; |
853 | - $line->info_bits = $objp->info_bits ; |
|
853 | + $line->info_bits = $objp->info_bits; |
|
854 | 854 | $line->special_code = $objp->special_code; |
855 | 855 | $line->rang = $objp->rang; |
856 | 856 | $line->fk_unit = $objp->fk_unit; |
857 | 857 | $line->import_key = $objp->import_key; |
858 | 858 | $line->fk_user_author = $objp->fk_user_author; |
859 | 859 | $line->fk_user_modif = $objp->fk_user_modif; |
860 | - $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
860 | + $this->extraparams = !empty($objp->extraparams) ? (array) json_decode($objp->extraparams, true) : array(); |
|
861 | 861 | $line->fk_multicurrency = $objp->fk_multicurrency; |
862 | 862 | $line->multicurrency_code = $objp->multicurrency_code; |
863 | 863 | $line->multicurrency_subprice = $objp->multicurrency_subprice; |
@@ -901,11 +901,11 @@ discard block |
||
901 | 901 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec'; |
902 | 902 | $ef = $main."_extrafields"; |
903 | 903 | |
904 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")"; |
|
905 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid; |
|
904 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")"; |
|
905 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid; |
|
906 | 906 | |
907 | 907 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
908 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid; |
|
908 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid; |
|
909 | 909 | dol_syslog($sql); |
910 | 910 | if ($this->db->query($sql)) { |
911 | 911 | // Delete linked object |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | } |
935 | 935 | // End call triggers |
936 | 936 | } |
937 | - if (! $error) { |
|
937 | + if (!$error) { |
|
938 | 938 | $this->db->commit(); |
939 | 939 | return 1; |
940 | 940 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | } |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; |
|
1049 | + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; |
|
1050 | 1050 | $sql .= 'fk_facture_fourn'; |
1051 | 1051 | $sql .= ', fk_product'; |
1052 | 1052 | $sql .= ', ref'; |
@@ -1078,46 +1078,46 @@ discard block |
||
1078 | 1078 | $sql .= ', fk_user_author'; |
1079 | 1079 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
1080 | 1080 | $sql .= ') VALUES ('; |
1081 | - $sql .= ' ' . (int) $facid; // source supplier invoice id |
|
1082 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape((string) $fk_product) . "'" : 'null'); |
|
1083 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
|
1084 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
|
1085 | - $sql .= ", '" . $this->db->escape($desc) . "'"; |
|
1086 | - $sql .= ', ' . price2num($pu_ht); |
|
1087 | - $sql .= ', ' . price2num($pu_ttc); |
|
1088 | - $sql .= ', ' . price2num($qty); |
|
1089 | - $sql .= ', ' . price2num($remise_percent); |
|
1081 | + $sql .= ' '.(int) $facid; // source supplier invoice id |
|
1082 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape((string) $fk_product)."'" : 'null'); |
|
1083 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null'); |
|
1084 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null'); |
|
1085 | + $sql .= ", '".$this->db->escape($desc)."'"; |
|
1086 | + $sql .= ', '.price2num($pu_ht); |
|
1087 | + $sql .= ', '.price2num($pu_ttc); |
|
1088 | + $sql .= ', '.price2num($qty); |
|
1089 | + $sql .= ', '.price2num($remise_percent); |
|
1090 | 1090 | $sql .= ', null'; |
1091 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'"; |
|
1092 | - $sql .= ', ' . price2num($txtva); |
|
1093 | - $sql .= ', ' . price2num($txlocaltax1); |
|
1094 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'"; |
|
1095 | - $sql .= ', ' . price2num($txlocaltax2); |
|
1096 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'"; |
|
1097 | - $sql .= ', ' . price2num($total_ht); |
|
1098 | - $sql .= ', ' . price2num($total_tva); |
|
1099 | - $sql .= ', ' . price2num($total_localtax1); |
|
1100 | - $sql .= ', ' . price2num($total_localtax2); |
|
1101 | - $sql .= ', ' . price2num($total_ttc); |
|
1102 | - $sql .= ', ' . (int) $product_type; |
|
1103 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1104 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1105 | - $sql .= ', ' . (int) $info_bits; |
|
1106 | - $sql .= ', ' . (int) $special_code; |
|
1107 | - $sql .= ', ' . (int) $rang; |
|
1108 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1109 | - $sql .= ', ' . (int) $user->id; |
|
1110 | - $sql .= ', ' . (int) $this->fk_multicurrency; |
|
1111 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
|
1112 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU'); |
|
1113 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT'); |
|
1114 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT'); |
|
1115 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT'); |
|
1091 | + $sql .= ", '".$this->db->escape($vat_src_code)."'"; |
|
1092 | + $sql .= ', '.price2num($txtva); |
|
1093 | + $sql .= ', '.price2num($txlocaltax1); |
|
1094 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'"; |
|
1095 | + $sql .= ', '.price2num($txlocaltax2); |
|
1096 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'"; |
|
1097 | + $sql .= ', '.price2num($total_ht); |
|
1098 | + $sql .= ', '.price2num($total_tva); |
|
1099 | + $sql .= ', '.price2num($total_localtax1); |
|
1100 | + $sql .= ', '.price2num($total_localtax2); |
|
1101 | + $sql .= ', '.price2num($total_ttc); |
|
1102 | + $sql .= ', '.(int) $product_type; |
|
1103 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1104 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1105 | + $sql .= ', '.(int) $info_bits; |
|
1106 | + $sql .= ', '.(int) $special_code; |
|
1107 | + $sql .= ', '.(int) $rang; |
|
1108 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1109 | + $sql .= ', '.(int) $user->id; |
|
1110 | + $sql .= ', '.(int) $this->fk_multicurrency; |
|
1111 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
|
1112 | + $sql .= ', '.price2num($pu_ht_devise, 'CU'); |
|
1113 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT'); |
|
1114 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT'); |
|
1115 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT'); |
|
1116 | 1116 | $sql .= ')'; |
1117 | 1117 | |
1118 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG); |
|
1118 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG); |
|
1119 | 1119 | if ($this->db->query($sql)) { |
1120 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec'); |
|
1120 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec'); |
|
1121 | 1121 | $this->update_price(); |
1122 | 1122 | $this->id = $facid; |
1123 | 1123 | $this->db->commit(); |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | |
1169 | 1169 | $facid = $this->id; |
1170 | 1170 | |
1171 | - dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
1171 | + dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
1172 | 1172 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
1173 | 1173 | |
1174 | 1174 | // Check parameters |
@@ -1238,41 +1238,41 @@ discard block |
||
1238 | 1238 | $product_type = $product->type; |
1239 | 1239 | } |
1240 | 1240 | |
1241 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
1242 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
1243 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1244 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
1245 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
1246 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
1247 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
1248 | - $sql .= ', qty = ' . price2num($qty); |
|
1249 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
1250 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
1251 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
1252 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
1253 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
1254 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
1255 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
1256 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
1257 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
1258 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
1259 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
1260 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
1261 | - $sql .= ', product_type = ' . (int) $product_type; |
|
1262 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
1263 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
1264 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
1265 | - $sql .= ', special_code = ' . (int) $special_code; |
|
1266 | - $sql .= ', rang = ' . (int) $rang; |
|
1267 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
1268 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
1241 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
1242 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
1243 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1244 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
1245 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
1246 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
1247 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
1248 | + $sql .= ', qty = '.price2num($qty); |
|
1249 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
1250 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
1251 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
1252 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
1253 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
1254 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
1255 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
1256 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
1257 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
1258 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
1259 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
1260 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
1261 | + $sql .= ', product_type = '.(int) $product_type; |
|
1262 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
1263 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
1264 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
1265 | + $sql .= ', special_code = '.(int) $special_code; |
|
1266 | + $sql .= ', rang = '.(int) $rang; |
|
1267 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
1268 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
1269 | 1269 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
1270 | 1270 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
1271 | 1271 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
1272 | 1272 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
1273 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
1273 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
1274 | 1274 | |
1275 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
1275 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
1276 | 1276 | if ($this->db->query($sql)) { |
1277 | 1277 | $this->id = $facid; |
1278 | 1278 | $this->update_price(); |
@@ -1362,16 +1362,16 @@ discard block |
||
1362 | 1362 | $tmparray = dol_getdate($now); |
1363 | 1363 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
1364 | 1364 | |
1365 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
1365 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
1366 | 1366 | |
1367 | 1367 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
1368 | 1368 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
1369 | 1369 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
1370 | 1370 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
1371 | 1371 | $sql .= ' AND suspended = 0'; |
1372 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
1372 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
1373 | 1373 | if ($restrictioninvoiceid > 0) { |
1374 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
1374 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
1375 | 1375 | } |
1376 | 1376 | $sql .= $this->db->order('entity', 'ASC'); |
1377 | 1377 | //print $sql;exit; |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | // Set entity context |
1412 | 1412 | $conf->entity = $facturerec->entity; |
1413 | 1413 | |
1414 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
1414 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
1415 | 1415 | |
1416 | 1416 | $new_fac_fourn = new FactureFournisseur($this->db); |
1417 | 1417 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | |
1420 | 1420 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1421 | 1421 | $new_fac_fourn->subtype = $facturerec->subtype; |
1422 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1422 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1423 | 1423 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1424 | 1424 | $new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. |
1425 | 1425 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1429 | 1429 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1430 | 1430 | $new_fac_fourn->label = $facturerec->label; |
1431 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1431 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1432 | 1432 | |
1433 | 1433 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1434 | 1434 | $laststep = "Create invoiceidgenerated $invoiceidgenerated"; |
@@ -1461,9 +1461,9 @@ discard block |
||
1461 | 1461 | } |
1462 | 1462 | } else { |
1463 | 1463 | $error++; |
1464 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
1465 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
1466 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
1464 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
1465 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
1466 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | if (!$error && $invoiceidgenerated >= 0) { |
@@ -1472,12 +1472,12 @@ discard block |
||
1472 | 1472 | $nextDate = $facturerec->getNextDate(); |
1473 | 1473 | $facturerec->date_when = (($nextDate === false) ? null : $nextDate); |
1474 | 1474 | $facturerec->update($user); |
1475 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
1476 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation'); |
|
1475 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title); |
|
1476 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation'); |
|
1477 | 1477 | $nb_create++; |
1478 | 1478 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n"; |
1479 | 1479 | } else { |
1480 | - $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title); |
|
1480 | + $this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title); |
|
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | $parameters = array( |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | } |
1572 | 1572 | $result .= $linkend; |
1573 | 1573 | global $action; |
1574 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1574 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1575 | 1575 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
1576 | 1576 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1577 | 1577 | if ($reshook > 0) { |
@@ -1751,8 +1751,8 @@ discard block |
||
1751 | 1751 | $prodids = array(); |
1752 | 1752 | |
1753 | 1753 | $sql = 'SELECT rowid'; |
1754 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
1755 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
1754 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
1755 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
1756 | 1756 | $sql .= $this->db->plimit(100); |
1757 | 1757 | |
1758 | 1758 | $resql = $this->db->query($sql); |
@@ -1787,11 +1787,11 @@ discard block |
||
1787 | 1787 | |
1788 | 1788 | if (empty($option) || $option != 'nolines') { |
1789 | 1789 | // Lines |
1790 | - $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
1790 | + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) |
|
1791 | 1791 | $xnbp = 0; |
1792 | 1792 | while ($xnbp < $nbp) { |
1793 | 1793 | $line = new FactureLigne($this->db); |
1794 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
1794 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
1795 | 1795 | $line->qty = 1; |
1796 | 1796 | $line->subprice = 100; |
1797 | 1797 | $line->tva_tx = 19.6; |
@@ -1838,7 +1838,7 @@ discard block |
||
1838 | 1838 | |
1839 | 1839 | // Add a line "offered" |
1840 | 1840 | $line = new FactureLigne($this->db); |
1841 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
1841 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
1842 | 1842 | $line->qty = 1; |
1843 | 1843 | $line->subprice = 100; |
1844 | 1844 | $line->tva_tx = 19.6; |
@@ -1887,12 +1887,12 @@ discard block |
||
1887 | 1887 | public function setFrequencyAndUnit($frequency, $unit) |
1888 | 1888 | { |
1889 | 1889 | if (!$this->table_element) { |
1890 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
1890 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR); |
|
1891 | 1891 | return -1; |
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | if (!empty($frequency) && empty($unit)) { |
1895 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
1895 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR); |
|
1896 | 1896 | return -2; |
1897 | 1897 | } |
1898 | 1898 | |
@@ -1931,11 +1931,11 @@ discard block |
||
1931 | 1931 | return -1; |
1932 | 1932 | } |
1933 | 1933 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1934 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1934 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1935 | 1935 | if ($increment_nb_gen_done > 0) { |
1936 | 1936 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
1937 | 1937 | } |
1938 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1938 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1939 | 1939 | |
1940 | 1940 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
1941 | 1941 | |
@@ -1969,8 +1969,8 @@ discard block |
||
1969 | 1969 | } |
1970 | 1970 | |
1971 | 1971 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1972 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
1973 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1972 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
1973 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1974 | 1974 | |
1975 | 1975 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
1976 | 1976 | |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | |
1999 | 1999 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
2000 | 2000 | $sql .= " SET auto_validate = ".((int) $validate); |
2001 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
2001 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
2002 | 2002 | |
2003 | 2003 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
2004 | 2004 | |
@@ -2025,8 +2025,8 @@ discard block |
||
2025 | 2025 | } |
2026 | 2026 | |
2027 | 2027 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
2028 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
2029 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
2028 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
2029 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
2030 | 2030 | |
2031 | 2031 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
2032 | 2032 | |
@@ -2054,7 +2054,7 @@ discard block |
||
2054 | 2054 | |
2055 | 2055 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
2056 | 2056 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
2057 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
2057 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
2058 | 2058 | |
2059 | 2059 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
2060 | 2060 |