@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | if (!is_object($formadmin)) { |
38 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; |
|
38 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; |
|
39 | 39 | $formadmin = new FormAdmin($db); |
40 | 40 | } |
41 | 41 | |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | 'mode_key' => $info[0], |
70 | 70 | 'field_key' => $info[1], |
71 | 71 | 'value' => $info[2], |
72 | - 'target' => 'block_' . $mode_key, |
|
72 | + 'target' => 'block_'.$mode_key, |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $assetdepreciationoptions->setInfosForMode($mode_key, $class_type, true); |
77 | - $prefix_html_name = $mode_key . '_'; |
|
77 | + $prefix_html_name = $mode_key.'_'; |
|
78 | 78 | |
79 | - print '<div id="block_' . $mode_key . '">'; |
|
79 | + print '<div id="block_'.$mode_key.'">'; |
|
80 | 80 | print load_fiche_titre($langs->trans($mode_info['label']), '', ''); |
81 | 81 | print '<div class="fichecenter">'; |
82 | 82 | print '<div class="fichehalfleft">'; |
83 | 83 | print '<div class="underbanner clearboth"></div>'; |
84 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
84 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
85 | 85 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
86 | 86 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
87 | 87 | // Discard if extrafield is a hidden field on form |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | print '<table class="border centpercent tableforfield">'; |
103 | 103 | } |
104 | 104 | |
105 | - $html_name = $prefix_html_name . $field_key; |
|
105 | + $html_name = $prefix_html_name.$field_key; |
|
106 | 106 | if (!empty($field_info['enabled_field'])) { |
107 | 107 | $info = explode(':', $field_info['enabled_field']); |
108 | 108 | $enabled_field_info[] = array( |
109 | 109 | 'mode_key' => $info[0], |
110 | 110 | 'field_key' => $info[1], |
111 | 111 | 'value' => $info[2], |
112 | - 'target' => 'field_' . $html_name, |
|
112 | + 'target' => 'field_'.$html_name, |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $more_class .= ' tdtop'; |
122 | 122 | } |
123 | 123 | |
124 | - print '<tr class="field_' . $html_name . '" id="field_' . $html_name . '"><td'; |
|
125 | - print ' class="titlefieldcreate' . $more_class . '">'; |
|
124 | + print '<tr class="field_'.$html_name.'" id="field_'.$html_name.'"><td'; |
|
125 | + print ' class="titlefieldcreate'.$more_class.'">'; |
|
126 | 126 | if (!empty($field_info['help'])) { |
127 | 127 | print $form->textwithpicto($langs->trans($field_info['label']), $langs->trans($field_info['help'])); |
128 | 128 | } else { |
@@ -221,7 +221,7 @@ |
||
221 | 221 | } |
222 | 222 | }); |
223 | 223 | </script> |
224 | -SCRIPT; |
|
224 | +script; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '<div class="fichecenter">'; |
68 | 68 | print '<div class="fichehalfleft">'; |
69 | 69 | print '<div class="underbanner clearboth"></div>'; |
70 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
70 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
71 | 71 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
72 | 72 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
73 | 73 | if (!empty($field_info['enabled_field'])) { |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | print '<table class="border centpercent tableforfield">'; |
95 | 95 | } |
96 | 96 | |
97 | - $key = $mode_key . '_' . $field_key; |
|
97 | + $key = $mode_key.'_'.$field_key; |
|
98 | 98 | $value = $assetdepreciationoptions->deprecation_options[$mode_key][$field_key]; |
99 | 99 | |
100 | - print '<tr class="field_' . $key . '"><td'; |
|
101 | - print ' class="' . (empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']) . ' fieldname_' . $key; |
|
100 | + print '<tr class="field_'.$key.'"><td'; |
|
101 | + print ' class="'.(empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']).' fieldname_'.$key; |
|
102 | 102 | if ($field_info['type'] == 'text' || $field_info['type'] == 'html') { |
103 | 103 | print ' tdtop'; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | print '</td>'; |
116 | - print '<td class="valuefield fieldname_' . $key; |
|
116 | + print '<td class="valuefield fieldname_'.$key; |
|
117 | 117 | if ($field_info['type'] == 'text') { |
118 | 118 | print ' wordbreak'; |
119 | 119 | } |
120 | 120 | if (!empty($field_info['cssview'])) { |
121 | - print ' ' . $field_info['cssview']; |
|
121 | + print ' '.$field_info['cssview']; |
|
122 | 122 | } |
123 | 123 | print '">'; |
124 | 124 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | } |
127 | 127 | if ($field_key == 'lang') { |
128 | 128 | $langs->load("languages"); |
129 | - $labellang = ($value ? $langs->trans('Language_' . $value) : ''); |
|
129 | + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); |
|
130 | 130 | print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); |
131 | 131 | print $labellang; |
132 | 132 | } else { |
133 | 133 | if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 2) { |
134 | - $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
134 | + $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
135 | 135 | print showValueWithClipboardCPButton($out, 0, $out); |
136 | 136 | } else { |
137 | - print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
137 | + print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -80,32 +80,32 @@ discard block |
||
80 | 80 | $h = 0; |
81 | 81 | $head = array(); |
82 | 82 | |
83 | - $head[$h][0] = DOL_URL_ROOT . '/asset/card.php?id=' . $object->id; |
|
83 | + $head[$h][0] = DOL_URL_ROOT.'/asset/card.php?id='.$object->id; |
|
84 | 84 | $head[$h][1] = $langs->trans("Card"); |
85 | 85 | $head[$h][2] = 'card'; |
86 | 86 | $h++; |
87 | 87 | |
88 | 88 | if (empty($object->not_depreciated)) { |
89 | - $head[$h][0] = DOL_URL_ROOT . '/asset/depreciation_options.php?id=' . $object->id; |
|
89 | + $head[$h][0] = DOL_URL_ROOT.'/asset/depreciation_options.php?id='.$object->id; |
|
90 | 90 | $head[$h][1] = $langs->trans("AssetDepreciationOptions"); |
91 | 91 | $head[$h][2] = 'depreciation_options'; |
92 | 92 | $h++; |
93 | 93 | } |
94 | 94 | |
95 | - $head[$h][0] = DOL_URL_ROOT . '/asset/accountancy_codes.php?id=' . $object->id; |
|
95 | + $head[$h][0] = DOL_URL_ROOT.'/asset/accountancy_codes.php?id='.$object->id; |
|
96 | 96 | $head[$h][1] = $langs->trans("AssetAccountancyCodes"); |
97 | 97 | $head[$h][2] = 'accountancy_codes'; |
98 | 98 | $h++; |
99 | 99 | |
100 | 100 | if (empty($object->not_depreciated)) { |
101 | - $head[$h][0] = DOL_URL_ROOT . '/asset/depreciation.php?id=' . $object->id; |
|
101 | + $head[$h][0] = DOL_URL_ROOT.'/asset/depreciation.php?id='.$object->id; |
|
102 | 102 | $head[$h][1] = $langs->trans("AssetDepreciation"); |
103 | 103 | $head[$h][2] = 'depreciation'; |
104 | 104 | $h++; |
105 | 105 | } |
106 | 106 | |
107 | 107 | if (isset($object->disposal_date) && $object->disposal_date !== "") { |
108 | - $head[$h][0] = DOL_URL_ROOT . '/asset/disposal.php?id=' . $object->id; |
|
108 | + $head[$h][0] = DOL_URL_ROOT.'/asset/disposal.php?id='.$object->id; |
|
109 | 109 | $head[$h][1] = $langs->trans("AssetDisposal"); |
110 | 110 | $head[$h][2] = 'disposal'; |
111 | 111 | $h++; |
@@ -119,29 +119,29 @@ discard block |
||
119 | 119 | if (!empty($object->note_public)) { |
120 | 120 | $nbNote++; |
121 | 121 | } |
122 | - $head[$h][0] = DOL_URL_ROOT . '/asset/note.php?id=' . $object->id; |
|
122 | + $head[$h][0] = DOL_URL_ROOT.'/asset/note.php?id='.$object->id; |
|
123 | 123 | $head[$h][1] = $langs->trans('Notes'); |
124 | 124 | if ($nbNote > 0) { |
125 | - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : ''); |
|
125 | + $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : ''); |
|
126 | 126 | } |
127 | 127 | $head[$h][2] = 'note'; |
128 | 128 | $h++; |
129 | 129 | } |
130 | 130 | |
131 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
132 | - require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; |
|
133 | - $upload_dir = $conf->asset->dir_output . "/asset/" . dol_sanitizeFileName($object->ref); |
|
131 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
132 | + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
|
133 | + $upload_dir = $conf->asset->dir_output."/asset/".dol_sanitizeFileName($object->ref); |
|
134 | 134 | $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
135 | 135 | $nbLinks = Link::count($db, $object->element, $object->id); |
136 | - $head[$h][0] = DOL_URL_ROOT . '/asset/document.php?id=' . $object->id; |
|
136 | + $head[$h][0] = DOL_URL_ROOT.'/asset/document.php?id='.$object->id; |
|
137 | 137 | $head[$h][1] = $langs->trans('Documents'); |
138 | 138 | if (($nbFiles + $nbLinks) > 0) { |
139 | - $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>'; |
|
139 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>'; |
|
140 | 140 | } |
141 | 141 | $head[$h][2] = 'document'; |
142 | 142 | $h++; |
143 | 143 | |
144 | - $head[$h][0] = DOL_URL_ROOT . '/asset/agenda.php?id=' . $object->id; |
|
144 | + $head[$h][0] = DOL_URL_ROOT.'/asset/agenda.php?id='.$object->id; |
|
145 | 145 | $head[$h][1] = $langs->trans("Events"); |
146 | 146 | $head[$h][2] = 'agenda'; |
147 | 147 | $h++; |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | $h = 0; |
177 | 177 | $head = array(); |
178 | 178 | |
179 | - $head[$h][0] = DOL_URL_ROOT . '/asset/model/card.php?id=' . $object->id; |
|
179 | + $head[$h][0] = DOL_URL_ROOT.'/asset/model/card.php?id='.$object->id; |
|
180 | 180 | $head[$h][1] = $langs->trans("Card"); |
181 | 181 | $head[$h][2] = 'card'; |
182 | 182 | $h++; |
183 | 183 | |
184 | - $head[$h][0] = DOL_URL_ROOT . '/asset/model/depreciation_options.php?id=' . $object->id; |
|
184 | + $head[$h][0] = DOL_URL_ROOT.'/asset/model/depreciation_options.php?id='.$object->id; |
|
185 | 185 | $head[$h][1] = $langs->trans("AssetDepreciationOptions"); |
186 | 186 | $head[$h][2] = 'depreciation_options'; |
187 | 187 | $h++; |
188 | 188 | |
189 | - $head[$h][0] = DOL_URL_ROOT . '/asset/model/accountancy_codes.php?id=' . $object->id; |
|
189 | + $head[$h][0] = DOL_URL_ROOT.'/asset/model/accountancy_codes.php?id='.$object->id; |
|
190 | 190 | $head[$h][1] = $langs->trans("AssetAccountancyCodes"); |
191 | 191 | $head[$h][2] = 'accountancy_codes'; |
192 | 192 | $h++; |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | if (!empty($object->note_public)) { |
200 | 200 | $nbNote++; |
201 | 201 | } |
202 | - $head[$h][0] = DOL_URL_ROOT . '/asset/model/note.php?id=' . $object->id; |
|
202 | + $head[$h][0] = DOL_URL_ROOT.'/asset/model/note.php?id='.$object->id; |
|
203 | 203 | $head[$h][1] = $langs->trans('Notes'); |
204 | 204 | if ($nbNote > 0) { |
205 | - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : ''); |
|
205 | + $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : ''); |
|
206 | 206 | } |
207 | 207 | $head[$h][2] = 'note'; |
208 | 208 | $h++; |
209 | 209 | } |
210 | 210 | |
211 | - $head[$h][0] = DOL_URL_ROOT . '/asset/model/agenda.php?id=' . $object->id; |
|
211 | + $head[$h][0] = DOL_URL_ROOT.'/asset/model/agenda.php?id='.$object->id; |
|
212 | 212 | $head[$h][1] = $langs->trans("Events"); |
213 | 213 | $head[$h][2] = 'agenda'; |
214 | 214 | $h++; |
@@ -397,9 +397,15 @@ |
||
397 | 397 | ) { |
398 | 398 | $accountancy_category_asset = $conf->global->ASSET_ACCOUNTANCY_CATEGORY; |
399 | 399 | $filters = array(); |
400 | - if (!empty($product_static->accountancy_code_buy)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; |
|
401 | - if (!empty($product_static->accountancy_code_buy_intra)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; |
|
402 | - if (!empty($product_static->accountancy_code_buy_export)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; |
|
400 | + if (!empty($product_static->accountancy_code_buy)) { |
|
401 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; |
|
402 | + } |
|
403 | + if (!empty($product_static->accountancy_code_buy_intra)) { |
|
404 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; |
|
405 | + } |
|
406 | + if (!empty($product_static->accountancy_code_buy_export)) { |
|
407 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; |
|
408 | + } |
|
403 | 409 | $sql = "SELECT COUNT(*) AS found"; |
404 | 410 | $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account"; |
405 | 411 | $sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'"; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $discount = new DiscountAbsolute($this->db); |
111 | 111 | $discount->fetch($line->fk_remise_except); |
112 | 112 | print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); |
113 | - } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) { |
|
113 | + } elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) { |
|
114 | 114 | include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
115 | 115 | $discount = new DiscountAbsolute($this->db); |
116 | 116 | $discount->fetch($line->fk_remise_except); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) { |
120 | 120 | print ' ('.dol_print_date($discount->datec).')'; |
121 | 121 | } |
122 | - } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) { |
|
122 | + } elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) { |
|
123 | 123 | include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
124 | 124 | $discount = new DiscountAbsolute($this->db); |
125 | 125 | $discount->fetch($line->fk_remise_except); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // we need to fetch product associated to line for some test |
194 | 194 | if ($object->element == 'propal' || $object->element == 'order' || $object->element == 'facture' || $object->element == 'propal_supplier' || $object->element == 'supplier_proposal' || $object->element == 'commande') { |
195 | 195 | $res = $line->fetch_product(); |
196 | - if ($res > 0 ) { |
|
196 | + if ($res > 0) { |
|
197 | 197 | if ($line->product->isService() && $line->product->isMandatoryPeriod()) { |
198 | 198 | print '<div><span class="clearboth nowraponall warning">'.$langs->trans("mandatoryPeriodNeedTobeSet").'</span></div>'; |
199 | 199 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | if ($mysoc->useLocalTax(2)) { |
288 | - if (( isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { |
|
288 | + if ((isset($seller->country_code) && isset($buyer->thirdparty->country_code) && $seller->country_code == $buyer->thirdparty->country_code) || $line->total_localtax2 || $seller->useLocalTax(2)) { |
|
289 | 289 | $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", $seller->country_code).'='.price($line->total_localtax2); |
290 | 290 | } else { |
291 | 291 | $tooltiponprice .= '<br>'.$langs->transcountry("TotalLT2", $seller->country_code).'=<span class="opacitymedium">'.$langs->trans($senderissupplier ? "NotUsedForThisVendor" : "NotUsedForThisCustomer").'</span>'; |
@@ -431,20 +431,20 @@ discard block |
||
431 | 431 | ) { |
432 | 432 | $accountancy_category_asset = $conf->global->ASSET_ACCOUNTANCY_CATEGORY; |
433 | 433 | $filters = array(); |
434 | - if (!empty($product_static->accountancy_code_buy)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; |
|
435 | - if (!empty($product_static->accountancy_code_buy_intra)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; |
|
436 | - if (!empty($product_static->accountancy_code_buy_export)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; |
|
434 | + if (!empty($product_static->accountancy_code_buy)) $filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy)."'"; |
|
435 | + if (!empty($product_static->accountancy_code_buy_intra)) $filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy_intra)."'"; |
|
436 | + if (!empty($product_static->accountancy_code_buy_export)) $filters[] = "account_number = '".$this->db->escape($product_static->accountancy_code_buy_export)."'"; |
|
437 | 437 | $sql = "SELECT COUNT(*) AS found"; |
438 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account"; |
|
439 | - $sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'"; |
|
440 | - $sql .= " AND (" . implode(' OR ', $filters). ")"; |
|
438 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account"; |
|
439 | + $sql .= " WHERE pcg_type = '".$this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY)."'"; |
|
440 | + $sql .= " AND (".implode(' OR ', $filters).")"; |
|
441 | 441 | $resql_asset = $this->db->query($sql); |
442 | 442 | if (!$resql_asset) { |
443 | - print 'Error SQL: ' . $this->db->lasterror(); |
|
443 | + print 'Error SQL: '.$this->db->lasterror(); |
|
444 | 444 | } elseif ($obj = $this->db->fetch_object($resql_asset)) { |
445 | 445 | if (!empty($obj->found)) { |
446 | - print '<a class="reposition" href="' . DOL_URL_ROOT . '/asset/card.php?action=create&token='.newToken().'&supplier_invoice_id='.$object->id.'">'; |
|
447 | - print img_edit_add() . '</a>'; |
|
446 | + print '<a class="reposition" href="'.DOL_URL_ROOT.'/asset/card.php?action=create&token='.newToken().'&supplier_invoice_id='.$object->id.'">'; |
|
447 | + print img_edit_add().'</a>'; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
@@ -349,8 +349,9 @@ discard block |
||
349 | 349 | |
350 | 350 | $rang = $i; |
351 | 351 | //there may already be rows from previous receptions |
352 | - if (!empty($createbills_onebythird)) |
|
353 | - $rang = $TFactThirdNbLines[$rcp->socid]; |
|
352 | + if (!empty($createbills_onebythird)) { |
|
353 | + $rang = $TFactThirdNbLines[$rcp->socid]; |
|
354 | + } |
|
354 | 355 | |
355 | 356 | $result = $objecttmp->addline( |
356 | 357 | $desc, |
@@ -380,8 +381,10 @@ discard block |
||
380 | 381 | |
381 | 382 | if ($result > 0) { |
382 | 383 | $lineid = $result; |
383 | - if (!empty($createbills_onebythird)) //increment rang to keep order |
|
384 | + if (!empty($createbills_onebythird)) { |
|
385 | + //increment rang to keep order |
|
384 | 386 | $TFactThirdNbLines[$rcp->socid]++; |
387 | + } |
|
385 | 388 | } else { |
386 | 389 | $lineid = 0; |
387 | 390 | $error++; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); |
60 | 60 | $search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int'); |
61 | 61 | $search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int'); |
62 | -$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver |
|
62 | +$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver |
|
63 | 63 | $search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear); |
64 | 64 | $search_date_create_startday = GETPOST('search_date_create_startday', 'int'); |
65 | 65 | $search_date_create_startmonth = GETPOST('search_date_create_startmonth', 'int'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $search_date_create_endday = GETPOST('search_date_create_endday', 'int'); |
68 | 68 | $search_date_create_endmonth = GETPOST('search_date_create_endmonth', 'int'); |
69 | 69 | $search_date_create_endyear = GETPOST('search_date_create_endyear', 'int'); |
70 | -$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver |
|
70 | +$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver |
|
71 | 71 | $search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear); |
72 | 72 | $search_billed = GETPOST("search_billed", 'int'); |
73 | 73 | $sall = GETPOST('sall', 'alphanohtml'); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $TFactThirdNbLines = array(); |
222 | 222 | |
223 | 223 | $nb_bills_created = 0; |
224 | - $lastid= 0; |
|
224 | + $lastid = 0; |
|
225 | 225 | $lastref = ''; |
226 | 226 | |
227 | 227 | $db->begin(); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // if the VAT reverse-charge is activated by default in supplier card to resume the information |
350 | 350 | $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; |
351 | 351 | |
352 | - $objecttmp->fk_project = $rcp->fk_project; |
|
352 | + $objecttmp->fk_project = $rcp->fk_project; |
|
353 | 353 | //$objecttmp->multicurrency_code = $rcp->multicurrency_code; |
354 | 354 | if (empty($createbills_onebythird)) { |
355 | 355 | $objecttmp->ref_supplier = $rcp->ref; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | } |
384 | 384 | |
385 | - $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id |
|
385 | + $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id |
|
386 | 386 | |
387 | 387 | //var_dump($objecttmp->error);exit; |
388 | 388 | if ($res > 0) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | $id = $objecttmp->id; // For builddoc action |
557 | 557 | $lastref = $objecttmp->ref; // generated ref |
558 | - $object =$objecttmp; |
|
558 | + $object = $objecttmp; |
|
559 | 559 | |
560 | 560 | // Fac builddoc |
561 | 561 | $donotredirect = 1; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '<div class="fichecenter">'; |
68 | 68 | print '<div class="fichehalfleft">'; |
69 | 69 | print '<div class="underbanner clearboth"></div>'; |
70 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
70 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
71 | 71 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
72 | 72 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
73 | 73 | if (!empty($field_info['enabled_field'])) { |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | print '<table class="border centpercent tableforfield">'; |
95 | 95 | } |
96 | 96 | |
97 | - $key = $mode_key . '_' . $field_key; |
|
97 | + $key = $mode_key.'_'.$field_key; |
|
98 | 98 | $value = $assetdepreciationoptions->deprecation_options[$mode_key][$field_key]; |
99 | 99 | |
100 | - print '<tr class="field_' . $key . '"><td'; |
|
101 | - print ' class="' . (empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']) . ' fieldname_' . $key; |
|
100 | + print '<tr class="field_'.$key.'"><td'; |
|
101 | + print ' class="'.(empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']).' fieldname_'.$key; |
|
102 | 102 | if ($field_info['type'] == 'text' || $field_info['type'] == 'html') { |
103 | 103 | print ' tdtop'; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | print '</td>'; |
116 | - print '<td class="valuefield fieldname_' . $key; |
|
116 | + print '<td class="valuefield fieldname_'.$key; |
|
117 | 117 | if ($field_info['type'] == 'text') { |
118 | 118 | print ' wordbreak'; |
119 | 119 | } |
120 | 120 | if (!empty($field_info['cssview'])) { |
121 | - print ' ' . $field_info['cssview']; |
|
121 | + print ' '.$field_info['cssview']; |
|
122 | 122 | } |
123 | 123 | print '">'; |
124 | 124 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | } |
127 | 127 | if ($field_key == 'lang') { |
128 | 128 | $langs->load("languages"); |
129 | - $labellang = ($value ? $langs->trans('Language_' . $value) : ''); |
|
129 | + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); |
|
130 | 130 | print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); |
131 | 131 | print $labellang; |
132 | 132 | } else { |
133 | 133 | if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 2) { |
134 | - $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
134 | + $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
135 | 135 | print showValueWithClipboardCPButton($out, 0, $out); |
136 | 136 | } else { |
137 | - print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
137 | + print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $amount = $credit; |
107 | 107 | } |
108 | 108 | |
109 | - return "'" . $this->db->escape(abs($amount)) . "'"; |
|
109 | + return "'".$this->db->escape(abs($amount))."'"; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return "''"; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $sens = 'C'; |
135 | 135 | } |
136 | 136 | |
137 | - return "'" . $this->db->escape($sens) . "'"; |
|
137 | + return "'".$this->db->escape($sens)."'"; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return "''"; |
@@ -479,7 +479,9 @@ |
||
479 | 479 | $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; |
480 | 480 | $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
481 | 481 | $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
482 | - if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
482 | + if ($this->fk_soc > 0) { |
|
483 | + $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
484 | + } |
|
483 | 485 | $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
484 | 486 | $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
485 | 487 | $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
@@ -334,32 +334,32 @@ discard block |
||
334 | 334 | $sql .= ", '".$this->db->idate($now)."'"; |
335 | 335 | $sql .= ", ".((int) $this->suspended); |
336 | 336 | $sql .= ", '".$this->db->escape($this->libelle)."'"; |
337 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
338 | - $sql .= ", " .((int) $user->id); |
|
339 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
340 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
341 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
342 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
343 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
344 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
345 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
346 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
347 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency; |
|
337 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
338 | + $sql .= ", ".((int) $user->id); |
|
339 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
340 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
341 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
342 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
343 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
344 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
345 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
346 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
347 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency; |
|
348 | 348 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; |
349 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx; |
|
350 | - $sql .= ", " . (int) $this->usenewprice; |
|
351 | - $sql .= ", " . (int) $this->frequency; |
|
349 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx; |
|
350 | + $sql .= ", ".(int) $this->usenewprice; |
|
351 | + $sql .= ", ".(int) $this->frequency; |
|
352 | 352 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; |
353 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
354 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
355 | - $sql .= ", " . (int) $this->nb_gen_done; |
|
356 | - $sql .= ", " . (int) $this->nb_gen_max; |
|
357 | - $sql .= ", " . (int) $this->auto_validate; |
|
358 | - $sql .= ", " . (int) $this->generate_pdf; |
|
353 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
354 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
355 | + $sql .= ", ".(int) $this->nb_gen_done; |
|
356 | + $sql .= ", ".(int) $this->nb_gen_max; |
|
357 | + $sql .= ", ".(int) $this->auto_validate; |
|
358 | + $sql .= ", ".(int) $this->generate_pdf; |
|
359 | 359 | $sql .= ')'; |
360 | 360 | |
361 | 361 | if ($this->db->query($sql)) { |
362 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec'); |
|
362 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec'); |
|
363 | 363 | |
364 | 364 | // Fields used into addline later |
365 | 365 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency; |
@@ -496,42 +496,42 @@ discard block |
||
496 | 496 | $error = 0; |
497 | 497 | |
498 | 498 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; |
499 | - $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; |
|
500 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
501 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
|
502 | - if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
503 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
|
504 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
|
505 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
|
506 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; |
|
507 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; |
|
508 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; |
|
509 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; |
|
510 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; |
|
511 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ','; |
|
512 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; |
|
513 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; |
|
514 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; |
|
515 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; |
|
516 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; |
|
517 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; |
|
518 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; |
|
519 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; |
|
520 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; |
|
521 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; |
|
522 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; |
|
523 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; |
|
524 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; |
|
525 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; |
|
526 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; |
|
527 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; |
|
528 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; |
|
529 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; |
|
530 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; |
|
531 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; |
|
532 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; |
|
533 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
534 | - $sql .= " WHERE rowid = ". (int) $this->id; |
|
499 | + $sql .= " titre = '".(!empty($this->titre) ? $this->db->escape($this->titre) : "")."',"; |
|
500 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
501 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).','; |
|
502 | + if ($this->fk_soc > 0) $sql .= " fk_soc = ".(int) $this->fk_soc.','; |
|
503 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).','; |
|
504 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').","; |
|
505 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').','; |
|
506 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).','; |
|
507 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).','; |
|
508 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).','; |
|
509 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).','; |
|
510 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).','; |
|
511 | + $sql .= " fk_user_modif = ".((int) $user->id).','; |
|
512 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').','; |
|
513 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').','; |
|
514 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').','; |
|
515 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').','; |
|
516 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').','; |
|
517 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',"; |
|
518 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',"; |
|
519 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').","; |
|
520 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').','; |
|
521 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').","; |
|
522 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).','; |
|
523 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).','; |
|
524 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).','; |
|
525 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).','; |
|
526 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).','; |
|
527 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).','; |
|
528 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',"; |
|
529 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').','; |
|
530 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').','; |
|
531 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).','; |
|
532 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).','; |
|
533 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
534 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
535 | 535 | |
536 | 536 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
537 | 537 | $resql = $this->db->query($sql); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
591 | 591 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
592 | 592 | if ($rowid) { |
593 | - $sql .= ' AND f.rowid='. (int) $rowid; |
|
593 | + $sql .= ' AND f.rowid='.(int) $rowid; |
|
594 | 594 | } elseif ($ref) { |
595 | 595 | $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
596 | 596 | } else { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
723 | 723 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
724 | 724 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
725 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id; |
|
725 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id; |
|
726 | 726 | $sql .= ' ORDER BY l.rang'; |
727 | 727 | |
728 | 728 | dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $line->product_type = $objp->product_type; |
763 | 763 | $line->date_start = $objp->date_start; |
764 | 764 | $line->date_end = $objp->date_end; |
765 | - $line->info_bits = $objp->info_bits ; |
|
765 | + $line->info_bits = $objp->info_bits; |
|
766 | 766 | $line->special_code = $objp->special_code; |
767 | 767 | $line->rang = $objp->rang; |
768 | 768 | $line->fk_unit = $objp->fk_unit; |
@@ -812,11 +812,11 @@ discard block |
||
812 | 812 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec'; |
813 | 813 | $ef = $main."_extrafields"; |
814 | 814 | |
815 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")"; |
|
816 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid; |
|
815 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")"; |
|
816 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid; |
|
817 | 817 | |
818 | 818 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
819 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid; |
|
819 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid; |
|
820 | 820 | dol_syslog($sql); |
821 | 821 | if ($this->db->query($sql)) { |
822 | 822 | // Delete linked object |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } |
846 | 846 | // End call triggers |
847 | 847 | } |
848 | - if (! $error) { |
|
848 | + if (!$error) { |
|
849 | 849 | $this->db->commit(); |
850 | 850 | return 1; |
851 | 851 | } else { |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | } |
958 | 958 | } |
959 | 959 | |
960 | - $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; |
|
960 | + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; |
|
961 | 961 | $sql .= 'fk_facture_fourn'; |
962 | 962 | $sql .= ', fk_product'; |
963 | 963 | $sql .= ', ref'; |
@@ -989,46 +989,46 @@ discard block |
||
989 | 989 | $sql .= ', fk_user_author'; |
990 | 990 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
991 | 991 | $sql .= ') VALUES ('; |
992 | - $sql .= ' ' . (int) $facid; // source supplier invoie id |
|
993 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); |
|
994 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
|
995 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
|
996 | - $sql .= ", '" . $this->db->escape($desc) . "'"; |
|
997 | - $sql .= ', ' . price2num($pu_ht); |
|
998 | - $sql .= ', ' . price2num($pu_ttc); |
|
999 | - $sql .= ', ' . price2num($qty); |
|
1000 | - $sql .= ', ' . price2num($remise_percent); |
|
992 | + $sql .= ' '.(int) $facid; // source supplier invoie id |
|
993 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null'); |
|
994 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null'); |
|
995 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null'); |
|
996 | + $sql .= ", '".$this->db->escape($desc)."'"; |
|
997 | + $sql .= ', '.price2num($pu_ht); |
|
998 | + $sql .= ', '.price2num($pu_ttc); |
|
999 | + $sql .= ', '.price2num($qty); |
|
1000 | + $sql .= ', '.price2num($remise_percent); |
|
1001 | 1001 | $sql .= ', null'; |
1002 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'"; |
|
1003 | - $sql .= ', ' . price2num($txtva); |
|
1004 | - $sql .= ', ' . price2num($txlocaltax1); |
|
1005 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'"; |
|
1006 | - $sql .= ', ' . price2num($txlocaltax2); |
|
1007 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'"; |
|
1008 | - $sql .= ', ' . price2num($total_ht); |
|
1009 | - $sql .= ', ' . price2num($total_tva); |
|
1010 | - $sql .= ', ' . price2num($total_localtax1); |
|
1011 | - $sql .= ', ' . price2num($total_localtax2); |
|
1012 | - $sql .= ', ' . price2num($total_ttc); |
|
1013 | - $sql .= ', ' . (int) $product_type; |
|
1014 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1015 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1016 | - $sql .= ', ' . (int) $info_bits; |
|
1017 | - $sql .= ', ' . (int) $special_code; |
|
1018 | - $sql .= ', ' . (int) $rang; |
|
1019 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1020 | - $sql .= ', ' . (int) $user; |
|
1021 | - $sql .= ', ' . (int) $this->fk_multicurrency; |
|
1022 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
|
1023 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU'); |
|
1024 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT'); |
|
1025 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT'); |
|
1026 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT'); |
|
1002 | + $sql .= ", '".$this->db->escape($vat_src_code)."'"; |
|
1003 | + $sql .= ', '.price2num($txtva); |
|
1004 | + $sql .= ', '.price2num($txlocaltax1); |
|
1005 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'"; |
|
1006 | + $sql .= ', '.price2num($txlocaltax2); |
|
1007 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'"; |
|
1008 | + $sql .= ', '.price2num($total_ht); |
|
1009 | + $sql .= ', '.price2num($total_tva); |
|
1010 | + $sql .= ', '.price2num($total_localtax1); |
|
1011 | + $sql .= ', '.price2num($total_localtax2); |
|
1012 | + $sql .= ', '.price2num($total_ttc); |
|
1013 | + $sql .= ', '.(int) $product_type; |
|
1014 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1015 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1016 | + $sql .= ', '.(int) $info_bits; |
|
1017 | + $sql .= ', '.(int) $special_code; |
|
1018 | + $sql .= ', '.(int) $rang; |
|
1019 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1020 | + $sql .= ', '.(int) $user; |
|
1021 | + $sql .= ', '.(int) $this->fk_multicurrency; |
|
1022 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
|
1023 | + $sql .= ', '.price2num($pu_ht_devise, 'CU'); |
|
1024 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT'); |
|
1025 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT'); |
|
1026 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT'); |
|
1027 | 1027 | $sql .= ')'; |
1028 | 1028 | |
1029 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG); |
|
1029 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG); |
|
1030 | 1030 | if ($this->db->query($sql)) { |
1031 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec'); |
|
1031 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec'); |
|
1032 | 1032 | $this->update_price(); |
1033 | 1033 | $this->id = $facid; |
1034 | 1034 | $this->db->commit(); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | $facid = $this->id; |
1081 | 1081 | |
1082 | - 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); |
|
1082 | + 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); |
|
1083 | 1083 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
1084 | 1084 | |
1085 | 1085 | // Check parameters |
@@ -1150,41 +1150,41 @@ discard block |
||
1150 | 1150 | $product_type = $product->type; |
1151 | 1151 | } |
1152 | 1152 | |
1153 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
1154 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
1155 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1156 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
1157 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
1158 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
1159 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
1160 | - $sql .= ', qty = ' . price2num($qty); |
|
1161 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
1162 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
1163 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
1164 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
1165 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
1166 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
1167 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
1168 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
1169 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
1170 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
1171 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
1172 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
1173 | - $sql .= ', product_type = ' . (int) $product_type; |
|
1174 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
1175 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
1176 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
1177 | - $sql .= ', special_code = ' . (int) $special_code; |
|
1178 | - $sql .= ', rang = ' . (int) $rang; |
|
1179 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
1180 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
1153 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
1154 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
1155 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1156 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
1157 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
1158 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
1159 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
1160 | + $sql .= ', qty = '.price2num($qty); |
|
1161 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
1162 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
1163 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
1164 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
1165 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
1166 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
1167 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
1168 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
1169 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
1170 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
1171 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
1172 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
1173 | + $sql .= ', product_type = '.(int) $product_type; |
|
1174 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
1175 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
1176 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
1177 | + $sql .= ', special_code = '.(int) $special_code; |
|
1178 | + $sql .= ', rang = '.(int) $rang; |
|
1179 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
1180 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
1181 | 1181 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
1182 | 1182 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
1183 | 1183 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
1184 | 1184 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
1185 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
1185 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
1186 | 1186 | |
1187 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
1187 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
1188 | 1188 | if ($this->db->query($sql)) { |
1189 | 1189 | $this->id = $facid; |
1190 | 1190 | $this->update_price(); |
@@ -1273,16 +1273,16 @@ discard block |
||
1273 | 1273 | $tmparray = dol_getdate($now); |
1274 | 1274 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
1275 | 1275 | |
1276 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
1276 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
1277 | 1277 | |
1278 | 1278 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
1279 | 1279 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
1280 | 1280 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
1281 | 1281 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
1282 | 1282 | $sql .= ' AND suspended = 0'; |
1283 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
1283 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
1284 | 1284 | if ($restrictioninvoiceid > 0) { |
1285 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
1285 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
1286 | 1286 | } |
1287 | 1287 | $sql .= $this->db->order('entity', 'ASC'); |
1288 | 1288 | //print $sql;exit; |
@@ -1320,14 +1320,14 @@ discard block |
||
1320 | 1320 | // Set entity context |
1321 | 1321 | $conf->entity = $facturerec->entity; |
1322 | 1322 | |
1323 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
1323 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
1324 | 1324 | |
1325 | 1325 | $new_fac_fourn = new FactureFournisseur($this->db); |
1326 | 1326 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
1327 | 1327 | $new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice |
1328 | 1328 | |
1329 | 1329 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1330 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1330 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1331 | 1331 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1332 | 1332 | $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. |
1333 | 1333 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1337 | 1337 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1338 | 1338 | $new_fac_fourn->label = $facturerec->label; |
1339 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1339 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1340 | 1340 | |
1341 | 1341 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1342 | 1342 | if ($invoiceidgenerated <= 0) { |
@@ -1365,22 +1365,22 @@ discard block |
||
1365 | 1365 | } |
1366 | 1366 | } else { |
1367 | 1367 | $error++; |
1368 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
1369 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
1370 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
1368 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
1369 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
1370 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | if (!$error && $invoiceidgenerated >= 0) { |
1374 | 1374 | $facturerec->nb_gen_done++; |
1375 | 1375 | $facturerec->date_last_gen = dol_now(); |
1376 | - $facturerec->date_when= $facturerec->getNextDate(); |
|
1376 | + $facturerec->date_when = $facturerec->getNextDate(); |
|
1377 | 1377 | $facturerec->update($user); |
1378 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1379 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->titre. ' is finished with a success generation'); |
|
1378 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1379 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->titre.' is finished with a success generation'); |
|
1380 | 1380 | $nb_create++; |
1381 | 1381 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->titre)."\n"; |
1382 | 1382 | } else { |
1383 | - $this->db->rollback('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1383 | + $this->db->rollback('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | $parameters = array( |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | } |
1474 | 1474 | $result .= $linkend; |
1475 | 1475 | global $action; |
1476 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1476 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1477 | 1477 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
1478 | 1478 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1479 | 1479 | if ($reshook > 0) { |
@@ -1652,8 +1652,8 @@ discard block |
||
1652 | 1652 | $prodids = array(); |
1653 | 1653 | |
1654 | 1654 | $sql = 'SELECT rowid'; |
1655 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
1656 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
1655 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
1656 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
1657 | 1657 | $sql .= $this->db->plimit(100); |
1658 | 1658 | |
1659 | 1659 | $resql = $this->db->query($sql); |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | $xnbp = 0; |
1693 | 1693 | while ($xnbp < $nbp) { |
1694 | 1694 | $line = new FactureLigne($this->db); |
1695 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
1695 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
1696 | 1696 | $line->qty = 1; |
1697 | 1697 | $line->subprice = 100; |
1698 | 1698 | $line->tva_tx = 19.6; |
@@ -1740,7 +1740,7 @@ discard block |
||
1740 | 1740 | |
1741 | 1741 | // Add a line "offered" |
1742 | 1742 | $line = new FactureLigne($this->db); |
1743 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
1743 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
1744 | 1744 | $line->qty = 1; |
1745 | 1745 | $line->subprice = 100; |
1746 | 1746 | $line->tva_tx = 19.6; |
@@ -1787,12 +1787,12 @@ discard block |
||
1787 | 1787 | public function setFrequencyAndUnit($frequency, $unit) |
1788 | 1788 | { |
1789 | 1789 | if (!$this->table_element) { |
1790 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1790 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1791 | 1791 | return -1; |
1792 | 1792 | } |
1793 | 1793 | |
1794 | 1794 | if (!empty($frequency) && empty($unit)) { |
1795 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1795 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1796 | 1796 | return -2; |
1797 | 1797 | } |
1798 | 1798 | |
@@ -1831,11 +1831,11 @@ discard block |
||
1831 | 1831 | return -1; |
1832 | 1832 | } |
1833 | 1833 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1834 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1834 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1835 | 1835 | if ($increment_nb_gen_done > 0) { |
1836 | 1836 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
1837 | 1837 | } |
1838 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1838 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1839 | 1839 | |
1840 | 1840 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
1841 | 1841 | |
@@ -1869,8 +1869,8 @@ discard block |
||
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1872 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
1873 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1872 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
1873 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1874 | 1874 | |
1875 | 1875 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
1876 | 1876 | |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | |
1899 | 1899 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1900 | 1900 | $sql .= " SET auto_validate = ".((int) $validate); |
1901 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1901 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1902 | 1902 | |
1903 | 1903 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
1904 | 1904 | |
@@ -1925,8 +1925,8 @@ discard block |
||
1925 | 1925 | } |
1926 | 1926 | |
1927 | 1927 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1928 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
1929 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1928 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
1929 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1930 | 1930 | |
1931 | 1931 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
1932 | 1932 | |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | |
1955 | 1955 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1956 | 1956 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
1957 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1957 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1958 | 1958 | |
1959 | 1959 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
1960 | 1960 | |
@@ -2028,8 +2028,8 @@ discard block |
||
2028 | 2028 | $error = 0; |
2029 | 2029 | $this->db->begin(); |
2030 | 2030 | |
2031 | - if (! $error) { |
|
2032 | - if (! $notrigger) { |
|
2031 | + if (!$error) { |
|
2032 | + if (!$notrigger) { |
|
2033 | 2033 | // Call triggers |
2034 | 2034 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
2035 | 2035 | if ($result < 0) { |
@@ -2039,15 +2039,15 @@ discard block |
||
2039 | 2039 | } |
2040 | 2040 | } |
2041 | 2041 | |
2042 | - if (! $error) { |
|
2042 | + if (!$error) { |
|
2043 | 2043 | $result = $this->deleteExtraFields(); |
2044 | 2044 | if ($result < 0) { |
2045 | 2045 | $error++; |
2046 | 2046 | } |
2047 | 2047 | } |
2048 | 2048 | |
2049 | - if (! $error) { |
|
2050 | - $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
|
2049 | + if (!$error) { |
|
2050 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id; |
|
2051 | 2051 | |
2052 | 2052 | $res = $this->db->query($sql); |
2053 | 2053 | if ($res === false) { |
@@ -2087,7 +2087,7 @@ discard block |
||
2087 | 2087 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
2088 | 2088 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
2089 | 2089 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
2090 | - $sql .= ' WHERE l.rowid = '. (int) $rowid; |
|
2090 | + $sql .= ' WHERE l.rowid = '.(int) $rowid; |
|
2091 | 2091 | $sql .= ' ORDER BY l.rang'; |
2092 | 2092 | |
2093 | 2093 | dol_syslog('FactureRec::fetch', LOG_DEBUG); |
@@ -2159,44 +2159,44 @@ discard block |
||
2159 | 2159 | |
2160 | 2160 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
2161 | 2161 | |
2162 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
2163 | - $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; |
|
2164 | - $sql .= ', fk_parent_line = ' . (int) $this->fk_parent; |
|
2165 | - $sql .= ', fk_product = ' . (int) $this->fk_product; |
|
2166 | - $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); |
|
2167 | - $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); |
|
2168 | - $sql .= ", description = '" . $this->db->escape($this->description) . "'"; |
|
2169 | - $sql .= ', pu_ht = ' . price2num($this->pu_ht); |
|
2170 | - $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); |
|
2171 | - $sql .= ', qty = ' . price2num($this->qty); |
|
2172 | - $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'"; |
|
2173 | - $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except; |
|
2174 | - $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'"; |
|
2175 | - $sql .= ', tva_tx = ' . price2num($this->tva_tx); |
|
2176 | - $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx); |
|
2177 | - $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'"; |
|
2178 | - $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx); |
|
2179 | - $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'"; |
|
2162 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
2163 | + $sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn; |
|
2164 | + $sql .= ', fk_parent_line = '.(int) $this->fk_parent; |
|
2165 | + $sql .= ', fk_product = '.(int) $this->fk_product; |
|
2166 | + $sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL'); |
|
2167 | + $sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL'); |
|
2168 | + $sql .= ", description = '".$this->db->escape($this->description)."'"; |
|
2169 | + $sql .= ', pu_ht = '.price2num($this->pu_ht); |
|
2170 | + $sql .= ', pu_ttc = '.price2num($this->pu_ttc); |
|
2171 | + $sql .= ', qty = '.price2num($this->qty); |
|
2172 | + $sql .= ", remise_percent = '".price2num($this->remise_percent)."'"; |
|
2173 | + $sql .= ', fk_remise_except = '.(int) $this->fk_remise_except; |
|
2174 | + $sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'"; |
|
2175 | + $sql .= ', tva_tx = '.price2num($this->tva_tx); |
|
2176 | + $sql .= ', localtax1_tx = '.price2num($this->localtax1_tx); |
|
2177 | + $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'"; |
|
2178 | + $sql .= ', localtax2_tx = '.price2num($this->localtax2_tx); |
|
2179 | + $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'"; |
|
2180 | 2180 | if (empty($this->skip_update_total)) { |
2181 | - $sql .= ', total_ht = ' . price2num($this->total_ht); |
|
2182 | - $sql .= ', total_tva = ' . price2num($this->total_tva); |
|
2183 | - $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1); |
|
2184 | - $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2); |
|
2185 | - $sql .= ', total_ttc = ' . price2num($this->total_ttc); |
|
2181 | + $sql .= ', total_ht = '.price2num($this->total_ht); |
|
2182 | + $sql .= ', total_tva = '.price2num($this->total_tva); |
|
2183 | + $sql .= ', total_localtax1 = '.price2num($this->total_localtax1); |
|
2184 | + $sql .= ', total_localtax2 = '.price2num($this->total_localtax2); |
|
2185 | + $sql .= ', total_ttc = '.price2num($this->total_ttc); |
|
2186 | 2186 | } |
2187 | - $sql .= ', product_type = ' . (int) $this->product_type; |
|
2188 | - $sql .= ', date_start = ' . (int) $this->date_start; |
|
2189 | - $sql .= ', date_end = ' . (int) $this->date_end; |
|
2190 | - $sql .= ", info_bits = " . ((int) $this->info_bits); |
|
2191 | - $sql .= ', special_code =' . (int) $this->special_code; |
|
2192 | - $sql .= ', rang = ' . (int) $this->rang; |
|
2193 | - $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2194 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
2195 | - $sql .= ' WHERE rowid = ' . (int) $this->id; |
|
2187 | + $sql .= ', product_type = '.(int) $this->product_type; |
|
2188 | + $sql .= ', date_start = '.(int) $this->date_start; |
|
2189 | + $sql .= ', date_end = '.(int) $this->date_end; |
|
2190 | + $sql .= ", info_bits = ".((int) $this->info_bits); |
|
2191 | + $sql .= ', special_code ='.(int) $this->special_code; |
|
2192 | + $sql .= ', rang = '.(int) $this->rang; |
|
2193 | + $sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2194 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
2195 | + $sql .= ' WHERE rowid = '.(int) $this->id; |
|
2196 | 2196 | |
2197 | 2197 | $this->db->begin(); |
2198 | 2198 | |
2199 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
2199 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
2200 | 2200 | $resql = $this->db->query($sql); |
2201 | 2201 | if ($resql) { |
2202 | 2202 | if (!$error) { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | case 'sellist': |
49 | 49 | $tmp = ''; |
50 | 50 | $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
51 | - if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
51 | + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
52 | 52 | $tmpkeys = array_keys($tmpparam['options']); |
53 | 53 | $tmp = array_shift($tmpkeys); |
54 | 54 | } |