@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | if ($contactid > 0) { |
218 | 218 | $contact = new Contact($this->db); |
219 | 219 | $res = $contact->fetch($contactid); |
220 | - if (! in_array($contact, $linked_contacts)) { |
|
221 | - $error_msg = $langs->trans('Error'). ': '; |
|
220 | + if (!in_array($contact, $linked_contacts)) { |
|
221 | + $error_msg = $langs->trans('Error').': '; |
|
222 | 222 | $error_msg .= $langs->transnoentities('TicketWrongContact'); |
223 | 223 | setEventMessages($error_msg, [], 'errors'); |
224 | 224 | $ok = 0; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $sendto = ''; |
230 | 230 | if ($res > 0 && !empty($contact->email) && !empty($contact->statut)) { |
231 | 231 | $sendto = $contact->email; |
232 | - } elseif ( !empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) { |
|
232 | + } elseif (!empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) { |
|
233 | 233 | // if sending to all contacts or sending to contacts while mass closing |
234 | 234 | $temp_emails = []; |
235 | 235 | foreach ($linked_contacts as $contact) { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | if ($qualified) { |
370 | - $message_customer .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>'; |
|
370 | + $message_customer .= '<li>'.$langs->trans($key).' : '.$value.'</li>'; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
@@ -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; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php'; |
89 | 89 | |
90 | -call_user_func(function () { |
|
90 | +call_user_func(function() { |
|
91 | 91 | $loader = Luracast\Restler\AutoLoader::instance(); |
92 | 92 | spl_autoload_register($loader); |
93 | 93 | return $loader; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log" |
162 | 162 | if (!empty($conf->global->MAIN_API_DEBUG)) { |
163 | 163 | $r = $api->r; |
164 | - $r->onCall(function () use ($r) { |
|
164 | + $r->onCall(function() use ($r) { |
|
165 | 165 | // Don't log Luracast Restler Explorer recources calls |
166 | 166 | //if (!preg_match('/^explorer/', $r->url)) { |
167 | 167 | // 'method' => $api->r->requestMethod, |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | } |
345 | 345 | } |
346 | 346 | |
347 | - if (! $endpointisallowed) { |
|
347 | + if (!$endpointisallowed) { |
|
348 | 348 | dol_syslog('The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES', LOG_WARNING); |
349 | 349 | print 'The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES'; |
350 | 350 | header('HTTP/1.1 501 API is forbidden by API_ENDPOINT_RULES'); |
@@ -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(); |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | |
1079 | 1079 | $facid = $this->id; |
1080 | 1080 | |
1081 | - 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, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
1081 | + 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, fk_remise_except=$fk_remise_except, 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 | 1082 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
1083 | 1083 | |
1084 | 1084 | // Check parameters |
@@ -1149,41 +1149,41 @@ discard block |
||
1149 | 1149 | $product_type = $product->type; |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
1153 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
1154 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1155 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
1156 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
1157 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
1158 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
1159 | - $sql .= ', qty = ' . price2num($qty); |
|
1160 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
1161 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
1162 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
1163 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
1164 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
1165 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
1166 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
1167 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
1168 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
1169 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
1170 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
1171 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
1172 | - $sql .= ', product_type = ' . (int) $product_type; |
|
1173 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
1174 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
1175 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
1176 | - $sql .= ', special_code = ' . (int) $special_code; |
|
1177 | - $sql .= ', rang = ' . (int) $rang; |
|
1178 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
1179 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
1152 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
1153 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
1154 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1155 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
1156 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
1157 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
1158 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
1159 | + $sql .= ', qty = '.price2num($qty); |
|
1160 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
1161 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
1162 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
1163 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
1164 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
1165 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
1166 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
1167 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
1168 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
1169 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
1170 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
1171 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
1172 | + $sql .= ', product_type = '.(int) $product_type; |
|
1173 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
1174 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
1175 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
1176 | + $sql .= ', special_code = '.(int) $special_code; |
|
1177 | + $sql .= ', rang = '.(int) $rang; |
|
1178 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
1179 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
1180 | 1180 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
1181 | 1181 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
1182 | 1182 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
1183 | 1183 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
1184 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
1184 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
1185 | 1185 | |
1186 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
1186 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
1187 | 1187 | if ($this->db->query($sql)) { |
1188 | 1188 | $this->id = $facid; |
1189 | 1189 | $this->update_price(); |
@@ -1272,16 +1272,16 @@ discard block |
||
1272 | 1272 | $tmparray = dol_getdate($now); |
1273 | 1273 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
1274 | 1274 | |
1275 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
1275 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
1276 | 1276 | |
1277 | 1277 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
1278 | 1278 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
1279 | 1279 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
1280 | 1280 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
1281 | 1281 | $sql .= ' AND suspended = 0'; |
1282 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
1282 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
1283 | 1283 | if ($restrictioninvoiceid > 0) { |
1284 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
1284 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
1285 | 1285 | } |
1286 | 1286 | $sql .= $this->db->order('entity', 'ASC'); |
1287 | 1287 | //print $sql;exit; |
@@ -1319,14 +1319,14 @@ discard block |
||
1319 | 1319 | // Set entity context |
1320 | 1320 | $conf->entity = $facturerec->entity; |
1321 | 1321 | |
1322 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
1322 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
1323 | 1323 | |
1324 | 1324 | $new_fac_fourn = new FactureFournisseur($this->db); |
1325 | 1325 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
1326 | 1326 | $new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice |
1327 | 1327 | |
1328 | 1328 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1329 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1329 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1330 | 1330 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1331 | 1331 | $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. |
1332 | 1332 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1336 | 1336 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1337 | 1337 | $new_fac_fourn->label = $facturerec->label; |
1338 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1338 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1339 | 1339 | |
1340 | 1340 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1341 | 1341 | if ($invoiceidgenerated <= 0) { |
@@ -1364,22 +1364,22 @@ discard block |
||
1364 | 1364 | } |
1365 | 1365 | } else { |
1366 | 1366 | $error++; |
1367 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
1368 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
1369 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
1367 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
1368 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
1369 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | if (!$error && $invoiceidgenerated >= 0) { |
1373 | 1373 | $facturerec->nb_gen_done++; |
1374 | 1374 | $facturerec->date_last_gen = dol_now(); |
1375 | - $facturerec->date_when= $facturerec->getNextDate(); |
|
1375 | + $facturerec->date_when = $facturerec->getNextDate(); |
|
1376 | 1376 | $facturerec->update($user); |
1377 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1378 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->titre. ' is finished with a success generation'); |
|
1377 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1378 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->titre.' is finished with a success generation'); |
|
1379 | 1379 | $nb_create++; |
1380 | 1380 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->titre)."\n"; |
1381 | 1381 | } else { |
1382 | - $this->db->rollback('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1382 | + $this->db->rollback('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1383 | 1383 | } |
1384 | 1384 | |
1385 | 1385 | $parameters = array( |
@@ -1472,7 +1472,7 @@ discard block |
||
1472 | 1472 | } |
1473 | 1473 | $result .= $linkend; |
1474 | 1474 | global $action; |
1475 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1475 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1476 | 1476 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
1477 | 1477 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1478 | 1478 | if ($reshook > 0) { |
@@ -1651,8 +1651,8 @@ discard block |
||
1651 | 1651 | $prodids = array(); |
1652 | 1652 | |
1653 | 1653 | $sql = 'SELECT rowid'; |
1654 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
1655 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
1654 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
1655 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
1656 | 1656 | $sql .= $this->db->plimit(100); |
1657 | 1657 | |
1658 | 1658 | $resql = $this->db->query($sql); |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | $xnbp = 0; |
1692 | 1692 | while ($xnbp < $nbp) { |
1693 | 1693 | $line = new FactureLigne($this->db); |
1694 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
1694 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
1695 | 1695 | $line->qty = 1; |
1696 | 1696 | $line->subprice = 100; |
1697 | 1697 | $line->tva_tx = 19.6; |
@@ -1739,7 +1739,7 @@ discard block |
||
1739 | 1739 | |
1740 | 1740 | // Add a line "offered" |
1741 | 1741 | $line = new FactureLigne($this->db); |
1742 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
1742 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
1743 | 1743 | $line->qty = 1; |
1744 | 1744 | $line->subprice = 100; |
1745 | 1745 | $line->tva_tx = 19.6; |
@@ -1786,12 +1786,12 @@ discard block |
||
1786 | 1786 | public function setFrequencyAndUnit($frequency, $unit) |
1787 | 1787 | { |
1788 | 1788 | if (!$this->table_element) { |
1789 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1789 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1790 | 1790 | return -1; |
1791 | 1791 | } |
1792 | 1792 | |
1793 | 1793 | if (!empty($frequency) && empty($unit)) { |
1794 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1794 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1795 | 1795 | return -2; |
1796 | 1796 | } |
1797 | 1797 | |
@@ -1830,11 +1830,11 @@ discard block |
||
1830 | 1830 | return -1; |
1831 | 1831 | } |
1832 | 1832 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1833 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1833 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1834 | 1834 | if ($increment_nb_gen_done > 0) { |
1835 | 1835 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
1836 | 1836 | } |
1837 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1837 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1838 | 1838 | |
1839 | 1839 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
1840 | 1840 | |
@@ -1868,8 +1868,8 @@ discard block |
||
1868 | 1868 | } |
1869 | 1869 | |
1870 | 1870 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1871 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
1872 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1871 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
1872 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1873 | 1873 | |
1874 | 1874 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
1875 | 1875 | |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | |
1898 | 1898 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1899 | 1899 | $sql .= " SET auto_validate = ".((int) $validate); |
1900 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1900 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1901 | 1901 | |
1902 | 1902 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
1903 | 1903 | |
@@ -1924,8 +1924,8 @@ discard block |
||
1924 | 1924 | } |
1925 | 1925 | |
1926 | 1926 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1927 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
1928 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1927 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
1928 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1929 | 1929 | |
1930 | 1930 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
1931 | 1931 | |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | |
1954 | 1954 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1955 | 1955 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
1956 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1956 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1957 | 1957 | |
1958 | 1958 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
1959 | 1959 | |
@@ -2027,8 +2027,8 @@ discard block |
||
2027 | 2027 | $error = 0; |
2028 | 2028 | $this->db->begin(); |
2029 | 2029 | |
2030 | - if (! $error) { |
|
2031 | - if (! $notrigger) { |
|
2030 | + if (!$error) { |
|
2031 | + if (!$notrigger) { |
|
2032 | 2032 | // Call triggers |
2033 | 2033 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
2034 | 2034 | if ($result < 0) { |
@@ -2038,15 +2038,15 @@ discard block |
||
2038 | 2038 | } |
2039 | 2039 | } |
2040 | 2040 | |
2041 | - if (! $error) { |
|
2041 | + if (!$error) { |
|
2042 | 2042 | $result = $this->deleteExtraFields(); |
2043 | 2043 | if ($result < 0) { |
2044 | 2044 | $error++; |
2045 | 2045 | } |
2046 | 2046 | } |
2047 | 2047 | |
2048 | - if (! $error) { |
|
2049 | - $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
|
2048 | + if (!$error) { |
|
2049 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id; |
|
2050 | 2050 | |
2051 | 2051 | $res = $this->db->query($sql); |
2052 | 2052 | if ($res === false) { |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
2087 | 2087 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
2088 | 2088 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
2089 | - $sql .= ' WHERE l.rowid = '. (int) $rowid; |
|
2089 | + $sql .= ' WHERE l.rowid = '.(int) $rowid; |
|
2090 | 2090 | $sql .= ' ORDER BY l.rang'; |
2091 | 2091 | |
2092 | 2092 | dol_syslog('FactureRec::fetch', LOG_DEBUG); |
@@ -2158,44 +2158,44 @@ discard block |
||
2158 | 2158 | |
2159 | 2159 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
2160 | 2160 | |
2161 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
2162 | - $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; |
|
2163 | - $sql .= ', fk_parent_line = ' . (int) $this->fk_parent; |
|
2164 | - $sql .= ', fk_product = ' . (int) $this->fk_product; |
|
2165 | - $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); |
|
2166 | - $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); |
|
2167 | - $sql .= ", description = '" . $this->db->escape($this->description) . "'"; |
|
2168 | - $sql .= ', pu_ht = ' . price2num($this->pu_ht); |
|
2169 | - $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); |
|
2170 | - $sql .= ', qty = ' . price2num($this->qty); |
|
2171 | - $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'"; |
|
2172 | - $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except; |
|
2173 | - $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'"; |
|
2174 | - $sql .= ', tva_tx = ' . price2num($this->tva_tx); |
|
2175 | - $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx); |
|
2176 | - $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'"; |
|
2177 | - $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx); |
|
2178 | - $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'"; |
|
2161 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
2162 | + $sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn; |
|
2163 | + $sql .= ', fk_parent_line = '.(int) $this->fk_parent; |
|
2164 | + $sql .= ', fk_product = '.(int) $this->fk_product; |
|
2165 | + $sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL'); |
|
2166 | + $sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL'); |
|
2167 | + $sql .= ", description = '".$this->db->escape($this->description)."'"; |
|
2168 | + $sql .= ', pu_ht = '.price2num($this->pu_ht); |
|
2169 | + $sql .= ', pu_ttc = '.price2num($this->pu_ttc); |
|
2170 | + $sql .= ', qty = '.price2num($this->qty); |
|
2171 | + $sql .= ", remise_percent = '".price2num($this->remise_percent)."'"; |
|
2172 | + $sql .= ', fk_remise_except = '.(int) $this->fk_remise_except; |
|
2173 | + $sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'"; |
|
2174 | + $sql .= ', tva_tx = '.price2num($this->tva_tx); |
|
2175 | + $sql .= ', localtax1_tx = '.price2num($this->localtax1_tx); |
|
2176 | + $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'"; |
|
2177 | + $sql .= ', localtax2_tx = '.price2num($this->localtax2_tx); |
|
2178 | + $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'"; |
|
2179 | 2179 | if (empty($this->skip_update_total)) { |
2180 | - $sql .= ', total_ht = ' . price2num($this->total_ht); |
|
2181 | - $sql .= ', total_tva = ' . price2num($this->total_tva); |
|
2182 | - $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1); |
|
2183 | - $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2); |
|
2184 | - $sql .= ', total_ttc = ' . price2num($this->total_ttc); |
|
2180 | + $sql .= ', total_ht = '.price2num($this->total_ht); |
|
2181 | + $sql .= ', total_tva = '.price2num($this->total_tva); |
|
2182 | + $sql .= ', total_localtax1 = '.price2num($this->total_localtax1); |
|
2183 | + $sql .= ', total_localtax2 = '.price2num($this->total_localtax2); |
|
2184 | + $sql .= ', total_ttc = '.price2num($this->total_ttc); |
|
2185 | 2185 | } |
2186 | - $sql .= ', product_type = ' . (int) $this->product_type; |
|
2187 | - $sql .= ', date_start = ' . (int) $this->date_start; |
|
2188 | - $sql .= ', date_end = ' . (int) $this->date_end; |
|
2189 | - $sql .= ", info_bits = " . ((int) $this->info_bits); |
|
2190 | - $sql .= ', special_code =' . (int) $this->special_code; |
|
2191 | - $sql .= ', rang = ' . (int) $this->rang; |
|
2192 | - $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2193 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
2194 | - $sql .= ' WHERE rowid = ' . (int) $this->id; |
|
2186 | + $sql .= ', product_type = '.(int) $this->product_type; |
|
2187 | + $sql .= ', date_start = '.(int) $this->date_start; |
|
2188 | + $sql .= ', date_end = '.(int) $this->date_end; |
|
2189 | + $sql .= ", info_bits = ".((int) $this->info_bits); |
|
2190 | + $sql .= ', special_code ='.(int) $this->special_code; |
|
2191 | + $sql .= ', rang = '.(int) $this->rang; |
|
2192 | + $sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2193 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
2194 | + $sql .= ' WHERE rowid = '.(int) $this->id; |
|
2195 | 2195 | |
2196 | 2196 | $this->db->begin(); |
2197 | 2197 | |
2198 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
2198 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
2199 | 2199 | $resql = $this->db->query($sql); |
2200 | 2200 | if ($resql) { |
2201 | 2201 | if (!$error) { |
@@ -1204,8 +1204,11 @@ discard block |
||
1204 | 1204 | $this->fk_facture_source = trim($this->fk_facture_source); |
1205 | 1205 | } |
1206 | 1206 | if (isset($this->fk_project)) { |
1207 | - if (empty($this->fk_project)) $this->fk_project = null; |
|
1208 | - else $this->fk_project = intval($this->fk_project); |
|
1207 | + if (empty($this->fk_project)) { |
|
1208 | + $this->fk_project = null; |
|
1209 | + } else { |
|
1210 | + $this->fk_project = intval($this->fk_project); |
|
1211 | + } |
|
1209 | 1212 | } |
1210 | 1213 | if (isset($this->cond_reglement_id)) { |
1211 | 1214 | $this->cond_reglement_id = trim($this->cond_reglement_id); |
@@ -3654,8 +3657,11 @@ discard block |
||
3654 | 3657 | $sql .= ", pu_ttc = ".price2num($this->pu_ttc); |
3655 | 3658 | $sql .= ", qty = ".price2num($this->qty); |
3656 | 3659 | $sql .= ", remise_percent = ".price2num($this->remise_percent); |
3657 | - if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3658 | - else $sql .= ", fk_remise_except=null"; |
|
3660 | + if ($this->fk_remise_except > 0) { |
|
3661 | + $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3662 | + } else { |
|
3663 | + $sql .= ", fk_remise_except=null"; |
|
3664 | + } |
|
3659 | 3665 | $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; |
3660 | 3666 | $sql .= ", tva_tx = ".price2num($this->tva_tx); |
3661 | 3667 | $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | /** |
231 | 231 | * @var int ID |
232 | 232 | */ |
233 | - public $fk_account; // default bank account |
|
233 | + public $fk_account; // default bank account |
|
234 | 234 | |
235 | 235 | public $mode_reglement_id; |
236 | 236 | public $mode_reglement_code; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | if ($this->fac_rec > 0) { |
436 | 436 | $this->fk_fac_rec_source = $this->fac_rec; |
437 | 437 | |
438 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php'; |
|
438 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php'; |
|
439 | 439 | $_facrec = new FactureFournisseurRec($this->db); |
440 | 440 | $result = $_facrec->fetch($this->fac_rec); |
441 | 441 | $result = $_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | $this->location_incoterms = $_facrec->location_incoterms; |
470 | 470 | |
471 | 471 | // Clean parameters |
472 | - if (! $this->type) { |
|
472 | + if (!$this->type) { |
|
473 | 473 | $this->type = self::TYPE_STANDARD; |
474 | 474 | } |
475 | 475 | if (!empty(GETPOST('ref_supplier'))) { |
476 | 476 | $this->ref_supplier = trim($this->ref_supplier); |
477 | 477 | } else { |
478 | - $this->ref_supplier = trim($this->ref_supplier . '_' . ($_facrec->nb_gen_done + 1)); |
|
478 | + $this->ref_supplier = trim($this->ref_supplier.'_'.($_facrec->nb_gen_done + 1)); |
|
479 | 479 | } |
480 | 480 | $this->note_public = trim($this->note_public); |
481 | 481 | $this->note_private = trim($this->note_private); |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | |
484 | 484 | $this->array_options = $_facrec->array_options; |
485 | 485 | |
486 | - if (! $this->mode_reglement_id) { |
|
486 | + if (!$this->mode_reglement_id) { |
|
487 | 487 | $this->mode_reglement_id = 0; |
488 | 488 | } |
489 | 489 | $this->status = self::STATUS_DRAFT; |
490 | - $this->statut = self::STATUS_DRAFT; // deprecated |
|
490 | + $this->statut = self::STATUS_DRAFT; // deprecated |
|
491 | 491 | |
492 | 492 | $this->linked_objects = $_facrec->linkedObjectsIds; |
493 | 493 | // We do not add link to template invoice or next invoice will be linked to all generated invoices |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | /* |
735 | 735 | * Insert lines of template invoices |
736 | 736 | */ |
737 | - if (! $error && $this->fac_rec > 0) { |
|
737 | + if (!$error && $this->fac_rec > 0) { |
|
738 | 738 | foreach ($_facrec->lines as $i => $val) { |
739 | 739 | if ($_facrec->lines[$i]->fk_product) { |
740 | 740 | $prod = new Product($this->db); |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $localtax1_tx=get_localtax($tva_tx,1,$soc,$mysoc,$tva_npr); |
750 | 750 | $localtax2_tx=get_localtax($tva_tx,2,$soc,$mysoc,$tva_npr); |
751 | 751 | */ |
752 | - $tva_tx = $_facrec->lines[$i]->tva_tx . ($_facrec->lines[$i]->vat_src_code ? '(' . $_facrec->lines[$i]->vat_src_code . ')' : ''); |
|
752 | + $tva_tx = $_facrec->lines[$i]->tva_tx.($_facrec->lines[$i]->vat_src_code ? '('.$_facrec->lines[$i]->vat_src_code.')' : ''); |
|
753 | 753 | $tva_npr = $_facrec->lines[$i]->info_bits; |
754 | 754 | if (empty($tva_tx)) { |
755 | 755 | $tva_npr = 0; |
@@ -761,8 +761,8 @@ discard block |
||
761 | 761 | $buyprice = empty($_facrec->lines[$i]->buyprice) ? 0 : $_facrec->lines[$i]->buyprice; |
762 | 762 | |
763 | 763 | // If buyprice not defined from template invoice, we try to guess the best value |
764 | - if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
765 | - require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; |
|
764 | + if (!$buyprice && $_facrec->lines[$i]->fk_product > 0) { |
|
765 | + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; |
|
766 | 766 | $producttmp = new ProductFournisseur($this->db); |
767 | 767 | $producttmp->fetch($_facrec->lines[$i]->fk_product); |
768 | 768 | |
@@ -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->fk_user_author = $obj->fk_user_author; |
973 | 973 | $this->author = $obj->fk_user_author; |
974 | 974 | $this->fk_user_valid = $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; |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | $line->localtax2_tx = $obj->localtax2_tx; |
1092 | 1092 | $line->localtax1_type = $obj->localtax1_type; |
1093 | 1093 | $line->localtax2_type = $obj->localtax2_type; |
1094 | - $line->qty = $obj->qty; |
|
1094 | + $line->qty = $obj->qty; |
|
1095 | 1095 | $line->remise_percent = $obj->remise_percent; |
1096 | 1096 | $line->fk_remise_except = $obj->fk_remise_except; |
1097 | 1097 | //$line->tva = $obj->total_tva; // deprecated |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | $facligne->rang = 1; |
1373 | 1373 | $linecount = count($this->lines); |
1374 | 1374 | for ($ii = 1; $ii <= $linecount; $ii++) { |
1375 | - $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii+1); |
|
1375 | + $this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1); |
|
1376 | 1376 | } |
1377 | 1377 | } |
1378 | 1378 | |
@@ -2679,7 +2679,7 @@ discard block |
||
2679 | 2679 | |
2680 | 2680 | while ($obj = $this->db->fetch_object($resql)) { |
2681 | 2681 | $facturestatic->date_echeance = $this->db->jdate($obj->datefin); |
2682 | - $facturestatic->statut = $obj->status; // For backward compatibility |
|
2682 | + $facturestatic->statut = $obj->status; // For backward compatibility |
|
2683 | 2683 | $facturestatic->status = $obj->status; |
2684 | 2684 | |
2685 | 2685 | $response->nbtodo++; |
@@ -2861,7 +2861,7 @@ discard block |
||
2861 | 2861 | $label = $langs->trans("ShowSupplierInvoice"); |
2862 | 2862 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
2863 | 2863 | } |
2864 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2864 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2865 | 2865 | $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; |
2866 | 2866 | } |
2867 | 2867 | |
@@ -2890,7 +2890,7 @@ discard block |
||
2890 | 2890 | } |
2891 | 2891 | } |
2892 | 2892 | global $action; |
2893 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
2893 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
2894 | 2894 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
2895 | 2895 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
2896 | 2896 | if ($reshook > 0) { |
@@ -3112,7 +3112,7 @@ discard block |
||
3112 | 3112 | // Load source object |
3113 | 3113 | $object->fetch($fromid); |
3114 | 3114 | $object->id = 0; |
3115 | - $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3115 | + $object->statut = self::STATUS_DRAFT; // For backward compatibility |
|
3116 | 3116 | $object->status = self::STATUS_DRAFT; |
3117 | 3117 | |
3118 | 3118 | $object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor |
@@ -3660,7 +3660,7 @@ discard block |
||
3660 | 3660 | $this->localtax1_type = $obj->localtax1_type; |
3661 | 3661 | $this->localtax2_type = $obj->localtax2_type; |
3662 | 3662 | |
3663 | - $this->qty = $obj->qty; |
|
3663 | + $this->qty = $obj->qty; |
|
3664 | 3664 | $this->remise_percent = $obj->remise_percent; |
3665 | 3665 | $this->fk_remise_except = $obj->fk_remise_except; |
3666 | 3666 | //$this->tva = $obj->total_tva; // deprecated |