@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | global $type_element, $where; |
18 | 18 | |
19 | - $contexts = explode(':',$parameters['context']); |
|
19 | + $contexts = explode(':', $parameters['context']); |
|
20 | 20 | |
21 | - if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
21 | + if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
22 | 22 | $mod_num = TSubtotal::$module_number; |
23 | 23 | |
24 | 24 | // Not a title (can't use TSubtotal class methods in sql) |
25 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
25 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
26 | 26 | // Not a subtotal (can't use TSubtotal class methods in sql) |
27 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
27 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
28 | 28 | // Not a free line text (can't use TSubtotal class methods in sql) |
29 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
29 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -105,47 +105,47 @@ discard block |
||
105 | 105 | |
106 | 106 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
107 | 107 | { |
108 | - global $langs,$db,$user, $conf; |
|
108 | + global $langs, $db, $user, $conf; |
|
109 | 109 | |
110 | 110 | $langs->load('subtotal@subtotal'); |
111 | 111 | |
112 | - $contexts = explode(':',$parameters['context']); |
|
112 | + $contexts = explode(':', $parameters['context']); |
|
113 | 113 | |
114 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts) || in_array('expeditioncard',$contexts)) { |
|
114 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts) || in_array('expeditioncard', $contexts)) { |
|
115 | 115 | |
116 | 116 | $createRight = $user->rights->{$object->element}->creer; |
117 | - if($object->element == 'facturerec' ) |
|
117 | + if ($object->element == 'facturerec') |
|
118 | 118 | { |
119 | 119 | $object->statut = 0; // hack for facture rec |
120 | 120 | $createRight = $user->rights->facture->creer; |
121 | - } elseif($object->element == 'order_supplier' ) |
|
121 | + } elseif ($object->element == 'order_supplier') |
|
122 | 122 | { |
123 | 123 | $createRight = $user->rights->fournisseur->commande->creer; |
124 | - } elseif($object->element == 'invoice_supplier' ) |
|
124 | + } elseif ($object->element == 'invoice_supplier') |
|
125 | 125 | { |
126 | 126 | $createRight = $user->rights->fournisseur->facture->creer; |
127 | 127 | } |
128 | - elseif($object->element == 'shipping') |
|
128 | + elseif ($object->element == 'shipping') |
|
129 | 129 | { |
130 | 130 | $createRight = true; // No rights management for shipments |
131 | 131 | } |
132 | 132 | |
133 | - if ($object->statut == 0 && $createRight) { |
|
133 | + if ($object->statut == 0 && $createRight) { |
|
134 | 134 | |
135 | 135 | |
136 | - if($object->element=='facture')$idvar = 'facid'; |
|
137 | - else $idvar='id'; |
|
136 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
137 | + else $idvar = 'id'; |
|
138 | 138 | |
139 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
139 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
140 | 140 | { |
141 | 141 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
142 | 142 | |
143 | - if($action=='add_title_line') { |
|
143 | + if ($action == 'add_title_line') { |
|
144 | 144 | $title = GETPOST('title'); |
145 | - if(empty($title)) $title = $langs->trans('title'); |
|
146 | - $qty = $level<1 ? 1 : $level ; |
|
145 | + if (empty($title)) $title = $langs->trans('title'); |
|
146 | + $qty = $level < 1 ? 1 : $level; |
|
147 | 147 | } |
148 | - else if($action=='add_free_text') { |
|
148 | + else if ($action == 'add_free_text') { |
|
149 | 149 | $title = GETPOST('title'); |
150 | 150 | |
151 | 151 | if (empty($title)) { |
@@ -157,21 +157,21 @@ discard block |
||
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
160 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
160 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
161 | 161 | $qty = 50; |
162 | 162 | } |
163 | - else if($action=='add_subtitle_line') { |
|
163 | + else if ($action == 'add_subtitle_line') { |
|
164 | 164 | $title = GETPOST('title'); |
165 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
165 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
166 | 166 | $qty = 2; |
167 | 167 | } |
168 | - else if($action=='add_subtotal_line') { |
|
168 | + else if ($action == 'add_subtotal_line') { |
|
169 | 169 | $title = $langs->trans('SubSubTotal'); |
170 | 170 | $qty = 98; |
171 | 171 | } |
172 | 172 | else { |
173 | 173 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
174 | - $qty = $level ? 100-$level : 99; |
|
174 | + $qty = $level ? 100 - $level : 99; |
|
175 | 175 | } |
176 | 176 | dol_include_once('/subtotal/class/subtotal.class.php'); |
177 | 177 | |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | |
180 | 180 | TSubtotal::addSubTotalLine($object, $title, $qty); |
181 | 181 | } |
182 | - else if($action==='ask_deleteallline') { |
|
183 | - $form=new Form($db); |
|
182 | + else if ($action === 'ask_deleteallline') { |
|
183 | + $form = new Form($db); |
|
184 | 184 | |
185 | - $lineid = GETPOST('lineid','integer'); |
|
185 | + $lineid = GETPOST('lineid', 'integer'); |
|
186 | 186 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
187 | 187 | |
188 | 188 | $nbLines = count($TIdForGroup); |
189 | 189 | |
190 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
190 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
191 | 191 | print $formconfirm; |
192 | 192 | } |
193 | 193 | |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | - if($object->element != 'shipping' && $action!='editline') { |
|
200 | + if ($object->element != 'shipping' && $action != 'editline') { |
|
201 | 201 | // New format is for 3.8 |
202 | 202 | $this->printNewFormat($object, $conf, $langs, $idvar); |
203 | 203 | } |
204 | 204 | } |
205 | 205 | } |
206 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts) || in_array('orderstoinvoicesupplier',$contexts)) |
|
206 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts) || in_array('orderstoinvoicesupplier', $contexts)) |
|
207 | 207 | { |
208 | 208 | ?> |
209 | 209 | <script type="text/javascript"> |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $(document).ready(function() { |
229 | 229 | $('div.fiche div.tabsAction').append('<br />'); |
230 | 230 | |
231 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
231 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
232 | 232 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
233 | 233 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
234 | 234 | |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | $('body').append(dialog_html); |
280 | 280 | |
281 | 281 | <?php |
282 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
283 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
284 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
282 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
283 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
284 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
285 | 285 | ?> |
286 | 286 | if (action == 'addTitle' || action == 'addFreeTxt') |
287 | 287 | { |
@@ -396,62 +396,62 @@ discard block |
||
396 | 396 | global $conf, $langs, $bc; |
397 | 397 | |
398 | 398 | $action = GETPOST('action'); |
399 | - $TContext = explode(':',$parameters['context']); |
|
399 | + $TContext = explode(':', $parameters['context']); |
|
400 | 400 | if ( |
401 | - in_array('invoicecard',$TContext) |
|
402 | - || in_array('invoicesuppliercard',$TContext) |
|
403 | - || in_array('propalcard',$TContext) |
|
404 | - || in_array('ordercard',$TContext) |
|
405 | - || in_array('ordersuppliercard',$TContext) |
|
406 | - || in_array('invoicereccard',$TContext) |
|
401 | + in_array('invoicecard', $TContext) |
|
402 | + || in_array('invoicesuppliercard', $TContext) |
|
403 | + || in_array('propalcard', $TContext) |
|
404 | + || in_array('ordercard', $TContext) |
|
405 | + || in_array('ordersuppliercard', $TContext) |
|
406 | + || in_array('invoicereccard', $TContext) |
|
407 | 407 | ) |
408 | 408 | { |
409 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
410 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
411 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
412 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
409 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
410 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
411 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
412 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
413 | 413 | |
414 | - $var=false; |
|
415 | - $out.= '<tr '.$bc[$var].'> |
|
414 | + $var = false; |
|
415 | + $out .= '<tr '.$bc[$var].'> |
|
416 | 416 | <td colspan="4" align="right"> |
417 | 417 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
418 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
418 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
419 | 419 | </td> |
420 | 420 | </tr>'; |
421 | 421 | |
422 | - $var=!$var; |
|
423 | - $out.= '<tr '.$bc[$var].'> |
|
422 | + $var = !$var; |
|
423 | + $out .= '<tr '.$bc[$var].'> |
|
424 | 424 | <td colspan="4" align="right"> |
425 | 425 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
426 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
426 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
427 | 427 | </td> |
428 | 428 | </tr>'; |
429 | 429 | |
430 | - $var=!$var; |
|
431 | - $out.= '<tr '.$bc[$var].'> |
|
430 | + $var = !$var; |
|
431 | + $out .= '<tr '.$bc[$var].'> |
|
432 | 432 | <td colspan="4" align="right"> |
433 | 433 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
434 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
434 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
435 | 435 | </td> |
436 | 436 | </tr>'; |
437 | 437 | |
438 | 438 | |
439 | 439 | |
440 | 440 | if ( |
441 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
442 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
443 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
444 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
445 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
446 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
441 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
442 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
443 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
444 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
445 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
446 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
447 | 447 | ) |
448 | 448 | { |
449 | - $var=!$var; |
|
450 | - $out.= ' |
|
449 | + $var = !$var; |
|
450 | + $out .= ' |
|
451 | 451 | <tr '.$bc[$var].'> |
452 | 452 | <td colspan="4" align="right"> |
453 | 453 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
454 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
454 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
455 | 455 | </td> |
456 | 456 | </tr>'; |
457 | 457 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
468 | 468 | { |
469 | 469 | |
470 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
470 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
471 | 471 | { |
472 | 472 | |
473 | 473 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
479 | 479 | global $conf; |
480 | 480 | |
481 | - if($action === 'builddoc') { |
|
481 | + if ($action === 'builddoc') { |
|
482 | 482 | |
483 | 483 | $line = &$parameters['line']; |
484 | 484 | $object = &$parameters['object']; |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $substitutionarray['line_modsubtotal_total'] = false; |
490 | 490 | $substitutionarray['line_modsubtotal_title'] = false; |
491 | 491 | |
492 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
492 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
493 | 493 | $substitutionarray['line_modsubtotal'] = 1; |
494 | 494 | $substitutionarray['line_not_modsubtotal'] = false; |
495 | 495 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | = $substitutionarray['line_up'] |
502 | 502 | = ''; |
503 | 503 | |
504 | - if($line->qty>90) { |
|
504 | + if ($line->qty > 90) { |
|
505 | 505 | $substitutionarray['line_modsubtotal_total'] = true; |
506 | 506 | |
507 | 507 | //list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | |
517 | 517 | |
518 | 518 | } |
519 | - else{ |
|
519 | + else { |
|
520 | 520 | $substitutionarray['line_not_modsubtotal'] = true; |
521 | 521 | $substitutionarray['line_modsubtotal'] = 0; |
522 | 522 | } |
@@ -528,29 +528,29 @@ discard block |
||
528 | 528 | function createFrom($parameters, &$object, $action, $hookmanager) { |
529 | 529 | |
530 | 530 | if ( |
531 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
532 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
533 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
534 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
535 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
536 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
537 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
531 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
532 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
533 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
534 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
535 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
536 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
537 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
538 | 538 | ) { |
539 | 539 | |
540 | 540 | global $db; |
541 | 541 | |
542 | 542 | $objFrom = $parameters['objFrom']; |
543 | 543 | |
544 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
544 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
545 | 545 | |
546 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
546 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
547 | 547 | |
548 | 548 | $line = & $object->lines[$k]; |
549 | 549 | |
550 | 550 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
551 | 551 | |
552 | 552 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
553 | - SET info_bits=".(int)$lineOld->info_bits." |
|
553 | + SET info_bits=".(int) $lineOld->info_bits." |
|
554 | 554 | WHERE rowid = ".$idLine." |
555 | 555 | "); |
556 | 556 | |
@@ -566,15 +566,15 @@ discard block |
||
566 | 566 | |
567 | 567 | function doActions($parameters, &$object, $action, $hookmanager) |
568 | 568 | { |
569 | - global $db, $conf, $langs,$user; |
|
569 | + global $db, $conf, $langs, $user; |
|
570 | 570 | |
571 | 571 | dol_include_once('/subtotal/class/subtotal.class.php'); |
572 | 572 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
573 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
573 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
574 | 574 | |
575 | 575 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
576 | 576 | |
577 | - if($object->element=='facture') $idvar = 'facid'; |
|
577 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
578 | 578 | else $idvar = 'id'; |
579 | 579 | |
580 | 580 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
588 | 588 | { |
589 | 589 | $found = true; |
590 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
590 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
591 | 591 | $extrafieldsline = new ExtraFields($db); |
592 | 592 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
593 | 593 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -606,43 +606,43 @@ discard block |
||
606 | 606 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
607 | 607 | } |
608 | 608 | } |
609 | - else if($action === 'builddoc') { |
|
609 | + else if ($action === 'builddoc') { |
|
610 | 610 | |
611 | 611 | if ( |
612 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
613 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
614 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
615 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
616 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
617 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
612 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
613 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
614 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
615 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
616 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
617 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
618 | 618 | ) |
619 | 619 | { |
620 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
620 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
621 | 621 | $sessname = 'subtotal_hideInnerLines_facture'; |
622 | 622 | $sessname2 = 'subtotal_hidedetails_facture'; |
623 | 623 | $sessname3 = 'subtotal_hideprices_facture'; |
624 | 624 | } |
625 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
625 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
626 | 626 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
627 | 627 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
628 | 628 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
629 | 629 | } |
630 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
630 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
631 | 631 | $sessname = 'subtotal_hideInnerLines_propal'; |
632 | 632 | $sessname2 = 'subtotal_hidedetails_propal'; |
633 | 633 | $sessname3 = 'subtotal_hideprices_propal'; |
634 | 634 | } |
635 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
635 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
636 | 636 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
637 | 637 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
638 | 638 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
639 | 639 | } |
640 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
640 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
641 | 641 | $sessname = 'subtotal_hideInnerLines_commande'; |
642 | 642 | $sessname2 = 'subtotal_hidedetails_commande'; |
643 | 643 | $sessname3 = 'subtotal_hideprices_commande'; |
644 | 644 | } |
645 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
645 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
646 | 646 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
647 | 647 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
648 | 648 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -655,25 +655,25 @@ discard block |
||
655 | 655 | |
656 | 656 | global $hideprices; |
657 | 657 | |
658 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
659 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
658 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
659 | + if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system |
|
660 | 660 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
661 | 661 | |
662 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
663 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
662 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
663 | + if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system |
|
664 | 664 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
665 | 665 | |
666 | - $hideprices= (int)GETPOST('hideprices'); |
|
667 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
666 | + $hideprices = (int) GETPOST('hideprices'); |
|
667 | + if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system |
|
668 | 668 | $_SESSION[$sessname3][$object->id] = $hideprices; |
669 | 669 | |
670 | - foreach($object->lines as &$line) { |
|
670 | + foreach ($object->lines as &$line) { |
|
671 | 671 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
672 | 672 | |
673 | - if($line->qty>=90) { |
|
673 | + if ($line->qty >= 90) { |
|
674 | 674 | $line->modsubtotal_total = 1; |
675 | 675 | } |
676 | - else{ |
|
676 | + else { |
|
677 | 677 | $line->modsubtotal_title = 1; |
678 | 678 | } |
679 | 679 | |
@@ -683,34 +683,34 @@ discard block |
||
683 | 683 | } |
684 | 684 | |
685 | 685 | } |
686 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
686 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
687 | 687 | |
688 | 688 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
689 | 689 | |
690 | - foreach($Tab as $idLine) { |
|
690 | + foreach ($Tab as $idLine) { |
|
691 | 691 | /** |
692 | 692 | * @var $object Facture |
693 | 693 | */ |
694 | - if($object->element=='facture') $object->deleteline($idLine); |
|
694 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
695 | 695 | /** |
696 | 696 | * @var $object Facture fournisseur |
697 | 697 | */ |
698 | - else if($object->element=='invoice_supplier') |
|
698 | + else if ($object->element == 'invoice_supplier') |
|
699 | 699 | { |
700 | 700 | $object->deleteline($idLine); |
701 | 701 | } |
702 | 702 | /** |
703 | 703 | * @var $object Propal |
704 | 704 | */ |
705 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
705 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
706 | 706 | /** |
707 | 707 | * @var $object Propal Fournisseur |
708 | 708 | */ |
709 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
709 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
710 | 710 | /** |
711 | 711 | * @var $object Commande |
712 | 712 | */ |
713 | - else if($object->element=='commande') |
|
713 | + else if ($object->element == 'commande') |
|
714 | 714 | { |
715 | 715 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
716 | 716 | else $object->deleteline($idLine); |
@@ -718,18 +718,18 @@ discard block |
||
718 | 718 | /** |
719 | 719 | * @var $object Commande fournisseur |
720 | 720 | */ |
721 | - else if($object->element=='order_supplier') |
|
721 | + else if ($object->element == 'order_supplier') |
|
722 | 722 | { |
723 | 723 | $object->deleteline($idLine); |
724 | 724 | } |
725 | 725 | /** |
726 | 726 | * @var $object Facturerec |
727 | 727 | */ |
728 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
728 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
729 | 729 | /** |
730 | 730 | * @var $object Expedition |
731 | 731 | */ |
732 | - else if($object->element=='shipping') $object->deleteline($user, $idLine); |
|
732 | + else if ($object->element == 'shipping') $object->deleteline($user, $idLine); |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | header('location:?id='.$object->id); |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | return 0; |
753 | 753 | } |
754 | 754 | |
755 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
755 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
756 | 756 | return 0; |
757 | 757 | } |
758 | 758 | |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | if (!empty($parameters['fk_element'])) |
771 | 771 | { |
772 | 772 | |
773 | - if($obj->fetch($parameters['fk_element'])){ |
|
774 | - $obj->id= $obj->rowid; |
|
773 | + if ($obj->fetch($parameters['fk_element'])) { |
|
774 | + $obj->id = $obj->rowid; |
|
775 | 775 | if (empty($obj->array_options)) |
776 | 776 | $obj->fetch_optionals(); |
777 | 777 | if (!empty($obj->array_options['options_subtotal_nc'])) |
@@ -791,22 +791,22 @@ discard block |
||
791 | 791 | |
792 | 792 | $found = false; |
793 | 793 | |
794 | - $Tab= array(); |
|
794 | + $Tab = array(); |
|
795 | 795 | |
796 | - foreach($object->lines as $l) { |
|
796 | + foreach ($object->lines as $l) { |
|
797 | 797 | |
798 | 798 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
799 | - if($lid == $lineid) { |
|
799 | + if ($lid == $lineid) { |
|
800 | 800 | |
801 | 801 | $found = true; |
802 | 802 | $qty_line = $l->qty; |
803 | 803 | } |
804 | 804 | |
805 | - if($found) { |
|
805 | + if ($found) { |
|
806 | 806 | |
807 | 807 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
808 | 808 | |
809 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
809 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
810 | 810 | break; // end of story |
811 | 811 | } |
812 | 812 | } |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | |
820 | 820 | } |
821 | 821 | |
822 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
822 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
823 | 823 | global $conf; |
824 | 824 | |
825 | 825 | $rang = $line->rang; |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | $total_ttc = 0; |
833 | 833 | $TTotal_tva = array(); |
834 | 834 | |
835 | - $sign=1; |
|
836 | - if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
835 | + $sign = 1; |
|
836 | + if (isset($object->type) && $object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; |
|
837 | 837 | |
838 | 838 | if (GETPOST('action') == 'builddoc') $builddoc = true; |
839 | 839 | else $builddoc = false; |
@@ -842,15 +842,15 @@ discard block |
||
842 | 842 | |
843 | 843 | $TLineReverse = array_reverse($object->lines); |
844 | 844 | |
845 | - foreach($TLineReverse as $l) |
|
845 | + foreach ($TLineReverse as $l) |
|
846 | 846 | { |
847 | 847 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
848 | - if ($l->rang>=$rang) continue; |
|
848 | + if ($l->rang >= $rang) continue; |
|
849 | 849 | if (!empty($title_break) && $title_break->id == $l->id) break; |
850 | 850 | elseif (!TSubtotal::isModSubtotalLine($l)) |
851 | 851 | { |
852 | 852 | // TODO retirer le test avec $builddoc quand Dolibarr affichera le total progression sur la card et pas seulement dans le PDF |
853 | - if ($builddoc && $object->element == 'facture' && $object->type==Facture::TYPE_SITUATION) |
|
853 | + if ($builddoc && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
854 | 854 | { |
855 | 855 | if ($l->situation_percent > 0) |
856 | 856 | { |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | } |
864 | 864 | |
865 | 865 | $result = $sign * ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
866 | - $total+= $result; |
|
866 | + $total += $result; |
|
867 | 867 | // TODO check si les 3 lignes du dessous sont corrects |
868 | 868 | $total_tva += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
869 | 869 | $TTotal_tva[$l->tva_tx] += $sign * ($l->total_tva / ($l->situation_percent / 100)) * $progress; |
@@ -894,10 +894,10 @@ discard block |
||
894 | 894 | * @param $w float width |
895 | 895 | * @param $h float height |
896 | 896 | */ |
897 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
898 | - global $conf,$subtotal_last_title_posy; |
|
897 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
898 | + global $conf, $subtotal_last_title_posy; |
|
899 | 899 | |
900 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
900 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
901 | 901 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
902 | 902 | { |
903 | 903 | $posy = $subtotal_last_title_posy; |
@@ -906,40 +906,40 @@ discard block |
||
906 | 906 | |
907 | 907 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
908 | 908 | |
909 | - if($object->element == 'shipping' || $object->element == 'delivery') |
|
909 | + if ($object->element == 'shipping' || $object->element == 'delivery') |
|
910 | 910 | { |
911 | 911 | $hidePriceOnSubtotalLines = 1; |
912 | 912 | } |
913 | 913 | |
914 | 914 | $set_pagebreak_margin = false; |
915 | - if(method_exists('Closure','bind')) { |
|
915 | + if (method_exists('Closure', 'bind')) { |
|
916 | 916 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
917 | - $sweetsThief = function ($pdf) { |
|
918 | - return $pdf->bMargin ; |
|
917 | + $sweetsThief = function($pdf) { |
|
918 | + return $pdf->bMargin; |
|
919 | 919 | }; |
920 | 920 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
921 | 921 | |
922 | - $bMargin = $sweetsThief($pdf); |
|
922 | + $bMargin = $sweetsThief($pdf); |
|
923 | 923 | |
924 | - $pdf->SetAutoPageBreak( false ); |
|
924 | + $pdf->SetAutoPageBreak(false); |
|
925 | 925 | |
926 | 926 | $set_pagebreak_margin = true; |
927 | 927 | } |
928 | 928 | |
929 | 929 | |
930 | - if($line->qty==99) |
|
931 | - $pdf->SetFillColor(220,220,220); |
|
932 | - elseif ($line->qty==98) |
|
933 | - $pdf->SetFillColor(230,230,230); |
|
930 | + if ($line->qty == 99) |
|
931 | + $pdf->SetFillColor(220, 220, 220); |
|
932 | + elseif ($line->qty == 98) |
|
933 | + $pdf->SetFillColor(230, 230, 230); |
|
934 | 934 | else |
935 | - $pdf->SetFillColor(240,240,240); |
|
935 | + $pdf->SetFillColor(240, 240, 240); |
|
936 | 936 | |
937 | 937 | $style = 'B'; |
938 | 938 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
939 | 939 | |
940 | 940 | $pdf->SetFont('', $style, 9); |
941 | 941 | |
942 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
942 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
943 | 943 | // var_dump($bMargin); |
944 | 944 | $pageAfter = $pdf->getPage(); |
945 | 945 | |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | |
968 | 968 | |
969 | 969 | |
970 | - if($total_to_print !== '') { |
|
970 | + if ($total_to_print !== '') { |
|
971 | 971 | |
972 | 972 | if (GETPOST('hideInnerLines')) |
973 | 973 | { |
@@ -994,11 +994,11 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | $pdf->SetXY($pdf->postotalht, $posy); |
997 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
998 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
997 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
998 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
999 | 999 | } |
1000 | - else{ |
|
1001 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1000 | + else { |
|
1001 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $posy = $posy + $cell_height; |
@@ -1018,22 +1018,22 @@ discard block |
||
1018 | 1018 | * @param $w float width |
1019 | 1019 | * @param $h float height |
1020 | 1020 | */ |
1021 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
1021 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
1022 | 1022 | |
1023 | - global $db,$conf,$subtotal_last_title_posy; |
|
1023 | + global $db, $conf, $subtotal_last_title_posy; |
|
1024 | 1024 | |
1025 | 1025 | $subtotal_last_title_posy = $posy; |
1026 | - $pdf->SetXY ($posx, $posy); |
|
1026 | + $pdf->SetXY($posx, $posy); |
|
1027 | 1027 | |
1028 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1028 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1029 | 1029 | |
1030 | 1030 | |
1031 | 1031 | |
1032 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
1032 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
1033 | 1033 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
1034 | 1034 | |
1035 | - if($hideInnerLines) { |
|
1036 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1035 | + if ($hideInnerLines) { |
|
1036 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
1037 | 1037 | else |
1038 | 1038 | { |
1039 | 1039 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -1042,44 +1042,44 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | else { |
1044 | 1044 | |
1045 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1045 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1046 | 1046 | else $pdf->SetFont('', $style, 9); |
1047 | 1047 | |
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | 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 |
1051 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1051 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
1052 | 1052 | |
1053 | - if($description && !$hidedesc) { |
|
1053 | + if ($description && !$hidedesc) { |
|
1054 | 1054 | $posy = $pdf->GetY(); |
1055 | 1055 | |
1056 | 1056 | $pdf->SetFont('', '', 8); |
1057 | 1057 | |
1058 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
1058 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
1059 | 1059 | |
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | } |
1063 | 1063 | |
1064 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
1064 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
1065 | 1065 | // ultimate PDF hook O_o |
1066 | 1066 | |
1067 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
1067 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
1068 | 1068 | |
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | function isModSubtotalLine(&$parameters, &$object) { |
1072 | 1072 | |
1073 | - if(is_array($parameters)) { |
|
1073 | + if (is_array($parameters)) { |
|
1074 | 1074 | $i = & $parameters['i']; |
1075 | 1075 | } |
1076 | 1076 | else { |
1077 | - $i = (int)$parameters; |
|
1077 | + $i = (int) $parameters; |
|
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | $line = $object->lines[$i]; |
1081 | 1081 | |
1082 | - if($object->element == 'shipping' || $object->element == 'delivery') |
|
1082 | + if ($object->element == 'shipping' || $object->element == 'delivery') |
|
1083 | 1083 | { |
1084 | 1084 | dol_include_once('/commande/class/commande.class.php'); |
1085 | 1085 | $line = new OrderLine($object->db); |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
1090 | - if($line->special_code == $this->module_number && $line->product_type == 9) { |
|
1090 | + if ($line->special_code == $this->module_number && $line->product_type == 9) { |
|
1091 | 1091 | return true; |
1092 | 1092 | } |
1093 | 1093 | |
@@ -1095,42 +1095,42 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
1099 | - global $conf,$hideprices; |
|
1098 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
1099 | + global $conf, $hideprices; |
|
1100 | 1100 | |
1101 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1101 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1102 | 1102 | $this->resprints = ' '; |
1103 | 1103 | |
1104 | - if((float)DOL_VERSION<=3.6) { |
|
1104 | + if ((float) DOL_VERSION <= 3.6) { |
|
1105 | 1105 | return ''; |
1106 | 1106 | } |
1107 | - else if((float)DOL_VERSION>=3.8) { |
|
1107 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1108 | 1108 | return 1; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | } |
1112 | - elseif(!empty($hideprices)) { |
|
1112 | + elseif (!empty($hideprices)) { |
|
1113 | 1113 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1114 | 1114 | return 1; |
1115 | 1115 | } |
1116 | 1116 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1117 | 1117 | { |
1118 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1119 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1118 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1119 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1120 | 1120 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1121 | 1121 | { |
1122 | 1122 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1123 | 1123 | } |
1124 | 1124 | } |
1125 | 1125 | |
1126 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1127 | - else $i = (int)$parameters; |
|
1126 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1127 | + else $i = (int) $parameters; |
|
1128 | 1128 | |
1129 | 1129 | 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) |
1130 | 1130 | |
1131 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1131 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1132 | 1132 | |
1133 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1133 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1134 | 1134 | { |
1135 | 1135 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1136 | 1136 | { |
@@ -1142,20 +1142,20 @@ discard block |
||
1142 | 1142 | return 0; |
1143 | 1143 | } |
1144 | 1144 | |
1145 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1145 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1146 | 1146 | global $conf, $hideprices, $hookmanager; |
1147 | 1147 | |
1148 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1149 | - else $i = (int)$parameters; |
|
1148 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1149 | + else $i = (int) $parameters; |
|
1150 | 1150 | |
1151 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1151 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1152 | 1152 | |
1153 | 1153 | $this->resprints = ' '; |
1154 | 1154 | |
1155 | - if((float)DOL_VERSION<=3.6) { |
|
1155 | + if ((float) DOL_VERSION <= 3.6) { |
|
1156 | 1156 | return ''; |
1157 | 1157 | } |
1158 | - else if((float)DOL_VERSION>=3.8) { |
|
1158 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1159 | 1159 | return 1; |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | } |
1183 | 1183 | } |
1184 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1184 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1185 | 1185 | $this->resprints = price($object->lines[$i]->total_ht); |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | { |
1207 | 1207 | // Check if a title exist for this line && if the title have subtotal |
1208 | 1208 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1209 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1209 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1210 | 1210 | { |
1211 | 1211 | |
1212 | 1212 | $this->resprints = ' '; |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | */ |
1227 | 1227 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
1228 | 1228 | { |
1229 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
1229 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
1230 | 1230 | if ($reshook < 0) |
1231 | 1231 | { |
1232 | 1232 | $this->error = $hookmanager->error; |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | $this->resprints = $hookmanager->resprints; |
1243 | 1243 | |
1244 | 1244 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
1245 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
1245 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
1246 | 1246 | { |
1247 | 1247 | return $hookmanager->resArray['overrideReturn']; |
1248 | 1248 | } |
@@ -1251,25 +1251,25 @@ discard block |
||
1251 | 1251 | return $defaultReturn; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1254 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1255 | 1255 | global $conf; |
1256 | 1256 | |
1257 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1257 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1258 | 1258 | |
1259 | 1259 | $this->resprints = ' '; |
1260 | 1260 | |
1261 | - if((float)DOL_VERSION<=3.6) { |
|
1261 | + if ((float) DOL_VERSION <= 3.6) { |
|
1262 | 1262 | return ''; |
1263 | 1263 | } |
1264 | - else if((float)DOL_VERSION>=3.8) { |
|
1264 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1265 | 1265 | return 1; |
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1270 | - else $i = (int)$parameters; |
|
1269 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1270 | + else $i = (int) $parameters; |
|
1271 | 1271 | |
1272 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1272 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1273 | 1273 | { |
1274 | 1274 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1275 | 1275 | { |
@@ -1281,24 +1281,24 @@ discard block |
||
1281 | 1281 | return 0; |
1282 | 1282 | } |
1283 | 1283 | |
1284 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1284 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1285 | 1285 | global $conf; |
1286 | 1286 | |
1287 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1287 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1288 | 1288 | $this->resprints = ' '; |
1289 | 1289 | |
1290 | - if((float)DOL_VERSION<=3.6) { |
|
1290 | + if ((float) DOL_VERSION <= 3.6) { |
|
1291 | 1291 | return ''; |
1292 | 1292 | } |
1293 | - else if((float)DOL_VERSION>=3.8) { |
|
1293 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1294 | 1294 | return 1; |
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1299 | - else $i = (int)$parameters; |
|
1298 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1299 | + else $i = (int) $parameters; |
|
1300 | 1300 | |
1301 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1301 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1302 | 1302 | { |
1303 | 1303 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1304 | 1304 | { |
@@ -1310,32 +1310,32 @@ discard block |
||
1310 | 1310 | return 0; |
1311 | 1311 | } |
1312 | 1312 | |
1313 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1314 | - global $conf,$hideprices,$hookmanager; |
|
1313 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1314 | + global $conf, $hideprices, $hookmanager; |
|
1315 | 1315 | |
1316 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1317 | - else $i = (int)$parameters; |
|
1316 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1317 | + else $i = (int) $parameters; |
|
1318 | 1318 | |
1319 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1319 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1320 | 1320 | $this->resprints = ' '; |
1321 | 1321 | |
1322 | 1322 | $line = $object->lines[$i]; |
1323 | 1323 | |
1324 | 1324 | // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
1325 | - if(TSubtotal::isSubtotal($line)) { |
|
1325 | + if (TSubtotal::isSubtotal($line)) { |
|
1326 | 1326 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1327 | 1327 | |
1328 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1329 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1328 | + if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1329 | + if (!empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1330 | 1330 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1331 | 1331 | $this->resprints = price($TTotal['total_unit_subprice']); |
1332 | 1332 | } |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - if((float)DOL_VERSION<=3.6) { |
|
1335 | + if ((float) DOL_VERSION <= 3.6) { |
|
1336 | 1336 | return ''; |
1337 | 1337 | } |
1338 | - else if((float)DOL_VERSION>=3.8) { |
|
1338 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1339 | 1339 | return 1; |
1340 | 1340 | } |
1341 | 1341 | } |
@@ -1363,7 +1363,7 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | // Check if a title exist for this line && if the title have subtotal |
1365 | 1365 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1366 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1366 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1367 | 1367 | { |
1368 | 1368 | |
1369 | 1369 | $this->resprints = ' '; |
@@ -1377,37 +1377,37 @@ discard block |
||
1377 | 1377 | return 0; |
1378 | 1378 | } |
1379 | 1379 | |
1380 | - function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
|
1381 | - global $conf,$hideprices,$hookmanager; |
|
1380 | + function pdf_getlineremisepercent($parameters = array(), &$object, &$action = '') { |
|
1381 | + global $conf, $hideprices, $hookmanager; |
|
1382 | 1382 | |
1383 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1383 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1384 | 1384 | else $i = (int) $parameters; |
1385 | 1385 | |
1386 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1386 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1387 | 1387 | $this->resprints = ' '; |
1388 | 1388 | |
1389 | 1389 | $line = $object->lines[$i]; |
1390 | 1390 | |
1391 | 1391 | // Affichage de la remise |
1392 | - if(TSubtotal::isSubtotal($line)) { |
|
1392 | + if (TSubtotal::isSubtotal($line)) { |
|
1393 | 1393 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1394 | 1394 | |
1395 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1396 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1395 | + if (empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1396 | + if (!empty($parentTitle->array_options['options_show_reduc'])) { |
|
1397 | 1397 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1398 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
1398 | + $this->resprints = price((1 - $TTotal['total_ht'] / $TTotal['total_subprice']) * 100, 0, '', 1, 2, 2).'%'; |
|
1399 | 1399 | } |
1400 | 1400 | } |
1401 | 1401 | |
1402 | - if((float)DOL_VERSION<=3.6) { |
|
1402 | + if ((float) DOL_VERSION <= 3.6) { |
|
1403 | 1403 | return ''; |
1404 | 1404 | } |
1405 | - else if((float)DOL_VERSION>=3.8) { |
|
1405 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1406 | 1406 | return 1; |
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | elseif (!empty($hideprices) |
1410 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1410 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1411 | 1411 | ) |
1412 | 1412 | { |
1413 | 1413 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1420,24 +1420,24 @@ discard block |
||
1420 | 1420 | return 0; |
1421 | 1421 | } |
1422 | 1422 | |
1423 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1424 | - global $conf,$hideprices; |
|
1423 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1424 | + global $conf, $hideprices; |
|
1425 | 1425 | |
1426 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1426 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1427 | 1427 | $this->resprints = ' '; |
1428 | - if((float)DOL_VERSION<=3.6) { |
|
1428 | + if ((float) DOL_VERSION <= 3.6) { |
|
1429 | 1429 | return ''; |
1430 | 1430 | } |
1431 | - else if((float)DOL_VERSION>=3.8) { |
|
1431 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1432 | 1432 | return 1; |
1433 | 1433 | } |
1434 | 1434 | } |
1435 | 1435 | |
1436 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1437 | - else $i = (int)$parameters; |
|
1436 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1437 | + else $i = (int) $parameters; |
|
1438 | 1438 | |
1439 | 1439 | if (!empty($hideprices) |
1440 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1440 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1441 | 1441 | ) |
1442 | 1442 | { |
1443 | 1443 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1450,22 +1450,22 @@ discard block |
||
1450 | 1450 | return 0; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1454 | - global $conf,$hideprices,$hookmanager; |
|
1453 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1454 | + global $conf, $hideprices, $hookmanager; |
|
1455 | 1455 | |
1456 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1456 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1457 | 1457 | $this->resprints = ' '; |
1458 | 1458 | |
1459 | - if((float)DOL_VERSION<=3.6) { |
|
1459 | + if ((float) DOL_VERSION <= 3.6) { |
|
1460 | 1460 | return ''; |
1461 | 1461 | } |
1462 | - else if((float)DOL_VERSION>=3.8) { |
|
1462 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1463 | 1463 | return 1; |
1464 | 1464 | } |
1465 | 1465 | } |
1466 | 1466 | |
1467 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1468 | - else $i = (int)$parameters; |
|
1467 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1468 | + else $i = (int) $parameters; |
|
1469 | 1469 | |
1470 | 1470 | 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) |
1471 | 1471 | |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | |
1493 | 1493 | // Check if a title exist for this line && if the title have subtotal |
1494 | 1494 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1495 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1495 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1496 | 1496 | { |
1497 | 1497 | |
1498 | 1498 | $this->resprints = ' '; |
@@ -1506,23 +1506,23 @@ discard block |
||
1506 | 1506 | return 0; |
1507 | 1507 | } |
1508 | 1508 | |
1509 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1509 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1510 | 1510 | global $conf; |
1511 | 1511 | |
1512 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1512 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1513 | 1513 | $this->resprints = ' '; |
1514 | - if((float)DOL_VERSION<=3.6) { |
|
1514 | + if ((float) DOL_VERSION <= 3.6) { |
|
1515 | 1515 | return ''; |
1516 | 1516 | } |
1517 | - else if((float)DOL_VERSION>=3.8) { |
|
1517 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1518 | 1518 | return 1; |
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | |
1522 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1523 | - else $i = (int)$parameters; |
|
1522 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1523 | + else $i = (int) $parameters; |
|
1524 | 1524 | |
1525 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1525 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1526 | 1526 | { |
1527 | 1527 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1528 | 1528 | { |
@@ -1537,12 +1537,12 @@ discard block |
||
1537 | 1537 | function add_numerotation(&$object) { |
1538 | 1538 | global $conf; |
1539 | 1539 | |
1540 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1540 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1541 | 1541 | |
1542 | 1542 | $TLevelTitre = array(); |
1543 | 1543 | $prevlevel = 0; |
1544 | 1544 | |
1545 | - foreach($object->lines as $k=>&$line) |
|
1545 | + foreach ($object->lines as $k=>&$line) |
|
1546 | 1546 | { |
1547 | 1547 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1548 | 1548 | { |
@@ -1556,12 +1556,12 @@ discard block |
||
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1559 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1559 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1560 | 1560 | { |
1561 | 1561 | $TTitle = array(); |
1562 | 1562 | |
1563 | - $i=1; |
|
1564 | - $j=0; |
|
1563 | + $i = 1; |
|
1564 | + $j = 0; |
|
1565 | 1565 | foreach ($TLineTitle as $k => &$line) |
1566 | 1566 | { |
1567 | 1567 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1571,7 +1571,7 @@ discard block |
||
1571 | 1571 | { |
1572 | 1572 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1573 | 1573 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1574 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1574 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1575 | 1575 | { |
1576 | 1576 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1577 | 1577 | $line->desc = $line->description = ''; |
@@ -1597,26 +1597,26 @@ discard block |
||
1597 | 1597 | |
1598 | 1598 | function setDocTVA(&$pdf, &$object) { |
1599 | 1599 | |
1600 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1600 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1601 | 1601 | |
1602 | - if(empty($hidedetails)) return false; |
|
1602 | + if (empty($hidedetails)) return false; |
|
1603 | 1603 | |
1604 | 1604 | // TODO can't add VAT to document without lines... :-/ |
1605 | 1605 | |
1606 | 1606 | return true; |
1607 | 1607 | } |
1608 | 1608 | |
1609 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1609 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1610 | 1610 | { |
1611 | 1611 | /** |
1612 | 1612 | * @var $pdf TCPDF |
1613 | 1613 | */ |
1614 | - global $pdf,$conf, $langs; |
|
1614 | + global $pdf, $conf, $langs; |
|
1615 | 1615 | |
1616 | 1616 | // var_dump($object->lines); |
1617 | 1617 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1618 | 1618 | |
1619 | - foreach($parameters as $key=>$value) { |
|
1619 | + foreach ($parameters as $key=>$value) { |
|
1620 | 1620 | ${$key} = $value; |
1621 | 1621 | } |
1622 | 1622 | |
@@ -1624,43 +1624,43 @@ discard block |
||
1624 | 1624 | |
1625 | 1625 | $this->add_numerotation($object); |
1626 | 1626 | |
1627 | - foreach($object->lines as $k => &$l) { |
|
1628 | - if(TSubtotal::isSubtotal($l)) { |
|
1627 | + foreach ($object->lines as $k => &$l) { |
|
1628 | + if (TSubtotal::isSubtotal($l)) { |
|
1629 | 1629 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
1630 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1631 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1632 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1630 | + if (is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1631 | + if (!empty($parentTitle->id) && !empty($parentTitle->array_options['options_show_reduc'])) { |
|
1632 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1633 | 1633 | } |
1634 | 1634 | } |
1635 | 1635 | |
1636 | 1636 | |
1637 | 1637 | // Pas de hook sur les colonnes du PDF expédition, on unset les bonnes variables |
1638 | - if(($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
1638 | + if (($object->element == 'shipping' || $object->element == 'delivery') && $this->isModSubtotalLine($k, $object)) |
|
1639 | 1639 | { |
1640 | 1640 | $l->qty = $l->qty_asked; |
1641 | 1641 | unset($l->qty_asked, $l->qty_shipped, $l->volume, $l->weight); |
1642 | 1642 | } |
1643 | 1643 | } |
1644 | 1644 | |
1645 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1646 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1645 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1646 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1647 | 1647 | |
1648 | 1648 | if ($hideInnerLines) { // si c une ligne de titre |
1649 | - $fk_parent_line=0; |
|
1650 | - $TLines =array(); |
|
1649 | + $fk_parent_line = 0; |
|
1650 | + $TLines = array(); |
|
1651 | 1651 | |
1652 | - $original_count=count($object->lines); |
|
1652 | + $original_count = count($object->lines); |
|
1653 | 1653 | $TTvas = array(); // tableau de tva |
1654 | 1654 | |
1655 | - foreach($object->lines as $k=>&$line) |
|
1655 | + foreach ($object->lines as $k=>&$line) |
|
1656 | 1656 | { |
1657 | 1657 | |
1658 | - if($line->product_type==9 && $line->rowid>0) |
|
1658 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1659 | 1659 | { |
1660 | 1660 | $fk_parent_line = $line->rowid; |
1661 | 1661 | |
1662 | 1662 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
1663 | - if(TSubtotal::isSubtotal($line)) |
|
1663 | + if (TSubtotal::isSubtotal($line)) |
|
1664 | 1664 | { |
1665 | 1665 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1666 | 1666 | |
@@ -1691,22 +1691,22 @@ discard block |
||
1691 | 1691 | |
1692 | 1692 | if ($hideInnerLines) |
1693 | 1693 | { |
1694 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1694 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1695 | 1695 | { |
1696 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1696 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1697 | 1697 | |
1698 | 1698 | // on remplit le tableau de tva pour substituer les lignes cachées |
1699 | 1699 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1700 | 1700 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1701 | 1701 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1702 | 1702 | } |
1703 | - if($line->product_type==9 && $line->rowid>0) |
|
1703 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1704 | 1704 | { |
1705 | 1705 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1706 | 1706 | // génère des lignes d'affichage des montants HT soumis à tva |
1707 | 1707 | $nbtva = count($TTvas); |
1708 | - if(!empty($nbtva)){ |
|
1709 | - foreach ($TTvas as $tx =>$val){ |
|
1708 | + if (!empty($nbtva)) { |
|
1709 | + foreach ($TTvas as $tx =>$val) { |
|
1710 | 1710 | $l = clone $line; |
1711 | 1711 | $l->product_type = 1; |
1712 | 1712 | $l->special_code = ''; |
@@ -1727,7 +1727,7 @@ discard block |
||
1727 | 1727 | } |
1728 | 1728 | } else { |
1729 | 1729 | |
1730 | - if($line->product_type==9 && $line->rowid>0) |
|
1730 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1731 | 1731 | { |
1732 | 1732 | // ajoute la ligne de sous-total |
1733 | 1733 | $TLines[] = $line; |
@@ -1755,9 +1755,9 @@ discard block |
||
1755 | 1755 | |
1756 | 1756 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1757 | 1757 | $nbtva = count($TTvas); |
1758 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1758 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1759 | 1759 | { |
1760 | - foreach ($TTvas as $tx =>$val){ |
|
1760 | + foreach ($TTvas as $tx =>$val) { |
|
1761 | 1761 | $l = clone $line; |
1762 | 1762 | $l->product_type = 1; |
1763 | 1763 | $l->special_code = ''; |
@@ -1774,11 +1774,11 @@ discard block |
||
1774 | 1774 | } |
1775 | 1775 | |
1776 | 1776 | global $nblignes; |
1777 | - $nblignes=count($TLines); |
|
1777 | + $nblignes = count($TLines); |
|
1778 | 1778 | |
1779 | 1779 | $object->lines = $TLines; |
1780 | 1780 | |
1781 | - if($i>count($object->lines)) { |
|
1781 | + if ($i > count($object->lines)) { |
|
1782 | 1782 | $this->resprints = ''; |
1783 | 1783 | return 0; |
1784 | 1784 | } |
@@ -1787,55 +1787,55 @@ discard block |
||
1787 | 1787 | return 0; |
1788 | 1788 | } |
1789 | 1789 | |
1790 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1790 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1791 | 1791 | { |
1792 | 1792 | /** |
1793 | 1793 | * @var $pdf TCPDF |
1794 | 1794 | */ |
1795 | - global $pdf,$conf; |
|
1795 | + global $pdf, $conf; |
|
1796 | 1796 | |
1797 | - foreach($parameters as $key=>$value) { |
|
1797 | + foreach ($parameters as $key=>$value) { |
|
1798 | 1798 | ${$key} = $value; |
1799 | 1799 | } |
1800 | 1800 | |
1801 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1802 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1801 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1802 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1803 | 1803 | |
1804 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1804 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1805 | 1805 | |
1806 | 1806 | global $hideprices; |
1807 | 1807 | |
1808 | - if(!empty($hideprices)) { |
|
1809 | - foreach($object->lines as &$line) { |
|
1810 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1808 | + if (!empty($hideprices)) { |
|
1809 | + foreach ($object->lines as &$line) { |
|
1810 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1811 | 1811 | } |
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | $line = &$object->lines[$i]; |
1815 | 1815 | |
1816 | - if($object->element == 'delivery' && ! empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
1816 | + if ($object->element == 'delivery' && !empty($object->commande->expeditions[$line->fk_origin_line])) unset($object->commande->expeditions[$line->fk_origin_line]); |
|
1817 | 1817 | |
1818 | - if($line->info_bits>0) { // PAGE BREAK |
|
1818 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1819 | 1819 | $pdf->addPage(); |
1820 | 1820 | $posy = $pdf->GetY(); |
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | $label = $line->label; |
1824 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1824 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1825 | 1825 | |
1826 | - if(empty($label)) { |
|
1826 | + if (empty($label)) { |
|
1827 | 1827 | $label = $description; |
1828 | - $description=''; |
|
1828 | + $description = ''; |
|
1829 | 1829 | } |
1830 | 1830 | |
1831 | - if($line->qty>90) { |
|
1831 | + if ($line->qty > 90) { |
|
1832 | 1832 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1833 | 1833 | |
1834 | 1834 | $pageBefore = $pdf->getPage(); |
1835 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1835 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1836 | 1836 | $pageAfter = $pdf->getPage(); |
1837 | 1837 | |
1838 | - if($pageAfter>$pageBefore) { |
|
1838 | + if ($pageAfter > $pageBefore) { |
|
1839 | 1839 | //print "ST $pageAfter>$pageBefore<br>"; |
1840 | 1840 | $pdf->rollbackTransaction(true); |
1841 | 1841 | $pdf->addPage('', '', true); |
@@ -1846,9 +1846,9 @@ discard block |
||
1846 | 1846 | } |
1847 | 1847 | |
1848 | 1848 | // On delivery PDF, we don't want quantities to appear and there are no hooks => setting text color to background color; |
1849 | - if($object->element == 'delivery') |
|
1849 | + if ($object->element == 'delivery') |
|
1850 | 1850 | { |
1851 | - switch($line->qty) |
|
1851 | + switch ($line->qty) |
|
1852 | 1852 | { |
1853 | 1853 | case 99: |
1854 | 1854 | $grey = 220; |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | else if ($line->qty < 10) { |
1872 | 1872 | $pageBefore = $pdf->getPage(); |
1873 | 1873 | |
1874 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1874 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1875 | 1875 | $pageAfter = $pdf->getPage(); |
1876 | 1876 | |
1877 | 1877 | |
@@ -1887,9 +1887,9 @@ discard block |
||
1887 | 1887 | } |
1888 | 1888 | */ |
1889 | 1889 | |
1890 | - if($object->element == 'delivery') |
|
1890 | + if ($object->element == 'delivery') |
|
1891 | 1891 | { |
1892 | - $pdf->SetTextColor(255,255,255); |
|
1892 | + $pdf->SetTextColor(255, 255, 255); |
|
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | $posy = $pdf->GetY(); |
@@ -1952,9 +1952,9 @@ discard block |
||
1952 | 1952 | * @param $hookmanager HookManager |
1953 | 1953 | * @return int |
1954 | 1954 | */ |
1955 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1955 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1956 | 1956 | |
1957 | - global $conf,$langs,$user,$db,$bc; |
|
1957 | + global $conf, $langs, $user, $db, $bc; |
|
1958 | 1958 | |
1959 | 1959 | $num = &$parameters['num']; |
1960 | 1960 | $line = &$parameters['line']; |
@@ -1962,33 +1962,33 @@ discard block |
||
1962 | 1962 | |
1963 | 1963 | $var = &$parameters['var']; |
1964 | 1964 | |
1965 | - $contexts = explode(':',$parameters['context']); |
|
1966 | - if($parameters['currentcontext'] === 'paiementcard') return 0; |
|
1965 | + $contexts = explode(':', $parameters['context']); |
|
1966 | + if ($parameters['currentcontext'] === 'paiementcard') return 0; |
|
1967 | 1967 | $originline = null; |
1968 | 1968 | |
1969 | 1969 | $createRight = $user->rights->{$object->element}->creer; |
1970 | - if($object->element == 'facturerec' ) |
|
1970 | + if ($object->element == 'facturerec') |
|
1971 | 1971 | { |
1972 | 1972 | $object->statut = 0; // hack for facture rec |
1973 | 1973 | $createRight = $user->rights->facture->creer; |
1974 | 1974 | } |
1975 | - elseif($object->element == 'order_supplier' ) |
|
1975 | + elseif ($object->element == 'order_supplier') |
|
1976 | 1976 | { |
1977 | 1977 | $createRight = $user->rights->fournisseur->commande->creer; |
1978 | 1978 | } |
1979 | - elseif($object->element == 'invoice_supplier' ) |
|
1979 | + elseif ($object->element == 'invoice_supplier') |
|
1980 | 1980 | { |
1981 | 1981 | $createRight = $user->rights->fournisseur->facture->creer; |
1982 | 1982 | } |
1983 | - elseif($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
1983 | + elseif ($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) |
|
1984 | 1984 | { |
1985 | 1985 | // H4cK 4n0nYm0u$-style : $line n'est pas un objet instancié mais provient d'un fetch_object d'une requête SQL |
1986 | 1986 | $line->id = $line->rowid; |
1987 | 1987 | $line->product_type = $line->type; |
1988 | 1988 | } |
1989 | - elseif($object->element == 'shipping' || $object->element == 'delivery') |
|
1989 | + elseif ($object->element == 'shipping' || $object->element == 'delivery') |
|
1990 | 1990 | { |
1991 | - if(empty($line->origin_line_id) && ! empty($line->fk_origin_line)) |
|
1991 | + if (empty($line->origin_line_id) && !empty($line->fk_origin_line)) |
|
1992 | 1992 | { |
1993 | 1993 | $line->origin_line_id = $line->fk_origin_line; |
1994 | 1994 | } |
@@ -1996,9 +1996,9 @@ discard block |
||
1996 | 1996 | $originline = new OrderLine($db); |
1997 | 1997 | $originline->fetch($line->fk_origin_line); |
1998 | 1998 | |
1999 | - foreach(get_object_vars($line) as $property => $value) |
|
1999 | + foreach (get_object_vars($line) as $property => $value) |
|
2000 | 2000 | { |
2001 | - if(empty($originline->{ $property })) |
|
2001 | + if (empty($originline->{ $property })) |
|
2002 | 2002 | { |
2003 | 2003 | $originline->{ $property } = $value; |
2004 | 2004 | } |
@@ -2006,13 +2006,13 @@ discard block |
||
2006 | 2006 | |
2007 | 2007 | $line = $originline; |
2008 | 2008 | } |
2009 | - if($object->element=='facture')$idvar = 'facid'; |
|
2010 | - else $idvar='id'; |
|
2011 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
2012 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
|
2009 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
2010 | + else $idvar = 'id'; |
|
2011 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
2012 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_LINE) && $object->element !== 'invoice_supplier') |
|
2013 | 2013 | { |
2014 | - if(!(TSubtotal::isModSubtotalLine($line)) && ( $line->fk_prev_id === null ) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
2015 | - echo '<a name="duplicate-'.$line->id.'" href="' . $_SERVER['PHP_SELF'] . '?' . $idvar . '=' . $object->id . '&action=duplicate&lineid=' . $line->id . '"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
2014 | + if (!(TSubtotal::isModSubtotalLine($line)) && ($line->fk_prev_id === null) && !($action == "editline" && GETPOST('lineid') == $line->id)) { |
|
2015 | + echo '<a name="duplicate-'.$line->id.'" href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'"><i class="fa fa-clone" aria-hidden="true"></i></a>'; |
|
2016 | 2016 | |
2017 | 2017 | ?> |
2018 | 2018 | <script type="text/javascript"> |
@@ -2026,11 +2026,11 @@ discard block |
||
2026 | 2026 | } |
2027 | 2027 | return 0; |
2028 | 2028 | } |
2029 | - 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)) |
|
2029 | + 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)) |
|
2030 | 2030 | { |
2031 | 2031 | |
2032 | 2032 | |
2033 | - if((float)DOL_VERSION <= 3.4) |
|
2033 | + if ((float) DOL_VERSION <= 3.4) |
|
2034 | 2034 | { |
2035 | 2035 | ?> |
2036 | 2036 | <script type="text/javascript"> |
@@ -2053,23 +2053,23 @@ discard block |
||
2053 | 2053 | </script> |
2054 | 2054 | <?php |
2055 | 2055 | } |
2056 | - if(empty($line->description)) $line->description = $line->desc; |
|
2056 | + if (empty($line->description)) $line->description = $line->desc; |
|
2057 | 2057 | $colspan = 5; |
2058 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
2059 | - if($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
2060 | - if($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4: $colspan = 7; |
|
2061 | - if($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
2062 | - if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
2058 | + if ($object->element == 'facturerec') $colspan = 3; |
|
2059 | + if ($object->element == 'order_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 3 : $colspan = 6; |
|
2060 | + if ($object->element == 'invoice_supplier') (float) DOL_VERSION < 7.0 ? $colspan = 4 : $colspan = 7; |
|
2061 | + if ($object->element == 'supplier_proposal') (float) DOL_VERSION < 6.0 ? $colspan = 4 : $colspan = 3; |
|
2062 | + if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
2063 | 2063 | $colspan++; // Colonne PU Devise |
2064 | 2064 | } |
2065 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
2065 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
2066 | 2066 | |
2067 | 2067 | $margins_hidden_by_module = empty($conf->affmarges->enabled) ? false : !($_SESSION['marginsdisplayed']); |
2068 | - if(!empty($conf->margin->enabled) && !$margins_hidden_by_module) $colspan++; |
|
2069 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES) && !$margins_hidden_by_module) $colspan++; |
|
2070 | - if(!empty($conf->global->DISPLAY_MARK_RATES) && !$margins_hidden_by_module) $colspan++; |
|
2071 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
2072 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
2068 | + if (!empty($conf->margin->enabled) && !$margins_hidden_by_module) $colspan++; |
|
2069 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES) && !$margins_hidden_by_module) $colspan++; |
|
2070 | + if (!empty($conf->global->DISPLAY_MARK_RATES) && !$margins_hidden_by_module) $colspan++; |
|
2071 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
2072 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
2073 | 2073 | |
2074 | 2074 | /* Titre */ |
2075 | 2075 | //var_dump($line); |
@@ -2079,39 +2079,39 @@ discard block |
||
2079 | 2079 | |
2080 | 2080 | |
2081 | 2081 | ?> |
2082 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2082 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2083 | 2083 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
2084 | 2084 | { |
2085 | - if($line->qty==99) print 'background:#adadcf'; |
|
2086 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2087 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
2088 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
2089 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
2090 | - else if($line->qty==50) print ''; |
|
2085 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
2086 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2087 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
2088 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
2089 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
2090 | + else if ($line->qty == 50) print ''; |
|
2091 | 2091 | else print 'background:#eeeeff;'; |
2092 | 2092 | |
2093 | 2093 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
2094 | 2094 | } |
2095 | 2095 | else |
2096 | 2096 | { |
2097 | - if($line->qty==99) print 'background:#ddffdd'; |
|
2098 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2099 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
2100 | - else if($line->qty==50) print ''; |
|
2101 | - else print 'background:#eeffee;' ; |
|
2097 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
2098 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2099 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
2100 | + else if ($line->qty == 50) print ''; |
|
2101 | + else print 'background:#eeffee;'; |
|
2102 | 2102 | } |
2103 | 2103 | |
2104 | 2104 | ?>;"> |
2105 | 2105 | |
2106 | - <?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
2106 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
2107 | 2107 | <td class="linecolnum"><?php echo $i + 1; ?></td> |
2108 | 2108 | <?php } ?> |
2109 | 2109 | |
2110 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
2111 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2110 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
2111 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2112 | 2112 | |
2113 | - $params=array('line'=>$line); |
|
2114 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
2113 | + $params = array('line'=>$line); |
|
2114 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
2115 | 2115 | |
2116 | 2116 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
2117 | 2117 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -2119,7 +2119,7 @@ discard block |
||
2119 | 2119 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
2120 | 2120 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
2121 | 2121 | |
2122 | - $isFreeText=false; |
|
2122 | + $isFreeText = false; |
|
2123 | 2123 | if (TSubtotal::isTitle($line)) |
2124 | 2124 | { |
2125 | 2125 | $qty_displayed = $line->qty; |
@@ -2141,13 +2141,13 @@ discard block |
||
2141 | 2141 | $line->description = ''; |
2142 | 2142 | } |
2143 | 2143 | $newlabel = $line->label; |
2144 | - if($line->label=='' && !$isFreeText) { |
|
2145 | - if(TSubtotal::isSubtotal($line)) { |
|
2144 | + if ($line->label == '' && !$isFreeText) { |
|
2145 | + if (TSubtotal::isSubtotal($line)) { |
|
2146 | 2146 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
2147 | - $line->description=''; |
|
2148 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
2149 | - $newlabel= $line->description; |
|
2150 | - $line->description=''; |
|
2147 | + $line->description = ''; |
|
2148 | + } elseif ((float) DOL_VERSION < 6) { |
|
2149 | + $newlabel = $line->description; |
|
2150 | + $line->description = ''; |
|
2151 | 2151 | } |
2152 | 2152 | } |
2153 | 2153 | |
@@ -2156,10 +2156,10 @@ discard block |
||
2156 | 2156 | |
2157 | 2157 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
2158 | 2158 | |
2159 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
2159 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
2160 | 2160 | { |
2161 | 2161 | $select = '<select name="subtotal_level">'; |
2162 | - for ($j=1; $j<10; $j++) |
|
2162 | + for ($j = 1; $j < 10; $j++) |
|
2163 | 2163 | { |
2164 | 2164 | if (!empty($readonlyForSituation)) { |
2165 | 2165 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -2173,7 +2173,7 @@ discard block |
||
2173 | 2173 | |
2174 | 2174 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
2175 | 2175 | echo '<div>'; |
2176 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2176 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
2177 | 2177 | echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
2178 | 2178 | echo '</div>'; |
2179 | 2179 | |
@@ -2194,12 +2194,12 @@ discard block |
||
2194 | 2194 | echo '</div>'; |
2195 | 2195 | } |
2196 | 2196 | echo '<div>'; |
2197 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2197 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '').' /> '; |
|
2198 | 2198 | echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
2199 | 2199 | echo '</div>'; |
2200 | 2200 | |
2201 | 2201 | echo '<div>'; |
2202 | - 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"' : '') .' /> '; |
|
2202 | + 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"' : '').' /> '; |
|
2203 | 2203 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2204 | 2204 | echo '</div>'; |
2205 | 2205 | } |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | if (TSubtotal::isTitle($line)) |
2210 | 2210 | { |
2211 | 2211 | // WYSIWYG editor |
2212 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
2212 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
2213 | 2213 | $nbrows = ROWS_2; |
2214 | 2214 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
2215 | 2215 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -2251,25 +2251,25 @@ discard block |
||
2251 | 2251 | |
2252 | 2252 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2253 | 2253 | { |
2254 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2254 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2255 | 2255 | { |
2256 | - echo str_repeat(' ', $line->qty-1); |
|
2256 | + echo str_repeat(' ', $line->qty - 1); |
|
2257 | 2257 | |
2258 | 2258 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
2259 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2259 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
2260 | 2260 | } |
2261 | 2261 | } |
2262 | 2262 | else |
2263 | 2263 | { |
2264 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2265 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2264 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2265 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2266 | 2266 | } |
2267 | 2267 | |
2268 | 2268 | |
2269 | 2269 | // Get display styles and apply them |
2270 | 2270 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2271 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2272 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2271 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2272 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2273 | 2273 | |
2274 | 2274 | if (empty($line->label)) { |
2275 | 2275 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2277,16 +2277,16 @@ discard block |
||
2277 | 2277 | } |
2278 | 2278 | else { |
2279 | 2279 | |
2280 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2280 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2281 | 2281 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2282 | 2282 | } |
2283 | - else{ |
|
2283 | + else { |
|
2284 | 2284 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2285 | 2285 | } |
2286 | 2286 | |
2287 | 2287 | } |
2288 | - if($line->qty>90) print ' : '; |
|
2289 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2288 | + if ($line->qty > 90) print ' : '; |
|
2289 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2290 | 2290 | |
2291 | 2291 | |
2292 | 2292 | |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | ?></td> |
2296 | 2296 | |
2297 | 2297 | <?php |
2298 | - if($line->qty>90) { |
|
2298 | + if ($line->qty > 90) { |
|
2299 | 2299 | /* Total */ |
2300 | 2300 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
2301 | 2301 | echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2314,7 +2314,7 @@ discard block |
||
2314 | 2314 | <?php |
2315 | 2315 | if ($action != 'selectlines') { |
2316 | 2316 | |
2317 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2317 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2318 | 2318 | ?> |
2319 | 2319 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
2320 | 2320 | <br /> |
@@ -2330,13 +2330,13 @@ discard block |
||
2330 | 2330 | <?php |
2331 | 2331 | |
2332 | 2332 | } |
2333 | - else{ |
|
2334 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2333 | + else { |
|
2334 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2335 | 2335 | { |
2336 | - if(TSubtotal::isTitle($line) && ( $line->fk_prev_id === null )) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2336 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2337 | 2337 | } |
2338 | 2338 | |
2339 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2339 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2340 | 2340 | { |
2341 | 2341 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
2342 | 2342 | } |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | <?php |
2352 | 2352 | |
2353 | 2353 | if ($action != 'editline' && $action != 'selectlines') { |
2354 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2354 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2355 | 2355 | { |
2356 | 2356 | |
2357 | 2357 | if ($line->fk_prev_id === null) |
@@ -2359,12 +2359,12 @@ discard block |
||
2359 | 2359 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
2360 | 2360 | } |
2361 | 2361 | |
2362 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
2362 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
2363 | 2363 | { |
2364 | 2364 | if ((float) DOL_VERSION >= 8.0) { |
2365 | 2365 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
2366 | 2366 | } elseif ((float) DOL_VERSION >= 3.8) { |
2367 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
2367 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
2368 | 2368 | } else { |
2369 | 2369 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
2370 | 2370 | } |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
2375 | 2375 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
2376 | 2376 | */ |
2377 | - if((float) DOL_VERSION >= 8.0) { |
|
2377 | + if ((float) DOL_VERSION >= 8.0) { |
|
2378 | 2378 | ?> |
2379 | 2379 | <script> |
2380 | 2380 | $(document).ready(function () { |
@@ -2390,7 +2390,7 @@ discard block |
||
2390 | 2390 | </td> |
2391 | 2391 | |
2392 | 2392 | <?php |
2393 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2393 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2394 | 2394 | { |
2395 | 2395 | echo '<td class="subtotal_nc">'; |
2396 | 2396 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -2401,12 +2401,12 @@ discard block |
||
2401 | 2401 | <td align="center" class="linecolmove tdlineupdown"> |
2402 | 2402 | </td> |
2403 | 2403 | <?php } else { ?> |
2404 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
2404 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
2405 | 2405 | <?php } ?> |
2406 | 2406 | |
2407 | 2407 | |
2408 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
2409 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2408 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
2409 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2410 | 2410 | <?php } ?> |
2411 | 2411 | |
2412 | 2412 | </tr> |
@@ -2414,29 +2414,29 @@ discard block |
||
2414 | 2414 | |
2415 | 2415 | |
2416 | 2416 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2417 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2417 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2418 | 2418 | |
2419 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2419 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2420 | 2420 | |
2421 | 2421 | // Extrafields |
2422 | 2422 | $extrafieldsline = new ExtraFields($db); |
2423 | 2423 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2424 | 2424 | |
2425 | - $colspan+=3; $mode = 'view'; |
|
2426 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2425 | + $colspan += 3; $mode = 'view'; |
|
2426 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2427 | 2427 | |
2428 | 2428 | $ex_element = $line->element; |
2429 | 2429 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2430 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2430 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2431 | 2431 | $isExtraSelected = false; |
2432 | - foreach($line->array_options as $option) { |
|
2433 | - if(!empty($option) && $option != "-1") { |
|
2432 | + foreach ($line->array_options as $option) { |
|
2433 | + if (!empty($option) && $option != "-1") { |
|
2434 | 2434 | $isExtraSelected = true; |
2435 | 2435 | break; |
2436 | 2436 | } |
2437 | 2437 | } |
2438 | 2438 | |
2439 | - if($mode === 'edit') { |
|
2439 | + if ($mode === 'edit') { |
|
2440 | 2440 | ?> |
2441 | 2441 | <script> |
2442 | 2442 | $(document).ready(function(){ |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2445 | 2445 | <?php |
2446 | 2446 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2447 | - if(!$isExtraSelected) { |
|
2447 | + if (!$isExtraSelected) { |
|
2448 | 2448 | echo 'all_tr_extrafields.hide();'; |
2449 | 2449 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2450 | 2450 | echo 'var extra = 0;'; |
@@ -2483,61 +2483,61 @@ discard block |
||
2483 | 2483 | return 1; |
2484 | 2484 | |
2485 | 2485 | } |
2486 | - elseif(($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
2486 | + elseif (($object->element == 'commande' && in_array('ordershipmentcard', $contexts)) || (in_array('expeditioncard', $contexts) && $action == 'create')) |
|
2487 | 2487 | { |
2488 | 2488 | $colspan = 4; |
2489 | 2489 | |
2490 | 2490 | // HTML 5 data for js |
2491 | 2491 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
2492 | 2492 | ?> |
2493 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2493 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2494 | 2494 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
2495 | 2495 | { |
2496 | - if($line->qty==99) print 'background:#adadcf'; |
|
2497 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2498 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
2499 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
2500 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
2501 | - else if($line->qty==50) print ''; |
|
2496 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
2497 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2498 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
2499 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
2500 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
2501 | + else if ($line->qty == 50) print ''; |
|
2502 | 2502 | else print 'background:#eeeeff;'; |
2503 | 2503 | |
2504 | 2504 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
2505 | 2505 | } |
2506 | 2506 | else |
2507 | 2507 | { |
2508 | - if($line->qty==99) print 'background:#ddffdd'; |
|
2509 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2510 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
2511 | - else if($line->qty==50) print ''; |
|
2512 | - else print 'background:#eeffee;' ; |
|
2508 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
2509 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2510 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
2511 | + else if ($line->qty == 50) print ''; |
|
2512 | + else print 'background:#eeffee;'; |
|
2513 | 2513 | } |
2514 | 2514 | |
2515 | 2515 | ?>;"> |
2516 | 2516 | |
2517 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
2517 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
2518 | 2518 | |
2519 | 2519 | |
2520 | 2520 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2521 | 2521 | { |
2522 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2522 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2523 | 2523 | { |
2524 | - echo str_repeat(' ', $line->qty-1); |
|
2524 | + echo str_repeat(' ', $line->qty - 1); |
|
2525 | 2525 | |
2526 | 2526 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
2527 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2527 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
2528 | 2528 | } |
2529 | 2529 | } |
2530 | 2530 | else |
2531 | 2531 | { |
2532 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2533 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2532 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2533 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2534 | 2534 | } |
2535 | 2535 | |
2536 | 2536 | |
2537 | 2537 | // Get display styles and apply them |
2538 | 2538 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2539 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2540 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2539 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2540 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2541 | 2541 | |
2542 | 2542 | if (empty($line->label)) { |
2543 | 2543 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2545,22 +2545,22 @@ discard block |
||
2545 | 2545 | } |
2546 | 2546 | else { |
2547 | 2547 | |
2548 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2548 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2549 | 2549 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2550 | 2550 | } |
2551 | - else{ |
|
2551 | + else { |
|
2552 | 2552 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2553 | 2553 | } |
2554 | 2554 | |
2555 | 2555 | } |
2556 | 2556 | //if($line->qty>90) print ' : '; |
2557 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2557 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2558 | 2558 | |
2559 | 2559 | ?> |
2560 | 2560 | </td> |
2561 | 2561 | <td colspan="<?php echo $colspan; ?>"> |
2562 | 2562 | <?php |
2563 | - if(in_array('expeditioncard', $contexts) && $action == 'create') |
|
2563 | + if (in_array('expeditioncard', $contexts) && $action == 'create') |
|
2564 | 2564 | { |
2565 | 2565 | $fk_entrepot = GETPOST('entrepot_id', 'int'); |
2566 | 2566 | ?> |
@@ -2587,100 +2587,100 @@ discard block |
||
2587 | 2587 | $shipment_static = new Expedition($db); |
2588 | 2588 | $warehousestatic = new Entrepot($db); |
2589 | 2589 | $extrafieldsline = new ExtraFields($db); |
2590 | - $extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
2590 | + $extralabelslines = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
|
2591 | 2591 | |
2592 | 2592 | $colspan = 4; |
2593 | - if($object->origin && $object->origin_id > 0) $colspan++; |
|
2594 | - if(! empty($conf->stock->enabled)) $colspan++; |
|
2595 | - if(! empty($conf->productbatch->enabled)) $colspan++; |
|
2596 | - if($object->statut == 0) $colspan++; |
|
2597 | - if($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
2593 | + if ($object->origin && $object->origin_id > 0) $colspan++; |
|
2594 | + if (!empty($conf->stock->enabled)) $colspan++; |
|
2595 | + if (!empty($conf->productbatch->enabled)) $colspan++; |
|
2596 | + if ($object->statut == 0) $colspan++; |
|
2597 | + if ($object->statut == 0 && empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) $colspan++; |
|
2598 | 2598 | |
2599 | - if($object->element == 'delivery') $colspan = 2; |
|
2599 | + if ($object->element == 'delivery') $colspan = 2; |
|
2600 | 2600 | |
2601 | 2601 | print '<!-- origin line id = '.$line->origin_line_id.' -->'; // id of order line |
2602 | 2602 | |
2603 | 2603 | // HTML 5 data for js |
2604 | 2604 | $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
2605 | 2605 | ?> |
2606 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2606 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
2607 | 2607 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
2608 | 2608 | { |
2609 | - if($line->qty==99) print 'background:#adadcf'; |
|
2610 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2611 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
2612 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
2613 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
2614 | - else if($line->qty==50) print ''; |
|
2609 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
2610 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2611 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
2612 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
2613 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
2614 | + else if ($line->qty == 50) print ''; |
|
2615 | 2615 | else print 'background:#eeeeff;'; |
2616 | 2616 | |
2617 | 2617 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
2618 | 2618 | } |
2619 | 2619 | else |
2620 | 2620 | { |
2621 | - if($line->qty==99) print 'background:#ddffdd'; |
|
2622 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2623 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
2624 | - else if($line->qty==50) print ''; |
|
2625 | - else print 'background:#eeffee;' ; |
|
2621 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
2622 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2623 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
2624 | + else if ($line->qty == 50) print ''; |
|
2625 | + else print 'background:#eeffee;'; |
|
2626 | 2626 | } |
2627 | 2627 | |
2628 | 2628 | ?>;"> |
2629 | 2629 | |
2630 | 2630 | <?php |
2631 | 2631 | // # |
2632 | - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2632 | + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) |
|
2633 | 2633 | { |
2634 | - print '<td align="center">'.($i+1).'</td>'; |
|
2634 | + print '<td align="center">'.($i + 1).'</td>'; |
|
2635 | 2635 | } |
2636 | 2636 | ?> |
2637 | 2637 | |
2638 | - <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
2638 | + <td style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
2639 | 2639 | |
2640 | 2640 | |
2641 | 2641 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2642 | 2642 | { |
2643 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2643 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2644 | 2644 | { |
2645 | - echo str_repeat(' ', $line->qty-1); |
|
2645 | + echo str_repeat(' ', $line->qty - 1); |
|
2646 | 2646 | |
2647 | 2647 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
2648 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2648 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
2649 | 2649 | } |
2650 | 2650 | } |
2651 | 2651 | else |
2652 | 2652 | { |
2653 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2654 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2653 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2654 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2655 | 2655 | } |
2656 | 2656 | |
2657 | 2657 | |
2658 | 2658 | // Get display styles and apply them |
2659 | 2659 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2660 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2661 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2660 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2661 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2662 | 2662 | |
2663 | 2663 | if (empty($line->label)) { |
2664 | 2664 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
2665 | 2665 | else print $line->description; |
2666 | 2666 | } |
2667 | 2667 | else { |
2668 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2668 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2669 | 2669 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2670 | 2670 | } |
2671 | - else{ |
|
2671 | + else { |
|
2672 | 2672 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2673 | 2673 | } |
2674 | 2674 | } |
2675 | 2675 | //if($line->qty>90) print ' : '; |
2676 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2676 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2677 | 2677 | |
2678 | 2678 | ?> |
2679 | 2679 | </td> |
2680 | 2680 | <td colspan="<?php echo $colspan; ?>"> </td> |
2681 | 2681 | <?php |
2682 | 2682 | |
2683 | - if ($object->element == 'shipping' && $object->statut == 0 && ! empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2683 | + if ($object->element == 'shipping' && $object->statut == 0 && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2684 | 2684 | { |
2685 | 2685 | print '<td class="linecoldelete nowrap" width="10">'; |
2686 | 2686 | |
@@ -2689,12 +2689,12 @@ discard block |
||
2689 | 2689 | echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
2690 | 2690 | } |
2691 | 2691 | |
2692 | - if(TSubtotal::isTitle($line) && ($line->fk_prev_id === null) ) |
|
2692 | + if (TSubtotal::isTitle($line) && ($line->fk_prev_id === null)) |
|
2693 | 2693 | { |
2694 | 2694 | if ((float) DOL_VERSION >= 8.0) { |
2695 | 2695 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
2696 | 2696 | } elseif ((float) DOL_VERSION >= 3.8) { |
2697 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
2697 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
2698 | 2698 | } else { |
2699 | 2699 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
2700 | 2700 | } |
@@ -2704,7 +2704,7 @@ discard block |
||
2704 | 2704 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
2705 | 2705 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
2706 | 2706 | */ |
2707 | - if((float) DOL_VERSION >= 8.0) { |
|
2707 | + if ((float) DOL_VERSION >= 8.0) { |
|
2708 | 2708 | ?> |
2709 | 2709 | <script> |
2710 | 2710 | $(document).ready(function () { |
@@ -2722,11 +2722,11 @@ discard block |
||
2722 | 2722 | print "</tr>"; |
2723 | 2723 | |
2724 | 2724 | // Display lines extrafields |
2725 | - if ($object->element == 'shipping' && ! empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines)>0) { |
|
2725 | + if ($object->element == 'shipping' && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE) && is_array($extralabelslines) && count($extralabelslines) > 0) { |
|
2726 | 2726 | $line = new ExpeditionLigne($db); |
2727 | 2727 | $line->fetch_optionals($line->id); |
2728 | 2728 | print '<tr class="oddeven">'; |
2729 | - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$i); |
|
2729 | + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan), $i); |
|
2730 | 2730 | } |
2731 | 2731 | |
2732 | 2732 | return 1; |
@@ -2738,20 +2738,20 @@ discard block |
||
2738 | 2738 | |
2739 | 2739 | |
2740 | 2740 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2741 | - global $conf,$langs; |
|
2741 | + global $conf, $langs; |
|
2742 | 2742 | |
2743 | 2743 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2744 | 2744 | { |
2745 | 2745 | |
2746 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2746 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2747 | 2747 | { |
2748 | 2748 | foreach ($object->lines as $line) |
2749 | 2749 | { |
2750 | 2750 | // fetch optionals attributes and labels |
2751 | 2751 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2752 | - $extrafields=new ExtraFields($this->db); |
|
2753 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2754 | - $line->fetch_optionals($line->id,$extralabels); |
|
2752 | + $extrafields = new ExtraFields($this->db); |
|
2753 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2754 | + $line->fetch_optionals($line->id, $extralabels); |
|
2755 | 2755 | } |
2756 | 2756 | } |
2757 | 2757 | |
@@ -2851,23 +2851,23 @@ discard block |
||
2851 | 2851 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2852 | 2852 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2853 | 2853 | |
2854 | - if(TSubtotal::isTitle($line)){ |
|
2854 | + if (TSubtotal::isTitle($line)) { |
|
2855 | 2855 | $ThtmlData['data-issubtotal'] = 'title'; |
2856 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2856 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2857 | 2857 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2858 | 2858 | } |
2859 | - else{ |
|
2859 | + else { |
|
2860 | 2860 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2861 | 2861 | } |
2862 | 2862 | |
2863 | 2863 | |
2864 | 2864 | // Change or add data from hooks |
2865 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2865 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2866 | 2866 | |
2867 | 2867 | // hook |
2868 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2868 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2869 | 2869 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2870 | - if ($reshook>0) |
|
2870 | + if ($reshook > 0) |
|
2871 | 2871 | { |
2872 | 2872 | $ThtmlData = $hookmanager->resArray; |
2873 | 2873 | } |
@@ -2880,14 +2880,14 @@ discard block |
||
2880 | 2880 | function implodeHtmlData($ThtmlData = array()) |
2881 | 2881 | { |
2882 | 2882 | $data = ''; |
2883 | - foreach($ThtmlData as $k => $h ) |
|
2883 | + foreach ($ThtmlData as $k => $h) |
|
2884 | 2884 | { |
2885 | - if(is_array($h)) |
|
2885 | + if (is_array($h)) |
|
2886 | 2886 | { |
2887 | 2887 | $h = json_encode($h); |
2888 | 2888 | } |
2889 | 2889 | |
2890 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2890 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2891 | 2891 | } |
2892 | 2892 | |
2893 | 2893 | return $data; |
@@ -2895,26 +2895,26 @@ discard block |
||
2895 | 2895 | |
2896 | 2896 | function _ajax_block_order_js($object) |
2897 | 2897 | { |
2898 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2898 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2899 | 2899 | |
2900 | 2900 | /* |
2901 | 2901 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2902 | 2902 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2903 | 2903 | */ |
2904 | 2904 | |
2905 | - $id=$object->id; |
|
2906 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2907 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2905 | + $id = $object->id; |
|
2906 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2907 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2908 | 2908 | |
2909 | - $id=$object->id; |
|
2910 | - $fk_element=$object->fk_element; |
|
2911 | - $table_element_line=$object->table_element_line; |
|
2912 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2913 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2914 | - $filepath=(empty($filepath)?'':$filepath); |
|
2909 | + $id = $object->id; |
|
2910 | + $fk_element = $object->fk_element; |
|
2911 | + $table_element_line = $object->table_element_line; |
|
2912 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2913 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2914 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2915 | 2915 | |
2916 | 2916 | |
2917 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2917 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2918 | 2918 | { |
2919 | 2919 | |
2920 | 2920 | ?> |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | moveBlockCol.disableSelection(); // prevent selection |
2933 | 2933 | <?php if ($object->statut == 0) { ?> |
2934 | 2934 | // apply some graphical stuff |
2935 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2935 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2936 | 2936 | moveBlockCol.css("background-repeat","no-repeat"); |
2937 | 2937 | moveBlockCol.css("background-position","center center"); |
2938 | 2938 | moveBlockCol.css("cursor","move"); |