@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | $value = ''; |
| 26 | 26 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
| 27 | 27 | $resql = $this->db->query($sql); |
| 28 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
| 28 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
| 29 | + $value = $obj->content; |
|
| 30 | + } |
|
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | ?> |
@@ -109,8 +111,11 @@ discard block |
||
| 109 | 111 | if ($object->statut == 0 && $createRight) { |
| 110 | 112 | |
| 111 | 113 | |
| 112 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 113 | - else $idvar='id'; |
|
| 114 | + if($object->element=='facture') { |
|
| 115 | + $idvar = 'facid'; |
|
| 116 | + } else { |
|
| 117 | + $idvar='id'; |
|
| 118 | + } |
|
| 114 | 119 | |
| 115 | 120 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
| 116 | 121 | { |
@@ -118,10 +123,11 @@ discard block |
||
| 118 | 123 | |
| 119 | 124 | if($action=='add_title_line') { |
| 120 | 125 | $title = GETPOST('title'); |
| 121 | - if(empty($title)) $title = $langs->trans('title'); |
|
| 126 | + if(empty($title)) { |
|
| 127 | + $title = $langs->trans('title'); |
|
| 128 | + } |
|
| 122 | 129 | $qty = $level<1 ? 1 : $level ; |
| 123 | - } |
|
| 124 | - else if($action=='add_free_text') { |
|
| 130 | + } else if($action=='add_free_text') { |
|
| 125 | 131 | $title = GETPOST('title'); |
| 126 | 132 | |
| 127 | 133 | if (empty($title)) { |
@@ -133,29 +139,31 @@ discard block |
||
| 133 | 139 | } |
| 134 | 140 | } |
| 135 | 141 | } |
| 136 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
| 142 | + if(empty($title)) { |
|
| 143 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
| 144 | + } |
|
| 137 | 145 | $qty = 50; |
| 138 | - } |
|
| 139 | - else if($action=='add_subtitle_line') { |
|
| 146 | + } else if($action=='add_subtitle_line') { |
|
| 140 | 147 | $title = GETPOST('title'); |
| 141 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
| 148 | + if(empty($title)) { |
|
| 149 | + $title = $langs->trans('subtitle'); |
|
| 150 | + } |
|
| 142 | 151 | $qty = 2; |
| 143 | - } |
|
| 144 | - else if($action=='add_subtotal_line') { |
|
| 152 | + } else if($action=='add_subtotal_line') { |
|
| 145 | 153 | $title = $langs->trans('SubSubTotal'); |
| 146 | 154 | $qty = 98; |
| 147 | - } |
|
| 148 | - else { |
|
| 155 | + } else { |
|
| 149 | 156 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
| 150 | 157 | $qty = $level ? 100-$level : 99; |
| 151 | 158 | } |
| 152 | 159 | dol_include_once('/subtotal/class/subtotal.class.php'); |
| 153 | 160 | |
| 154 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
| 161 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
| 162 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
| 163 | + } |
|
| 155 | 164 | |
| 156 | 165 | TSubtotal::addSubTotalLine($object, $title, $qty); |
| 157 | - } |
|
| 158 | - else if($action==='ask_deleteallline') { |
|
| 166 | + } else if($action==='ask_deleteallline') { |
|
| 159 | 167 | $form=new Form($db); |
| 160 | 168 | |
| 161 | 169 | $lineid = GETPOST('lineid','integer'); |
@@ -178,8 +186,7 @@ discard block |
||
| 178 | 186 | $this->printNewFormat($object, $conf, $langs, $idvar); |
| 179 | 187 | } |
| 180 | 188 | } |
| 181 | - } |
|
| 182 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 189 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
| 183 | 190 | { |
| 184 | 191 | ?> |
| 185 | 192 | <script type="text/javascript"> |
@@ -197,8 +204,13 @@ discard block |
||
| 197 | 204 | |
| 198 | 205 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
| 199 | 206 | { |
| 200 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
| 201 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
| 207 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
| 208 | + return false; |
|
| 209 | + } |
|
| 210 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 213 | + // Si facture de situation |
|
| 202 | 214 | ?> |
| 203 | 215 | <script type="text/javascript"> |
| 204 | 216 | $(document).ready(function() { |
@@ -484,8 +496,7 @@ discard block |
||
| 484 | 496 | } |
| 485 | 497 | |
| 486 | 498 | |
| 487 | - } |
|
| 488 | - else{ |
|
| 499 | + } else{ |
|
| 489 | 500 | $substitutionarray['line_not_modsubtotal'] = true; |
| 490 | 501 | $substitutionarray['line_modsubtotal'] = 0; |
| 491 | 502 | } |
@@ -543,8 +554,11 @@ discard block |
||
| 543 | 554 | |
| 544 | 555 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
| 545 | 556 | |
| 546 | - if($object->element=='facture') $idvar = 'facid'; |
|
| 547 | - else $idvar = 'id'; |
|
| 557 | + if($object->element=='facture') { |
|
| 558 | + $idvar = 'facid'; |
|
| 559 | + } else { |
|
| 560 | + $idvar = 'id'; |
|
| 561 | + } |
|
| 548 | 562 | |
| 549 | 563 | if ($action == 'updateligne' || $action == 'updateline') |
| 550 | 564 | { |
@@ -574,8 +588,7 @@ discard block |
||
| 574 | 588 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
| 575 | 589 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
| 576 | 590 | } |
| 577 | - } |
|
| 578 | - else if($action === 'builddoc') { |
|
| 591 | + } else if($action === 'builddoc') { |
|
| 579 | 592 | |
| 580 | 593 | if ( |
| 581 | 594 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -590,33 +603,27 @@ discard block |
||
| 590 | 603 | $sessname = 'subtotal_hideInnerLines_facture'; |
| 591 | 604 | $sessname2 = 'subtotal_hidedetails_facture'; |
| 592 | 605 | $sessname3 = 'subtotal_hideprices_facture'; |
| 593 | - } |
|
| 594 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 606 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
| 595 | 607 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
| 596 | 608 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
| 597 | 609 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
| 598 | - } |
|
| 599 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 610 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
| 600 | 611 | $sessname = 'subtotal_hideInnerLines_propal'; |
| 601 | 612 | $sessname2 = 'subtotal_hidedetails_propal'; |
| 602 | 613 | $sessname3 = 'subtotal_hideprices_propal'; |
| 603 | - } |
|
| 604 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 614 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
| 605 | 615 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
| 606 | 616 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
| 607 | 617 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
| 608 | - } |
|
| 609 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 618 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
| 610 | 619 | $sessname = 'subtotal_hideInnerLines_commande'; |
| 611 | 620 | $sessname2 = 'subtotal_hidedetails_commande'; |
| 612 | 621 | $sessname3 = 'subtotal_hideprices_commande'; |
| 613 | - } |
|
| 614 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 622 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
| 615 | 623 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
| 616 | 624 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
| 617 | 625 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
| 618 | - } |
|
| 619 | - else { |
|
| 626 | + } else { |
|
| 620 | 627 | $sessname = 'subtotal_hideInnerLines_unknown'; |
| 621 | 628 | $sessname2 = 'subtotal_hidedetails_unknown'; |
| 622 | 629 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -638,8 +645,7 @@ discard block |
||
| 638 | 645 | |
| 639 | 646 | if($line->qty>=90) { |
| 640 | 647 | $line->modsubtotal_total = 1; |
| 641 | - } |
|
| 642 | - else{ |
|
| 648 | + } else{ |
|
| 643 | 649 | $line->modsubtotal_title = 1; |
| 644 | 650 | } |
| 645 | 651 | |
@@ -648,8 +654,7 @@ discard block |
||
| 648 | 654 | } |
| 649 | 655 | } |
| 650 | 656 | |
| 651 | - } |
|
| 652 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 657 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
| 653 | 658 | |
| 654 | 659 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
| 655 | 660 | |
@@ -657,7 +662,9 @@ discard block |
||
| 657 | 662 | /** |
| 658 | 663 | * @var $object Facture |
| 659 | 664 | */ |
| 660 | - if($object->element=='facture') $object->deleteline($idLine); |
|
| 665 | + if($object->element=='facture') { |
|
| 666 | + $object->deleteline($idLine); |
|
| 667 | + } |
|
| 661 | 668 | /** |
| 662 | 669 | * @var $object Facture fournisseur |
| 663 | 670 | */ |
@@ -668,18 +675,25 @@ discard block |
||
| 668 | 675 | /** |
| 669 | 676 | * @var $object Propal |
| 670 | 677 | */ |
| 671 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
| 678 | + else if($object->element=='propal') { |
|
| 679 | + $object->deleteline($idLine); |
|
| 680 | + } |
|
| 672 | 681 | /** |
| 673 | 682 | * @var $object Propal Fournisseur |
| 674 | 683 | */ |
| 675 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
| 684 | + else if($object->element=='supplier_proposal') { |
|
| 685 | + $object->deleteline($idLine); |
|
| 686 | + } |
|
| 676 | 687 | /** |
| 677 | 688 | * @var $object Commande |
| 678 | 689 | */ |
| 679 | 690 | else if($object->element=='commande') |
| 680 | 691 | { |
| 681 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
| 682 | - else $object->deleteline($idLine); |
|
| 692 | + if ((float) DOL_VERSION >= 5.0) { |
|
| 693 | + $object->deleteline($user, $idLine); |
|
| 694 | + } else { |
|
| 695 | + $object->deleteline($idLine); |
|
| 696 | + } |
|
| 683 | 697 | } |
| 684 | 698 | /** |
| 685 | 699 | * @var $object Commande fournisseur |
@@ -691,21 +705,26 @@ discard block |
||
| 691 | 705 | /** |
| 692 | 706 | * @var $object Facturerec |
| 693 | 707 | */ |
| 694 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
| 708 | + else if($object->element=='facturerec') { |
|
| 709 | + $object->deleteline($idLine); |
|
| 710 | + } |
|
| 695 | 711 | } |
| 696 | 712 | |
| 697 | 713 | header('location:?id='.$object->id); |
| 698 | 714 | exit; |
| 699 | 715 | |
| 700 | - } |
|
| 701 | - else if ($action == 'duplicate') |
|
| 716 | + } else if ($action == 'duplicate') |
|
| 702 | 717 | { |
| 703 | 718 | $lineid = GETPOST('lineid', 'int'); |
| 704 | 719 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
| 705 | 720 | |
| 706 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 707 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 708 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 721 | + if ($nbDuplicate > 0) { |
|
| 722 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
| 723 | + } elseif ($nbDuplicate == 0) { |
|
| 724 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
| 725 | + } else { |
|
| 726 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
| 727 | + } |
|
| 709 | 728 | |
| 710 | 729 | header('Location: ?id='.$object->id); |
| 711 | 730 | exit; |
@@ -785,17 +804,18 @@ discard block |
||
| 785 | 804 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
| 786 | 805 | if($l->rang>=$rang) { |
| 787 | 806 | //echo 'return!<br>'; |
| 788 | - if (!$return_all) return $total; |
|
| 789 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 790 | - } |
|
| 791 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 807 | + if (!$return_all) { |
|
| 808 | + return $total; |
|
| 809 | + } else { |
|
| 810 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 811 | + } |
|
| 812 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
| 792 | 813 | { |
| 793 | 814 | $total = 0; |
| 794 | 815 | $total_tva = 0; |
| 795 | 816 | $total_ttc = 0; |
| 796 | 817 | $TTotal_tva = array(); |
| 797 | - } |
|
| 798 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 818 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
| 799 | 819 | $total += $l->total_ht; |
| 800 | 820 | $total_tva += $l->total_tva; |
| 801 | 821 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -803,8 +823,11 @@ discard block |
||
| 803 | 823 | } |
| 804 | 824 | |
| 805 | 825 | } |
| 806 | - if (!$return_all) return $total; |
|
| 807 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 826 | + if (!$return_all) { |
|
| 827 | + return $total; |
|
| 828 | + } else { |
|
| 829 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
| 830 | + } |
|
| 808 | 831 | } |
| 809 | 832 | |
| 810 | 833 | /* |
@@ -872,15 +895,18 @@ discard block |
||
| 872 | 895 | } |
| 873 | 896 | |
| 874 | 897 | |
| 875 | - if($line->qty==99) |
|
| 876 | - $pdf->SetFillColor(220,220,220); |
|
| 877 | - elseif ($line->qty==98) |
|
| 878 | - $pdf->SetFillColor(230,230,230); |
|
| 879 | - else |
|
| 880 | - $pdf->SetFillColor(240,240,240); |
|
| 898 | + if($line->qty==99) { |
|
| 899 | + $pdf->SetFillColor(220,220,220); |
|
| 900 | + } elseif ($line->qty==98) { |
|
| 901 | + $pdf->SetFillColor(230,230,230); |
|
| 902 | + } else { |
|
| 903 | + $pdf->SetFillColor(240,240,240); |
|
| 904 | + } |
|
| 881 | 905 | |
| 882 | 906 | $style = 'B'; |
| 883 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 907 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
| 908 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
| 909 | + } |
|
| 884 | 910 | |
| 885 | 911 | $pdf->SetFont('', $style, 9); |
| 886 | 912 | |
@@ -919,8 +945,7 @@ discard block |
||
| 919 | 945 | // $line->total_tva |
| 920 | 946 | // $line->total |
| 921 | 947 | // $line->total_ttc |
| 922 | - } |
|
| 923 | - else |
|
| 948 | + } else |
|
| 924 | 949 | { |
| 925 | 950 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 926 | 951 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -937,11 +962,14 @@ discard block |
||
| 937 | 962 | } |
| 938 | 963 | |
| 939 | 964 | $pdf->SetXY($pdf->postotalht, $posy); |
| 940 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 965 | + if($set_pagebreak_margin) { |
|
| 966 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 967 | + } |
|
| 941 | 968 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
| 942 | - } |
|
| 943 | - else{ |
|
| 944 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 969 | + } else{ |
|
| 970 | + if($set_pagebreak_margin) { |
|
| 971 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
| 972 | + } |
|
| 945 | 973 | } |
| 946 | 974 | |
| 947 | 975 | $posy = $posy + $cell_height; |
@@ -973,25 +1001,40 @@ discard block |
||
| 973 | 1001 | |
| 974 | 1002 | |
| 975 | 1003 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
| 976 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1004 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
| 1005 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
| 1006 | + } |
|
| 977 | 1007 | |
| 978 | 1008 | if($hideInnerLines) { |
| 979 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
| 980 | - else |
|
| 1009 | + if($line->qty==1) { |
|
| 1010 | + $pdf->SetFont('', $style, 9); |
|
| 1011 | + } else |
|
| 981 | 1012 | { |
| 982 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1013 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
| 1014 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
| 1015 | + } |
|
| 983 | 1016 | $pdf->SetFont('', $style, 9); |
| 984 | 1017 | } |
| 985 | - } |
|
| 986 | - else { |
|
| 1018 | + } else { |
|
| 987 | 1019 | |
| 988 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
| 989 | - else $pdf->SetFont('', $style, 9); |
|
| 1020 | + if($line->qty==1) { |
|
| 1021 | + $pdf->SetFont('', $style, 9); |
|
| 1022 | + } |
|
| 1023 | + //TODO if super utile |
|
| 1024 | + else { |
|
| 1025 | + $pdf->SetFont('', $style, 9); |
|
| 1026 | + } |
|
| 990 | 1027 | |
| 991 | 1028 | } |
| 992 | 1029 | |
| 993 | - 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 |
|
| 994 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
| 1030 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
| 1031 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
| 1032 | + } |
|
| 1033 | + // Pas de HTML dans la chaine |
|
| 1034 | + else { |
|
| 1035 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
| 1036 | + } |
|
| 1037 | + // et maintenant avec du HTML |
|
| 995 | 1038 | |
| 996 | 1039 | if($description && !$hidedesc) { |
| 997 | 1040 | $posy = $pdf->GetY(); |
@@ -1015,8 +1058,7 @@ discard block |
||
| 1015 | 1058 | |
| 1016 | 1059 | if(is_array($parameters)) { |
| 1017 | 1060 | $i = & $parameters['i']; |
| 1018 | - } |
|
| 1019 | - else { |
|
| 1061 | + } else { |
|
| 1020 | 1062 | $i = (int)$parameters; |
| 1021 | 1063 | } |
| 1022 | 1064 | |
@@ -1038,17 +1080,14 @@ discard block |
||
| 1038 | 1080 | |
| 1039 | 1081 | if((float)DOL_VERSION<=3.6) { |
| 1040 | 1082 | return ''; |
| 1041 | - } |
|
| 1042 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1083 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1043 | 1084 | return 1; |
| 1044 | 1085 | } |
| 1045 | 1086 | |
| 1046 | - } |
|
| 1047 | - elseif(!empty($hideprices)) { |
|
| 1087 | + } elseif(!empty($hideprices)) { |
|
| 1048 | 1088 | $this->resprints = $object->lines[$parameters['i']]->qty; |
| 1049 | 1089 | return 1; |
| 1050 | - } |
|
| 1051 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1090 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
| 1052 | 1091 | { |
| 1053 | 1092 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
| 1054 | 1093 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1058,12 +1097,20 @@ discard block |
||
| 1058 | 1097 | } |
| 1059 | 1098 | } |
| 1060 | 1099 | |
| 1061 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1062 | - else $i = (int)$parameters; |
|
| 1100 | + if(is_array($parameters)) { |
|
| 1101 | + $i = & $parameters['i']; |
|
| 1102 | + } else { |
|
| 1103 | + $i = (int)$parameters; |
|
| 1104 | + } |
|
| 1063 | 1105 | |
| 1064 | - 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) |
|
| 1106 | + if (empty($object->lines[$i])) { |
|
| 1107 | + return 0; |
|
| 1108 | + } |
|
| 1109 | + // 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) |
|
| 1065 | 1110 | |
| 1066 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
| 1111 | + if(empty($object->lines[$i]->array_options)) { |
|
| 1112 | + $object->lines[$i]->fetch_optionals(); |
|
| 1113 | + } |
|
| 1067 | 1114 | |
| 1068 | 1115 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1069 | 1116 | { |
@@ -1080,8 +1127,11 @@ discard block |
||
| 1080 | 1127 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
| 1081 | 1128 | global $conf, $hideprices, $hookmanager; |
| 1082 | 1129 | |
| 1083 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1084 | - else $i = (int)$parameters; |
|
| 1130 | + if(is_array($parameters)) { |
|
| 1131 | + $i = & $parameters['i']; |
|
| 1132 | + } else { |
|
| 1133 | + $i = (int)$parameters; |
|
| 1134 | + } |
|
| 1085 | 1135 | |
| 1086 | 1136 | if($this->isModSubtotalLine($parameters,$object) ){ |
| 1087 | 1137 | |
@@ -1089,13 +1139,11 @@ discard block |
||
| 1089 | 1139 | |
| 1090 | 1140 | if((float)DOL_VERSION<=3.6) { |
| 1091 | 1141 | return ''; |
| 1092 | - } |
|
| 1093 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1142 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1094 | 1143 | return 1; |
| 1095 | 1144 | } |
| 1096 | 1145 | |
| 1097 | - } |
|
| 1098 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1146 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
| 1099 | 1147 | { |
| 1100 | 1148 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
| 1101 | 1149 | { |
@@ -1167,12 +1215,10 @@ discard block |
||
| 1167 | 1215 | $this->error = $hookmanager->error; |
| 1168 | 1216 | $this->errors = $hookmanager->errors; |
| 1169 | 1217 | return -1; |
| 1170 | - } |
|
| 1171 | - elseif (empty($reshook)) |
|
| 1218 | + } elseif (empty($reshook)) |
|
| 1172 | 1219 | { |
| 1173 | 1220 | $this->resprints .= $hookmanager->resprints; |
| 1174 | - } |
|
| 1175 | - else |
|
| 1221 | + } else |
|
| 1176 | 1222 | { |
| 1177 | 1223 | $this->resprints = $hookmanager->resprints; |
| 1178 | 1224 | |
@@ -1195,14 +1241,16 @@ discard block |
||
| 1195 | 1241 | |
| 1196 | 1242 | if((float)DOL_VERSION<=3.6) { |
| 1197 | 1243 | return ''; |
| 1198 | - } |
|
| 1199 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1244 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1200 | 1245 | return 1; |
| 1201 | 1246 | } |
| 1202 | 1247 | } |
| 1203 | 1248 | |
| 1204 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1205 | - else $i = (int)$parameters; |
|
| 1249 | + if(is_array($parameters)) { |
|
| 1250 | + $i = & $parameters['i']; |
|
| 1251 | + } else { |
|
| 1252 | + $i = (int)$parameters; |
|
| 1253 | + } |
|
| 1206 | 1254 | |
| 1207 | 1255 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1208 | 1256 | { |
@@ -1224,14 +1272,16 @@ discard block |
||
| 1224 | 1272 | |
| 1225 | 1273 | if((float)DOL_VERSION<=3.6) { |
| 1226 | 1274 | return ''; |
| 1227 | - } |
|
| 1228 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1275 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1229 | 1276 | return 1; |
| 1230 | 1277 | } |
| 1231 | 1278 | } |
| 1232 | 1279 | |
| 1233 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1234 | - else $i = (int)$parameters; |
|
| 1280 | + if(is_array($parameters)) { |
|
| 1281 | + $i = & $parameters['i']; |
|
| 1282 | + } else { |
|
| 1283 | + $i = (int)$parameters; |
|
| 1284 | + } |
|
| 1235 | 1285 | |
| 1236 | 1286 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1237 | 1287 | { |
@@ -1253,13 +1303,15 @@ discard block |
||
| 1253 | 1303 | |
| 1254 | 1304 | if((float)DOL_VERSION<=3.6) { |
| 1255 | 1305 | return ''; |
| 1256 | - } |
|
| 1257 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1306 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1258 | 1307 | return 1; |
| 1259 | 1308 | } |
| 1260 | 1309 | } |
| 1261 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1262 | - else $i = (int)$parameters; |
|
| 1310 | + if(is_array($parameters)) { |
|
| 1311 | + $i = & $parameters['i']; |
|
| 1312 | + } else { |
|
| 1313 | + $i = (int)$parameters; |
|
| 1314 | + } |
|
| 1263 | 1315 | |
| 1264 | 1316 | |
| 1265 | 1317 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1306,14 +1358,16 @@ discard block |
||
| 1306 | 1358 | $this->resprints = ' '; |
| 1307 | 1359 | if((float)DOL_VERSION<=3.6) { |
| 1308 | 1360 | return ''; |
| 1309 | - } |
|
| 1310 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1361 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1311 | 1362 | return 1; |
| 1312 | 1363 | } |
| 1313 | 1364 | } |
| 1314 | 1365 | |
| 1315 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1316 | - else $i = (int)$parameters; |
|
| 1366 | + if(is_array($parameters)) { |
|
| 1367 | + $i = & $parameters['i']; |
|
| 1368 | + } else { |
|
| 1369 | + $i = (int)$parameters; |
|
| 1370 | + } |
|
| 1317 | 1371 | |
| 1318 | 1372 | if (!empty($hideprices) |
| 1319 | 1373 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1337,16 +1391,21 @@ discard block |
||
| 1337 | 1391 | |
| 1338 | 1392 | if((float)DOL_VERSION<=3.6) { |
| 1339 | 1393 | return ''; |
| 1340 | - } |
|
| 1341 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1394 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1342 | 1395 | return 1; |
| 1343 | 1396 | } |
| 1344 | 1397 | } |
| 1345 | 1398 | |
| 1346 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1347 | - else $i = (int)$parameters; |
|
| 1399 | + if(is_array($parameters)) { |
|
| 1400 | + $i = & $parameters['i']; |
|
| 1401 | + } else { |
|
| 1402 | + $i = (int)$parameters; |
|
| 1403 | + } |
|
| 1348 | 1404 | |
| 1349 | - 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) |
|
| 1405 | + if (empty($object->lines[$i])) { |
|
| 1406 | + return 0; |
|
| 1407 | + } |
|
| 1408 | + // 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) |
|
| 1350 | 1409 | |
| 1351 | 1410 | $object->lines[$i]->fetch_optionals(); |
| 1352 | 1411 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1392,14 +1451,16 @@ discard block |
||
| 1392 | 1451 | $this->resprints = ' '; |
| 1393 | 1452 | if((float)DOL_VERSION<=3.6) { |
| 1394 | 1453 | return ''; |
| 1395 | - } |
|
| 1396 | - else if((float)DOL_VERSION>=3.8) { |
|
| 1454 | + } else if((float)DOL_VERSION>=3.8) { |
|
| 1397 | 1455 | return 1; |
| 1398 | 1456 | } |
| 1399 | 1457 | } |
| 1400 | 1458 | |
| 1401 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
| 1402 | - else $i = (int)$parameters; |
|
| 1459 | + if(is_array($parameters)) { |
|
| 1460 | + $i = & $parameters['i']; |
|
| 1461 | + } else { |
|
| 1462 | + $i = (int)$parameters; |
|
| 1463 | + } |
|
| 1403 | 1464 | |
| 1404 | 1465 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
| 1405 | 1466 | { |
@@ -1429,7 +1490,9 @@ discard block |
||
| 1429 | 1490 | } |
| 1430 | 1491 | } |
| 1431 | 1492 | |
| 1432 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1493 | + if (!empty($TLineTitle)) { |
|
| 1494 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
| 1495 | + } |
|
| 1433 | 1496 | } |
| 1434 | 1497 | |
| 1435 | 1498 | } |
@@ -1443,8 +1506,12 @@ discard block |
||
| 1443 | 1506 | $j=0; |
| 1444 | 1507 | foreach ($TLineTitle as $k => &$line) |
| 1445 | 1508 | { |
| 1446 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
| 1447 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
| 1509 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
| 1510 | + continue; |
|
| 1511 | + } |
|
| 1512 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
| 1513 | + break; |
|
| 1514 | + } |
|
| 1448 | 1515 | |
| 1449 | 1516 | if ($line->qty == $level) |
| 1450 | 1517 | { |
@@ -1478,7 +1545,9 @@ discard block |
||
| 1478 | 1545 | |
| 1479 | 1546 | $hidedetails = (int)GETPOST('hidedetails'); |
| 1480 | 1547 | |
| 1481 | - if(empty($hidedetails)) return false; |
|
| 1548 | + if(empty($hidedetails)) { |
|
| 1549 | + return false; |
|
| 1550 | + } |
|
| 1482 | 1551 | |
| 1483 | 1552 | // TODO can't add VAT to document without lines... :-/ |
| 1484 | 1553 | |
@@ -1531,7 +1600,9 @@ discard block |
||
| 1531 | 1600 | */ |
| 1532 | 1601 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
| 1533 | 1602 | |
| 1534 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
| 1603 | + if (TSubtotal::getNiveau($line) == 1) { |
|
| 1604 | + $line->TTotal_tva = $TTotal_tva; |
|
| 1605 | + } |
|
| 1535 | 1606 | $line->total_ht = $total; |
| 1536 | 1607 | $line->total_tva = $total_tva; |
| 1537 | 1608 | $line->total = $line->total_ht; |
@@ -1586,8 +1657,7 @@ discard block |
||
| 1586 | 1657 | } |
| 1587 | 1658 | |
| 1588 | 1659 | |
| 1589 | - } |
|
| 1590 | - elseif ($hidedetails) |
|
| 1660 | + } elseif ($hidedetails) |
|
| 1591 | 1661 | { |
| 1592 | 1662 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
| 1593 | 1663 | } |
@@ -1658,7 +1728,9 @@ discard block |
||
| 1658 | 1728 | |
| 1659 | 1729 | if(!empty($hideprices)) { |
| 1660 | 1730 | foreach($object->lines as &$line) { |
| 1661 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
| 1731 | + if($line->fk_product_type!=9) { |
|
| 1732 | + $line->fk_parent_line = -1; |
|
| 1733 | + } |
|
| 1662 | 1734 | } |
| 1663 | 1735 | } |
| 1664 | 1736 | |
@@ -1679,7 +1751,9 @@ discard block |
||
| 1679 | 1751 | |
| 1680 | 1752 | if($line->qty>90) { |
| 1681 | 1753 | |
| 1682 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
| 1754 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 1755 | + $label .= ' '.$this->getTitle($object, $line); |
|
| 1756 | + } |
|
| 1683 | 1757 | |
| 1684 | 1758 | $pageBefore = $pdf->getPage(); |
| 1685 | 1759 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1697,8 +1771,7 @@ discard block |
||
| 1697 | 1771 | |
| 1698 | 1772 | $posy = $pdf->GetY(); |
| 1699 | 1773 | return 1; |
| 1700 | - } |
|
| 1701 | - else if ($line->qty < 10) { |
|
| 1774 | + } else if ($line->qty < 10) { |
|
| 1702 | 1775 | $pageBefore = $pdf->getPage(); |
| 1703 | 1776 | |
| 1704 | 1777 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1722,8 +1795,7 @@ discard block |
||
| 1722 | 1795 | // if($line->rowid==47) exit; |
| 1723 | 1796 | |
| 1724 | 1797 | return 0; |
| 1725 | - } |
|
| 1726 | - elseif (empty($object->lines[$parameters['i']])) |
|
| 1798 | + } elseif (empty($object->lines[$parameters['i']])) |
|
| 1727 | 1799 | { |
| 1728 | 1800 | $this->resprints = -1; |
| 1729 | 1801 | } |
@@ -1756,7 +1828,9 @@ discard block |
||
| 1756 | 1828 | |
| 1757 | 1829 | foreach ($object->lines as $line) |
| 1758 | 1830 | { |
| 1759 | - if ($line->id == $currentLine->id) break; |
|
| 1831 | + if ($line->id == $currentLine->id) { |
|
| 1832 | + break; |
|
| 1833 | + } |
|
| 1760 | 1834 | |
| 1761 | 1835 | $qty_search = 100 - $currentLine->qty; |
| 1762 | 1836 | |
@@ -1793,23 +1867,23 @@ discard block |
||
| 1793 | 1867 | { |
| 1794 | 1868 | $object->statut = 0; // hack for facture rec |
| 1795 | 1869 | $createRight = $user->rights->facture->creer; |
| 1796 | - } |
|
| 1797 | - elseif($object->element == 'order_supplier' ) |
|
| 1870 | + } elseif($object->element == 'order_supplier' ) |
|
| 1798 | 1871 | { |
| 1799 | 1872 | $createRight = $user->rights->fournisseur->commande->creer; |
| 1800 | - } |
|
| 1801 | - elseif($object->element == 'invoice_supplier' ) |
|
| 1873 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 1802 | 1874 | { |
| 1803 | 1875 | $createRight = $user->rights->fournisseur->facture->creer; |
| 1804 | 1876 | } |
| 1805 | 1877 | |
| 1806 | 1878 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
| 1807 | 1879 | null; |
| 1808 | - } |
|
| 1809 | - 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)) |
|
| 1880 | + } 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)) |
|
| 1810 | 1881 | { |
| 1811 | - if($object->element=='facture')$idvar = 'facid'; |
|
| 1812 | - else $idvar='id'; |
|
| 1882 | + if($object->element=='facture') { |
|
| 1883 | + $idvar = 'facid'; |
|
| 1884 | + } else { |
|
| 1885 | + $idvar='id'; |
|
| 1886 | + } |
|
| 1813 | 1887 | |
| 1814 | 1888 | if((float)DOL_VERSION <= 3.4) |
| 1815 | 1889 | { |
@@ -1835,20 +1909,44 @@ discard block |
||
| 1835 | 1909 | <?php |
| 1836 | 1910 | } |
| 1837 | 1911 | |
| 1838 | - if(empty($line->description)) $line->description = $line->desc; |
|
| 1912 | + if(empty($line->description)) { |
|
| 1913 | + $line->description = $line->desc; |
|
| 1914 | + } |
|
| 1839 | 1915 | |
| 1840 | 1916 | $colspan = 5; |
| 1841 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
| 1842 | - if($object->element == 'order_supplier') $colspan = 3; |
|
| 1843 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
| 1844 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
| 1845 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
| 1846 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
| 1847 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
| 1848 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
| 1849 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
| 1850 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
| 1851 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
| 1917 | + if($object->element == 'facturerec' ) { |
|
| 1918 | + $colspan = 3; |
|
| 1919 | + } |
|
| 1920 | + if($object->element == 'order_supplier') { |
|
| 1921 | + $colspan = 3; |
|
| 1922 | + } |
|
| 1923 | + if($object->element == 'invoice_supplier') { |
|
| 1924 | + $colspan = 4; |
|
| 1925 | + } |
|
| 1926 | + if($object->element == 'supplier_proposal') { |
|
| 1927 | + $colspan = 4; |
|
| 1928 | + } |
|
| 1929 | + if(!empty($conf->multicurrency->enabled)) { |
|
| 1930 | + $colspan+=2; |
|
| 1931 | + } |
|
| 1932 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
| 1933 | + $colspan++; |
|
| 1934 | + } |
|
| 1935 | + if(!empty($conf->margin->enabled)) { |
|
| 1936 | + $colspan++; |
|
| 1937 | + } |
|
| 1938 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
| 1939 | + $colspan++; |
|
| 1940 | + } |
|
| 1941 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
| 1942 | + $colspan++; |
|
| 1943 | + } |
|
| 1944 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
| 1945 | + $colspan++; |
|
| 1946 | + } |
|
| 1947 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
| 1948 | + $colspan++; |
|
| 1949 | + } |
|
| 1852 | 1950 | |
| 1853 | 1951 | /* Titre */ |
| 1854 | 1952 | //var_dump($line); |
@@ -1861,23 +1959,36 @@ discard block |
||
| 1861 | 1959 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
| 1862 | 1960 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
| 1863 | 1961 | { |
| 1864 | - if($line->qty==99) print 'background:#adadcf'; |
|
| 1865 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1866 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
| 1867 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
| 1868 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
| 1869 | - else if($line->qty==50) print ''; |
|
| 1870 | - else print 'background:#eeeeff;'; |
|
| 1962 | + if($line->qty==99) { |
|
| 1963 | + print 'background:#adadcf'; |
|
| 1964 | + } else if($line->qty==98) { |
|
| 1965 | + print 'background:#ddddff;'; |
|
| 1966 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
| 1967 | + print 'background:#eeeeff;'; |
|
| 1968 | + } else if($line->qty==1) { |
|
| 1969 | + print 'background:#adadcf;'; |
|
| 1970 | + } else if($line->qty==2) { |
|
| 1971 | + print 'background:#ddddff;'; |
|
| 1972 | + } else if($line->qty==50) { |
|
| 1973 | + print ''; |
|
| 1974 | + } else { |
|
| 1975 | + print 'background:#eeeeff;'; |
|
| 1976 | + } |
|
| 1871 | 1977 | |
| 1872 | 1978 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
| 1873 | - } |
|
| 1874 | - else |
|
| 1979 | + } else |
|
| 1875 | 1980 | { |
| 1876 | - if($line->qty==99) print 'background:#ddffdd'; |
|
| 1877 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
| 1878 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
| 1879 | - else if($line->qty==50) print ''; |
|
| 1880 | - else print 'background:#eeffee;' ; |
|
| 1981 | + if($line->qty==99) { |
|
| 1982 | + print 'background:#ddffdd'; |
|
| 1983 | + } else if($line->qty==98) { |
|
| 1984 | + print 'background:#ddddff;'; |
|
| 1985 | + } else if($line->qty==2) { |
|
| 1986 | + print 'background:#eeeeff; '; |
|
| 1987 | + } else if($line->qty==50) { |
|
| 1988 | + print ''; |
|
| 1989 | + } else { |
|
| 1990 | + print 'background:#eeffee;' ; |
|
| 1991 | + } |
|
| 1881 | 1992 | } |
| 1882 | 1993 | |
| 1883 | 1994 | ?>;"> |
@@ -1900,13 +2011,11 @@ discard block |
||
| 1900 | 2011 | $qty_displayed = $line->qty; |
| 1901 | 2012 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1902 | 2013 | |
| 1903 | - } |
|
| 1904 | - else if (TSubtotal::isSubtotal($line)) |
|
| 2014 | + } else if (TSubtotal::isSubtotal($line)) |
|
| 1905 | 2015 | { |
| 1906 | 2016 | $qty_displayed = 100 - $line->qty; |
| 1907 | 2017 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
| 1908 | - } |
|
| 1909 | - else |
|
| 2018 | + } else |
|
| 1910 | 2019 | { |
| 1911 | 2020 | $isFreeText = true; |
| 1912 | 2021 | } |
@@ -1927,9 +2036,13 @@ discard block |
||
| 1927 | 2036 | } |
| 1928 | 2037 | |
| 1929 | 2038 | $readonlyForSituation = ''; |
| 1930 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
| 2039 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
| 2040 | + $readonlyForSituation = 'readonly'; |
|
| 2041 | + } |
|
| 1931 | 2042 | |
| 1932 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2043 | + if (!$isFreeText) { |
|
| 2044 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
| 2045 | + } |
|
| 1933 | 2046 | |
| 1934 | 2047 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
| 1935 | 2048 | { |
@@ -1937,8 +2050,12 @@ discard block |
||
| 1937 | 2050 | for ($j=1; $j<10; $j++) |
| 1938 | 2051 | { |
| 1939 | 2052 | if (!empty($readonlyForSituation)) { |
| 1940 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 1941 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2053 | + if ($qty_displayed == $j) { |
|
| 2054 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2055 | + } |
|
| 2056 | + } else { |
|
| 2057 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
| 2058 | + } |
|
| 1942 | 2059 | } |
| 1943 | 2060 | $select .= '</select> '; |
| 1944 | 2061 | |
@@ -1954,15 +2071,18 @@ discard block |
||
| 1954 | 2071 | $form = new Form($db); |
| 1955 | 2072 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
| 1956 | 2073 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
| 1957 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2074 | + if (empty($readonlyForSituation)) { |
|
| 2075 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
| 2076 | + } |
|
| 1958 | 2077 | echo '</select> '; |
| 1959 | 2078 | |
| 1960 | 2079 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
| 1961 | 2080 | { |
| 1962 | 2081 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
| 1963 | 2082 | } |
| 2083 | + } else if ($isFreeText) { |
|
| 2084 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1964 | 2085 | } |
| 1965 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
| 1966 | 2086 | echo '</div>'; |
| 1967 | 2087 | |
| 1968 | 2088 | if($line->qty<10) { |
@@ -1982,8 +2102,7 @@ discard block |
||
| 1982 | 2102 | $doleditor->Create(); |
| 1983 | 2103 | } |
| 1984 | 2104 | |
| 1985 | - } |
|
| 1986 | - else { |
|
| 2105 | + } else { |
|
| 1987 | 2106 | |
| 1988 | 2107 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
| 1989 | 2108 | { |
@@ -1991,14 +2110,19 @@ discard block |
||
| 1991 | 2110 | { |
| 1992 | 2111 | echo str_repeat(' ', $line->qty-1); |
| 1993 | 2112 | |
| 1994 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 1995 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2113 | + if (TSubtotal::isTitle($line)) { |
|
| 2114 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
| 2115 | + } else { |
|
| 2116 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
| 2117 | + } |
|
| 1996 | 2118 | } |
| 1997 | - } |
|
| 1998 | - else |
|
| 2119 | + } else |
|
| 1999 | 2120 | { |
| 2000 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
| 2001 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2121 | + if($line->qty<=1) { |
|
| 2122 | + print img_picto('', 'subtotal@subtotal'); |
|
| 2123 | + } else if($line->qty==2) { |
|
| 2124 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
| 2125 | + } |
|
| 2002 | 2126 | } |
| 2003 | 2127 | |
| 2004 | 2128 | |
@@ -2008,21 +2132,26 @@ discard block |
||
| 2008 | 2132 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
| 2009 | 2133 | |
| 2010 | 2134 | if (empty($line->label)) { |
| 2011 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
| 2012 | - else print $line->description; |
|
| 2013 | - } |
|
| 2014 | - else { |
|
| 2135 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
| 2136 | + print $line->description.' '.$this->getTitle($object, $line); |
|
| 2137 | + } else { |
|
| 2138 | + print $line->description; |
|
| 2139 | + } |
|
| 2140 | + } else { |
|
| 2015 | 2141 | |
| 2016 | 2142 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
| 2017 | 2143 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
| 2018 | - } |
|
| 2019 | - else{ |
|
| 2144 | + } else{ |
|
| 2020 | 2145 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
| 2021 | 2146 | } |
| 2022 | 2147 | |
| 2023 | 2148 | } |
| 2024 | - if($line->qty>90) print ' : '; |
|
| 2025 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2149 | + if($line->qty>90) { |
|
| 2150 | + print ' : '; |
|
| 2151 | + } |
|
| 2152 | + if($line->info_bits > 0) { |
|
| 2153 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
| 2154 | + } |
|
| 2026 | 2155 | |
| 2027 | 2156 | |
| 2028 | 2157 | |
@@ -2059,11 +2188,12 @@ discard block |
||
| 2059 | 2188 | </script> |
| 2060 | 2189 | <?php |
| 2061 | 2190 | |
| 2062 | - } |
|
| 2063 | - else{ |
|
| 2191 | + } else{ |
|
| 2064 | 2192 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
| 2065 | 2193 | { |
| 2066 | - 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>'; |
|
| 2194 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
| 2195 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
| 2196 | + } |
|
| 2067 | 2197 | } |
| 2068 | 2198 | |
| 2069 | 2199 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2132,7 +2262,9 @@ discard block |
||
| 2132 | 2262 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
| 2133 | 2263 | |
| 2134 | 2264 | $colspan+=3; $mode = 'view'; |
| 2135 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
| 2265 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
| 2266 | + $mode = 'edit'; |
|
| 2267 | + } |
|
| 2136 | 2268 | |
| 2137 | 2269 | $ex_element = $line->element; |
| 2138 | 2270 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2314,10 +2446,9 @@ discard block |
||
| 2314 | 2446 | |
| 2315 | 2447 | if(TSubtotal::isTitle($line)){ |
| 2316 | 2448 | $ThtmlData['data-issubtotal'] = 'title'; |
| 2317 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
| 2449 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
| 2318 | 2450 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
| 2319 | - } |
|
| 2320 | - else{ |
|
| 2451 | + } else{ |
|
| 2321 | 2452 | $ThtmlData['data-issubtotal'] = 'freetext'; |
| 2322 | 2453 | } |
| 2323 | 2454 | |
@@ -2327,7 +2458,9 @@ discard block |
||
| 2327 | 2458 | |
| 2328 | 2459 | // hook |
| 2329 | 2460 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
| 2330 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2461 | + if ($reshook < 0) { |
|
| 2462 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 2463 | + } |
|
| 2331 | 2464 | if ($reshook>0) |
| 2332 | 2465 | { |
| 2333 | 2466 | $ThtmlData = $hookmanager->resArray; |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | $prop->desc = ''; |
| 24 | 24 | } |
| 25 | 25 | $ret = $prop->update(1); |
| 26 | - if($ret>0) $i++; |
|
| 26 | + if($ret>0) { |
|
| 27 | + $i++; |
|
| 28 | + } |
|
| 27 | 29 | } |
| 28 | 30 | print $i." lignes converties<br>"; |
| 29 | 31 | } |
@@ -45,7 +47,9 @@ discard block |
||
| 45 | 47 | $cdeline->desc = ''; |
| 46 | 48 | } |
| 47 | 49 | $ret = $cdeline->update($user, 1); |
| 48 | - if($ret>0) $i++; |
|
| 50 | + if($ret>0) { |
|
| 51 | + $i++; |
|
| 52 | + } |
|
| 49 | 53 | } |
| 50 | 54 | |
| 51 | 55 | print $i." lignes converties<br>"; |
@@ -69,7 +73,9 @@ discard block |
||
| 69 | 73 | $facline->desc = ''; |
| 70 | 74 | } |
| 71 | 75 | $ret = $facline->update($user, 1); |
| 72 | - if($ret>0) $i++; |
|
| 76 | + if($ret>0) { |
|
| 77 | + $i++; |
|
| 78 | + } |
|
| 73 | 79 | } |
| 74 | 80 | |
| 75 | 81 | print $i." lignes converties<br>"; |
@@ -13,18 +13,23 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var $object Facture |
| 15 | 15 | */ |
| 16 | - if($object->element=='facture') $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 16 | + if($object->element=='facture') { |
|
| 17 | + $res = $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number); |
|
| 18 | + } |
|
| 17 | 19 | /** |
| 18 | 20 | * @var $object Propal |
| 19 | 21 | */ |
| 20 | - else if($object->element=='propal') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 22 | + else if($object->element=='propal') { |
|
| 23 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number); |
|
| 24 | + } |
|
| 21 | 25 | /** |
| 22 | 26 | * @var $object Commande |
| 23 | 27 | */ |
| 24 | - else if($object->element=='commande') $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 28 | + else if($object->element=='commande') { |
|
| 29 | + $res = $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number); |
|
| 30 | + } |
|
| 25 | 31 | |
| 26 | - } |
|
| 27 | - else { |
|
| 32 | + } else { |
|
| 28 | 33 | $desc = ''; |
| 29 | 34 | if ((float) DOL_VERSION < 6 || $qty==50) { |
| 30 | 35 | $desc = $label; |
@@ -34,29 +39,40 @@ discard block |
||
| 34 | 39 | /** |
| 35 | 40 | * @var $object Facture |
| 36 | 41 | */ |
| 37 | - if($object->element=='facture') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 42 | + if($object->element=='facture') { |
|
| 43 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label); |
|
| 44 | + } |
|
| 38 | 45 | /** |
| 39 | 46 | * @var $object Facture fournisseur |
| 40 | 47 | */ |
| 41 | 48 | else if($object->element=='invoice_supplier') { |
| 42 | 49 | $object->special_code = TSubtotal::$module_number; |
| 43 | 50 | $rang = $object->line_max() + 1; |
| 44 | - if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 45 | - else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 51 | + if($qty==50) { |
|
| 52 | + $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 53 | + } else { |
|
| 54 | + $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang); |
|
| 55 | + } |
|
| 46 | 56 | } |
| 47 | 57 | /** |
| 48 | 58 | * @var $object Propal |
| 49 | 59 | */ |
| 50 | - else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 60 | + else if($object->element=='propal') { |
|
| 61 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 62 | + } |
|
| 51 | 63 | /** |
| 52 | 64 | * @var $object Propal Fournisseur |
| 53 | 65 | */ |
| 54 | - else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 66 | + else if($object->element=='supplier_proposal') { |
|
| 67 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label); |
|
| 68 | + } |
|
| 55 | 69 | |
| 56 | 70 | /** |
| 57 | 71 | * @var $object Commande |
| 58 | 72 | */ |
| 59 | - else if($object->element=='commande') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 73 | + else if($object->element=='commande') { |
|
| 74 | + $res = $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label); |
|
| 75 | + } |
|
| 60 | 76 | /** |
| 61 | 77 | * @var $object Commande fournisseur |
| 62 | 78 | */ |
@@ -67,7 +83,9 @@ discard block |
||
| 67 | 83 | /** |
| 68 | 84 | * @var $object Facturerec |
| 69 | 85 | */ |
| 70 | - else if($object->element=='facturerec') $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 86 | + else if($object->element=='facturerec') { |
|
| 87 | + $res = $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); |
|
| 88 | + } |
|
| 71 | 89 | |
| 72 | 90 | } |
| 73 | 91 | |
@@ -89,8 +107,9 @@ discard block |
||
| 89 | 107 | // Define output language |
| 90 | 108 | $outputlangs = $langs; |
| 91 | 109 | $newlang = GETPOST('lang_id', 'alpha'); |
| 92 | - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) |
|
| 93 | - $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 110 | + if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { |
|
| 111 | + $newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang; |
|
| 112 | + } |
|
| 94 | 113 | if (! empty($newlang)) { |
| 95 | 114 | $outputlangs = new Translate("", $conf); |
| 96 | 115 | $outputlangs->setDefaultLang($newlang); |
@@ -99,13 +118,18 @@ discard block |
||
| 99 | 118 | $ret = $object->fetch($object->id); // Reload to get new records |
| 100 | 119 | if ((float) DOL_VERSION <= 3.6) |
| 101 | 120 | { |
| 102 | - if ($object->element == 'propal') propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 103 | - elseif ($object->element == 'commande') commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 104 | - elseif ($object->element == 'facture') facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 105 | - } |
|
| 106 | - else |
|
| 121 | + if ($object->element == 'propal') { |
|
| 122 | + propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 123 | + } elseif ($object->element == 'commande') { |
|
| 124 | + commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 125 | + } elseif ($object->element == 'facture') { |
|
| 126 | + facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 127 | + } |
|
| 128 | + } else |
|
| 107 | 129 | { |
| 108 | - if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 130 | + if ($object->element!= 'facturerec') { |
|
| 131 | + $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); |
|
| 132 | + } |
|
| 109 | 133 | } |
| 110 | 134 | } |
| 111 | 135 | } |
@@ -119,7 +143,9 @@ discard block |
||
| 119 | 143 | */ |
| 120 | 144 | public static function updateRang(&$object, $rang_start, $move_to=1) |
| 121 | 145 | { |
| 122 | - if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 146 | + if (!class_exists('GenericObject')) { |
|
| 147 | + require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; |
|
| 148 | + } |
|
| 123 | 149 | |
| 124 | 150 | $row=new GenericObject($object->db); |
| 125 | 151 | $row->table_element_line = $object->table_element_line; |
@@ -128,7 +154,9 @@ discard block |
||
| 128 | 154 | |
| 129 | 155 | foreach ($object->lines as &$line) |
| 130 | 156 | { |
| 131 | - if ($line->rang < $rang_start) continue; |
|
| 157 | + if ($line->rang < $rang_start) { |
|
| 158 | + continue; |
|
| 159 | + } |
|
| 132 | 160 | |
| 133 | 161 | $row->updateRangOfLine($line->id, $line->rang+$move_to); |
| 134 | 162 | } |
@@ -151,21 +179,28 @@ discard block |
||
| 151 | 179 | foreach ($TTitle_reverse as $k => $title_line) |
| 152 | 180 | { |
| 153 | 181 | $title_niveau = self::getNiveau($title_line); |
| 154 | - if ($title_niveau < $level_new_title) break; |
|
| 182 | + if ($title_niveau < $level_new_title) { |
|
| 183 | + break; |
|
| 184 | + } |
|
| 155 | 185 | |
| 156 | 186 | $rang_to_add = self::titleHasTotalLine($object, $title_line, true, true); |
| 157 | 187 | |
| 158 | 188 | if (is_numeric($rang_to_add)) |
| 159 | 189 | { |
| 160 | - if ($rang_to_add != -1) self::updateRang($object, $rang_to_add); |
|
| 190 | + if ($rang_to_add != -1) { |
|
| 191 | + self::updateRang($object, $rang_to_add); |
|
| 192 | + } |
|
| 161 | 193 | |
| 162 | 194 | self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add); |
| 163 | 195 | |
| 164 | 196 | $object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas) |
| 165 | 197 | if ($rang_to_add != -1) |
| 166 | 198 | { |
| 167 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
| 168 | - else $object->fetch($object->id); |
|
| 199 | + if (method_exists($object, 'fetch_lines')) { |
|
| 200 | + $object->fetch_lines(); |
|
| 201 | + } else { |
|
| 202 | + $object->fetch($object->id); |
|
| 203 | + } |
|
| 169 | 204 | } |
| 170 | 205 | } |
| 171 | 206 | } |
@@ -195,7 +230,9 @@ discard block |
||
| 195 | 230 | |
| 196 | 231 | foreach ($TTitle as $k => $title_line) |
| 197 | 232 | { |
| 198 | - if (self::titleHasTotalLine($object, $title_line)) unset($TTitle[$k]); |
|
| 233 | + if (self::titleHasTotalLine($object, $title_line)) { |
|
| 234 | + unset($TTitle[$k]); |
|
| 235 | + } |
|
| 199 | 236 | } |
| 200 | 237 | |
| 201 | 238 | return $TTitle; |
@@ -212,23 +249,41 @@ discard block |
||
| 212 | 249 | */ |
| 213 | 250 | public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false) |
| 214 | 251 | { |
| 215 | - if (empty($object->lines) || !is_array($object->lines)) return false; |
|
| 252 | + if (empty($object->lines) || !is_array($object->lines)) { |
|
| 253 | + return false; |
|
| 254 | + } |
|
| 216 | 255 | |
| 217 | 256 | $title_niveau = self::getNiveau($title_line); |
| 218 | 257 | foreach ($object->lines as &$line) |
| 219 | 258 | { |
| 220 | - if ($line->rang <= $title_line->rang) continue; |
|
| 221 | - if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) return false; // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 222 | - if (!self::isSubtotal($line)) continue; |
|
| 259 | + if ($line->rang <= $title_line->rang) { |
|
| 260 | + continue; |
|
| 261 | + } |
|
| 262 | + if (self::isTitle($line) && self::getNiveau($line) <= $title_niveau) { |
|
| 263 | + return false; |
|
| 264 | + } |
|
| 265 | + // Oups on croise un titre d'un niveau inférieur ou égale (exemple : je croise un titre niveau 2 alors que je suis sur un titre de niveau 3) pas lieu de continuer car un nouveau bloc commence |
|
| 266 | + if (!self::isSubtotal($line)) { |
|
| 267 | + continue; |
|
| 268 | + } |
|
| 223 | 269 | |
| 224 | 270 | $subtotal_niveau = self::getNiveau($line); |
| 225 | 271 | |
| 226 | 272 | // Comparaison du niveau de la ligne de sous-total avec celui du titre |
| 227 | - if ($subtotal_niveau == $title_niveau) return true; // niveau égale => Ok mon titre a un sous-total |
|
| 228 | - elseif ($subtotal_niveau < $title_niveau) // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 273 | + if ($subtotal_niveau == $title_niveau) { |
|
| 274 | + return true; |
|
| 275 | + } |
|
| 276 | + // niveau égale => Ok mon titre a un sous-total |
|
| 277 | + elseif ($subtotal_niveau < $title_niveau) { |
|
| 278 | + // niveau inférieur trouvé (exemple : sous-total de niveau 1 contre mon titre de niveau 3) |
|
| 229 | 279 | { |
| 230 | - if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; // mode strict niveau pas égale donc faux |
|
| 231 | - else return true; // mode libre => OK je considère que mon titre à un sous-total |
|
| 280 | + if ($strict_mode) return ($return_rang_on_false) ? $line->rang : false; |
|
| 281 | + } |
|
| 282 | + // mode strict niveau pas égale donc faux |
|
| 283 | + else { |
|
| 284 | + return true; |
|
| 285 | + } |
|
| 286 | + // mode libre => OK je considère que mon titre à un sous-total |
|
| 232 | 287 | } |
| 233 | 288 | } |
| 234 | 289 | |
@@ -276,16 +331,19 @@ discard block |
||
| 276 | 331 | |
| 277 | 332 | foreach ($object->lines as &$l) |
| 278 | 333 | { |
| 279 | - if ($l->rang <= $line->rang) continue; |
|
| 280 | - elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) break; |
|
| 281 | - elseif (self::isModSubtotalLine($l)) continue; |
|
| 334 | + if ($l->rang <= $line->rang) { |
|
| 335 | + continue; |
|
| 336 | + } elseif (self::isSubtotal($l) && self::getNiveau($l) == $line->qty) { |
|
| 337 | + break; |
|
| 338 | + } elseif (self::isModSubtotalLine($l)) { |
|
| 339 | + continue; |
|
| 340 | + } |
|
| 282 | 341 | |
| 283 | 342 | if (!empty($l->array_options['options_subtotal_nc'])) |
| 284 | 343 | { |
| 285 | 344 | $tabprice = calcul_price_total($l->qty, $l->subprice, $l->remise_percent, $l->tva_tx, $l->localtax1_tx, $l->localtax2_tx, 0, 'HT', $l->info_bits, $l->product_type); |
| 286 | 345 | $TTot['total_options'] += $tabprice[0]; // total ht |
| 287 | - } |
|
| 288 | - else |
|
| 346 | + } else |
|
| 289 | 347 | { |
| 290 | 348 | $TTot['total_pa_ht'] += $l->pa_ht * $l->qty; |
| 291 | 349 | $TTot['total_ht'] += $l->total_ht; |
@@ -304,29 +362,41 @@ discard block |
||
| 304 | 362 | |
| 305 | 363 | public static function getOrderIdFromLineId(&$db, $fk_commandedet) |
| 306 | 364 | { |
| 307 | - if (empty($fk_commandedet)) return false; |
|
| 365 | + if (empty($fk_commandedet)) { |
|
| 366 | + return false; |
|
| 367 | + } |
|
| 308 | 368 | |
| 309 | 369 | $sql = 'SELECT fk_commande FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$fk_commandedet; |
| 310 | 370 | $resql = $db->query($sql); |
| 311 | 371 | |
| 312 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->fk_commande; |
|
| 313 | - else return false; |
|
| 372 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 373 | + return $row->fk_commande; |
|
| 374 | + } else { |
|
| 375 | + return false; |
|
| 376 | + } |
|
| 314 | 377 | } |
| 315 | 378 | |
| 316 | 379 | public static function getLastLineOrderId(&$db, $fk_commande) |
| 317 | 380 | { |
| 318 | - if (empty($fk_commande)) return false; |
|
| 381 | + if (empty($fk_commande)) { |
|
| 382 | + return false; |
|
| 383 | + } |
|
| 319 | 384 | |
| 320 | 385 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commandedet WHERE fk_commande = '.$fk_commande.' ORDER BY rang DESC LIMIT 1'; |
| 321 | 386 | $resql = $db->query($sql); |
| 322 | 387 | |
| 323 | - if ($resql && ($row = $db->fetch_object($resql))) return $row->rowid; |
|
| 324 | - else return false; |
|
| 388 | + if ($resql && ($row = $db->fetch_object($resql))) { |
|
| 389 | + return $row->rowid; |
|
| 390 | + } else { |
|
| 391 | + return false; |
|
| 392 | + } |
|
| 325 | 393 | } |
| 326 | 394 | |
| 327 | 395 | public static function getParentTitleOfLine(&$object, $i) |
| 328 | 396 | { |
| 329 | - if ($i <= 0) return false; |
|
| 397 | + if ($i <= 0) { |
|
| 398 | + return false; |
|
| 399 | + } |
|
| 330 | 400 | |
| 331 | 401 | $skip_title = 0; |
| 332 | 402 | // Je parcours les lignes précédentes |
@@ -345,8 +415,7 @@ discard block |
||
| 345 | 415 | //@INFO J'ai ma ligne titre qui contient ma ligne, par contre je check pas s'il y a un sous-total |
| 346 | 416 | return $line; |
| 347 | 417 | break; |
| 348 | - } |
|
| 349 | - elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 418 | + } elseif ($line->product_type == 9 && $line->qty >= 90 && $line->qty <= 99) |
|
| 350 | 419 | { |
| 351 | 420 | // Il s'agit d'un sous-total, ça veut dire que le prochain titre théoriquement doit être ignorer (je travail avec un incrément au cas ou je croise plusieurs sous-totaux) |
| 352 | 421 | $skip_title++; |
@@ -361,7 +430,9 @@ discard block |
||
| 361 | 430 | $res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9; |
| 362 | 431 | if($res && $level > -1) { |
| 363 | 432 | return $line->qty == $level; |
| 364 | - } else return $res; |
|
| 433 | + } else { |
|
| 434 | + return $res; |
|
| 435 | + } |
|
| 365 | 436 | |
| 366 | 437 | } |
| 367 | 438 | |
@@ -388,10 +459,14 @@ discard block |
||
| 388 | 459 | // editeur wysiwyg |
| 389 | 460 | require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
| 390 | 461 | $nbrows=ROWS_2; |
| 391 | - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 462 | + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
|
| 463 | + $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; |
|
| 464 | + } |
|
| 392 | 465 | $enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); |
| 393 | 466 | $toolbarname='dolibarr_details'; |
| 394 | - if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; |
|
| 467 | + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) { |
|
| 468 | + $toolbarname='dolibarr_notes'; |
|
| 469 | + } |
|
| 395 | 470 | $text = !empty($line->description)?$line->description:$line->label; |
| 396 | 471 | $doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly); |
| 397 | 472 | return $doleditor->Create(1); |
@@ -406,12 +481,10 @@ discard block |
||
| 406 | 481 | { |
| 407 | 482 | $object->statut = 0; // hack for facture rec |
| 408 | 483 | $createRight = $user->rights->facture->creer; |
| 409 | - } |
|
| 410 | - elseif($object->element == 'order_supplier' ) |
|
| 484 | + } elseif($object->element == 'order_supplier' ) |
|
| 411 | 485 | { |
| 412 | 486 | $createRight = $user->rights->fournisseur->commande->creer; |
| 413 | - } |
|
| 414 | - elseif($object->element == 'invoice_supplier' ) |
|
| 487 | + } elseif($object->element == 'invoice_supplier' ) |
|
| 415 | 488 | { |
| 416 | 489 | $createRight = $user->rights->fournisseur->facture->creer; |
| 417 | 490 | } |
@@ -484,8 +557,9 @@ discard block |
||
| 484 | 557 | |
| 485 | 558 | $TLineAdded[] = $object->line; |
| 486 | 559 | // Error from addline |
| 487 | - if ($res <= 0) break; |
|
| 488 | - else |
|
| 560 | + if ($res <= 0) { |
|
| 561 | + break; |
|
| 562 | + } else |
|
| 489 | 563 | { |
| 490 | 564 | $object->line_from = $line; |
| 491 | 565 | // Call trigger |
@@ -507,8 +581,7 @@ discard block |
||
| 507 | 581 | _updateLineNC($object->element, $object->id, $line->id, $line->array_options['options_subtotal_nc']); |
| 508 | 582 | } |
| 509 | 583 | return count($TLineAdded); |
| 510 | - } |
|
| 511 | - else |
|
| 584 | + } else |
|
| 512 | 585 | { |
| 513 | 586 | $object->db->rollback(); |
| 514 | 587 | return -1; |
@@ -524,10 +597,14 @@ discard block |
||
| 524 | 597 | global $langs; |
| 525 | 598 | |
| 526 | 599 | // Besoin de comparer sur les 2 formes d'écriture |
| 527 | - if (!$key_is_id) $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 600 | + if (!$key_is_id) { |
|
| 601 | + $TTitle_search = array($langs->trans($key_trad), $langs->transnoentitiesnoconv($key_trad)); |
|
| 602 | + } |
|
| 528 | 603 | |
| 529 | 604 | $TTitle_under_search = array(); |
| 530 | - if (!empty($under_title)) $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 605 | + if (!empty($under_title)) { |
|
| 606 | + $TTitle_under_search = array($langs->trans($under_title), $langs->transnoentitiesnoconv($under_title)); |
|
| 607 | + } |
|
| 531 | 608 | |
| 532 | 609 | $TLine = array(); |
| 533 | 610 | $add_line = false; |
@@ -537,28 +614,37 @@ discard block |
||
| 537 | 614 | { |
| 538 | 615 | if (!$under_title_found && !empty($TTitle_under_search)) |
| 539 | 616 | { |
| 540 | - if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true; |
|
| 541 | - } |
|
| 542 | - else |
|
| 617 | + if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) { |
|
| 618 | + $under_title_found = true; |
|
| 619 | + } |
|
| 620 | + } else |
|
| 543 | 621 | { |
| 544 | 622 | if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) ))) |
| 545 | 623 | { |
| 546 | - if ($key_is_id) $level = $line->qty; |
|
| 624 | + if ($key_is_id) { |
|
| 625 | + $level = $line->qty; |
|
| 626 | + } |
|
| 547 | 627 | |
| 548 | 628 | $add_line = true; |
| 549 | - if ($withBlockLine) $TLine[] = $line; |
|
| 629 | + if ($withBlockLine) { |
|
| 630 | + $TLine[] = $line; |
|
| 631 | + } |
|
| 550 | 632 | continue; |
| 551 | - } |
|
| 552 | - elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 633 | + } elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) { |
|
| 634 | + // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre |
|
| 553 | 635 | { |
| 554 | 636 | if ($withBlockLine) $TLine[] = $line; |
| 637 | + } |
|
| 555 | 638 | break; |
| 556 | 639 | } |
| 557 | 640 | |
| 558 | 641 | if ($add_line) |
| 559 | 642 | { |
| 560 | - if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue; |
|
| 561 | - else $TLine[] = $line; |
|
| 643 | + if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) { |
|
| 644 | + continue; |
|
| 645 | + } else { |
|
| 646 | + $TLine[] = $line; |
|
| 647 | + } |
|
| 562 | 648 | } |
| 563 | 649 | } |
| 564 | 650 | } |
@@ -592,7 +678,9 @@ discard block |
||
| 592 | 678 | |
| 593 | 679 | case 'order_supplier': |
| 594 | 680 | $object->special_code = SELF::$module_number; |
| 595 | - if (empty($desc)) $desc = $label; |
|
| 681 | + if (empty($desc)) { |
|
| 682 | + $desc = $label; |
|
| 683 | + } |
|
| 596 | 684 | $res = $object->updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 597 | 685 | break; |
| 598 | 686 | |
@@ -602,7 +690,9 @@ discard block |
||
| 602 | 690 | |
| 603 | 691 | case 'invoice_supplier': |
| 604 | 692 | $object->special_code = SELF::$module_number; |
| 605 | - if (empty($desc)) $desc = $label; |
|
| 693 | + if (empty($desc)) { |
|
| 694 | + $desc = $label; |
|
| 695 | + } |
|
| 606 | 696 | $res = $object->updateline($rowid, $desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, 0, $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $fk_unit); |
| 607 | 697 | break; |
| 608 | 698 | |
@@ -619,8 +709,11 @@ discard block |
||
| 619 | 709 | break; |
| 620 | 710 | } |
| 621 | 711 | |
| 622 | - if ($res <= 0) $object->db->rollback(); |
|
| 623 | - else $object->db->commit(); |
|
| 712 | + if ($res <= 0) { |
|
| 713 | + $object->db->rollback(); |
|
| 714 | + } else { |
|
| 715 | + $object->db->commit(); |
|
| 716 | + } |
|
| 624 | 717 | |
| 625 | 718 | return $res; |
| 626 | 719 | } |
@@ -630,24 +723,20 @@ discard block |
||
| 630 | 723 | global $db, $object; |
| 631 | 724 | |
| 632 | 725 | $TTitle = array(); |
| 633 | - if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} |
|
| 634 | - else { |
|
| 726 | + if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {} else { |
|
| 635 | 727 | if ($origin_line->element == 'propaldet') |
| 636 | 728 | { |
| 637 | 729 | $object = new Propal($db); |
| 638 | 730 | $object->fetch($origin_line->fk_propal); |
| 639 | - } |
|
| 640 | - else if ($origin_line->element == 'commandedet') |
|
| 731 | + } else if ($origin_line->element == 'commandedet') |
|
| 641 | 732 | { |
| 642 | 733 | $object = new Commande($db); |
| 643 | 734 | $object->fetch($origin_line->fk_commande); |
| 644 | - } |
|
| 645 | - else if ($origin_line->element == 'facturedet') |
|
| 735 | + } else if ($origin_line->element == 'facturedet') |
|
| 646 | 736 | { |
| 647 | 737 | $object = new Facture($db); |
| 648 | 738 | $object->fetch($origin_line->fk_facture); |
| 649 | - } |
|
| 650 | - else |
|
| 739 | + } else |
|
| 651 | 740 | { |
| 652 | 741 | return $TTitle; |
| 653 | 742 | } |
@@ -657,8 +746,11 @@ discard block |
||
| 657 | 746 | $i = 0; |
| 658 | 747 | foreach ($object->lines as &$line) |
| 659 | 748 | { |
| 660 | - if ($origin_line->id == $line->id) break; |
|
| 661 | - else $i++; |
|
| 749 | + if ($origin_line->id == $line->id) { |
|
| 750 | + break; |
|
| 751 | + } else { |
|
| 752 | + $i++; |
|
| 753 | + } |
|
| 662 | 754 | } |
| 663 | 755 | |
| 664 | 756 | $i--; // Skip la ligne d'origine |
@@ -673,35 +765,43 @@ discard block |
||
| 673 | 765 | if (self::isSubtotal($object->lines[$y])) |
| 674 | 766 | { |
| 675 | 767 | $next_title_lvl_to_skip = self::getNiveau($object->lines[$y]); |
| 676 | - } |
|
| 677 | - elseif (self::isTitle($object->lines[$y])) |
|
| 768 | + } elseif (self::isTitle($object->lines[$y])) |
|
| 678 | 769 | { |
| 679 | 770 | if ($object->lines[$y]->qty == $next_title_lvl_to_skip) |
| 680 | 771 | { |
| 681 | 772 | $next_title_lvl_to_skip = 0; |
| 682 | 773 | continue; |
| 683 | - } |
|
| 684 | - else |
|
| 774 | + } else |
|
| 685 | 775 | { |
| 686 | - if (empty($object->lines[$y]->array_options)) $object->lines[$y]->fetch_optionals(); |
|
| 776 | + if (empty($object->lines[$y]->array_options)) { |
|
| 777 | + $object->lines[$y]->fetch_optionals(); |
|
| 778 | + } |
|
| 687 | 779 | $TTitle[$object->lines[$y]->id] = $object->lines[$y]; |
| 688 | 780 | |
| 689 | - if ($object->lines[$y]->qty == 1) break; |
|
| 781 | + if ($object->lines[$y]->qty == 1) { |
|
| 782 | + break; |
|
| 783 | + } |
|
| 690 | 784 | } |
| 691 | 785 | } |
| 692 | 786 | } |
| 693 | 787 | } |
| 694 | 788 | |
| 695 | - if ($reverse) $TTitle = array_reverse($TTitle, true); |
|
| 789 | + if ($reverse) { |
|
| 790 | + $TTitle = array_reverse($TTitle, true); |
|
| 791 | + } |
|
| 696 | 792 | |
| 697 | 793 | return $TTitle; |
| 698 | 794 | } |
| 699 | 795 | |
| 700 | 796 | public static function getNiveau(&$line) |
| 701 | 797 | { |
| 702 | - if (self::isTitle($line)) return $line->qty; |
|
| 703 | - elseif (self::isSubtotal($line)) return 100 - $line->qty; |
|
| 704 | - else return 0; |
|
| 798 | + if (self::isTitle($line)) { |
|
| 799 | + return $line->qty; |
|
| 800 | + } elseif (self::isSubtotal($line)) { |
|
| 801 | + return 100 - $line->qty; |
|
| 802 | + } else { |
|
| 803 | + return 0; |
|
| 804 | + } |
|
| 705 | 805 | } |
| 706 | 806 | |
| 707 | 807 | /** |
@@ -726,10 +826,16 @@ discard block |
||
| 726 | 826 | $objmarge->marge_droite = 10; |
| 727 | 827 | |
| 728 | 828 | $objectref = dol_sanitizeFileName($object->ref); |
| 729 | - if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 730 | - elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 731 | - elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 732 | - elseif ($object->element == 'facturerec') return; // no PDF for facturerec |
|
| 829 | + if ($object->element == 'propal') { |
|
| 830 | + $dir = $conf->propal->dir_output . '/' . $objectref; |
|
| 831 | + } elseif ($object->element == 'commande') { |
|
| 832 | + $dir = $conf->commande->dir_output . '/' . $objectref; |
|
| 833 | + } elseif ($object->element == 'facture') { |
|
| 834 | + $dir = $conf->facture->dir_output . '/' . $objectref; |
|
| 835 | + } elseif ($object->element == 'facturerec') { |
|
| 836 | + return; |
|
| 837 | + } |
|
| 838 | + // no PDF for facturerec |
|
| 733 | 839 | else |
| 734 | 840 | { |
| 735 | 841 | setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings'); |
@@ -764,7 +870,9 @@ discard block |
||
| 764 | 870 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
| 765 | 871 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
| 766 | 872 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); |
| 767 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 873 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 874 | + $pdf->SetCompression(false); |
|
| 875 | + } |
|
| 768 | 876 | |
| 769 | 877 | $pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right |
| 770 | 878 | |
@@ -774,7 +882,9 @@ discard block |
||
| 774 | 882 | |
| 775 | 883 | // New page |
| 776 | 884 | $pdf->AddPage(); |
| 777 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 885 | + if (! empty($tplidx)) { |
|
| 886 | + $pdf->useTemplate($tplidx); |
|
| 887 | + } |
|
| 778 | 888 | $pagenb++; |
| 779 | 889 | |
| 780 | 890 | |
@@ -830,8 +940,10 @@ discard block |
||
| 830 | 940 | { |
| 831 | 941 | $TTot['TTotal_tva_multicurrency'][$tx] += $amount; |
| 832 | 942 | } |
| 943 | + } else { |
|
| 944 | + $pdf->SetFont('','', $default_font_size - 1); |
|
| 833 | 945 | } |
| 834 | - else $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
| 946 | + // Into loop to work with multipage |
|
| 835 | 947 | |
| 836 | 948 | $pdf->SetTextColor(0,0,0); |
| 837 | 949 | |
@@ -853,9 +965,11 @@ discard block |
||
| 853 | 965 | $pdf->startTransaction(); |
| 854 | 966 | $pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true); |
| 855 | 967 | $pageposafter=$pdf->getPage(); |
| 856 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
| 968 | + if ($pageposafter > $pageposbefore) { |
|
| 969 | + // There is a pagebreak |
|
| 857 | 970 | { |
| 858 | 971 | $pdf->rollbackTransaction(true); |
| 972 | + } |
|
| 859 | 973 | $pageposafter=$pageposbefore; |
| 860 | 974 | //print $pageposafter.'-'.$pageposbefore;exit; |
| 861 | 975 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -864,23 +978,27 @@ discard block |
||
| 864 | 978 | $pageposafter=$pdf->getPage(); |
| 865 | 979 | $posyafter=$pdf->GetY(); |
| 866 | 980 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
| 867 | - if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) // There is no space left for total+free text |
|
| 981 | + if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot))) { |
|
| 982 | + // There is no space left for total+free text |
|
| 868 | 983 | { |
| 869 | 984 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
| 870 | 985 | { |
| 871 | 986 | $pdf->AddPage('','',true); |
| 872 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 873 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 987 | + } |
|
| 988 | + if (! empty($tplidx)) { |
|
| 989 | + $pdf->useTemplate($tplidx); |
|
| 990 | + } |
|
| 991 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 992 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 993 | + } |
|
| 874 | 994 | $pdf->setPage($pageposafter+1); |
| 875 | 995 | } |
| 876 | - } |
|
| 877 | - else |
|
| 996 | + } else |
|
| 878 | 997 | { |
| 879 | 998 | // We found a page break |
| 880 | 999 | $showpricebeforepagebreak=0; |
| 881 | 1000 | } |
| 882 | - } |
|
| 883 | - else // No pagebreak |
|
| 1001 | + } else // No pagebreak |
|
| 884 | 1002 | { |
| 885 | 1003 | $pdf->commitTransaction(); |
| 886 | 1004 | } |
@@ -920,8 +1038,7 @@ discard block |
||
| 920 | 1038 | if ($pagenb == 1) |
| 921 | 1039 | { |
| 922 | 1040 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); |
| 923 | - } |
|
| 924 | - else |
|
| 1041 | + } else |
|
| 925 | 1042 | { |
| 926 | 1043 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); |
| 927 | 1044 | } |
@@ -929,7 +1046,9 @@ discard block |
||
| 929 | 1046 | $pagenb++; |
| 930 | 1047 | $pdf->setPage($pagenb); |
| 931 | 1048 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 932 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1049 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
| 1050 | + self::pagehead($objmarge, $pdf, $object, 0, $outputlangs); |
|
| 1051 | + } |
|
| 933 | 1052 | } |
| 934 | 1053 | } |
| 935 | 1054 | } |
@@ -939,8 +1058,7 @@ discard block |
||
| 939 | 1058 | { |
| 940 | 1059 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); |
| 941 | 1060 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
| 942 | - } |
|
| 943 | - else |
|
| 1061 | + } else |
|
| 944 | 1062 | { |
| 945 | 1063 | self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); |
| 946 | 1064 | $bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1; |
@@ -954,7 +1072,9 @@ discard block |
||
| 954 | 1072 | |
| 955 | 1073 | $pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file); |
| 956 | 1074 | |
| 957 | - if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) unlink($file); |
|
| 1075 | + if (empty($conf->global->SUBTOTAL_KEEP_RECAP_FILE)) { |
|
| 1076 | + unlink($file); |
|
| 1077 | + } |
|
| 958 | 1078 | } |
| 959 | 1079 | |
| 960 | 1080 | private static function printLevel($objmarge, $pdf, $line, $curY, $posx_designation) |
@@ -997,8 +1117,7 @@ discard block |
||
| 997 | 1117 | { |
| 998 | 1118 | $height=pdf_getHeightForLogo($logo); |
| 999 | 1119 | $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto) |
| 1000 | - } |
|
| 1001 | - else |
|
| 1120 | + } else |
|
| 1002 | 1121 | { |
| 1003 | 1122 | $pdf->SetTextColor(200,0,0); |
| 1004 | 1123 | $pdf->SetFont('','B',$default_font_size - 2); |
@@ -1007,8 +1126,7 @@ discard block |
||
| 1007 | 1126 | } |
| 1008 | 1127 | |
| 1009 | 1128 | $posy+=35; |
| 1010 | - } |
|
| 1011 | - else |
|
| 1129 | + } else |
|
| 1012 | 1130 | { |
| 1013 | 1131 | $text=$mysoc->name; |
| 1014 | 1132 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1022,9 +1140,13 @@ discard block |
||
| 1022 | 1140 | $pdf->SetXY($objmarge->marge_gauche,$posy); |
| 1023 | 1141 | |
| 1024 | 1142 | $key = 'subtotalPropalTitle'; |
| 1025 | - if ($object->element == 'commande') $key = 'subtotalCommandeTitle'; |
|
| 1026 | - elseif ($object->element == 'facture') $key = 'subtotalInvoiceTitle'; |
|
| 1027 | - elseif ($object->element == 'facturerec') $key = 'subtotalInvoiceTitle'; |
|
| 1143 | + if ($object->element == 'commande') { |
|
| 1144 | + $key = 'subtotalCommandeTitle'; |
|
| 1145 | + } elseif ($object->element == 'facture') { |
|
| 1146 | + $key = 'subtotalInvoiceTitle'; |
|
| 1147 | + } elseif ($object->element == 'facturerec') { |
|
| 1148 | + $key = 'subtotalInvoiceTitle'; |
|
| 1149 | + } |
|
| 1028 | 1150 | |
| 1029 | 1151 | $pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L'); |
| 1030 | 1152 | |
@@ -1059,7 +1181,9 @@ discard block |
||
| 1059 | 1181 | |
| 1060 | 1182 | // Force to disable hidetop and hidebottom |
| 1061 | 1183 | $hidebottom=0; |
| 1062 | - if ($hidetop) $hidetop=-1; |
|
| 1184 | + if ($hidetop) { |
|
| 1185 | + $hidetop=-1; |
|
| 1186 | + } |
|
| 1063 | 1187 | |
| 1064 | 1188 | $currency = !empty($currency) ? $currency : $conf->currency; |
| 1065 | 1189 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
@@ -1074,7 +1198,9 @@ discard block |
||
| 1074 | 1198 | $pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5); |
| 1075 | 1199 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
| 1076 | 1200 | |
| 1077 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1201 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
| 1202 | + $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
| 1203 | + } |
|
| 1078 | 1204 | |
| 1079 | 1205 | |
| 1080 | 1206 | $pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param |
@@ -1087,8 +1213,7 @@ discard block |
||
| 1087 | 1213 | $pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R'); |
| 1088 | 1214 | |
| 1089 | 1215 | $pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8); // line prend une position y en 2eme param et 4eme param |
| 1090 | - } |
|
| 1091 | - else |
|
| 1216 | + } else |
|
| 1092 | 1217 | { |
| 1093 | 1218 | $pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2); // line prend une position y en 2eme param et 4eme param |
| 1094 | 1219 | } |
@@ -1109,10 +1234,12 @@ discard block |
||
| 1109 | 1234 | |
| 1110 | 1235 | // Tableau total |
| 1111 | 1236 | $col1x = 120; $col2x = 170; |
| 1112 | - if ($objmarge->page_largeur < 210) // To work with US executive format |
|
| 1237 | + if ($objmarge->page_largeur < 210) { |
|
| 1238 | + // To work with US executive format |
|
| 1113 | 1239 | { |
| 1114 | 1240 | $col2x-=20; |
| 1115 | 1241 | } |
| 1242 | + } |
|
| 1116 | 1243 | $largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x); |
| 1117 | 1244 | |
| 1118 | 1245 | $useborder=0; |
@@ -1134,9 +1261,11 @@ discard block |
||
| 1134 | 1261 | $atleastoneratenotnull=0; |
| 1135 | 1262 | foreach($TTot['TTotal_tva'] as $tvakey => $tvaval) |
| 1136 | 1263 | { |
| 1137 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
| 1264 | + if ($tvakey != 0) { |
|
| 1265 | + // On affiche pas taux 0 |
|
| 1138 | 1266 | { |
| 1139 | 1267 | $atleastoneratenotnull++; |
| 1268 | + } |
|
| 1140 | 1269 | |
| 1141 | 1270 | $index++; |
| 1142 | 1271 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1189,9 +1318,13 @@ discard block |
||
| 1189 | 1318 | */ |
| 1190 | 1319 | private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) |
| 1191 | 1320 | { |
| 1192 | - if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); |
|
| 1321 | + if (empty($hidetop) || $hidetop==-1) { |
|
| 1322 | + $pdf->line($x, $y, $x+$l, $y); |
|
| 1323 | + } |
|
| 1193 | 1324 | $pdf->line($x+$l, $y, $x+$l, $y+$h); |
| 1194 | - if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1325 | + if (empty($hidebottom)) { |
|
| 1326 | + $pdf->line($x+$l, $y+$h, $x, $y+$h); |
|
| 1327 | + } |
|
| 1195 | 1328 | $pdf->line($x, $y+$h, $x, $y); |
| 1196 | 1329 | } |
| 1197 | 1330 | |
@@ -1200,7 +1333,9 @@ discard block |
||
| 1200 | 1333 | { |
| 1201 | 1334 | global $conf; |
| 1202 | 1335 | |
| 1203 | - if (empty($fileoutput)) $fileoutput = $file[0]; |
|
| 1336 | + if (empty($fileoutput)) { |
|
| 1337 | + $fileoutput = $file[0]; |
|
| 1338 | + } |
|
| 1204 | 1339 | |
| 1205 | 1340 | $pdf=pdf_getInstance(); |
| 1206 | 1341 | if (class_exists('TCPDF')) |
@@ -1210,7 +1345,9 @@ discard block |
||
| 1210 | 1345 | } |
| 1211 | 1346 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
| 1212 | 1347 | |
| 1213 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
| 1348 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
| 1349 | + $pdf->SetCompression(false); |
|
| 1350 | + } |
|
| 1214 | 1351 | |
| 1215 | 1352 | |
| 1216 | 1353 | foreach($files as $file) |
@@ -1226,7 +1363,9 @@ discard block |
||
| 1226 | 1363 | } |
| 1227 | 1364 | |
| 1228 | 1365 | $pdf->Output($fileoutput,'F'); |
| 1229 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1366 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
| 1367 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
| 1368 | + } |
|
| 1230 | 1369 | |
| 1231 | 1370 | return $pagecount; |
| 1232 | 1371 | } |
@@ -1239,7 +1378,9 @@ discard block |
||
| 1239 | 1378 | */ |
| 1240 | 1379 | public static function hasNcTitle(&$line) |
| 1241 | 1380 | { |
| 1242 | - if(isset($line->has_nc_title)) return $line->has_nc_title; |
|
| 1381 | + if(isset($line->has_nc_title)) { |
|
| 1382 | + return $line->has_nc_title; |
|
| 1383 | + } |
|
| 1243 | 1384 | |
| 1244 | 1385 | $TTitle = self::getAllTitleFromLine($line); |
| 1245 | 1386 | foreach ($TTitle as &$line_title) |
@@ -1264,7 +1405,9 @@ discard block |
||
| 1264 | 1405 | public static function getTitleLabel($line) |
| 1265 | 1406 | { |
| 1266 | 1407 | $title = $line->label; |
| 1267 | - if (empty($title)) $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1408 | + if (empty($title)) { |
|
| 1409 | + $title = !empty($line->description) ? $line->description : $line->desc; |
|
| 1410 | + } |
|
| 1268 | 1411 | return $title; |
| 1269 | 1412 | } |
| 1270 | 1413 | } |