@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * @return void |
102 | 102 | */ |
103 | 103 | |
104 | - var $module_number = 104777; |
|
104 | + var $module_number = 104777; |
|
105 | 105 | |
106 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
107 | - { |
|
108 | - global $langs,$db,$user, $conf; |
|
106 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
107 | + { |
|
108 | + global $langs,$db,$user, $conf; |
|
109 | 109 | |
110 | 110 | $langs->load('subtotal@subtotal'); |
111 | 111 | |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $createRight = $user->rights->facture->creer; |
121 | 121 | } elseif($object->element == 'order_supplier' ) |
122 | 122 | { |
123 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
123 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
124 | 124 | } elseif($object->element == 'invoice_supplier' ) |
125 | 125 | { |
126 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
126 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if ($object->statut == 0 && $createRight) { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
175 | 175 | |
176 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
176 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
177 | 177 | } |
178 | 178 | else if($action==='ask_deleteallline') { |
179 | 179 | $form=new Form($db); |
@@ -395,36 +395,36 @@ discard block |
||
395 | 395 | $TContext = explode(':',$parameters['context']); |
396 | 396 | if ( |
397 | 397 | in_array('invoicecard',$TContext) |
398 | - || in_array('invoicesuppliercard',$TContext) |
|
398 | + || in_array('invoicesuppliercard',$TContext) |
|
399 | 399 | || in_array('propalcard',$TContext) |
400 | 400 | || in_array('ordercard',$TContext) |
401 | - || in_array('ordersuppliercard',$TContext) |
|
401 | + || in_array('ordersuppliercard',$TContext) |
|
402 | 402 | || in_array('invoicereccard',$TContext) |
403 | 403 | ) |
404 | - { |
|
405 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
404 | + { |
|
405 | + $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | + $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
407 | 407 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
408 | 408 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
409 | 409 | |
410 | 410 | $var=false; |
411 | - $out.= '<tr '.$bc[$var].'> |
|
411 | + $out.= '<tr '.$bc[$var].'> |
|
412 | 412 | <td colspan="4" align="right"> |
413 | 413 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
414 | 414 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
415 | 415 | </td> |
416 | 416 | </tr>'; |
417 | 417 | |
418 | - $var=!$var; |
|
419 | - $out.= '<tr '.$bc[$var].'> |
|
418 | + $var=!$var; |
|
419 | + $out.= '<tr '.$bc[$var].'> |
|
420 | 420 | <td colspan="4" align="right"> |
421 | 421 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
422 | 422 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
423 | 423 | </td> |
424 | 424 | </tr>'; |
425 | 425 | |
426 | - $var=!$var; |
|
427 | - $out.= '<tr '.$bc[$var].'> |
|
426 | + $var=!$var; |
|
427 | + $out.= '<tr '.$bc[$var].'> |
|
428 | 428 | <td colspan="4" align="right"> |
429 | 429 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
430 | 430 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | if ( |
437 | 437 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
438 | 438 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
439 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
439 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
440 | 440 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
441 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
441 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
442 | 442 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
443 | 443 | ) |
444 | 444 | { |
@@ -457,19 +457,19 @@ discard block |
||
457 | 457 | } |
458 | 458 | |
459 | 459 | |
460 | - return 1; |
|
460 | + return 1; |
|
461 | 461 | } |
462 | 462 | |
463 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
464 | - { |
|
463 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
464 | + { |
|
465 | 465 | |
466 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
467 | - { |
|
466 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
467 | + { |
|
468 | 468 | |
469 | - } |
|
469 | + } |
|
470 | 470 | |
471 | - return 0; |
|
472 | - } |
|
471 | + return 0; |
|
472 | + } |
|
473 | 473 | |
474 | 474 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
475 | 475 | global $conf; |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | |
519 | 519 | if ( |
520 | 520 | in_array('invoicecard',explode(':',$parameters['context'])) |
521 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
521 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
522 | 522 | || in_array('propalcard',explode(':',$parameters['context'])) |
523 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
523 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
524 | 524 | || in_array('ordercard',explode(':',$parameters['context'])) |
525 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
525 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
526 | 526 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
527 | 527 | ) { |
528 | 528 | |
@@ -601,20 +601,20 @@ discard block |
||
601 | 601 | in_array('invoicecard',explode(':',$parameters['context'])) |
602 | 602 | || in_array('propalcard',explode(':',$parameters['context'])) |
603 | 603 | || in_array('ordercard',explode(':',$parameters['context'])) |
604 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
605 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
606 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
604 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
605 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
606 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
607 | 607 | ) |
608 | - { |
|
608 | + { |
|
609 | 609 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
610 | 610 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 611 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 612 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | 613 | } |
614 | 614 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
615 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
616 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
617 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
615 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
616 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
617 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
618 | 618 | } |
619 | 619 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
620 | 620 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -622,9 +622,9 @@ discard block |
||
622 | 622 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | 623 | } |
624 | 624 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
625 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
626 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
627 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
625 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
626 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
627 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
628 | 628 | } |
629 | 629 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
630 | 630 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | 633 | } |
634 | 634 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
635 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
636 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
637 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
635 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
636 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
637 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
638 | 638 | } |
639 | 639 | else { |
640 | 640 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -659,17 +659,17 @@ discard block |
||
659 | 659 | foreach($object->lines as &$line) { |
660 | 660 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
661 | 661 | |
662 | - if($line->qty>=90) { |
|
663 | - $line->modsubtotal_total = 1; |
|
664 | - } |
|
665 | - else{ |
|
666 | - $line->modsubtotal_title = 1; |
|
667 | - } |
|
662 | + if($line->qty>=90) { |
|
663 | + $line->modsubtotal_total = 1; |
|
664 | + } |
|
665 | + else{ |
|
666 | + $line->modsubtotal_title = 1; |
|
667 | + } |
|
668 | 668 | |
669 | 669 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
670 | 670 | } |
671 | - } |
|
672 | - } |
|
671 | + } |
|
672 | + } |
|
673 | 673 | |
674 | 674 | } |
675 | 675 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | else if($object->element=='invoice_supplier') |
688 | 688 | { |
689 | - $object->deleteline($idLine); |
|
689 | + $object->deleteline($idLine); |
|
690 | 690 | } |
691 | 691 | /** |
692 | 692 | * @var $object Propal |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | else if($object->element=='order_supplier') |
711 | 711 | { |
712 | - $object->deleteline($idLine); |
|
712 | + $object->deleteline($idLine); |
|
713 | 713 | } |
714 | 714 | /** |
715 | 715 | * @var $object Facturerec |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | |
781 | 781 | foreach($object->lines as $l) { |
782 | 782 | |
783 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
783 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
784 | 784 | if($lid == $lineid) { |
785 | 785 | |
786 | 786 | $found = true; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | |
790 | 790 | if($found) { |
791 | 791 | |
792 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
792 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
793 | 793 | |
794 | 794 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
795 | 795 | break; // end of story |
@@ -868,17 +868,17 @@ discard block |
||
868 | 868 | if($l->rang>=$rang) { |
869 | 869 | return price($total); |
870 | 870 | } |
871 | - if (TSubtotal::isSubtotal($l)){ |
|
872 | - $total = 0; |
|
873 | - } else if ($l->situation_percent > 0 ){ |
|
871 | + if (TSubtotal::isSubtotal($l)){ |
|
872 | + $total = 0; |
|
873 | + } else if ($l->situation_percent > 0 ){ |
|
874 | 874 | |
875 | 875 | |
876 | 876 | $prev_progress = $l->get_prev_progress($object->id); |
877 | 877 | $progress = ($l->situation_percent - $prev_progress) /100; |
878 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
878 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
879 | 879 | |
880 | - } |
|
881 | - } |
|
880 | + } |
|
881 | + } |
|
882 | 882 | |
883 | 883 | return price($total); |
884 | 884 | } |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | if(method_exists('Closure','bind')) { |
911 | 911 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
912 | 912 | $sweetsThief = function ($pdf) { |
913 | - return $pdf->bMargin ; |
|
913 | + return $pdf->bMargin ; |
|
914 | 914 | }; |
915 | 915 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
916 | 916 | |
@@ -973,11 +973,11 @@ discard block |
||
973 | 973 | else |
974 | 974 | { |
975 | 975 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
977 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
978 | - } else { |
|
979 | - $total_to_print = price($total); |
|
980 | - } |
|
976 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
977 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
978 | + } else { |
|
979 | + $total_to_print = price($total); |
|
980 | + } |
|
981 | 981 | |
982 | 982 | $line->total_ht = $total; |
983 | 983 | $line->total = $total; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1131 | - global $conf, $hideprices, $hookmanager; |
|
1131 | + global $conf, $hideprices, $hookmanager; |
|
1132 | 1132 | |
1133 | 1133 | if(is_array($parameters)) $i = & $parameters['i']; |
1134 | 1134 | else $i = (int)$parameters; |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | } |
1168 | 1168 | } |
1169 | 1169 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1170 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1170 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1299 | - global $conf,$hideprices,$hookmanager; |
|
1299 | + global $conf,$hideprices,$hookmanager; |
|
1300 | 1300 | |
1301 | 1301 | if(is_array($parameters)) $i = & $parameters['i']; |
1302 | 1302 | else $i = (int)$parameters; |
@@ -1304,17 +1304,17 @@ discard block |
||
1304 | 1304 | if($this->isModSubtotalLine($parameters,$object) ) { |
1305 | 1305 | $this->resprints = ' '; |
1306 | 1306 | |
1307 | - $line = $object->lines[$i]; |
|
1307 | + $line = $object->lines[$i]; |
|
1308 | 1308 | |
1309 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
1310 | - if(TSubtotal::isSubtotal($line)) { |
|
1311 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1309 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
1310 | + if(TSubtotal::isSubtotal($line)) { |
|
1311 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1312 | 1312 | |
1313 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1314 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1315 | - $this->resprints = price($TTotal['total_subprice']); |
|
1316 | - } |
|
1317 | - } |
|
1313 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1314 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1315 | + $this->resprints = price($TTotal['total_subprice']); |
|
1316 | + } |
|
1317 | + } |
|
1318 | 1318 | |
1319 | 1319 | if((float)DOL_VERSION<=3.6) { |
1320 | 1320 | return ''; |
@@ -1330,57 +1330,57 @@ discard block |
||
1330 | 1330 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1331 | 1331 | ) |
1332 | 1332 | { |
1333 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1334 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1335 | - { |
|
1336 | - $this->resprints = ' '; |
|
1333 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1334 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1335 | + { |
|
1336 | + $this->resprints = ' '; |
|
1337 | 1337 | |
1338 | - // currentcontext à modifier celon l'appel |
|
1339 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1340 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1338 | + // currentcontext à modifier celon l'appel |
|
1339 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1340 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1341 | 1341 | |
1342 | - } |
|
1342 | + } |
|
1343 | 1343 | } |
1344 | 1344 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1345 | 1345 | else if (!empty($hideprices)) |
1346 | 1346 | { |
1347 | 1347 | |
1348 | - // Check if a title exist for this line && if the title have subtotal |
|
1349 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1350 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1351 | - { |
|
1348 | + // Check if a title exist for this line && if the title have subtotal |
|
1349 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1350 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1351 | + { |
|
1352 | 1352 | |
1353 | - $this->resprints = ' '; |
|
1353 | + $this->resprints = ' '; |
|
1354 | 1354 | |
1355 | - // currentcontext à modifier celon l'appel |
|
1356 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1357 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1358 | - } |
|
1355 | + // currentcontext à modifier celon l'appel |
|
1356 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1357 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1358 | + } |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | return 0; |
1362 | 1362 | } |
1363 | 1363 | |
1364 | 1364 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
1365 | - global $conf,$hideprices,$hookmanager; |
|
1365 | + global $conf,$hideprices,$hookmanager; |
|
1366 | 1366 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1368 | - else $i = (int) $parameters; |
|
1367 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1368 | + else $i = (int) $parameters; |
|
1369 | 1369 | |
1370 | 1370 | if($this->isModSubtotalLine($parameters,$object) ) { |
1371 | 1371 | $this->resprints = ' '; |
1372 | 1372 | |
1373 | - $line = $object->lines[$i]; |
|
1373 | + $line = $object->lines[$i]; |
|
1374 | 1374 | |
1375 | - // Affichage de la remise |
|
1376 | - if(TSubtotal::isSubtotal($line)) { |
|
1377 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1375 | + // Affichage de la remise |
|
1376 | + if(TSubtotal::isSubtotal($line)) { |
|
1377 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1378 | 1378 | |
1379 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1380 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1381 | - $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%'; |
|
1382 | - } |
|
1383 | - } |
|
1379 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1380 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1381 | + $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%'; |
|
1382 | + } |
|
1383 | + } |
|
1384 | 1384 | |
1385 | 1385 | if((float)DOL_VERSION<=3.6) { |
1386 | 1386 | return ''; |
@@ -1390,15 +1390,15 @@ discard block |
||
1390 | 1390 | } |
1391 | 1391 | } |
1392 | 1392 | elseif (!empty($hideprices) |
1393 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1394 | - ) |
|
1395 | - { |
|
1396 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1397 | - { |
|
1398 | - $this->resprints = ' '; |
|
1399 | - return 1; |
|
1400 | - } |
|
1401 | - } |
|
1393 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1394 | + ) |
|
1395 | + { |
|
1396 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1397 | + { |
|
1398 | + $this->resprints = ' '; |
|
1399 | + return 1; |
|
1400 | + } |
|
1401 | + } |
|
1402 | 1402 | |
1403 | 1403 | return 0; |
1404 | 1404 | } |
@@ -1434,7 +1434,7 @@ discard block |
||
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
1437 | - global $conf,$hideprices,$hookmanager; |
|
1437 | + global $conf,$hideprices,$hookmanager; |
|
1438 | 1438 | |
1439 | 1439 | if($this->isModSubtotalLine($parameters,$object) ){ |
1440 | 1440 | $this->resprints = ' '; |
@@ -1459,31 +1459,31 @@ discard block |
||
1459 | 1459 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1460 | 1460 | ) |
1461 | 1461 | { |
1462 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1463 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1464 | - { |
|
1465 | - $this->resprints = ' '; |
|
1462 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1463 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1464 | + { |
|
1465 | + $this->resprints = ' '; |
|
1466 | 1466 | |
1467 | - // currentcontext à modifier celon l'appel |
|
1468 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1469 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1470 | - } |
|
1467 | + // currentcontext à modifier celon l'appel |
|
1468 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1469 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1470 | + } |
|
1471 | 1471 | } |
1472 | 1472 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1473 | 1473 | else if (!empty($hideprices)) |
1474 | 1474 | { |
1475 | 1475 | |
1476 | - // Check if a title exist for this line && if the title have subtotal |
|
1477 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1478 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1479 | - { |
|
1476 | + // Check if a title exist for this line && if the title have subtotal |
|
1477 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1478 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1479 | + { |
|
1480 | 1480 | |
1481 | - $this->resprints = ' '; |
|
1481 | + $this->resprints = ' '; |
|
1482 | 1482 | |
1483 | - // currentcontext à modifier celon l'appel |
|
1484 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1485 | - return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1486 | - } |
|
1483 | + // currentcontext à modifier celon l'appel |
|
1484 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1485 | + return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1) |
|
1486 | + } |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | return 0; |
@@ -1607,24 +1607,24 @@ discard block |
||
1607 | 1607 | |
1608 | 1608 | $this->add_numerotation($object); |
1609 | 1609 | |
1610 | - foreach($object->lines as $k => &$l) { |
|
1611 | - if(TSubtotal::isSubtotal($l)) { |
|
1612 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
1613 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1614 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1615 | - } |
|
1616 | - } |
|
1617 | - } |
|
1610 | + foreach($object->lines as $k => &$l) { |
|
1611 | + if(TSubtotal::isSubtotal($l)) { |
|
1612 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
1613 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1614 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1615 | + } |
|
1616 | + } |
|
1617 | + } |
|
1618 | 1618 | |
1619 | 1619 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1620 | 1620 | $hidedetails = (int)GETPOST('hidedetails'); |
1621 | 1621 | |
1622 | 1622 | if ($hideInnerLines) { // si c une ligne de titre |
1623 | - $fk_parent_line=0; |
|
1623 | + $fk_parent_line=0; |
|
1624 | 1624 | $TLines =array(); |
1625 | 1625 | |
1626 | 1626 | $original_count=count($object->lines); |
1627 | - $TTvas = array(); // tableau de tva |
|
1627 | + $TTvas = array(); // tableau de tva |
|
1628 | 1628 | |
1629 | 1629 | foreach($object->lines as $k=>&$line) |
1630 | 1630 | { |
@@ -1663,48 +1663,48 @@ discard block |
||
1663 | 1663 | |
1664 | 1664 | if ($hideInnerLines) |
1665 | 1665 | { |
1666 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1667 | - { |
|
1668 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1666 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1667 | + { |
|
1668 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1669 | 1669 | |
1670 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1671 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1672 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1673 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1674 | - } |
|
1675 | - if($line->product_type==9 && $line->rowid>0) |
|
1676 | - { |
|
1677 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1678 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1679 | - $nbtva = count($TTvas); |
|
1680 | - if(!empty($nbtva)){ |
|
1681 | - foreach ($TTvas as $tx =>$val){ |
|
1682 | - $l = clone $line; |
|
1683 | - $l->product_type = 1; |
|
1684 | - $l->special_code = ''; |
|
1685 | - $l->qty = 1; |
|
1686 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1687 | - $l->tva_tx = $tx; |
|
1688 | - $l->total_ht = $val['total_ht']; |
|
1689 | - $l->total_tva = $val['total_tva']; |
|
1690 | - $l->total = $line->total_ht; |
|
1691 | - $l->total_ttc = $val['total_ttc']; |
|
1692 | - $TLines[] = $l; |
|
1693 | - array_shift($TTvas); |
|
1694 | - } |
|
1695 | - } |
|
1670 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1671 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1672 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1673 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1674 | + } |
|
1675 | + if($line->product_type==9 && $line->rowid>0) |
|
1676 | + { |
|
1677 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1678 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1679 | + $nbtva = count($TTvas); |
|
1680 | + if(!empty($nbtva)){ |
|
1681 | + foreach ($TTvas as $tx =>$val){ |
|
1682 | + $l = clone $line; |
|
1683 | + $l->product_type = 1; |
|
1684 | + $l->special_code = ''; |
|
1685 | + $l->qty = 1; |
|
1686 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1687 | + $l->tva_tx = $tx; |
|
1688 | + $l->total_ht = $val['total_ht']; |
|
1689 | + $l->total_tva = $val['total_tva']; |
|
1690 | + $l->total = $line->total_ht; |
|
1691 | + $l->total_ttc = $val['total_ttc']; |
|
1692 | + $TLines[] = $l; |
|
1693 | + array_shift($TTvas); |
|
1694 | + } |
|
1695 | + } |
|
1696 | 1696 | |
1697 | - // ajoute la ligne de sous-total |
|
1698 | - $TLines[] = $line; |
|
1699 | - } |
|
1700 | - } else { |
|
1697 | + // ajoute la ligne de sous-total |
|
1698 | + $TLines[] = $line; |
|
1699 | + } |
|
1700 | + } else { |
|
1701 | 1701 | |
1702 | - if($line->product_type==9 && $line->rowid>0) |
|
1703 | - { |
|
1704 | - // ajoute la ligne de sous-total |
|
1705 | - $TLines[] = $line; |
|
1706 | - } |
|
1707 | - } |
|
1702 | + if($line->product_type==9 && $line->rowid>0) |
|
1703 | + { |
|
1704 | + // ajoute la ligne de sous-total |
|
1705 | + $TLines[] = $line; |
|
1706 | + } |
|
1707 | + } |
|
1708 | 1708 | |
1709 | 1709 | |
1710 | 1710 | } |
@@ -1729,20 +1729,20 @@ discard block |
||
1729 | 1729 | $nbtva = count($TTvas); |
1730 | 1730 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1731 | 1731 | { |
1732 | - foreach ($TTvas as $tx =>$val){ |
|
1733 | - $l = clone $line; |
|
1734 | - $l->product_type = 1; |
|
1735 | - $l->special_code = ''; |
|
1736 | - $l->qty = 1; |
|
1737 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1738 | - $l->tva_tx = $tx; |
|
1739 | - $l->total_ht = $val['total_ht']; |
|
1740 | - $l->total_tva = $val['total_tva']; |
|
1741 | - $l->total = $line->total_ht; |
|
1742 | - $l->total_ttc = $val['total_ttc']; |
|
1743 | - $TLines[] = $l; |
|
1744 | - array_shift($TTvas); |
|
1745 | - } |
|
1732 | + foreach ($TTvas as $tx =>$val){ |
|
1733 | + $l = clone $line; |
|
1734 | + $l->product_type = 1; |
|
1735 | + $l->special_code = ''; |
|
1736 | + $l->qty = 1; |
|
1737 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1738 | + $l->tva_tx = $tx; |
|
1739 | + $l->total_ht = $val['total_ht']; |
|
1740 | + $l->total_tva = $val['total_tva']; |
|
1741 | + $l->total = $line->total_ht; |
|
1742 | + $l->total_ttc = $val['total_ttc']; |
|
1743 | + $TLines[] = $l; |
|
1744 | + array_shift($TTvas); |
|
1745 | + } |
|
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | global $nblignes; |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | $this->resprints = ''; |
1755 | 1755 | return 0; |
1756 | 1756 | } |
1757 | - } |
|
1757 | + } |
|
1758 | 1758 | |
1759 | 1759 | return 0; |
1760 | 1760 | } |
@@ -1917,18 +1917,18 @@ discard block |
||
1917 | 1917 | } |
1918 | 1918 | elseif($object->element == 'order_supplier' ) |
1919 | 1919 | { |
1920 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
1920 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
1921 | 1921 | } |
1922 | 1922 | elseif($object->element == 'invoice_supplier' ) |
1923 | 1923 | { |
1924 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
1924 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
1925 | 1925 | } |
1926 | 1926 | |
1927 | 1927 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1928 | 1928 | null; |
1929 | 1929 | } |
1930 | 1930 | 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)) |
1931 | - { |
|
1931 | + { |
|
1932 | 1932 | if($object->element=='facture')$idvar = 'facid'; |
1933 | 1933 | else $idvar='id'; |
1934 | 1934 | |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | //var_dump($line); |
1978 | 1978 | |
1979 | 1979 | // HTML 5 data for js |
1980 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1980 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1981 | 1981 | |
1982 | 1982 | |
1983 | 1983 | ?> |
@@ -2039,8 +2039,8 @@ discard block |
||
2039 | 2039 | } |
2040 | 2040 | |
2041 | 2041 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
2042 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
2043 | - $line->description = ''; |
|
2042 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
2043 | + $line->description = ''; |
|
2044 | 2044 | } |
2045 | 2045 | $newlabel = $line->label; |
2046 | 2046 | if($line->label=='' && !$isFreeText) { |
@@ -2074,38 +2074,38 @@ discard block |
||
2074 | 2074 | |
2075 | 2075 | |
2076 | 2076 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
2077 | - echo '<div>'; |
|
2078 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2079 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
2080 | - echo '</div>'; |
|
2081 | - |
|
2082 | - if (TSubtotal::isTitle($line)) |
|
2083 | - { |
|
2084 | - $form = new Form($db); |
|
2085 | - echo '<div>'; |
|
2086 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
2087 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
2088 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2089 | - echo '</select>'; |
|
2090 | - echo '</div>'; |
|
2091 | - |
|
2092 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
2093 | - { |
|
2094 | - echo '<div>'; |
|
2095 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
2096 | - echo '</div>'; |
|
2097 | - } |
|
2098 | - echo '<div>'; |
|
2099 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2100 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
2101 | - echo '</div>'; |
|
2102 | - |
|
2103 | - echo '<div>'; |
|
2104 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2105 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
2106 | - echo '</div>'; |
|
2107 | - } |
|
2108 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2077 | + echo '<div>'; |
|
2078 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2079 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
2080 | + echo '</div>'; |
|
2081 | + |
|
2082 | + if (TSubtotal::isTitle($line)) |
|
2083 | + { |
|
2084 | + $form = new Form($db); |
|
2085 | + echo '<div>'; |
|
2086 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
2087 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
2088 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2089 | + echo '</select>'; |
|
2090 | + echo '</div>'; |
|
2091 | + |
|
2092 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
2093 | + { |
|
2094 | + echo '<div>'; |
|
2095 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
2096 | + echo '</div>'; |
|
2097 | + } |
|
2098 | + echo '<div>'; |
|
2099 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2100 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
2101 | + echo '</div>'; |
|
2102 | + |
|
2103 | + echo '<div>'; |
|
2104 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2105 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
2106 | + echo '</div>'; |
|
2107 | + } |
|
2108 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2109 | 2109 | echo '</div>'; |
2110 | 2110 | |
2111 | 2111 | if($line->qty<10) { |
@@ -2373,17 +2373,17 @@ discard block |
||
2373 | 2373 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2374 | 2374 | { |
2375 | 2375 | |
2376 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2377 | - { |
|
2378 | - foreach ($object->lines as $line) |
|
2379 | - { |
|
2380 | - // fetch optionals attributes and labels |
|
2381 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2382 | - $extrafields=new ExtraFields($this->db); |
|
2383 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2384 | - $line->fetch_optionals($line->id,$extralabels); |
|
2385 | - } |
|
2386 | - } |
|
2376 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2377 | + { |
|
2378 | + foreach ($object->lines as $line) |
|
2379 | + { |
|
2380 | + // fetch optionals attributes and labels |
|
2381 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2382 | + $extrafields=new ExtraFields($this->db); |
|
2383 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2384 | + $line->fetch_optionals($line->id,$extralabels); |
|
2385 | + } |
|
2386 | + } |
|
2387 | 2387 | |
2388 | 2388 | $TSubNc = array(); |
2389 | 2389 | foreach ($object->lines as &$l) |
@@ -2474,80 +2474,80 @@ discard block |
||
2474 | 2474 | { |
2475 | 2475 | dol_include_once('/subtotal/class/subtotal.class.php'); |
2476 | 2476 | |
2477 | - $line = &$parameters['line']; |
|
2477 | + $line = &$parameters['line']; |
|
2478 | 2478 | |
2479 | - $ThtmlData['data-id'] = $line->id; |
|
2480 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2481 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2482 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2479 | + $ThtmlData['data-id'] = $line->id; |
|
2480 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2481 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2482 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2483 | 2483 | |
2484 | - if(TSubtotal::isTitle($line)){ |
|
2485 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2486 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2487 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2488 | - } |
|
2489 | - else{ |
|
2490 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2491 | - } |
|
2484 | + if(TSubtotal::isTitle($line)){ |
|
2485 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2486 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2487 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2488 | + } |
|
2489 | + else{ |
|
2490 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2491 | + } |
|
2492 | 2492 | |
2493 | 2493 | |
2494 | - // Change or add data from hooks |
|
2495 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2494 | + // Change or add data from hooks |
|
2495 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2496 | 2496 | |
2497 | - // hook |
|
2498 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2499 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2500 | - if ($reshook>0) |
|
2501 | - { |
|
2502 | - $ThtmlData = $hookmanager->resArray; |
|
2503 | - } |
|
2504 | - |
|
2505 | - return $this->implodeHtmlData($ThtmlData); |
|
2497 | + // hook |
|
2498 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2499 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2500 | + if ($reshook>0) |
|
2501 | + { |
|
2502 | + $ThtmlData = $hookmanager->resArray; |
|
2503 | + } |
|
2504 | + |
|
2505 | + return $this->implodeHtmlData($ThtmlData); |
|
2506 | 2506 | |
2507 | 2507 | } |
2508 | 2508 | |
2509 | 2509 | |
2510 | 2510 | function implodeHtmlData($ThtmlData = array()) |
2511 | 2511 | { |
2512 | - $data = ''; |
|
2513 | - foreach($ThtmlData as $k => $h ) |
|
2514 | - { |
|
2515 | - if(is_array($h)) |
|
2516 | - { |
|
2517 | - $h = json_encode($h); |
|
2518 | - } |
|
2512 | + $data = ''; |
|
2513 | + foreach($ThtmlData as $k => $h ) |
|
2514 | + { |
|
2515 | + if(is_array($h)) |
|
2516 | + { |
|
2517 | + $h = json_encode($h); |
|
2518 | + } |
|
2519 | 2519 | |
2520 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2521 | - } |
|
2520 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2521 | + } |
|
2522 | 2522 | |
2523 | - return $data; |
|
2523 | + return $data; |
|
2524 | 2524 | } |
2525 | 2525 | |
2526 | 2526 | function _ajax_block_order_js($object) |
2527 | 2527 | { |
2528 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2528 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2529 | 2529 | |
2530 | - /* |
|
2530 | + /* |
|
2531 | 2531 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2532 | 2532 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2533 | 2533 | */ |
2534 | 2534 | |
2535 | - $id=$object->id; |
|
2536 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2537 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2535 | + $id=$object->id; |
|
2536 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2537 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2538 | 2538 | |
2539 | - $id=$object->id; |
|
2540 | - $fk_element=$object->fk_element; |
|
2541 | - $table_element_line=$object->table_element_line; |
|
2542 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2543 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2544 | - $filepath=(empty($filepath)?'':$filepath); |
|
2539 | + $id=$object->id; |
|
2540 | + $fk_element=$object->fk_element; |
|
2541 | + $table_element_line=$object->table_element_line; |
|
2542 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2543 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2544 | + $filepath=(empty($filepath)?'':$filepath); |
|
2545 | 2545 | |
2546 | 2546 | |
2547 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2548 | - { |
|
2547 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2548 | + { |
|
2549 | 2549 | |
2550 | - ?> |
|
2550 | + ?> |
|
2551 | 2551 | |
2552 | 2552 | |
2553 | 2553 | <script type="text/javascript"> |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | global $type_element, $where; |
18 | 18 | |
19 | - $contexts = explode(':',$parameters['context']); |
|
19 | + $contexts = explode(':', $parameters['context']); |
|
20 | 20 | |
21 | - if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
21 | + if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
22 | 22 | $mod_num = TSubtotal::$module_number; |
23 | 23 | |
24 | 24 | // Not a title (can't use TSubtotal class methods in sql) |
25 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
25 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
26 | 26 | // Not a subtotal (can't use TSubtotal class methods in sql) |
27 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
27 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
28 | 28 | // Not a free line text (can't use TSubtotal class methods in sql) |
29 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
29 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -105,43 +105,43 @@ discard block |
||
105 | 105 | |
106 | 106 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
107 | 107 | { |
108 | - global $langs,$db,$user, $conf; |
|
108 | + global $langs, $db, $user, $conf; |
|
109 | 109 | |
110 | 110 | $langs->load('subtotal@subtotal'); |
111 | 111 | |
112 | - $contexts = explode(':',$parameters['context']); |
|
112 | + $contexts = explode(':', $parameters['context']); |
|
113 | 113 | |
114 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
114 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
115 | 115 | |
116 | 116 | $createRight = $user->rights->{$object->element}->creer; |
117 | - if($object->element == 'facturerec' ) |
|
117 | + if ($object->element == 'facturerec') |
|
118 | 118 | { |
119 | 119 | $object->statut = 0; // hack for facture rec |
120 | 120 | $createRight = $user->rights->facture->creer; |
121 | - } elseif($object->element == 'order_supplier' ) |
|
121 | + } elseif ($object->element == 'order_supplier') |
|
122 | 122 | { |
123 | 123 | $createRight = $user->rights->fournisseur->commande->creer; |
124 | - } elseif($object->element == 'invoice_supplier' ) |
|
124 | + } elseif ($object->element == 'invoice_supplier') |
|
125 | 125 | { |
126 | 126 | $createRight = $user->rights->fournisseur->facture->creer; |
127 | 127 | } |
128 | 128 | |
129 | - if ($object->statut == 0 && $createRight) { |
|
129 | + if ($object->statut == 0 && $createRight) { |
|
130 | 130 | |
131 | 131 | |
132 | - if($object->element=='facture')$idvar = 'facid'; |
|
133 | - else $idvar='id'; |
|
132 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
133 | + else $idvar = 'id'; |
|
134 | 134 | |
135 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
135 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
136 | 136 | { |
137 | 137 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
138 | 138 | |
139 | - if($action=='add_title_line') { |
|
139 | + if ($action == 'add_title_line') { |
|
140 | 140 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('title'); |
|
142 | - $qty = $level<1 ? 1 : $level ; |
|
141 | + if (empty($title)) $title = $langs->trans('title'); |
|
142 | + $qty = $level < 1 ? 1 : $level; |
|
143 | 143 | } |
144 | - else if($action=='add_free_text') { |
|
144 | + else if ($action == 'add_free_text') { |
|
145 | 145 | $title = GETPOST('title'); |
146 | 146 | |
147 | 147 | if (empty($title)) { |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
156 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
157 | 157 | $qty = 50; |
158 | 158 | } |
159 | - else if($action=='add_subtitle_line') { |
|
159 | + else if ($action == 'add_subtitle_line') { |
|
160 | 160 | $title = GETPOST('title'); |
161 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
161 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
162 | 162 | $qty = 2; |
163 | 163 | } |
164 | - else if($action=='add_subtotal_line') { |
|
164 | + else if ($action == 'add_subtotal_line') { |
|
165 | 165 | $title = $langs->trans('SubSubTotal'); |
166 | 166 | $qty = 98; |
167 | 167 | } |
168 | 168 | else { |
169 | 169 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
170 | - $qty = $level ? 100-$level : 99; |
|
170 | + $qty = $level ? 100 - $level : 99; |
|
171 | 171 | } |
172 | 172 | dol_include_once('/subtotal/class/subtotal.class.php'); |
173 | 173 | |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | |
176 | 176 | TSubtotal::addSubTotalLine($object, $title, $qty); |
177 | 177 | } |
178 | - else if($action==='ask_deleteallline') { |
|
179 | - $form=new Form($db); |
|
178 | + else if ($action === 'ask_deleteallline') { |
|
179 | + $form = new Form($db); |
|
180 | 180 | |
181 | - $lineid = GETPOST('lineid','integer'); |
|
181 | + $lineid = GETPOST('lineid', 'integer'); |
|
182 | 182 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
183 | 183 | |
184 | 184 | $nbLines = count($TIdForGroup); |
185 | 185 | |
186 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
186 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
187 | 187 | print $formconfirm; |
188 | 188 | } |
189 | 189 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | |
196 | - if($action!='editline') { |
|
196 | + if ($action != 'editline') { |
|
197 | 197 | // New format is for 3.8 |
198 | 198 | $this->printNewFormat($object, $conf, $langs, $idvar); |
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
202 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
202 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
203 | 203 | { |
204 | 204 | ?> |
205 | 205 | <script type="text/javascript"> |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $(document).ready(function() { |
225 | 225 | $('div.fiche div.tabsAction').append('<br />'); |
226 | 226 | |
227 | - $('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>'); |
|
227 | + $('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>'); |
|
228 | 228 | $('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>'); |
229 | 229 | $('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>'); |
230 | 230 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $('body').append(dialog_html); |
276 | 276 | |
277 | 277 | <?php |
278 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
279 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
280 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
278 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
279 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
280 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
281 | 281 | ?> |
282 | 282 | if (action == 'addTitle' || action == 'addFreeTxt') |
283 | 283 | { |
@@ -392,62 +392,62 @@ discard block |
||
392 | 392 | global $conf, $langs, $bc; |
393 | 393 | |
394 | 394 | $action = GETPOST('action'); |
395 | - $TContext = explode(':',$parameters['context']); |
|
395 | + $TContext = explode(':', $parameters['context']); |
|
396 | 396 | if ( |
397 | - in_array('invoicecard',$TContext) |
|
398 | - || in_array('invoicesuppliercard',$TContext) |
|
399 | - || in_array('propalcard',$TContext) |
|
400 | - || in_array('ordercard',$TContext) |
|
401 | - || in_array('ordersuppliercard',$TContext) |
|
402 | - || in_array('invoicereccard',$TContext) |
|
397 | + in_array('invoicecard', $TContext) |
|
398 | + || in_array('invoicesuppliercard', $TContext) |
|
399 | + || in_array('propalcard', $TContext) |
|
400 | + || in_array('ordercard', $TContext) |
|
401 | + || in_array('ordersuppliercard', $TContext) |
|
402 | + || in_array('invoicereccard', $TContext) |
|
403 | 403 | ) |
404 | 404 | { |
405 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
407 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
408 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
405 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
407 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
408 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
409 | 409 | |
410 | - $var=false; |
|
411 | - $out.= '<tr '.$bc[$var].'> |
|
410 | + $var = false; |
|
411 | + $out .= '<tr '.$bc[$var].'> |
|
412 | 412 | <td colspan="4" align="right"> |
413 | 413 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
414 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
414 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
415 | 415 | </td> |
416 | 416 | </tr>'; |
417 | 417 | |
418 | - $var=!$var; |
|
419 | - $out.= '<tr '.$bc[$var].'> |
|
418 | + $var = !$var; |
|
419 | + $out .= '<tr '.$bc[$var].'> |
|
420 | 420 | <td colspan="4" align="right"> |
421 | 421 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
422 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
422 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
423 | 423 | </td> |
424 | 424 | </tr>'; |
425 | 425 | |
426 | - $var=!$var; |
|
427 | - $out.= '<tr '.$bc[$var].'> |
|
426 | + $var = !$var; |
|
427 | + $out .= '<tr '.$bc[$var].'> |
|
428 | 428 | <td colspan="4" align="right"> |
429 | 429 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
430 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
430 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
431 | 431 | </td> |
432 | 432 | </tr>'; |
433 | 433 | |
434 | 434 | |
435 | 435 | |
436 | 436 | if ( |
437 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
438 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
439 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
440 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
441 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
442 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
437 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
438 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
439 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
440 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
441 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
442 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
443 | 443 | ) |
444 | 444 | { |
445 | - $var=!$var; |
|
446 | - $out.= ' |
|
445 | + $var = !$var; |
|
446 | + $out .= ' |
|
447 | 447 | <tr '.$bc[$var].'> |
448 | 448 | <td colspan="4" align="right"> |
449 | 449 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
450 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
450 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
451 | 451 | </td> |
452 | 452 | </tr>'; |
453 | 453 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
464 | 464 | { |
465 | 465 | |
466 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
466 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
467 | 467 | { |
468 | 468 | |
469 | 469 | } |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
475 | 475 | global $conf; |
476 | 476 | |
477 | - if($action === 'builddoc') { |
|
477 | + if ($action === 'builddoc') { |
|
478 | 478 | |
479 | 479 | $line = &$parameters['line']; |
480 | 480 | $object = &$parameters['object']; |
481 | 481 | $substitutionarray = &$parameters['substitutionarray']; |
482 | 482 | |
483 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
483 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
484 | 484 | $substitutionarray['line_modsubtotal'] = 1; |
485 | 485 | |
486 | 486 | $substitutionarray['line_price_ht'] |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | = $substitutionarray['line_up'] |
492 | 492 | = ''; |
493 | 493 | |
494 | - if($line->qty>90) { |
|
494 | + if ($line->qty > 90) { |
|
495 | 495 | $substitutionarray['line_modsubtotal_total'] = true; |
496 | 496 | |
497 | 497 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | |
507 | 507 | } |
508 | - else{ |
|
508 | + else { |
|
509 | 509 | $substitutionarray['line_not_modsubtotal'] = true; |
510 | 510 | $substitutionarray['line_modsubtotal'] = 0; |
511 | 511 | } |
@@ -517,29 +517,29 @@ discard block |
||
517 | 517 | function createFrom($parameters, &$object, $action, $hookmanager) { |
518 | 518 | |
519 | 519 | if ( |
520 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
521 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
522 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
523 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
524 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
525 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
526 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
520 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
521 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
522 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
523 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
524 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
525 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
526 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
527 | 527 | ) { |
528 | 528 | |
529 | 529 | global $db; |
530 | 530 | |
531 | 531 | $objFrom = $parameters['objFrom']; |
532 | 532 | |
533 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
533 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
534 | 534 | |
535 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
535 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
536 | 536 | |
537 | 537 | $line = & $object->lines[$k]; |
538 | 538 | |
539 | 539 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
540 | 540 | |
541 | 541 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
542 | - SET info_bits=".(int)$lineOld->info_bits." |
|
542 | + SET info_bits=".(int) $lineOld->info_bits." |
|
543 | 543 | WHERE rowid = ".$idLine." |
544 | 544 | "); |
545 | 545 | |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | |
556 | 556 | function doActions($parameters, &$object, $action, $hookmanager) |
557 | 557 | { |
558 | - global $db, $conf, $langs,$user; |
|
558 | + global $db, $conf, $langs, $user; |
|
559 | 559 | |
560 | 560 | dol_include_once('/subtotal/class/subtotal.class.php'); |
561 | 561 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
562 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
562 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
563 | 563 | |
564 | 564 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
565 | 565 | |
566 | - if($object->element=='facture') $idvar = 'facid'; |
|
566 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
567 | 567 | else $idvar = 'id'; |
568 | 568 | |
569 | 569 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
577 | 577 | { |
578 | 578 | $found = true; |
579 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
579 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
580 | 580 | $extrafieldsline = new ExtraFields($db); |
581 | 581 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
582 | 582 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -595,43 +595,43 @@ discard block |
||
595 | 595 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
596 | 596 | } |
597 | 597 | } |
598 | - else if($action === 'builddoc') { |
|
598 | + else if ($action === 'builddoc') { |
|
599 | 599 | |
600 | 600 | if ( |
601 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
602 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
603 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
604 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
605 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
606 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
601 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
602 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
603 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
604 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
605 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
606 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
607 | 607 | ) |
608 | 608 | { |
609 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
609 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
610 | 610 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 611 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 612 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | 613 | } |
614 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
614 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
615 | 615 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
616 | 616 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
617 | 617 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
618 | 618 | } |
619 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
619 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
620 | 620 | $sessname = 'subtotal_hideInnerLines_propal'; |
621 | 621 | $sessname2 = 'subtotal_hidedetails_propal'; |
622 | 622 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | 623 | } |
624 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
624 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
625 | 625 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
626 | 626 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
627 | 627 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
628 | 628 | } |
629 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
629 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
630 | 630 | $sessname = 'subtotal_hideInnerLines_commande'; |
631 | 631 | $sessname2 = 'subtotal_hidedetails_commande'; |
632 | 632 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | 633 | } |
634 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
634 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
635 | 635 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
636 | 636 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
637 | 637 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -644,25 +644,25 @@ discard block |
||
644 | 644 | |
645 | 645 | global $hideprices; |
646 | 646 | |
647 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
648 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
647 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
648 | + if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system |
|
649 | 649 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
650 | 650 | |
651 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
652 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
651 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
652 | + if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system |
|
653 | 653 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
654 | 654 | |
655 | - $hideprices= (int)GETPOST('hideprices'); |
|
656 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
655 | + $hideprices = (int) GETPOST('hideprices'); |
|
656 | + if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system |
|
657 | 657 | $_SESSION[$sessname3][$object->id] = $hideprices; |
658 | 658 | |
659 | - foreach($object->lines as &$line) { |
|
659 | + foreach ($object->lines as &$line) { |
|
660 | 660 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
661 | 661 | |
662 | - if($line->qty>=90) { |
|
662 | + if ($line->qty >= 90) { |
|
663 | 663 | $line->modsubtotal_total = 1; |
664 | 664 | } |
665 | - else{ |
|
665 | + else { |
|
666 | 666 | $line->modsubtotal_title = 1; |
667 | 667 | } |
668 | 668 | |
@@ -672,34 +672,34 @@ discard block |
||
672 | 672 | } |
673 | 673 | |
674 | 674 | } |
675 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
675 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
676 | 676 | |
677 | 677 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
678 | 678 | |
679 | - foreach($Tab as $idLine) { |
|
679 | + foreach ($Tab as $idLine) { |
|
680 | 680 | /** |
681 | 681 | * @var $object Facture |
682 | 682 | */ |
683 | - if($object->element=='facture') $object->deleteline($idLine); |
|
683 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
684 | 684 | /** |
685 | 685 | * @var $object Facture fournisseur |
686 | 686 | */ |
687 | - else if($object->element=='invoice_supplier') |
|
687 | + else if ($object->element == 'invoice_supplier') |
|
688 | 688 | { |
689 | 689 | $object->deleteline($idLine); |
690 | 690 | } |
691 | 691 | /** |
692 | 692 | * @var $object Propal |
693 | 693 | */ |
694 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
694 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
695 | 695 | /** |
696 | 696 | * @var $object Propal Fournisseur |
697 | 697 | */ |
698 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
698 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
699 | 699 | /** |
700 | 700 | * @var $object Commande |
701 | 701 | */ |
702 | - else if($object->element=='commande') |
|
702 | + else if ($object->element == 'commande') |
|
703 | 703 | { |
704 | 704 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
705 | 705 | else $object->deleteline($idLine); |
@@ -707,14 +707,14 @@ discard block |
||
707 | 707 | /** |
708 | 708 | * @var $object Commande fournisseur |
709 | 709 | */ |
710 | - else if($object->element=='order_supplier') |
|
710 | + else if ($object->element == 'order_supplier') |
|
711 | 711 | { |
712 | 712 | $object->deleteline($idLine); |
713 | 713 | } |
714 | 714 | /** |
715 | 715 | * @var $object Facturerec |
716 | 716 | */ |
717 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
717 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | header('location:?id='.$object->id); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | return 0; |
738 | 738 | } |
739 | 739 | |
740 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
740 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
741 | 741 | return 0; |
742 | 742 | } |
743 | 743 | |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | if (!empty($parameters['fk_element'])) |
756 | 756 | { |
757 | 757 | |
758 | - if($obj->fetch($parameters['fk_element'])){ |
|
759 | - $obj->id= $obj->rowid; |
|
758 | + if ($obj->fetch($parameters['fk_element'])) { |
|
759 | + $obj->id = $obj->rowid; |
|
760 | 760 | if (empty($obj->array_options)) |
761 | 761 | $obj->fetch_optionals(); |
762 | 762 | if (!empty($obj->array_options['options_subtotal_nc'])) |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | |
777 | 777 | $found = false; |
778 | 778 | |
779 | - $Tab= array(); |
|
779 | + $Tab = array(); |
|
780 | 780 | |
781 | - foreach($object->lines as $l) { |
|
781 | + foreach ($object->lines as $l) { |
|
782 | 782 | |
783 | 783 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
784 | - if($lid == $lineid) { |
|
784 | + if ($lid == $lineid) { |
|
785 | 785 | |
786 | 786 | $found = true; |
787 | 787 | $qty_line = $l->qty; |
788 | 788 | } |
789 | 789 | |
790 | - if($found) { |
|
790 | + if ($found) { |
|
791 | 791 | |
792 | 792 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
793 | 793 | |
794 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
794 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
795 | 795 | break; // end of story |
796 | 796 | } |
797 | 797 | } |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @param $use_level isn't used anymore |
822 | 822 | */ |
823 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
823 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
824 | 824 | |
825 | 825 | $rang = $line->rang; |
826 | 826 | $qty_line = $line->qty; |
@@ -831,21 +831,21 @@ discard block |
||
831 | 831 | $TTotal_tva = array(); |
832 | 832 | |
833 | 833 | dol_include_once('/subtotal/class/subtotal.class.php'); |
834 | - foreach($object->lines as $l) { |
|
834 | + foreach ($object->lines as $l) { |
|
835 | 835 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
836 | - if($l->rang>=$rang) { |
|
836 | + if ($l->rang >= $rang) { |
|
837 | 837 | //echo 'return!<br>'; |
838 | 838 | if (!$return_all) return $total; |
839 | 839 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
840 | 840 | } |
841 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
841 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
842 | 842 | { |
843 | 843 | $total = 0; |
844 | 844 | $total_tva = 0; |
845 | 845 | $total_ttc = 0; |
846 | 846 | $TTotal_tva = array(); |
847 | 847 | } |
848 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
848 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
849 | 849 | $total += $l->total_ht; |
850 | 850 | $total_tva += $l->total_tva; |
851 | 851 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -864,18 +864,18 @@ discard block |
||
864 | 864 | |
865 | 865 | $rang = $line->rang; |
866 | 866 | $total = 0; |
867 | - foreach($object->lines as $l) { |
|
868 | - if($l->rang>=$rang) { |
|
867 | + foreach ($object->lines as $l) { |
|
868 | + if ($l->rang >= $rang) { |
|
869 | 869 | return price($total); |
870 | 870 | } |
871 | - if (TSubtotal::isSubtotal($l)){ |
|
871 | + if (TSubtotal::isSubtotal($l)) { |
|
872 | 872 | $total = 0; |
873 | - } else if ($l->situation_percent > 0 ){ |
|
873 | + } else if ($l->situation_percent > 0) { |
|
874 | 874 | |
875 | 875 | |
876 | 876 | $prev_progress = $l->get_prev_progress($object->id); |
877 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
878 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
877 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
878 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | } |
@@ -894,10 +894,10 @@ discard block |
||
894 | 894 | * @param $w float width |
895 | 895 | * @param $h float height |
896 | 896 | */ |
897 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
898 | - global $conf,$subtotal_last_title_posy; |
|
897 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
898 | + global $conf, $subtotal_last_title_posy; |
|
899 | 899 | |
900 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
900 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
901 | 901 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
902 | 902 | { |
903 | 903 | $posy = $subtotal_last_title_posy; |
@@ -907,34 +907,34 @@ discard block |
||
907 | 907 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
908 | 908 | |
909 | 909 | $set_pagebreak_margin = false; |
910 | - if(method_exists('Closure','bind')) { |
|
910 | + if (method_exists('Closure', 'bind')) { |
|
911 | 911 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
912 | - $sweetsThief = function ($pdf) { |
|
913 | - return $pdf->bMargin ; |
|
912 | + $sweetsThief = function($pdf) { |
|
913 | + return $pdf->bMargin; |
|
914 | 914 | }; |
915 | 915 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
916 | 916 | |
917 | - $bMargin = $sweetsThief($pdf); |
|
917 | + $bMargin = $sweetsThief($pdf); |
|
918 | 918 | |
919 | - $pdf->SetAutoPageBreak( false ); |
|
919 | + $pdf->SetAutoPageBreak(false); |
|
920 | 920 | |
921 | 921 | $set_pagebreak_margin = true; |
922 | 922 | } |
923 | 923 | |
924 | 924 | |
925 | - if($line->qty==99) |
|
926 | - $pdf->SetFillColor(220,220,220); |
|
927 | - elseif ($line->qty==98) |
|
928 | - $pdf->SetFillColor(230,230,230); |
|
925 | + if ($line->qty == 99) |
|
926 | + $pdf->SetFillColor(220, 220, 220); |
|
927 | + elseif ($line->qty == 98) |
|
928 | + $pdf->SetFillColor(230, 230, 230); |
|
929 | 929 | else |
930 | - $pdf->SetFillColor(240,240,240); |
|
930 | + $pdf->SetFillColor(240, 240, 240); |
|
931 | 931 | |
932 | 932 | $style = 'B'; |
933 | 933 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
934 | 934 | |
935 | 935 | $pdf->SetFont('', $style, 9); |
936 | 936 | |
937 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
937 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
938 | 938 | // var_dump($bMargin); |
939 | 939 | $pageAfter = $pdf->getPage(); |
940 | 940 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | } |
960 | 960 | } |
961 | 961 | |
962 | - if($total_to_print !== '') { |
|
962 | + if ($total_to_print !== '') { |
|
963 | 963 | |
964 | 964 | if (GETPOST('hideInnerLines')) |
965 | 965 | { |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | else |
974 | 974 | { |
975 | 975 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
976 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
977 | 977 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
978 | 978 | } else { |
979 | 979 | $total_to_print = price($total); |
@@ -987,11 +987,11 @@ discard block |
||
987 | 987 | } |
988 | 988 | |
989 | 989 | $pdf->SetXY($pdf->postotalht, $posy); |
990 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
991 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
990 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
991 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
992 | 992 | } |
993 | - else{ |
|
994 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
993 | + else { |
|
994 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | $posy = $posy + $cell_height; |
@@ -1011,22 +1011,22 @@ discard block |
||
1011 | 1011 | * @param $w float width |
1012 | 1012 | * @param $h float height |
1013 | 1013 | */ |
1014 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
1014 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
1015 | 1015 | |
1016 | - global $db,$conf,$subtotal_last_title_posy; |
|
1016 | + global $db, $conf, $subtotal_last_title_posy; |
|
1017 | 1017 | |
1018 | 1018 | $subtotal_last_title_posy = $posy; |
1019 | - $pdf->SetXY ($posx, $posy); |
|
1019 | + $pdf->SetXY($posx, $posy); |
|
1020 | 1020 | |
1021 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1021 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1022 | 1022 | |
1023 | 1023 | |
1024 | 1024 | |
1025 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
1025 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
1026 | 1026 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
1027 | 1027 | |
1028 | - if($hideInnerLines) { |
|
1029 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1028 | + if ($hideInnerLines) { |
|
1029 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
1030 | 1030 | else |
1031 | 1031 | { |
1032 | 1032 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -1035,43 +1035,43 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | else { |
1037 | 1037 | |
1038 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1038 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1039 | 1039 | else $pdf->SetFont('', $style, 9); |
1040 | 1040 | |
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
1044 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1044 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
1045 | 1045 | |
1046 | - if($description && !$hidedesc) { |
|
1046 | + if ($description && !$hidedesc) { |
|
1047 | 1047 | $posy = $pdf->GetY(); |
1048 | 1048 | |
1049 | 1049 | $pdf->SetFont('', '', 8); |
1050 | 1050 | |
1051 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
1051 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
1052 | 1052 | |
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | } |
1056 | 1056 | |
1057 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
1057 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
1058 | 1058 | // ultimate PDF hook O_o |
1059 | 1059 | |
1060 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
1060 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
1061 | 1061 | |
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | function isModSubtotalLine(&$parameters, &$object) { |
1065 | 1065 | |
1066 | - if(is_array($parameters)) { |
|
1066 | + if (is_array($parameters)) { |
|
1067 | 1067 | $i = & $parameters['i']; |
1068 | 1068 | } |
1069 | 1069 | else { |
1070 | - $i = (int)$parameters; |
|
1070 | + $i = (int) $parameters; |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
1074 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1074 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1075 | 1075 | return true; |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1079,43 +1079,43 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
1083 | - global $conf,$hideprices; |
|
1082 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
1083 | + global $conf, $hideprices; |
|
1084 | 1084 | |
1085 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1085 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1086 | 1086 | |
1087 | 1087 | $this->resprints = ' '; |
1088 | 1088 | |
1089 | - if((float)DOL_VERSION<=3.6) { |
|
1089 | + if ((float) DOL_VERSION <= 3.6) { |
|
1090 | 1090 | return ''; |
1091 | 1091 | } |
1092 | - else if((float)DOL_VERSION>=3.8) { |
|
1092 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1093 | 1093 | return 1; |
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | } |
1097 | - elseif(!empty($hideprices)) { |
|
1097 | + elseif (!empty($hideprices)) { |
|
1098 | 1098 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1099 | 1099 | return 1; |
1100 | 1100 | } |
1101 | 1101 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1102 | 1102 | { |
1103 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1104 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1103 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1104 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1105 | 1105 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1106 | 1106 | { |
1107 | 1107 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1112 | - else $i = (int)$parameters; |
|
1111 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1112 | + else $i = (int) $parameters; |
|
1113 | 1113 | |
1114 | 1114 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
1115 | 1115 | |
1116 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1116 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1117 | 1117 | |
1118 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1118 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1119 | 1119 | { |
1120 | 1120 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1121 | 1121 | { |
@@ -1127,20 +1127,20 @@ discard block |
||
1127 | 1127 | return 0; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1130 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1131 | 1131 | global $conf, $hideprices, $hookmanager; |
1132 | 1132 | |
1133 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1134 | - else $i = (int)$parameters; |
|
1133 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1134 | + else $i = (int) $parameters; |
|
1135 | 1135 | |
1136 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1136 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1137 | 1137 | |
1138 | 1138 | $this->resprints = ' '; |
1139 | 1139 | |
1140 | - if((float)DOL_VERSION<=3.6) { |
|
1140 | + if ((float) DOL_VERSION <= 3.6) { |
|
1141 | 1141 | return ''; |
1142 | 1142 | } |
1143 | - else if((float)DOL_VERSION>=3.8) { |
|
1143 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1144 | 1144 | return 1; |
1145 | 1145 | } |
1146 | 1146 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1169 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1170 | 1170 | $this->resprints = price($object->lines[$i]->total_ht); |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | // Check if a title exist for this line && if the title have subtotal |
1193 | 1193 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1194 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1194 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1195 | 1195 | { |
1196 | 1196 | |
1197 | 1197 | $this->resprints = ' '; |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
1213 | 1213 | { |
1214 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
1214 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
1215 | 1215 | if ($reshook < 0) |
1216 | 1216 | { |
1217 | 1217 | $this->error = $hookmanager->error; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $this->resprints = $hookmanager->resprints; |
1228 | 1228 | |
1229 | 1229 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
1230 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
1230 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
1231 | 1231 | { |
1232 | 1232 | return $hookmanager->resArray['overrideReturn']; |
1233 | 1233 | } |
@@ -1236,25 +1236,25 @@ discard block |
||
1236 | 1236 | return $defaultReturn; |
1237 | 1237 | } |
1238 | 1238 | |
1239 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1239 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1240 | 1240 | global $conf; |
1241 | 1241 | |
1242 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1242 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1243 | 1243 | |
1244 | 1244 | $this->resprints = ' '; |
1245 | 1245 | |
1246 | - if((float)DOL_VERSION<=3.6) { |
|
1246 | + if ((float) DOL_VERSION <= 3.6) { |
|
1247 | 1247 | return ''; |
1248 | 1248 | } |
1249 | - else if((float)DOL_VERSION>=3.8) { |
|
1249 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1250 | 1250 | return 1; |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1255 | - else $i = (int)$parameters; |
|
1254 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1255 | + else $i = (int) $parameters; |
|
1256 | 1256 | |
1257 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1257 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1258 | 1258 | { |
1259 | 1259 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1260 | 1260 | { |
@@ -1266,24 +1266,24 @@ discard block |
||
1266 | 1266 | return 0; |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1269 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1270 | 1270 | global $conf; |
1271 | 1271 | |
1272 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1272 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1273 | 1273 | $this->resprints = ' '; |
1274 | 1274 | |
1275 | - if((float)DOL_VERSION<=3.6) { |
|
1275 | + if ((float) DOL_VERSION <= 3.6) { |
|
1276 | 1276 | return ''; |
1277 | 1277 | } |
1278 | - else if((float)DOL_VERSION>=3.8) { |
|
1278 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1279 | 1279 | return 1; |
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1284 | - else $i = (int)$parameters; |
|
1283 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1284 | + else $i = (int) $parameters; |
|
1285 | 1285 | |
1286 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1286 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1287 | 1287 | { |
1288 | 1288 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1289 | 1289 | { |
@@ -1295,31 +1295,31 @@ discard block |
||
1295 | 1295 | return 0; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1299 | - global $conf,$hideprices,$hookmanager; |
|
1298 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1299 | + global $conf, $hideprices, $hookmanager; |
|
1300 | 1300 | |
1301 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1302 | - else $i = (int)$parameters; |
|
1301 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1302 | + else $i = (int) $parameters; |
|
1303 | 1303 | |
1304 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1304 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1305 | 1305 | $this->resprints = ' '; |
1306 | 1306 | |
1307 | 1307 | $line = $object->lines[$i]; |
1308 | 1308 | |
1309 | 1309 | // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
1310 | - if(TSubtotal::isSubtotal($line)) { |
|
1310 | + if (TSubtotal::isSubtotal($line)) { |
|
1311 | 1311 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1312 | 1312 | |
1313 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1313 | + if (!empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1314 | 1314 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1315 | 1315 | $this->resprints = price($TTotal['total_subprice']); |
1316 | 1316 | } |
1317 | 1317 | } |
1318 | 1318 | |
1319 | - if((float)DOL_VERSION<=3.6) { |
|
1319 | + if ((float) DOL_VERSION <= 3.6) { |
|
1320 | 1320 | return ''; |
1321 | 1321 | } |
1322 | - else if((float)DOL_VERSION>=3.8) { |
|
1322 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1323 | 1323 | return 1; |
1324 | 1324 | } |
1325 | 1325 | } |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | // Check if a title exist for this line && if the title have subtotal |
1349 | 1349 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1350 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1350 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1351 | 1351 | { |
1352 | 1352 | |
1353 | 1353 | $this->resprints = ' '; |
@@ -1361,36 +1361,36 @@ discard block |
||
1361 | 1361 | return 0; |
1362 | 1362 | } |
1363 | 1363 | |
1364 | - function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
|
1365 | - global $conf,$hideprices,$hookmanager; |
|
1364 | + function pdf_getlineremisepercent($parameters = array(), &$object, &$action = '') { |
|
1365 | + global $conf, $hideprices, $hookmanager; |
|
1366 | 1366 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1367 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1368 | 1368 | else $i = (int) $parameters; |
1369 | 1369 | |
1370 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1370 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1371 | 1371 | $this->resprints = ' '; |
1372 | 1372 | |
1373 | 1373 | $line = $object->lines[$i]; |
1374 | 1374 | |
1375 | 1375 | // Affichage de la remise |
1376 | - if(TSubtotal::isSubtotal($line)) { |
|
1376 | + if (TSubtotal::isSubtotal($line)) { |
|
1377 | 1377 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1378 | 1378 | |
1379 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1379 | + if (!empty($parentTitle->array_options['options_show_reduc'])) { |
|
1380 | 1380 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1381 | - $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%'; |
|
1381 | + $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice'] * 100, 0, '', 1, 2, 2).'%'; |
|
1382 | 1382 | } |
1383 | 1383 | } |
1384 | 1384 | |
1385 | - if((float)DOL_VERSION<=3.6) { |
|
1385 | + if ((float) DOL_VERSION <= 3.6) { |
|
1386 | 1386 | return ''; |
1387 | 1387 | } |
1388 | - else if((float)DOL_VERSION>=3.8) { |
|
1388 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1389 | 1389 | return 1; |
1390 | 1390 | } |
1391 | 1391 | } |
1392 | 1392 | elseif (!empty($hideprices) |
1393 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1393 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1394 | 1394 | ) |
1395 | 1395 | { |
1396 | 1396 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1403,24 +1403,24 @@ discard block |
||
1403 | 1403 | return 0; |
1404 | 1404 | } |
1405 | 1405 | |
1406 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1407 | - global $conf,$hideprices; |
|
1406 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1407 | + global $conf, $hideprices; |
|
1408 | 1408 | |
1409 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1409 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1410 | 1410 | $this->resprints = ' '; |
1411 | - if((float)DOL_VERSION<=3.6) { |
|
1411 | + if ((float) DOL_VERSION <= 3.6) { |
|
1412 | 1412 | return ''; |
1413 | 1413 | } |
1414 | - else if((float)DOL_VERSION>=3.8) { |
|
1414 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1415 | 1415 | return 1; |
1416 | 1416 | } |
1417 | 1417 | } |
1418 | 1418 | |
1419 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1420 | - else $i = (int)$parameters; |
|
1419 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1420 | + else $i = (int) $parameters; |
|
1421 | 1421 | |
1422 | 1422 | if (!empty($hideprices) |
1423 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1423 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1424 | 1424 | ) |
1425 | 1425 | { |
1426 | 1426 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1433,22 +1433,22 @@ discard block |
||
1433 | 1433 | return 0; |
1434 | 1434 | } |
1435 | 1435 | |
1436 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1437 | - global $conf,$hideprices,$hookmanager; |
|
1436 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1437 | + global $conf, $hideprices, $hookmanager; |
|
1438 | 1438 | |
1439 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1439 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1440 | 1440 | $this->resprints = ' '; |
1441 | 1441 | |
1442 | - if((float)DOL_VERSION<=3.6) { |
|
1442 | + if ((float) DOL_VERSION <= 3.6) { |
|
1443 | 1443 | return ''; |
1444 | 1444 | } |
1445 | - else if((float)DOL_VERSION>=3.8) { |
|
1445 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1446 | 1446 | return 1; |
1447 | 1447 | } |
1448 | 1448 | } |
1449 | 1449 | |
1450 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1451 | - else $i = (int)$parameters; |
|
1450 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1451 | + else $i = (int) $parameters; |
|
1452 | 1452 | |
1453 | 1453 | 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) |
1454 | 1454 | |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | |
1476 | 1476 | // Check if a title exist for this line && if the title have subtotal |
1477 | 1477 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1478 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1478 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1479 | 1479 | { |
1480 | 1480 | |
1481 | 1481 | $this->resprints = ' '; |
@@ -1489,23 +1489,23 @@ discard block |
||
1489 | 1489 | return 0; |
1490 | 1490 | } |
1491 | 1491 | |
1492 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1492 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1493 | 1493 | global $conf; |
1494 | 1494 | |
1495 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1495 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1496 | 1496 | $this->resprints = ' '; |
1497 | - if((float)DOL_VERSION<=3.6) { |
|
1497 | + if ((float) DOL_VERSION <= 3.6) { |
|
1498 | 1498 | return ''; |
1499 | 1499 | } |
1500 | - else if((float)DOL_VERSION>=3.8) { |
|
1500 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1501 | 1501 | return 1; |
1502 | 1502 | } |
1503 | 1503 | } |
1504 | 1504 | |
1505 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1506 | - else $i = (int)$parameters; |
|
1505 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1506 | + else $i = (int) $parameters; |
|
1507 | 1507 | |
1508 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1508 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1509 | 1509 | { |
1510 | 1510 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1511 | 1511 | { |
@@ -1520,12 +1520,12 @@ discard block |
||
1520 | 1520 | function add_numerotation(&$object) { |
1521 | 1521 | global $conf; |
1522 | 1522 | |
1523 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1523 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1524 | 1524 | |
1525 | 1525 | $TLevelTitre = array(); |
1526 | 1526 | $prevlevel = 0; |
1527 | 1527 | |
1528 | - foreach($object->lines as $k=>&$line) |
|
1528 | + foreach ($object->lines as $k=>&$line) |
|
1529 | 1529 | { |
1530 | 1530 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1531 | 1531 | { |
@@ -1539,12 +1539,12 @@ discard block |
||
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1542 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1542 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1543 | 1543 | { |
1544 | 1544 | $TTitle = array(); |
1545 | 1545 | |
1546 | - $i=1; |
|
1547 | - $j=0; |
|
1546 | + $i = 1; |
|
1547 | + $j = 0; |
|
1548 | 1548 | foreach ($TLineTitle as $k => &$line) |
1549 | 1549 | { |
1550 | 1550 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | { |
1555 | 1555 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1556 | 1556 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1557 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1557 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1558 | 1558 | { |
1559 | 1559 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1560 | 1560 | $line->desc = $line->description = ''; |
@@ -1580,26 +1580,26 @@ discard block |
||
1580 | 1580 | |
1581 | 1581 | function setDocTVA(&$pdf, &$object) { |
1582 | 1582 | |
1583 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1583 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1584 | 1584 | |
1585 | - if(empty($hidedetails)) return false; |
|
1585 | + if (empty($hidedetails)) return false; |
|
1586 | 1586 | |
1587 | 1587 | // TODO can't add VAT to document without lines... :-/ |
1588 | 1588 | |
1589 | 1589 | return true; |
1590 | 1590 | } |
1591 | 1591 | |
1592 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1592 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1593 | 1593 | { |
1594 | 1594 | /** |
1595 | 1595 | * @var $pdf TCPDF |
1596 | 1596 | */ |
1597 | - global $pdf,$conf, $langs; |
|
1597 | + global $pdf, $conf, $langs; |
|
1598 | 1598 | |
1599 | 1599 | // var_dump($object->lines); |
1600 | 1600 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1601 | 1601 | |
1602 | - foreach($parameters as $key=>$value) { |
|
1602 | + foreach ($parameters as $key=>$value) { |
|
1603 | 1603 | ${$key} = $value; |
1604 | 1604 | } |
1605 | 1605 | |
@@ -1607,34 +1607,34 @@ discard block |
||
1607 | 1607 | |
1608 | 1608 | $this->add_numerotation($object); |
1609 | 1609 | |
1610 | - foreach($object->lines as $k => &$l) { |
|
1611 | - if(TSubtotal::isSubtotal($l)) { |
|
1610 | + foreach ($object->lines as $k => &$l) { |
|
1611 | + if (TSubtotal::isSubtotal($l)) { |
|
1612 | 1612 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
1613 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1614 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1613 | + if (!empty($parentTitle->id) && !empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1614 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1615 | 1615 | } |
1616 | 1616 | } |
1617 | 1617 | } |
1618 | 1618 | |
1619 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1620 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1619 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1620 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1621 | 1621 | |
1622 | 1622 | if ($hideInnerLines) { // si c une ligne de titre |
1623 | - $fk_parent_line=0; |
|
1624 | - $TLines =array(); |
|
1623 | + $fk_parent_line = 0; |
|
1624 | + $TLines = array(); |
|
1625 | 1625 | |
1626 | - $original_count=count($object->lines); |
|
1626 | + $original_count = count($object->lines); |
|
1627 | 1627 | $TTvas = array(); // tableau de tva |
1628 | 1628 | |
1629 | - foreach($object->lines as $k=>&$line) |
|
1629 | + foreach ($object->lines as $k=>&$line) |
|
1630 | 1630 | { |
1631 | 1631 | |
1632 | - if($line->product_type==9 && $line->rowid>0) |
|
1632 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1633 | 1633 | { |
1634 | 1634 | $fk_parent_line = $line->rowid; |
1635 | 1635 | |
1636 | 1636 | // 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 |
1637 | - if(TSubtotal::isSubtotal($line)) |
|
1637 | + if (TSubtotal::isSubtotal($line)) |
|
1638 | 1638 | { |
1639 | 1639 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1640 | 1640 | |
@@ -1663,22 +1663,22 @@ discard block |
||
1663 | 1663 | |
1664 | 1664 | if ($hideInnerLines) |
1665 | 1665 | { |
1666 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1666 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1667 | 1667 | { |
1668 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1668 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1669 | 1669 | |
1670 | 1670 | // on remplit le tableau de tva pour substituer les lignes cachées |
1671 | 1671 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1672 | 1672 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1673 | 1673 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1674 | 1674 | } |
1675 | - if($line->product_type==9 && $line->rowid>0) |
|
1675 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1676 | 1676 | { |
1677 | 1677 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1678 | 1678 | // génère des lignes d'affichage des montants HT soumis à tva |
1679 | 1679 | $nbtva = count($TTvas); |
1680 | - if(!empty($nbtva)){ |
|
1681 | - foreach ($TTvas as $tx =>$val){ |
|
1680 | + if (!empty($nbtva)) { |
|
1681 | + foreach ($TTvas as $tx =>$val) { |
|
1682 | 1682 | $l = clone $line; |
1683 | 1683 | $l->product_type = 1; |
1684 | 1684 | $l->special_code = ''; |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | } |
1700 | 1700 | } else { |
1701 | 1701 | |
1702 | - if($line->product_type==9 && $line->rowid>0) |
|
1702 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1703 | 1703 | { |
1704 | 1704 | // ajoute la ligne de sous-total |
1705 | 1705 | $TLines[] = $line; |
@@ -1727,9 +1727,9 @@ discard block |
||
1727 | 1727 | |
1728 | 1728 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1729 | 1729 | $nbtva = count($TTvas); |
1730 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1730 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1731 | 1731 | { |
1732 | - foreach ($TTvas as $tx =>$val){ |
|
1732 | + foreach ($TTvas as $tx =>$val) { |
|
1733 | 1733 | $l = clone $line; |
1734 | 1734 | $l->product_type = 1; |
1735 | 1735 | $l->special_code = ''; |
@@ -1746,11 +1746,11 @@ discard block |
||
1746 | 1746 | } |
1747 | 1747 | |
1748 | 1748 | global $nblignes; |
1749 | - $nblignes=count($TLines); |
|
1749 | + $nblignes = count($TLines); |
|
1750 | 1750 | |
1751 | 1751 | $object->lines = $TLines; |
1752 | 1752 | |
1753 | - if($i>count($object->lines)) { |
|
1753 | + if ($i > count($object->lines)) { |
|
1754 | 1754 | $this->resprints = ''; |
1755 | 1755 | return 0; |
1756 | 1756 | } |
@@ -1759,59 +1759,59 @@ discard block |
||
1759 | 1759 | return 0; |
1760 | 1760 | } |
1761 | 1761 | |
1762 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1762 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1763 | 1763 | { |
1764 | 1764 | /** |
1765 | 1765 | * @var $pdf TCPDF |
1766 | 1766 | */ |
1767 | - global $pdf,$conf; |
|
1767 | + global $pdf, $conf; |
|
1768 | 1768 | |
1769 | - foreach($parameters as $key=>$value) { |
|
1769 | + foreach ($parameters as $key=>$value) { |
|
1770 | 1770 | ${$key} = $value; |
1771 | 1771 | } |
1772 | 1772 | |
1773 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1774 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1773 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1774 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1775 | 1775 | |
1776 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1776 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1777 | 1777 | |
1778 | 1778 | global $hideprices; |
1779 | 1779 | |
1780 | - if(!empty($hideprices)) { |
|
1781 | - foreach($object->lines as &$line) { |
|
1782 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1780 | + if (!empty($hideprices)) { |
|
1781 | + foreach ($object->lines as &$line) { |
|
1782 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1783 | 1783 | } |
1784 | 1784 | } |
1785 | 1785 | |
1786 | 1786 | $line = &$object->lines[$i]; |
1787 | 1787 | |
1788 | - if($line->info_bits>0) { // PAGE BREAK |
|
1788 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1789 | 1789 | $pdf->addPage(); |
1790 | 1790 | $posy = $pdf->GetY(); |
1791 | 1791 | } |
1792 | 1792 | |
1793 | 1793 | $label = $line->label; |
1794 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1794 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1795 | 1795 | |
1796 | - if(empty($label)) { |
|
1796 | + if (empty($label)) { |
|
1797 | 1797 | $label = $description; |
1798 | - $description=''; |
|
1798 | + $description = ''; |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | - if($line->qty>90) { |
|
1801 | + if ($line->qty > 90) { |
|
1802 | 1802 | |
1803 | 1803 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1804 | 1804 | |
1805 | 1805 | $pageBefore = $pdf->getPage(); |
1806 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1806 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1807 | 1807 | $pageAfter = $pdf->getPage(); |
1808 | 1808 | |
1809 | - if($pageAfter>$pageBefore) { |
|
1809 | + if ($pageAfter > $pageBefore) { |
|
1810 | 1810 | //print "ST $pageAfter>$pageBefore<br>"; |
1811 | 1811 | $pdf->rollbackTransaction(true); |
1812 | - $pdf->addPage('','', true); |
|
1812 | + $pdf->addPage('', '', true); |
|
1813 | 1813 | $posy = $pdf->GetY(); |
1814 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1814 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1815 | 1815 | $posy = $pdf->GetY(); |
1816 | 1816 | //print 'add ST'.$pdf->getPage().'<br />'; |
1817 | 1817 | } |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | else if ($line->qty < 10) { |
1823 | 1823 | $pageBefore = $pdf->getPage(); |
1824 | 1824 | |
1825 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1825 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1826 | 1826 | $pageAfter = $pdf->getPage(); |
1827 | 1827 | |
1828 | 1828 | |
@@ -1897,9 +1897,9 @@ discard block |
||
1897 | 1897 | * @param $hookmanager HookManager |
1898 | 1898 | * @return int |
1899 | 1899 | */ |
1900 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1900 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1901 | 1901 | |
1902 | - global $conf,$langs,$user,$db,$bc; |
|
1902 | + global $conf, $langs, $user, $db, $bc; |
|
1903 | 1903 | |
1904 | 1904 | $num = &$parameters['num']; |
1905 | 1905 | $line = &$parameters['line']; |
@@ -1907,32 +1907,32 @@ discard block |
||
1907 | 1907 | |
1908 | 1908 | $var = &$parameters['var']; |
1909 | 1909 | |
1910 | - $contexts = explode(':',$parameters['context']); |
|
1910 | + $contexts = explode(':', $parameters['context']); |
|
1911 | 1911 | |
1912 | 1912 | $createRight = $user->rights->{$object->element}->creer; |
1913 | - if($object->element == 'facturerec' ) |
|
1913 | + if ($object->element == 'facturerec') |
|
1914 | 1914 | { |
1915 | 1915 | $object->statut = 0; // hack for facture rec |
1916 | 1916 | $createRight = $user->rights->facture->creer; |
1917 | 1917 | } |
1918 | - elseif($object->element == 'order_supplier' ) |
|
1918 | + elseif ($object->element == 'order_supplier') |
|
1919 | 1919 | { |
1920 | 1920 | $createRight = $user->rights->fournisseur->commande->creer; |
1921 | 1921 | } |
1922 | - elseif($object->element == 'invoice_supplier' ) |
|
1922 | + elseif ($object->element == 'invoice_supplier') |
|
1923 | 1923 | { |
1924 | 1924 | $createRight = $user->rights->fournisseur->facture->creer; |
1925 | 1925 | } |
1926 | 1926 | |
1927 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1927 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1928 | 1928 | null; |
1929 | 1929 | } |
1930 | - 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)) |
|
1930 | + 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)) |
|
1931 | 1931 | { |
1932 | - if($object->element=='facture')$idvar = 'facid'; |
|
1933 | - else $idvar='id'; |
|
1932 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1933 | + else $idvar = 'id'; |
|
1934 | 1934 | |
1935 | - if((float)DOL_VERSION <= 3.4) |
|
1935 | + if ((float) DOL_VERSION <= 3.4) |
|
1936 | 1936 | { |
1937 | 1937 | ?> |
1938 | 1938 | <script type="text/javascript"> |
@@ -1956,22 +1956,22 @@ discard block |
||
1956 | 1956 | <?php |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - if(empty($line->description)) $line->description = $line->desc; |
|
1959 | + if (empty($line->description)) $line->description = $line->desc; |
|
1960 | 1960 | |
1961 | 1961 | $colspan = 5; |
1962 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1963 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1964 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1965 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1966 | - if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
1962 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1963 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
1964 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
1965 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
1966 | + if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
1967 | 1967 | $colspan++; // Colonne PU Devise |
1968 | 1968 | } |
1969 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1970 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1971 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1972 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1973 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1974 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1969 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1970 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1971 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1972 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1973 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1974 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1975 | 1975 | |
1976 | 1976 | /* Titre */ |
1977 | 1977 | //var_dump($line); |
@@ -1981,39 +1981,39 @@ discard block |
||
1981 | 1981 | |
1982 | 1982 | |
1983 | 1983 | ?> |
1984 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1984 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1985 | 1985 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1986 | 1986 | { |
1987 | - if($line->qty==99) print 'background:#adadcf'; |
|
1988 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1989 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1990 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1991 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1992 | - else if($line->qty==50) print ''; |
|
1987 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1988 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1989 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1990 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1991 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1992 | + else if ($line->qty == 50) print ''; |
|
1993 | 1993 | else print 'background:#eeeeff;'; |
1994 | 1994 | |
1995 | 1995 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1996 | 1996 | } |
1997 | 1997 | else |
1998 | 1998 | { |
1999 | - if($line->qty==99) print 'background:#ddffdd'; |
|
2000 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2001 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
2002 | - else if($line->qty==50) print ''; |
|
2003 | - else print 'background:#eeffee;' ; |
|
1999 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
2000 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
2001 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
2002 | + else if ($line->qty == 50) print ''; |
|
2003 | + else print 'background:#eeffee;'; |
|
2004 | 2004 | } |
2005 | 2005 | |
2006 | 2006 | ?>;"> |
2007 | 2007 | |
2008 | - <?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
2008 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
2009 | 2009 | <td class="linecolnum"><?php echo $i + 1; ?></td> |
2010 | 2010 | <?php } ?> |
2011 | 2011 | |
2012 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
2013 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2012 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
2013 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2014 | 2014 | |
2015 | - $params=array('line'=>$line); |
|
2016 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
2015 | + $params = array('line'=>$line); |
|
2016 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
2017 | 2017 | |
2018 | 2018 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
2019 | 2019 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -2021,7 +2021,7 @@ discard block |
||
2021 | 2021 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
2022 | 2022 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
2023 | 2023 | |
2024 | - $isFreeText=false; |
|
2024 | + $isFreeText = false; |
|
2025 | 2025 | if (TSubtotal::isTitle($line)) |
2026 | 2026 | { |
2027 | 2027 | $qty_displayed = $line->qty; |
@@ -2043,13 +2043,13 @@ discard block |
||
2043 | 2043 | $line->description = ''; |
2044 | 2044 | } |
2045 | 2045 | $newlabel = $line->label; |
2046 | - if($line->label=='' && !$isFreeText) { |
|
2047 | - if(TSubtotal::isSubtotal($line)) { |
|
2046 | + if ($line->label == '' && !$isFreeText) { |
|
2047 | + if (TSubtotal::isSubtotal($line)) { |
|
2048 | 2048 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
2049 | - $line->description=''; |
|
2050 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
2051 | - $newlabel= $line->description; |
|
2052 | - $line->description=''; |
|
2049 | + $line->description = ''; |
|
2050 | + } elseif ((float) DOL_VERSION < 6) { |
|
2051 | + $newlabel = $line->description; |
|
2052 | + $line->description = ''; |
|
2053 | 2053 | } |
2054 | 2054 | } |
2055 | 2055 | |
@@ -2058,10 +2058,10 @@ discard block |
||
2058 | 2058 | |
2059 | 2059 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
2060 | 2060 | |
2061 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
2061 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
2062 | 2062 | { |
2063 | 2063 | $select = '<select name="subtotal_level">'; |
2064 | - for ($j=1; $j<10; $j++) |
|
2064 | + for ($j = 1; $j < 10; $j++) |
|
2065 | 2065 | { |
2066 | 2066 | if (!empty($readonlyForSituation)) { |
2067 | 2067 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -2075,7 +2075,7 @@ discard block |
||
2075 | 2075 | |
2076 | 2076 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
2077 | 2077 | echo '<div>'; |
2078 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2078 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
2079 | 2079 | echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
2080 | 2080 | echo '</div>'; |
2081 | 2081 | |
@@ -2096,21 +2096,21 @@ discard block |
||
2096 | 2096 | echo '</div>'; |
2097 | 2097 | } |
2098 | 2098 | echo '<div>'; |
2099 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2099 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '').' /> '; |
|
2100 | 2100 | echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
2101 | 2101 | echo '</div>'; |
2102 | 2102 | |
2103 | 2103 | echo '<div>'; |
2104 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
|
2104 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '').' /> '; |
|
2105 | 2105 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2106 | 2106 | echo '</div>'; |
2107 | 2107 | } |
2108 | 2108 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
2109 | 2109 | echo '</div>'; |
2110 | 2110 | |
2111 | - if($line->qty<10) { |
|
2111 | + if ($line->qty < 10) { |
|
2112 | 2112 | // WYSIWYG editor |
2113 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
2113 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
2114 | 2114 | $nbrows = ROWS_2; |
2115 | 2115 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
2116 | 2116 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -2130,25 +2130,25 @@ discard block |
||
2130 | 2130 | |
2131 | 2131 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2132 | 2132 | { |
2133 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2133 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2134 | 2134 | { |
2135 | - echo str_repeat(' ', $line->qty-1); |
|
2135 | + echo str_repeat(' ', $line->qty - 1); |
|
2136 | 2136 | |
2137 | 2137 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
2138 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2138 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
2139 | 2139 | } |
2140 | 2140 | } |
2141 | 2141 | else |
2142 | 2142 | { |
2143 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2144 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2143 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2144 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | |
2148 | 2148 | // Get display styles and apply them |
2149 | 2149 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2150 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2151 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2150 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2151 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2152 | 2152 | |
2153 | 2153 | if (empty($line->label)) { |
2154 | 2154 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2156,16 +2156,16 @@ discard block |
||
2156 | 2156 | } |
2157 | 2157 | else { |
2158 | 2158 | |
2159 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2159 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2160 | 2160 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2161 | 2161 | } |
2162 | - else{ |
|
2162 | + else { |
|
2163 | 2163 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2164 | 2164 | } |
2165 | 2165 | |
2166 | 2166 | } |
2167 | - if($line->qty>90) print ' : '; |
|
2168 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2167 | + if ($line->qty > 90) print ' : '; |
|
2168 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2169 | 2169 | |
2170 | 2170 | |
2171 | 2171 | |
@@ -2174,7 +2174,7 @@ discard block |
||
2174 | 2174 | ?></td> |
2175 | 2175 | |
2176 | 2176 | <?php |
2177 | - if($line->qty>90) { |
|
2177 | + if ($line->qty > 90) { |
|
2178 | 2178 | /* Total */ |
2179 | 2179 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
2180 | 2180 | echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | <?php |
2194 | 2194 | if ($action != 'selectlines') { |
2195 | 2195 | |
2196 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2196 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2197 | 2197 | ?> |
2198 | 2198 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
2199 | 2199 | <br /> |
@@ -2209,13 +2209,13 @@ discard block |
||
2209 | 2209 | <?php |
2210 | 2210 | |
2211 | 2211 | } |
2212 | - else{ |
|
2213 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2212 | + else { |
|
2213 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2214 | 2214 | { |
2215 | - 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>'; |
|
2215 | + 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>'; |
|
2216 | 2216 | } |
2217 | 2217 | |
2218 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2218 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2219 | 2219 | { |
2220 | 2220 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
2221 | 2221 | } |
@@ -2230,7 +2230,7 @@ discard block |
||
2230 | 2230 | <?php |
2231 | 2231 | |
2232 | 2232 | if ($action != 'editline' && $action != 'selectlines') { |
2233 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2233 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2234 | 2234 | { |
2235 | 2235 | |
2236 | 2236 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -2238,12 +2238,12 @@ discard block |
||
2238 | 2238 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
2239 | 2239 | } |
2240 | 2240 | |
2241 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
2241 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
2242 | 2242 | { |
2243 | 2243 | if ((float) DOL_VERSION >= 8.0) { |
2244 | 2244 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
2245 | 2245 | } elseif ((float) DOL_VERSION >= 3.8) { |
2246 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
2246 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
2247 | 2247 | } else { |
2248 | 2248 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
2249 | 2249 | } |
@@ -2253,7 +2253,7 @@ discard block |
||
2253 | 2253 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
2254 | 2254 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
2255 | 2255 | */ |
2256 | - if((float) DOL_VERSION >= 8.0) { |
|
2256 | + if ((float) DOL_VERSION >= 8.0) { |
|
2257 | 2257 | ?> |
2258 | 2258 | <script> |
2259 | 2259 | $(document).ready(function () { |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | </td> |
2270 | 2270 | |
2271 | 2271 | <?php |
2272 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2272 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2273 | 2273 | { |
2274 | 2274 | echo '<td class="subtotal_nc">'; |
2275 | 2275 | 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"' : '').' />'; |
@@ -2280,11 +2280,11 @@ discard block |
||
2280 | 2280 | <td align="center" class="linecolmove tdlineupdown"> |
2281 | 2281 | </td> |
2282 | 2282 | <?php } else { ?> |
2283 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
2283 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
2284 | 2284 | <?php } ?> |
2285 | 2285 | |
2286 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
2287 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2286 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
2287 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2288 | 2288 | <?php } ?> |
2289 | 2289 | |
2290 | 2290 | </tr> |
@@ -2292,29 +2292,29 @@ discard block |
||
2292 | 2292 | |
2293 | 2293 | |
2294 | 2294 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2295 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2295 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2296 | 2296 | |
2297 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2297 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2298 | 2298 | |
2299 | 2299 | // Extrafields |
2300 | 2300 | $extrafieldsline = new ExtraFields($db); |
2301 | 2301 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2302 | 2302 | |
2303 | - $colspan+=3; $mode = 'view'; |
|
2304 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2303 | + $colspan += 3; $mode = 'view'; |
|
2304 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2305 | 2305 | |
2306 | 2306 | $ex_element = $line->element; |
2307 | 2307 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2308 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2308 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2309 | 2309 | $isExtraSelected = false; |
2310 | - foreach($line->array_options as $option) { |
|
2311 | - if(!empty($option) && $option != "-1") { |
|
2310 | + foreach ($line->array_options as $option) { |
|
2311 | + if (!empty($option) && $option != "-1") { |
|
2312 | 2312 | $isExtraSelected = true; |
2313 | 2313 | break; |
2314 | 2314 | } |
2315 | 2315 | } |
2316 | 2316 | |
2317 | - if($mode === 'edit') { |
|
2317 | + if ($mode === 'edit') { |
|
2318 | 2318 | ?> |
2319 | 2319 | <script> |
2320 | 2320 | $(document).ready(function(){ |
@@ -2322,7 +2322,7 @@ discard block |
||
2322 | 2322 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2323 | 2323 | <?php |
2324 | 2324 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2325 | - if(!$isExtraSelected) { |
|
2325 | + if (!$isExtraSelected) { |
|
2326 | 2326 | echo 'all_tr_extrafields.hide();'; |
2327 | 2327 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2328 | 2328 | echo 'var extra = 0;'; |
@@ -2368,20 +2368,20 @@ discard block |
||
2368 | 2368 | |
2369 | 2369 | |
2370 | 2370 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2371 | - global $conf,$langs; |
|
2371 | + global $conf, $langs; |
|
2372 | 2372 | |
2373 | 2373 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2374 | 2374 | { |
2375 | 2375 | |
2376 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2376 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2377 | 2377 | { |
2378 | 2378 | foreach ($object->lines as $line) |
2379 | 2379 | { |
2380 | 2380 | // fetch optionals attributes and labels |
2381 | 2381 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2382 | - $extrafields=new ExtraFields($this->db); |
|
2383 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2384 | - $line->fetch_optionals($line->id,$extralabels); |
|
2382 | + $extrafields = new ExtraFields($this->db); |
|
2383 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2384 | + $line->fetch_optionals($line->id, $extralabels); |
|
2385 | 2385 | } |
2386 | 2386 | } |
2387 | 2387 | |
@@ -2481,23 +2481,23 @@ discard block |
||
2481 | 2481 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2482 | 2482 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2483 | 2483 | |
2484 | - if(TSubtotal::isTitle($line)){ |
|
2484 | + if (TSubtotal::isTitle($line)) { |
|
2485 | 2485 | $ThtmlData['data-issubtotal'] = 'title'; |
2486 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2486 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2487 | 2487 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2488 | 2488 | } |
2489 | - else{ |
|
2489 | + else { |
|
2490 | 2490 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2491 | 2491 | } |
2492 | 2492 | |
2493 | 2493 | |
2494 | 2494 | // Change or add data from hooks |
2495 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2495 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2496 | 2496 | |
2497 | 2497 | // hook |
2498 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2498 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2499 | 2499 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2500 | - if ($reshook>0) |
|
2500 | + if ($reshook > 0) |
|
2501 | 2501 | { |
2502 | 2502 | $ThtmlData = $hookmanager->resArray; |
2503 | 2503 | } |
@@ -2510,14 +2510,14 @@ discard block |
||
2510 | 2510 | function implodeHtmlData($ThtmlData = array()) |
2511 | 2511 | { |
2512 | 2512 | $data = ''; |
2513 | - foreach($ThtmlData as $k => $h ) |
|
2513 | + foreach ($ThtmlData as $k => $h) |
|
2514 | 2514 | { |
2515 | - if(is_array($h)) |
|
2515 | + if (is_array($h)) |
|
2516 | 2516 | { |
2517 | 2517 | $h = json_encode($h); |
2518 | 2518 | } |
2519 | 2519 | |
2520 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2520 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2521 | 2521 | } |
2522 | 2522 | |
2523 | 2523 | return $data; |
@@ -2525,26 +2525,26 @@ discard block |
||
2525 | 2525 | |
2526 | 2526 | function _ajax_block_order_js($object) |
2527 | 2527 | { |
2528 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2528 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2529 | 2529 | |
2530 | 2530 | /* |
2531 | 2531 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2532 | 2532 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2533 | 2533 | */ |
2534 | 2534 | |
2535 | - $id=$object->id; |
|
2536 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2537 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2535 | + $id = $object->id; |
|
2536 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2537 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2538 | 2538 | |
2539 | - $id=$object->id; |
|
2540 | - $fk_element=$object->fk_element; |
|
2541 | - $table_element_line=$object->table_element_line; |
|
2542 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2543 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2544 | - $filepath=(empty($filepath)?'':$filepath); |
|
2539 | + $id = $object->id; |
|
2540 | + $fk_element = $object->fk_element; |
|
2541 | + $table_element_line = $object->table_element_line; |
|
2542 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2543 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2544 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2545 | 2545 | |
2546 | 2546 | |
2547 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2547 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2548 | 2548 | { |
2549 | 2549 | |
2550 | 2550 | ?> |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | moveBlockCol.disableSelection(); // prevent selection |
2563 | 2563 | <?php if ($object->statut == 0) { ?> |
2564 | 2564 | // apply some graphical stuff |
2565 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2565 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2566 | 2566 | moveBlockCol.css("background-repeat","no-repeat"); |
2567 | 2567 | moveBlockCol.css("background-position","center center"); |
2568 | 2568 | moveBlockCol.css("cursor","move"); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | $value = ''; |
46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
47 | 47 | $resql = $this->db->query($sql); |
48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
49 | + $value = $obj->content; |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | |
51 | 53 | ?> |
@@ -129,8 +131,11 @@ discard block |
||
129 | 131 | if ($object->statut == 0 && $createRight) { |
130 | 132 | |
131 | 133 | |
132 | - if($object->element=='facture')$idvar = 'facid'; |
|
133 | - else $idvar='id'; |
|
134 | + if($object->element=='facture') { |
|
135 | + $idvar = 'facid'; |
|
136 | + } else { |
|
137 | + $idvar='id'; |
|
138 | + } |
|
134 | 139 | |
135 | 140 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
136 | 141 | { |
@@ -138,10 +143,11 @@ discard block |
||
138 | 143 | |
139 | 144 | if($action=='add_title_line') { |
140 | 145 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('title'); |
|
146 | + if(empty($title)) { |
|
147 | + $title = $langs->trans('title'); |
|
148 | + } |
|
142 | 149 | $qty = $level<1 ? 1 : $level ; |
143 | - } |
|
144 | - else if($action=='add_free_text') { |
|
150 | + } else if($action=='add_free_text') { |
|
145 | 151 | $title = GETPOST('title'); |
146 | 152 | |
147 | 153 | if (empty($title)) { |
@@ -153,29 +159,31 @@ discard block |
||
153 | 159 | } |
154 | 160 | } |
155 | 161 | } |
156 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
162 | + if(empty($title)) { |
|
163 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
164 | + } |
|
157 | 165 | $qty = 50; |
158 | - } |
|
159 | - else if($action=='add_subtitle_line') { |
|
166 | + } else if($action=='add_subtitle_line') { |
|
160 | 167 | $title = GETPOST('title'); |
161 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
168 | + if(empty($title)) { |
|
169 | + $title = $langs->trans('subtitle'); |
|
170 | + } |
|
162 | 171 | $qty = 2; |
163 | - } |
|
164 | - else if($action=='add_subtotal_line') { |
|
172 | + } else if($action=='add_subtotal_line') { |
|
165 | 173 | $title = $langs->trans('SubSubTotal'); |
166 | 174 | $qty = 98; |
167 | - } |
|
168 | - else { |
|
175 | + } else { |
|
169 | 176 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
170 | 177 | $qty = $level ? 100-$level : 99; |
171 | 178 | } |
172 | 179 | dol_include_once('/subtotal/class/subtotal.class.php'); |
173 | 180 | |
174 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
181 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
182 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
183 | + } |
|
175 | 184 | |
176 | 185 | TSubtotal::addSubTotalLine($object, $title, $qty); |
177 | - } |
|
178 | - else if($action==='ask_deleteallline') { |
|
186 | + } else if($action==='ask_deleteallline') { |
|
179 | 187 | $form=new Form($db); |
180 | 188 | |
181 | 189 | $lineid = GETPOST('lineid','integer'); |
@@ -198,8 +206,7 @@ discard block |
||
198 | 206 | $this->printNewFormat($object, $conf, $langs, $idvar); |
199 | 207 | } |
200 | 208 | } |
201 | - } |
|
202 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
209 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
203 | 210 | { |
204 | 211 | ?> |
205 | 212 | <script type="text/javascript"> |
@@ -217,8 +224,13 @@ discard block |
||
217 | 224 | |
218 | 225 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
219 | 226 | { |
220 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
221 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
227 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
228 | + return false; |
|
229 | + } |
|
230 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
231 | + return false; |
|
232 | + } |
|
233 | + // Si facture de situation |
|
222 | 234 | ?> |
223 | 235 | <script type="text/javascript"> |
224 | 236 | $(document).ready(function() { |
@@ -504,8 +516,7 @@ discard block |
||
504 | 516 | } |
505 | 517 | |
506 | 518 | |
507 | - } |
|
508 | - else{ |
|
519 | + } else{ |
|
509 | 520 | $substitutionarray['line_not_modsubtotal'] = true; |
510 | 521 | $substitutionarray['line_modsubtotal'] = 0; |
511 | 522 | } |
@@ -563,8 +574,11 @@ discard block |
||
563 | 574 | |
564 | 575 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
565 | 576 | |
566 | - if($object->element=='facture') $idvar = 'facid'; |
|
567 | - else $idvar = 'id'; |
|
577 | + if($object->element=='facture') { |
|
578 | + $idvar = 'facid'; |
|
579 | + } else { |
|
580 | + $idvar = 'id'; |
|
581 | + } |
|
568 | 582 | |
569 | 583 | if ($action == 'updateligne' || $action == 'updateline') |
570 | 584 | { |
@@ -594,8 +608,7 @@ discard block |
||
594 | 608 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
595 | 609 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
596 | 610 | } |
597 | - } |
|
598 | - else if($action === 'builddoc') { |
|
611 | + } else if($action === 'builddoc') { |
|
599 | 612 | |
600 | 613 | if ( |
601 | 614 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -610,33 +623,27 @@ discard block |
||
610 | 623 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 624 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 625 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | - } |
|
614 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
626 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
615 | 627 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
616 | 628 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
617 | 629 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
618 | - } |
|
619 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
630 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
620 | 631 | $sessname = 'subtotal_hideInnerLines_propal'; |
621 | 632 | $sessname2 = 'subtotal_hidedetails_propal'; |
622 | 633 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | - } |
|
624 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
634 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
625 | 635 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
626 | 636 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
627 | 637 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
628 | - } |
|
629 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
638 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
630 | 639 | $sessname = 'subtotal_hideInnerLines_commande'; |
631 | 640 | $sessname2 = 'subtotal_hidedetails_commande'; |
632 | 641 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | - } |
|
634 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
642 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
635 | 643 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
636 | 644 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
637 | 645 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
638 | - } |
|
639 | - else { |
|
646 | + } else { |
|
640 | 647 | $sessname = 'subtotal_hideInnerLines_unknown'; |
641 | 648 | $sessname2 = 'subtotal_hidedetails_unknown'; |
642 | 649 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -645,15 +652,24 @@ discard block |
||
645 | 652 | global $hideprices; |
646 | 653 | |
647 | 654 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
648 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
655 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
656 | + $_SESSION[$sessname] = array(); |
|
657 | + } |
|
658 | + // prevent old system |
|
649 | 659 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
650 | 660 | |
651 | 661 | $hidedetails= (int)GETPOST('hidedetails'); |
652 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
662 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
663 | + $_SESSION[$sessname2] = array(); |
|
664 | + } |
|
665 | + // prevent old system |
|
653 | 666 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
654 | 667 | |
655 | 668 | $hideprices= (int)GETPOST('hideprices'); |
656 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
669 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
670 | + $_SESSION[$sessname3] = array(); |
|
671 | + } |
|
672 | + // prevent old system |
|
657 | 673 | $_SESSION[$sessname3][$object->id] = $hideprices; |
658 | 674 | |
659 | 675 | foreach($object->lines as &$line) { |
@@ -661,8 +677,7 @@ discard block |
||
661 | 677 | |
662 | 678 | if($line->qty>=90) { |
663 | 679 | $line->modsubtotal_total = 1; |
664 | - } |
|
665 | - else{ |
|
680 | + } else{ |
|
666 | 681 | $line->modsubtotal_title = 1; |
667 | 682 | } |
668 | 683 | |
@@ -671,8 +686,7 @@ discard block |
||
671 | 686 | } |
672 | 687 | } |
673 | 688 | |
674 | - } |
|
675 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
689 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
676 | 690 | |
677 | 691 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
678 | 692 | |
@@ -680,7 +694,9 @@ discard block |
||
680 | 694 | /** |
681 | 695 | * @var $object Facture |
682 | 696 | */ |
683 | - if($object->element=='facture') $object->deleteline($idLine); |
|
697 | + if($object->element=='facture') { |
|
698 | + $object->deleteline($idLine); |
|
699 | + } |
|
684 | 700 | /** |
685 | 701 | * @var $object Facture fournisseur |
686 | 702 | */ |
@@ -691,18 +707,25 @@ discard block |
||
691 | 707 | /** |
692 | 708 | * @var $object Propal |
693 | 709 | */ |
694 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
710 | + else if($object->element=='propal') { |
|
711 | + $object->deleteline($idLine); |
|
712 | + } |
|
695 | 713 | /** |
696 | 714 | * @var $object Propal Fournisseur |
697 | 715 | */ |
698 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
716 | + else if($object->element=='supplier_proposal') { |
|
717 | + $object->deleteline($idLine); |
|
718 | + } |
|
699 | 719 | /** |
700 | 720 | * @var $object Commande |
701 | 721 | */ |
702 | 722 | else if($object->element=='commande') |
703 | 723 | { |
704 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
705 | - else $object->deleteline($idLine); |
|
724 | + if ((float) DOL_VERSION >= 5.0) { |
|
725 | + $object->deleteline($user, $idLine); |
|
726 | + } else { |
|
727 | + $object->deleteline($idLine); |
|
728 | + } |
|
706 | 729 | } |
707 | 730 | /** |
708 | 731 | * @var $object Commande fournisseur |
@@ -714,21 +737,26 @@ discard block |
||
714 | 737 | /** |
715 | 738 | * @var $object Facturerec |
716 | 739 | */ |
717 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
740 | + else if($object->element=='facturerec') { |
|
741 | + $object->deleteline($idLine); |
|
742 | + } |
|
718 | 743 | } |
719 | 744 | |
720 | 745 | header('location:?id='.$object->id); |
721 | 746 | exit; |
722 | 747 | |
723 | - } |
|
724 | - else if ($action == 'duplicate') |
|
748 | + } else if ($action == 'duplicate') |
|
725 | 749 | { |
726 | 750 | $lineid = GETPOST('lineid', 'int'); |
727 | 751 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
728 | 752 | |
729 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
730 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
731 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
753 | + if ($nbDuplicate > 0) { |
|
754 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
755 | + } elseif ($nbDuplicate == 0) { |
|
756 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
757 | + } else { |
|
758 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
759 | + } |
|
732 | 760 | |
733 | 761 | header('Location: ?id='.$object->id); |
734 | 762 | exit; |
@@ -746,21 +774,26 @@ discard block |
||
746 | 774 | global $conf; |
747 | 775 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
748 | 776 | { |
749 | - if ($object->element == 'commande') |
|
750 | - $obj = new OrderLine($object->db); |
|
751 | - if ($object->element == 'propal') |
|
752 | - $obj = new PropaleLigne($object->db); |
|
753 | - if ($object->element == 'facture') |
|
754 | - $obj = new FactureLigne($object->db); |
|
777 | + if ($object->element == 'commande') { |
|
778 | + $obj = new OrderLine($object->db); |
|
779 | + } |
|
780 | + if ($object->element == 'propal') { |
|
781 | + $obj = new PropaleLigne($object->db); |
|
782 | + } |
|
783 | + if ($object->element == 'facture') { |
|
784 | + $obj = new FactureLigne($object->db); |
|
785 | + } |
|
755 | 786 | if (!empty($parameters['fk_element'])) |
756 | 787 | { |
757 | 788 | |
758 | 789 | if($obj->fetch($parameters['fk_element'])){ |
759 | 790 | $obj->id= $obj->rowid; |
760 | - if (empty($obj->array_options)) |
|
761 | - $obj->fetch_optionals(); |
|
762 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
763 | - return 1; |
|
791 | + if (empty($obj->array_options)) { |
|
792 | + $obj->fetch_optionals(); |
|
793 | + } |
|
794 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
795 | + return 1; |
|
796 | + } |
|
764 | 797 | } |
765 | 798 | } |
766 | 799 | } |
@@ -835,17 +868,18 @@ discard block |
||
835 | 868 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
836 | 869 | if($l->rang>=$rang) { |
837 | 870 | //echo 'return!<br>'; |
838 | - if (!$return_all) return $total; |
|
839 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
840 | - } |
|
841 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
871 | + if (!$return_all) { |
|
872 | + return $total; |
|
873 | + } else { |
|
874 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
875 | + } |
|
876 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
842 | 877 | { |
843 | 878 | $total = 0; |
844 | 879 | $total_tva = 0; |
845 | 880 | $total_ttc = 0; |
846 | 881 | $TTotal_tva = array(); |
847 | - } |
|
848 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
882 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
849 | 883 | $total += $l->total_ht; |
850 | 884 | $total_tva += $l->total_tva; |
851 | 885 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -853,8 +887,11 @@ discard block |
||
853 | 887 | } |
854 | 888 | |
855 | 889 | } |
856 | - if (!$return_all) return $total; |
|
857 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
890 | + if (!$return_all) { |
|
891 | + return $total; |
|
892 | + } else { |
|
893 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
894 | + } |
|
858 | 895 | } |
859 | 896 | |
860 | 897 | /* |
@@ -922,15 +959,18 @@ discard block |
||
922 | 959 | } |
923 | 960 | |
924 | 961 | |
925 | - if($line->qty==99) |
|
926 | - $pdf->SetFillColor(220,220,220); |
|
927 | - elseif ($line->qty==98) |
|
928 | - $pdf->SetFillColor(230,230,230); |
|
929 | - else |
|
930 | - $pdf->SetFillColor(240,240,240); |
|
962 | + if($line->qty==99) { |
|
963 | + $pdf->SetFillColor(220,220,220); |
|
964 | + } elseif ($line->qty==98) { |
|
965 | + $pdf->SetFillColor(230,230,230); |
|
966 | + } else { |
|
967 | + $pdf->SetFillColor(240,240,240); |
|
968 | + } |
|
931 | 969 | |
932 | 970 | $style = 'B'; |
933 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
971 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
972 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
973 | + } |
|
934 | 974 | |
935 | 975 | $pdf->SetFont('', $style, 9); |
936 | 976 | |
@@ -969,8 +1009,7 @@ discard block |
||
969 | 1009 | // $line->total_tva |
970 | 1010 | // $line->total |
971 | 1011 | // $line->total_ttc |
972 | - } |
|
973 | - else |
|
1012 | + } else |
|
974 | 1013 | { |
975 | 1014 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | 1015 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -987,11 +1026,14 @@ discard block |
||
987 | 1026 | } |
988 | 1027 | |
989 | 1028 | $pdf->SetXY($pdf->postotalht, $posy); |
990 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1029 | + if($set_pagebreak_margin) { |
|
1030 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1031 | + } |
|
991 | 1032 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
992 | - } |
|
993 | - else{ |
|
994 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1033 | + } else{ |
|
1034 | + if($set_pagebreak_margin) { |
|
1035 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1036 | + } |
|
995 | 1037 | } |
996 | 1038 | |
997 | 1039 | $posy = $posy + $cell_height; |
@@ -1023,25 +1065,40 @@ discard block |
||
1023 | 1065 | |
1024 | 1066 | |
1025 | 1067 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
1026 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1068 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
1069 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1070 | + } |
|
1027 | 1071 | |
1028 | 1072 | if($hideInnerLines) { |
1029 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1030 | - else |
|
1073 | + if($line->qty==1) { |
|
1074 | + $pdf->SetFont('', $style, 9); |
|
1075 | + } else |
|
1031 | 1076 | { |
1032 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1077 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
1078 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1079 | + } |
|
1033 | 1080 | $pdf->SetFont('', $style, 9); |
1034 | 1081 | } |
1035 | - } |
|
1036 | - else { |
|
1082 | + } else { |
|
1037 | 1083 | |
1038 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1039 | - else $pdf->SetFont('', $style, 9); |
|
1084 | + if($line->qty==1) { |
|
1085 | + $pdf->SetFont('', $style, 9); |
|
1086 | + } |
|
1087 | + //TODO if super utile |
|
1088 | + else { |
|
1089 | + $pdf->SetFont('', $style, 9); |
|
1090 | + } |
|
1040 | 1091 | |
1041 | 1092 | } |
1042 | 1093 | |
1043 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
1044 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1094 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
1095 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
1096 | + } |
|
1097 | + // Pas de HTML dans la chaine |
|
1098 | + else { |
|
1099 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
1100 | + } |
|
1101 | + // et maintenant avec du HTML |
|
1045 | 1102 | |
1046 | 1103 | if($description && !$hidedesc) { |
1047 | 1104 | $posy = $pdf->GetY(); |
@@ -1065,8 +1122,7 @@ discard block |
||
1065 | 1122 | |
1066 | 1123 | if(is_array($parameters)) { |
1067 | 1124 | $i = & $parameters['i']; |
1068 | - } |
|
1069 | - else { |
|
1125 | + } else { |
|
1070 | 1126 | $i = (int)$parameters; |
1071 | 1127 | } |
1072 | 1128 | |
@@ -1088,17 +1144,14 @@ discard block |
||
1088 | 1144 | |
1089 | 1145 | if((float)DOL_VERSION<=3.6) { |
1090 | 1146 | return ''; |
1091 | - } |
|
1092 | - else if((float)DOL_VERSION>=3.8) { |
|
1147 | + } else if((float)DOL_VERSION>=3.8) { |
|
1093 | 1148 | return 1; |
1094 | 1149 | } |
1095 | 1150 | |
1096 | - } |
|
1097 | - elseif(!empty($hideprices)) { |
|
1151 | + } elseif(!empty($hideprices)) { |
|
1098 | 1152 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1099 | 1153 | return 1; |
1100 | - } |
|
1101 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1154 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1102 | 1155 | { |
1103 | 1156 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1104 | 1157 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1108,12 +1161,20 @@ discard block |
||
1108 | 1161 | } |
1109 | 1162 | } |
1110 | 1163 | |
1111 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1112 | - else $i = (int)$parameters; |
|
1164 | + if(is_array($parameters)) { |
|
1165 | + $i = & $parameters['i']; |
|
1166 | + } else { |
|
1167 | + $i = (int)$parameters; |
|
1168 | + } |
|
1113 | 1169 | |
1114 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1170 | + if (empty($object->lines[$i])) { |
|
1171 | + return 0; |
|
1172 | + } |
|
1173 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1115 | 1174 | |
1116 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1175 | + if(empty($object->lines[$i]->array_options)) { |
|
1176 | + $object->lines[$i]->fetch_optionals(); |
|
1177 | + } |
|
1117 | 1178 | |
1118 | 1179 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1119 | 1180 | { |
@@ -1130,8 +1191,11 @@ discard block |
||
1130 | 1191 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1131 | 1192 | global $conf, $hideprices, $hookmanager; |
1132 | 1193 | |
1133 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1134 | - else $i = (int)$parameters; |
|
1194 | + if(is_array($parameters)) { |
|
1195 | + $i = & $parameters['i']; |
|
1196 | + } else { |
|
1197 | + $i = (int)$parameters; |
|
1198 | + } |
|
1135 | 1199 | |
1136 | 1200 | if($this->isModSubtotalLine($parameters,$object) ){ |
1137 | 1201 | |
@@ -1139,13 +1203,11 @@ discard block |
||
1139 | 1203 | |
1140 | 1204 | if((float)DOL_VERSION<=3.6) { |
1141 | 1205 | return ''; |
1142 | - } |
|
1143 | - else if((float)DOL_VERSION>=3.8) { |
|
1206 | + } else if((float)DOL_VERSION>=3.8) { |
|
1144 | 1207 | return 1; |
1145 | 1208 | } |
1146 | 1209 | |
1147 | - } |
|
1148 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1210 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1149 | 1211 | { |
1150 | 1212 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1151 | 1213 | { |
@@ -1217,12 +1279,10 @@ discard block |
||
1217 | 1279 | $this->error = $hookmanager->error; |
1218 | 1280 | $this->errors = $hookmanager->errors; |
1219 | 1281 | return -1; |
1220 | - } |
|
1221 | - elseif (empty($reshook)) |
|
1282 | + } elseif (empty($reshook)) |
|
1222 | 1283 | { |
1223 | 1284 | $this->resprints .= $hookmanager->resprints; |
1224 | - } |
|
1225 | - else |
|
1285 | + } else |
|
1226 | 1286 | { |
1227 | 1287 | $this->resprints = $hookmanager->resprints; |
1228 | 1288 | |
@@ -1245,14 +1305,16 @@ discard block |
||
1245 | 1305 | |
1246 | 1306 | if((float)DOL_VERSION<=3.6) { |
1247 | 1307 | return ''; |
1248 | - } |
|
1249 | - else if((float)DOL_VERSION>=3.8) { |
|
1308 | + } else if((float)DOL_VERSION>=3.8) { |
|
1250 | 1309 | return 1; |
1251 | 1310 | } |
1252 | 1311 | } |
1253 | 1312 | |
1254 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1255 | - else $i = (int)$parameters; |
|
1313 | + if(is_array($parameters)) { |
|
1314 | + $i = & $parameters['i']; |
|
1315 | + } else { |
|
1316 | + $i = (int)$parameters; |
|
1317 | + } |
|
1256 | 1318 | |
1257 | 1319 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1258 | 1320 | { |
@@ -1274,14 +1336,16 @@ discard block |
||
1274 | 1336 | |
1275 | 1337 | if((float)DOL_VERSION<=3.6) { |
1276 | 1338 | return ''; |
1277 | - } |
|
1278 | - else if((float)DOL_VERSION>=3.8) { |
|
1339 | + } else if((float)DOL_VERSION>=3.8) { |
|
1279 | 1340 | return 1; |
1280 | 1341 | } |
1281 | 1342 | } |
1282 | 1343 | |
1283 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1284 | - else $i = (int)$parameters; |
|
1344 | + if(is_array($parameters)) { |
|
1345 | + $i = & $parameters['i']; |
|
1346 | + } else { |
|
1347 | + $i = (int)$parameters; |
|
1348 | + } |
|
1285 | 1349 | |
1286 | 1350 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1287 | 1351 | { |
@@ -1298,8 +1362,11 @@ discard block |
||
1298 | 1362 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1299 | 1363 | global $conf,$hideprices,$hookmanager; |
1300 | 1364 | |
1301 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1302 | - else $i = (int)$parameters; |
|
1365 | + if(is_array($parameters)) { |
|
1366 | + $i = & $parameters['i']; |
|
1367 | + } else { |
|
1368 | + $i = (int)$parameters; |
|
1369 | + } |
|
1303 | 1370 | |
1304 | 1371 | if($this->isModSubtotalLine($parameters,$object) ) { |
1305 | 1372 | $this->resprints = ' '; |
@@ -1318,8 +1385,7 @@ discard block |
||
1318 | 1385 | |
1319 | 1386 | if((float)DOL_VERSION<=3.6) { |
1320 | 1387 | return ''; |
1321 | - } |
|
1322 | - else if((float)DOL_VERSION>=3.8) { |
|
1388 | + } else if((float)DOL_VERSION>=3.8) { |
|
1323 | 1389 | return 1; |
1324 | 1390 | } |
1325 | 1391 | } |
@@ -1364,8 +1430,11 @@ discard block |
||
1364 | 1430 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
1365 | 1431 | global $conf,$hideprices,$hookmanager; |
1366 | 1432 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1368 | - else $i = (int) $parameters; |
|
1433 | + if(is_array($parameters)) { |
|
1434 | + $i = & $parameters['i']; |
|
1435 | + } else { |
|
1436 | + $i = (int) $parameters; |
|
1437 | + } |
|
1369 | 1438 | |
1370 | 1439 | if($this->isModSubtotalLine($parameters,$object) ) { |
1371 | 1440 | $this->resprints = ' '; |
@@ -1384,12 +1453,10 @@ discard block |
||
1384 | 1453 | |
1385 | 1454 | if((float)DOL_VERSION<=3.6) { |
1386 | 1455 | return ''; |
1387 | - } |
|
1388 | - else if((float)DOL_VERSION>=3.8) { |
|
1456 | + } else if((float)DOL_VERSION>=3.8) { |
|
1389 | 1457 | return 1; |
1390 | 1458 | } |
1391 | - } |
|
1392 | - elseif (!empty($hideprices) |
|
1459 | + } elseif (!empty($hideprices) |
|
1393 | 1460 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1394 | 1461 | ) |
1395 | 1462 | { |
@@ -1410,14 +1477,16 @@ discard block |
||
1410 | 1477 | $this->resprints = ' '; |
1411 | 1478 | if((float)DOL_VERSION<=3.6) { |
1412 | 1479 | return ''; |
1413 | - } |
|
1414 | - else if((float)DOL_VERSION>=3.8) { |
|
1480 | + } else if((float)DOL_VERSION>=3.8) { |
|
1415 | 1481 | return 1; |
1416 | 1482 | } |
1417 | 1483 | } |
1418 | 1484 | |
1419 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1420 | - else $i = (int)$parameters; |
|
1485 | + if(is_array($parameters)) { |
|
1486 | + $i = & $parameters['i']; |
|
1487 | + } else { |
|
1488 | + $i = (int)$parameters; |
|
1489 | + } |
|
1421 | 1490 | |
1422 | 1491 | if (!empty($hideprices) |
1423 | 1492 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1441,16 +1510,21 @@ discard block |
||
1441 | 1510 | |
1442 | 1511 | if((float)DOL_VERSION<=3.6) { |
1443 | 1512 | return ''; |
1444 | - } |
|
1445 | - else if((float)DOL_VERSION>=3.8) { |
|
1513 | + } else if((float)DOL_VERSION>=3.8) { |
|
1446 | 1514 | return 1; |
1447 | 1515 | } |
1448 | 1516 | } |
1449 | 1517 | |
1450 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1451 | - else $i = (int)$parameters; |
|
1518 | + if(is_array($parameters)) { |
|
1519 | + $i = & $parameters['i']; |
|
1520 | + } else { |
|
1521 | + $i = (int)$parameters; |
|
1522 | + } |
|
1452 | 1523 | |
1453 | - 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) |
|
1524 | + if (empty($object->lines[$i])) { |
|
1525 | + return 0; |
|
1526 | + } |
|
1527 | + // 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) |
|
1454 | 1528 | |
1455 | 1529 | $object->lines[$i]->fetch_optionals(); |
1456 | 1530 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1496,14 +1570,16 @@ discard block |
||
1496 | 1570 | $this->resprints = ' '; |
1497 | 1571 | if((float)DOL_VERSION<=3.6) { |
1498 | 1572 | return ''; |
1499 | - } |
|
1500 | - else if((float)DOL_VERSION>=3.8) { |
|
1573 | + } else if((float)DOL_VERSION>=3.8) { |
|
1501 | 1574 | return 1; |
1502 | 1575 | } |
1503 | 1576 | } |
1504 | 1577 | |
1505 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1506 | - else $i = (int)$parameters; |
|
1578 | + if(is_array($parameters)) { |
|
1579 | + $i = & $parameters['i']; |
|
1580 | + } else { |
|
1581 | + $i = (int)$parameters; |
|
1582 | + } |
|
1507 | 1583 | |
1508 | 1584 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1509 | 1585 | { |
@@ -1533,7 +1609,9 @@ discard block |
||
1533 | 1609 | } |
1534 | 1610 | } |
1535 | 1611 | |
1536 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1612 | + if (!empty($TLineTitle)) { |
|
1613 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1614 | + } |
|
1537 | 1615 | } |
1538 | 1616 | |
1539 | 1617 | } |
@@ -1547,8 +1625,12 @@ discard block |
||
1547 | 1625 | $j=0; |
1548 | 1626 | foreach ($TLineTitle as $k => &$line) |
1549 | 1627 | { |
1550 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1551 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1628 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1629 | + continue; |
|
1630 | + } |
|
1631 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1632 | + break; |
|
1633 | + } |
|
1552 | 1634 | |
1553 | 1635 | if ($line->qty == $level) |
1554 | 1636 | { |
@@ -1582,7 +1664,9 @@ discard block |
||
1582 | 1664 | |
1583 | 1665 | $hidedetails = (int)GETPOST('hidedetails'); |
1584 | 1666 | |
1585 | - if(empty($hidedetails)) return false; |
|
1667 | + if(empty($hidedetails)) { |
|
1668 | + return false; |
|
1669 | + } |
|
1586 | 1670 | |
1587 | 1671 | // TODO can't add VAT to document without lines... :-/ |
1588 | 1672 | |
@@ -1643,7 +1727,9 @@ discard block |
||
1643 | 1727 | */ |
1644 | 1728 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1645 | 1729 | |
1646 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1730 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1731 | + $line->TTotal_tva = $TTotal_tva; |
|
1732 | + } |
|
1647 | 1733 | $line->total_ht = $total; |
1648 | 1734 | $line->total_tva = $total_tva; |
1649 | 1735 | $line->total = $line->total_ht; |
@@ -1707,8 +1793,7 @@ discard block |
||
1707 | 1793 | } |
1708 | 1794 | |
1709 | 1795 | |
1710 | - } |
|
1711 | - elseif ($hidedetails) |
|
1796 | + } elseif ($hidedetails) |
|
1712 | 1797 | { |
1713 | 1798 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1714 | 1799 | } |
@@ -1779,7 +1864,9 @@ discard block |
||
1779 | 1864 | |
1780 | 1865 | if(!empty($hideprices)) { |
1781 | 1866 | foreach($object->lines as &$line) { |
1782 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1867 | + if($line->fk_product_type!=9) { |
|
1868 | + $line->fk_parent_line = -1; |
|
1869 | + } |
|
1783 | 1870 | } |
1784 | 1871 | } |
1785 | 1872 | |
@@ -1800,7 +1887,9 @@ discard block |
||
1800 | 1887 | |
1801 | 1888 | if($line->qty>90) { |
1802 | 1889 | |
1803 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1890 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1891 | + $label .= ' '.$this->getTitle($object, $line); |
|
1892 | + } |
|
1804 | 1893 | |
1805 | 1894 | $pageBefore = $pdf->getPage(); |
1806 | 1895 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1818,8 +1907,7 @@ discard block |
||
1818 | 1907 | |
1819 | 1908 | $posy = $pdf->GetY(); |
1820 | 1909 | return 1; |
1821 | - } |
|
1822 | - else if ($line->qty < 10) { |
|
1910 | + } else if ($line->qty < 10) { |
|
1823 | 1911 | $pageBefore = $pdf->getPage(); |
1824 | 1912 | |
1825 | 1913 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1843,8 +1931,7 @@ discard block |
||
1843 | 1931 | // if($line->rowid==47) exit; |
1844 | 1932 | |
1845 | 1933 | return 0; |
1846 | - } |
|
1847 | - elseif (empty($object->lines[$parameters['i']])) |
|
1934 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1848 | 1935 | { |
1849 | 1936 | $this->resprints = -1; |
1850 | 1937 | } |
@@ -1877,7 +1964,9 @@ discard block |
||
1877 | 1964 | |
1878 | 1965 | foreach ($object->lines as $line) |
1879 | 1966 | { |
1880 | - if ($line->id == $currentLine->id) break; |
|
1967 | + if ($line->id == $currentLine->id) { |
|
1968 | + break; |
|
1969 | + } |
|
1881 | 1970 | |
1882 | 1971 | $qty_search = 100 - $currentLine->qty; |
1883 | 1972 | |
@@ -1914,23 +2003,23 @@ discard block |
||
1914 | 2003 | { |
1915 | 2004 | $object->statut = 0; // hack for facture rec |
1916 | 2005 | $createRight = $user->rights->facture->creer; |
1917 | - } |
|
1918 | - elseif($object->element == 'order_supplier' ) |
|
2006 | + } elseif($object->element == 'order_supplier' ) |
|
1919 | 2007 | { |
1920 | 2008 | $createRight = $user->rights->fournisseur->commande->creer; |
1921 | - } |
|
1922 | - elseif($object->element == 'invoice_supplier' ) |
|
2009 | + } elseif($object->element == 'invoice_supplier' ) |
|
1923 | 2010 | { |
1924 | 2011 | $createRight = $user->rights->fournisseur->facture->creer; |
1925 | 2012 | } |
1926 | 2013 | |
1927 | 2014 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1928 | 2015 | null; |
1929 | - } |
|
1930 | - 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)) |
|
2016 | + } 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)) |
|
1931 | 2017 | { |
1932 | - if($object->element=='facture')$idvar = 'facid'; |
|
1933 | - else $idvar='id'; |
|
2018 | + if($object->element=='facture') { |
|
2019 | + $idvar = 'facid'; |
|
2020 | + } else { |
|
2021 | + $idvar='id'; |
|
2022 | + } |
|
1934 | 2023 | |
1935 | 2024 | if((float)DOL_VERSION <= 3.4) |
1936 | 2025 | { |
@@ -1956,22 +2045,44 @@ discard block |
||
1956 | 2045 | <?php |
1957 | 2046 | } |
1958 | 2047 | |
1959 | - if(empty($line->description)) $line->description = $line->desc; |
|
2048 | + if(empty($line->description)) { |
|
2049 | + $line->description = $line->desc; |
|
2050 | + } |
|
1960 | 2051 | |
1961 | 2052 | $colspan = 5; |
1962 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1963 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1964 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1965 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
2053 | + if($object->element == 'facturerec' ) { |
|
2054 | + $colspan = 3; |
|
2055 | + } |
|
2056 | + if($object->element == 'order_supplier') { |
|
2057 | + $colspan = 3; |
|
2058 | + } |
|
2059 | + if($object->element == 'invoice_supplier') { |
|
2060 | + $colspan = 4; |
|
2061 | + } |
|
2062 | + if($object->element == 'supplier_proposal') { |
|
2063 | + $colspan = 4; |
|
2064 | + } |
|
1966 | 2065 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
1967 | 2066 | $colspan++; // Colonne PU Devise |
1968 | 2067 | } |
1969 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1970 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1971 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1972 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1973 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1974 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
2068 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
2069 | + $colspan++; |
|
2070 | + } |
|
2071 | + if(!empty($conf->margin->enabled)) { |
|
2072 | + $colspan++; |
|
2073 | + } |
|
2074 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
2075 | + $colspan++; |
|
2076 | + } |
|
2077 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
2078 | + $colspan++; |
|
2079 | + } |
|
2080 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
2081 | + $colspan++; |
|
2082 | + } |
|
2083 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
2084 | + $colspan++; |
|
2085 | + } |
|
1975 | 2086 | |
1976 | 2087 | /* Titre */ |
1977 | 2088 | //var_dump($line); |
@@ -1984,23 +2095,36 @@ discard block |
||
1984 | 2095 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1985 | 2096 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1986 | 2097 | { |
1987 | - if($line->qty==99) print 'background:#adadcf'; |
|
1988 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1989 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1990 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1991 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1992 | - else if($line->qty==50) print ''; |
|
1993 | - else print 'background:#eeeeff;'; |
|
2098 | + if($line->qty==99) { |
|
2099 | + print 'background:#adadcf'; |
|
2100 | + } else if($line->qty==98) { |
|
2101 | + print 'background:#ddddff;'; |
|
2102 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
2103 | + print 'background:#eeeeff;'; |
|
2104 | + } else if($line->qty==1) { |
|
2105 | + print 'background:#adadcf;'; |
|
2106 | + } else if($line->qty==2) { |
|
2107 | + print 'background:#ddddff;'; |
|
2108 | + } else if($line->qty==50) { |
|
2109 | + print ''; |
|
2110 | + } else { |
|
2111 | + print 'background:#eeeeff;'; |
|
2112 | + } |
|
1994 | 2113 | |
1995 | 2114 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1996 | - } |
|
1997 | - else |
|
2115 | + } else |
|
1998 | 2116 | { |
1999 | - if($line->qty==99) print 'background:#ddffdd'; |
|
2000 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
2001 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
2002 | - else if($line->qty==50) print ''; |
|
2003 | - else print 'background:#eeffee;' ; |
|
2117 | + if($line->qty==99) { |
|
2118 | + print 'background:#ddffdd'; |
|
2119 | + } else if($line->qty==98) { |
|
2120 | + print 'background:#ddddff;'; |
|
2121 | + } else if($line->qty==2) { |
|
2122 | + print 'background:#eeeeff; '; |
|
2123 | + } else if($line->qty==50) { |
|
2124 | + print ''; |
|
2125 | + } else { |
|
2126 | + print 'background:#eeffee;' ; |
|
2127 | + } |
|
2004 | 2128 | } |
2005 | 2129 | |
2006 | 2130 | ?>;"> |
@@ -2027,13 +2151,11 @@ discard block |
||
2027 | 2151 | $qty_displayed = $line->qty; |
2028 | 2152 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2029 | 2153 | |
2030 | - } |
|
2031 | - else if (TSubtotal::isSubtotal($line)) |
|
2154 | + } else if (TSubtotal::isSubtotal($line)) |
|
2032 | 2155 | { |
2033 | 2156 | $qty_displayed = 100 - $line->qty; |
2034 | 2157 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2035 | - } |
|
2036 | - else |
|
2158 | + } else |
|
2037 | 2159 | { |
2038 | 2160 | $isFreeText = true; |
2039 | 2161 | } |
@@ -2054,9 +2176,13 @@ discard block |
||
2054 | 2176 | } |
2055 | 2177 | |
2056 | 2178 | $readonlyForSituation = ''; |
2057 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
2179 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
2180 | + $readonlyForSituation = 'readonly'; |
|
2181 | + } |
|
2058 | 2182 | |
2059 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2183 | + if (!$isFreeText) { |
|
2184 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2185 | + } |
|
2060 | 2186 | |
2061 | 2187 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
2062 | 2188 | { |
@@ -2064,8 +2190,12 @@ discard block |
||
2064 | 2190 | for ($j=1; $j<10; $j++) |
2065 | 2191 | { |
2066 | 2192 | if (!empty($readonlyForSituation)) { |
2067 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2068 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2193 | + if ($qty_displayed == $j) { |
|
2194 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2195 | + } |
|
2196 | + } else { |
|
2197 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2198 | + } |
|
2069 | 2199 | } |
2070 | 2200 | $select .= '</select> '; |
2071 | 2201 | |
@@ -2085,7 +2215,9 @@ discard block |
||
2085 | 2215 | echo '<div>'; |
2086 | 2216 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
2087 | 2217 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
2088 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2218 | + if (empty($readonlyForSituation)) { |
|
2219 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2220 | + } |
|
2089 | 2221 | echo '</select>'; |
2090 | 2222 | echo '</div>'; |
2091 | 2223 | |
@@ -2104,8 +2236,9 @@ discard block |
||
2104 | 2236 | echo '<input style="vertical-align:sub;" type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' /> '; |
2105 | 2237 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2106 | 2238 | echo '</div>'; |
2239 | + } else if ($isFreeText) { |
|
2240 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2107 | 2241 | } |
2108 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2109 | 2242 | echo '</div>'; |
2110 | 2243 | |
2111 | 2244 | if($line->qty<10) { |
@@ -2125,8 +2258,7 @@ discard block |
||
2125 | 2258 | $doleditor->Create(); |
2126 | 2259 | } |
2127 | 2260 | |
2128 | - } |
|
2129 | - else { |
|
2261 | + } else { |
|
2130 | 2262 | |
2131 | 2263 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2132 | 2264 | { |
@@ -2134,14 +2266,19 @@ discard block |
||
2134 | 2266 | { |
2135 | 2267 | echo str_repeat(' ', $line->qty-1); |
2136 | 2268 | |
2137 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2138 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2269 | + if (TSubtotal::isTitle($line)) { |
|
2270 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2271 | + } else { |
|
2272 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2273 | + } |
|
2139 | 2274 | } |
2140 | - } |
|
2141 | - else |
|
2275 | + } else |
|
2142 | 2276 | { |
2143 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2144 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2277 | + if($line->qty<=1) { |
|
2278 | + print img_picto('', 'subtotal@subtotal'); |
|
2279 | + } else if($line->qty==2) { |
|
2280 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
2281 | + } |
|
2145 | 2282 | } |
2146 | 2283 | |
2147 | 2284 | |
@@ -2151,21 +2288,26 @@ discard block |
||
2151 | 2288 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
2152 | 2289 | |
2153 | 2290 | if (empty($line->label)) { |
2154 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
2155 | - else print $line->description; |
|
2156 | - } |
|
2157 | - else { |
|
2291 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
2292 | + print $line->description.' '.$this->getTitle($object, $line); |
|
2293 | + } else { |
|
2294 | + print $line->description; |
|
2295 | + } |
|
2296 | + } else { |
|
2158 | 2297 | |
2159 | 2298 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
2160 | 2299 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2161 | - } |
|
2162 | - else{ |
|
2300 | + } else{ |
|
2163 | 2301 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2164 | 2302 | } |
2165 | 2303 | |
2166 | 2304 | } |
2167 | - if($line->qty>90) print ' : '; |
|
2168 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2305 | + if($line->qty>90) { |
|
2306 | + print ' : '; |
|
2307 | + } |
|
2308 | + if($line->info_bits > 0) { |
|
2309 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2310 | + } |
|
2169 | 2311 | |
2170 | 2312 | |
2171 | 2313 | |
@@ -2208,11 +2350,12 @@ discard block |
||
2208 | 2350 | </script> |
2209 | 2351 | <?php |
2210 | 2352 | |
2211 | - } |
|
2212 | - else{ |
|
2353 | + } else{ |
|
2213 | 2354 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
2214 | 2355 | { |
2215 | - 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>'; |
|
2356 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
2357 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2358 | + } |
|
2216 | 2359 | } |
2217 | 2360 | |
2218 | 2361 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2301,7 +2444,9 @@ discard block |
||
2301 | 2444 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2302 | 2445 | |
2303 | 2446 | $colspan+=3; $mode = 'view'; |
2304 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2447 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2448 | + $mode = 'edit'; |
|
2449 | + } |
|
2305 | 2450 | |
2306 | 2451 | $ex_element = $line->element; |
2307 | 2452 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2483,10 +2628,9 @@ discard block |
||
2483 | 2628 | |
2484 | 2629 | if(TSubtotal::isTitle($line)){ |
2485 | 2630 | $ThtmlData['data-issubtotal'] = 'title'; |
2486 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2631 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2487 | 2632 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2488 | - } |
|
2489 | - else{ |
|
2633 | + } else{ |
|
2490 | 2634 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2491 | 2635 | } |
2492 | 2636 | |
@@ -2496,7 +2640,9 @@ discard block |
||
2496 | 2640 | |
2497 | 2641 | // hook |
2498 | 2642 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2499 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2643 | + if ($reshook < 0) { |
|
2644 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2645 | + } |
|
2500 | 2646 | if ($reshook>0) |
2501 | 2647 | { |
2502 | 2648 | $ThtmlData = $hookmanager->resArray; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // Dolibarr environment |
29 | 29 | $res = @include("../../main.inc.php"); // From htdocs directory |
30 | 30 | if (! $res) { |
31 | - $res = @include("../../../main.inc.php"); // From "custom" directory |
|
31 | + $res = @include("../../../main.inc.php"); // From "custom" directory |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // Libraries |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | // Access control |
41 | 41 | if (! $user->admin) { |
42 | - accessforbidden(); |
|
42 | + accessforbidden(); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | // Parameters |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | // Configuration header |
92 | 92 | $head = subtotalAdminPrepareHead(); |
93 | 93 | dol_fiche_head( |
94 | - $head, |
|
95 | - 'settings', |
|
96 | - $langs->trans("Module104777Name"), |
|
97 | - 0, |
|
98 | - "subtotal@subtotal" |
|
94 | + $head, |
|
95 | + 'settings', |
|
96 | + $langs->trans("Module104777Name"), |
|
97 | + 0, |
|
98 | + "subtotal@subtotal" |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | showParameters(); |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
260 | 260 | print '<input type="hidden" name="action" value="set_SUBTOTAL_TFIELD_TO_KEEP_WITH_NC">'; |
261 | 261 | $TField = array( |
262 | - 'pdf_getlineqty' => $langs->trans('Qty'), |
|
263 | - 'pdf_getlinevatrate' => $langs->trans('VAT'), |
|
264 | - 'pdf_getlineupexcltax' => $langs->trans('PriceUHT'), |
|
265 | - 'pdf_getlinetotalexcltax' => $langs->trans('TotalHT'), |
|
266 | - 'pdf_getlineunit' => $langs->trans('Unit'), |
|
267 | - 'pdf_getlineremisepercent' => $langs->trans('Discount') |
|
262 | + 'pdf_getlineqty' => $langs->trans('Qty'), |
|
263 | + 'pdf_getlinevatrate' => $langs->trans('VAT'), |
|
264 | + 'pdf_getlineupexcltax' => $langs->trans('PriceUHT'), |
|
265 | + 'pdf_getlinetotalexcltax' => $langs->trans('TotalHT'), |
|
266 | + 'pdf_getlineunit' => $langs->trans('Unit'), |
|
267 | + 'pdf_getlineremisepercent' => $langs->trans('Discount') |
|
268 | 268 | ); |
269 | 269 | print $html->multiselectarray('SUBTOTAL_TFIELD_TO_KEEP_WITH_NC', $TField, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC), 0, 0, '', 0, 0, 'style="min-width:100px"'); |
270 | 270 | print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; |