Total Complexity | 126 |
Total Lines | 769 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like InvoiceLine often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use InvoiceLine, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
50 | class InvoiceLine extends CommonInvoiceLine |
||
51 | { |
||
52 | /** |
||
53 | * @var string ID to identify managed object |
||
54 | */ |
||
55 | public $element = 'facturedet'; |
||
56 | |||
57 | /** |
||
58 | * @var string Name of table without prefix where object is stored |
||
59 | */ |
||
60 | public $table_element = 'facturedet'; |
||
61 | |||
62 | /** |
||
63 | * @var FactureLigne |
||
64 | */ |
||
65 | public $oldline; |
||
66 | |||
67 | //! From llx_facturedet |
||
68 | //! Id facture |
||
69 | public $fk_facture; |
||
70 | //! Id parent line |
||
71 | public $fk_parent_line; |
||
72 | |||
73 | //! Description ligne |
||
74 | public $desc; |
||
75 | public $ref_ext; // External reference of the line |
||
76 | |||
77 | public $localtax1_type; // Local tax 1 type |
||
78 | public $localtax2_type; // Local tax 2 type |
||
79 | public $fk_remise_except; // Link to line into llx_remise_except |
||
80 | public $rang = 0; |
||
81 | |||
82 | public $fk_fournprice; |
||
83 | public $pa_ht; |
||
84 | public $marge_tx; |
||
85 | public $marque_tx; |
||
86 | |||
87 | /** |
||
88 | * @var int |
||
89 | */ |
||
90 | public $tva_npr; |
||
91 | |||
92 | public $remise_percent; |
||
93 | |||
94 | /** |
||
95 | * List of special options to define line: |
||
96 | * 1: shipment cost lines |
||
97 | * 2: ecotaxe |
||
98 | * 3: ?? |
||
99 | * idofmodule: a meaning for the module |
||
100 | */ |
||
101 | public $special_code; |
||
102 | |||
103 | /** |
||
104 | * @var string To store the batch to consume in stock when using a POS module |
||
105 | */ |
||
106 | public $batch; |
||
107 | /** |
||
108 | * @var string To store the warehouse where to consume stock when using a POS module |
||
109 | */ |
||
110 | public $fk_warehouse; |
||
111 | |||
112 | |||
113 | public $origin; |
||
114 | public $origin_id; |
||
115 | |||
116 | /** |
||
117 | * @var integer Id in table llx_accounting_bookeeping to know accounting account for product line |
||
118 | */ |
||
119 | public $fk_code_ventilation = 0; |
||
120 | |||
121 | |||
122 | public $date_start; |
||
123 | public $date_end; |
||
124 | |||
125 | public $skip_update_total; // Skip update price total for special lines |
||
126 | |||
127 | /** |
||
128 | * @var int Situation advance percentage |
||
129 | */ |
||
130 | public $situation_percent; |
||
131 | |||
132 | /** |
||
133 | * @var int Previous situation line id reference |
||
134 | */ |
||
135 | public $fk_prev_id; |
||
136 | |||
137 | /** |
||
138 | * Constructor |
||
139 | * |
||
140 | * @param DoliDB $db handler d'acces base de donnee |
||
141 | */ |
||
142 | public function __construct($db) |
||
143 | { |
||
144 | $this->db = $db; |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * Load invoice line from database |
||
149 | * |
||
150 | * @param int $rowid id of invoice line to get |
||
151 | * @return int Return integer <0 if KO, >0 if OK |
||
152 | */ |
||
153 | public function fetch($rowid) |
||
154 | { |
||
155 | $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,'; |
||
156 | $sql .= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice, fd.ref_ext,'; |
||
157 | $sql .= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,'; |
||
158 | $sql .= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,'; |
||
159 | $sql .= ' fd.fk_code_ventilation,'; |
||
160 | $sql .= ' fd.fk_unit, fd.fk_user_author, fd.fk_user_modif,'; |
||
161 | $sql .= ' fd.situation_percent, fd.fk_prev_id,'; |
||
162 | $sql .= ' fd.multicurrency_subprice,'; |
||
163 | $sql .= ' fd.multicurrency_total_ht,'; |
||
164 | $sql .= ' fd.multicurrency_total_tva,'; |
||
165 | $sql .= ' fd.multicurrency_total_ttc,'; |
||
166 | $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc'; |
||
167 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facturedet as fd'; |
||
168 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON fd.fk_product = p.rowid'; |
||
169 | $sql .= ' WHERE fd.rowid = ' . ((int) $rowid); |
||
170 | |||
171 | $result = $this->db->query($sql); |
||
172 | if ($result) { |
||
173 | $objp = $this->db->fetch_object($result); |
||
174 | |||
175 | if (!$objp) { |
||
176 | $this->error = 'InvoiceLine with id ' . $rowid . ' not found sql=' . $sql; |
||
177 | return 0; |
||
178 | } |
||
179 | |||
180 | $this->rowid = $objp->rowid; |
||
|
|||
181 | $this->id = $objp->rowid; |
||
182 | $this->fk_facture = $objp->fk_facture; |
||
183 | $this->fk_parent_line = $objp->fk_parent_line; |
||
184 | $this->label = $objp->custom_label; |
||
185 | $this->desc = $objp->description; |
||
186 | $this->qty = $objp->qty; |
||
187 | $this->subprice = $objp->subprice; |
||
188 | $this->ref_ext = $objp->ref_ext; |
||
189 | $this->vat_src_code = $objp->vat_src_code; |
||
190 | $this->tva_tx = $objp->tva_tx; |
||
191 | $this->localtax1_tx = $objp->localtax1_tx; |
||
192 | $this->localtax2_tx = $objp->localtax2_tx; |
||
193 | $this->remise_percent = $objp->remise_percent; |
||
194 | $this->fk_remise_except = $objp->fk_remise_except; |
||
195 | $this->fk_product = $objp->fk_product; |
||
196 | $this->product_type = $objp->product_type; |
||
197 | $this->date_start = $this->db->jdate($objp->date_start); |
||
198 | $this->date_end = $this->db->jdate($objp->date_end); |
||
199 | $this->info_bits = $objp->info_bits; |
||
200 | $this->tva_npr = (($objp->info_bits & 1) == 1) ? 1 : 0; |
||
201 | $this->special_code = $objp->special_code; |
||
202 | $this->total_ht = $objp->total_ht; |
||
203 | $this->total_tva = $objp->total_tva; |
||
204 | $this->total_localtax1 = $objp->total_localtax1; |
||
205 | $this->total_localtax2 = $objp->total_localtax2; |
||
206 | $this->total_ttc = $objp->total_ttc; |
||
207 | $this->fk_code_ventilation = $objp->fk_code_ventilation; |
||
208 | $this->rang = $objp->rang; |
||
209 | $this->fk_fournprice = $objp->fk_fournprice; |
||
210 | $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht); |
||
211 | $this->pa_ht = $marginInfos[0]; |
||
212 | $this->marge_tx = $marginInfos[1]; |
||
213 | $this->marque_tx = $marginInfos[2]; |
||
214 | |||
215 | $this->ref = $objp->product_ref; // deprecated |
||
216 | |||
217 | $this->product_ref = $objp->product_ref; |
||
218 | $this->product_label = $objp->product_label; |
||
219 | $this->product_desc = $objp->product_desc; |
||
220 | |||
221 | $this->fk_unit = $objp->fk_unit; |
||
222 | $this->fk_user_modif = $objp->fk_user_modif; |
||
223 | $this->fk_user_author = $objp->fk_user_author; |
||
224 | |||
225 | $this->situation_percent = $objp->situation_percent; |
||
226 | $this->fk_prev_id = $objp->fk_prev_id; |
||
227 | |||
228 | $this->multicurrency_subprice = $objp->multicurrency_subprice; |
||
229 | $this->multicurrency_total_ht = $objp->multicurrency_total_ht; |
||
230 | $this->multicurrency_total_tva = $objp->multicurrency_total_tva; |
||
231 | $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; |
||
232 | |||
233 | $this->fetch_optionals(); |
||
234 | |||
235 | $this->db->free($result); |
||
236 | |||
237 | return 1; |
||
238 | } else { |
||
239 | $this->error = $this->db->lasterror(); |
||
240 | return -1; |
||
241 | } |
||
242 | } |
||
243 | |||
244 | /** |
||
245 | * Insert line into database |
||
246 | * |
||
247 | * @param int $notrigger 1 no triggers |
||
248 | * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another |
||
249 | * @return int Return integer <0 if KO, >0 if OK |
||
250 | */ |
||
251 | public function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) |
||
252 | { |
||
253 | global $langs, $user; |
||
254 | |||
255 | $error = 0; |
||
256 | |||
257 | $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'. |
||
258 | |||
259 | dol_syslog(get_class($this) . "::insert rang=" . $this->rang, LOG_DEBUG); |
||
260 | |||
261 | // Clean parameters |
||
262 | $this->desc = trim($this->desc); |
||
263 | if (empty($this->tva_tx)) { |
||
264 | $this->tva_tx = 0; |
||
265 | } |
||
266 | if (empty($this->localtax1_tx)) { |
||
267 | $this->localtax1_tx = 0; |
||
268 | } |
||
269 | if (empty($this->localtax2_tx)) { |
||
270 | $this->localtax2_tx = 0; |
||
271 | } |
||
272 | if (empty($this->localtax1_type)) { |
||
273 | $this->localtax1_type = 0; |
||
274 | } |
||
275 | if (empty($this->localtax2_type)) { |
||
276 | $this->localtax2_type = 0; |
||
277 | } |
||
278 | if (empty($this->total_localtax1)) { |
||
279 | $this->total_localtax1 = 0; |
||
280 | } |
||
281 | if (empty($this->total_localtax2)) { |
||
282 | $this->total_localtax2 = 0; |
||
283 | } |
||
284 | if (empty($this->rang)) { |
||
285 | $this->rang = 0; |
||
286 | } |
||
287 | if (empty($this->remise_percent)) { |
||
288 | $this->remise_percent = 0; |
||
289 | } |
||
290 | if (empty($this->info_bits)) { |
||
291 | $this->info_bits = 0; |
||
292 | } |
||
293 | if (empty($this->subprice)) { |
||
294 | $this->subprice = 0; |
||
295 | } |
||
296 | if (empty($this->ref_ext)) { |
||
297 | $this->ref_ext = ''; |
||
298 | } |
||
299 | if (empty($this->special_code)) { |
||
300 | $this->special_code = 0; |
||
301 | } |
||
302 | if (empty($this->fk_parent_line)) { |
||
303 | $this->fk_parent_line = 0; |
||
304 | } |
||
305 | if (empty($this->fk_prev_id)) { |
||
306 | $this->fk_prev_id = 0; |
||
307 | } |
||
308 | if (!isset($this->situation_percent) || $this->situation_percent > 100 || (string) $this->situation_percent == '') { |
||
309 | $this->situation_percent = 100; |
||
310 | } |
||
311 | |||
312 | if (empty($this->pa_ht)) { |
||
313 | $this->pa_ht = 0; |
||
314 | } |
||
315 | if (empty($this->multicurrency_subprice)) { |
||
316 | $this->multicurrency_subprice = 0; |
||
317 | } |
||
318 | if (empty($this->multicurrency_total_ht)) { |
||
319 | $this->multicurrency_total_ht = 0; |
||
320 | } |
||
321 | if (empty($this->multicurrency_total_tva)) { |
||
322 | $this->multicurrency_total_tva = 0; |
||
323 | } |
||
324 | if (empty($this->multicurrency_total_ttc)) { |
||
325 | $this->multicurrency_total_ttc = 0; |
||
326 | } |
||
327 | |||
328 | // if buy price not defined, define buyprice as configured in margin admin |
||
329 | if ($this->pa_ht == 0 && $pa_ht_isemptystring) { |
||
330 | $result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product); |
||
331 | if ($result < 0) { |
||
332 | return $result; |
||
333 | } else { |
||
334 | $this->pa_ht = $result; |
||
335 | } |
||
336 | } |
||
337 | |||
338 | // Check parameters |
||
339 | if ($this->product_type < 0) { |
||
340 | $this->error = 'ErrorProductTypeMustBe0orMore'; |
||
341 | return -1; |
||
342 | } |
||
343 | if (!empty($this->fk_product) && $this->fk_product > 0) { |
||
344 | // Check product exists |
||
345 | $result = Product::isExistingObject('product', $this->fk_product); |
||
346 | if ($result <= 0) { |
||
347 | $this->error = 'ErrorProductIdDoesNotExists'; |
||
348 | dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); |
||
349 | return -1; |
||
350 | } |
||
351 | } |
||
352 | |||
353 | $this->db->begin(); |
||
354 | |||
355 | // Update line in database |
||
356 | $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facturedet'; |
||
357 | $sql .= ' (fk_facture, fk_parent_line, label, description, qty,'; |
||
358 | $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; |
||
359 | $sql .= ' fk_product, product_type, remise_percent, subprice, ref_ext, fk_remise_except,'; |
||
360 | $sql .= ' date_start, date_end, fk_code_ventilation,'; |
||
361 | $sql .= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,'; |
||
362 | $sql .= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,'; |
||
363 | $sql .= ' situation_percent, fk_prev_id,'; |
||
364 | $sql .= ' fk_unit, fk_user_author, fk_user_modif,'; |
||
365 | $sql .= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
||
366 | $sql .= ')'; |
||
367 | $sql .= " VALUES (" . $this->fk_facture . ","; |
||
368 | $sql .= " " . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null") . ","; |
||
369 | $sql .= " " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : "null") . ","; |
||
370 | $sql .= " '" . $this->db->escape($this->desc) . "',"; |
||
371 | $sql .= " " . price2num($this->qty) . ","; |
||
372 | $sql .= " " . (empty($this->vat_src_code) ? "''" : "'" . $this->db->escape($this->vat_src_code) . "'") . ","; |
||
373 | $sql .= " " . price2num($this->tva_tx) . ","; |
||
374 | $sql .= " " . price2num($this->localtax1_tx) . ","; |
||
375 | $sql .= " " . price2num($this->localtax2_tx) . ","; |
||
376 | $sql .= " '" . $this->db->escape($this->localtax1_type) . "',"; |
||
377 | $sql .= " '" . $this->db->escape($this->localtax2_type) . "',"; |
||
378 | $sql .= ' ' . ((!empty($this->fk_product) && $this->fk_product > 0) ? $this->fk_product : "null") . ','; |
||
379 | $sql .= " " . ((int) $this->product_type) . ","; |
||
380 | $sql .= " " . price2num($this->remise_percent) . ","; |
||
381 | $sql .= " " . price2num($this->subprice) . ","; |
||
382 | $sql .= " '" . $this->db->escape($this->ref_ext) . "',"; |
||
383 | $sql .= ' ' . (!empty($this->fk_remise_except) ? $this->fk_remise_except : "null") . ','; |
||
384 | $sql .= " " . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null") . ","; |
||
385 | $sql .= " " . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null") . ","; |
||
386 | $sql .= ' ' . ((int) $this->fk_code_ventilation) . ','; |
||
387 | $sql .= ' ' . ((int) $this->rang) . ','; |
||
388 | $sql .= ' ' . ((int) $this->special_code) . ','; |
||
389 | $sql .= ' ' . (!empty($this->fk_fournprice) ? $this->fk_fournprice : "null") . ','; |
||
390 | $sql .= ' ' . price2num($this->pa_ht) . ','; |
||
391 | $sql .= " '" . $this->db->escape($this->info_bits) . "',"; |
||
392 | $sql .= " " . price2num($this->total_ht) . ","; |
||
393 | $sql .= " " . price2num($this->total_tva) . ","; |
||
394 | $sql .= " " . price2num($this->total_ttc) . ","; |
||
395 | $sql .= " " . price2num($this->total_localtax1) . ","; |
||
396 | $sql .= " " . price2num($this->total_localtax2); |
||
397 | $sql .= ", " . ((float) $this->situation_percent); |
||
398 | $sql .= ", " . (!empty($this->fk_prev_id) ? $this->fk_prev_id : "null"); |
||
399 | $sql .= ", " . (!$this->fk_unit ? 'NULL' : $this->fk_unit); |
||
400 | $sql .= ", " . ((int) $user->id); |
||
401 | $sql .= ", " . ((int) $user->id); |
||
402 | $sql .= ", " . (int) $this->fk_multicurrency; |
||
403 | $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
||
404 | $sql .= ", " . price2num($this->multicurrency_subprice); |
||
405 | $sql .= ", " . price2num($this->multicurrency_total_ht); |
||
406 | $sql .= ", " . price2num($this->multicurrency_total_tva); |
||
407 | $sql .= ", " . price2num($this->multicurrency_total_ttc); |
||
408 | $sql .= ')'; |
||
409 | |||
410 | dol_syslog(get_class($this) . "::insert", LOG_DEBUG); |
||
411 | $resql = $this->db->query($sql); |
||
412 | if ($resql) { |
||
413 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . 'facturedet'); |
||
414 | $this->rowid = $this->id; // For backward compatibility |
||
415 | |||
416 | if (!$error) { |
||
417 | $result = $this->insertExtraFields(); |
||
418 | if ($result < 0) { |
||
419 | $error++; |
||
420 | } |
||
421 | } |
||
422 | |||
423 | // If fk_remise_except is defined, the discount is linked to the invoice |
||
424 | // which flags it as "consumed". |
||
425 | if ($this->fk_remise_except) { |
||
426 | $discount = new DiscountAbsolute($this->db); |
||
427 | $result = $discount->fetch($this->fk_remise_except); |
||
428 | if ($result >= 0) { |
||
429 | // Check if discount was found |
||
430 | if ($result > 0) { |
||
431 | // Check if discount not already affected to another invoice |
||
432 | if ($discount->fk_facture_line > 0) { |
||
433 | if (empty($noerrorifdiscountalreadylinked)) { |
||
434 | $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id); |
||
435 | dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); |
||
436 | $this->db->rollback(); |
||
437 | return -3; |
||
438 | } |
||
439 | } else { |
||
440 | $result = $discount->link_to_invoice($this->rowid, 0); |
||
441 | if ($result < 0) { |
||
442 | $this->error = $discount->error; |
||
443 | dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); |
||
444 | $this->db->rollback(); |
||
445 | return -3; |
||
446 | } |
||
447 | } |
||
448 | } else { |
||
449 | $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); |
||
450 | dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); |
||
451 | $this->db->rollback(); |
||
452 | return -3; |
||
453 | } |
||
454 | } else { |
||
455 | $this->error = $discount->error; |
||
456 | dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); |
||
457 | $this->db->rollback(); |
||
458 | return -3; |
||
459 | } |
||
460 | } |
||
461 | |||
462 | if (!$notrigger) { |
||
463 | // Call trigger |
||
464 | $result = $this->call_trigger('LINEBILL_INSERT', $user); |
||
465 | if ($result < 0) { |
||
466 | $this->db->rollback(); |
||
467 | return -2; |
||
468 | } |
||
469 | // End call triggers |
||
470 | } |
||
471 | |||
472 | $this->db->commit(); |
||
473 | return $this->id; |
||
474 | } else { |
||
475 | $this->error = $this->db->lasterror(); |
||
476 | $this->db->rollback(); |
||
477 | return -2; |
||
478 | } |
||
479 | } |
||
480 | |||
481 | /** |
||
482 | * Update line into database |
||
483 | * |
||
484 | * @param User $user User object |
||
485 | * @param int $notrigger Disable triggers |
||
486 | * @return int Return integer <0 if KO, >0 if OK |
||
487 | */ |
||
488 | public function update($user = null, $notrigger = 0) |
||
650 | } |
||
651 | } |
||
652 | |||
653 | /** |
||
654 | * Delete line in database |
||
655 | * |
||
656 | * @param User $tmpuser User that deletes |
||
657 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
||
658 | * @return int Return integer <0 if KO, >0 if OK |
||
659 | */ |
||
660 | public function delete($tmpuser = null, $notrigger = 0) |
||
717 | } |
||
718 | } |
||
719 | |||
720 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
||
721 | /** |
||
722 | * Update DB line fields total_xxx |
||
723 | * Used by migration |
||
724 | * |
||
725 | * @return int Return integer <0 if KO, >0 if OK |
||
726 | */ |
||
727 | public function update_total() |
||
728 | { |
||
729 | // phpcs:enable |
||
730 | $this->db->begin(); |
||
731 | dol_syslog(get_class($this) . "::update_total", LOG_DEBUG); |
||
732 | |||
733 | // Clean parameters |
||
734 | if (empty($this->total_localtax1)) { |
||
735 | $this->total_localtax1 = 0; |
||
736 | } |
||
737 | if (empty($this->total_localtax2)) { |
||
738 | $this->total_localtax2 = 0; |
||
739 | } |
||
740 | |||
741 | // Update line in database |
||
742 | $sql = "UPDATE " . MAIN_DB_PREFIX . "facturedet SET"; |
||
743 | $sql .= " total_ht=" . price2num($this->total_ht); |
||
744 | $sql .= ",total_tva=" . price2num($this->total_tva); |
||
745 | $sql .= ",total_localtax1=" . price2num($this->total_localtax1); |
||
746 | $sql .= ",total_localtax2=" . price2num($this->total_localtax2); |
||
747 | $sql .= ",total_ttc=" . price2num($this->total_ttc); |
||
748 | $sql .= " WHERE rowid = " . ((int) $this->rowid); |
||
749 | |||
750 | dol_syslog(get_class($this) . "::update_total", LOG_DEBUG); |
||
751 | |||
752 | $resql = $this->db->query($sql); |
||
753 | if ($resql) { |
||
754 | $this->db->commit(); |
||
755 | return 1; |
||
756 | } else { |
||
757 | $this->error = $this->db->error(); |
||
758 | $this->db->rollback(); |
||
759 | return -2; |
||
760 | } |
||
761 | } |
||
762 | |||
763 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
||
764 | /** |
||
765 | * Returns situation_percent of the previous line. |
||
766 | * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. |
||
767 | * |
||
768 | * @param int $invoiceid Invoice id |
||
769 | * @param bool $include_credit_note Include credit note or not |
||
770 | * @return float|int Reurrn previous situation percent, 0 or -1 if error |
||
771 | */ |
||
772 | public function get_prev_progress($invoiceid, $include_credit_note = true) |
||
819 | } |
||
820 | } |
||
821 | } |
||
823 |
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.