@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Turning on or off the ssl target certificate |
| 81 | 81 | if ($ssl_verifypeer < 0) { |
| 82 | 82 | global $dolibarr_main_prod; |
| 83 | - $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
| 83 | + $ssl_verifypeer = ($dolibarr_main_prod ? true : false); |
|
| 84 | 84 | } |
| 85 | 85 | if (getDolGlobalString('MAIN_CURL_DISABLE_VERIFYPEER')) { |
| 86 | 86 | $ssl_verifypeer = 0; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // limit size of downloaded files. TODO Add MAIN_SECURITY_MAXFILESIZE_DOWNLOADED |
| 118 | 118 | $maxsize = getDolGlobalInt('MAIN_SECURITY_MAXFILESIZE_DOWNLOADED'); |
| 119 | 119 | if ($maxsize && defined('CURLOPT_MAXFILESIZE_LARGE')) { |
| 120 | - curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal |
|
| 120 | + curl_setopt($ch, CURLOPT_MAXFILESIZE_LARGE, $maxsize); // @phan-suppress-current-line PhanTypeMismatchArgumentNullableInternal |
|
| 121 | 121 | } |
| 122 | 122 | if ($maxsize && defined('CURLOPT_MAXFILESIZE')) { |
| 123 | 123 | curl_setopt($ch, CURLOPT_MAXFILESIZE, $maxsize); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $array_param = null; |
| 136 | 136 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' |
| 137 | 137 | if (!is_array($param)) { |
| 138 | - parse_str($param, $array_param); // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 138 | + parse_str($param, $array_param); // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 139 | 139 | } else { |
| 140 | 140 | dol_syslog("parameter param must be a string", LOG_WARNING); |
| 141 | 141 | $array_param = $param; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $out .= '<div class="centpercent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">'; |
| 112 | 112 | if ($maxmin > 0) { |
| 113 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 113 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 114 | 114 | } |
| 115 | 115 | $out .= '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="'.$htmlname.'" id="'.$htmlname.'" accept="image/*">'; |
| 116 | 116 | $out .= '</div>'; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $maxphptoshow = $maxfilesizearray['maxphptoshow']; |
| 241 | 241 | $maxphptoshowparam = $maxfilesizearray['maxphptoshowparam']; |
| 242 | 242 | if ($maxmin > 0) { |
| 243 | - $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 243 | + $out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
| 244 | 244 | } |
| 245 | 245 | $out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"'; |
| 246 | 246 | $out .= ((getDolGlobalString('MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple'); |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | |
| 950 | 950 | // Loop on each file found |
| 951 | 951 | if (is_array($file_list)) { |
| 952 | - '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $file_list'; // phan limitations loose typing information with empty() tests, etc. Force again. |
|
| 952 | + '@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string}> $file_list'; // phan limitations loose typing information with empty() tests, etc. Force again. |
|
| 953 | 953 | // Defined relative dir to DOL_DATA_ROOT |
| 954 | 954 | $relativedir = ''; |
| 955 | 955 | if ($filedir) { |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | |
| 1221 | 1221 | $this->infofiles['nboffiles']++; |
| 1222 | 1222 | $this->infofiles['files'][] = $file['fullname']; |
| 1223 | - $ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis) |
|
| 1223 | + $ext = (string) pathinfo($file['name'], PATHINFO_EXTENSION); // pathinfo returns a string here (cast for static analysis) |
|
| 1224 | 1224 | if (!array_key_exists($ext, $this->infofiles['extensions'])) { |
| 1225 | 1225 | $this->infofiles['extensions'][$ext] = 1; |
| 1226 | 1226 | } else { |
@@ -1502,7 +1502,7 @@ discard block |
||
| 1502 | 1502 | $modulepart = basename(dirname($file['path'])); |
| 1503 | 1503 | } |
| 1504 | 1504 | if (empty($relativepath)) { |
| 1505 | - $relativepath = preg_replace('/\/(.+)/', '', $filepath) . '/'; |
|
| 1505 | + $relativepath = preg_replace('/\/(.+)/', '', $filepath).'/'; |
|
| 1506 | 1506 | } |
| 1507 | 1507 | |
| 1508 | 1508 | $editline = 0; |
@@ -1780,7 +1780,7 @@ discard block |
||
| 1780 | 1780 | |
| 1781 | 1781 | if ($nboflines > 1 && is_object($object)) { |
| 1782 | 1782 | if (!empty($conf->use_javascript_ajax) && $permtoeditline) { |
| 1783 | - $table_element_line = 'ecm_files'; // used by ajaxrow.tpl.php |
|
| 1783 | + $table_element_line = 'ecm_files'; // used by ajaxrow.tpl.php |
|
| 1784 | 1784 | include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
| 1785 | 1785 | } |
| 1786 | 1786 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | // Fetch optionals attributes and labels |
| 212 | -$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects |
|
| 212 | +$extrafields->fetch_name_optionals_label('all'); // We load all extrafields definitions for all objects |
|
| 213 | 213 | //$extrafields->fetch_name_optionals_label($object->table_element_line); |
| 214 | 214 | |
| 215 | 215 | $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | // If string is not an universal filter string, we try to convert it into universal filter syntax string |
| 224 | 224 | $errorstr = ''; |
| 225 | -forgeSQLFromUniversalSearchCriteria($search_component_params_input, $errorstr); // Try conversion UFS->SQL |
|
| 225 | +forgeSQLFromUniversalSearchCriteria($search_component_params_input, $errorstr); // Try conversion UFS->SQL |
|
| 226 | 226 | //var_dump($errorstr); |
| 227 | 227 | if ($errorstr) { |
| 228 | 228 | $value = $search_component_params_input; |
@@ -234,14 +234,14 @@ discard block |
||
| 234 | 234 | $crits = explode(' ', trim($value)); // the string after the name of the field. Explode on each AND |
| 235 | 235 | $res = ''; |
| 236 | 236 | |
| 237 | - $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 237 | + $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 238 | 238 | foreach ($crits as $crit) { // Loop on each AND criteria |
| 239 | 239 | $crit = trim($crit); |
| 240 | 240 | |
| 241 | - $i2 = 0; // count the nb of valid criteria added for this first criteria |
|
| 241 | + $i2 = 0; // count the nb of valid criteria added for this first criteria |
|
| 242 | 242 | $newres = ''; |
| 243 | 243 | $tmpcrits = explode('|', $crit); |
| 244 | - $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 244 | + $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 245 | 245 | foreach ($tmpcrits as $tmpcrit) { |
| 246 | 246 | if ($tmpcrit !== '0' && empty($tmpcrit)) { |
| 247 | 247 | continue; |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field |
|
| 263 | - $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field |
|
| 262 | + $field = preg_replace('/(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:).*$/', '', $tmpcrit); // the name of the field |
|
| 263 | + $tmpcrit = preg_replace('/^.*(:[!<>=\s]+:|:in:|:notin:|:like:|:notlike:)/', '\1', $tmpcrit); // the condition after the name of the field |
|
| 264 | 264 | //var_dump($field); var_dump($tmpcrit); var_dump($i3); |
| 265 | 265 | |
| 266 | 266 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | foreach ($arrayofmesures as $key => $val) { |
| 637 | 637 | $simplearrayofmesures[$key] = $arrayofmesures[$key]['label']; |
| 638 | 638 | } |
| 639 | - print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields |
|
| 639 | + print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields |
|
| 640 | 640 | print '</div>'; |
| 641 | 641 | |
| 642 | 642 | // XAxis |
@@ -644,14 +644,14 @@ discard block |
||
| 644 | 644 | print '<div class="divadvancedsearchfield">'; |
| 645 | 645 | print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>'; |
| 646 | 646 | //var_dump($arrayofxaxis); |
| 647 | - print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields |
|
| 647 | + print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields |
|
| 648 | 648 | print '</div>'; |
| 649 | 649 | |
| 650 | 650 | // Group by |
| 651 | 651 | $count = 0; |
| 652 | 652 | print '<div class="divadvancedsearchfield">'; |
| 653 | 653 | print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>'; |
| 654 | - print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields |
|
| 654 | + print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields |
|
| 655 | 655 | print '</div>'; |
| 656 | 656 | |
| 657 | 657 | |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | //var_dump($arrayofgroupby); |
| 811 | 811 | $tmpforloop = dolExplodeIntoArray($arrayofxaxis[$val]['tablefromt'], ','); |
| 812 | 812 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 813 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 813 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 814 | 814 | $tmpforexplode = explode('__', $tmptablealias); |
| 815 | 815 | $endpart = end($tmpforexplode); |
| 816 | 816 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | //var_dump($arrayofgroupby[$val]); var_dump($tmpval); |
| 838 | 838 | $tmpforloop = dolExplodeIntoArray($arrayofgroupby[$val]['tablefromt'], ','); |
| 839 | 839 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 840 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 840 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 841 | 841 | $tmpforexplode = explode('__', $tmptablealias); |
| 842 | 842 | $endpart = end($tmpforexplode); |
| 843 | 843 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | //var_dump($arrayofgroupby); |
| 865 | 865 | $tmpforloop = dolExplodeIntoArray($arrayofmesures[$val]['tablefromt'], ','); |
| 866 | 866 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 867 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 867 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 868 | 868 | $tmpforexplode = explode('__', $tmptablealias); |
| 869 | 869 | $endpart = end($tmpforexplode); |
| 870 | 870 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | $tmpval = explode('.', $val); |
| 899 | 899 | $tmpforloop = dolExplodeIntoArray($arrayoffilterfields[$val]['tablefromt'], ','); |
| 900 | 900 | foreach ($tmpforloop as $tmptable => $tmptablealias) { |
| 901 | - if (! in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 901 | + if (!in_array($tmptable, $listoftablesalreadyadded)) { // We do not add join for main table and tables already added |
|
| 902 | 902 | $tmpforexplode = explode('__', $tmptablealias); |
| 903 | 903 | $endpart = end($tmpforexplode); |
| 904 | 904 | $parenttableandfield = preg_replace('/__'.$endpart.'$/', '', $tmptablealias).'.'.$endpart; |
@@ -934,9 +934,9 @@ discard block |
||
| 934 | 934 | * @param array<int, string> $matches |
| 935 | 935 | * @return string |
| 936 | 936 | */ |
| 937 | - function (array $matches): string { |
|
| 937 | + function(array $matches): string { |
|
| 938 | 938 | global $db; |
| 939 | - $column = $matches[1] . '.' . $matches[2]; |
|
| 939 | + $column = $matches[1].'.'.$matches[2]; |
|
| 940 | 940 | $operator = $matches[3]; |
| 941 | 941 | $year = (int) $matches[4]; |
| 942 | 942 | $month = (int) $matches[5]; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | global $user; |
| 301 | 301 | |
| 302 | 302 | if (!isset($_FILES)) { |
| 303 | - global $_FILES; // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 303 | + global $_FILES; // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 304 | 304 | } |
| 305 | 305 | $sErrorNumber = '0'; |
| 306 | 306 | $sFileName = ''; |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | function GetRootPath() |
| 640 | 640 | { |
| 641 | 641 | if (!isset($_SERVER)) { |
| 642 | - global $_SERVER; // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 642 | + global $_SERVER; // @phan-suppress-current-line PhanPluginConstantVariableNull |
|
| 643 | 643 | } |
| 644 | 644 | $sRealPath = realpath('./'); |
| 645 | 645 | // #2124 ensure that no slash is at the end |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | ob_start(); |
| 27 | 27 | |
| 28 | -require 'config.inc.php'; // This include the main.inc.php |
|
| 28 | +require 'config.inc.php'; // This include the main.inc.php |
|
| 29 | 29 | require 'connector.lib.php'; |
| 30 | 30 | |
| 31 | 31 | if (!$Config['Enabled']) { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if ($sCommand == 'FileUpload') { |
| 64 | 64 | FileUpload($sResourceType, $sCurrentFolder, $sCommand); |
| 65 | 65 | // @phan-suppress-next-line PhanPluginUnreachableCode |
| 66 | - return; // FileUpload exits @phpstan-ignore-line |
|
| 66 | + return; // FileUpload exits @phpstan-ignore-line |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder); |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110); |
| 1703 | 1703 | $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); |
| 1704 | 1704 | if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { |
| 1705 | - $newmenu->add("/accountancy/admin/report_list.php?id=32&search_country_id=" . $mysoc->country_id . "&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingReport"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); |
|
| 1705 | + $newmenu->add("/accountancy/admin/report_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingReport"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 125); |
|
| 1706 | 1706 | } |
| 1707 | 1707 | $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 130); |
| 1708 | 1708 | } |
@@ -1772,7 +1772,7 @@ discard block |
||
| 1772 | 1772 | $nature = "expensereports"; |
| 1773 | 1773 | } |
| 1774 | 1774 | if ($objp->nature == 1 && isModEnabled('asset')) { |
| 1775 | - $nature = "various"; // Warning: The page /accountancy/journal/variousjournal.php is bugged. It read tables that does not exists. |
|
| 1775 | + $nature = "various"; // Warning: The page /accountancy/journal/variousjournal.php is bugged. It read tables that does not exists. |
|
| 1776 | 1776 | } |
| 1777 | 1777 | if ($objp->nature == 8) { |
| 1778 | 1778 | $nature = "inventory"; |
@@ -1797,7 +1797,7 @@ discard block |
||
| 1797 | 1797 | $journallabel = '<span class="opacitymedium">('.$langs->trans($objp->label).')</span>'; // Label of bank account in llx_accounting_journal |
| 1798 | 1798 | } |
| 1799 | 1799 | |
| 1800 | - $key = $langs->trans("AccountingJournalType".$objp->nature); // $objp->nature is 1, 2, 3 ... |
|
| 1800 | + $key = $langs->trans("AccountingJournalType".$objp->nature); // $objp->nature is 1, 2, 3 ... |
|
| 1801 | 1801 | $transferlabel = (($objp->nature && $key != "AccountingJournalType".$objp->nature) ? $key.($journallabelwithoutspan != $key ? ' '.$journallabel : '') : $journallabel); |
| 1802 | 1802 | |
| 1803 | 1803 | $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $transferlabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | // Put here code to add control on parameters values |
| 127 | 127 | |
| 128 | 128 | // Insert request |
| 129 | - $sql = "INSERT INTO " . $this->db->prefix() . $this->table_element . " ("; |
|
| 129 | + $sql = "INSERT INTO ".$this->db->prefix().$this->table_element." ("; |
|
| 130 | 130 | if ($this->rowid > 0) { |
| 131 | 131 | $sql .= "rowid, "; |
| 132 | 132 | } |
@@ -137,29 +137,29 @@ discard block |
||
| 137 | 137 | $sql .= "entity"; |
| 138 | 138 | $sql .= ") VALUES ("; |
| 139 | 139 | if ($this->rowid > 0) { |
| 140 | - $sql .= " " . ((int) $this->rowid) . ","; |
|
| 140 | + $sql .= " ".((int) $this->rowid).","; |
|
| 141 | 141 | } |
| 142 | - $sql .= " " . (!isset($this->code) ? "NULL" : "'" . $this->db->escape($this->code) . "'") . ","; |
|
| 143 | - $sql .= " " . (!isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'") . ","; |
|
| 144 | - $sql .= " " . (!isset($this->fk_country) ? 'NULL' : ((int) $this->fk_country)) . ","; |
|
| 145 | - $sql .= " " . (!isset($this->active) ? 'NULL' : ((int) $this->active)); |
|
| 146 | - $sql .= ", " . ((int) $conf->entity); |
|
| 142 | + $sql .= " ".(!isset($this->code) ? "NULL" : "'".$this->db->escape($this->code)."'").","; |
|
| 143 | + $sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").","; |
|
| 144 | + $sql .= " ".(!isset($this->fk_country) ? 'NULL' : ((int) $this->fk_country)).","; |
|
| 145 | + $sql .= " ".(!isset($this->active) ? 'NULL' : ((int) $this->active)); |
|
| 146 | + $sql .= ", ".((int) $conf->entity); |
|
| 147 | 147 | $sql .= ")"; |
| 148 | 148 | |
| 149 | 149 | $this->db->begin(); |
| 150 | 150 | |
| 151 | - dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 151 | + dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 152 | 152 | $resql = $this->db->query($sql); |
| 153 | 153 | if (!$resql) { |
| 154 | 154 | $error++; |
| 155 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 155 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Commit or rollback |
| 159 | 159 | if ($error) { |
| 160 | 160 | foreach ($this->errors as $errmsg) { |
| 161 | - dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); |
|
| 162 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 161 | + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); |
|
| 162 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 163 | 163 | } |
| 164 | 164 | $this->db->rollback(); |
| 165 | 165 | return -1 * $error; |
@@ -186,19 +186,19 @@ discard block |
||
| 186 | 186 | $sql .= " t.label,"; |
| 187 | 187 | $sql .= " t.fk_country,"; |
| 188 | 188 | $sql .= " t.active"; |
| 189 | - $sql .= " FROM " . $this->db->prefix() . $this->table_element . " as t"; |
|
| 189 | + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; |
|
| 190 | 190 | if ($id) { |
| 191 | - $sql .= " WHERE t.rowid = " . ((int) $id); |
|
| 191 | + $sql .= " WHERE t.rowid = ".((int) $id); |
|
| 192 | 192 | } else { |
| 193 | - $sql .= " WHERE t.entity IN (" . getEntity('c_accounting_report') . ")"; // Don't use entity if you use rowid |
|
| 193 | + $sql .= " WHERE t.entity IN (".getEntity('c_accounting_report').")"; // Don't use entity if you use rowid |
|
| 194 | 194 | if ($code) { |
| 195 | - $sql .= " AND t.code = '" . $this->db->escape($code) . "'"; |
|
| 195 | + $sql .= " AND t.code = '".$this->db->escape($code)."'"; |
|
| 196 | 196 | } elseif ($label) { |
| 197 | - $sql .= " AND t.label = '" . $this->db->escape($label) . "'"; |
|
| 197 | + $sql .= " AND t.label = '".$this->db->escape($label)."'"; |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 201 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 202 | 202 | $resql = $this->db->query($sql); |
| 203 | 203 | if ($resql) { |
| 204 | 204 | if ($this->db->num_rows($resql)) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | return 1; |
| 216 | 216 | } else { |
| 217 | - $this->error = "Error " . $this->db->lasterror(); |
|
| 217 | + $this->error = "Error ".$this->db->lasterror(); |
|
| 218 | 218 | return -1; |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -251,27 +251,27 @@ discard block |
||
| 251 | 251 | // Put here code to add control on parameters values |
| 252 | 252 | |
| 253 | 253 | // Update request |
| 254 | - $sql = "UPDATE " . $this->db->prefix() . $this->table_element . " SET"; |
|
| 255 | - $sql .= " code=" . (isset($this->code) ? "'" . $this->db->escape($this->code) . "'" : "null") . ","; |
|
| 256 | - $sql .= " label=" . (isset($this->label) ? "'" . $this->db->escape($this->label) . "'" : "null") . ","; |
|
| 257 | - $sql .= " fk_country=" . (isset($this->fk_country) ? ((int) $this->fk_country) : "null") . ","; |
|
| 258 | - $sql .= " active=" . (isset($this->active) ? ((int) $this->active) : "null"); |
|
| 259 | - $sql .= " WHERE rowid=" . ((int) $this->id); |
|
| 254 | + $sql = "UPDATE ".$this->db->prefix().$this->table_element." SET"; |
|
| 255 | + $sql .= " code=".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "null").","; |
|
| 256 | + $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; |
|
| 257 | + $sql .= " fk_country=".(isset($this->fk_country) ? ((int) $this->fk_country) : "null").","; |
|
| 258 | + $sql .= " active=".(isset($this->active) ? ((int) $this->active) : "null"); |
|
| 259 | + $sql .= " WHERE rowid=".((int) $this->id); |
|
| 260 | 260 | |
| 261 | 261 | $this->db->begin(); |
| 262 | 262 | |
| 263 | - dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 263 | + dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 264 | 264 | $resql = $this->db->query($sql); |
| 265 | 265 | if (!$resql) { |
| 266 | 266 | $error++; |
| 267 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 267 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Commit or rollback |
| 271 | 271 | if ($error) { |
| 272 | 272 | foreach ($this->errors as $errmsg) { |
| 273 | - dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); |
|
| 274 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 273 | + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); |
|
| 274 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 275 | 275 | } |
| 276 | 276 | $this->db->rollback(); |
| 277 | 277 | return -1 * $error; |
@@ -294,23 +294,23 @@ discard block |
||
| 294 | 294 | global $conf, $langs; |
| 295 | 295 | $error = 0; |
| 296 | 296 | |
| 297 | - $sql = "DELETE FROM " . $this->db->prefix() . $this->table_element; |
|
| 298 | - $sql .= " WHERE rowid=" . ((int) $this->id); |
|
| 297 | + $sql = "DELETE FROM ".$this->db->prefix().$this->table_element; |
|
| 298 | + $sql .= " WHERE rowid=".((int) $this->id); |
|
| 299 | 299 | |
| 300 | 300 | $this->db->begin(); |
| 301 | 301 | |
| 302 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 302 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 303 | 303 | $resql = $this->db->query($sql); |
| 304 | 304 | if (!$resql) { |
| 305 | 305 | $error++; |
| 306 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 306 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | // Commit or rollback |
| 310 | 310 | if ($error) { |
| 311 | 311 | foreach ($this->errors as $errmsg) { |
| 312 | - dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); |
|
| 313 | - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
|
| 312 | + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); |
|
| 313 | + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); |
|
| 314 | 314 | } |
| 315 | 315 | $this->db->rollback(); |
| 316 | 316 | return -1 * $error; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * @var int ID |
| 227 | 227 | */ |
| 228 | - public $fk_account; // default bank account |
|
| 228 | + public $fk_account; // default bank account |
|
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * @var int Transport mode id |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | if ($this->fac_rec > 0) { |
| 437 | 437 | $this->fk_fac_rec_source = $this->fac_rec; |
| 438 | 438 | |
| 439 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php'; |
|
| 439 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php'; |
|
| 440 | 440 | $_facrec = new FactureFournisseurRec($this->db); |
| 441 | 441 | $result = $_facrec->fetch($this->fac_rec); |
| 442 | 442 | $result = $_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $this->location_incoterms = $_facrec->location_incoterms; |
| 472 | 472 | |
| 473 | 473 | // Clean parameters |
| 474 | - if (! $this->type) { |
|
| 474 | + if (!$this->type) { |
|
| 475 | 475 | $this->type = self::TYPE_STANDARD; |
| 476 | 476 | } |
| 477 | 477 | $this->note_public = trim($this->note_public); |
@@ -480,11 +480,11 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | $this->array_options = $_facrec->array_options; |
| 482 | 482 | |
| 483 | - if (! $this->mode_reglement_id) { |
|
| 483 | + if (!$this->mode_reglement_id) { |
|
| 484 | 484 | $this->mode_reglement_id = 0; |
| 485 | 485 | } |
| 486 | 486 | $this->status = self::STATUS_DRAFT; |
| 487 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 487 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 488 | 488 | |
| 489 | 489 | $this->linked_objects = $_facrec->linkedObjectsIds; |
| 490 | 490 | // We do not add link to template invoice or next invoice will be linked to all generated invoices |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice |
| 496 | 496 | if ($_facrec->frequency > 0) { |
| 497 | - $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1)); |
|
| 497 | + $this->ref_supplier = trim($this->ref_supplier.'_'.($_facrec->nb_gen_done + 1)); |
|
| 498 | 498 | dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when"); |
| 499 | 499 | if (empty($_facrec->date_when)) { |
| 500 | 500 | $_facrec->date_when = $now; |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | /* |
| 731 | 731 | * Insert lines of template invoices |
| 732 | 732 | */ |
| 733 | - if (! $error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
| 733 | + if (!$error && $this->fac_rec > 0 && $_facrec instanceof FactureFournisseurRec) { |
|
| 734 | 734 | foreach ($_facrec->lines as $i => $val) { |
| 735 | 735 | if ($_facrec->lines[$i]->fk_product) { |
| 736 | 736 | $prod = new Product($this->db); |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | $localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr); |
| 746 | 746 | $localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr); |
| 747 | 747 | */ |
| 748 | - $tva_tx = $_facrec->lines[$i]->tva_tx . ($_facrec->lines[$i]->vat_src_code ? '(' . $_facrec->lines[$i]->vat_src_code . ')' : ''); |
|
| 748 | + $tva_tx = $_facrec->lines[$i]->tva_tx.($_facrec->lines[$i]->vat_src_code ? '('.$_facrec->lines[$i]->vat_src_code.')' : ''); |
|
| 749 | 749 | $tva_npr = $_facrec->lines[$i]->info_bits; |
| 750 | 750 | if (empty($tva_tx)) { |
| 751 | 751 | $tva_npr = 0; |
@@ -758,8 +758,8 @@ discard block |
||
| 758 | 758 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice; |
| 759 | 759 | |
| 760 | 760 | // If buyprice not defined from template invoice, we try to guess the best value |
| 761 | - if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
| 762 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; |
|
| 761 | + if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
| 762 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; |
|
| 763 | 763 | $producttmp = new ProductFournisseur($this->db); |
| 764 | 764 | $producttmp->fetch($_facrec->lines[$i]->fk_product); |
| 765 | 765 | |
@@ -945,11 +945,11 @@ discard block |
||
| 945 | 945 | $this->id = $obj->rowid; |
| 946 | 946 | $this->ref = $obj->ref ? $obj->ref : $obj->rowid; // We take rowid if ref is empty for backward compatibility |
| 947 | 947 | |
| 948 | - $this->ref_supplier = $obj->ref_supplier; |
|
| 949 | - $this->ref_ext = $obj->ref_ext; |
|
| 950 | - $this->entity = $obj->entity; |
|
| 948 | + $this->ref_supplier = $obj->ref_supplier; |
|
| 949 | + $this->ref_ext = $obj->ref_ext; |
|
| 950 | + $this->entity = $obj->entity; |
|
| 951 | 951 | $this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type; |
| 952 | - $this->subtype = (int) $obj->subtype; |
|
| 952 | + $this->subtype = (int) $obj->subtype; |
|
| 953 | 953 | $this->socid = $obj->fk_soc; |
| 954 | 954 | $this->datec = $this->db->jdate($obj->datec); |
| 955 | 955 | $this->date = $this->db->jdate($obj->datef); |
@@ -967,13 +967,13 @@ discard block |
||
| 967 | 967 | $this->total_tva = $obj->total_tva; |
| 968 | 968 | $this->total_ttc = $obj->total_ttc; |
| 969 | 969 | $this->status = $obj->status; |
| 970 | - $this->statut = $obj->status; // For backward compatibility |
|
| 971 | - $this->fk_statut = $obj->status; // For backward compatibility |
|
| 970 | + $this->statut = $obj->status; // For backward compatibility |
|
| 971 | + $this->fk_statut = $obj->status; // For backward compatibility |
|
| 972 | 972 | $this->user_creation_id = $obj->fk_user_author; |
| 973 | - $this->author = $obj->fk_user_author; // deprecated |
|
| 973 | + $this->author = $obj->fk_user_author; // deprecated |
|
| 974 | 974 | $this->user_validation_id = $obj->fk_user_valid; |
| 975 | 975 | $this->fk_facture_source = $obj->fk_facture_source; |
| 976 | - $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? 0 : 1; |
|
| 976 | + $this->vat_reverse_charge = empty($obj->vat_reverse_charge) ? 0 : 1; |
|
| 977 | 977 | $this->fk_fac_rec_source = $obj->fk_fac_rec_source; |
| 978 | 978 | $this->fk_project = $obj->fk_project; |
| 979 | 979 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
@@ -1009,7 +1009,7 @@ discard block |
||
| 1009 | 1009 | |
| 1010 | 1010 | $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); |
| 1011 | 1011 | |
| 1012 | - $this->socid = $obj->socid; |
|
| 1012 | + $this->socid = $obj->socid; |
|
| 1013 | 1013 | |
| 1014 | 1014 | // Retrieve all extrafield |
| 1015 | 1015 | // fetch optionals attributes and labels |
@@ -1076,11 +1076,11 @@ discard block |
||
| 1076 | 1076 | $line->date_end = $obj->date_end; |
| 1077 | 1077 | $line->product_ref = $obj->product_ref; |
| 1078 | 1078 | $line->ref = $obj->product_ref; |
| 1079 | - $line->ref_supplier = $obj->ref_supplier; |
|
| 1079 | + $line->ref_supplier = $obj->ref_supplier; |
|
| 1080 | 1080 | $line->libelle = $obj->label; |
| 1081 | 1081 | $line->label = $obj->label; |
| 1082 | 1082 | $line->product_barcode = $obj->product_barcode; |
| 1083 | - $line->product_desc = $obj->product_desc; |
|
| 1083 | + $line->product_desc = $obj->product_desc; |
|
| 1084 | 1084 | $line->subprice = $obj->pu_ht; |
| 1085 | 1085 | $line->pu_ht = $obj->pu_ht; |
| 1086 | 1086 | $line->pu_ttc = $obj->pu_ttc; |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | $line->localtax2_tx = $obj->localtax2_tx; |
| 1091 | 1091 | $line->localtax1_type = $obj->localtax1_type; |
| 1092 | 1092 | $line->localtax2_type = $obj->localtax2_type; |
| 1093 | - $line->qty = $obj->qty; |
|
| 1093 | + $line->qty = $obj->qty; |
|
| 1094 | 1094 | $line->remise_percent = $obj->remise_percent; |
| 1095 | 1095 | $line->fk_remise_except = $obj->fk_remise_except; |
| 1096 | 1096 | //$line->tva = $obj->total_tva; // deprecated |
@@ -2449,7 +2449,7 @@ discard block |
||
| 2449 | 2449 | |
| 2450 | 2450 | $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs((float) $qty) : (float) $qty); // For credit note, quantity is always positive and unit price negative |
| 2451 | 2451 | $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs((float) $pu_ht) : (float) $pu_ht); // For credit note, unit price always negative, always positive otherwise |
| 2452 | - $line->pu_ht = $line->subprice; // deprecated |
|
| 2452 | + $line->pu_ht = $line->subprice; // deprecated |
|
| 2453 | 2453 | $line->pu_ttc = ($this->type == self::TYPE_CREDIT_NOTE ? -abs((float) $pu_ttc) : (float) $pu_ttc); // For credit note, unit price always negative, always positive otherwise |
| 2454 | 2454 | |
| 2455 | 2455 | $line->remise_percent = $remise_percent; |
@@ -2734,7 +2734,7 @@ discard block |
||
| 2734 | 2734 | |
| 2735 | 2735 | while ($obj = $this->db->fetch_object($resql)) { |
| 2736 | 2736 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin); |
| 2737 | - $facturestatic->statut = $obj->status; // For backward compatibility |
|
| 2737 | + $facturestatic->statut = $obj->status; // For backward compatibility |
|
| 2738 | 2738 | $facturestatic->status = $obj->status; |
| 2739 | 2739 | |
| 2740 | 2740 | $response->nbtodo++; |
@@ -2947,7 +2947,7 @@ discard block |
||
| 2947 | 2947 | } |
| 2948 | 2948 | } |
| 2949 | 2949 | global $action; |
| 2950 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 2950 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 2951 | 2951 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 2952 | 2952 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 2953 | 2953 | if ($reshook > 0) { |
@@ -2978,7 +2978,7 @@ discard block |
||
| 2978 | 2978 | |
| 2979 | 2979 | $mybool = false; |
| 2980 | 2980 | |
| 2981 | - $file = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER') . ".php"; |
|
| 2981 | + $file = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER').".php"; |
|
| 2982 | 2982 | $classname = getDolGlobalString('INVOICE_SUPPLIER_ADDON_NUMBER'); |
| 2983 | 2983 | |
| 2984 | 2984 | // Include file with class |
@@ -3169,15 +3169,15 @@ discard block |
||
| 3169 | 3169 | // Load source object |
| 3170 | 3170 | $object->fetch($fromid); |
| 3171 | 3171 | $object->id = 0; |
| 3172 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
| 3172 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
| 3173 | 3173 | $object->status = self::STATUS_DRAFT; |
| 3174 | 3174 | |
| 3175 | 3175 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor |
| 3176 | 3176 | |
| 3177 | 3177 | // Clear fields |
| 3178 | 3178 | $object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier); |
| 3179 | - $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
| 3180 | - $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
| 3179 | + $object->author = $user->id; // FIXME? user_validation_id is replacement for author |
|
| 3180 | + $object->user_validation_id = 0; // FIXME? user_validation_id is replacement for author |
|
| 3181 | 3181 | $object->fk_facture_source = 0; |
| 3182 | 3182 | $object->date_creation = ''; |
| 3183 | 3183 | $object->date_validation = ''; |
@@ -3480,14 +3480,14 @@ discard block |
||
| 3480 | 3480 | if (!empty($paymentmode) && $paymentmode != 'all') { |
| 3481 | 3481 | $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp"; |
| 3482 | 3482 | } |
| 3483 | - $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
| 3484 | - $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
| 3483 | + $sql .= " WHERE f.paye = 0"; // Only unpaid |
|
| 3484 | + $sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status |
|
| 3485 | 3485 | if ($datetouse == 'invoicedate') { |
| 3486 | 3486 | $sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'"; |
| 3487 | 3487 | } else { |
| 3488 | 3488 | $sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'"; |
| 3489 | 3489 | } |
| 3490 | - $sql .= " AND f.entity IN (".getEntity('supplier_invoice', 0).")"; // One batch process only one company (no sharing) |
|
| 3490 | + $sql .= " AND f.entity IN (".getEntity('supplier_invoice', 0).")"; // One batch process only one company (no sharing) |
|
| 3491 | 3491 | if (!empty($paymentmode) && $paymentmode != 'all') { |
| 3492 | 3492 | $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; |
| 3493 | 3493 | } |
@@ -3707,7 +3707,7 @@ discard block |
||
| 3707 | 3707 | $actioncomm->create($user); |
| 3708 | 3708 | } |
| 3709 | 3709 | |
| 3710 | - $this->db->commit(); // We always commit |
|
| 3710 | + $this->db->commit(); // We always commit |
|
| 3711 | 3711 | } |
| 3712 | 3712 | |
| 3713 | 3713 | if ($errormesg) { |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | $this->ref_supplier = $obj->ref_supplier; |
| 522 | 522 | $this->socid = $obj->fk_soc; |
| 523 | 523 | $this->fourn_id = $obj->fk_soc; |
| 524 | - $this->statut = $obj->status; // deprecated |
|
| 524 | + $this->statut = $obj->status; // deprecated |
|
| 525 | 525 | $this->status = $obj->status; |
| 526 | 526 | $this->billed = $obj->billed; |
| 527 | 527 | $this->user_author_id = $obj->user_author_id; |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | $this->fk_project = $obj->fk_project; |
| 553 | 553 | $this->cond_reglement_id = $obj->fk_cond_reglement; |
| 554 | 554 | $this->cond_reglement_code = $obj->cond_reglement_code; |
| 555 | - $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
| 555 | + $this->cond_reglement = $obj->cond_reglement_label; // deprecated |
|
| 556 | 556 | $this->cond_reglement_label = $obj->cond_reglement_label; |
| 557 | 557 | $this->cond_reglement_doc = $obj->cond_reglement_doc; |
| 558 | 558 | $this->fk_account = $obj->fk_account; |
@@ -685,10 +685,10 @@ discard block |
||
| 685 | 685 | $sqlsearchpackage .= ' WHERE entity IN ('.getEntity('product_fournisseur_price').")"; |
| 686 | 686 | $sqlsearchpackage .= " AND fk_product = ".((int) $objp->fk_product); |
| 687 | 687 | $sqlsearchpackage .= " AND ref_fourn = '".$this->db->escape($objp->ref_supplier)."'"; |
| 688 | - $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
| 689 | - $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
| 688 | + $sqlsearchpackage .= " AND quantity <= ".((float) $objp->qty); // required to be qualified |
|
| 689 | + $sqlsearchpackage .= " AND (packaging IS NULL OR packaging = 0 OR packaging <= ".((float) $objp->qty).")"; // required to be qualified |
|
| 690 | 690 | $sqlsearchpackage .= " AND fk_soc = ".((int) $this->socid); |
| 691 | - $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
| 691 | + $sqlsearchpackage .= " ORDER BY packaging ASC"; // Take the smaller package first |
|
| 692 | 692 | $sqlsearchpackage .= " LIMIT 1"; |
| 693 | 693 | |
| 694 | 694 | $resqlsearchpackage = $this->db->query($sqlsearchpackage); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $line->multicurrency_total_tva = $objp->multicurrency_total_tva; |
| 717 | 717 | $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; |
| 718 | 718 | |
| 719 | - $line->info_bits = $objp->info_bits; |
|
| 719 | + $line->info_bits = $objp->info_bits; |
|
| 720 | 720 | $line->special_code = $objp->special_code; |
| 721 | 721 | $line->fk_parent_line = $objp->fk_parent_line; |
| 722 | 722 | |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | if (!$error) { |
| 844 | 844 | $result = 1; |
| 845 | 845 | $this->status = self::STATUS_VALIDATED; |
| 846 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 846 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
| 847 | 847 | $this->ref = $num; |
| 848 | 848 | } |
| 849 | 849 | |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | global $action; |
| 1089 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1089 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1090 | 1090 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1091 | 1091 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1092 | 1092 | if ($reshook > 0) { |
@@ -1576,7 +1576,7 @@ discard block |
||
| 1576 | 1576 | $this->multicurrency_tx = 1; |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 1579 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
| 1580 | 1580 | $this->status = self::STATUS_DRAFT; |
| 1581 | 1581 | |
| 1582 | 1582 | $sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur ("; |
@@ -1662,10 +1662,10 @@ discard block |
||
| 1662 | 1662 | $line->date_end, |
| 1663 | 1663 | $line->array_options, |
| 1664 | 1664 | $line->fk_unit, |
| 1665 | - $line->multicurrency_subprice, // pu_ht_devise |
|
| 1666 | - $line->origin, // origin |
|
| 1667 | - $line->origin_id, // origin_id |
|
| 1668 | - $line->rang, // rang |
|
| 1665 | + $line->multicurrency_subprice, // pu_ht_devise |
|
| 1666 | + $line->origin, // origin |
|
| 1667 | + $line->origin_id, // origin_id |
|
| 1668 | + $line->rang, // rang |
|
| 1669 | 1669 | $line->special_code |
| 1670 | 1670 | ); |
| 1671 | 1671 | if ($result < 0) { |
@@ -2039,7 +2039,7 @@ discard block |
||
| 2039 | 2039 | $this->db->begin(); |
| 2040 | 2040 | |
| 2041 | 2041 | $product_type = $type; |
| 2042 | - $label = ''; // deprecated |
|
| 2042 | + $label = ''; // deprecated |
|
| 2043 | 2043 | |
| 2044 | 2044 | if ($fk_product > 0) { |
| 2045 | 2045 | if (getDolGlobalString('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY')) { // Not the common case |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | if ($qty < $prod->packaging) { |
| 2102 | 2102 | $qty = $prod->packaging; |
| 2103 | 2103 | } else { |
| 2104 | - if (!empty($prod->packaging) && (fmod((float) $qty, $prod->packaging) > 0.000001)) { |
|
| 2104 | + if (!empty($prod->packaging) && (fmod((float) $qty, $prod->packaging) > 0.000001)) { |
|
| 2105 | 2105 | $coeff = intval((float) $qty / $prod->packaging) + 1; |
| 2106 | 2106 | $qty = (float) $prod->packaging * $coeff; |
| 2107 | 2107 | setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | $this->line->total_localtax2 = (float) $total_localtax2; |
| 2183 | 2183 | $this->line->total_ttc = (float) $total_ttc; |
| 2184 | 2184 | $this->line->product_type = $type; |
| 2185 | - $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
| 2185 | + $this->line->special_code = (!empty($special_code) ? $special_code : 0); |
|
| 2186 | 2186 | $this->line->origin = $origin; |
| 2187 | 2187 | $this->line->origin_id = $origin_id; |
| 2188 | 2188 | $this->line->fk_unit = $fk_unit; |
@@ -2193,8 +2193,8 @@ discard block |
||
| 2193 | 2193 | // Multicurrency |
| 2194 | 2194 | $this->line->fk_multicurrency = $this->fk_multicurrency; |
| 2195 | 2195 | $this->line->multicurrency_code = $this->multicurrency_code; |
| 2196 | - $this->line->multicurrency_subprice = (float) $pu_ht_devise; |
|
| 2197 | - $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; |
|
| 2196 | + $this->line->multicurrency_subprice = (float) $pu_ht_devise; |
|
| 2197 | + $this->line->multicurrency_total_ht = (float) $multicurrency_total_ht; |
|
| 2198 | 2198 | $this->line->multicurrency_total_tva = (float) $multicurrency_total_tva; |
| 2199 | 2199 | $this->line->multicurrency_total_ttc = (float) $multicurrency_total_ttc; |
| 2200 | 2200 | |
@@ -3390,7 +3390,7 @@ discard block |
||
| 3390 | 3390 | global $conf, $langs; |
| 3391 | 3391 | |
| 3392 | 3392 | if (!dol_strlen($modele)) { |
| 3393 | - $modele = ''; // No doc template/generation by default |
|
| 3393 | + $modele = ''; // No doc template/generation by default |
|
| 3394 | 3394 | |
| 3395 | 3395 | if (!empty($this->model_pdf)) { |
| 3396 | 3396 | $modele = $this->model_pdf; |