@@ -51,43 +51,43 @@ discard block |
||
51 | 51 | |
52 | 52 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
53 | 53 | { |
54 | - global $langs,$db,$user, $conf; |
|
54 | + global $langs, $db, $user, $conf; |
|
55 | 55 | |
56 | 56 | $langs->load('subtotal@subtotal'); |
57 | 57 | |
58 | - $contexts = explode(':',$parameters['context']); |
|
58 | + $contexts = explode(':', $parameters['context']); |
|
59 | 59 | |
60 | - 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)) { |
|
60 | + 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)) { |
|
61 | 61 | |
62 | 62 | $createRight = $user->rights->{$object->element}->creer; |
63 | - if($object->element == 'facturerec' ) |
|
63 | + if ($object->element == 'facturerec') |
|
64 | 64 | { |
65 | 65 | $object->statut = 0; // hack for facture rec |
66 | 66 | $createRight = $user->rights->facture->creer; |
67 | - } elseif($object->element == 'order_supplier' ) |
|
67 | + } elseif ($object->element == 'order_supplier') |
|
68 | 68 | { |
69 | 69 | $createRight = $user->rights->fournisseur->commande->creer; |
70 | - } elseif($object->element == 'invoice_supplier' ) |
|
70 | + } elseif ($object->element == 'invoice_supplier') |
|
71 | 71 | { |
72 | 72 | $createRight = $user->rights->fournisseur->facture->creer; |
73 | 73 | } |
74 | 74 | |
75 | - if ($object->statut == 0 && $createRight) { |
|
75 | + if ($object->statut == 0 && $createRight) { |
|
76 | 76 | |
77 | 77 | |
78 | - if($object->element=='facture')$idvar = 'facid'; |
|
79 | - else $idvar='id'; |
|
78 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
79 | + else $idvar = 'id'; |
|
80 | 80 | |
81 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
81 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
82 | 82 | { |
83 | 83 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
84 | 84 | |
85 | - if($action=='add_title_line') { |
|
85 | + if ($action == 'add_title_line') { |
|
86 | 86 | $title = GETPOST('title'); |
87 | - if(empty($title)) $title = $langs->trans('title'); |
|
88 | - $qty = $level<1 ? 1 : $level ; |
|
87 | + if (empty($title)) $title = $langs->trans('title'); |
|
88 | + $qty = $level < 1 ? 1 : $level; |
|
89 | 89 | } |
90 | - else if($action=='add_free_text') { |
|
90 | + else if ($action == 'add_free_text') { |
|
91 | 91 | $title = GETPOST('title'); |
92 | 92 | |
93 | 93 | if (empty($title)) { |
@@ -99,21 +99,21 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
102 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
103 | 103 | $qty = 50; |
104 | 104 | } |
105 | - else if($action=='add_subtitle_line') { |
|
105 | + else if ($action == 'add_subtitle_line') { |
|
106 | 106 | $title = GETPOST('title'); |
107 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
107 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
108 | 108 | $qty = 2; |
109 | 109 | } |
110 | - else if($action=='add_subtotal_line') { |
|
110 | + else if ($action == 'add_subtotal_line') { |
|
111 | 111 | $title = $langs->trans('SubSubTotal'); |
112 | 112 | $qty = 98; |
113 | 113 | } |
114 | 114 | else { |
115 | 115 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
116 | - $qty = $level ? 100-$level : 99; |
|
116 | + $qty = $level ? 100 - $level : 99; |
|
117 | 117 | } |
118 | 118 | dol_include_once('/subtotal/class/subtotal.class.php'); |
119 | 119 | |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | |
122 | 122 | TSubtotal::addSubTotalLine($object, $title, $qty); |
123 | 123 | } |
124 | - else if($action==='ask_deleteallline') { |
|
125 | - $form=new Form($db); |
|
124 | + else if ($action === 'ask_deleteallline') { |
|
125 | + $form = new Form($db); |
|
126 | 126 | |
127 | - $lineid = GETPOST('lineid','integer'); |
|
127 | + $lineid = GETPOST('lineid', 'integer'); |
|
128 | 128 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
129 | 129 | |
130 | 130 | $nbLines = count($TIdForGroup); |
131 | 131 | |
132 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
132 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
133 | 133 | print $formconfirm; |
134 | 134 | } |
135 | 135 | |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | |
142 | - if($action!='editline') { |
|
142 | + if ($action != 'editline') { |
|
143 | 143 | // New format is for 3.8 |
144 | 144 | $this->printNewFormat($object, $conf, $langs, $idvar); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | } |
148 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
148 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
149 | 149 | { |
150 | 150 | ?> |
151 | 151 | <script type="text/javascript"> |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $(document).ready(function() { |
171 | 171 | $('div.fiche div.tabsAction').append('<br />'); |
172 | 172 | |
173 | - $('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>'); |
|
173 | + $('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>'); |
|
174 | 174 | $('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>'); |
175 | 175 | $('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>'); |
176 | 176 | |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $('body').append(dialog_html); |
222 | 222 | |
223 | 223 | <?php |
224 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
225 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
226 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
224 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
225 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
226 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
227 | 227 | ?> |
228 | 228 | if (action == 'addTitle' || action == 'addFreeTxt') |
229 | 229 | { |
@@ -338,62 +338,62 @@ discard block |
||
338 | 338 | global $conf, $langs, $bc; |
339 | 339 | |
340 | 340 | $action = GETPOST('action'); |
341 | - $TContext = explode(':',$parameters['context']); |
|
341 | + $TContext = explode(':', $parameters['context']); |
|
342 | 342 | if ( |
343 | - in_array('invoicecard',$TContext) |
|
344 | - || in_array('invoicesuppliercard',$TContext) |
|
345 | - || in_array('propalcard',$TContext) |
|
346 | - || in_array('ordercard',$TContext) |
|
347 | - || in_array('ordersuppliercard',$TContext) |
|
348 | - || in_array('invoicereccard',$TContext) |
|
343 | + in_array('invoicecard', $TContext) |
|
344 | + || in_array('invoicesuppliercard', $TContext) |
|
345 | + || in_array('propalcard', $TContext) |
|
346 | + || in_array('ordercard', $TContext) |
|
347 | + || in_array('ordersuppliercard', $TContext) |
|
348 | + || in_array('invoicereccard', $TContext) |
|
349 | 349 | ) |
350 | 350 | { |
351 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
352 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
353 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
354 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
351 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
352 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
353 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
354 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
|
355 | 355 | |
356 | - $var=false; |
|
357 | - $out.= '<tr '.$bc[$var].'> |
|
356 | + $var = false; |
|
357 | + $out .= '<tr '.$bc[$var].'> |
|
358 | 358 | <td colspan="4" align="right"> |
359 | 359 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
360 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
360 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
361 | 361 | </td> |
362 | 362 | </tr>'; |
363 | 363 | |
364 | - $var=!$var; |
|
365 | - $out.= '<tr '.$bc[$var].'> |
|
364 | + $var = !$var; |
|
365 | + $out .= '<tr '.$bc[$var].'> |
|
366 | 366 | <td colspan="4" align="right"> |
367 | 367 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
368 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
368 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
369 | 369 | </td> |
370 | 370 | </tr>'; |
371 | 371 | |
372 | - $var=!$var; |
|
373 | - $out.= '<tr '.$bc[$var].'> |
|
372 | + $var = !$var; |
|
373 | + $out .= '<tr '.$bc[$var].'> |
|
374 | 374 | <td colspan="4" align="right"> |
375 | 375 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
376 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
376 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
377 | 377 | </td> |
378 | 378 | </tr>'; |
379 | 379 | |
380 | 380 | |
381 | 381 | |
382 | 382 | if ( |
383 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
384 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
385 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
386 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
387 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
388 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
383 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
384 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
385 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
386 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
387 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
388 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
389 | 389 | ) |
390 | 390 | { |
391 | - $var=!$var; |
|
392 | - $out.= ' |
|
391 | + $var = !$var; |
|
392 | + $out .= ' |
|
393 | 393 | <tr '.$bc[$var].'> |
394 | 394 | <td colspan="4" align="right"> |
395 | 395 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
396 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
396 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
397 | 397 | </td> |
398 | 398 | </tr>'; |
399 | 399 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
410 | 410 | { |
411 | 411 | |
412 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
412 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
413 | 413 | { |
414 | 414 | |
415 | 415 | } |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
421 | 421 | global $conf; |
422 | 422 | |
423 | - if($action === 'builddoc') { |
|
423 | + if ($action === 'builddoc') { |
|
424 | 424 | |
425 | 425 | $line = &$parameters['line']; |
426 | 426 | $object = &$parameters['object']; |
427 | 427 | $substitutionarray = &$parameters['substitutionarray']; |
428 | 428 | |
429 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
429 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
430 | 430 | $substitutionarray['line_modsubtotal'] = 1; |
431 | 431 | |
432 | 432 | $substitutionarray['line_price_ht'] |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | = $substitutionarray['line_up'] |
438 | 438 | = ''; |
439 | 439 | |
440 | - if($line->qty>90) { |
|
440 | + if ($line->qty > 90) { |
|
441 | 441 | $substitutionarray['line_modsubtotal_total'] = true; |
442 | 442 | |
443 | 443 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | |
453 | 453 | } |
454 | - else{ |
|
454 | + else { |
|
455 | 455 | $substitutionarray['line_not_modsubtotal'] = true; |
456 | 456 | $substitutionarray['line_modsubtotal'] = 0; |
457 | 457 | } |
@@ -463,29 +463,29 @@ discard block |
||
463 | 463 | function createFrom($parameters, &$object, $action, $hookmanager) { |
464 | 464 | |
465 | 465 | if ( |
466 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
467 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
468 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
469 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
470 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
471 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
472 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
466 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
467 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
468 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
469 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
470 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
471 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
472 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
473 | 473 | ) { |
474 | 474 | |
475 | 475 | global $db; |
476 | 476 | |
477 | 477 | $objFrom = $parameters['objFrom']; |
478 | 478 | |
479 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
479 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
480 | 480 | |
481 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
481 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
482 | 482 | |
483 | 483 | $line = & $object->lines[$k]; |
484 | 484 | |
485 | 485 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
486 | 486 | |
487 | 487 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
488 | - SET info_bits=".(int)$lineOld->info_bits." |
|
488 | + SET info_bits=".(int) $lineOld->info_bits." |
|
489 | 489 | WHERE rowid = ".$idLine." |
490 | 490 | "); |
491 | 491 | |
@@ -501,15 +501,15 @@ discard block |
||
501 | 501 | |
502 | 502 | function doActions($parameters, &$object, $action, $hookmanager) |
503 | 503 | { |
504 | - global $db, $conf, $langs,$user; |
|
504 | + global $db, $conf, $langs, $user; |
|
505 | 505 | |
506 | 506 | dol_include_once('/subtotal/class/subtotal.class.php'); |
507 | 507 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
508 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
508 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
509 | 509 | |
510 | 510 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
511 | 511 | |
512 | - if($object->element=='facture') $idvar = 'facid'; |
|
512 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
513 | 513 | else $idvar = 'id'; |
514 | 514 | |
515 | 515 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
523 | 523 | { |
524 | 524 | $found = true; |
525 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
525 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
526 | 526 | $extrafieldsline = new ExtraFields($db); |
527 | 527 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
528 | 528 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -541,43 +541,43 @@ discard block |
||
541 | 541 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
542 | 542 | } |
543 | 543 | } |
544 | - else if($action === 'builddoc') { |
|
544 | + else if ($action === 'builddoc') { |
|
545 | 545 | |
546 | 546 | if ( |
547 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
548 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
549 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
550 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
551 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
552 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
547 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
548 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
549 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
550 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
551 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
552 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
553 | 553 | ) |
554 | 554 | { |
555 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
555 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
556 | 556 | $sessname = 'subtotal_hideInnerLines_facture'; |
557 | 557 | $sessname2 = 'subtotal_hidedetails_facture'; |
558 | 558 | $sessname3 = 'subtotal_hideprices_facture'; |
559 | 559 | } |
560 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
560 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
561 | 561 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
562 | 562 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
563 | 563 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
564 | 564 | } |
565 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
565 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
566 | 566 | $sessname = 'subtotal_hideInnerLines_propal'; |
567 | 567 | $sessname2 = 'subtotal_hidedetails_propal'; |
568 | 568 | $sessname3 = 'subtotal_hideprices_propal'; |
569 | 569 | } |
570 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
570 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
571 | 571 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
572 | 572 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
573 | 573 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
574 | 574 | } |
575 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
575 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
576 | 576 | $sessname = 'subtotal_hideInnerLines_commande'; |
577 | 577 | $sessname2 = 'subtotal_hidedetails_commande'; |
578 | 578 | $sessname3 = 'subtotal_hideprices_commande'; |
579 | 579 | } |
580 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
580 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
581 | 581 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
582 | 582 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
583 | 583 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -590,22 +590,22 @@ discard block |
||
590 | 590 | |
591 | 591 | global $hideprices; |
592 | 592 | |
593 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
593 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
594 | 594 | $_SESSION[$sessname] = $hideInnerLines; |
595 | 595 | |
596 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
596 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
597 | 597 | $_SESSION[$sessname2] = $hidedetails; |
598 | 598 | |
599 | - $hideprices= (int)GETPOST('hideprices'); |
|
599 | + $hideprices = (int) GETPOST('hideprices'); |
|
600 | 600 | $_SESSION[$sessname3] = $hideprices; |
601 | 601 | |
602 | - foreach($object->lines as &$line) { |
|
602 | + foreach ($object->lines as &$line) { |
|
603 | 603 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
604 | 604 | |
605 | - if($line->qty>=90) { |
|
605 | + if ($line->qty >= 90) { |
|
606 | 606 | $line->modsubtotal_total = 1; |
607 | 607 | } |
608 | - else{ |
|
608 | + else { |
|
609 | 609 | $line->modsubtotal_title = 1; |
610 | 610 | } |
611 | 611 | |
@@ -615,34 +615,34 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | } |
618 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
618 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
619 | 619 | |
620 | 620 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
621 | 621 | |
622 | - foreach($Tab as $idLine) { |
|
622 | + foreach ($Tab as $idLine) { |
|
623 | 623 | /** |
624 | 624 | * @var $object Facture |
625 | 625 | */ |
626 | - if($object->element=='facture') $object->deleteline($idLine); |
|
626 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
627 | 627 | /** |
628 | 628 | * @var $object Facture fournisseur |
629 | 629 | */ |
630 | - else if($object->element=='invoice_supplier') |
|
630 | + else if ($object->element == 'invoice_supplier') |
|
631 | 631 | { |
632 | 632 | $object->deleteline($idLine); |
633 | 633 | } |
634 | 634 | /** |
635 | 635 | * @var $object Propal |
636 | 636 | */ |
637 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
637 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
638 | 638 | /** |
639 | 639 | * @var $object Propal Fournisseur |
640 | 640 | */ |
641 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
641 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
642 | 642 | /** |
643 | 643 | * @var $object Commande |
644 | 644 | */ |
645 | - else if($object->element=='commande') |
|
645 | + else if ($object->element == 'commande') |
|
646 | 646 | { |
647 | 647 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
648 | 648 | else $object->deleteline($idLine); |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | /** |
651 | 651 | * @var $object Commande fournisseur |
652 | 652 | */ |
653 | - else if($object->element=='order_supplier') |
|
653 | + else if ($object->element == 'order_supplier') |
|
654 | 654 | { |
655 | 655 | $object->deleteline($idLine); |
656 | 656 | } |
657 | 657 | /** |
658 | 658 | * @var $object Facturerec |
659 | 659 | */ |
660 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
660 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | header('location:?id='.$object->id); |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | return 0; |
681 | 681 | } |
682 | 682 | |
683 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
683 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
684 | 684 | return 0; |
685 | 685 | } |
686 | 686 | |
@@ -692,22 +692,22 @@ discard block |
||
692 | 692 | |
693 | 693 | $found = false; |
694 | 694 | |
695 | - $Tab= array(); |
|
695 | + $Tab = array(); |
|
696 | 696 | |
697 | - foreach($object->lines as $l) { |
|
697 | + foreach ($object->lines as $l) { |
|
698 | 698 | |
699 | 699 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
700 | - if($lid == $lineid) { |
|
700 | + if ($lid == $lineid) { |
|
701 | 701 | |
702 | 702 | $found = true; |
703 | 703 | $qty_line = $l->qty; |
704 | 704 | } |
705 | 705 | |
706 | - if($found) { |
|
706 | + if ($found) { |
|
707 | 707 | |
708 | 708 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
709 | 709 | |
710 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
710 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
711 | 711 | break; // end of story |
712 | 712 | } |
713 | 713 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @param $use_level isn't used anymore |
738 | 738 | */ |
739 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
739 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
740 | 740 | |
741 | 741 | $rang = $line->rang; |
742 | 742 | $qty_line = $line->qty; |
@@ -747,21 +747,21 @@ discard block |
||
747 | 747 | $TTotal_tva = array(); |
748 | 748 | |
749 | 749 | dol_include_once('/subtotal/class/subtotal.class.php'); |
750 | - foreach($object->lines as $l) { |
|
750 | + foreach ($object->lines as $l) { |
|
751 | 751 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
752 | - if($l->rang>=$rang) { |
|
752 | + if ($l->rang >= $rang) { |
|
753 | 753 | //echo 'return!<br>'; |
754 | 754 | if (!$return_all) return $total; |
755 | 755 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
756 | 756 | } |
757 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
757 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
758 | 758 | { |
759 | 759 | $total = 0; |
760 | 760 | $total_tva = 0; |
761 | 761 | $total_ttc = 0; |
762 | 762 | $TTotal_tva = array(); |
763 | 763 | } |
764 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
764 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
765 | 765 | $total += $l->total_ht; |
766 | 766 | $total_tva += $l->total_tva; |
767 | 767 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -780,18 +780,18 @@ discard block |
||
780 | 780 | |
781 | 781 | $rang = $line->rang; |
782 | 782 | $total = 0; |
783 | - foreach($object->lines as $l) { |
|
784 | - if($l->rang>=$rang) { |
|
783 | + foreach ($object->lines as $l) { |
|
784 | + if ($l->rang >= $rang) { |
|
785 | 785 | return price($total); |
786 | 786 | } |
787 | - if (TSubtotal::isSubtotal($l)){ |
|
787 | + if (TSubtotal::isSubtotal($l)) { |
|
788 | 788 | $total = 0; |
789 | - } else if ($l->situation_percent > 0 ){ |
|
789 | + } else if ($l->situation_percent > 0) { |
|
790 | 790 | |
791 | 791 | |
792 | 792 | $prev_progress = $l->get_prev_progress($object->id); |
793 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
794 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
793 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
794 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
795 | 795 | |
796 | 796 | } |
797 | 797 | } |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | * @param $w float width |
811 | 811 | * @param $h float height |
812 | 812 | */ |
813 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
814 | - global $conf,$subtotal_last_title_posy; |
|
813 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
814 | + global $conf, $subtotal_last_title_posy; |
|
815 | 815 | |
816 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
816 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
817 | 817 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
818 | 818 | { |
819 | 819 | $posy = $subtotal_last_title_posy; |
@@ -823,34 +823,34 @@ discard block |
||
823 | 823 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
824 | 824 | |
825 | 825 | $set_pagebreak_margin = false; |
826 | - if(method_exists('Closure','bind')) { |
|
826 | + if (method_exists('Closure', 'bind')) { |
|
827 | 827 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
828 | - $sweetsThief = function ($pdf) { |
|
829 | - return $pdf->bMargin ; |
|
828 | + $sweetsThief = function($pdf) { |
|
829 | + return $pdf->bMargin; |
|
830 | 830 | }; |
831 | 831 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
832 | 832 | |
833 | - $bMargin = $sweetsThief($pdf); |
|
833 | + $bMargin = $sweetsThief($pdf); |
|
834 | 834 | |
835 | - $pdf->SetAutoPageBreak( false ); |
|
835 | + $pdf->SetAutoPageBreak(false); |
|
836 | 836 | |
837 | 837 | $set_pagebreak_margin = true; |
838 | 838 | } |
839 | 839 | |
840 | 840 | |
841 | - if($line->qty==99) |
|
842 | - $pdf->SetFillColor(220,220,220); |
|
843 | - elseif ($line->qty==98) |
|
844 | - $pdf->SetFillColor(230,230,230); |
|
841 | + if ($line->qty == 99) |
|
842 | + $pdf->SetFillColor(220, 220, 220); |
|
843 | + elseif ($line->qty == 98) |
|
844 | + $pdf->SetFillColor(230, 230, 230); |
|
845 | 845 | else |
846 | - $pdf->SetFillColor(240,240,240); |
|
846 | + $pdf->SetFillColor(240, 240, 240); |
|
847 | 847 | |
848 | 848 | $style = 'B'; |
849 | 849 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
850 | 850 | |
851 | 851 | $pdf->SetFont('', $style, 9); |
852 | 852 | |
853 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
853 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
854 | 854 | // var_dump($bMargin); |
855 | 855 | $pageAfter = $pdf->getPage(); |
856 | 856 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | } |
876 | 876 | } |
877 | 877 | |
878 | - if($total_to_print) { |
|
878 | + if ($total_to_print) { |
|
879 | 879 | |
880 | 880 | if (GETPOST('hideInnerLines')) |
881 | 881 | { |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | else |
890 | 890 | { |
891 | 891 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
892 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
892 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
893 | 893 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
894 | 894 | } else { |
895 | 895 | $total_to_print = price($total); |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | $pdf->SetXY($pdf->postotalht, $posy); |
906 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
907 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
906 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
907 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
908 | 908 | } |
909 | - else{ |
|
910 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
909 | + else { |
|
910 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | $posy = $posy + $cell_height; |
@@ -927,22 +927,22 @@ discard block |
||
927 | 927 | * @param $w float width |
928 | 928 | * @param $h float height |
929 | 929 | */ |
930 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
930 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
931 | 931 | |
932 | - global $db,$conf,$subtotal_last_title_posy; |
|
932 | + global $db, $conf, $subtotal_last_title_posy; |
|
933 | 933 | |
934 | 934 | $subtotal_last_title_posy = $posy; |
935 | - $pdf->SetXY ($posx, $posy); |
|
935 | + $pdf->SetXY($posx, $posy); |
|
936 | 936 | |
937 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
937 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
938 | 938 | |
939 | 939 | |
940 | 940 | |
941 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
941 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
942 | 942 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
943 | 943 | |
944 | - if($hideInnerLines) { |
|
945 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
944 | + if ($hideInnerLines) { |
|
945 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
946 | 946 | else |
947 | 947 | { |
948 | 948 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -951,43 +951,43 @@ discard block |
||
951 | 951 | } |
952 | 952 | else { |
953 | 953 | |
954 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
954 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
955 | 955 | else $pdf->SetFont('', $style, 9); |
956 | 956 | |
957 | 957 | } |
958 | 958 | |
959 | 959 | 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 |
960 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
960 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
961 | 961 | |
962 | - if($description && !$hidedesc) { |
|
962 | + if ($description && !$hidedesc) { |
|
963 | 963 | $posy = $pdf->GetY(); |
964 | 964 | |
965 | 965 | $pdf->SetFont('', '', 8); |
966 | 966 | |
967 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
967 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
968 | 968 | |
969 | 969 | } |
970 | 970 | |
971 | 971 | } |
972 | 972 | |
973 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
973 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
974 | 974 | // ultimate PDF hook O_o |
975 | 975 | |
976 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
976 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
977 | 977 | |
978 | 978 | } |
979 | 979 | |
980 | 980 | function isModSubtotalLine(&$parameters, &$object) { |
981 | 981 | |
982 | - if(is_array($parameters)) { |
|
982 | + if (is_array($parameters)) { |
|
983 | 983 | $i = & $parameters['i']; |
984 | 984 | } |
985 | 985 | else { |
986 | - $i = (int)$parameters; |
|
986 | + $i = (int) $parameters; |
|
987 | 987 | } |
988 | 988 | |
989 | 989 | |
990 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
990 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
991 | 991 | return true; |
992 | 992 | } |
993 | 993 | |
@@ -995,43 +995,43 @@ discard block |
||
995 | 995 | |
996 | 996 | } |
997 | 997 | |
998 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
999 | - global $conf,$hideprices; |
|
998 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
999 | + global $conf, $hideprices; |
|
1000 | 1000 | |
1001 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1001 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1002 | 1002 | |
1003 | 1003 | $this->resprints = ' '; |
1004 | 1004 | |
1005 | - if((float)DOL_VERSION<=3.6) { |
|
1005 | + if ((float) DOL_VERSION <= 3.6) { |
|
1006 | 1006 | return ''; |
1007 | 1007 | } |
1008 | - else if((float)DOL_VERSION>=3.8) { |
|
1008 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1009 | 1009 | return 1; |
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | } |
1013 | - elseif(!empty($hideprices)) { |
|
1013 | + elseif (!empty($hideprices)) { |
|
1014 | 1014 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1015 | 1015 | return 1; |
1016 | 1016 | } |
1017 | 1017 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1018 | 1018 | { |
1019 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1020 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1019 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1020 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1021 | 1021 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1022 | 1022 | { |
1023 | 1023 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1028 | - else $i = (int)$parameters; |
|
1027 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1028 | + else $i = (int) $parameters; |
|
1029 | 1029 | |
1030 | 1030 | 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) |
1031 | 1031 | |
1032 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1032 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1033 | 1033 | |
1034 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1034 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1035 | 1035 | { |
1036 | 1036 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1037 | 1037 | { |
@@ -1043,25 +1043,25 @@ discard block |
||
1043 | 1043 | return 0; |
1044 | 1044 | } |
1045 | 1045 | |
1046 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1046 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1047 | 1047 | global $conf, $hideprices, $hookmanager; |
1048 | 1048 | |
1049 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1049 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1050 | 1050 | |
1051 | 1051 | $this->resprints = ' '; |
1052 | 1052 | |
1053 | - if((float)DOL_VERSION<=3.6) { |
|
1053 | + if ((float) DOL_VERSION <= 3.6) { |
|
1054 | 1054 | return ''; |
1055 | 1055 | } |
1056 | - else if((float)DOL_VERSION>=3.8) { |
|
1056 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1057 | 1057 | return 1; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | } |
1061 | 1061 | elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
1062 | 1062 | { |
1063 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1064 | - else $i = (int)$parameters; |
|
1063 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1064 | + else $i = (int) $parameters; |
|
1065 | 1065 | |
1066 | 1066 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1067 | 1067 | { |
@@ -1082,29 +1082,29 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | } |
1084 | 1084 | } |
1085 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1086 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1087 | - else $i = (int)$parameters; |
|
1085 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1086 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1087 | + else $i = (int) $parameters; |
|
1088 | 1088 | $this->resprints = price($object->lines[$i]->total_ht); |
1089 | 1089 | } |
1090 | 1090 | if (!empty($hideprices) |
1091 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1091 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1092 | 1092 | ) |
1093 | 1093 | { |
1094 | 1094 | if (!empty($hideprices)) |
1095 | 1095 | { |
1096 | 1096 | |
1097 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1098 | - else $i = (int)$parameters; |
|
1097 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1098 | + else $i = (int) $parameters; |
|
1099 | 1099 | |
1100 | 1100 | // Check if a title exist for this line && if the title have subtotal |
1101 | 1101 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1102 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1102 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1103 | 1103 | { |
1104 | 1104 | |
1105 | 1105 | $this->resprints = ' '; |
1106 | 1106 | |
1107 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$parameters,$object,$action); |
|
1107 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $parameters, $object, $action); |
|
1108 | 1108 | |
1109 | 1109 | if ($reshook < 0) |
1110 | 1110 | { |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $this->resprints = $hookmanager->resprints; |
1121 | 1121 | |
1122 | 1122 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
1123 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
1123 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
1124 | 1124 | { |
1125 | 1125 | return $hookmanager->resArray['overrideReturn']; |
1126 | 1126 | } |
@@ -1141,25 +1141,25 @@ discard block |
||
1141 | 1141 | return 0; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1144 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1145 | 1145 | global $conf; |
1146 | 1146 | |
1147 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1147 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1148 | 1148 | |
1149 | 1149 | $this->resprints = ' '; |
1150 | 1150 | |
1151 | - if((float)DOL_VERSION<=3.6) { |
|
1151 | + if ((float) DOL_VERSION <= 3.6) { |
|
1152 | 1152 | return ''; |
1153 | 1153 | } |
1154 | - else if((float)DOL_VERSION>=3.8) { |
|
1154 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1155 | 1155 | return 1; |
1156 | 1156 | } |
1157 | 1157 | } |
1158 | 1158 | |
1159 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1160 | - else $i = (int)$parameters; |
|
1159 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1160 | + else $i = (int) $parameters; |
|
1161 | 1161 | |
1162 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1162 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1163 | 1163 | { |
1164 | 1164 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1165 | 1165 | { |
@@ -1171,24 +1171,24 @@ discard block |
||
1171 | 1171 | return 0; |
1172 | 1172 | } |
1173 | 1173 | |
1174 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1174 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1175 | 1175 | global $conf; |
1176 | 1176 | |
1177 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1177 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1178 | 1178 | $this->resprints = ' '; |
1179 | 1179 | |
1180 | - if((float)DOL_VERSION<=3.6) { |
|
1180 | + if ((float) DOL_VERSION <= 3.6) { |
|
1181 | 1181 | return ''; |
1182 | 1182 | } |
1183 | - else if((float)DOL_VERSION>=3.8) { |
|
1183 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1184 | 1184 | return 1; |
1185 | 1185 | } |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1189 | - else $i = (int)$parameters; |
|
1188 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1189 | + else $i = (int) $parameters; |
|
1190 | 1190 | |
1191 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1191 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1192 | 1192 | { |
1193 | 1193 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1194 | 1194 | { |
@@ -1200,24 +1200,24 @@ discard block |
||
1200 | 1200 | return 0; |
1201 | 1201 | } |
1202 | 1202 | |
1203 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1204 | - global $conf,$hideprices; |
|
1203 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1204 | + global $conf, $hideprices; |
|
1205 | 1205 | |
1206 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1206 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1207 | 1207 | $this->resprints = ' '; |
1208 | 1208 | |
1209 | - if((float)DOL_VERSION<=3.6) { |
|
1209 | + if ((float) DOL_VERSION <= 3.6) { |
|
1210 | 1210 | return ''; |
1211 | 1211 | } |
1212 | - else if((float)DOL_VERSION>=3.8) { |
|
1212 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1213 | 1213 | return 1; |
1214 | 1214 | } |
1215 | 1215 | } |
1216 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1217 | - else $i = (int)$parameters; |
|
1216 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1217 | + else $i = (int) $parameters; |
|
1218 | 1218 | |
1219 | 1219 | if (!empty($hideprices) |
1220 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1220 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1221 | 1221 | ) |
1222 | 1222 | { |
1223 | 1223 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1230,24 +1230,24 @@ discard block |
||
1230 | 1230 | return 0; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1234 | - global $conf,$hideprices; |
|
1233 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1234 | + global $conf, $hideprices; |
|
1235 | 1235 | |
1236 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1236 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1237 | 1237 | $this->resprints = ' '; |
1238 | - if((float)DOL_VERSION<=3.6) { |
|
1238 | + if ((float) DOL_VERSION <= 3.6) { |
|
1239 | 1239 | return ''; |
1240 | 1240 | } |
1241 | - else if((float)DOL_VERSION>=3.8) { |
|
1241 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1242 | 1242 | return 1; |
1243 | 1243 | } |
1244 | 1244 | } |
1245 | 1245 | |
1246 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1247 | - else $i = (int)$parameters; |
|
1246 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1247 | + else $i = (int) $parameters; |
|
1248 | 1248 | |
1249 | 1249 | if (!empty($hideprices) |
1250 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1250 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1251 | 1251 | ) |
1252 | 1252 | { |
1253 | 1253 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1260,27 +1260,27 @@ discard block |
||
1260 | 1260 | return 0; |
1261 | 1261 | } |
1262 | 1262 | |
1263 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1263 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1264 | 1264 | global $conf; |
1265 | 1265 | |
1266 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1266 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1267 | 1267 | $this->resprints = ' '; |
1268 | 1268 | |
1269 | - if((float)DOL_VERSION<=3.6) { |
|
1269 | + if ((float) DOL_VERSION <= 3.6) { |
|
1270 | 1270 | return ''; |
1271 | 1271 | } |
1272 | - else if((float)DOL_VERSION>=3.8) { |
|
1272 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1273 | 1273 | return 1; |
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | |
1277 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1278 | - else $i = (int)$parameters; |
|
1277 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1278 | + else $i = (int) $parameters; |
|
1279 | 1279 | |
1280 | 1280 | 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) |
1281 | 1281 | |
1282 | 1282 | $object->lines[$i]->fetch_optionals(); |
1283 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1283 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1284 | 1284 | { |
1285 | 1285 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1286 | 1286 | { |
@@ -1292,23 +1292,23 @@ discard block |
||
1292 | 1292 | return 0; |
1293 | 1293 | } |
1294 | 1294 | |
1295 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1295 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1296 | 1296 | global $conf; |
1297 | 1297 | |
1298 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1298 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1299 | 1299 | $this->resprints = ' '; |
1300 | - if((float)DOL_VERSION<=3.6) { |
|
1300 | + if ((float) DOL_VERSION <= 3.6) { |
|
1301 | 1301 | return ''; |
1302 | 1302 | } |
1303 | - else if((float)DOL_VERSION>=3.8) { |
|
1303 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1304 | 1304 | return 1; |
1305 | 1305 | } |
1306 | 1306 | } |
1307 | 1307 | |
1308 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1309 | - else $i = (int)$parameters; |
|
1308 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1309 | + else $i = (int) $parameters; |
|
1310 | 1310 | |
1311 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1311 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1312 | 1312 | { |
1313 | 1313 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1314 | 1314 | { |
@@ -1323,12 +1323,12 @@ discard block |
||
1323 | 1323 | function add_numerotation(&$object) { |
1324 | 1324 | global $conf; |
1325 | 1325 | |
1326 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1326 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1327 | 1327 | |
1328 | 1328 | $TLevelTitre = array(); |
1329 | 1329 | $prevlevel = 0; |
1330 | 1330 | |
1331 | - foreach($object->lines as $k=>&$line) |
|
1331 | + foreach ($object->lines as $k=>&$line) |
|
1332 | 1332 | { |
1333 | 1333 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1334 | 1334 | { |
@@ -1342,12 +1342,12 @@ discard block |
||
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1345 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1345 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1346 | 1346 | { |
1347 | 1347 | $TTitle = array(); |
1348 | 1348 | |
1349 | - $i=1; |
|
1350 | - $j=0; |
|
1349 | + $i = 1; |
|
1350 | + $j = 0; |
|
1351 | 1351 | foreach ($TLineTitle as $k => &$line) |
1352 | 1352 | { |
1353 | 1353 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | { |
1358 | 1358 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1359 | 1359 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1360 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1360 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1361 | 1361 | { |
1362 | 1362 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1363 | 1363 | $line->desc = $line->description = ''; |
@@ -1383,26 +1383,26 @@ discard block |
||
1383 | 1383 | |
1384 | 1384 | function setDocTVA(&$pdf, &$object) { |
1385 | 1385 | |
1386 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1386 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1387 | 1387 | |
1388 | - if(empty($hidedetails)) return false; |
|
1388 | + if (empty($hidedetails)) return false; |
|
1389 | 1389 | |
1390 | 1390 | // TODO can't add VAT to document without lines... :-/ |
1391 | 1391 | |
1392 | 1392 | return true; |
1393 | 1393 | } |
1394 | 1394 | |
1395 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1395 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1396 | 1396 | { |
1397 | 1397 | /** |
1398 | 1398 | * @var $pdf TCPDF |
1399 | 1399 | */ |
1400 | - global $pdf,$conf, $langs; |
|
1400 | + global $pdf, $conf, $langs; |
|
1401 | 1401 | |
1402 | 1402 | // var_dump($object->lines); |
1403 | 1403 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1404 | 1404 | |
1405 | - foreach($parameters as $key=>$value) { |
|
1405 | + foreach ($parameters as $key=>$value) { |
|
1406 | 1406 | ${$key} = $value; |
1407 | 1407 | } |
1408 | 1408 | |
@@ -1411,25 +1411,25 @@ discard block |
||
1411 | 1411 | $this->add_numerotation($object); |
1412 | 1412 | |
1413 | 1413 | |
1414 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1415 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1414 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1415 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1416 | 1416 | |
1417 | 1417 | if ($hideInnerLines) { // si c une ligne de titre |
1418 | - $fk_parent_line=0; |
|
1419 | - $TLines =array(); |
|
1418 | + $fk_parent_line = 0; |
|
1419 | + $TLines = array(); |
|
1420 | 1420 | |
1421 | - $original_count=count($object->lines); |
|
1421 | + $original_count = count($object->lines); |
|
1422 | 1422 | $TTvas = array(); // tableau de tva |
1423 | 1423 | |
1424 | - foreach($object->lines as $k=>&$line) |
|
1424 | + foreach ($object->lines as $k=>&$line) |
|
1425 | 1425 | { |
1426 | 1426 | |
1427 | - if($line->product_type==9 && $line->rowid>0) |
|
1427 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1428 | 1428 | { |
1429 | 1429 | $fk_parent_line = $line->rowid; |
1430 | 1430 | |
1431 | 1431 | // 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 |
1432 | - if(TSubtotal::isSubtotal($line)) |
|
1432 | + if (TSubtotal::isSubtotal($line)) |
|
1433 | 1433 | { |
1434 | 1434 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1435 | 1435 | |
@@ -1449,22 +1449,22 @@ discard block |
||
1449 | 1449 | |
1450 | 1450 | if ($hideInnerLines) |
1451 | 1451 | { |
1452 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1452 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1453 | 1453 | { |
1454 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1454 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1455 | 1455 | |
1456 | 1456 | // on remplit le tableau de tva pour substituer les lignes cachées |
1457 | 1457 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1458 | 1458 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1459 | 1459 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1460 | 1460 | } |
1461 | - if($line->product_type==9 && $line->rowid>0) |
|
1461 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1462 | 1462 | { |
1463 | 1463 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1464 | 1464 | // génère des lignes d'affichage des montants HT soumis à tva |
1465 | 1465 | $nbtva = count($TTvas); |
1466 | - if(!empty($nbtva)){ |
|
1467 | - foreach ($TTvas as $tx =>$val){ |
|
1466 | + if (!empty($nbtva)) { |
|
1467 | + foreach ($TTvas as $tx =>$val) { |
|
1468 | 1468 | $l = clone $line; |
1469 | 1469 | $l->product_type = 1; |
1470 | 1470 | $l->special_code = ''; |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | } |
1486 | 1486 | } else { |
1487 | 1487 | |
1488 | - if($line->product_type==9 && $line->rowid>0) |
|
1488 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1489 | 1489 | { |
1490 | 1490 | // ajoute la ligne de sous-total |
1491 | 1491 | $TLines[] = $line; |
@@ -1513,9 +1513,9 @@ discard block |
||
1513 | 1513 | |
1514 | 1514 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1515 | 1515 | $nbtva = count($TTvas); |
1516 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1516 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1517 | 1517 | { |
1518 | - foreach ($TTvas as $tx =>$val){ |
|
1518 | + foreach ($TTvas as $tx =>$val) { |
|
1519 | 1519 | $l = clone $line; |
1520 | 1520 | $l->product_type = 1; |
1521 | 1521 | $l->special_code = ''; |
@@ -1532,11 +1532,11 @@ discard block |
||
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | global $nblignes; |
1535 | - $nblignes=count($TLines); |
|
1535 | + $nblignes = count($TLines); |
|
1536 | 1536 | |
1537 | 1537 | $object->lines = $TLines; |
1538 | 1538 | |
1539 | - if($i>count($object->lines)) { |
|
1539 | + if ($i > count($object->lines)) { |
|
1540 | 1540 | $this->resprints = ''; |
1541 | 1541 | return 0; |
1542 | 1542 | } |
@@ -1545,59 +1545,59 @@ discard block |
||
1545 | 1545 | return 0; |
1546 | 1546 | } |
1547 | 1547 | |
1548 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1548 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1549 | 1549 | { |
1550 | 1550 | /** |
1551 | 1551 | * @var $pdf TCPDF |
1552 | 1552 | */ |
1553 | - global $pdf,$conf; |
|
1553 | + global $pdf, $conf; |
|
1554 | 1554 | |
1555 | - foreach($parameters as $key=>$value) { |
|
1555 | + foreach ($parameters as $key=>$value) { |
|
1556 | 1556 | ${$key} = $value; |
1557 | 1557 | } |
1558 | 1558 | |
1559 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1560 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1559 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1560 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1561 | 1561 | |
1562 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1562 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1563 | 1563 | |
1564 | 1564 | global $hideprices; |
1565 | 1565 | |
1566 | - if(!empty($hideprices)) { |
|
1567 | - foreach($object->lines as &$line) { |
|
1568 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1566 | + if (!empty($hideprices)) { |
|
1567 | + foreach ($object->lines as &$line) { |
|
1568 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | $line = &$object->lines[$i]; |
1573 | 1573 | |
1574 | - if($line->info_bits>0) { // PAGE BREAK |
|
1574 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1575 | 1575 | $pdf->addPage(); |
1576 | 1576 | $posy = $pdf->GetY(); |
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | $label = $line->label; |
1580 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1580 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1581 | 1581 | |
1582 | - if(empty($label)) { |
|
1582 | + if (empty($label)) { |
|
1583 | 1583 | $label = $description; |
1584 | - $description=''; |
|
1584 | + $description = ''; |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | - if($line->qty>90) { |
|
1587 | + if ($line->qty > 90) { |
|
1588 | 1588 | |
1589 | 1589 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1590 | 1590 | |
1591 | 1591 | $pageBefore = $pdf->getPage(); |
1592 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1592 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1593 | 1593 | $pageAfter = $pdf->getPage(); |
1594 | 1594 | |
1595 | - if($pageAfter>$pageBefore) { |
|
1595 | + if ($pageAfter > $pageBefore) { |
|
1596 | 1596 | //print "ST $pageAfter>$pageBefore<br>"; |
1597 | 1597 | $pdf->rollbackTransaction(true); |
1598 | - $pdf->addPage('','', true); |
|
1598 | + $pdf->addPage('', '', true); |
|
1599 | 1599 | $posy = $pdf->GetY(); |
1600 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1600 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1601 | 1601 | $posy = $pdf->GetY(); |
1602 | 1602 | //print 'add ST'.$pdf->getPage().'<br />'; |
1603 | 1603 | } |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | else if ($line->qty < 10) { |
1609 | 1609 | $pageBefore = $pdf->getPage(); |
1610 | 1610 | |
1611 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1611 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1612 | 1612 | $pageAfter = $pdf->getPage(); |
1613 | 1613 | |
1614 | 1614 | |
@@ -1683,9 +1683,9 @@ discard block |
||
1683 | 1683 | * @param $hookmanager HookManager |
1684 | 1684 | * @return int |
1685 | 1685 | */ |
1686 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1686 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1687 | 1687 | |
1688 | - global $conf,$langs,$user,$db,$bc; |
|
1688 | + global $conf, $langs, $user, $db, $bc; |
|
1689 | 1689 | |
1690 | 1690 | $num = &$parameters['num']; |
1691 | 1691 | $line = &$parameters['line']; |
@@ -1693,32 +1693,32 @@ discard block |
||
1693 | 1693 | |
1694 | 1694 | $var = &$parameters['var']; |
1695 | 1695 | |
1696 | - $contexts = explode(':',$parameters['context']); |
|
1696 | + $contexts = explode(':', $parameters['context']); |
|
1697 | 1697 | |
1698 | 1698 | $createRight = $user->rights->{$object->element}->creer; |
1699 | - if($object->element == 'facturerec' ) |
|
1699 | + if ($object->element == 'facturerec') |
|
1700 | 1700 | { |
1701 | 1701 | $object->statut = 0; // hack for facture rec |
1702 | 1702 | $createRight = $user->rights->facture->creer; |
1703 | 1703 | } |
1704 | - elseif($object->element == 'order_supplier' ) |
|
1704 | + elseif ($object->element == 'order_supplier') |
|
1705 | 1705 | { |
1706 | 1706 | $createRight = $user->rights->fournisseur->commande->creer; |
1707 | 1707 | } |
1708 | - elseif($object->element == 'invoice_supplier' ) |
|
1708 | + elseif ($object->element == 'invoice_supplier') |
|
1709 | 1709 | { |
1710 | 1710 | $createRight = $user->rights->fournisseur->facture->creer; |
1711 | 1711 | } |
1712 | 1712 | |
1713 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1713 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1714 | 1714 | null; |
1715 | 1715 | } |
1716 | - 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)) |
|
1716 | + 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)) |
|
1717 | 1717 | { |
1718 | - if($object->element=='facture')$idvar = 'facid'; |
|
1719 | - else $idvar='id'; |
|
1718 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1719 | + else $idvar = 'id'; |
|
1720 | 1720 | |
1721 | - if((float)DOL_VERSION <= 3.4) |
|
1721 | + if ((float) DOL_VERSION <= 3.4) |
|
1722 | 1722 | { |
1723 | 1723 | ?> |
1724 | 1724 | <script type="text/javascript"> |
@@ -1742,20 +1742,20 @@ discard block |
||
1742 | 1742 | <?php |
1743 | 1743 | } |
1744 | 1744 | |
1745 | - if(empty($line->description)) $line->description = $line->desc; |
|
1745 | + if (empty($line->description)) $line->description = $line->desc; |
|
1746 | 1746 | |
1747 | 1747 | $colspan = 5; |
1748 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1749 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1750 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1751 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1752 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1753 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1754 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1755 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1756 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1757 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1758 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1748 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1749 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
1750 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
1751 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
1752 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
1753 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1754 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1755 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1756 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1757 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1758 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1759 | 1759 | |
1760 | 1760 | /* Titre */ |
1761 | 1761 | //var_dump($line); |
@@ -1765,35 +1765,35 @@ discard block |
||
1765 | 1765 | |
1766 | 1766 | |
1767 | 1767 | ?> |
1768 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1768 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1769 | 1769 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1770 | 1770 | { |
1771 | - if($line->qty==99) print 'background:#adadcf'; |
|
1772 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1773 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1774 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1775 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1776 | - else if($line->qty==50) print ''; |
|
1771 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1772 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1773 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1774 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1775 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1776 | + else if ($line->qty == 50) print ''; |
|
1777 | 1777 | else print 'background:#eeeeff;'; |
1778 | 1778 | |
1779 | 1779 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1780 | 1780 | } |
1781 | 1781 | else |
1782 | 1782 | { |
1783 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1784 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1785 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1786 | - else if($line->qty==50) print ''; |
|
1787 | - else print 'background:#eeffee;' ; |
|
1783 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
1784 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1785 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
1786 | + else if ($line->qty == 50) print ''; |
|
1787 | + else print 'background:#eeffee;'; |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | ?>;"> |
1791 | 1791 | |
1792 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
1793 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1792 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
1793 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1794 | 1794 | |
1795 | - $params=array('line'=>$line); |
|
1796 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
1795 | + $params = array('line'=>$line); |
|
1796 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
1797 | 1797 | |
1798 | 1798 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
1799 | 1799 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1801,7 +1801,7 @@ discard block |
||
1801 | 1801 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
1802 | 1802 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
1803 | 1803 | |
1804 | - $isFreeText=false; |
|
1804 | + $isFreeText = false; |
|
1805 | 1805 | if (TSubtotal::isTitle($line)) |
1806 | 1806 | { |
1807 | 1807 | $qty_displayed = $line->qty; |
@@ -1823,13 +1823,13 @@ discard block |
||
1823 | 1823 | $line->description = ''; |
1824 | 1824 | } |
1825 | 1825 | $newlabel = $line->label; |
1826 | - if($line->label=='' && !$isFreeText) { |
|
1827 | - if(TSubtotal::isSubtotal($line)) { |
|
1826 | + if ($line->label == '' && !$isFreeText) { |
|
1827 | + if (TSubtotal::isSubtotal($line)) { |
|
1828 | 1828 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
1829 | - $line->description=''; |
|
1830 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
1831 | - $newlabel= $line->description; |
|
1832 | - $line->description=''; |
|
1829 | + $line->description = ''; |
|
1830 | + } elseif ((float) DOL_VERSION < 6) { |
|
1831 | + $newlabel = $line->description; |
|
1832 | + $line->description = ''; |
|
1833 | 1833 | } |
1834 | 1834 | } |
1835 | 1835 | |
@@ -1838,10 +1838,10 @@ discard block |
||
1838 | 1838 | |
1839 | 1839 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
1840 | 1840 | |
1841 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
1841 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
1842 | 1842 | { |
1843 | 1843 | $select = '<select name="subtotal_level">'; |
1844 | - for ($j=1; $j<10; $j++) |
|
1844 | + for ($j = 1; $j < 10; $j++) |
|
1845 | 1845 | { |
1846 | 1846 | if (!empty($readonlyForSituation)) { |
1847 | 1847 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | |
1855 | 1855 | |
1856 | 1856 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
1857 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
1857 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
1858 | 1858 | |
1859 | 1859 | if (TSubtotal::isTitle($line)) |
1860 | 1860 | { |
@@ -1872,9 +1872,9 @@ discard block |
||
1872 | 1872 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
1873 | 1873 | echo '</div>'; |
1874 | 1874 | |
1875 | - if($line->qty<10) { |
|
1875 | + if ($line->qty < 10) { |
|
1876 | 1876 | // WYSIWYG editor |
1877 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
1877 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1878 | 1878 | $nbrows = ROWS_2; |
1879 | 1879 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
1880 | 1880 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1894,25 +1894,25 @@ discard block |
||
1894 | 1894 | |
1895 | 1895 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1896 | 1896 | { |
1897 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1897 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1898 | 1898 | { |
1899 | - echo str_repeat(' ', $line->qty-1); |
|
1899 | + echo str_repeat(' ', $line->qty - 1); |
|
1900 | 1900 | |
1901 | 1901 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
1902 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1902 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | else |
1906 | 1906 | { |
1907 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
1908 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1907 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
1908 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | |
1912 | 1912 | // Get display styles and apply them |
1913 | 1913 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
1914 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1915 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1914 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1915 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1916 | 1916 | |
1917 | 1917 | if (empty($line->label)) { |
1918 | 1918 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -1920,16 +1920,16 @@ discard block |
||
1920 | 1920 | } |
1921 | 1921 | else { |
1922 | 1922 | |
1923 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1923 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1924 | 1924 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
1925 | 1925 | } |
1926 | - else{ |
|
1926 | + else { |
|
1927 | 1927 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
1928 | 1928 | } |
1929 | 1929 | |
1930 | 1930 | } |
1931 | - if($line->qty>90) print ' : '; |
|
1932 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1931 | + if ($line->qty > 90) print ' : '; |
|
1932 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1933 | 1933 | |
1934 | 1934 | |
1935 | 1935 | |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | ?></td> |
1939 | 1939 | |
1940 | 1940 | <?php |
1941 | - if($line->qty>90) { |
|
1941 | + if ($line->qty > 90) { |
|
1942 | 1942 | /* Total */ |
1943 | 1943 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
1944 | 1944 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | <?php |
1952 | 1952 | if ($action != 'selectlines') { |
1953 | 1953 | |
1954 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1954 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1955 | 1955 | ?> |
1956 | 1956 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
1957 | 1957 | <br /> |
@@ -1967,13 +1967,13 @@ discard block |
||
1967 | 1967 | <?php |
1968 | 1968 | |
1969 | 1969 | } |
1970 | - else{ |
|
1971 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
1970 | + else { |
|
1971 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
1972 | 1972 | { |
1973 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
1973 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
1974 | 1974 | } |
1975 | 1975 | |
1976 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1976 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1977 | 1977 | { |
1978 | 1978 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
1979 | 1979 | } |
@@ -1988,7 +1988,7 @@ discard block |
||
1988 | 1988 | <?php |
1989 | 1989 | |
1990 | 1990 | if ($action != 'editline' && $action != 'selectlines') { |
1991 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1991 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1992 | 1992 | { |
1993 | 1993 | |
1994 | 1994 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -1996,7 +1996,7 @@ discard block |
||
1996 | 1996 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
1997 | 1997 | } |
1998 | 1998 | |
1999 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
1999 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
2000 | 2000 | { |
2001 | 2001 | $img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
2002 | 2002 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -2007,7 +2007,7 @@ discard block |
||
2007 | 2007 | </td> |
2008 | 2008 | |
2009 | 2009 | <?php |
2010 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2010 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2011 | 2011 | { |
2012 | 2012 | echo '<td class="subtotal_nc">'; |
2013 | 2013 | 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"' : '').' />'; |
@@ -2018,11 +2018,11 @@ discard block |
||
2018 | 2018 | <td align="center" class="tdlineupdown"> |
2019 | 2019 | </td> |
2020 | 2020 | <?php } else { ?> |
2021 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
2021 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
2022 | 2022 | <?php } ?> |
2023 | 2023 | |
2024 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
2025 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2024 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
2025 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2026 | 2026 | <?php } ?> |
2027 | 2027 | |
2028 | 2028 | </tr> |
@@ -2030,29 +2030,29 @@ discard block |
||
2030 | 2030 | |
2031 | 2031 | |
2032 | 2032 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2033 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2033 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2034 | 2034 | |
2035 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2035 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2036 | 2036 | |
2037 | 2037 | // Extrafields |
2038 | 2038 | $extrafieldsline = new ExtraFields($db); |
2039 | 2039 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2040 | 2040 | |
2041 | - $colspan+=3; $mode = 'view'; |
|
2042 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2041 | + $colspan += 3; $mode = 'view'; |
|
2042 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2043 | 2043 | |
2044 | 2044 | $ex_element = $line->element; |
2045 | 2045 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2046 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2046 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2047 | 2047 | $isExtraSelected = false; |
2048 | - foreach($line->array_options as $option) { |
|
2049 | - if(!empty($option) && $option != "-1") { |
|
2048 | + foreach ($line->array_options as $option) { |
|
2049 | + if (!empty($option) && $option != "-1") { |
|
2050 | 2050 | $isExtraSelected = true; |
2051 | 2051 | break; |
2052 | 2052 | } |
2053 | 2053 | } |
2054 | 2054 | |
2055 | - if($mode === 'edit') { |
|
2055 | + if ($mode === 'edit') { |
|
2056 | 2056 | ?> |
2057 | 2057 | <script> |
2058 | 2058 | $(document).ready(function(){ |
@@ -2060,7 +2060,7 @@ discard block |
||
2060 | 2060 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2061 | 2061 | <?php |
2062 | 2062 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2063 | - if(!$isExtraSelected) { |
|
2063 | + if (!$isExtraSelected) { |
|
2064 | 2064 | echo 'all_tr_extrafields.hide();'; |
2065 | 2065 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2066 | 2066 | echo 'var extra = 0;'; |
@@ -2106,20 +2106,20 @@ discard block |
||
2106 | 2106 | |
2107 | 2107 | |
2108 | 2108 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2109 | - global $conf,$langs; |
|
2109 | + global $conf, $langs; |
|
2110 | 2110 | |
2111 | 2111 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2112 | 2112 | { |
2113 | 2113 | |
2114 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2114 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2115 | 2115 | { |
2116 | 2116 | foreach ($object->lines as $line) |
2117 | 2117 | { |
2118 | 2118 | // fetch optionals attributes and labels |
2119 | 2119 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2120 | - $extrafields=new ExtraFields($this->db); |
|
2121 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2122 | - $line->fetch_optionals($line->id,$extralabels); |
|
2120 | + $extrafields = new ExtraFields($this->db); |
|
2121 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2122 | + $line->fetch_optionals($line->id, $extralabels); |
|
2123 | 2123 | } |
2124 | 2124 | } |
2125 | 2125 | |
@@ -2219,23 +2219,23 @@ discard block |
||
2219 | 2219 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2220 | 2220 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2221 | 2221 | |
2222 | - if(TSubtotal::isTitle($line)){ |
|
2222 | + if (TSubtotal::isTitle($line)) { |
|
2223 | 2223 | $ThtmlData['data-issubtotal'] = 'title'; |
2224 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2224 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2225 | 2225 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2226 | 2226 | } |
2227 | - else{ |
|
2227 | + else { |
|
2228 | 2228 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2229 | 2229 | } |
2230 | 2230 | |
2231 | 2231 | |
2232 | 2232 | // Change or add data from hooks |
2233 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2233 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2234 | 2234 | |
2235 | 2235 | // hook |
2236 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2236 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2237 | 2237 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2238 | - if ($reshook>0) |
|
2238 | + if ($reshook > 0) |
|
2239 | 2239 | { |
2240 | 2240 | $ThtmlData = $hookmanager->resArray; |
2241 | 2241 | } |
@@ -2248,14 +2248,14 @@ discard block |
||
2248 | 2248 | function implodeHtmlData($ThtmlData = array()) |
2249 | 2249 | { |
2250 | 2250 | $data = ''; |
2251 | - foreach($ThtmlData as $k => $h ) |
|
2251 | + foreach ($ThtmlData as $k => $h) |
|
2252 | 2252 | { |
2253 | - if(is_array($h)) |
|
2253 | + if (is_array($h)) |
|
2254 | 2254 | { |
2255 | 2255 | $h = json_encode($h); |
2256 | 2256 | } |
2257 | 2257 | |
2258 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2258 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2259 | 2259 | } |
2260 | 2260 | |
2261 | 2261 | return $data; |
@@ -2263,26 +2263,26 @@ discard block |
||
2263 | 2263 | |
2264 | 2264 | function _ajax_block_order_js($object) |
2265 | 2265 | { |
2266 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2266 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2267 | 2267 | |
2268 | 2268 | /* |
2269 | 2269 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2270 | 2270 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2271 | 2271 | */ |
2272 | 2272 | |
2273 | - $id=$object->id; |
|
2274 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2275 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2273 | + $id = $object->id; |
|
2274 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2275 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2276 | 2276 | |
2277 | - $id=$object->id; |
|
2278 | - $fk_element=$object->fk_element; |
|
2279 | - $table_element_line=$object->table_element_line; |
|
2280 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2281 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2282 | - $filepath=(empty($filepath)?'':$filepath); |
|
2277 | + $id = $object->id; |
|
2278 | + $fk_element = $object->fk_element; |
|
2279 | + $table_element_line = $object->table_element_line; |
|
2280 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2281 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2282 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2283 | 2283 | |
2284 | 2284 | |
2285 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2285 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2286 | 2286 | { |
2287 | 2287 | |
2288 | 2288 | ?> |
@@ -2300,7 +2300,7 @@ discard block |
||
2300 | 2300 | moveBlockCol.disableSelection(); // prevent selection |
2301 | 2301 | <?php if ($object->statut == 0) { ?> |
2302 | 2302 | // apply some graphical stuff |
2303 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2303 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2304 | 2304 | moveBlockCol.css("background-repeat","no-repeat"); |
2305 | 2305 | moveBlockCol.css("background-position","center center"); |
2306 | 2306 | moveBlockCol.css("cursor","move"); |