@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | * @return void |
82 | 82 | */ |
83 | 83 | |
84 | - var $module_number = 104777; |
|
84 | + var $module_number = 104777; |
|
85 | 85 | |
86 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
87 | - { |
|
88 | - global $langs,$db,$user, $conf; |
|
86 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
87 | + { |
|
88 | + global $langs,$db,$user, $conf; |
|
89 | 89 | |
90 | 90 | $langs->load('subtotal@subtotal'); |
91 | 91 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | $createRight = $user->rights->facture->creer; |
101 | 101 | } elseif($object->element == 'order_supplier' ) |
102 | 102 | { |
103 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
103 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
104 | 104 | } elseif($object->element == 'invoice_supplier' ) |
105 | 105 | { |
106 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
106 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($object->statut == 0 && $createRight) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
155 | 155 | |
156 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
156 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
157 | 157 | } |
158 | 158 | else if($action==='ask_deleteallline') { |
159 | 159 | $form=new Form($db); |
@@ -375,36 +375,36 @@ discard block |
||
375 | 375 | $TContext = explode(':',$parameters['context']); |
376 | 376 | if ( |
377 | 377 | in_array('invoicecard',$TContext) |
378 | - || in_array('invoicesuppliercard',$TContext) |
|
378 | + || in_array('invoicesuppliercard',$TContext) |
|
379 | 379 | || in_array('propalcard',$TContext) |
380 | 380 | || in_array('ordercard',$TContext) |
381 | - || in_array('ordersuppliercard',$TContext) |
|
381 | + || in_array('ordersuppliercard',$TContext) |
|
382 | 382 | || in_array('invoicereccard',$TContext) |
383 | 383 | ) |
384 | - { |
|
384 | + { |
|
385 | 385 | $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
386 | 386 | $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
387 | 387 | $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
388 | 388 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : $hidepricesDefaultConf; |
389 | 389 | |
390 | 390 | $var=false; |
391 | - $out.= '<tr '.$bc[$var].'> |
|
391 | + $out.= '<tr '.$bc[$var].'> |
|
392 | 392 | <td colspan="4" align="right"> |
393 | 393 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
394 | 394 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
395 | 395 | </td> |
396 | 396 | </tr>'; |
397 | 397 | |
398 | - $var=!$var; |
|
399 | - $out.= '<tr '.$bc[$var].'> |
|
398 | + $var=!$var; |
|
399 | + $out.= '<tr '.$bc[$var].'> |
|
400 | 400 | <td colspan="4" align="right"> |
401 | 401 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
402 | 402 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
403 | 403 | </td> |
404 | 404 | </tr>'; |
405 | 405 | |
406 | - $var=!$var; |
|
407 | - $out.= '<tr '.$bc[$var].'> |
|
406 | + $var=!$var; |
|
407 | + $out.= '<tr '.$bc[$var].'> |
|
408 | 408 | <td colspan="4" align="right"> |
409 | 409 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
410 | 410 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | if ( |
417 | 417 | (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
418 | 418 | || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
419 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
419 | + || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
420 | 420 | || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
421 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
421 | + || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
422 | 422 | || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
423 | 423 | ) |
424 | 424 | { |
@@ -437,19 +437,19 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | |
440 | - return 1; |
|
440 | + return 1; |
|
441 | 441 | } |
442 | 442 | |
443 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
444 | - { |
|
443 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
444 | + { |
|
445 | 445 | |
446 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
447 | - { |
|
446 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
447 | + { |
|
448 | 448 | |
449 | - } |
|
449 | + } |
|
450 | 450 | |
451 | - return 0; |
|
452 | - } |
|
451 | + return 0; |
|
452 | + } |
|
453 | 453 | |
454 | 454 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
455 | 455 | global $conf; |
@@ -498,11 +498,11 @@ discard block |
||
498 | 498 | |
499 | 499 | if ( |
500 | 500 | in_array('invoicecard',explode(':',$parameters['context'])) |
501 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
501 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
502 | 502 | || in_array('propalcard',explode(':',$parameters['context'])) |
503 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
503 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
504 | 504 | || in_array('ordercard',explode(':',$parameters['context'])) |
505 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
505 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
506 | 506 | || in_array('invoicereccard',explode(':',$parameters['context'])) |
507 | 507 | ) { |
508 | 508 | |
@@ -581,20 +581,20 @@ discard block |
||
581 | 581 | in_array('invoicecard',explode(':',$parameters['context'])) |
582 | 582 | || in_array('propalcard',explode(':',$parameters['context'])) |
583 | 583 | || in_array('ordercard',explode(':',$parameters['context'])) |
584 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
585 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
586 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
584 | + || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
585 | + || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
586 | + || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
587 | 587 | ) |
588 | - { |
|
588 | + { |
|
589 | 589 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
590 | 590 | $sessname = 'subtotal_hideInnerLines_facture'; |
591 | 591 | $sessname2 = 'subtotal_hidedetails_facture'; |
592 | 592 | $sessname3 = 'subtotal_hideprices_facture'; |
593 | 593 | } |
594 | 594 | elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
595 | - $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
596 | - $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
597 | - $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
595 | + $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
|
596 | + $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
|
597 | + $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
|
598 | 598 | } |
599 | 599 | elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
600 | 600 | $sessname = 'subtotal_hideInnerLines_propal'; |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | $sessname3 = 'subtotal_hideprices_propal'; |
603 | 603 | } |
604 | 604 | elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
605 | - $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
606 | - $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
607 | - $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
605 | + $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
|
606 | + $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
|
607 | + $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
|
608 | 608 | } |
609 | 609 | elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
610 | 610 | $sessname = 'subtotal_hideInnerLines_commande'; |
@@ -612,9 +612,9 @@ discard block |
||
612 | 612 | $sessname3 = 'subtotal_hideprices_commande'; |
613 | 613 | } |
614 | 614 | elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
615 | - $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
616 | - $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
617 | - $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
615 | + $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
|
616 | + $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
|
617 | + $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
|
618 | 618 | } |
619 | 619 | else { |
620 | 620 | $sessname = 'subtotal_hideInnerLines_unknown'; |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | foreach($object->lines as &$line) { |
637 | 637 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
638 | 638 | |
639 | - if($line->qty>=90) { |
|
640 | - $line->modsubtotal_total = 1; |
|
641 | - } |
|
642 | - else{ |
|
643 | - $line->modsubtotal_title = 1; |
|
644 | - } |
|
639 | + if($line->qty>=90) { |
|
640 | + $line->modsubtotal_total = 1; |
|
641 | + } |
|
642 | + else{ |
|
643 | + $line->modsubtotal_title = 1; |
|
644 | + } |
|
645 | 645 | |
646 | 646 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
647 | 647 | } |
648 | - } |
|
649 | - } |
|
648 | + } |
|
649 | + } |
|
650 | 650 | |
651 | 651 | } |
652 | 652 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | else if($object->element=='invoice_supplier') |
665 | 665 | { |
666 | - $object->deleteline($idLine); |
|
666 | + $object->deleteline($idLine); |
|
667 | 667 | } |
668 | 668 | /** |
669 | 669 | * @var $object Propal |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | else if($object->element=='order_supplier') |
688 | 688 | { |
689 | - $object->deleteline($idLine); |
|
689 | + $object->deleteline($idLine); |
|
690 | 690 | } |
691 | 691 | /** |
692 | 692 | * @var $object Facturerec |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | foreach($object->lines as $l) { |
732 | 732 | |
733 | - $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
733 | + $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
734 | 734 | if($lid == $lineid) { |
735 | 735 | |
736 | 736 | $found = true; |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | |
740 | 740 | if($found) { |
741 | 741 | |
742 | - $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
742 | + $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
|
743 | 743 | |
744 | 744 | if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
745 | 745 | break; // end of story |
@@ -818,17 +818,17 @@ discard block |
||
818 | 818 | if($l->rang>=$rang) { |
819 | 819 | return price($total); |
820 | 820 | } |
821 | - if (TSubtotal::isSubtotal($l)){ |
|
822 | - $total = 0; |
|
823 | - } else if ($l->situation_percent > 0 ){ |
|
821 | + if (TSubtotal::isSubtotal($l)){ |
|
822 | + $total = 0; |
|
823 | + } else if ($l->situation_percent > 0 ){ |
|
824 | 824 | |
825 | 825 | |
826 | 826 | $prev_progress = $l->get_prev_progress($object->id); |
827 | 827 | $progress = ($l->situation_percent - $prev_progress) /100; |
828 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
828 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
829 | 829 | |
830 | - } |
|
831 | - } |
|
830 | + } |
|
831 | + } |
|
832 | 832 | |
833 | 833 | return price($total); |
834 | 834 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | if(method_exists('Closure','bind')) { |
861 | 861 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
862 | 862 | $sweetsThief = function ($pdf) { |
863 | - return $pdf->bMargin ; |
|
863 | + return $pdf->bMargin ; |
|
864 | 864 | }; |
865 | 865 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
866 | 866 | |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | else |
924 | 924 | { |
925 | 925 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
926 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
927 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
928 | - } else { |
|
929 | - $total_to_print = price($total); |
|
930 | - } |
|
926 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
927 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
928 | + } else { |
|
929 | + $total_to_print = price($total); |
|
930 | + } |
|
931 | 931 | |
932 | 932 | $line->total_ht = $total; |
933 | 933 | $line->total = $total; |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1081 | - global $conf, $hideprices, $hookmanager; |
|
1081 | + global $conf, $hideprices, $hookmanager; |
|
1082 | 1082 | |
1083 | 1083 | if($this->isModSubtotalLine($parameters,$object) ){ |
1084 | 1084 | |
@@ -1117,9 +1117,9 @@ discard block |
||
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1120 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1121 | - else $i = (int)$parameters; |
|
1122 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1120 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1121 | + else $i = (int)$parameters; |
|
1122 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1465,11 +1465,11 @@ discard block |
||
1465 | 1465 | $hidedetails = (int)GETPOST('hidedetails'); |
1466 | 1466 | |
1467 | 1467 | if ($hideInnerLines) { // si c une ligne de titre |
1468 | - $fk_parent_line=0; |
|
1468 | + $fk_parent_line=0; |
|
1469 | 1469 | $TLines =array(); |
1470 | 1470 | |
1471 | 1471 | $original_count=count($object->lines); |
1472 | - $TTvas = array(); // tableau de tva |
|
1472 | + $TTvas = array(); // tableau de tva |
|
1473 | 1473 | |
1474 | 1474 | foreach($object->lines as $k=>&$line) |
1475 | 1475 | { |
@@ -1499,48 +1499,48 @@ discard block |
||
1499 | 1499 | |
1500 | 1500 | if ($hideInnerLines) |
1501 | 1501 | { |
1502 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1503 | - { |
|
1504 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1502 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1503 | + { |
|
1504 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1505 | 1505 | |
1506 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1507 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1508 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1509 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1510 | - } |
|
1511 | - if($line->product_type==9 && $line->rowid>0) |
|
1512 | - { |
|
1513 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1514 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1515 | - $nbtva = count($TTvas); |
|
1516 | - if(!empty($nbtva)){ |
|
1517 | - foreach ($TTvas as $tx =>$val){ |
|
1518 | - $l = clone $line; |
|
1519 | - $l->product_type = 1; |
|
1520 | - $l->special_code = ''; |
|
1521 | - $l->qty = 1; |
|
1522 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1523 | - $l->tva_tx = $tx; |
|
1524 | - $l->total_ht = $val['total_ht']; |
|
1525 | - $l->total_tva = $val['total_tva']; |
|
1526 | - $l->total = $line->total_ht; |
|
1527 | - $l->total_ttc = $val['total_ttc']; |
|
1528 | - $TLines[] = $l; |
|
1529 | - array_shift($TTvas); |
|
1530 | - } |
|
1531 | - } |
|
1506 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1507 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1508 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1509 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1510 | + } |
|
1511 | + if($line->product_type==9 && $line->rowid>0) |
|
1512 | + { |
|
1513 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1514 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1515 | + $nbtva = count($TTvas); |
|
1516 | + if(!empty($nbtva)){ |
|
1517 | + foreach ($TTvas as $tx =>$val){ |
|
1518 | + $l = clone $line; |
|
1519 | + $l->product_type = 1; |
|
1520 | + $l->special_code = ''; |
|
1521 | + $l->qty = 1; |
|
1522 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1523 | + $l->tva_tx = $tx; |
|
1524 | + $l->total_ht = $val['total_ht']; |
|
1525 | + $l->total_tva = $val['total_tva']; |
|
1526 | + $l->total = $line->total_ht; |
|
1527 | + $l->total_ttc = $val['total_ttc']; |
|
1528 | + $TLines[] = $l; |
|
1529 | + array_shift($TTvas); |
|
1530 | + } |
|
1531 | + } |
|
1532 | 1532 | |
1533 | - // ajoute la ligne de sous-total |
|
1534 | - $TLines[] = $line; |
|
1535 | - } |
|
1536 | - } else { |
|
1533 | + // ajoute la ligne de sous-total |
|
1534 | + $TLines[] = $line; |
|
1535 | + } |
|
1536 | + } else { |
|
1537 | 1537 | |
1538 | - if($line->product_type==9 && $line->rowid>0) |
|
1539 | - { |
|
1540 | - // ajoute la ligne de sous-total |
|
1541 | - $TLines[] = $line; |
|
1542 | - } |
|
1543 | - } |
|
1538 | + if($line->product_type==9 && $line->rowid>0) |
|
1539 | + { |
|
1540 | + // ajoute la ligne de sous-total |
|
1541 | + $TLines[] = $line; |
|
1542 | + } |
|
1543 | + } |
|
1544 | 1544 | |
1545 | 1545 | |
1546 | 1546 | } |
@@ -1565,20 +1565,20 @@ discard block |
||
1565 | 1565 | $nbtva = count($TTvas); |
1566 | 1566 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1567 | 1567 | { |
1568 | - foreach ($TTvas as $tx =>$val){ |
|
1569 | - $l = clone $line; |
|
1570 | - $l->product_type = 1; |
|
1571 | - $l->special_code = ''; |
|
1572 | - $l->qty = 1; |
|
1573 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1574 | - $l->tva_tx = $tx; |
|
1575 | - $l->total_ht = $val['total_ht']; |
|
1576 | - $l->total_tva = $val['total_tva']; |
|
1577 | - $l->total = $line->total_ht; |
|
1578 | - $l->total_ttc = $val['total_ttc']; |
|
1579 | - $TLines[] = $l; |
|
1580 | - array_shift($TTvas); |
|
1581 | - } |
|
1568 | + foreach ($TTvas as $tx =>$val){ |
|
1569 | + $l = clone $line; |
|
1570 | + $l->product_type = 1; |
|
1571 | + $l->special_code = ''; |
|
1572 | + $l->qty = 1; |
|
1573 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1574 | + $l->tva_tx = $tx; |
|
1575 | + $l->total_ht = $val['total_ht']; |
|
1576 | + $l->total_tva = $val['total_tva']; |
|
1577 | + $l->total = $line->total_ht; |
|
1578 | + $l->total_ttc = $val['total_ttc']; |
|
1579 | + $TLines[] = $l; |
|
1580 | + array_shift($TTvas); |
|
1581 | + } |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | global $nblignes; |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $this->resprints = ''; |
1591 | 1591 | return 0; |
1592 | 1592 | } |
1593 | - } |
|
1593 | + } |
|
1594 | 1594 | |
1595 | 1595 | return 0; |
1596 | 1596 | } |
@@ -1753,18 +1753,18 @@ discard block |
||
1753 | 1753 | } |
1754 | 1754 | elseif($object->element == 'order_supplier' ) |
1755 | 1755 | { |
1756 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
1756 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
1757 | 1757 | } |
1758 | 1758 | elseif($object->element == 'invoice_supplier' ) |
1759 | 1759 | { |
1760 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
1760 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
1761 | 1761 | } |
1762 | 1762 | |
1763 | 1763 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1764 | 1764 | null; |
1765 | 1765 | } |
1766 | 1766 | 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)) |
1767 | - { |
|
1767 | + { |
|
1768 | 1768 | if($object->element=='facture')$idvar = 'facid'; |
1769 | 1769 | else $idvar='id'; |
1770 | 1770 | |
@@ -1811,7 +1811,7 @@ discard block |
||
1811 | 1811 | //var_dump($line); |
1812 | 1812 | |
1813 | 1813 | // HTML 5 data for js |
1814 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1814 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1815 | 1815 | |
1816 | 1816 | |
1817 | 1817 | ?> |
@@ -1869,8 +1869,8 @@ discard block |
||
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
1872 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1873 | - $line->description = ''; |
|
1872 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
1873 | + $line->description = ''; |
|
1874 | 1874 | } |
1875 | 1875 | $newlabel = $line->label; |
1876 | 1876 | if($line->label=='' && !$isFreeText) { |
@@ -2161,17 +2161,17 @@ discard block |
||
2161 | 2161 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2162 | 2162 | { |
2163 | 2163 | |
2164 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2165 | - { |
|
2166 | - foreach ($object->lines as $line) |
|
2167 | - { |
|
2168 | - // fetch optionals attributes and labels |
|
2169 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2170 | - $extrafields=new ExtraFields($this->db); |
|
2171 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2172 | - $line->fetch_optionals($line->id,$extralabels); |
|
2173 | - } |
|
2174 | - } |
|
2164 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2165 | + { |
|
2166 | + foreach ($object->lines as $line) |
|
2167 | + { |
|
2168 | + // fetch optionals attributes and labels |
|
2169 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2170 | + $extrafields=new ExtraFields($this->db); |
|
2171 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2172 | + $line->fetch_optionals($line->id,$extralabels); |
|
2173 | + } |
|
2174 | + } |
|
2175 | 2175 | |
2176 | 2176 | $TSubNc = array(); |
2177 | 2177 | foreach ($object->lines as &$l) |
@@ -2262,80 +2262,80 @@ discard block |
||
2262 | 2262 | { |
2263 | 2263 | dol_include_once('/subtotal/class/subtotal.class.php'); |
2264 | 2264 | |
2265 | - $line = &$parameters['line']; |
|
2265 | + $line = &$parameters['line']; |
|
2266 | 2266 | |
2267 | - $ThtmlData['data-id'] = $line->id; |
|
2268 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2269 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2270 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2267 | + $ThtmlData['data-id'] = $line->id; |
|
2268 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2269 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2270 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2271 | 2271 | |
2272 | - if(TSubtotal::isTitle($line)){ |
|
2273 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2274 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2275 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2276 | - } |
|
2277 | - else{ |
|
2278 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2279 | - } |
|
2272 | + if(TSubtotal::isTitle($line)){ |
|
2273 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2274 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2275 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2276 | + } |
|
2277 | + else{ |
|
2278 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2279 | + } |
|
2280 | 2280 | |
2281 | 2281 | |
2282 | - // Change or add data from hooks |
|
2283 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2282 | + // Change or add data from hooks |
|
2283 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2284 | 2284 | |
2285 | - // hook |
|
2286 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2287 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2288 | - if ($reshook>0) |
|
2289 | - { |
|
2290 | - $ThtmlData = $hookmanager->resArray; |
|
2291 | - } |
|
2292 | - |
|
2293 | - return $this->implodeHtmlData($ThtmlData); |
|
2285 | + // hook |
|
2286 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2287 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2288 | + if ($reshook>0) |
|
2289 | + { |
|
2290 | + $ThtmlData = $hookmanager->resArray; |
|
2291 | + } |
|
2292 | + |
|
2293 | + return $this->implodeHtmlData($ThtmlData); |
|
2294 | 2294 | |
2295 | 2295 | } |
2296 | 2296 | |
2297 | 2297 | |
2298 | 2298 | function implodeHtmlData($ThtmlData = array()) |
2299 | 2299 | { |
2300 | - $data = ''; |
|
2301 | - foreach($ThtmlData as $k => $h ) |
|
2302 | - { |
|
2303 | - if(is_array($h)) |
|
2304 | - { |
|
2305 | - $h = json_encode($h); |
|
2306 | - } |
|
2300 | + $data = ''; |
|
2301 | + foreach($ThtmlData as $k => $h ) |
|
2302 | + { |
|
2303 | + if(is_array($h)) |
|
2304 | + { |
|
2305 | + $h = json_encode($h); |
|
2306 | + } |
|
2307 | 2307 | |
2308 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2309 | - } |
|
2308 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2309 | + } |
|
2310 | 2310 | |
2311 | - return $data; |
|
2311 | + return $data; |
|
2312 | 2312 | } |
2313 | 2313 | |
2314 | 2314 | function _ajax_block_order_js($object) |
2315 | 2315 | { |
2316 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2316 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2317 | 2317 | |
2318 | - /* |
|
2318 | + /* |
|
2319 | 2319 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2320 | 2320 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2321 | 2321 | */ |
2322 | 2322 | |
2323 | - $id=$object->id; |
|
2324 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2325 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2323 | + $id=$object->id; |
|
2324 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2325 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2326 | 2326 | |
2327 | - $id=$object->id; |
|
2328 | - $fk_element=$object->fk_element; |
|
2329 | - $table_element_line=$object->table_element_line; |
|
2330 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2331 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2332 | - $filepath=(empty($filepath)?'':$filepath); |
|
2327 | + $id=$object->id; |
|
2328 | + $fk_element=$object->fk_element; |
|
2329 | + $table_element_line=$object->table_element_line; |
|
2330 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2331 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2332 | + $filepath=(empty($filepath)?'':$filepath); |
|
2333 | 2333 | |
2334 | 2334 | |
2335 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2336 | - { |
|
2335 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2336 | + { |
|
2337 | 2337 | |
2338 | - ?> |
|
2338 | + ?> |
|
2339 | 2339 | |
2340 | 2340 | |
2341 | 2341 | <script type="text/javascript"> |