@@ -89,12 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | if ($this->version == 'development') { |
91 | 91 | return $langs->trans("Development"); |
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
92 | + } elseif ($this->version == 'experimental') { |
|
93 | + |
|
94 | 94 | return $langs->trans("Experimental"); |
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
95 | + } elseif ($this->version == 'dolibarr') { |
|
96 | + return DOL_VERSION; |
|
97 | + } elseif ($this->version) { |
|
98 | + return $this->version; |
|
99 | + } else { |
|
98 | 100 | return $langs->trans("Unknown"); |
99 | 101 | } |
100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
122 | 124 | $subtotal_line_found = false; |
123 | 125 | foreach ($parent->lines as $k => &$line) |
124 | 126 | { |
125 | - if ($line->rang < $rang) continue; |
|
126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | + if ($line->rang < $rang) { |
|
128 | + continue; |
|
129 | + } elseif ($line->rang == $rang) { |
|
130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | 131 | { |
128 | 132 | $title_level = $line->qty; |
129 | 133 | } |
130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
131 | 136 | { |
132 | 137 | $subtotal_line_found = true; |
138 | + } |
|
133 | 139 | $rang = $line->rang; |
134 | 140 | } |
135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
191 | 197 | break; |
192 | 198 | } |
193 | 199 | |
194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
195 | - else $this->addToBegin($parent, $object, $rang); |
|
200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
201 | + $this->addToEnd($parent, $object, $rang); |
|
202 | + } else { |
|
203 | + $this->addToBegin($parent, $object, $rang); |
|
204 | + } |
|
196 | 205 | |
197 | 206 | } |
198 | 207 | |
@@ -220,7 +229,9 @@ discard block |
||
220 | 229 | $commande->fetch($current_fk_commande); |
221 | 230 | |
222 | 231 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
223 | - if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
232 | + if (empty($label)) { |
|
233 | + $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
234 | + } |
|
224 | 235 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
225 | 236 | |
226 | 237 | TSubtotal::addTitle($facture, $label, 1, $rang); |
@@ -255,7 +266,9 @@ discard block |
||
255 | 266 | |
256 | 267 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
257 | 268 | { |
258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
269 | + if(! function_exists('_updateLineNC')) { |
|
270 | + dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
271 | + } |
|
259 | 272 | |
260 | 273 | $doli_action = GETPOST('action'); |
261 | 274 | $set = GETPOST('set'); |
@@ -273,32 +286,50 @@ discard block |
||
273 | 286 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
274 | 287 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
275 | 288 | |
276 | - if ($object->element == 'propal') $res = $object->update(1); |
|
277 | - else $res = $object->update($user, 1); |
|
289 | + if ($object->element == 'propal') { |
|
290 | + $res = $object->update(1); |
|
291 | + } else { |
|
292 | + $res = $object->update($user, 1); |
|
293 | + } |
|
278 | 294 | |
279 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
295 | + if ($res > 0) { |
|
296 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
297 | + } |
|
280 | 298 | break; |
281 | 299 | } |
282 | 300 | } |
283 | 301 | |
284 | 302 | // $object correspond à la ligne ajoutée |
285 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
303 | + if(empty($object->array_options)) { |
|
304 | + $object->fetch_optionals(); |
|
305 | + } |
|
286 | 306 | |
287 | 307 | if(! empty($object->array_options['options_subtotal_nc'])) { |
288 | 308 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
289 | 309 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
290 | 310 | |
291 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
292 | - else $res = $object->update($user, 1); |
|
311 | + if ($object->element == 'propaldet') { |
|
312 | + $res = $object->update(1); |
|
313 | + } else { |
|
314 | + $res = $object->update($user, 1); |
|
315 | + } |
|
293 | 316 | |
294 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
317 | + if ($res > 0) { |
|
318 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
319 | + } |
|
295 | 320 | } |
296 | 321 | |
297 | 322 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
298 | 323 | $parent_element = ''; |
299 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
300 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
301 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
324 | + if($object->element == 'propaldet') { |
|
325 | + $parent_element = 'propal'; |
|
326 | + } |
|
327 | + if($object->element == 'commandedet') { |
|
328 | + $parent_element = 'commande'; |
|
329 | + } |
|
330 | + if($object->element == 'facturedet') { |
|
331 | + $parent_element = 'facture'; |
|
332 | + } |
|
302 | 333 | |
303 | 334 | if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
304 | 335 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
@@ -498,26 +529,38 @@ discard block |
||
498 | 529 | ); |
499 | 530 | |
500 | 531 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
501 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
502 | - else $object->fetch($object->id); |
|
532 | + if (method_exists($object, 'fetch_lines')) { |
|
533 | + $object->fetch_lines(); |
|
534 | + } else { |
|
535 | + $object->fetch($object->id); |
|
536 | + } |
|
503 | 537 | |
504 | 538 | foreach ($object->lines as &$line) |
505 | 539 | { |
506 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
540 | + if (empty($line->array_options)) { |
|
541 | + $line->fetch_optionals(); |
|
542 | + } |
|
507 | 543 | |
508 | 544 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
509 | 545 | { |
510 | 546 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
511 | 547 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
512 | 548 | |
513 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
514 | - else $res = $line->update($user, 1); |
|
549 | + if ($line->element == 'propaldet') { |
|
550 | + $res = $line->update(1); |
|
551 | + } else { |
|
552 | + $res = $line->update($user, 1); |
|
553 | + } |
|
515 | 554 | |
516 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
555 | + if ($res > 0) { |
|
556 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
557 | + } |
|
517 | 558 | } |
518 | 559 | } |
519 | 560 | |
520 | - if (!empty($line)) $object->update_price(1); |
|
561 | + if (!empty($line)) { |
|
562 | + $object->update_price(1); |
|
563 | + } |
|
521 | 564 | } |
522 | 565 | |
523 | 566 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -587,9 +630,7 @@ discard block |
||
587 | 630 | dol_syslog( |
588 | 631 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
589 | 632 | ); |
590 | - } |
|
591 | - |
|
592 | - elseif ($action == 'BILL_MODIFY') { |
|
633 | + } elseif ($action == 'BILL_MODIFY') { |
|
593 | 634 | dol_syslog( |
594 | 635 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
595 | 636 | ); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | $value = ''; |
46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
47 | 47 | $resql = $this->db->query($sql); |
48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
49 | + $value = $obj->content; |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | |
51 | 53 | ?> |
@@ -129,8 +131,11 @@ discard block |
||
129 | 131 | if ($object->statut == 0 && $createRight) { |
130 | 132 | |
131 | 133 | |
132 | - if($object->element=='facture')$idvar = 'facid'; |
|
133 | - else $idvar='id'; |
|
134 | + if($object->element=='facture') { |
|
135 | + $idvar = 'facid'; |
|
136 | + } else { |
|
137 | + $idvar='id'; |
|
138 | + } |
|
134 | 139 | |
135 | 140 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
136 | 141 | { |
@@ -138,10 +143,11 @@ discard block |
||
138 | 143 | |
139 | 144 | if($action=='add_title_line') { |
140 | 145 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('title'); |
|
146 | + if(empty($title)) { |
|
147 | + $title = $langs->trans('title'); |
|
148 | + } |
|
142 | 149 | $qty = $level<1 ? 1 : $level ; |
143 | - } |
|
144 | - else if($action=='add_free_text') { |
|
150 | + } else if($action=='add_free_text') { |
|
145 | 151 | $title = GETPOST('title'); |
146 | 152 | |
147 | 153 | if (empty($title)) { |
@@ -153,29 +159,31 @@ discard block |
||
153 | 159 | } |
154 | 160 | } |
155 | 161 | } |
156 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
162 | + if(empty($title)) { |
|
163 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
164 | + } |
|
157 | 165 | $qty = 50; |
158 | - } |
|
159 | - else if($action=='add_subtitle_line') { |
|
166 | + } else if($action=='add_subtitle_line') { |
|
160 | 167 | $title = GETPOST('title'); |
161 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
168 | + if(empty($title)) { |
|
169 | + $title = $langs->trans('subtitle'); |
|
170 | + } |
|
162 | 171 | $qty = 2; |
163 | - } |
|
164 | - else if($action=='add_subtotal_line') { |
|
172 | + } else if($action=='add_subtotal_line') { |
|
165 | 173 | $title = $langs->trans('SubSubTotal'); |
166 | 174 | $qty = 98; |
167 | - } |
|
168 | - else { |
|
175 | + } else { |
|
169 | 176 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
170 | 177 | $qty = $level ? 100-$level : 99; |
171 | 178 | } |
172 | 179 | dol_include_once('/subtotal/class/subtotal.class.php'); |
173 | 180 | |
174 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
181 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
182 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
183 | + } |
|
175 | 184 | |
176 | 185 | TSubtotal::addSubTotalLine($object, $title, $qty); |
177 | - } |
|
178 | - else if($action==='ask_deleteallline') { |
|
186 | + } else if($action==='ask_deleteallline') { |
|
179 | 187 | $form=new Form($db); |
180 | 188 | |
181 | 189 | $lineid = GETPOST('lineid','integer'); |
@@ -198,8 +206,7 @@ discard block |
||
198 | 206 | $this->printNewFormat($object, $conf, $langs, $idvar); |
199 | 207 | } |
200 | 208 | } |
201 | - } |
|
202 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
209 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
203 | 210 | { |
204 | 211 | ?> |
205 | 212 | <script type="text/javascript"> |
@@ -217,8 +224,13 @@ discard block |
||
217 | 224 | |
218 | 225 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
219 | 226 | { |
220 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
221 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
227 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
228 | + return false; |
|
229 | + } |
|
230 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
231 | + return false; |
|
232 | + } |
|
233 | + // Si facture de situation |
|
222 | 234 | ?> |
223 | 235 | <script type="text/javascript"> |
224 | 236 | $(document).ready(function() { |
@@ -504,8 +516,7 @@ discard block |
||
504 | 516 | } |
505 | 517 | |
506 | 518 | |
507 | - } |
|
508 | - else{ |
|
519 | + } else{ |
|
509 | 520 | $substitutionarray['line_not_modsubtotal'] = true; |
510 | 521 | $substitutionarray['line_modsubtotal'] = 0; |
511 | 522 | } |
@@ -563,8 +574,11 @@ discard block |
||
563 | 574 | |
564 | 575 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
565 | 576 | |
566 | - if($object->element=='facture') $idvar = 'facid'; |
|
567 | - else $idvar = 'id'; |
|
577 | + if($object->element=='facture') { |
|
578 | + $idvar = 'facid'; |
|
579 | + } else { |
|
580 | + $idvar = 'id'; |
|
581 | + } |
|
568 | 582 | |
569 | 583 | if ($action == 'updateligne' || $action == 'updateline') |
570 | 584 | { |
@@ -594,8 +608,7 @@ discard block |
||
594 | 608 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
595 | 609 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
596 | 610 | } |
597 | - } |
|
598 | - else if($action === 'builddoc') { |
|
611 | + } else if($action === 'builddoc') { |
|
599 | 612 | |
600 | 613 | if ( |
601 | 614 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -610,33 +623,27 @@ discard block |
||
610 | 623 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 624 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 625 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | - } |
|
614 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
626 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
615 | 627 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
616 | 628 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
617 | 629 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
618 | - } |
|
619 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
630 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
620 | 631 | $sessname = 'subtotal_hideInnerLines_propal'; |
621 | 632 | $sessname2 = 'subtotal_hidedetails_propal'; |
622 | 633 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | - } |
|
624 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
634 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
625 | 635 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
626 | 636 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
627 | 637 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
628 | - } |
|
629 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
638 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
630 | 639 | $sessname = 'subtotal_hideInnerLines_commande'; |
631 | 640 | $sessname2 = 'subtotal_hidedetails_commande'; |
632 | 641 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | - } |
|
634 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
642 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
635 | 643 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
636 | 644 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
637 | 645 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
638 | - } |
|
639 | - else { |
|
646 | + } else { |
|
640 | 647 | $sessname = 'subtotal_hideInnerLines_unknown'; |
641 | 648 | $sessname2 = 'subtotal_hidedetails_unknown'; |
642 | 649 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -645,15 +652,24 @@ discard block |
||
645 | 652 | global $hideprices; |
646 | 653 | |
647 | 654 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
648 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
655 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
656 | + $_SESSION[$sessname] = array(); |
|
657 | + } |
|
658 | + // prevent old system |
|
649 | 659 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
650 | 660 | |
651 | 661 | $hidedetails= (int)GETPOST('hidedetails'); |
652 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
662 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
663 | + $_SESSION[$sessname2] = array(); |
|
664 | + } |
|
665 | + // prevent old system |
|
653 | 666 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
654 | 667 | |
655 | 668 | $hideprices= (int)GETPOST('hideprices'); |
656 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
669 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
670 | + $_SESSION[$sessname3] = array(); |
|
671 | + } |
|
672 | + // prevent old system |
|
657 | 673 | $_SESSION[$sessname3][$object->id] = $hideprices; |
658 | 674 | |
659 | 675 | foreach($object->lines as &$line) { |
@@ -661,8 +677,7 @@ discard block |
||
661 | 677 | |
662 | 678 | if($line->qty>=90) { |
663 | 679 | $line->modsubtotal_total = 1; |
664 | - } |
|
665 | - else{ |
|
680 | + } else{ |
|
666 | 681 | $line->modsubtotal_title = 1; |
667 | 682 | } |
668 | 683 | |
@@ -671,8 +686,7 @@ discard block |
||
671 | 686 | } |
672 | 687 | } |
673 | 688 | |
674 | - } |
|
675 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
689 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
676 | 690 | |
677 | 691 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
678 | 692 | |
@@ -680,7 +694,9 @@ discard block |
||
680 | 694 | /** |
681 | 695 | * @var $object Facture |
682 | 696 | */ |
683 | - if($object->element=='facture') $object->deleteline($idLine); |
|
697 | + if($object->element=='facture') { |
|
698 | + $object->deleteline($idLine); |
|
699 | + } |
|
684 | 700 | /** |
685 | 701 | * @var $object Facture fournisseur |
686 | 702 | */ |
@@ -691,18 +707,25 @@ discard block |
||
691 | 707 | /** |
692 | 708 | * @var $object Propal |
693 | 709 | */ |
694 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
710 | + else if($object->element=='propal') { |
|
711 | + $object->deleteline($idLine); |
|
712 | + } |
|
695 | 713 | /** |
696 | 714 | * @var $object Propal Fournisseur |
697 | 715 | */ |
698 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
716 | + else if($object->element=='supplier_proposal') { |
|
717 | + $object->deleteline($idLine); |
|
718 | + } |
|
699 | 719 | /** |
700 | 720 | * @var $object Commande |
701 | 721 | */ |
702 | 722 | else if($object->element=='commande') |
703 | 723 | { |
704 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
705 | - else $object->deleteline($idLine); |
|
724 | + if ((float) DOL_VERSION >= 5.0) { |
|
725 | + $object->deleteline($user, $idLine); |
|
726 | + } else { |
|
727 | + $object->deleteline($idLine); |
|
728 | + } |
|
706 | 729 | } |
707 | 730 | /** |
708 | 731 | * @var $object Commande fournisseur |
@@ -714,21 +737,26 @@ discard block |
||
714 | 737 | /** |
715 | 738 | * @var $object Facturerec |
716 | 739 | */ |
717 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
740 | + else if($object->element=='facturerec') { |
|
741 | + $object->deleteline($idLine); |
|
742 | + } |
|
718 | 743 | } |
719 | 744 | |
720 | 745 | header('location:?id='.$object->id); |
721 | 746 | exit; |
722 | 747 | |
723 | - } |
|
724 | - else if ($action == 'duplicate') |
|
748 | + } else if ($action == 'duplicate') |
|
725 | 749 | { |
726 | 750 | $lineid = GETPOST('lineid', 'int'); |
727 | 751 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
728 | 752 | |
729 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
730 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
731 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
753 | + if ($nbDuplicate > 0) { |
|
754 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
755 | + } elseif ($nbDuplicate == 0) { |
|
756 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
757 | + } else { |
|
758 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
759 | + } |
|
732 | 760 | |
733 | 761 | header('Location: ?id='.$object->id); |
734 | 762 | exit; |
@@ -746,21 +774,26 @@ discard block |
||
746 | 774 | global $conf; |
747 | 775 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
748 | 776 | { |
749 | - if ($object->element == 'commande') |
|
750 | - $obj = new OrderLine($object->db); |
|
751 | - if ($object->element == 'propal') |
|
752 | - $obj = new PropaleLigne($object->db); |
|
753 | - if ($object->element == 'facture') |
|
754 | - $obj = new FactureLigne($object->db); |
|
777 | + if ($object->element == 'commande') { |
|
778 | + $obj = new OrderLine($object->db); |
|
779 | + } |
|
780 | + if ($object->element == 'propal') { |
|
781 | + $obj = new PropaleLigne($object->db); |
|
782 | + } |
|
783 | + if ($object->element == 'facture') { |
|
784 | + $obj = new FactureLigne($object->db); |
|
785 | + } |
|
755 | 786 | if (!empty($parameters['fk_element'])) |
756 | 787 | { |
757 | 788 | |
758 | 789 | if($obj->fetch($parameters['fk_element'])){ |
759 | 790 | $obj->id= $obj->rowid; |
760 | - if (empty($obj->array_options)) |
|
761 | - $obj->fetch_optionals(); |
|
762 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
763 | - return 1; |
|
791 | + if (empty($obj->array_options)) { |
|
792 | + $obj->fetch_optionals(); |
|
793 | + } |
|
794 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
795 | + return 1; |
|
796 | + } |
|
764 | 797 | } |
765 | 798 | } |
766 | 799 | } |
@@ -835,17 +868,18 @@ discard block |
||
835 | 868 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
836 | 869 | if($l->rang>=$rang) { |
837 | 870 | //echo 'return!<br>'; |
838 | - if (!$return_all) return $total; |
|
839 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
840 | - } |
|
841 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
871 | + if (!$return_all) { |
|
872 | + return $total; |
|
873 | + } else { |
|
874 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
875 | + } |
|
876 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
842 | 877 | { |
843 | 878 | $total = 0; |
844 | 879 | $total_tva = 0; |
845 | 880 | $total_ttc = 0; |
846 | 881 | $TTotal_tva = array(); |
847 | - } |
|
848 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
882 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
849 | 883 | $total += $l->total_ht; |
850 | 884 | $total_tva += $l->total_tva; |
851 | 885 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -853,8 +887,11 @@ discard block |
||
853 | 887 | } |
854 | 888 | |
855 | 889 | } |
856 | - if (!$return_all) return $total; |
|
857 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
890 | + if (!$return_all) { |
|
891 | + return $total; |
|
892 | + } else { |
|
893 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
894 | + } |
|
858 | 895 | } |
859 | 896 | |
860 | 897 | /* |
@@ -922,15 +959,18 @@ discard block |
||
922 | 959 | } |
923 | 960 | |
924 | 961 | |
925 | - if($line->qty==99) |
|
926 | - $pdf->SetFillColor(220,220,220); |
|
927 | - elseif ($line->qty==98) |
|
928 | - $pdf->SetFillColor(230,230,230); |
|
929 | - else |
|
930 | - $pdf->SetFillColor(240,240,240); |
|
962 | + if($line->qty==99) { |
|
963 | + $pdf->SetFillColor(220,220,220); |
|
964 | + } elseif ($line->qty==98) { |
|
965 | + $pdf->SetFillColor(230,230,230); |
|
966 | + } else { |
|
967 | + $pdf->SetFillColor(240,240,240); |
|
968 | + } |
|
931 | 969 | |
932 | 970 | $style = 'B'; |
933 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
971 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
972 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
973 | + } |
|
934 | 974 | |
935 | 975 | $pdf->SetFont('', $style, 9); |
936 | 976 | |
@@ -969,8 +1009,7 @@ discard block |
||
969 | 1009 | // $line->total_tva |
970 | 1010 | // $line->total |
971 | 1011 | // $line->total_ttc |
972 | - } |
|
973 | - else |
|
1012 | + } else |
|
974 | 1013 | { |
975 | 1014 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | 1015 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -987,11 +1026,14 @@ discard block |
||
987 | 1026 | } |
988 | 1027 | |
989 | 1028 | $pdf->SetXY($pdf->postotalht, $posy); |
990 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1029 | + if($set_pagebreak_margin) { |
|
1030 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1031 | + } |
|
991 | 1032 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
992 | - } |
|
993 | - else{ |
|
994 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1033 | + } else{ |
|
1034 | + if($set_pagebreak_margin) { |
|
1035 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1036 | + } |
|
995 | 1037 | } |
996 | 1038 | |
997 | 1039 | $posy = $posy + $cell_height; |
@@ -1023,25 +1065,40 @@ discard block |
||
1023 | 1065 | |
1024 | 1066 | |
1025 | 1067 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
1026 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1068 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
1069 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1070 | + } |
|
1027 | 1071 | |
1028 | 1072 | if($hideInnerLines) { |
1029 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1030 | - else |
|
1073 | + if($line->qty==1) { |
|
1074 | + $pdf->SetFont('', $style, 9); |
|
1075 | + } else |
|
1031 | 1076 | { |
1032 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1077 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
1078 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1079 | + } |
|
1033 | 1080 | $pdf->SetFont('', $style, 9); |
1034 | 1081 | } |
1035 | - } |
|
1036 | - else { |
|
1082 | + } else { |
|
1037 | 1083 | |
1038 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1039 | - else $pdf->SetFont('', $style, 9); |
|
1084 | + if($line->qty==1) { |
|
1085 | + $pdf->SetFont('', $style, 9); |
|
1086 | + } |
|
1087 | + //TODO if super utile |
|
1088 | + else { |
|
1089 | + $pdf->SetFont('', $style, 9); |
|
1090 | + } |
|
1040 | 1091 | |
1041 | 1092 | } |
1042 | 1093 | |
1043 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
1044 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1094 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
1095 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
1096 | + } |
|
1097 | + // Pas de HTML dans la chaine |
|
1098 | + else { |
|
1099 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
1100 | + } |
|
1101 | + // et maintenant avec du HTML |
|
1045 | 1102 | |
1046 | 1103 | if($description && !$hidedesc) { |
1047 | 1104 | $posy = $pdf->GetY(); |
@@ -1065,8 +1122,7 @@ discard block |
||
1065 | 1122 | |
1066 | 1123 | if(is_array($parameters)) { |
1067 | 1124 | $i = & $parameters['i']; |
1068 | - } |
|
1069 | - else { |
|
1125 | + } else { |
|
1070 | 1126 | $i = (int)$parameters; |
1071 | 1127 | } |
1072 | 1128 | |
@@ -1088,17 +1144,14 @@ discard block |
||
1088 | 1144 | |
1089 | 1145 | if((float)DOL_VERSION<=3.6) { |
1090 | 1146 | return ''; |
1091 | - } |
|
1092 | - else if((float)DOL_VERSION>=3.8) { |
|
1147 | + } else if((float)DOL_VERSION>=3.8) { |
|
1093 | 1148 | return 1; |
1094 | 1149 | } |
1095 | 1150 | |
1096 | - } |
|
1097 | - elseif(!empty($hideprices)) { |
|
1151 | + } elseif(!empty($hideprices)) { |
|
1098 | 1152 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1099 | 1153 | return 1; |
1100 | - } |
|
1101 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1154 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1102 | 1155 | { |
1103 | 1156 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1104 | 1157 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1108,12 +1161,20 @@ discard block |
||
1108 | 1161 | } |
1109 | 1162 | } |
1110 | 1163 | |
1111 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1112 | - else $i = (int)$parameters; |
|
1164 | + if(is_array($parameters)) { |
|
1165 | + $i = & $parameters['i']; |
|
1166 | + } else { |
|
1167 | + $i = (int)$parameters; |
|
1168 | + } |
|
1113 | 1169 | |
1114 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1170 | + if (empty($object->lines[$i])) { |
|
1171 | + return 0; |
|
1172 | + } |
|
1173 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1115 | 1174 | |
1116 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1175 | + if(empty($object->lines[$i]->array_options)) { |
|
1176 | + $object->lines[$i]->fetch_optionals(); |
|
1177 | + } |
|
1117 | 1178 | |
1118 | 1179 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1119 | 1180 | { |
@@ -1130,8 +1191,11 @@ discard block |
||
1130 | 1191 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1131 | 1192 | global $conf, $hideprices, $hookmanager; |
1132 | 1193 | |
1133 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1134 | - else $i = (int)$parameters; |
|
1194 | + if(is_array($parameters)) { |
|
1195 | + $i = & $parameters['i']; |
|
1196 | + } else { |
|
1197 | + $i = (int)$parameters; |
|
1198 | + } |
|
1135 | 1199 | |
1136 | 1200 | if($this->isModSubtotalLine($parameters,$object) ){ |
1137 | 1201 | |
@@ -1139,13 +1203,11 @@ discard block |
||
1139 | 1203 | |
1140 | 1204 | if((float)DOL_VERSION<=3.6) { |
1141 | 1205 | return ''; |
1142 | - } |
|
1143 | - else if((float)DOL_VERSION>=3.8) { |
|
1206 | + } else if((float)DOL_VERSION>=3.8) { |
|
1144 | 1207 | return 1; |
1145 | 1208 | } |
1146 | 1209 | |
1147 | - } |
|
1148 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1210 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1149 | 1211 | { |
1150 | 1212 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1151 | 1213 | { |
@@ -1217,12 +1279,10 @@ discard block |
||
1217 | 1279 | $this->error = $hookmanager->error; |
1218 | 1280 | $this->errors = $hookmanager->errors; |
1219 | 1281 | return -1; |
1220 | - } |
|
1221 | - elseif (empty($reshook)) |
|
1282 | + } elseif (empty($reshook)) |
|
1222 | 1283 | { |
1223 | 1284 | $this->resprints .= $hookmanager->resprints; |
1224 | - } |
|
1225 | - else |
|
1285 | + } else |
|
1226 | 1286 | { |
1227 | 1287 | $this->resprints = $hookmanager->resprints; |
1228 | 1288 | |
@@ -1245,14 +1305,16 @@ discard block |
||
1245 | 1305 | |
1246 | 1306 | if((float)DOL_VERSION<=3.6) { |
1247 | 1307 | return ''; |
1248 | - } |
|
1249 | - else if((float)DOL_VERSION>=3.8) { |
|
1308 | + } else if((float)DOL_VERSION>=3.8) { |
|
1250 | 1309 | return 1; |
1251 | 1310 | } |
1252 | 1311 | } |
1253 | 1312 | |
1254 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1255 | - else $i = (int)$parameters; |
|
1313 | + if(is_array($parameters)) { |
|
1314 | + $i = & $parameters['i']; |
|
1315 | + } else { |
|
1316 | + $i = (int)$parameters; |
|
1317 | + } |
|
1256 | 1318 | |
1257 | 1319 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1258 | 1320 | { |
@@ -1274,14 +1336,16 @@ discard block |
||
1274 | 1336 | |
1275 | 1337 | if((float)DOL_VERSION<=3.6) { |
1276 | 1338 | return ''; |
1277 | - } |
|
1278 | - else if((float)DOL_VERSION>=3.8) { |
|
1339 | + } else if((float)DOL_VERSION>=3.8) { |
|
1279 | 1340 | return 1; |
1280 | 1341 | } |
1281 | 1342 | } |
1282 | 1343 | |
1283 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1284 | - else $i = (int)$parameters; |
|
1344 | + if(is_array($parameters)) { |
|
1345 | + $i = & $parameters['i']; |
|
1346 | + } else { |
|
1347 | + $i = (int)$parameters; |
|
1348 | + } |
|
1285 | 1349 | |
1286 | 1350 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1287 | 1351 | { |
@@ -1298,8 +1362,11 @@ discard block |
||
1298 | 1362 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1299 | 1363 | global $conf,$hideprices,$hookmanager; |
1300 | 1364 | |
1301 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1302 | - else $i = (int)$parameters; |
|
1365 | + if(is_array($parameters)) { |
|
1366 | + $i = & $parameters['i']; |
|
1367 | + } else { |
|
1368 | + $i = (int)$parameters; |
|
1369 | + } |
|
1303 | 1370 | |
1304 | 1371 | if($this->isModSubtotalLine($parameters,$object) ) { |
1305 | 1372 | $this->resprints = ' '; |
@@ -1318,8 +1385,7 @@ discard block |
||
1318 | 1385 | |
1319 | 1386 | if((float)DOL_VERSION<=3.6) { |
1320 | 1387 | return ''; |
1321 | - } |
|
1322 | - else if((float)DOL_VERSION>=3.8) { |
|
1388 | + } else if((float)DOL_VERSION>=3.8) { |
|
1323 | 1389 | return 1; |
1324 | 1390 | } |
1325 | 1391 | } |
@@ -1364,8 +1430,11 @@ discard block |
||
1364 | 1430 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
1365 | 1431 | global $conf,$hideprices,$hookmanager; |
1366 | 1432 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1368 | - else $i = (int) $parameters; |
|
1433 | + if(is_array($parameters)) { |
|
1434 | + $i = & $parameters['i']; |
|
1435 | + } else { |
|
1436 | + $i = (int) $parameters; |
|
1437 | + } |
|
1369 | 1438 | |
1370 | 1439 | if($this->isModSubtotalLine($parameters,$object) ) { |
1371 | 1440 | $this->resprints = ' '; |
@@ -1384,8 +1453,7 @@ discard block |
||
1384 | 1453 | |
1385 | 1454 | if((float)DOL_VERSION<=3.6) { |
1386 | 1455 | return ''; |
1387 | - } |
|
1388 | - else if((float)DOL_VERSION>=3.8) { |
|
1456 | + } else if((float)DOL_VERSION>=3.8) { |
|
1389 | 1457 | return 1; |
1390 | 1458 | } |
1391 | 1459 | } |
@@ -1400,14 +1468,16 @@ discard block |
||
1400 | 1468 | $this->resprints = ' '; |
1401 | 1469 | if((float)DOL_VERSION<=3.6) { |
1402 | 1470 | return ''; |
1403 | - } |
|
1404 | - else if((float)DOL_VERSION>=3.8) { |
|
1471 | + } else if((float)DOL_VERSION>=3.8) { |
|
1405 | 1472 | return 1; |
1406 | 1473 | } |
1407 | 1474 | } |
1408 | 1475 | |
1409 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1410 | - else $i = (int)$parameters; |
|
1476 | + if(is_array($parameters)) { |
|
1477 | + $i = & $parameters['i']; |
|
1478 | + } else { |
|
1479 | + $i = (int)$parameters; |
|
1480 | + } |
|
1411 | 1481 | |
1412 | 1482 | if (!empty($hideprices) |
1413 | 1483 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1431,16 +1501,21 @@ discard block |
||
1431 | 1501 | |
1432 | 1502 | if((float)DOL_VERSION<=3.6) { |
1433 | 1503 | return ''; |
1434 | - } |
|
1435 | - else if((float)DOL_VERSION>=3.8) { |
|
1504 | + } else if((float)DOL_VERSION>=3.8) { |
|
1436 | 1505 | return 1; |
1437 | 1506 | } |
1438 | 1507 | } |
1439 | 1508 | |
1440 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1441 | - else $i = (int)$parameters; |
|
1509 | + if(is_array($parameters)) { |
|
1510 | + $i = & $parameters['i']; |
|
1511 | + } else { |
|
1512 | + $i = (int)$parameters; |
|
1513 | + } |
|
1442 | 1514 | |
1443 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1515 | + if (empty($object->lines[$i])) { |
|
1516 | + return 0; |
|
1517 | + } |
|
1518 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1444 | 1519 | |
1445 | 1520 | $object->lines[$i]->fetch_optionals(); |
1446 | 1521 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1486,14 +1561,16 @@ discard block |
||
1486 | 1561 | $this->resprints = ' '; |
1487 | 1562 | if((float)DOL_VERSION<=3.6) { |
1488 | 1563 | return ''; |
1489 | - } |
|
1490 | - else if((float)DOL_VERSION>=3.8) { |
|
1564 | + } else if((float)DOL_VERSION>=3.8) { |
|
1491 | 1565 | return 1; |
1492 | 1566 | } |
1493 | 1567 | } |
1494 | 1568 | |
1495 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1496 | - else $i = (int)$parameters; |
|
1569 | + if(is_array($parameters)) { |
|
1570 | + $i = & $parameters['i']; |
|
1571 | + } else { |
|
1572 | + $i = (int)$parameters; |
|
1573 | + } |
|
1497 | 1574 | |
1498 | 1575 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1499 | 1576 | { |
@@ -1523,7 +1600,9 @@ discard block |
||
1523 | 1600 | } |
1524 | 1601 | } |
1525 | 1602 | |
1526 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1603 | + if (!empty($TLineTitle)) { |
|
1604 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1605 | + } |
|
1527 | 1606 | } |
1528 | 1607 | |
1529 | 1608 | } |
@@ -1537,8 +1616,12 @@ discard block |
||
1537 | 1616 | $j=0; |
1538 | 1617 | foreach ($TLineTitle as $k => &$line) |
1539 | 1618 | { |
1540 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1541 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1619 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1620 | + continue; |
|
1621 | + } |
|
1622 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1623 | + break; |
|
1624 | + } |
|
1542 | 1625 | |
1543 | 1626 | if ($line->qty == $level) |
1544 | 1627 | { |
@@ -1572,7 +1655,9 @@ discard block |
||
1572 | 1655 | |
1573 | 1656 | $hidedetails = (int)GETPOST('hidedetails'); |
1574 | 1657 | |
1575 | - if(empty($hidedetails)) return false; |
|
1658 | + if(empty($hidedetails)) { |
|
1659 | + return false; |
|
1660 | + } |
|
1576 | 1661 | |
1577 | 1662 | // TODO can't add VAT to document without lines... :-/ |
1578 | 1663 | |
@@ -1633,7 +1718,9 @@ discard block |
||
1633 | 1718 | */ |
1634 | 1719 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1635 | 1720 | |
1636 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1721 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1722 | + $line->TTotal_tva = $TTotal_tva; |
|
1723 | + } |
|
1637 | 1724 | $line->total_ht = $total; |
1638 | 1725 | $line->total_tva = $total_tva; |
1639 | 1726 | $line->total = $line->total_ht; |
@@ -1697,8 +1784,7 @@ discard block |
||
1697 | 1784 | } |
1698 | 1785 | |
1699 | 1786 | |
1700 | - } |
|
1701 | - elseif ($hidedetails) |
|
1787 | + } elseif ($hidedetails) |
|
1702 | 1788 | { |
1703 | 1789 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1704 | 1790 | } |
@@ -1769,7 +1855,9 @@ discard block |
||
1769 | 1855 | |
1770 | 1856 | if(!empty($hideprices)) { |
1771 | 1857 | foreach($object->lines as &$line) { |
1772 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1858 | + if($line->fk_product_type!=9) { |
|
1859 | + $line->fk_parent_line = -1; |
|
1860 | + } |
|
1773 | 1861 | } |
1774 | 1862 | } |
1775 | 1863 | |
@@ -1790,7 +1878,9 @@ discard block |
||
1790 | 1878 | |
1791 | 1879 | if($line->qty>90) { |
1792 | 1880 | |
1793 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1881 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1882 | + $label .= ' '.$this->getTitle($object, $line); |
|
1883 | + } |
|
1794 | 1884 | |
1795 | 1885 | $pageBefore = $pdf->getPage(); |
1796 | 1886 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1808,8 +1898,7 @@ discard block |
||
1808 | 1898 | |
1809 | 1899 | $posy = $pdf->GetY(); |
1810 | 1900 | return 1; |
1811 | - } |
|
1812 | - else if ($line->qty < 10) { |
|
1901 | + } else if ($line->qty < 10) { |
|
1813 | 1902 | $pageBefore = $pdf->getPage(); |
1814 | 1903 | |
1815 | 1904 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1833,8 +1922,7 @@ discard block |
||
1833 | 1922 | // if($line->rowid==47) exit; |
1834 | 1923 | |
1835 | 1924 | return 0; |
1836 | - } |
|
1837 | - elseif (empty($object->lines[$parameters['i']])) |
|
1925 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1838 | 1926 | { |
1839 | 1927 | $this->resprints = -1; |
1840 | 1928 | } |
@@ -1867,7 +1955,9 @@ discard block |
||
1867 | 1955 | |
1868 | 1956 | foreach ($object->lines as $line) |
1869 | 1957 | { |
1870 | - if ($line->id == $currentLine->id) break; |
|
1958 | + if ($line->id == $currentLine->id) { |
|
1959 | + break; |
|
1960 | + } |
|
1871 | 1961 | |
1872 | 1962 | $qty_search = 100 - $currentLine->qty; |
1873 | 1963 | |
@@ -1904,23 +1994,23 @@ discard block |
||
1904 | 1994 | { |
1905 | 1995 | $object->statut = 0; // hack for facture rec |
1906 | 1996 | $createRight = $user->rights->facture->creer; |
1907 | - } |
|
1908 | - elseif($object->element == 'order_supplier' ) |
|
1997 | + } elseif($object->element == 'order_supplier' ) |
|
1909 | 1998 | { |
1910 | 1999 | $createRight = $user->rights->fournisseur->commande->creer; |
1911 | - } |
|
1912 | - elseif($object->element == 'invoice_supplier' ) |
|
2000 | + } elseif($object->element == 'invoice_supplier' ) |
|
1913 | 2001 | { |
1914 | 2002 | $createRight = $user->rights->fournisseur->facture->creer; |
1915 | 2003 | } |
1916 | 2004 | |
1917 | 2005 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1918 | 2006 | null; |
1919 | - } |
|
1920 | - else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
2007 | + } else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1921 | 2008 | { |
1922 | - if($object->element=='facture')$idvar = 'facid'; |
|
1923 | - else $idvar='id'; |
|
2009 | + if($object->element=='facture') { |
|
2010 | + $idvar = 'facid'; |
|
2011 | + } else { |
|
2012 | + $idvar='id'; |
|
2013 | + } |
|
1924 | 2014 | |
1925 | 2015 | if((float)DOL_VERSION <= 3.4) |
1926 | 2016 | { |
@@ -1946,22 +2036,44 @@ discard block |
||
1946 | 2036 | <?php |
1947 | 2037 | } |
1948 | 2038 | |
1949 | - if(empty($line->description)) $line->description = $line->desc; |
|
2039 | + if(empty($line->description)) { |
|
2040 | + $line->description = $line->desc; |
|
2041 | + } |
|
1950 | 2042 | |
1951 | 2043 | $colspan = 5; |
1952 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1953 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1954 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1955 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
2044 | + if($object->element == 'facturerec' ) { |
|
2045 | + $colspan = 3; |
|
2046 | + } |
|
2047 | + if($object->element == 'order_supplier') { |
|
2048 | + $colspan = 3; |
|
2049 | + } |
|
2050 | + if($object->element == 'invoice_supplier') { |
|
2051 | + $colspan = 4; |
|
2052 | + } |
|
2053 | + if($object->element == 'supplier_proposal') { |
|
2054 | + $colspan = 4; |
|
2055 | + } |
|
1956 | 2056 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
1957 | 2057 | $colspan++; // Colonne PU Devise |
1958 | 2058 | } |
1959 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1960 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1961 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1962 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1963 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1964 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
2059 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
2060 | + $colspan++; |
|
2061 | + } |
|
2062 | + if(!empty($conf->margin->enabled)) { |
|
2063 | + $colspan++; |
|
2064 | + } |
|
2065 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
2066 | + $colspan++; |
|
2067 | + } |
|
2068 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
2069 | + $colspan++; |
|
2070 | + } |
|
2071 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
2072 | + $colspan++; |
|
2073 | + } |
|
2074 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
2075 | + $colspan++; |
|
2076 | + } |
|
1965 | 2077 | |
1966 | 2078 | /* Titre */ |
1967 | 2079 | //var_dump($line); |
@@ -1974,23 +2086,36 @@ discard block |
||
1974 | 2086 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1975 | 2087 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1976 | 2088 | { |
1977 | - if($line->qty==99) print 'background:#adadcf'; |
|
1978 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1979 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1980 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1981 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1982 | - else if($line->qty==50) print ''; |
|
1983 | - else print 'background:#eeeeff;'; |
|
2089 | + if($line->qty==99) { |
|
2090 | + print 'background:#adadcf'; |
|
2091 | + } else if($line->qty==98) { |
|
2092 | + print 'background:#ddddff;'; |
|
2093 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
2094 | + print 'background:#eeeeff;'; |
|
2095 | + } else if($line->qty==1) { |
|
2096 | + print 'background:#adadcf;'; |
|
2097 | + } else if($line->qty==2) { |
|
2098 | + print 'background:#ddddff;'; |
|
2099 | + } else if($line->qty==50) { |
|
2100 | + print ''; |
|
2101 | + } else { |
|
2102 | + print 'background:#eeeeff;'; |
|
2103 | + } |
|
1984 | 2104 | |
1985 | 2105 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1986 | - } |
|
1987 | - else |
|
2106 | + } else |
|
1988 | 2107 | { |
1989 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1990 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1991 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1992 | - else if($line->qty==50) print ''; |
|
1993 | - else print 'background:#eeffee;' ; |
|
2108 | + if($line->qty==99) { |
|
2109 | + print 'background:#ddffdd'; |
|
2110 | + } else if($line->qty==98) { |
|
2111 | + print 'background:#ddddff;'; |
|
2112 | + } else if($line->qty==2) { |
|
2113 | + print 'background:#eeeeff; '; |
|
2114 | + } else if($line->qty==50) { |
|
2115 | + print ''; |
|
2116 | + } else { |
|
2117 | + print 'background:#eeffee;' ; |
|
2118 | + } |
|
1994 | 2119 | } |
1995 | 2120 | |
1996 | 2121 | ?>;"> |
@@ -2017,13 +2142,11 @@ discard block |
||
2017 | 2142 | $qty_displayed = $line->qty; |
2018 | 2143 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2019 | 2144 | |
2020 | - } |
|
2021 | - else if (TSubtotal::isSubtotal($line)) |
|
2145 | + } else if (TSubtotal::isSubtotal($line)) |
|
2022 | 2146 | { |
2023 | 2147 | $qty_displayed = 100 - $line->qty; |
2024 | 2148 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2025 | - } |
|
2026 | - else |
|
2149 | + } else |
|
2027 | 2150 | { |
2028 | 2151 | $isFreeText = true; |
2029 | 2152 | } |
@@ -2044,9 +2167,13 @@ discard block |
||
2044 | 2167 | } |
2045 | 2168 | |
2046 | 2169 | $readonlyForSituation = ''; |
2047 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
2170 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
2171 | + $readonlyForSituation = 'readonly'; |
|
2172 | + } |
|
2048 | 2173 | |
2049 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2174 | + if (!$isFreeText) { |
|
2175 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2176 | + } |
|
2050 | 2177 | |
2051 | 2178 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
2052 | 2179 | { |
@@ -2054,8 +2181,12 @@ discard block |
||
2054 | 2181 | for ($j=1; $j<10; $j++) |
2055 | 2182 | { |
2056 | 2183 | if (!empty($readonlyForSituation)) { |
2057 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2058 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2184 | + if ($qty_displayed == $j) { |
|
2185 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2186 | + } |
|
2187 | + } else { |
|
2188 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2189 | + } |
|
2059 | 2190 | } |
2060 | 2191 | $select .= '</select> '; |
2061 | 2192 | |
@@ -2075,7 +2206,9 @@ discard block |
||
2075 | 2206 | echo '<div>'; |
2076 | 2207 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
2077 | 2208 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
2078 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2209 | + if (empty($readonlyForSituation)) { |
|
2210 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2211 | + } |
|
2079 | 2212 | echo '</select>'; |
2080 | 2213 | echo '</div>'; |
2081 | 2214 | |
@@ -2094,8 +2227,9 @@ discard block |
||
2094 | 2227 | echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
2095 | 2228 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2096 | 2229 | echo '</div>'; |
2230 | + } else if ($isFreeText) { |
|
2231 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2097 | 2232 | } |
2098 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2099 | 2233 | echo '</div>'; |
2100 | 2234 | |
2101 | 2235 | if($line->qty<10) { |
@@ -2115,8 +2249,7 @@ discard block |
||
2115 | 2249 | $doleditor->Create(); |
2116 | 2250 | } |
2117 | 2251 | |
2118 | - } |
|
2119 | - else { |
|
2252 | + } else { |
|
2120 | 2253 | |
2121 | 2254 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2122 | 2255 | { |
@@ -2124,14 +2257,19 @@ discard block |
||
2124 | 2257 | { |
2125 | 2258 | echo str_repeat(' ', $line->qty-1); |
2126 | 2259 | |
2127 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2128 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2260 | + if (TSubtotal::isTitle($line)) { |
|
2261 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2262 | + } else { |
|
2263 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2264 | + } |
|
2129 | 2265 | } |
2130 | - } |
|
2131 | - else |
|
2266 | + } else |
|
2132 | 2267 | { |
2133 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2134 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2268 | + if($line->qty<=1) { |
|
2269 | + print img_picto('', 'subtotal@subtotal'); |
|
2270 | + } else if($line->qty==2) { |
|
2271 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
2272 | + } |
|
2135 | 2273 | } |
2136 | 2274 | |
2137 | 2275 | |
@@ -2141,21 +2279,26 @@ discard block |
||
2141 | 2279 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
2142 | 2280 | |
2143 | 2281 | if (empty($line->label)) { |
2144 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
2145 | - else print $line->description; |
|
2146 | - } |
|
2147 | - else { |
|
2282 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
2283 | + print $line->description.' '.$this->getTitle($object, $line); |
|
2284 | + } else { |
|
2285 | + print $line->description; |
|
2286 | + } |
|
2287 | + } else { |
|
2148 | 2288 | |
2149 | 2289 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
2150 | 2290 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2151 | - } |
|
2152 | - else{ |
|
2291 | + } else{ |
|
2153 | 2292 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2154 | 2293 | } |
2155 | 2294 | |
2156 | 2295 | } |
2157 | - if($line->qty>90) print ' : '; |
|
2158 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2296 | + if($line->qty>90) { |
|
2297 | + print ' : '; |
|
2298 | + } |
|
2299 | + if($line->info_bits > 0) { |
|
2300 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2301 | + } |
|
2159 | 2302 | |
2160 | 2303 | |
2161 | 2304 | |
@@ -2198,11 +2341,12 @@ discard block |
||
2198 | 2341 | </script> |
2199 | 2342 | <?php |
2200 | 2343 | |
2201 | - } |
|
2202 | - else{ |
|
2344 | + } else{ |
|
2203 | 2345 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
2204 | 2346 | { |
2205 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2347 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
2348 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2349 | + } |
|
2206 | 2350 | } |
2207 | 2351 | |
2208 | 2352 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2291,7 +2435,9 @@ discard block |
||
2291 | 2435 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2292 | 2436 | |
2293 | 2437 | $colspan+=3; $mode = 'view'; |
2294 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2438 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2439 | + $mode = 'edit'; |
|
2440 | + } |
|
2295 | 2441 | |
2296 | 2442 | $ex_element = $line->element; |
2297 | 2443 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2473,10 +2619,9 @@ discard block |
||
2473 | 2619 | |
2474 | 2620 | if(TSubtotal::isTitle($line)){ |
2475 | 2621 | $ThtmlData['data-issubtotal'] = 'title'; |
2476 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2622 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2477 | 2623 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2478 | - } |
|
2479 | - else{ |
|
2624 | + } else{ |
|
2480 | 2625 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2481 | 2626 | } |
2482 | 2627 | |
@@ -2486,7 +2631,9 @@ discard block |
||
2486 | 2631 | |
2487 | 2632 | // hook |
2488 | 2633 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2489 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2634 | + if ($reshook < 0) { |
|
2635 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2636 | + } |
|
2490 | 2637 | if ($reshook>0) |
2491 | 2638 | { |
2492 | 2639 | $ThtmlData = $hookmanager->resArray; |