@@ -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"> |
@@ -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").'">'; |