@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | */ |
39 | 39 | class pdf_einstein_subtotal extends ModelePDFCommandes |
40 | 40 | { |
41 | - var $db; |
|
42 | - var $name; |
|
43 | - var $description; |
|
44 | - var $type; |
|
41 | + var $db; |
|
42 | + var $name; |
|
43 | + var $description; |
|
44 | + var $type; |
|
45 | 45 | |
46 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
47 | - var $version = 'dolibarr'; |
|
46 | + var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
47 | + var $version = 'dolibarr'; |
|
48 | 48 | |
49 | - var $page_largeur; |
|
50 | - var $page_hauteur; |
|
51 | - var $format; |
|
49 | + var $page_largeur; |
|
50 | + var $page_hauteur; |
|
51 | + var $format; |
|
52 | 52 | var $marge_gauche; |
53 | 53 | var $marge_droite; |
54 | 54 | var $marge_haute; |
55 | 55 | var $marge_basse; |
56 | 56 | |
57 | - var $emetteur; // Objet societe qui emet |
|
57 | + var $emetteur; // Objet societe qui emet |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -129,15 +129,15 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | - * Function to build pdf onto disk |
|
133 | - * |
|
134 | - * @param Object $object Object to generate |
|
135 | - * @param Translate $outputlangs Lang output object |
|
136 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
137 | - * @param int $hidedetails Do not show line details |
|
138 | - * @param int $hidedesc Do not show desc |
|
139 | - * @param int $hideref Do not show ref |
|
140 | - * @return int 1=OK, 0=KO |
|
132 | + * Function to build pdf onto disk |
|
133 | + * |
|
134 | + * @param Object $object Object to generate |
|
135 | + * @param Translate $outputlangs Lang output object |
|
136 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
137 | + * @param int $hidedetails Do not show line details |
|
138 | + * @param int $hidedesc Do not show desc |
|
139 | + * @param int $hideref Do not show ref |
|
140 | + * @return int 1=OK, 0=KO |
|
141 | 141 | */ |
142 | 142 | function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
143 | 143 | { |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | |
160 | 160 | if ($conf->commande->dir_output) |
161 | 161 | { |
162 | - $object->fetch_thirdparty(); |
|
162 | + $object->fetch_thirdparty(); |
|
163 | 163 | if(!empty($object->client) ){ |
164 | 164 | $object->thirdparty = $object->client; |
165 | 165 | } |
166 | - $deja_regle = ""; |
|
166 | + $deja_regle = ""; |
|
167 | 167 | |
168 | - // Definition of $dir and $file |
|
168 | + // Definition of $dir and $file |
|
169 | 169 | if ($object->specimen) |
170 | 170 | { |
171 | 171 | $dir = $conf->commande->dir_output; |
@@ -204,22 +204,22 @@ discard block |
||
204 | 204 | $pdf=pdf_getInstance($this->format); |
205 | 205 | $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
206 | 206 | $heightforinfotot = 50; // Height reserved to output the info and total part |
207 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
208 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
209 | - $pdf->SetAutoPageBreak(1,0); |
|
210 | - |
|
211 | - if (class_exists('TCPDF')) |
|
212 | - { |
|
213 | - $pdf->setPrintHeader(false); |
|
214 | - $pdf->setPrintFooter(false); |
|
215 | - } |
|
216 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
217 | - // Set path to the background PDF File |
|
218 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
219 | - { |
|
220 | - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
221 | - $tplidx = $pdf->importPage(1); |
|
222 | - } |
|
207 | + $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
208 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
209 | + $pdf->SetAutoPageBreak(1,0); |
|
210 | + |
|
211 | + if (class_exists('TCPDF')) |
|
212 | + { |
|
213 | + $pdf->setPrintHeader(false); |
|
214 | + $pdf->setPrintFooter(false); |
|
215 | + } |
|
216 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
217 | + // Set path to the background PDF File |
|
218 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
219 | + { |
|
220 | + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
221 | + $tplidx = $pdf->importPage(1); |
|
222 | + } |
|
223 | 223 | |
224 | 224 | $pdf->Open(); |
225 | 225 | $pagenb=0; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | $localtax2_type = $localtaxtmp_array[2]; |
524 | 524 | } |
525 | 525 | |
526 | - // retrieve global local tax |
|
526 | + // retrieve global local tax |
|
527 | 527 | if ($localtax1_type && $localtax1ligne != 0) |
528 | 528 | $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
529 | 529 | if ($localtax2_type && $localtax2ligne != 0) |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | /** |
657 | 657 | * Show payments table |
658 | - * |
|
658 | + * |
|
659 | 659 | * @param PDF $pdf Object PDF |
660 | 660 | * @param Object $object Object order |
661 | 661 | * @param int $posy Position y in PDF |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | |
685 | 685 | $pdf->SetFont('','', $default_font_size - 1); |
686 | 686 | |
687 | - // If France, show VAT mention if not applicable |
|
687 | + // If France, show VAT mention if not applicable |
|
688 | 688 | if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) |
689 | 689 | { |
690 | 690 | $pdf->SetFont('','B', $default_font_size - 2); |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | $posy=$pdf->GetY()+3; |
714 | 714 | } |
715 | 715 | |
716 | - // Check a payment mode is defined |
|
717 | - /* Not used with orders |
|
716 | + // Check a payment mode is defined |
|
717 | + /* Not used with orders |
|
718 | 718 | if (empty($object->mode_reglement_code) |
719 | 719 | && ! $conf->global->FACTURE_CHQ_NUMBER |
720 | 720 | && ! $conf->global->FACTURE_RIB_NUMBER) |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | $posy=$pdf->GetY()+1; |
741 | 741 | }*/ |
742 | 742 | |
743 | - // Show planed date of delivery |
|
744 | - if (! empty($object->date_livraison)) |
|
743 | + // Show planed date of delivery |
|
744 | + if (! empty($object->date_livraison)) |
|
745 | 745 | { |
746 | - $outputlangs->load("sendings"); |
|
746 | + $outputlangs->load("sendings"); |
|
747 | 747 | $pdf->SetFont('','B', $default_font_size - 2); |
748 | 748 | $pdf->SetXY($this->marge_gauche, $posy); |
749 | 749 | $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; |
@@ -753,9 +753,9 @@ discard block |
||
753 | 753 | $dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); |
754 | 754 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
755 | 755 | |
756 | - $posy=$pdf->GetY()+1; |
|
756 | + $posy=$pdf->GetY()+1; |
|
757 | 757 | } |
758 | - elseif ($object->availability_code || $object->availability) // Show availability conditions |
|
758 | + elseif ($object->availability_code || $object->availability) // Show availability conditions |
|
759 | 759 | { |
760 | 760 | $pdf->SetFont('','B', $default_font_size - 2); |
761 | 761 | $pdf->SetXY($this->marge_gauche, $posy); |
@@ -771,70 +771,70 @@ discard block |
||
771 | 771 | $posy=$pdf->GetY()+1; |
772 | 772 | } |
773 | 773 | |
774 | - // Show payment mode |
|
775 | - if ($object->mode_reglement_code |
|
776 | - && $object->mode_reglement_code != 'CHQ' |
|
777 | - && $object->mode_reglement_code != 'VIR') |
|
778 | - { |
|
779 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
780 | - $pdf->SetXY($this->marge_gauche, $posy); |
|
781 | - $titre = $outputlangs->transnoentities("PaymentMode").':'; |
|
782 | - $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
|
774 | + // Show payment mode |
|
775 | + if ($object->mode_reglement_code |
|
776 | + && $object->mode_reglement_code != 'CHQ' |
|
777 | + && $object->mode_reglement_code != 'VIR') |
|
778 | + { |
|
779 | + $pdf->SetFont('','B', $default_font_size - 2); |
|
780 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
781 | + $titre = $outputlangs->transnoentities("PaymentMode").':'; |
|
782 | + $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
|
783 | 783 | |
784 | 784 | $pdf->SetFont('','', $default_font_size - 2); |
785 | - $pdf->SetXY($posxval, $posy); |
|
786 | - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
787 | - $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
785 | + $pdf->SetXY($posxval, $posy); |
|
786 | + $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
787 | + $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
788 | 788 | |
789 | - $posy=$pdf->GetY()+2; |
|
790 | - } |
|
789 | + $posy=$pdf->GetY()+2; |
|
790 | + } |
|
791 | 791 | |
792 | 792 | // Show payment mode CHQ |
793 | - if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
|
794 | - { |
|
795 | - // Si mode reglement non force ou si force a CHQ |
|
796 | - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
797 | - { |
|
798 | - if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
|
799 | - { |
|
800 | - $account = new Account($this->db); |
|
801 | - $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
|
802 | - |
|
803 | - $pdf->SetXY($this->marge_gauche, $posy); |
|
804 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
805 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
806 | - $posy=$pdf->GetY()+1; |
|
807 | - |
|
808 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
809 | - { |
|
810 | - $pdf->SetXY($this->marge_gauche, $posy); |
|
811 | - $pdf->SetFont('','', $default_font_size - 3); |
|
812 | - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
|
813 | - $posy=$pdf->GetY()+2; |
|
814 | - } |
|
815 | - } |
|
816 | - if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
|
817 | - { |
|
818 | - $pdf->SetXY($this->marge_gauche, $posy); |
|
819 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
820 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
821 | - $posy=$pdf->GetY()+1; |
|
822 | - |
|
823 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
824 | - { |
|
825 | - $pdf->SetXY($this->marge_gauche, $posy); |
|
826 | - $pdf->SetFont('','', $default_font_size - 3); |
|
827 | - $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
|
828 | - $posy=$pdf->GetY()+2; |
|
829 | - } |
|
830 | - } |
|
831 | - } |
|
793 | + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
|
794 | + { |
|
795 | + // Si mode reglement non force ou si force a CHQ |
|
796 | + if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
797 | + { |
|
798 | + if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
|
799 | + { |
|
800 | + $account = new Account($this->db); |
|
801 | + $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
|
802 | + |
|
803 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
804 | + $pdf->SetFont('','B', $default_font_size - 3); |
|
805 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
806 | + $posy=$pdf->GetY()+1; |
|
807 | + |
|
808 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
809 | + { |
|
810 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
811 | + $pdf->SetFont('','', $default_font_size - 3); |
|
812 | + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
|
813 | + $posy=$pdf->GetY()+2; |
|
814 | + } |
|
815 | + } |
|
816 | + if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
|
817 | + { |
|
818 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
819 | + $pdf->SetFont('','B', $default_font_size - 3); |
|
820 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
821 | + $posy=$pdf->GetY()+1; |
|
822 | + |
|
823 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
824 | + { |
|
825 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
826 | + $pdf->SetFont('','', $default_font_size - 3); |
|
827 | + $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
|
828 | + $posy=$pdf->GetY()+2; |
|
829 | + } |
|
830 | + } |
|
831 | + } |
|
832 | 832 | } |
833 | 833 | |
834 | - // If payment mode not forced or forced to VIR, show payment with BAN |
|
835 | - if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
|
836 | - { |
|
837 | - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
834 | + // If payment mode not forced or forced to VIR, show payment with BAN |
|
835 | + if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
|
836 | + { |
|
837 | + if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
838 | 838 | { |
839 | 839 | $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); |
840 | 840 | $account = new Account($this->db); |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | |
848 | 848 | $posy+=2; |
849 | 849 | } |
850 | - } |
|
850 | + } |
|
851 | 851 | |
852 | 852 | return $posy; |
853 | 853 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | */ |
866 | 866 | function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) |
867 | 867 | { |
868 | - global $conf,$mysoc; |
|
868 | + global $conf,$mysoc; |
|
869 | 869 | |
870 | 870 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
871 | 871 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | $pdf->SetFont('','', $default_font_size - 1); |
875 | 875 | |
876 | 876 | // Tableau total |
877 | - $col1x = 120; $col2x = 170; |
|
877 | + $col1x = 120; $col2x = 170; |
|
878 | 878 | if ($this->page_largeur < 210) // To work with US executive format |
879 | 879 | { |
880 | 880 | $col2x-=20; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | } |
936 | 936 | } |
937 | 937 | } |
938 | - //} |
|
938 | + //} |
|
939 | 939 | //Local tax 2 before VAT |
940 | 940 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
941 | 941 | //{ |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | } |
1027 | 1027 | } |
1028 | 1028 | } |
1029 | - //} |
|
1029 | + //} |
|
1030 | 1030 | //Local tax 2 after VAT |
1031 | 1031 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1032 | 1032 | //{ |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | |
1076 | 1076 | $pdf->SetTextColor(0,0,0); |
1077 | 1077 | |
1078 | - $creditnoteamount=0; |
|
1079 | - $depositsamount=0; |
|
1078 | + $creditnoteamount=0; |
|
1079 | + $depositsamount=0; |
|
1080 | 1080 | //$creditnoteamount=$object->getSumCreditNotesUsed(); |
1081 | 1081 | //$depositsamount=$object->getSumDepositsUsed(); |
1082 | 1082 | //print "x".$creditnoteamount."-".$depositsamount;exit; |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | // Show Draft Watermark |
1231 | 1231 | if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) |
1232 | 1232 | { |
1233 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); |
|
1233 | + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | $pdf->SetTextColor(0,0,60); |
@@ -1247,8 +1247,8 @@ discard block |
||
1247 | 1247 | { |
1248 | 1248 | if (is_readable($logo)) |
1249 | 1249 | { |
1250 | - $height=pdf_getHeightForLogo($logo); |
|
1251 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1250 | + $height=pdf_getHeightForLogo($logo); |
|
1251 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1252 | 1252 | } |
1253 | 1253 | else |
1254 | 1254 | { |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | |
1387 | 1387 | /** |
1388 | 1388 | * Show footer of page. Need this->emetteur object |
1389 | - * |
|
1389 | + * |
|
1390 | 1390 | * @param PDF $pdf PDF |
1391 | 1391 | * @param Object $object Object to show |
1392 | 1392 | * @param Translate $outputlangs Object lang for output |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * \brief Fichier de la classe permettant de generer les commandes au modele Einstein |
27 | 27 | */ |
28 | 28 | |
29 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/commande/modules_commande.php'; |
|
29 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; |
|
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
31 | 31 | require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | var $description; |
44 | 44 | var $type; |
45 | 45 | |
46 | - var $phpmin = array(4,3,0); // Minimum version of PHP required by module |
|
46 | + var $phpmin = array(4, 3, 0); // Minimum version of PHP required by module |
|
47 | 47 | var $version = 'dolibarr'; |
48 | 48 | |
49 | 49 | var $page_largeur; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | var $marge_haute; |
55 | 55 | var $marge_basse; |
56 | 56 | |
57 | - var $emetteur; // Objet societe qui emet |
|
57 | + var $emetteur; // Objet societe qui emet |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | function __construct($db) |
66 | 66 | { |
67 | - global $conf,$langs,$mysoc; |
|
67 | + global $conf, $langs, $mysoc; |
|
68 | 68 | |
69 | 69 | $langs->load("main"); |
70 | 70 | $langs->load("bills"); |
@@ -76,56 +76,56 @@ discard block |
||
76 | 76 | |
77 | 77 | // Dimension page pour format A4 |
78 | 78 | $this->type = 'pdf'; |
79 | - $formatarray=pdf_getFormat(); |
|
79 | + $formatarray = pdf_getFormat(); |
|
80 | 80 | $this->page_largeur = $formatarray['width']; |
81 | 81 | $this->page_hauteur = $formatarray['height']; |
82 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
83 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
84 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
85 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
86 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
87 | - |
|
88 | - $this->option_logo = 1; // Affiche logo |
|
89 | - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
90 | - $this->option_modereg = 1; // Affiche mode reglement |
|
91 | - $this->option_condreg = 1; // Affiche conditions reglement |
|
92 | - $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
93 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
94 | - $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
95 | - $this->option_credit_note = 0; // Support credit notes |
|
96 | - $this->option_freetext = 1; // Support add of a personalised text |
|
97 | - $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
98 | - |
|
99 | - $this->franchise=!$mysoc->tva_assuj; |
|
82 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
83 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
84 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
85 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
86 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
87 | + |
|
88 | + $this->option_logo = 1; // Affiche logo |
|
89 | + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION |
|
90 | + $this->option_modereg = 1; // Affiche mode reglement |
|
91 | + $this->option_condreg = 1; // Affiche conditions reglement |
|
92 | + $this->option_codeproduitservice = 1; // Affiche code produit-service |
|
93 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
94 | + $this->option_escompte = 0; // Affiche si il y a eu escompte |
|
95 | + $this->option_credit_note = 0; // Support credit notes |
|
96 | + $this->option_freetext = 1; // Support add of a personalised text |
|
97 | + $this->option_draft_watermark = 1; // Support add of a watermark on drafts |
|
98 | + |
|
99 | + $this->franchise = !$mysoc->tva_assuj; |
|
100 | 100 | |
101 | 101 | // Get source company |
102 | - $this->emetteur=$mysoc; |
|
103 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined |
|
102 | + $this->emetteur = $mysoc; |
|
103 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined |
|
104 | 104 | |
105 | 105 | // Define position of columns |
106 | - $this->posxdesc=$this->marge_gauche+1; |
|
107 | - $this->posxtva=112; |
|
108 | - $this->posxup=126; |
|
109 | - $this->posxqty=145; |
|
110 | - $this->posxdiscount=162; |
|
111 | - $this->postotalht=174; |
|
112 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; |
|
113 | - $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
106 | + $this->posxdesc = $this->marge_gauche + 1; |
|
107 | + $this->posxtva = 112; |
|
108 | + $this->posxup = 126; |
|
109 | + $this->posxqty = 145; |
|
110 | + $this->posxdiscount = 162; |
|
111 | + $this->postotalht = 174; |
|
112 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva = $this->posxup; |
|
113 | + $this->posxpicture = $this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
114 | 114 | if ($this->page_largeur < 210) // To work with US executive format |
115 | 115 | { |
116 | - $this->posxpicture-=20; |
|
117 | - $this->posxtva-=20; |
|
118 | - $this->posxup-=20; |
|
119 | - $this->posxqty-=20; |
|
120 | - $this->posxdiscount-=20; |
|
121 | - $this->postotalht-=20; |
|
116 | + $this->posxpicture -= 20; |
|
117 | + $this->posxtva -= 20; |
|
118 | + $this->posxup -= 20; |
|
119 | + $this->posxqty -= 20; |
|
120 | + $this->posxdiscount -= 20; |
|
121 | + $this->postotalht -= 20; |
|
122 | 122 | } |
123 | 123 | |
124 | - $this->tva=array(); |
|
125 | - $this->localtax1=array(); |
|
126 | - $this->localtax2=array(); |
|
127 | - $this->atleastoneratenotnull=0; |
|
128 | - $this->atleastonediscount=0; |
|
124 | + $this->tva = array(); |
|
125 | + $this->localtax1 = array(); |
|
126 | + $this->localtax2 = array(); |
|
127 | + $this->atleastoneratenotnull = 0; |
|
128 | + $this->atleastonediscount = 0; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | * @param int $hideref Do not show ref |
140 | 140 | * @return int 1=OK, 0=KO |
141 | 141 | */ |
142 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
142 | + function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
143 | 143 | { |
144 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
144 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager; |
|
145 | 145 | |
146 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
146 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
147 | 147 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
148 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
148 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
149 | 149 | |
150 | 150 | $outputlangs->load("main"); |
151 | 151 | $outputlangs->load("dict"); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | if ($conf->commande->dir_output) |
161 | 161 | { |
162 | 162 | $object->fetch_thirdparty(); |
163 | - if(!empty($object->client) ){ |
|
163 | + if (!empty($object->client)) { |
|
164 | 164 | $object->thirdparty = $object->client; |
165 | 165 | } |
166 | 166 | $deja_regle = ""; |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | if ($object->specimen) |
170 | 170 | { |
171 | 171 | $dir = $conf->commande->dir_output; |
172 | - $file = $dir . "/SPECIMEN.pdf"; |
|
172 | + $file = $dir."/SPECIMEN.pdf"; |
|
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | 176 | $objectref = dol_sanitizeFileName($object->ref); |
177 | - $dir = $conf->commande->dir_output . "/" . $objectref; |
|
178 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
177 | + $dir = $conf->commande->dir_output."/".$objectref; |
|
178 | + $file = $dir."/".$objectref.".pdf"; |
|
179 | 179 | } |
180 | 180 | |
181 | - if (! file_exists($dir)) |
|
181 | + if (!file_exists($dir)) |
|
182 | 182 | { |
183 | 183 | if (dol_mkdir($dir) < 0) |
184 | 184 | { |
185 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
185 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
186 | 186 | return 0; |
187 | 187 | } |
188 | 188 | } |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | if (file_exists($dir)) |
191 | 191 | { |
192 | 192 | // Add pdfgeneration hook |
193 | - if (! is_object($hookmanager)) |
|
193 | + if (!is_object($hookmanager)) |
|
194 | 194 | { |
195 | 195 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
196 | - $hookmanager=new HookManager($this->db); |
|
196 | + $hookmanager = new HookManager($this->db); |
|
197 | 197 | } |
198 | 198 | $hookmanager->initHooks(array('pdfgeneration')); |
199 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
199 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
200 | 200 | global $action; |
201 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
201 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
202 | 202 | |
203 | 203 | // Create pdf instance |
204 | - $pdf=pdf_getInstance($this->format); |
|
205 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
206 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
207 | - $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page |
|
208 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
209 | - $pdf->SetAutoPageBreak(1,0); |
|
204 | + $pdf = pdf_getInstance($this->format); |
|
205 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
206 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
207 | + $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
|
208 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
209 | + $pdf->SetAutoPageBreak(1, 0); |
|
210 | 210 | |
211 | 211 | if (class_exists('TCPDF')) |
212 | 212 | { |
@@ -215,27 +215,27 @@ discard block |
||
215 | 215 | } |
216 | 216 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
217 | 217 | // Set path to the background PDF File |
218 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
218 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
219 | 219 | { |
220 | 220 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
221 | 221 | $tplidx = $pdf->importPage(1); |
222 | 222 | } |
223 | 223 | |
224 | 224 | $pdf->Open(); |
225 | - $pagenb=0; |
|
226 | - $pdf->SetDrawColor(128,128,128); |
|
225 | + $pagenb = 0; |
|
226 | + $pdf->SetDrawColor(128, 128, 128); |
|
227 | 227 | |
228 | 228 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
229 | 229 | $pdf->SetSubject($outputlangs->transnoentities("Order")); |
230 | 230 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
231 | 231 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
232 | 232 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); |
233 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
233 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
234 | 234 | |
235 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
235 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
236 | 236 | |
237 | 237 | // Positionne $this->atleastonediscount si on a au moins une remise |
238 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
238 | + for ($i = 0; $i < $nblignes; $i++) |
|
239 | 239 | { |
240 | 240 | if ($object->lines[$i]->remise_percent) |
241 | 241 | { |
@@ -244,61 +244,61 @@ discard block |
||
244 | 244 | } |
245 | 245 | if (empty($this->atleastonediscount)) |
246 | 246 | { |
247 | - $this->posxpicture+=($this->postotalht - $this->posxdiscount); |
|
248 | - $this->posxtva+=($this->postotalht - $this->posxdiscount); |
|
249 | - $this->posxup+=($this->postotalht - $this->posxdiscount); |
|
250 | - $this->posxqty+=($this->postotalht - $this->posxdiscount); |
|
251 | - $this->posxdiscount+=($this->postotalht - $this->posxdiscount); |
|
247 | + $this->posxpicture += ($this->postotalht - $this->posxdiscount); |
|
248 | + $this->posxtva += ($this->postotalht - $this->posxdiscount); |
|
249 | + $this->posxup += ($this->postotalht - $this->posxdiscount); |
|
250 | + $this->posxqty += ($this->postotalht - $this->posxdiscount); |
|
251 | + $this->posxdiscount += ($this->postotalht - $this->posxdiscount); |
|
252 | 252 | //$this->postotalht; |
253 | 253 | } |
254 | 254 | |
255 | 255 | // New page |
256 | 256 | $pdf->AddPage(); |
257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
257 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
258 | 258 | $pagenb++; |
259 | 259 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
260 | - $pdf->SetFont('','', $default_font_size - 1); |
|
261 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
262 | - $pdf->SetTextColor(0,0,0); |
|
260 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
261 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
262 | + $pdf->SetTextColor(0, 0, 0); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | $tab_top = 90; |
266 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
266 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
267 | 267 | $tab_height = 130; |
268 | 268 | $tab_height_newpage = 150; |
269 | 269 | |
270 | 270 | // Affiche notes |
271 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
272 | - if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
271 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
272 | + if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) |
|
273 | 273 | { |
274 | 274 | // Get first sale rep |
275 | 275 | if (is_object($object->thirdparty)) |
276 | 276 | { |
277 | - $salereparray=$object->thirdparty->getSalesRepresentatives($user); |
|
278 | - $salerepobj=new User($this->db); |
|
277 | + $salereparray = $object->thirdparty->getSalesRepresentatives($user); |
|
278 | + $salerepobj = new User($this->db); |
|
279 | 279 | $salerepobj->fetch($salereparray[0]['id']); |
280 | - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
280 | + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | if ($notetoshow) |
284 | 284 | { |
285 | 285 | $tab_top = 88; |
286 | 286 | |
287 | - $pdf->SetFont('','', $default_font_size - 1); |
|
288 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
287 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
288 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
289 | 289 | $nexY = $pdf->GetY(); |
290 | - $height_note=$nexY-$tab_top; |
|
290 | + $height_note = $nexY - $tab_top; |
|
291 | 291 | |
292 | 292 | // Rect prend une longueur en 3eme param |
293 | - $pdf->SetDrawColor(192,192,192); |
|
294 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
293 | + $pdf->SetDrawColor(192, 192, 192); |
|
294 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
295 | 295 | |
296 | 296 | $tab_height = $tab_height - $height_note; |
297 | - $tab_top = $nexY+6; |
|
297 | + $tab_top = $nexY + 6; |
|
298 | 298 | } |
299 | 299 | else |
300 | 300 | { |
301 | - $height_note=0; |
|
301 | + $height_note = 0; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | $iniY = $tab_top + 7; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $TStack = array(); |
313 | 313 | |
314 | 314 | // Loop on each lines |
315 | - for ($i = 0 ; $i < $nblignes ; $i++) |
|
315 | + for ($i = 0; $i < $nblignes; $i++) |
|
316 | 316 | { |
317 | 317 | $package_qty = $TStack[count($TStack) - 1]['package_qty']; |
318 | 318 | $inPackage = count($TStack) > 0; |
@@ -376,44 +376,44 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | $curY = $nexY; |
379 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
380 | - $pdf->SetTextColor(0,0,0); |
|
379 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
380 | + $pdf->SetTextColor(0, 0, 0); |
|
381 | 381 | |
382 | 382 | $pdf->setTopMargin($tab_top_newpage); |
383 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
384 | - $pageposbefore=$pdf->getPage(); |
|
383 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
384 | + $pageposbefore = $pdf->getPage(); |
|
385 | 385 | |
386 | 386 | // Description of product line |
387 | - $curX = $this->posxdesc-1; |
|
387 | + $curX = $this->posxdesc - 1; |
|
388 | 388 | |
389 | - $showpricebeforepagebreak=1; |
|
389 | + $showpricebeforepagebreak = 1; |
|
390 | 390 | |
391 | 391 | $pdf->startTransaction(); |
392 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); |
|
393 | - $pageposafter=$pdf->getPage(); |
|
392 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 3, $curX, $curY, $hideref, $hidedesc); |
|
393 | + $pageposafter = $pdf->getPage(); |
|
394 | 394 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
395 | 395 | { |
396 | 396 | $pdf->rollbackTransaction(true); |
397 | - $pageposafter=$pageposbefore; |
|
397 | + $pageposafter = $pageposbefore; |
|
398 | 398 | //print $pageposafter.'-'.$pageposbefore;exit; |
399 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
400 | - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); |
|
401 | - $pageposafter=$pdf->getPage(); |
|
402 | - $posyafter=$pdf->GetY(); |
|
403 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
399 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
400 | + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->posxtva - $curX, 4, $curX, $curY, $hideref, $hidedesc); |
|
401 | + $pageposafter = $pdf->getPage(); |
|
402 | + $posyafter = $pdf->GetY(); |
|
403 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
404 | 404 | { |
405 | - if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
|
405 | + if ($i == ($nblignes - 1)) // No more lines, and no space left to show total, so we create a new page |
|
406 | 406 | { |
407 | - $pdf->AddPage('','',true); |
|
408 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
407 | + $pdf->AddPage('', '', true); |
|
408 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
409 | 409 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
410 | - $pdf->setPage($pageposafter+1); |
|
410 | + $pdf->setPage($pageposafter + 1); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | else |
414 | 414 | { |
415 | 415 | // We found a page break |
416 | - $showpricebeforepagebreak=0; |
|
416 | + $showpricebeforepagebreak = 0; |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | else // No pagebreak |
@@ -422,17 +422,17 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | $nexY = $pdf->GetY(); |
425 | - $pageposafter=$pdf->getPage(); |
|
425 | + $pageposafter = $pdf->getPage(); |
|
426 | 426 | $pdf->setPage($pageposbefore); |
427 | 427 | $pdf->setTopMargin($this->marge_haute); |
428 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
428 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
429 | 429 | |
430 | 430 | // We suppose that a too long description is moved completely on next page |
431 | 431 | if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { |
432 | 432 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
433 | 433 | } |
434 | 434 | |
435 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
435 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
436 | 436 | |
437 | 437 | // VAT Rate |
438 | 438 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | $pdf->SetXY($this->posxtva, $curY); |
448 | - $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); |
|
448 | + $pdf->MultiCell($this->posxup - $this->posxtva - 0.8, 3, $vat_rate, 0, 'R'); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | // Unit price before discount |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | } |
457 | 457 | |
458 | 458 | $pdf->SetXY($this->posxup, $curY); |
459 | - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
459 | + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); |
|
460 | 460 | |
461 | 461 | // Booléen pour déterminer s'il s'agit d'une ligne de titre ou non |
462 | 462 | $isTitle = false; |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | $pdf->SetXY($this->posxqty, $curY); |
481 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
481 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 0.8, 3, $qty, 0, 'R'); // Enough for 6 chars |
|
482 | 482 | |
483 | 483 | // Discount on line |
484 | 484 | if ($object->lines[$i]->remise_percent) |
485 | 485 | { |
486 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
486 | + $pdf->SetXY($this->posxdiscount - 2, $curY); |
|
487 | 487 | $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
488 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
|
488 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 2, 3, $remise_percent, 0, 'R'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | // Total HT line |
@@ -496,41 +496,41 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | $pdf->SetXY($this->postotalht, $curY); |
499 | - $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
499 | + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); |
|
500 | 500 | |
501 | 501 | // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva |
502 | - $tvaligne=$object->lines[$i]->total_tva; |
|
502 | + $tvaligne = $object->lines[$i]->total_tva; |
|
503 | 503 | |
504 | - $localtax1ligne=$object->lines[$i]->total_localtax1; |
|
505 | - $localtax2ligne=$object->lines[$i]->total_localtax2; |
|
506 | - $localtax1_rate=$object->lines[$i]->localtax1_tx; |
|
507 | - $localtax2_rate=$object->lines[$i]->localtax2_tx; |
|
508 | - $localtax1_type=$object->lines[$i]->localtax1_type; |
|
509 | - $localtax2_type=$object->lines[$i]->localtax2_type; |
|
504 | + $localtax1ligne = $object->lines[$i]->total_localtax1; |
|
505 | + $localtax2ligne = $object->lines[$i]->total_localtax2; |
|
506 | + $localtax1_rate = $object->lines[$i]->localtax1_tx; |
|
507 | + $localtax2_rate = $object->lines[$i]->localtax2_tx; |
|
508 | + $localtax1_type = $object->lines[$i]->localtax1_type; |
|
509 | + $localtax2_type = $object->lines[$i]->localtax2_type; |
|
510 | 510 | |
511 | - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
512 | - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
513 | - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
511 | + if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100; |
|
512 | + if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100; |
|
513 | + if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100; |
|
514 | 514 | |
515 | - $vatrate=(string) $object->lines[$i]->tva_tx; |
|
515 | + $vatrate = (string) $object->lines[$i]->tva_tx; |
|
516 | 516 | |
517 | 517 | // Retrieve type from database for backward compatibility with old records |
518 | - if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined |
|
519 | - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax |
|
518 | + if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined |
|
519 | + && (!empty($localtax1_rate) || !empty($localtax2_rate))) // and there is local tax |
|
520 | 520 | { |
521 | - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); |
|
521 | + $localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc); |
|
522 | 522 | $localtax1_type = $localtaxtmp_array[0]; |
523 | 523 | $localtax2_type = $localtaxtmp_array[2]; |
524 | 524 | } |
525 | 525 | |
526 | 526 | // retrieve global local tax |
527 | 527 | if ($localtax1_type && $localtax1ligne != 0) |
528 | - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
528 | + $this->localtax1[$localtax1_type][$localtax1_rate] += $localtax1ligne; |
|
529 | 529 | if ($localtax2_type && $localtax2ligne != 0) |
530 | - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
530 | + $this->localtax2[$localtax2_type][$localtax2_rate] += $localtax2ligne; |
|
531 | 531 | |
532 | - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; |
|
533 | - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; |
|
532 | + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate .= '*'; |
|
533 | + if (!isset($this->tva[$vatrate])) $this->tva[$vatrate] = ''; |
|
534 | 534 | |
535 | 535 | if (!empty($object->lines[$i]->TTotal_tva)) |
536 | 536 | { |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | } |
546 | 546 | |
547 | 547 | // Add line |
548 | - if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
548 | + if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) |
|
549 | 549 | { |
550 | 550 | $pdf->setPage($pageposafter); |
551 | - $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210))); |
|
551 | + $pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(210, 210, 210))); |
|
552 | 552 | //$pdf->SetDrawColor(190,190,200); |
553 | - $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); |
|
553 | + $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1); |
|
554 | 554 | $pdf->SetLineStyle(array('dash'=>0)); |
555 | 555 | } |
556 | 556 | |
557 | - $nexY+=2; // Passe espace entre les lignes |
|
557 | + $nexY += 2; // Passe espace entre les lignes |
|
558 | 558 | |
559 | 559 | // Detect if some page were added automatically and output _tableau for past pages |
560 | 560 | while ($pagenb < $pageposafter) |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | { |
569 | 569 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
570 | 570 | } |
571 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
571 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
572 | 572 | $pagenb++; |
573 | 573 | $pdf->setPage($pagenb); |
574 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
574 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
575 | 575 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
576 | 576 | } |
577 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
577 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
578 | 578 | { |
579 | 579 | if ($pagenb == 1) |
580 | 580 | { |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | { |
585 | 585 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
586 | 586 | } |
587 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
587 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
588 | 588 | // New page |
589 | 589 | $pdf->AddPage(); |
590 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
590 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
591 | 591 | $pagenb++; |
592 | 592 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
593 | 593 | } |
@@ -597,60 +597,60 @@ discard block |
||
597 | 597 | if ($pagenb == 1) |
598 | 598 | { |
599 | 599 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
600 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
600 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
601 | 601 | } |
602 | 602 | else |
603 | 603 | { |
604 | 604 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
605 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
605 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
606 | 606 | } |
607 | 607 | |
608 | 608 | // Affiche zone infos |
609 | - $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
609 | + $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); |
|
610 | 610 | |
611 | 611 | if (!$conf->global->SUBTOTAL_HIDE_DOCUMENT_TOTAL) { |
612 | 612 | // Affiche zone totaux |
613 | - $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
613 | + $posy = $this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | // Affiche zone versements |
617 | 617 | if ($deja_regle) |
618 | 618 | { |
619 | - $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
619 | + $posy = $this->_tableau_versements($pdf, $object, $posy, $outputlangs); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | // Pied de page |
623 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
624 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
623 | + $this->_pagefoot($pdf, $object, $outputlangs); |
|
624 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
625 | 625 | |
626 | 626 | $pdf->Close(); |
627 | 627 | |
628 | - $pdf->Output($file,'F'); |
|
628 | + $pdf->Output($file, 'F'); |
|
629 | 629 | |
630 | 630 | // Add pdfgeneration hook |
631 | 631 | $hookmanager->initHooks(array('pdfgeneration')); |
632 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
632 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
633 | 633 | global $action; |
634 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
634 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
635 | 635 | |
636 | - if (! empty($conf->global->MAIN_UMASK)) |
|
636 | + if (!empty($conf->global->MAIN_UMASK)) |
|
637 | 637 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
638 | 638 | |
639 | - return 1; // Pas d'erreur |
|
639 | + return 1; // Pas d'erreur |
|
640 | 640 | } |
641 | 641 | else |
642 | 642 | { |
643 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
643 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
644 | 644 | return 0; |
645 | 645 | } |
646 | 646 | } |
647 | 647 | else |
648 | 648 | { |
649 | - $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); |
|
649 | + $this->error = $langs->trans("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); |
|
650 | 650 | return 0; |
651 | 651 | } |
652 | - $this->error=$langs->trans("ErrorUnknown"); |
|
653 | - return 0; // Erreur par defaut |
|
652 | + $this->error = $langs->trans("ErrorUnknown"); |
|
653 | + return 0; // Erreur par defaut |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -682,35 +682,35 @@ discard block |
||
682 | 682 | global $conf; |
683 | 683 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
684 | 684 | |
685 | - $pdf->SetFont('','', $default_font_size - 1); |
|
685 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
686 | 686 | |
687 | 687 | // If France, show VAT mention if not applicable |
688 | 688 | if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) |
689 | 689 | { |
690 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
690 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
691 | 691 | $pdf->SetXY($this->marge_gauche, $posy); |
692 | 692 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0); |
693 | 693 | |
694 | - $posy=$pdf->GetY()+4; |
|
694 | + $posy = $pdf->GetY() + 4; |
|
695 | 695 | } |
696 | 696 | |
697 | - $posxval=52; |
|
697 | + $posxval = 52; |
|
698 | 698 | |
699 | 699 | // Show payments conditions |
700 | 700 | if ($object->cond_reglement_code || $object->cond_reglement) |
701 | 701 | { |
702 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
702 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
703 | 703 | $pdf->SetXY($this->marge_gauche, $posy); |
704 | 704 | $titre = $outputlangs->transnoentities("PaymentConditions").':'; |
705 | 705 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
706 | 706 | |
707 | - $pdf->SetFont('','', $default_font_size - 2); |
|
707 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
708 | 708 | $pdf->SetXY($posxval, $posy); |
709 | - $lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code)!=('PaymentCondition'.$object->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code):$outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
710 | - $lib_condition_paiement=str_replace('\n',"\n",$lib_condition_paiement); |
|
711 | - $pdf->MultiCell(80, 4, $lib_condition_paiement,0,'L'); |
|
709 | + $lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) != ('PaymentCondition'.$object->cond_reglement_code) ? $outputlangs->transnoentities("PaymentCondition".$object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc); |
|
710 | + $lib_condition_paiement = str_replace('\n', "\n", $lib_condition_paiement); |
|
711 | + $pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L'); |
|
712 | 712 | |
713 | - $posy=$pdf->GetY()+3; |
|
713 | + $posy = $pdf->GetY() + 3; |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | // Check a payment mode is defined |
@@ -741,34 +741,34 @@ discard block |
||
741 | 741 | }*/ |
742 | 742 | |
743 | 743 | // Show planed date of delivery |
744 | - if (! empty($object->date_livraison)) |
|
744 | + if (!empty($object->date_livraison)) |
|
745 | 745 | { |
746 | 746 | $outputlangs->load("sendings"); |
747 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
747 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
748 | 748 | $pdf->SetXY($this->marge_gauche, $posy); |
749 | 749 | $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; |
750 | 750 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
751 | - $pdf->SetFont('','', $default_font_size - 2); |
|
751 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
752 | 752 | $pdf->SetXY($posxval, $posy); |
753 | - $dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); |
|
753 | + $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); |
|
754 | 754 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
755 | 755 | |
756 | - $posy=$pdf->GetY()+1; |
|
756 | + $posy = $pdf->GetY() + 1; |
|
757 | 757 | } |
758 | 758 | elseif ($object->availability_code || $object->availability) // Show availability conditions |
759 | 759 | { |
760 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
760 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
761 | 761 | $pdf->SetXY($this->marge_gauche, $posy); |
762 | 762 | $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; |
763 | 763 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
764 | - $pdf->SetTextColor(0,0,0); |
|
765 | - $pdf->SetFont('','', $default_font_size - 2); |
|
764 | + $pdf->SetTextColor(0, 0, 0); |
|
765 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
766 | 766 | $pdf->SetXY($posxval, $posy); |
767 | - $lib_availability=$outputlangs->transnoentities("AvailabilityType".$object->availability_code)!=('AvailabilityType'.$object->availability_code)?$outputlangs->transnoentities("AvailabilityType".$object->availability_code):$outputlangs->convToOutputCharset(isset($object->availability)?$object->availability:''); |
|
768 | - $lib_availability=str_replace('\n',"\n",$lib_availability); |
|
767 | + $lib_availability = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); |
|
768 | + $lib_availability = str_replace('\n', "\n", $lib_availability); |
|
769 | 769 | $pdf->MultiCell(80, 4, $lib_availability, 0, 'L'); |
770 | 770 | |
771 | - $posy=$pdf->GetY()+1; |
|
771 | + $posy = $pdf->GetY() + 1; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | // Show payment mode |
@@ -776,24 +776,24 @@ discard block |
||
776 | 776 | && $object->mode_reglement_code != 'CHQ' |
777 | 777 | && $object->mode_reglement_code != 'VIR') |
778 | 778 | { |
779 | - $pdf->SetFont('','B', $default_font_size - 2); |
|
779 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
780 | 780 | $pdf->SetXY($this->marge_gauche, $posy); |
781 | 781 | $titre = $outputlangs->transnoentities("PaymentMode").':'; |
782 | 782 | $pdf->MultiCell(80, 5, $titre, 0, 'L'); |
783 | 783 | |
784 | - $pdf->SetFont('','', $default_font_size - 2); |
|
784 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
785 | 785 | $pdf->SetXY($posxval, $posy); |
786 | - $lib_mode_reg=$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code)!=('PaymentType'.$object->mode_reglement_code)?$outputlangs->transnoentities("PaymentType".$object->mode_reglement_code):$outputlangs->convToOutputCharset($object->mode_reglement); |
|
787 | - $pdf->MultiCell(80, 5, $lib_mode_reg,0,'L'); |
|
786 | + $lib_mode_reg = $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) != ('PaymentType'.$object->mode_reglement_code) ? $outputlangs->transnoentities("PaymentType".$object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement); |
|
787 | + $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); |
|
788 | 788 | |
789 | - $posy=$pdf->GetY()+2; |
|
789 | + $posy = $pdf->GetY() + 2; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // Show payment mode CHQ |
793 | 793 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') |
794 | 794 | { |
795 | 795 | // Si mode reglement non force ou si force a CHQ |
796 | - if (! empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
796 | + if (!empty($conf->global->FACTURE_CHQ_NUMBER)) |
|
797 | 797 | { |
798 | 798 | if ($conf->global->FACTURE_CHQ_NUMBER > 0) |
799 | 799 | { |
@@ -801,31 +801,31 @@ discard block |
||
801 | 801 | $account->fetch($conf->global->FACTURE_CHQ_NUMBER); |
802 | 802 | |
803 | 803 | $pdf->SetXY($this->marge_gauche, $posy); |
804 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
805 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
|
806 | - $posy=$pdf->GetY()+1; |
|
804 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
805 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); |
|
806 | + $posy = $pdf->GetY() + 1; |
|
807 | 807 | |
808 | 808 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
809 | 809 | { |
810 | 810 | $pdf->SetXY($this->marge_gauche, $posy); |
811 | - $pdf->SetFont('','', $default_font_size - 3); |
|
811 | + $pdf->SetFont('', '', $default_font_size - 3); |
|
812 | 812 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
813 | - $posy=$pdf->GetY()+2; |
|
813 | + $posy = $pdf->GetY() + 2; |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
817 | 817 | { |
818 | 818 | $pdf->SetXY($this->marge_gauche, $posy); |
819 | - $pdf->SetFont('','B', $default_font_size - 3); |
|
820 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
|
821 | - $posy=$pdf->GetY()+1; |
|
819 | + $pdf->SetFont('', 'B', $default_font_size - 3); |
|
820 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); |
|
821 | + $posy = $pdf->GetY() + 1; |
|
822 | 822 | |
823 | 823 | if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
824 | 824 | { |
825 | 825 | $pdf->SetXY($this->marge_gauche, $posy); |
826 | - $pdf->SetFont('','', $default_font_size - 3); |
|
826 | + $pdf->SetFont('', '', $default_font_size - 3); |
|
827 | 827 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
828 | - $posy=$pdf->GetY()+2; |
|
828 | + $posy = $pdf->GetY() + 2; |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | } |
@@ -834,18 +834,18 @@ discard block |
||
834 | 834 | // If payment mode not forced or forced to VIR, show payment with BAN |
835 | 835 | if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') |
836 | 836 | { |
837 | - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) |
|
837 | + if (!empty($object->fk_bank) || !empty($conf->global->FACTURE_RIB_NUMBER)) |
|
838 | 838 | { |
839 | - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); |
|
839 | + $bankid = (empty($object->fk_bank) ? $conf->global->FACTURE_RIB_NUMBER : $object->fk_bank); |
|
840 | 840 | $account = new Account($this->db); |
841 | 841 | $account->fetch($bankid); |
842 | 842 | |
843 | - $curx=$this->marge_gauche; |
|
844 | - $cury=$posy; |
|
843 | + $curx = $this->marge_gauche; |
|
844 | + $cury = $posy; |
|
845 | 845 | |
846 | - $posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account,0,$default_font_size); |
|
846 | + $posy = pdf_bank($pdf, $outputlangs, $curx, $cury, $account, 0, $default_font_size); |
|
847 | 847 | |
848 | - $posy+=2; |
|
848 | + $posy += 2; |
|
849 | 849 | } |
850 | 850 | } |
851 | 851 | |
@@ -865,41 +865,41 @@ discard block |
||
865 | 865 | */ |
866 | 866 | function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) |
867 | 867 | { |
868 | - global $conf,$mysoc; |
|
868 | + global $conf, $mysoc; |
|
869 | 869 | |
870 | 870 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
871 | 871 | |
872 | 872 | $tab2_top = $posy; |
873 | 873 | $tab2_hl = 4; |
874 | - $pdf->SetFont('','', $default_font_size - 1); |
|
874 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
875 | 875 | |
876 | 876 | // Tableau total |
877 | 877 | $col1x = 120; $col2x = 170; |
878 | 878 | if ($this->page_largeur < 210) // To work with US executive format |
879 | 879 | { |
880 | - $col2x-=20; |
|
880 | + $col2x -= 20; |
|
881 | 881 | } |
882 | 882 | $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); |
883 | 883 | |
884 | - $useborder=0; |
|
884 | + $useborder = 0; |
|
885 | 885 | $index = 0; |
886 | 886 | |
887 | 887 | // Total HT |
888 | - $pdf->SetFillColor(255,255,255); |
|
888 | + $pdf->SetFillColor(255, 255, 255); |
|
889 | 889 | $pdf->SetXY($col1x, $tab2_top + 0); |
890 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
890 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); |
|
891 | 891 | |
892 | 892 | $pdf->SetXY($col2x, $tab2_top + 0); |
893 | - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0), 0, $outputlangs), 0, 'R', 1); |
|
893 | + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); |
|
894 | 894 | |
895 | 895 | // Show VAT by rates and total |
896 | - $pdf->SetFillColor(248,248,248); |
|
896 | + $pdf->SetFillColor(248, 248, 248); |
|
897 | 897 | |
898 | - $this->atleastoneratenotnull=0; |
|
898 | + $this->atleastoneratenotnull = 0; |
|
899 | 899 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
900 | 900 | { |
901 | - $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
902 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
901 | + $tvaisnull = ((!empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false); |
|
902 | + if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
|
903 | 903 | { |
904 | 904 | // Nothing to do |
905 | 905 | } |
@@ -908,27 +908,27 @@ discard block |
||
908 | 908 | //Local tax 1 before VAT |
909 | 909 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
910 | 910 | //{ |
911 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
911 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
912 | 912 | { |
913 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
914 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
913 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
914 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
915 | 915 | { |
916 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
916 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
917 | 917 | { |
918 | 918 | //$this->atleastoneratenotnull++; |
919 | 919 | |
920 | 920 | $index++; |
921 | 921 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
922 | 922 | |
923 | - $tvacompl=''; |
|
924 | - if (preg_match('/\*/',$tvakey)) |
|
923 | + $tvacompl = ''; |
|
924 | + if (preg_match('/\*/', $tvakey)) |
|
925 | 925 | { |
926 | - $tvakey=str_replace('*','',$tvakey); |
|
926 | + $tvakey = str_replace('*', '', $tvakey); |
|
927 | 927 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
928 | 928 | } |
929 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
930 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
931 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
929 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
930 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
931 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
932 | 932 | |
933 | 933 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
934 | 934 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -939,12 +939,12 @@ discard block |
||
939 | 939 | //Local tax 2 before VAT |
940 | 940 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
941 | 941 | //{ |
942 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
942 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
943 | 943 | { |
944 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
945 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
944 | + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; |
|
945 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
946 | 946 | { |
947 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
947 | + if ($tvakey != 0) // On affiche pas taux 0 |
|
948 | 948 | { |
949 | 949 | //$this->atleastoneratenotnull++; |
950 | 950 | |
@@ -953,15 +953,15 @@ discard block |
||
953 | 953 | $index++; |
954 | 954 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
955 | 955 | |
956 | - $tvacompl=''; |
|
957 | - if (preg_match('/\*/',$tvakey)) |
|
956 | + $tvacompl = ''; |
|
957 | + if (preg_match('/\*/', $tvakey)) |
|
958 | 958 | { |
959 | - $tvakey=str_replace('*','',$tvakey); |
|
959 | + $tvakey = str_replace('*', '', $tvakey); |
|
960 | 960 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
961 | 961 | } |
962 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
963 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
964 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
962 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
963 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
964 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
965 | 965 | |
966 | 966 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
967 | 967 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | } |
972 | 972 | //} |
973 | 973 | // VAT |
974 | - foreach($this->tva as $tvakey => $tvaval) |
|
974 | + foreach ($this->tva as $tvakey => $tvaval) |
|
975 | 975 | { |
976 | 976 | if ($tvakey > 0) // On affiche pas taux 0 |
977 | 977 | { |
@@ -980,15 +980,15 @@ discard block |
||
980 | 980 | $index++; |
981 | 981 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
982 | 982 | |
983 | - $tvacompl=''; |
|
984 | - if (preg_match('/\*/',$tvakey)) |
|
983 | + $tvacompl = ''; |
|
984 | + if (preg_match('/\*/', $tvakey)) |
|
985 | 985 | { |
986 | - $tvakey=str_replace('*','',$tvakey); |
|
986 | + $tvakey = str_replace('*', '', $tvakey); |
|
987 | 987 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
988 | 988 | } |
989 | - $totalvat =$outputlangs->transnoentities("TotalVAT").' '; |
|
990 | - $totalvat.=vatrate($tvakey,1).$tvacompl; |
|
991 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
989 | + $totalvat = $outputlangs->transnoentities("TotalVAT").' '; |
|
990 | + $totalvat .= vatrate($tvakey, 1).$tvacompl; |
|
991 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
992 | 992 | |
993 | 993 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
994 | 994 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | //Local tax 1 after VAT |
999 | 999 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
1000 | 1000 | //{ |
1001 | - foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
|
1001 | + foreach ($this->localtax1 as $localtax_type => $localtax_rate) |
|
1002 | 1002 | { |
1003 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
1003 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
1004 | 1004 | |
1005 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
1005 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
1006 | 1006 | { |
1007 | 1007 | if ($tvakey != 0) // On affiche pas taux 0 |
1008 | 1008 | { |
@@ -1011,16 +1011,16 @@ discard block |
||
1011 | 1011 | $index++; |
1012 | 1012 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1013 | 1013 | |
1014 | - $tvacompl=''; |
|
1015 | - if (preg_match('/\*/',$tvakey)) |
|
1014 | + $tvacompl = ''; |
|
1015 | + if (preg_match('/\*/', $tvakey)) |
|
1016 | 1016 | { |
1017 | - $tvakey=str_replace('*','',$tvakey); |
|
1017 | + $tvakey = str_replace('*', '', $tvakey); |
|
1018 | 1018 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
1019 | 1019 | } |
1020 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; |
|
1020 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; |
|
1021 | 1021 | |
1022 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
1023 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1022 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
1023 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1024 | 1024 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1025 | 1025 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
1026 | 1026 | } |
@@ -1030,11 +1030,11 @@ discard block |
||
1030 | 1030 | //Local tax 2 after VAT |
1031 | 1031 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1032 | 1032 | //{ |
1033 | - foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
|
1033 | + foreach ($this->localtax2 as $localtax_type => $localtax_rate) |
|
1034 | 1034 | { |
1035 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
1035 | + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; |
|
1036 | 1036 | |
1037 | - foreach( $localtax_rate as $tvakey => $tvaval ) |
|
1037 | + foreach ($localtax_rate as $tvakey => $tvaval) |
|
1038 | 1038 | { |
1039 | 1039 | if ($tvakey != 0) // On affiche pas taux 0 |
1040 | 1040 | { |
@@ -1043,16 +1043,16 @@ discard block |
||
1043 | 1043 | $index++; |
1044 | 1044 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1045 | 1045 | |
1046 | - $tvacompl=''; |
|
1047 | - if (preg_match('/\*/',$tvakey)) |
|
1046 | + $tvacompl = ''; |
|
1047 | + if (preg_match('/\*/', $tvakey)) |
|
1048 | 1048 | { |
1049 | - $tvakey=str_replace('*','',$tvakey); |
|
1049 | + $tvakey = str_replace('*', '', $tvakey); |
|
1050 | 1050 | $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; |
1051 | 1051 | } |
1052 | - $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; |
|
1052 | + $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; |
|
1053 | 1053 | |
1054 | - $totalvat.=vatrate(abs($tvakey),1).$tvacompl; |
|
1055 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1054 | + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; |
|
1055 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); |
|
1056 | 1056 | |
1057 | 1057 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1058 | 1058 | $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); |
@@ -1064,24 +1064,24 @@ discard block |
||
1064 | 1064 | // Total TTC |
1065 | 1065 | $index++; |
1066 | 1066 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1067 | - $pdf->SetTextColor(0,0,60); |
|
1068 | - $pdf->SetFillColor(224,224,224); |
|
1069 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1067 | + $pdf->SetTextColor(0, 0, 60); |
|
1068 | + $pdf->SetFillColor(224, 224, 224); |
|
1069 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); |
|
1070 | 1070 | |
1071 | 1071 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1072 | 1072 | $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc, 0, $outputlangs), $useborder, 'R', 1); |
1073 | 1073 | } |
1074 | 1074 | } |
1075 | 1075 | |
1076 | - $pdf->SetTextColor(0,0,0); |
|
1076 | + $pdf->SetTextColor(0, 0, 0); |
|
1077 | 1077 | |
1078 | - $creditnoteamount=0; |
|
1079 | - $depositsamount=0; |
|
1078 | + $creditnoteamount = 0; |
|
1079 | + $depositsamount = 0; |
|
1080 | 1080 | //$creditnoteamount=$object->getSumCreditNotesUsed(); |
1081 | 1081 | //$depositsamount=$object->getSumDepositsUsed(); |
1082 | 1082 | //print "x".$creditnoteamount."-".$depositsamount;exit; |
1083 | 1083 | $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); |
1084 | - if (! empty($object->paye)) $resteapayer=0; |
|
1084 | + if (!empty($object->paye)) $resteapayer = 0; |
|
1085 | 1085 | |
1086 | 1086 | if ($deja_regle > 0) |
1087 | 1087 | { |
@@ -1089,21 +1089,21 @@ discard block |
||
1089 | 1089 | $index++; |
1090 | 1090 | |
1091 | 1091 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1092 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
1092 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("AlreadyPaid"), 0, 'L', 0); |
|
1093 | 1093 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1094 | 1094 | $pdf->MultiCell($largcol2, $tab2_hl, price($deja_regle, 0, $outputlangs), 0, 'R', 0); |
1095 | 1095 | |
1096 | 1096 | $index++; |
1097 | - $pdf->SetTextColor(0,0,60); |
|
1098 | - $pdf->SetFillColor(224,224,224); |
|
1097 | + $pdf->SetTextColor(0, 0, 60); |
|
1098 | + $pdf->SetFillColor(224, 224, 224); |
|
1099 | 1099 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1100 | - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
1100 | + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), $useborder, 'L', 1); |
|
1101 | 1101 | |
1102 | 1102 | $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); |
1103 | 1103 | $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); |
1104 | 1104 | |
1105 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1106 | - $pdf->SetTextColor(0,0,0); |
|
1105 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1106 | + $pdf->SetTextColor(0, 0, 0); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | $index++; |
@@ -1122,75 +1122,75 @@ discard block |
||
1122 | 1122 | * @param int $hidebottom Hide bottom bar of array |
1123 | 1123 | * @return void |
1124 | 1124 | */ |
1125 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
1125 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
1126 | 1126 | { |
1127 | 1127 | global $conf; |
1128 | 1128 | |
1129 | 1129 | // Force to disable hidetop and hidebottom |
1130 | - $hidebottom=0; |
|
1131 | - if ($hidetop) $hidetop=-1; |
|
1130 | + $hidebottom = 0; |
|
1131 | + if ($hidetop) $hidetop = -1; |
|
1132 | 1132 | |
1133 | 1133 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1134 | 1134 | |
1135 | 1135 | // Amount in (at tab_top - 1) |
1136 | - $pdf->SetTextColor(0,0,0); |
|
1137 | - $pdf->SetFont('','', $default_font_size - 2); |
|
1136 | + $pdf->SetTextColor(0, 0, 0); |
|
1137 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
1138 | 1138 | |
1139 | 1139 | if (empty($hidetop)) |
1140 | 1140 | { |
1141 | - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
1142 | - $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); |
|
1141 | + $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); |
|
1142 | + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4); |
|
1143 | 1143 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
1144 | 1144 | |
1145 | 1145 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
1146 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1146 | + if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | - $pdf->SetDrawColor(128,128,128); |
|
1150 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1149 | + $pdf->SetDrawColor(128, 128, 128); |
|
1150 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1151 | 1151 | |
1152 | 1152 | // Output Rect |
1153 | - $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
1153 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param |
|
1154 | 1154 | |
1155 | 1155 | if (empty($hidetop)) |
1156 | 1156 | { |
1157 | - $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param |
|
1157 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); // line prend une position y en 2eme param et 4eme param |
|
1158 | 1158 | |
1159 | - $pdf->SetXY($this->posxdesc-1, $tab_top+1); |
|
1160 | - $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); |
|
1159 | + $pdf->SetXY($this->posxdesc - 1, $tab_top + 1); |
|
1160 | + $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L'); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) |
1164 | 1164 | { |
1165 | - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); |
|
1165 | + $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height); |
|
1166 | 1166 | if (empty($hidetop)) |
1167 | 1167 | { |
1168 | - $pdf->SetXY($this->posxtva-3, $tab_top+1); |
|
1169 | - $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); |
|
1168 | + $pdf->SetXY($this->posxtva - 3, $tab_top + 1); |
|
1169 | + $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C'); |
|
1170 | 1170 | } |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); |
|
1173 | + $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height); |
|
1174 | 1174 | if (empty($hidetop)) |
1175 | 1175 | { |
1176 | - $pdf->SetXY($this->posxup-1, $tab_top+1); |
|
1177 | - $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); |
|
1176 | + $pdf->SetXY($this->posxup - 1, $tab_top + 1); |
|
1177 | + $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C'); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | - $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); |
|
1180 | + $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height); |
|
1181 | 1181 | if (empty($hidetop)) |
1182 | 1182 | { |
1183 | - $pdf->SetXY($this->posxqty-1, $tab_top+1); |
|
1184 | - $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); |
|
1183 | + $pdf->SetXY($this->posxqty - 1, $tab_top + 1); |
|
1184 | + $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C'); |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | - $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); |
|
1187 | + $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height); |
|
1188 | 1188 | if (empty($hidetop)) |
1189 | 1189 | { |
1190 | 1190 | if ($this->atleastonediscount) |
1191 | 1191 | { |
1192 | - $pdf->SetXY($this->posxdiscount-1, $tab_top+1); |
|
1193 | - $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); |
|
1192 | + $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1); |
|
1193 | + $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C'); |
|
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | } |
1201 | 1201 | if (empty($hidetop)) |
1202 | 1202 | { |
1203 | - $pdf->SetXY($this->postotalht-1, $tab_top+1); |
|
1204 | - $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); |
|
1203 | + $pdf->SetXY($this->postotalht - 1, $tab_top + 1); |
|
1204 | + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C'); |
|
1205 | 1205 | } |
1206 | 1206 | } |
1207 | 1207 | |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | */ |
1217 | 1217 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
1218 | 1218 | { |
1219 | - global $conf,$langs,$hookmanager; |
|
1219 | + global $conf, $langs, $hookmanager; |
|
1220 | 1220 | |
1221 | 1221 | $outputlangs->load("main"); |
1222 | 1222 | $outputlangs->load("bills"); |
@@ -1225,75 +1225,75 @@ discard block |
||
1225 | 1225 | $outputlangs->load("orders"); |
1226 | 1226 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1227 | 1227 | |
1228 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
1228 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
1229 | 1229 | |
1230 | 1230 | // Show Draft Watermark |
1231 | - if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) |
|
1231 | + if ($object->statut == 0 && (!empty($conf->global->COMMANDE_DRAFT_WATERMARK))) |
|
1232 | 1232 | { |
1233 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); |
|
1233 | + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->COMMANDE_DRAFT_WATERMARK); |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | - $pdf->SetTextColor(0,0,60); |
|
1237 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
1236 | + $pdf->SetTextColor(0, 0, 60); |
|
1237 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
1238 | 1238 | |
1239 | - $posy=$this->marge_haute; |
|
1240 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
1239 | + $posy = $this->marge_haute; |
|
1240 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
1241 | 1241 | |
1242 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
1242 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
1243 | 1243 | |
1244 | 1244 | // Logo |
1245 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
1245 | + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
1246 | 1246 | if ($this->emetteur->logo) |
1247 | 1247 | { |
1248 | 1248 | if (is_readable($logo)) |
1249 | 1249 | { |
1250 | - $height=pdf_getHeightForLogo($logo); |
|
1251 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1250 | + $height = pdf_getHeightForLogo($logo); |
|
1251 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1252 | 1252 | } |
1253 | 1253 | else |
1254 | 1254 | { |
1255 | - $pdf->SetTextColor(200,0,0); |
|
1256 | - $pdf->SetFont('','B', $default_font_size -2); |
|
1257 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
1255 | + $pdf->SetTextColor(200, 0, 0); |
|
1256 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
1257 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
1258 | 1258 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | else |
1262 | 1262 | { |
1263 | - $text=$this->emetteur->name; |
|
1263 | + $text = $this->emetteur->name; |
|
1264 | 1264 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
1268 | - $pdf->SetXY($posx,$posy); |
|
1269 | - $pdf->SetTextColor(0,0,60); |
|
1270 | - $title=$outputlangs->transnoentities("Order"); |
|
1267 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
1268 | + $pdf->SetXY($posx, $posy); |
|
1269 | + $pdf->SetTextColor(0, 0, 60); |
|
1270 | + $title = $outputlangs->transnoentities("Order"); |
|
1271 | 1271 | $pdf->MultiCell(100, 3, $title, '', 'R'); |
1272 | 1272 | |
1273 | - $pdf->SetFont('','B',$default_font_size); |
|
1273 | + $pdf->SetFont('', 'B', $default_font_size); |
|
1274 | 1274 | |
1275 | - $posy+=5; |
|
1276 | - $pdf->SetXY($posx,$posy); |
|
1277 | - $pdf->SetTextColor(0,0,60); |
|
1278 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
1275 | + $posy += 5; |
|
1276 | + $pdf->SetXY($posx, $posy); |
|
1277 | + $pdf->SetTextColor(0, 0, 60); |
|
1278 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
1279 | 1279 | |
1280 | - $posy+=1; |
|
1281 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1280 | + $posy += 1; |
|
1281 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1282 | 1282 | |
1283 | 1283 | if ($object->ref_client) |
1284 | 1284 | { |
1285 | - $posy+=5; |
|
1286 | - $pdf->SetXY($posx,$posy); |
|
1287 | - $pdf->SetTextColor(0,0,60); |
|
1288 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
1285 | + $posy += 5; |
|
1286 | + $pdf->SetXY($posx, $posy); |
|
1287 | + $pdf->SetTextColor(0, 0, 60); |
|
1288 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | - $posy+=4; |
|
1292 | - $pdf->SetXY($posx,$posy); |
|
1293 | - $pdf->SetTextColor(0,0,60); |
|
1294 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R'); |
|
1291 | + $posy += 4; |
|
1292 | + $pdf->SetXY($posx, $posy); |
|
1293 | + $pdf->SetTextColor(0, 0, 60); |
|
1294 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "%d %b %Y", false, $outputlangs, true), '', 'R'); |
|
1295 | 1295 | |
1296 | - $posy+=2; |
|
1296 | + $posy += 2; |
|
1297 | 1297 | |
1298 | 1298 | // Show list of linked objects |
1299 | 1299 | $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); |
@@ -1304,84 +1304,84 @@ discard block |
||
1304 | 1304 | $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); |
1305 | 1305 | |
1306 | 1306 | // Show sender |
1307 | - $posy=42; |
|
1308 | - $posx=$this->marge_gauche; |
|
1309 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
1310 | - $hautcadre=40; |
|
1307 | + $posy = 42; |
|
1308 | + $posx = $this->marge_gauche; |
|
1309 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
1310 | + $hautcadre = 40; |
|
1311 | 1311 | |
1312 | 1312 | // Show sender frame |
1313 | - $pdf->SetTextColor(0,0,0); |
|
1314 | - $pdf->SetFont('','', $default_font_size - 2); |
|
1315 | - $pdf->SetXY($posx,$posy-5); |
|
1316 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
1317 | - $pdf->SetXY($posx,$posy); |
|
1318 | - $pdf->SetFillColor(230,230,230); |
|
1313 | + $pdf->SetTextColor(0, 0, 0); |
|
1314 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
1315 | + $pdf->SetXY($posx, $posy - 5); |
|
1316 | + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); |
|
1317 | + $pdf->SetXY($posx, $posy); |
|
1318 | + $pdf->SetFillColor(230, 230, 230); |
|
1319 | 1319 | $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
1320 | - $pdf->SetTextColor(0,0,60); |
|
1320 | + $pdf->SetTextColor(0, 0, 60); |
|
1321 | 1321 | |
1322 | 1322 | // Show sender name |
1323 | - $pdf->SetXY($posx+2,$posy+3); |
|
1324 | - $pdf->SetFont('','B', $default_font_size); |
|
1323 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
1324 | + $pdf->SetFont('', 'B', $default_font_size); |
|
1325 | 1325 | $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
1326 | - $posy=$pdf->getY(); |
|
1326 | + $posy = $pdf->getY(); |
|
1327 | 1327 | |
1328 | 1328 | // Show sender information |
1329 | - $pdf->SetXY($posx+2,$posy); |
|
1330 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1329 | + $pdf->SetXY($posx + 2, $posy); |
|
1330 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1331 | 1331 | $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
1332 | 1332 | |
1333 | 1333 | |
1334 | 1334 | |
1335 | 1335 | // If CUSTOMER contact defined on order, we use it |
1336 | - $usecontact=false; |
|
1337 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
1336 | + $usecontact = false; |
|
1337 | + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); |
|
1338 | 1338 | if (count($arrayidcontact) > 0) |
1339 | 1339 | { |
1340 | - $usecontact=true; |
|
1341 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
1340 | + $usecontact = true; |
|
1341 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
1342 | 1342 | } |
1343 | 1343 | |
1344 | 1344 | // Recipient name |
1345 | - if (! empty($usecontact)) |
|
1345 | + if (!empty($usecontact)) |
|
1346 | 1346 | { |
1347 | 1347 | // On peut utiliser le nom de la societe du contact |
1348 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
1348 | + if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
1349 | 1349 | else $socname = $object->thirdparty->name; |
1350 | - $carac_client_name=$outputlangs->convToOutputCharset($socname); |
|
1350 | + $carac_client_name = $outputlangs->convToOutputCharset($socname); |
|
1351 | 1351 | } |
1352 | 1352 | else |
1353 | 1353 | { |
1354 | - $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); |
|
1354 | + $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | - $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target'); |
|
1357 | + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, 'target'); |
|
1358 | 1358 | |
1359 | 1359 | // Show recipient |
1360 | - $widthrecbox=100; |
|
1361 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
1362 | - $posy=42; |
|
1363 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
1364 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
1360 | + $widthrecbox = 100; |
|
1361 | + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
1362 | + $posy = 42; |
|
1363 | + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
|
1364 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
1365 | 1365 | |
1366 | 1366 | // Show recipient frame |
1367 | - $pdf->SetTextColor(0,0,0); |
|
1368 | - $pdf->SetFont('','', $default_font_size - 2); |
|
1369 | - $pdf->SetXY($posx+2,$posy-5); |
|
1370 | - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":",0,'L'); |
|
1367 | + $pdf->SetTextColor(0, 0, 0); |
|
1368 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
1369 | + $pdf->SetXY($posx + 2, $posy - 5); |
|
1370 | + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo").":", 0, 'L'); |
|
1371 | 1371 | $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
1372 | 1372 | |
1373 | 1373 | // Show recipient name |
1374 | - $pdf->SetXY($posx+2,$posy+3); |
|
1375 | - $pdf->SetFont('','B', $default_font_size); |
|
1374 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
1375 | + $pdf->SetFont('', 'B', $default_font_size); |
|
1376 | 1376 | $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
1377 | 1377 | |
1378 | 1378 | // Show recipient information |
1379 | - $pdf->SetFont('','', $default_font_size - 1); |
|
1380 | - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); |
|
1379 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
1380 | + $pdf->SetXY($posx + 2, $posy + 4 + (dol_nboflines_bis($carac_client_name, 50) * 4)); |
|
1381 | 1381 | $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - $pdf->SetTextColor(0,0,0); |
|
1384 | + $pdf->SetTextColor(0, 0, 0); |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | /** |
@@ -1393,11 +1393,11 @@ discard block |
||
1393 | 1393 | * @param int $hidefreetext 1=Hide free text |
1394 | 1394 | * @return int Return height of bottom margin including footer text |
1395 | 1395 | */ |
1396 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
1396 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
1397 | 1397 | { |
1398 | - $showdetails=0; |
|
1399 | - $free_text = (float)DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT'; |
|
1400 | - return pdf_pagefoot($pdf,$outputlangs,$free_text,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
1398 | + $showdetails = 0; |
|
1399 | + $free_text = (float) DOL_VERSION > 3.8 ? 'ORDER_FREE_TEXT' : 'COMMANDE_FREE_TEXT'; |
|
1400 | + return pdf_pagefoot($pdf, $outputlangs, $free_text, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | } |
@@ -100,7 +100,10 @@ discard block |
||
100 | 100 | |
101 | 101 | // Get source company |
102 | 102 | $this->emetteur=$mysoc; |
103 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined |
|
103 | + if (empty($this->emetteur->country_code)) { |
|
104 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
105 | + } |
|
106 | + // By default, if was not defined |
|
104 | 107 | |
105 | 108 | // Define position of columns |
106 | 109 | $this->posxdesc=$this->marge_gauche+1; |
@@ -109,11 +112,15 @@ discard block |
||
109 | 112 | $this->posxqty=145; |
110 | 113 | $this->posxdiscount=162; |
111 | 114 | $this->postotalht=174; |
112 | - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; |
|
115 | + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { |
|
116 | + $this->posxtva=$this->posxup; |
|
117 | + } |
|
113 | 118 | $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
114 | - if ($this->page_largeur < 210) // To work with US executive format |
|
119 | + if ($this->page_largeur < 210) { |
|
120 | + // To work with US executive format |
|
115 | 121 | { |
116 | 122 | $this->posxpicture-=20; |
123 | + } |
|
117 | 124 | $this->posxtva-=20; |
118 | 125 | $this->posxup-=20; |
119 | 126 | $this->posxqty-=20; |
@@ -143,9 +150,13 @@ discard block |
||
143 | 150 | { |
144 | 151 | global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
145 | 152 | |
146 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
153 | + if (! is_object($outputlangs)) { |
|
154 | + $outputlangs=$langs; |
|
155 | + } |
|
147 | 156 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
148 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
157 | + if (! empty($conf->global->MAIN_USE_FPDF)) { |
|
158 | + $outputlangs->charset_output='ISO-8859-1'; |
|
159 | + } |
|
149 | 160 | |
150 | 161 | $outputlangs->load("main"); |
151 | 162 | $outputlangs->load("dict"); |
@@ -170,8 +181,7 @@ discard block |
||
170 | 181 | { |
171 | 182 | $dir = $conf->commande->dir_output; |
172 | 183 | $file = $dir . "/SPECIMEN.pdf"; |
173 | - } |
|
174 | - else |
|
184 | + } else |
|
175 | 185 | { |
176 | 186 | $objectref = dol_sanitizeFileName($object->ref); |
177 | 187 | $dir = $conf->commande->dir_output . "/" . $objectref; |
@@ -230,7 +240,9 @@ discard block |
||
230 | 240 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
231 | 241 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
232 | 242 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")); |
233 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
243 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
244 | + $pdf->SetCompression(false); |
|
245 | + } |
|
234 | 246 | |
235 | 247 | $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
236 | 248 | |
@@ -254,7 +266,9 @@ discard block |
||
254 | 266 | |
255 | 267 | // New page |
256 | 268 | $pdf->AddPage(); |
257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
269 | + if (! empty($tplidx)) { |
|
270 | + $pdf->useTemplate($tplidx); |
|
271 | + } |
|
258 | 272 | $pagenb++; |
259 | 273 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
260 | 274 | $pdf->SetFont('','', $default_font_size - 1); |
@@ -277,7 +291,9 @@ discard block |
||
277 | 291 | $salereparray=$object->thirdparty->getSalesRepresentatives($user); |
278 | 292 | $salerepobj=new User($this->db); |
279 | 293 | $salerepobj->fetch($salereparray[0]['id']); |
280 | - if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
294 | + if (! empty($salerepobj->signature)) { |
|
295 | + $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); |
|
296 | + } |
|
281 | 297 | } |
282 | 298 | } |
283 | 299 | if ($notetoshow) |
@@ -295,8 +311,7 @@ discard block |
||
295 | 311 | |
296 | 312 | $tab_height = $tab_height - $height_note; |
297 | 313 | $tab_top = $nexY+6; |
298 | - } |
|
299 | - else |
|
314 | + } else |
|
300 | 315 | { |
301 | 316 | $height_note=0; |
302 | 317 | } |
@@ -391,32 +406,38 @@ discard block |
||
391 | 406 | $pdf->startTransaction(); |
392 | 407 | pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); |
393 | 408 | $pageposafter=$pdf->getPage(); |
394 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
409 | + if ($pageposafter > $pageposbefore) { |
|
410 | + // There is a pagebreak |
|
395 | 411 | { |
396 | 412 | $pdf->rollbackTransaction(true); |
413 | + } |
|
397 | 414 | $pageposafter=$pageposbefore; |
398 | 415 | //print $pageposafter.'-'.$pageposbefore;exit; |
399 | 416 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
400 | 417 | pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); |
401 | 418 | $pageposafter=$pdf->getPage(); |
402 | 419 | $posyafter=$pdf->GetY(); |
403 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
420 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) { |
|
421 | + // There is no space left for total+free text |
|
404 | 422 | { |
405 | 423 | if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page |
406 | 424 | { |
407 | 425 | $pdf->AddPage('','',true); |
408 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
409 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
426 | + } |
|
427 | + if (! empty($tplidx)) { |
|
428 | + $pdf->useTemplate($tplidx); |
|
429 | + } |
|
430 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
431 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
432 | + } |
|
410 | 433 | $pdf->setPage($pageposafter+1); |
411 | 434 | } |
412 | - } |
|
413 | - else |
|
435 | + } else |
|
414 | 436 | { |
415 | 437 | // We found a page break |
416 | 438 | $showpricebeforepagebreak=0; |
417 | 439 | } |
418 | - } |
|
419 | - else // No pagebreak |
|
440 | + } else // No pagebreak |
|
420 | 441 | { |
421 | 442 | $pdf->commitTransaction(); |
422 | 443 | } |
@@ -508,29 +529,43 @@ discard block |
||
508 | 529 | $localtax1_type=$object->lines[$i]->localtax1_type; |
509 | 530 | $localtax2_type=$object->lines[$i]->localtax2_type; |
510 | 531 | |
511 | - if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
512 | - if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
513 | - if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
532 | + if ($object->remise_percent) { |
|
533 | + $tvaligne-=($tvaligne*$object->remise_percent)/100; |
|
534 | + } |
|
535 | + if ($object->remise_percent) { |
|
536 | + $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; |
|
537 | + } |
|
538 | + if ($object->remise_percent) { |
|
539 | + $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; |
|
540 | + } |
|
514 | 541 | |
515 | 542 | $vatrate=(string) $object->lines[$i]->tva_tx; |
516 | 543 | |
517 | 544 | // Retrieve type from database for backward compatibility with old records |
518 | 545 | if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined |
519 | - && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax |
|
546 | + && (! empty($localtax1_rate) || ! empty($localtax2_rate))) { |
|
547 | + // and there is local tax |
|
520 | 548 | { |
521 | 549 | $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); |
550 | + } |
|
522 | 551 | $localtax1_type = $localtaxtmp_array[0]; |
523 | 552 | $localtax2_type = $localtaxtmp_array[2]; |
524 | 553 | } |
525 | 554 | |
526 | 555 | // retrieve global local tax |
527 | - if ($localtax1_type && $localtax1ligne != 0) |
|
528 | - $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
529 | - if ($localtax2_type && $localtax2ligne != 0) |
|
530 | - $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
556 | + if ($localtax1_type && $localtax1ligne != 0) { |
|
557 | + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
|
558 | + } |
|
559 | + if ($localtax2_type && $localtax2ligne != 0) { |
|
560 | + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; |
|
561 | + } |
|
531 | 562 | |
532 | - if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; |
|
533 | - if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; |
|
563 | + if (($object->lines[$i]->info_bits & 0x01) == 0x01) { |
|
564 | + $vatrate.='*'; |
|
565 | + } |
|
566 | + if (! isset($this->tva[$vatrate])) { |
|
567 | + $this->tva[$vatrate]=''; |
|
568 | + } |
|
534 | 569 | |
535 | 570 | if (!empty($object->lines[$i]->TTotal_tva)) |
536 | 571 | { |
@@ -538,8 +573,7 @@ discard block |
||
538 | 573 | { |
539 | 574 | $this->tva[$vatrate] += $tvaligne; |
540 | 575 | } |
541 | - } |
|
542 | - else { |
|
576 | + } else { |
|
543 | 577 | // standard |
544 | 578 | $this->tva[$vatrate] += $tvaligne; |
545 | 579 | } |
@@ -563,8 +597,7 @@ discard block |
||
563 | 597 | if ($pagenb == 1) |
564 | 598 | { |
565 | 599 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
566 | - } |
|
567 | - else |
|
600 | + } else |
|
568 | 601 | { |
569 | 602 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
570 | 603 | } |
@@ -572,24 +605,29 @@ discard block |
||
572 | 605 | $pagenb++; |
573 | 606 | $pdf->setPage($pagenb); |
574 | 607 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
575 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
608 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
609 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
610 | + } |
|
576 | 611 | } |
577 | 612 | if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
578 | 613 | { |
579 | 614 | if ($pagenb == 1) |
580 | 615 | { |
581 | 616 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
582 | - } |
|
583 | - else |
|
617 | + } else |
|
584 | 618 | { |
585 | 619 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
586 | 620 | } |
587 | 621 | $this->_pagefoot($pdf,$object,$outputlangs,1); |
588 | 622 | // New page |
589 | 623 | $pdf->AddPage(); |
590 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
624 | + if (! empty($tplidx)) { |
|
625 | + $pdf->useTemplate($tplidx); |
|
626 | + } |
|
591 | 627 | $pagenb++; |
592 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
628 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
629 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
630 | + } |
|
593 | 631 | } |
594 | 632 | } |
595 | 633 | |
@@ -598,8 +636,7 @@ discard block |
||
598 | 636 | { |
599 | 637 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
600 | 638 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
601 | - } |
|
602 | - else |
|
639 | + } else |
|
603 | 640 | { |
604 | 641 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
605 | 642 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
@@ -621,7 +658,9 @@ discard block |
||
621 | 658 | |
622 | 659 | // Pied de page |
623 | 660 | $this->_pagefoot($pdf,$object,$outputlangs); |
624 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
661 | + if (method_exists($pdf,'AliasNbPages')) { |
|
662 | + $pdf->AliasNbPages(); |
|
663 | + } |
|
625 | 664 | |
626 | 665 | $pdf->Close(); |
627 | 666 | |
@@ -633,18 +672,17 @@ discard block |
||
633 | 672 | global $action; |
634 | 673 | $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
635 | 674 | |
636 | - if (! empty($conf->global->MAIN_UMASK)) |
|
637 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
675 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
676 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
677 | + } |
|
638 | 678 | |
639 | 679 | return 1; // Pas d'erreur |
640 | - } |
|
641 | - else |
|
680 | + } else |
|
642 | 681 | { |
643 | 682 | $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
644 | 683 | return 0; |
645 | 684 | } |
646 | - } |
|
647 | - else |
|
685 | + } else |
|
648 | 686 | { |
649 | 687 | $this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR"); |
650 | 688 | return 0; |
@@ -754,10 +792,11 @@ discard block |
||
754 | 792 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
755 | 793 | |
756 | 794 | $posy=$pdf->GetY()+1; |
757 | - } |
|
758 | - elseif ($object->availability_code || $object->availability) // Show availability conditions |
|
795 | + } elseif ($object->availability_code || $object->availability) { |
|
796 | + // Show availability conditions |
|
759 | 797 | { |
760 | 798 | $pdf->SetFont('','B', $default_font_size - 2); |
799 | + } |
|
761 | 800 | $pdf->SetXY($this->marge_gauche, $posy); |
762 | 801 | $titre = $outputlangs->transnoentities("AvailabilityPeriod").':'; |
763 | 802 | $pdf->MultiCell(80, 4, $titre, 0, 'L'); |
@@ -875,10 +914,12 @@ discard block |
||
875 | 914 | |
876 | 915 | // Tableau total |
877 | 916 | $col1x = 120; $col2x = 170; |
878 | - if ($this->page_largeur < 210) // To work with US executive format |
|
917 | + if ($this->page_largeur < 210) { |
|
918 | + // To work with US executive format |
|
879 | 919 | { |
880 | 920 | $col2x-=20; |
881 | 921 | } |
922 | + } |
|
882 | 923 | $largcol2 = ($this->page_largeur - $this->marge_droite - $col2x); |
883 | 924 | |
884 | 925 | $useborder=0; |
@@ -902,22 +943,25 @@ discard block |
||
902 | 943 | if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) |
903 | 944 | { |
904 | 945 | // Nothing to do |
905 | - } |
|
906 | - else |
|
946 | + } else |
|
907 | 947 | { |
908 | 948 | //Local tax 1 before VAT |
909 | 949 | //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') |
910 | 950 | //{ |
911 | 951 | foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
912 | 952 | { |
913 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
953 | + if (in_array((string) $localtax_type, array('1','3','5'))) { |
|
954 | + continue; |
|
955 | + } |
|
914 | 956 | foreach( $localtax_rate as $tvakey => $tvaval ) |
915 | 957 | { |
916 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
958 | + if ($tvakey!=0) { |
|
959 | + // On affiche pas taux 0 |
|
917 | 960 | { |
918 | 961 | //$this->atleastoneratenotnull++; |
919 | 962 | |
920 | 963 | $index++; |
964 | + } |
|
921 | 965 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
922 | 966 | |
923 | 967 | $tvacompl=''; |
@@ -941,16 +985,20 @@ discard block |
||
941 | 985 | //{ |
942 | 986 | foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
943 | 987 | { |
944 | - if (in_array((string) $localtax_type, array('1','3','5'))) continue; |
|
988 | + if (in_array((string) $localtax_type, array('1','3','5'))) { |
|
989 | + continue; |
|
990 | + } |
|
945 | 991 | foreach( $localtax_rate as $tvakey => $tvaval ) |
946 | 992 | { |
947 | - if ($tvakey!=0) // On affiche pas taux 0 |
|
993 | + if ($tvakey!=0) { |
|
994 | + // On affiche pas taux 0 |
|
948 | 995 | { |
949 | 996 | //$this->atleastoneratenotnull++; |
950 | 997 | |
951 | 998 | |
952 | 999 | |
953 | 1000 | $index++; |
1001 | + } |
|
954 | 1002 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
955 | 1003 | |
956 | 1004 | $tvacompl=''; |
@@ -973,9 +1021,11 @@ discard block |
||
973 | 1021 | // VAT |
974 | 1022 | foreach($this->tva as $tvakey => $tvaval) |
975 | 1023 | { |
976 | - if ($tvakey > 0) // On affiche pas taux 0 |
|
1024 | + if ($tvakey > 0) { |
|
1025 | + // On affiche pas taux 0 |
|
977 | 1026 | { |
978 | 1027 | $this->atleastoneratenotnull++; |
1028 | + } |
|
979 | 1029 | |
980 | 1030 | $index++; |
981 | 1031 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -1000,15 +1050,19 @@ discard block |
||
1000 | 1050 | //{ |
1001 | 1051 | foreach( $this->localtax1 as $localtax_type => $localtax_rate ) |
1002 | 1052 | { |
1003 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
1053 | + if (in_array((string) $localtax_type, array('2','4','6'))) { |
|
1054 | + continue; |
|
1055 | + } |
|
1004 | 1056 | |
1005 | 1057 | foreach( $localtax_rate as $tvakey => $tvaval ) |
1006 | 1058 | { |
1007 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
1059 | + if ($tvakey != 0) { |
|
1060 | + // On affiche pas taux 0 |
|
1008 | 1061 | { |
1009 | 1062 | //$this->atleastoneratenotnull++; |
1010 | 1063 | |
1011 | 1064 | $index++; |
1065 | + } |
|
1012 | 1066 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1013 | 1067 | |
1014 | 1068 | $tvacompl=''; |
@@ -1032,15 +1086,19 @@ discard block |
||
1032 | 1086 | //{ |
1033 | 1087 | foreach( $this->localtax2 as $localtax_type => $localtax_rate ) |
1034 | 1088 | { |
1035 | - if (in_array((string) $localtax_type, array('2','4','6'))) continue; |
|
1089 | + if (in_array((string) $localtax_type, array('2','4','6'))) { |
|
1090 | + continue; |
|
1091 | + } |
|
1036 | 1092 | |
1037 | 1093 | foreach( $localtax_rate as $tvakey => $tvaval ) |
1038 | 1094 | { |
1039 | - if ($tvakey != 0) // On affiche pas taux 0 |
|
1095 | + if ($tvakey != 0) { |
|
1096 | + // On affiche pas taux 0 |
|
1040 | 1097 | { |
1041 | 1098 | //$this->atleastoneratenotnull++; |
1042 | 1099 | |
1043 | 1100 | $index++; |
1101 | + } |
|
1044 | 1102 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
1045 | 1103 | |
1046 | 1104 | $tvacompl=''; |
@@ -1081,7 +1139,9 @@ discard block |
||
1081 | 1139 | //$depositsamount=$object->getSumDepositsUsed(); |
1082 | 1140 | //print "x".$creditnoteamount."-".$depositsamount;exit; |
1083 | 1141 | $resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); |
1084 | - if (! empty($object->paye)) $resteapayer=0; |
|
1142 | + if (! empty($object->paye)) { |
|
1143 | + $resteapayer=0; |
|
1144 | + } |
|
1085 | 1145 | |
1086 | 1146 | if ($deja_regle > 0) |
1087 | 1147 | { |
@@ -1128,7 +1188,9 @@ discard block |
||
1128 | 1188 | |
1129 | 1189 | // Force to disable hidetop and hidebottom |
1130 | 1190 | $hidebottom=0; |
1131 | - if ($hidetop) $hidetop=-1; |
|
1191 | + if ($hidetop) { |
|
1192 | + $hidetop=-1; |
|
1193 | + } |
|
1132 | 1194 | |
1133 | 1195 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
1134 | 1196 | |
@@ -1143,7 +1205,9 @@ discard block |
||
1143 | 1205 | $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); |
1144 | 1206 | |
1145 | 1207 | //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; |
1146 | - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1208 | + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) { |
|
1209 | + $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); |
|
1210 | + } |
|
1147 | 1211 | } |
1148 | 1212 | |
1149 | 1213 | $pdf->SetDrawColor(128,128,128); |
@@ -1249,16 +1313,14 @@ discard block |
||
1249 | 1313 | { |
1250 | 1314 | $height=pdf_getHeightForLogo($logo); |
1251 | 1315 | $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
1252 | - } |
|
1253 | - else |
|
1316 | + } else |
|
1254 | 1317 | { |
1255 | 1318 | $pdf->SetTextColor(200,0,0); |
1256 | 1319 | $pdf->SetFont('','B', $default_font_size -2); |
1257 | 1320 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
1258 | 1321 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
1259 | 1322 | } |
1260 | - } |
|
1261 | - else |
|
1323 | + } else |
|
1262 | 1324 | { |
1263 | 1325 | $text=$this->emetteur->name; |
1264 | 1326 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -1306,7 +1368,9 @@ discard block |
||
1306 | 1368 | // Show sender |
1307 | 1369 | $posy=42; |
1308 | 1370 | $posx=$this->marge_gauche; |
1309 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
1371 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1372 | + $posx=$this->page_largeur-$this->marge_droite-80; |
|
1373 | + } |
|
1310 | 1374 | $hautcadre=40; |
1311 | 1375 | |
1312 | 1376 | // Show sender frame |
@@ -1345,11 +1409,13 @@ discard block |
||
1345 | 1409 | if (! empty($usecontact)) |
1346 | 1410 | { |
1347 | 1411 | // On peut utiliser le nom de la societe du contact |
1348 | - if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; |
|
1349 | - else $socname = $object->thirdparty->name; |
|
1412 | + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { |
|
1413 | + $socname = $object->contact->socname; |
|
1414 | + } else { |
|
1415 | + $socname = $object->thirdparty->name; |
|
1416 | + } |
|
1350 | 1417 | $carac_client_name=$outputlangs->convToOutputCharset($socname); |
1351 | - } |
|
1352 | - else |
|
1418 | + } else |
|
1353 | 1419 | { |
1354 | 1420 | $carac_client_name=$outputlangs->convToOutputCharset($object->thirdparty->name); |
1355 | 1421 | } |
@@ -1358,10 +1424,15 @@ discard block |
||
1358 | 1424 | |
1359 | 1425 | // Show recipient |
1360 | 1426 | $widthrecbox=100; |
1361 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
1427 | + if ($this->page_largeur < 210) { |
|
1428 | + $widthrecbox=84; |
|
1429 | + } |
|
1430 | + // To work with US executive format |
|
1362 | 1431 | $posy=42; |
1363 | 1432 | $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
1364 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
1433 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
1434 | + $posx=$this->marge_gauche; |
|
1435 | + } |
|
1365 | 1436 | |
1366 | 1437 | // Show recipient frame |
1367 | 1438 | $pdf->SetTextColor(0,0,0); |
@@ -31,170 +31,170 @@ discard block |
||
31 | 31 | class modSubtotal extends DolibarrModules |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | 39 | |
40 | - public function __construct($db) |
|
41 | - { |
|
42 | - global $langs, $conf; |
|
40 | + public function __construct($db) |
|
41 | + { |
|
42 | + global $langs, $conf; |
|
43 | 43 | |
44 | - $this->db = $db; |
|
44 | + $this->db = $db; |
|
45 | 45 | |
46 | 46 | $this->editor_name = 'ATM-Consulting'; |
47 | - // Id for module (must be unique). |
|
48 | - // Use a free id here |
|
49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
52 | - $this->rights_class = 'subtotal'; |
|
47 | + // Id for module (must be unique). |
|
48 | + // Use a free id here |
|
49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
52 | + $this->rights_class = 'subtotal'; |
|
53 | 53 | |
54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | - // It is used to group modules in module setup page |
|
56 | - $this->family = "technic"; |
|
57 | - // Module label (no space allowed) |
|
58 | - // used if translation string 'ModuleXXXName' not found |
|
59 | - // (where XXX is value of numeric property 'numero' of module) |
|
60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | - // Module description |
|
62 | - // used if translation string 'ModuleXXXDesc' not found |
|
63 | - // (where XXX is value of numeric property 'numero' of module) |
|
64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | - // Possible values for version are: 'development', 'experimental' or version |
|
66 | - $this->version = '3.0.1'; |
|
67 | - // Key used in llx_const table to save module status enabled/disabled |
|
68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | - // Where to store the module in setup page |
|
71 | - // (0=common,1=interface,2=others,3=very specific) |
|
72 | - $this->special = 2; |
|
73 | - // Name of image file used for this module. |
|
74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | - // use this->picto='pictovalue' |
|
76 | - // If file is in module/img directory under name object_pictovalue.png |
|
77 | - // use this->picto='pictovalue@module' |
|
78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | - $this->module_parts = array( |
|
84 | - // Set this to 1 if module has its own trigger directory |
|
85 | - 'triggers' => 1, |
|
86 | - // Set this to 1 if module has its own login method directory |
|
87 | - //'login' => 0, |
|
88 | - // Set this to 1 if module has its own substitution function file |
|
89 | - //'substitutions' => 0, |
|
90 | - // Set this to 1 if module has its own menus handler directory |
|
91 | - //'menus' => 0, |
|
92 | - // Set this to 1 if module has its own barcode directory |
|
93 | - //'barcode' => 0, |
|
94 | - // Set this to 1 if module has its own models directory |
|
95 | - 'models' => 1, |
|
96 | - // Set this to relative path of css if module has its own css file |
|
97 | - //'css' => '/titre/css/mycss.css.php', |
|
98 | - // Set here all hooks context managed by module |
|
99 | - 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
100 | - // Set here all workflow context managed by module |
|
101 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
102 | - ); |
|
54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | + // It is used to group modules in module setup page |
|
56 | + $this->family = "technic"; |
|
57 | + // Module label (no space allowed) |
|
58 | + // used if translation string 'ModuleXXXName' not found |
|
59 | + // (where XXX is value of numeric property 'numero' of module) |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | + // Module description |
|
62 | + // used if translation string 'ModuleXXXDesc' not found |
|
63 | + // (where XXX is value of numeric property 'numero' of module) |
|
64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | + // Possible values for version are: 'development', 'experimental' or version |
|
66 | + $this->version = '3.0.1'; |
|
67 | + // Key used in llx_const table to save module status enabled/disabled |
|
68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | + // Where to store the module in setup page |
|
71 | + // (0=common,1=interface,2=others,3=very specific) |
|
72 | + $this->special = 2; |
|
73 | + // Name of image file used for this module. |
|
74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | + // use this->picto='pictovalue' |
|
76 | + // If file is in module/img directory under name object_pictovalue.png |
|
77 | + // use this->picto='pictovalue@module' |
|
78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | + $this->module_parts = array( |
|
84 | + // Set this to 1 if module has its own trigger directory |
|
85 | + 'triggers' => 1, |
|
86 | + // Set this to 1 if module has its own login method directory |
|
87 | + //'login' => 0, |
|
88 | + // Set this to 1 if module has its own substitution function file |
|
89 | + //'substitutions' => 0, |
|
90 | + // Set this to 1 if module has its own menus handler directory |
|
91 | + //'menus' => 0, |
|
92 | + // Set this to 1 if module has its own barcode directory |
|
93 | + //'barcode' => 0, |
|
94 | + // Set this to 1 if module has its own models directory |
|
95 | + 'models' => 1, |
|
96 | + // Set this to relative path of css if module has its own css file |
|
97 | + //'css' => '/titre/css/mycss.css.php', |
|
98 | + // Set here all hooks context managed by module |
|
99 | + 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
100 | + // Set here all workflow context managed by module |
|
101 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
102 | + ); |
|
103 | 103 | |
104 | - // Data directories to create when module is enabled. |
|
105 | - // Example: this->dirs = array("/titre/temp"); |
|
106 | - $this->dirs = array(); |
|
104 | + // Data directories to create when module is enabled. |
|
105 | + // Example: this->dirs = array("/titre/temp"); |
|
106 | + $this->dirs = array(); |
|
107 | 107 | |
108 | - // Config pages. Put here list of php pages |
|
109 | - // stored into titre/admin directory, used to setup module. |
|
110 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
108 | + // Config pages. Put here list of php pages |
|
109 | + // stored into titre/admin directory, used to setup module. |
|
110 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
111 | 111 | |
112 | - // Dependencies |
|
113 | - // List of modules id that must be enabled if this module is enabled |
|
114 | - $this->depends = array(); |
|
112 | + // Dependencies |
|
113 | + // List of modules id that must be enabled if this module is enabled |
|
114 | + $this->depends = array(); |
|
115 | 115 | |
116 | 116 | $this->conflictwith=array('modMilestone'); |
117 | - // List of modules id to disable if this one is disabled |
|
118 | - $this->requiredby = array(); |
|
119 | - // Minimum version of PHP required by module |
|
120 | - $this->phpmin = array(5, 3); |
|
121 | - // Minimum version of Dolibarr required by module |
|
122 | - $this->need_dolibarr_version = array(3, 2); |
|
123 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
124 | - // Constants |
|
125 | - // List of particular constants to add when module is enabled |
|
126 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
127 | - // Example: |
|
128 | - $this->const = array( |
|
129 | - 0=>array( |
|
130 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
131 | - 'chaine', |
|
132 | - 'I', |
|
133 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
134 | - 1 |
|
135 | - ) |
|
117 | + // List of modules id to disable if this one is disabled |
|
118 | + $this->requiredby = array(); |
|
119 | + // Minimum version of PHP required by module |
|
120 | + $this->phpmin = array(5, 3); |
|
121 | + // Minimum version of Dolibarr required by module |
|
122 | + $this->need_dolibarr_version = array(3, 2); |
|
123 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
124 | + // Constants |
|
125 | + // List of particular constants to add when module is enabled |
|
126 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
127 | + // Example: |
|
128 | + $this->const = array( |
|
129 | + 0=>array( |
|
130 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
131 | + 'chaine', |
|
132 | + 'I', |
|
133 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
134 | + 1 |
|
135 | + ) |
|
136 | 136 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
137 | 137 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
138 | 138 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
139 | 139 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
140 | 140 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
141 | - // 1=>array( |
|
142 | - // 'MYMODULE_MYNEWCONST2', |
|
143 | - // 'chaine', |
|
144 | - // 'myvalue', |
|
145 | - // 'This is another constant to add', |
|
146 | - // 0 |
|
147 | - // ) |
|
148 | - ); |
|
141 | + // 1=>array( |
|
142 | + // 'MYMODULE_MYNEWCONST2', |
|
143 | + // 'chaine', |
|
144 | + // 'myvalue', |
|
145 | + // 'This is another constant to add', |
|
146 | + // 0 |
|
147 | + // ) |
|
148 | + ); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - // Array to add new pages in new tabs |
|
154 | - // Example: |
|
155 | - $this->tabs = array( |
|
156 | - // // To add a new tab identified by code tabname1 |
|
157 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
158 | - // // To add another new tab identified by code tabname2 |
|
159 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
160 | - // // To remove an existing tab identified by code tabname |
|
161 | - // 'objecttype:-tabname' |
|
162 | - ); |
|
163 | - // where objecttype can be |
|
164 | - // 'thirdparty' to add a tab in third party view |
|
165 | - // 'intervention' to add a tab in intervention view |
|
166 | - // 'order_supplier' to add a tab in supplier order view |
|
167 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
168 | - // 'invoice' to add a tab in customer invoice view |
|
169 | - // 'order' to add a tab in customer order view |
|
170 | - // 'product' to add a tab in product view |
|
171 | - // 'stock' to add a tab in stock view |
|
172 | - // 'propal' to add a tab in propal view |
|
173 | - // 'member' to add a tab in fundation member view |
|
174 | - // 'contract' to add a tab in contract view |
|
175 | - // 'user' to add a tab in user view |
|
176 | - // 'group' to add a tab in group view |
|
177 | - // 'contact' to add a tab in contact view |
|
178 | - // 'categories_x' to add a tab in category view |
|
179 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
180 | - // Dictionnaries |
|
181 | - if (! isset($conf->subtotal->enabled)) { |
|
182 | - $conf->subtotal=new stdClass(); |
|
183 | - $conf->subtotal->enabled = 0; |
|
184 | - } |
|
185 | - $this->dictionaries = array( |
|
153 | + // Array to add new pages in new tabs |
|
154 | + // Example: |
|
155 | + $this->tabs = array( |
|
156 | + // // To add a new tab identified by code tabname1 |
|
157 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
158 | + // // To add another new tab identified by code tabname2 |
|
159 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
160 | + // // To remove an existing tab identified by code tabname |
|
161 | + // 'objecttype:-tabname' |
|
162 | + ); |
|
163 | + // where objecttype can be |
|
164 | + // 'thirdparty' to add a tab in third party view |
|
165 | + // 'intervention' to add a tab in intervention view |
|
166 | + // 'order_supplier' to add a tab in supplier order view |
|
167 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
168 | + // 'invoice' to add a tab in customer invoice view |
|
169 | + // 'order' to add a tab in customer order view |
|
170 | + // 'product' to add a tab in product view |
|
171 | + // 'stock' to add a tab in stock view |
|
172 | + // 'propal' to add a tab in propal view |
|
173 | + // 'member' to add a tab in fundation member view |
|
174 | + // 'contract' to add a tab in contract view |
|
175 | + // 'user' to add a tab in user view |
|
176 | + // 'group' to add a tab in group view |
|
177 | + // 'contact' to add a tab in contact view |
|
178 | + // 'categories_x' to add a tab in category view |
|
179 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
180 | + // Dictionnaries |
|
181 | + if (! isset($conf->subtotal->enabled)) { |
|
182 | + $conf->subtotal=new stdClass(); |
|
183 | + $conf->subtotal->enabled = 0; |
|
184 | + } |
|
185 | + $this->dictionaries = array( |
|
186 | 186 | 'langs'=>'subtotal@subtotal', |
187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
196 | 196 | ); |
197 | - /* Example: |
|
197 | + /* Example: |
|
198 | 198 | // This is to avoid warnings |
199 | 199 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
200 | 200 | $this->dictionnaries=array( |
@@ -235,223 +235,223 @@ discard block |
||
235 | 235 | ); |
236 | 236 | */ |
237 | 237 | |
238 | - // Boxes |
|
239 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
240 | - $this->boxes = array(); // Boxes list |
|
238 | + // Boxes |
|
239 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
240 | + $this->boxes = array(); // Boxes list |
|
241 | 241 | |
242 | - /* |
|
242 | + /* |
|
243 | 243 | $this->boxes[$r][1] = "myboxb.php"; |
244 | 244 | $r++; |
245 | 245 | */ |
246 | 246 | |
247 | - // Permissions |
|
248 | - $this->rights = array(); // Permission array used by this module |
|
249 | - $r = 0; |
|
247 | + // Permissions |
|
248 | + $this->rights = array(); // Permission array used by this module |
|
249 | + $r = 0; |
|
250 | 250 | |
251 | - // Add here list of permission defined by |
|
252 | - // an id, a label, a boolean and two constant strings. |
|
253 | - // Example: |
|
254 | - //// Permission id (must not be already used) |
|
255 | - //$this->rights[$r][0] = 2000; |
|
256 | - //// Permission label |
|
257 | - //$this->rights[$r][1] = 'Permision label'; |
|
258 | - //// Permission by default for new user (0/1) |
|
259 | - //$this->rights[$r][3] = 1; |
|
260 | - //// In php code, permission will be checked by test |
|
261 | - //// if ($user->rights->permkey->level1->level2) |
|
262 | - //$this->rights[$r][4] = 'level1'; |
|
263 | - //// In php code, permission will be checked by test |
|
264 | - //// if ($user->rights->permkey->level1->level2) |
|
265 | - //$this->rights[$r][5] = 'level2'; |
|
266 | - //$r++; |
|
267 | - // Main menu entries |
|
268 | - $this->menus = array(); // List of menus to add |
|
269 | - $r = 0; |
|
251 | + // Add here list of permission defined by |
|
252 | + // an id, a label, a boolean and two constant strings. |
|
253 | + // Example: |
|
254 | + //// Permission id (must not be already used) |
|
255 | + //$this->rights[$r][0] = 2000; |
|
256 | + //// Permission label |
|
257 | + //$this->rights[$r][1] = 'Permision label'; |
|
258 | + //// Permission by default for new user (0/1) |
|
259 | + //$this->rights[$r][3] = 1; |
|
260 | + //// In php code, permission will be checked by test |
|
261 | + //// if ($user->rights->permkey->level1->level2) |
|
262 | + //$this->rights[$r][4] = 'level1'; |
|
263 | + //// In php code, permission will be checked by test |
|
264 | + //// if ($user->rights->permkey->level1->level2) |
|
265 | + //$this->rights[$r][5] = 'level2'; |
|
266 | + //$r++; |
|
267 | + // Main menu entries |
|
268 | + $this->menus = array(); // List of menus to add |
|
269 | + $r = 0; |
|
270 | 270 | |
271 | - // Add here entries to declare new menus |
|
272 | - // |
|
273 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
274 | - //$this->menu[$r]=array( |
|
275 | - // // Put 0 if this is a top menu |
|
276 | - // 'fk_menu'=>0, |
|
277 | - // // This is a Top menu entry |
|
278 | - // 'type'=>'top', |
|
279 | - // 'titre'=>'titre top menu', |
|
280 | - // 'mainmenu'=>'titre', |
|
281 | - // 'leftmenu'=>'titre', |
|
282 | - // 'url'=>'/titre/pagetop.php', |
|
283 | - // // Lang file to use (without .lang) by module. |
|
284 | - // // File must be in langs/code_CODE/ directory. |
|
285 | - // 'langs'=>'mylangfile', |
|
286 | - // 'position'=>100, |
|
287 | - // // Define condition to show or hide menu entry. |
|
288 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
289 | - // 'enabled'=>'$conf->titre->enabled', |
|
290 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
291 | - // // if you want your menu with a permission rules |
|
292 | - // 'perms'=>'1', |
|
293 | - // 'target'=>'', |
|
294 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
295 | - // 'user'=>2 |
|
296 | - //); |
|
297 | - //$r++; |
|
298 | - //$this->menu[$r]=array( |
|
299 | - // // Use r=value where r is index key used for the parent menu entry |
|
300 | - // // (higher parent must be a top menu entry) |
|
301 | - // 'fk_menu'=>'r=0', |
|
302 | - // // This is a Left menu entry |
|
303 | - // 'type'=>'left', |
|
304 | - // 'titre'=>'titre left menu', |
|
305 | - // 'mainmenu'=>'titre', |
|
306 | - // 'leftmenu'=>'titre', |
|
307 | - // 'url'=>'/titre/pagelevel1.php', |
|
308 | - // // Lang file to use (without .lang) by module. |
|
309 | - // // File must be in langs/code_CODE/ directory. |
|
310 | - // 'langs'=>'mylangfile', |
|
311 | - // 'position'=>100, |
|
312 | - // // Define condition to show or hide menu entry. |
|
313 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
314 | - // 'enabled'=>'$conf->titre->enabled', |
|
315 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
316 | - // // if you want your menu with a permission rules |
|
317 | - // 'perms'=>'1', |
|
318 | - // 'target'=>'', |
|
319 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
320 | - // 'user'=>2 |
|
321 | - //); |
|
322 | - //$r++; |
|
323 | - // |
|
324 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
325 | - //$this->menu[$r]=array( |
|
326 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
327 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
328 | - // // This is a Left menu entry |
|
329 | - // 'type'=>'left', |
|
330 | - // 'titre'=>'titre left menu', |
|
331 | - // 'mainmenu'=>'mainmenucode', |
|
332 | - // 'leftmenu'=>'titre', |
|
333 | - // 'url'=>'/titre/pagelevel2.php', |
|
334 | - // // Lang file to use (without .lang) by module. |
|
335 | - // // File must be in langs/code_CODE/ directory. |
|
336 | - // 'langs'=>'mylangfile', |
|
337 | - // 'position'=>100, |
|
338 | - // // Define condition to show or hide menu entry. |
|
339 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
340 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
341 | - // 'enabled'=>'$conf->titre->enabled', |
|
342 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
343 | - // // if you want your menu with a permission rules |
|
344 | - // 'perms'=>'1', |
|
345 | - // 'target'=>'', |
|
346 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
347 | - // 'user'=>2 |
|
348 | - //); |
|
349 | - //$r++; |
|
350 | - // Exports |
|
351 | - $r = 1; |
|
271 | + // Add here entries to declare new menus |
|
272 | + // |
|
273 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
274 | + //$this->menu[$r]=array( |
|
275 | + // // Put 0 if this is a top menu |
|
276 | + // 'fk_menu'=>0, |
|
277 | + // // This is a Top menu entry |
|
278 | + // 'type'=>'top', |
|
279 | + // 'titre'=>'titre top menu', |
|
280 | + // 'mainmenu'=>'titre', |
|
281 | + // 'leftmenu'=>'titre', |
|
282 | + // 'url'=>'/titre/pagetop.php', |
|
283 | + // // Lang file to use (without .lang) by module. |
|
284 | + // // File must be in langs/code_CODE/ directory. |
|
285 | + // 'langs'=>'mylangfile', |
|
286 | + // 'position'=>100, |
|
287 | + // // Define condition to show or hide menu entry. |
|
288 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
289 | + // 'enabled'=>'$conf->titre->enabled', |
|
290 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
291 | + // // if you want your menu with a permission rules |
|
292 | + // 'perms'=>'1', |
|
293 | + // 'target'=>'', |
|
294 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
295 | + // 'user'=>2 |
|
296 | + //); |
|
297 | + //$r++; |
|
298 | + //$this->menu[$r]=array( |
|
299 | + // // Use r=value where r is index key used for the parent menu entry |
|
300 | + // // (higher parent must be a top menu entry) |
|
301 | + // 'fk_menu'=>'r=0', |
|
302 | + // // This is a Left menu entry |
|
303 | + // 'type'=>'left', |
|
304 | + // 'titre'=>'titre left menu', |
|
305 | + // 'mainmenu'=>'titre', |
|
306 | + // 'leftmenu'=>'titre', |
|
307 | + // 'url'=>'/titre/pagelevel1.php', |
|
308 | + // // Lang file to use (without .lang) by module. |
|
309 | + // // File must be in langs/code_CODE/ directory. |
|
310 | + // 'langs'=>'mylangfile', |
|
311 | + // 'position'=>100, |
|
312 | + // // Define condition to show or hide menu entry. |
|
313 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
314 | + // 'enabled'=>'$conf->titre->enabled', |
|
315 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
316 | + // // if you want your menu with a permission rules |
|
317 | + // 'perms'=>'1', |
|
318 | + // 'target'=>'', |
|
319 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
320 | + // 'user'=>2 |
|
321 | + //); |
|
322 | + //$r++; |
|
323 | + // |
|
324 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
325 | + //$this->menu[$r]=array( |
|
326 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
327 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
328 | + // // This is a Left menu entry |
|
329 | + // 'type'=>'left', |
|
330 | + // 'titre'=>'titre left menu', |
|
331 | + // 'mainmenu'=>'mainmenucode', |
|
332 | + // 'leftmenu'=>'titre', |
|
333 | + // 'url'=>'/titre/pagelevel2.php', |
|
334 | + // // Lang file to use (without .lang) by module. |
|
335 | + // // File must be in langs/code_CODE/ directory. |
|
336 | + // 'langs'=>'mylangfile', |
|
337 | + // 'position'=>100, |
|
338 | + // // Define condition to show or hide menu entry. |
|
339 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
340 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
341 | + // 'enabled'=>'$conf->titre->enabled', |
|
342 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
343 | + // // if you want your menu with a permission rules |
|
344 | + // 'perms'=>'1', |
|
345 | + // 'target'=>'', |
|
346 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
347 | + // 'user'=>2 |
|
348 | + //); |
|
349 | + //$r++; |
|
350 | + // Exports |
|
351 | + $r = 1; |
|
352 | 352 | |
353 | - // Example: |
|
354 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
355 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
356 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
357 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
358 | - //// Set to 1 to always show when module is enabled. |
|
359 | - //$this->export_enabled[$r]='1'; |
|
360 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
361 | - //$this->export_fields_array[$r]=array( |
|
362 | - // 's.rowid'=>"IdCompany", |
|
363 | - // 's.nom'=>'CompanyName', |
|
364 | - // 's.address'=>'Address', |
|
365 | - // 's.cp'=>'Zip', |
|
366 | - // 's.ville'=>'Town', |
|
367 | - // 's.fk_pays'=>'Country', |
|
368 | - // 's.tel'=>'Phone', |
|
369 | - // 's.siren'=>'ProfId1', |
|
370 | - // 's.siret'=>'ProfId2', |
|
371 | - // 's.ape'=>'ProfId3', |
|
372 | - // 's.idprof4'=>'ProfId4', |
|
373 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
374 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
375 | - // 'f.rowid'=>"InvoiceId", |
|
376 | - // 'f.facnumber'=>"InvoiceRef", |
|
377 | - // 'f.datec'=>"InvoiceDateCreation", |
|
378 | - // 'f.datef'=>"DateInvoice", |
|
379 | - // 'f.total'=>"TotalHT", |
|
380 | - // 'f.total_ttc'=>"TotalTTC", |
|
381 | - // 'f.tva'=>"TotalVAT", |
|
382 | - // 'f.paye'=>"InvoicePaid", |
|
383 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
384 | - // 'f.note'=>"InvoiceNote", |
|
385 | - // 'fd.rowid'=>'LineId', |
|
386 | - // 'fd.description'=>"LineDescription", |
|
387 | - // 'fd.price'=>"LineUnitPrice", |
|
388 | - // 'fd.tva_tx'=>"LineVATRate", |
|
389 | - // 'fd.qty'=>"LineQty", |
|
390 | - // 'fd.total_ht'=>"LineTotalHT", |
|
391 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
392 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
393 | - // 'fd.date_start'=>"DateStart", |
|
394 | - // 'fd.date_end'=>"DateEnd", |
|
395 | - // 'fd.fk_product'=>'ProductId', |
|
396 | - // 'p.ref'=>'ProductRef' |
|
397 | - //); |
|
398 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
399 | - // 's.nom'=>'company', |
|
400 | - // 's.address'=>'company', |
|
401 | - // 's.cp'=>'company', |
|
402 | - // 's.ville'=>'company', |
|
403 | - // 's.fk_pays'=>'company', |
|
404 | - // 's.tel'=>'company', |
|
405 | - // 's.siren'=>'company', |
|
406 | - // 's.siret'=>'company', |
|
407 | - // 's.ape'=>'company', |
|
408 | - // 's.idprof4'=>'company', |
|
409 | - // 's.code_compta'=>'company', |
|
410 | - // 's.code_compta_fournisseur'=>'company', |
|
411 | - // 'f.rowid'=>"invoice", |
|
412 | - // 'f.facnumber'=>"invoice", |
|
413 | - // 'f.datec'=>"invoice", |
|
414 | - // 'f.datef'=>"invoice", |
|
415 | - // 'f.total'=>"invoice", |
|
416 | - // 'f.total_ttc'=>"invoice", |
|
417 | - // 'f.tva'=>"invoice", |
|
418 | - // 'f.paye'=>"invoice", |
|
419 | - // 'f.fk_statut'=>'invoice', |
|
420 | - // 'f.note'=>"invoice", |
|
421 | - // 'fd.rowid'=>'invoice_line', |
|
422 | - // 'fd.description'=>"invoice_line", |
|
423 | - // 'fd.price'=>"invoice_line", |
|
424 | - // 'fd.total_ht'=>"invoice_line", |
|
425 | - // 'fd.total_tva'=>"invoice_line", |
|
426 | - // 'fd.total_ttc'=>"invoice_line", |
|
427 | - // 'fd.tva_tx'=>"invoice_line", |
|
428 | - // 'fd.qty'=>"invoice_line", |
|
429 | - // 'fd.date_start'=>"invoice_line", |
|
430 | - // 'fd.date_end'=>"invoice_line", |
|
431 | - // 'fd.fk_product'=>'product', |
|
432 | - // 'p.ref'=>'product' |
|
433 | - //); |
|
434 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
435 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
436 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
437 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
438 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
439 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
440 | - // . 'AND f.rowid = fd.fk_facture'; |
|
441 | - //$r++; |
|
442 | - } |
|
353 | + // Example: |
|
354 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
355 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
356 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
357 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
358 | + //// Set to 1 to always show when module is enabled. |
|
359 | + //$this->export_enabled[$r]='1'; |
|
360 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
361 | + //$this->export_fields_array[$r]=array( |
|
362 | + // 's.rowid'=>"IdCompany", |
|
363 | + // 's.nom'=>'CompanyName', |
|
364 | + // 's.address'=>'Address', |
|
365 | + // 's.cp'=>'Zip', |
|
366 | + // 's.ville'=>'Town', |
|
367 | + // 's.fk_pays'=>'Country', |
|
368 | + // 's.tel'=>'Phone', |
|
369 | + // 's.siren'=>'ProfId1', |
|
370 | + // 's.siret'=>'ProfId2', |
|
371 | + // 's.ape'=>'ProfId3', |
|
372 | + // 's.idprof4'=>'ProfId4', |
|
373 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
374 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
375 | + // 'f.rowid'=>"InvoiceId", |
|
376 | + // 'f.facnumber'=>"InvoiceRef", |
|
377 | + // 'f.datec'=>"InvoiceDateCreation", |
|
378 | + // 'f.datef'=>"DateInvoice", |
|
379 | + // 'f.total'=>"TotalHT", |
|
380 | + // 'f.total_ttc'=>"TotalTTC", |
|
381 | + // 'f.tva'=>"TotalVAT", |
|
382 | + // 'f.paye'=>"InvoicePaid", |
|
383 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
384 | + // 'f.note'=>"InvoiceNote", |
|
385 | + // 'fd.rowid'=>'LineId', |
|
386 | + // 'fd.description'=>"LineDescription", |
|
387 | + // 'fd.price'=>"LineUnitPrice", |
|
388 | + // 'fd.tva_tx'=>"LineVATRate", |
|
389 | + // 'fd.qty'=>"LineQty", |
|
390 | + // 'fd.total_ht'=>"LineTotalHT", |
|
391 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
392 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
393 | + // 'fd.date_start'=>"DateStart", |
|
394 | + // 'fd.date_end'=>"DateEnd", |
|
395 | + // 'fd.fk_product'=>'ProductId', |
|
396 | + // 'p.ref'=>'ProductRef' |
|
397 | + //); |
|
398 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
399 | + // 's.nom'=>'company', |
|
400 | + // 's.address'=>'company', |
|
401 | + // 's.cp'=>'company', |
|
402 | + // 's.ville'=>'company', |
|
403 | + // 's.fk_pays'=>'company', |
|
404 | + // 's.tel'=>'company', |
|
405 | + // 's.siren'=>'company', |
|
406 | + // 's.siret'=>'company', |
|
407 | + // 's.ape'=>'company', |
|
408 | + // 's.idprof4'=>'company', |
|
409 | + // 's.code_compta'=>'company', |
|
410 | + // 's.code_compta_fournisseur'=>'company', |
|
411 | + // 'f.rowid'=>"invoice", |
|
412 | + // 'f.facnumber'=>"invoice", |
|
413 | + // 'f.datec'=>"invoice", |
|
414 | + // 'f.datef'=>"invoice", |
|
415 | + // 'f.total'=>"invoice", |
|
416 | + // 'f.total_ttc'=>"invoice", |
|
417 | + // 'f.tva'=>"invoice", |
|
418 | + // 'f.paye'=>"invoice", |
|
419 | + // 'f.fk_statut'=>'invoice', |
|
420 | + // 'f.note'=>"invoice", |
|
421 | + // 'fd.rowid'=>'invoice_line', |
|
422 | + // 'fd.description'=>"invoice_line", |
|
423 | + // 'fd.price'=>"invoice_line", |
|
424 | + // 'fd.total_ht'=>"invoice_line", |
|
425 | + // 'fd.total_tva'=>"invoice_line", |
|
426 | + // 'fd.total_ttc'=>"invoice_line", |
|
427 | + // 'fd.tva_tx'=>"invoice_line", |
|
428 | + // 'fd.qty'=>"invoice_line", |
|
429 | + // 'fd.date_start'=>"invoice_line", |
|
430 | + // 'fd.date_end'=>"invoice_line", |
|
431 | + // 'fd.fk_product'=>'product', |
|
432 | + // 'p.ref'=>'product' |
|
433 | + //); |
|
434 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
435 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
436 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
437 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
438 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
439 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
440 | + // . 'AND f.rowid = fd.fk_facture'; |
|
441 | + //$r++; |
|
442 | + } |
|
443 | 443 | |
444 | - /** |
|
445 | - * Function called when module is enabled. |
|
446 | - * The init function add constants, boxes, permissions and menus |
|
447 | - * (defined in constructor) into Dolibarr database. |
|
448 | - * It also creates data directories |
|
449 | - * |
|
450 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
451 | - * @return int 1 if OK, 0 if KO |
|
452 | - */ |
|
453 | - public function init($options = '') |
|
454 | - { |
|
444 | + /** |
|
445 | + * Function called when module is enabled. |
|
446 | + * The init function add constants, boxes, permissions and menus |
|
447 | + * (defined in constructor) into Dolibarr database. |
|
448 | + * It also creates data directories |
|
449 | + * |
|
450 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
451 | + * @return int 1 if OK, 0 if KO |
|
452 | + */ |
|
453 | + public function init($options = '') |
|
454 | + { |
|
455 | 455 | global $conf; |
456 | 456 | |
457 | 457 | |
@@ -459,39 +459,39 @@ discard block |
||
459 | 459 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
460 | 460 | } |
461 | 461 | */ |
462 | - $sql = array(); |
|
462 | + $sql = array(); |
|
463 | 463 | |
464 | - $result = $this->loadTables(); |
|
464 | + $result = $this->loadTables(); |
|
465 | 465 | |
466 | 466 | |
467 | - return $this->_init($sql, $options); |
|
468 | - } |
|
467 | + return $this->_init($sql, $options); |
|
468 | + } |
|
469 | 469 | |
470 | - /** |
|
471 | - * Function called when module is disabled. |
|
472 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
473 | - * Data directories are not deleted |
|
474 | - * |
|
475 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
476 | - * @return int 1 if OK, 0 if KO |
|
477 | - */ |
|
478 | - public function remove($options = '') |
|
479 | - { |
|
480 | - $sql = array(); |
|
470 | + /** |
|
471 | + * Function called when module is disabled. |
|
472 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
473 | + * Data directories are not deleted |
|
474 | + * |
|
475 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
476 | + * @return int 1 if OK, 0 if KO |
|
477 | + */ |
|
478 | + public function remove($options = '') |
|
479 | + { |
|
480 | + $sql = array(); |
|
481 | 481 | |
482 | - return $this->_remove($sql, $options); |
|
483 | - } |
|
482 | + return $this->_remove($sql, $options); |
|
483 | + } |
|
484 | 484 | |
485 | - /** |
|
486 | - * Create tables, keys and data required by module |
|
487 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
488 | - * and create data commands must be stored in directory /titre/sql/ |
|
489 | - * This function is called by this->init |
|
490 | - * |
|
491 | - * @return int <=0 if KO, >0 if OK |
|
492 | - */ |
|
493 | - private function loadTables() |
|
494 | - { |
|
495 | - return $this->_load_tables('/subtotal/sql/'); |
|
496 | - } |
|
485 | + /** |
|
486 | + * Create tables, keys and data required by module |
|
487 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
488 | + * and create data commands must be stored in directory /titre/sql/ |
|
489 | + * This function is called by this->init |
|
490 | + * |
|
491 | + * @return int <=0 if KO, >0 if OK |
|
492 | + */ |
|
493 | + private function loadTables() |
|
494 | + { |
|
495 | + return $this->_load_tables('/subtotal/sql/'); |
|
496 | + } |
|
497 | 497 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup titre |
24 | 24 | * \brief Description and activation file for module titre |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->version = '3.0.1'; |
67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | 70 | // Where to store the module in setup page |
71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
72 | 72 | $this->special = 2; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Set this to relative path of css if module has its own css file |
97 | 97 | //'css' => '/titre/css/mycss.css.php', |
98 | 98 | // Set here all hooks context managed by module |
99 | - 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','invoicereccard') |
|
99 | + 'hooks' => array('invoicecard', 'propalcard', 'ordercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard') |
|
100 | 100 | // Set here all workflow context managed by module |
101 | 101 | //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
102 | 102 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | // List of modules id that must be enabled if this module is enabled |
114 | 114 | $this->depends = array(); |
115 | 115 | |
116 | - $this->conflictwith=array('modMilestone'); |
|
116 | + $this->conflictwith = array('modMilestone'); |
|
117 | 117 | // List of modules id to disable if this one is disabled |
118 | 118 | $this->requiredby = array(); |
119 | 119 | // Minimum version of PHP required by module |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | // 'categories_x' to add a tab in category view |
179 | 179 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
180 | 180 | // Dictionnaries |
181 | - if (! isset($conf->subtotal->enabled)) { |
|
182 | - $conf->subtotal=new stdClass(); |
|
181 | + if (!isset($conf->subtotal->enabled)) { |
|
182 | + $conf->subtotal = new stdClass(); |
|
183 | 183 | $conf->subtotal->enabled = 0; |
184 | 184 | } |
185 | 185 | $this->dictionaries = array( |
186 | 186 | 'langs'=>'subtotal@subtotal', |
187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | 195 | 'tabcond'=>array($conf->subtotal->enabled) |
196 | 196 | ); |
197 | 197 | /* Example: |
@@ -36,68 +36,68 @@ discard block |
||
36 | 36 | class Interfacesubtotaltrigger |
37 | 37 | { |
38 | 38 | |
39 | - private $db; |
|
40 | - |
|
41 | - /** |
|
42 | - * Constructor |
|
43 | - * |
|
44 | - * @param DoliDB $db Database handler |
|
45 | - */ |
|
46 | - public function __construct($db) |
|
47 | - { |
|
48 | - $this->db = $db; |
|
49 | - |
|
50 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | - $this->family = "demo"; |
|
52 | - $this->description = "Triggers of this module are empty functions." |
|
53 | - . "They have no effect." |
|
54 | - . "They are provided for tutorial purpose only."; |
|
55 | - // 'development', 'experimental', 'dolibarr' or version |
|
56 | - $this->version = 'development'; |
|
57 | - $this->picto = 'titre@titre'; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Trigger name |
|
62 | - * |
|
63 | - * @return string Name of trigger file |
|
64 | - */ |
|
65 | - public function getName() |
|
66 | - { |
|
67 | - return $this->name; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Trigger description |
|
72 | - * |
|
73 | - * @return string Description of trigger file |
|
74 | - */ |
|
75 | - public function getDesc() |
|
76 | - { |
|
77 | - return $this->description; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Trigger version |
|
82 | - * |
|
83 | - * @return string Version of trigger file |
|
84 | - */ |
|
85 | - public function getVersion() |
|
86 | - { |
|
87 | - global $langs; |
|
88 | - $langs->load("admin"); |
|
89 | - |
|
90 | - if ($this->version == 'development') { |
|
91 | - return $langs->trans("Development"); |
|
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
94 | - return $langs->trans("Experimental"); |
|
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
98 | - return $langs->trans("Unknown"); |
|
99 | - } |
|
100 | - } |
|
39 | + private $db; |
|
40 | + |
|
41 | + /** |
|
42 | + * Constructor |
|
43 | + * |
|
44 | + * @param DoliDB $db Database handler |
|
45 | + */ |
|
46 | + public function __construct($db) |
|
47 | + { |
|
48 | + $this->db = $db; |
|
49 | + |
|
50 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | + $this->family = "demo"; |
|
52 | + $this->description = "Triggers of this module are empty functions." |
|
53 | + . "They have no effect." |
|
54 | + . "They are provided for tutorial purpose only."; |
|
55 | + // 'development', 'experimental', 'dolibarr' or version |
|
56 | + $this->version = 'development'; |
|
57 | + $this->picto = 'titre@titre'; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Trigger name |
|
62 | + * |
|
63 | + * @return string Name of trigger file |
|
64 | + */ |
|
65 | + public function getName() |
|
66 | + { |
|
67 | + return $this->name; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Trigger description |
|
72 | + * |
|
73 | + * @return string Description of trigger file |
|
74 | + */ |
|
75 | + public function getDesc() |
|
76 | + { |
|
77 | + return $this->description; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Trigger version |
|
82 | + * |
|
83 | + * @return string Version of trigger file |
|
84 | + */ |
|
85 | + public function getVersion() |
|
86 | + { |
|
87 | + global $langs; |
|
88 | + $langs->load("admin"); |
|
89 | + |
|
90 | + if ($this->version == 'development') { |
|
91 | + return $langs->trans("Development"); |
|
92 | + } elseif ($this->version == 'experimental') |
|
93 | + |
|
94 | + return $langs->trans("Experimental"); |
|
95 | + elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | + elseif ($this->version) return $this->version; |
|
97 | + else { |
|
98 | + return $langs->trans("Unknown"); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | public function addToBegin(&$parent, &$object, $rang) |
103 | 103 | { |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - /** |
|
151 | - * Function called when a Dolibarrr business event is done. |
|
152 | - * All functions "run_trigger" are triggered if file |
|
153 | - * is inside directory core/triggers |
|
154 | - * |
|
155 | - * @param string $action Event action code |
|
156 | - * @param Object $object Object |
|
157 | - * @param User $user Object user |
|
158 | - * @param Translate $langs Object langs |
|
159 | - * @param conf $conf Object conf |
|
160 | - * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | - */ |
|
162 | - public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | - { |
|
164 | - // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | - // Data and type of action are stored into $object and $action |
|
166 | - // Users |
|
167 | - dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | - $langs->load('subtotal@subtotal'); |
|
150 | + /** |
|
151 | + * Function called when a Dolibarrr business event is done. |
|
152 | + * All functions "run_trigger" are triggered if file |
|
153 | + * is inside directory core/triggers |
|
154 | + * |
|
155 | + * @param string $action Event action code |
|
156 | + * @param Object $object Object |
|
157 | + * @param User $user Object user |
|
158 | + * @param Translate $langs Object langs |
|
159 | + * @param conf $conf Object conf |
|
160 | + * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | + */ |
|
162 | + public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | + { |
|
164 | + // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | + // Data and type of action are stored into $object and $action |
|
166 | + // Users |
|
167 | + dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | + $langs->load('subtotal@subtotal'); |
|
169 | 169 | |
170 | - if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
170 | + if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
171 | 171 | { |
172 | 172 | |
173 | 173 | $rang = GETPOST('under_title', 'int'); // Rang du titre |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
202 | + if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
203 | 203 | { |
204 | 204 | $subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice'); |
205 | 205 | if (!empty($subtotal_add_title_bloc_from_orderstoinvoice)) |
@@ -307,173 +307,173 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | |
310 | - if ($action == 'USER_LOGIN') { |
|
311 | - dol_syslog( |
|
312 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
313 | - ); |
|
314 | - } elseif ($action == 'USER_UPDATE_SESSION') { |
|
315 | - // Warning: To increase performances, this action is triggered only if |
|
316 | - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
317 | - dol_syslog( |
|
318 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
319 | - ); |
|
320 | - } elseif ($action == 'USER_CREATE') { |
|
321 | - dol_syslog( |
|
322 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
323 | - ); |
|
324 | - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
325 | - dol_syslog( |
|
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | - ); |
|
328 | - } elseif ($action == 'USER_MODIFY') { |
|
329 | - dol_syslog( |
|
330 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
331 | - ); |
|
332 | - } elseif ($action == 'USER_NEW_PASSWORD') { |
|
333 | - dol_syslog( |
|
334 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
335 | - ); |
|
336 | - } elseif ($action == 'USER_ENABLEDISABLE') { |
|
337 | - dol_syslog( |
|
338 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
339 | - ); |
|
340 | - } elseif ($action == 'USER_DELETE') { |
|
341 | - dol_syslog( |
|
342 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
343 | - ); |
|
344 | - } elseif ($action == 'USER_LOGOUT') { |
|
345 | - dol_syslog( |
|
346 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
347 | - ); |
|
348 | - } elseif ($action == 'USER_SETINGROUP') { |
|
349 | - dol_syslog( |
|
350 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
351 | - ); |
|
352 | - } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
353 | - dol_syslog( |
|
354 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
355 | - ); |
|
356 | - } |
|
357 | - |
|
358 | - // Groups |
|
359 | - elseif ($action == 'GROUP_CREATE') { |
|
360 | - dol_syslog( |
|
361 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
362 | - ); |
|
363 | - } elseif ($action == 'GROUP_MODIFY') { |
|
364 | - dol_syslog( |
|
365 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
366 | - ); |
|
367 | - } elseif ($action == 'GROUP_DELETE') { |
|
368 | - dol_syslog( |
|
369 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
370 | - ); |
|
371 | - } |
|
372 | - |
|
373 | - // Companies |
|
374 | - elseif ($action == 'COMPANY_CREATE') { |
|
375 | - dol_syslog( |
|
376 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
377 | - ); |
|
378 | - } elseif ($action == 'COMPANY_MODIFY') { |
|
379 | - dol_syslog( |
|
380 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
381 | - ); |
|
382 | - } elseif ($action == 'COMPANY_DELETE') { |
|
383 | - dol_syslog( |
|
384 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
385 | - ); |
|
386 | - } |
|
387 | - |
|
388 | - // Contacts |
|
389 | - elseif ($action == 'CONTACT_CREATE') { |
|
390 | - dol_syslog( |
|
391 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
392 | - ); |
|
393 | - } elseif ($action == 'CONTACT_MODIFY') { |
|
394 | - dol_syslog( |
|
395 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
396 | - ); |
|
397 | - } elseif ($action == 'CONTACT_DELETE') { |
|
398 | - dol_syslog( |
|
399 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
400 | - ); |
|
401 | - } |
|
402 | - |
|
403 | - // Products |
|
404 | - elseif ($action == 'PRODUCT_CREATE') { |
|
405 | - dol_syslog( |
|
406 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
407 | - ); |
|
408 | - } elseif ($action == 'PRODUCT_MODIFY') { |
|
409 | - dol_syslog( |
|
410 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
411 | - ); |
|
412 | - } elseif ($action == 'PRODUCT_DELETE') { |
|
413 | - dol_syslog( |
|
414 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
415 | - ); |
|
416 | - } |
|
417 | - |
|
418 | - // Customer orders |
|
419 | - elseif ($action == 'ORDER_CREATE') { |
|
420 | - dol_syslog( |
|
421 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
422 | - ); |
|
423 | - } elseif ($action == 'ORDER_VALIDATE') { |
|
424 | - dol_syslog( |
|
425 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
426 | - ); |
|
427 | - } elseif ($action == 'ORDER_DELETE') { |
|
428 | - dol_syslog( |
|
429 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
430 | - ); |
|
431 | - } elseif ($action == 'ORDER_BUILDDOC') { |
|
432 | - dol_syslog( |
|
433 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
434 | - ); |
|
435 | - } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
436 | - dol_syslog( |
|
437 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
438 | - ); |
|
439 | - } elseif ($action == 'LINEORDER_INSERT') { |
|
440 | - dol_syslog( |
|
441 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
442 | - ); |
|
443 | - } elseif ($action == 'LINEORDER_DELETE') { |
|
444 | - dol_syslog( |
|
445 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
446 | - ); |
|
447 | - } |
|
448 | - |
|
449 | - // Supplier orders |
|
450 | - elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
451 | - dol_syslog( |
|
452 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
453 | - ); |
|
454 | - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
455 | - dol_syslog( |
|
456 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
457 | - ); |
|
458 | - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
459 | - dol_syslog( |
|
460 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
461 | - ); |
|
462 | - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
463 | - dol_syslog( |
|
464 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
465 | - ); |
|
466 | - } |
|
467 | - |
|
468 | - // Proposals |
|
469 | - elseif ($action == 'PROPAL_CREATE') { |
|
470 | - dol_syslog( |
|
471 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
472 | - ); |
|
473 | - } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
474 | - dol_syslog( |
|
475 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
476 | - ); |
|
310 | + if ($action == 'USER_LOGIN') { |
|
311 | + dol_syslog( |
|
312 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
313 | + ); |
|
314 | + } elseif ($action == 'USER_UPDATE_SESSION') { |
|
315 | + // Warning: To increase performances, this action is triggered only if |
|
316 | + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
317 | + dol_syslog( |
|
318 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
319 | + ); |
|
320 | + } elseif ($action == 'USER_CREATE') { |
|
321 | + dol_syslog( |
|
322 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
323 | + ); |
|
324 | + } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
325 | + dol_syslog( |
|
326 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | + ); |
|
328 | + } elseif ($action == 'USER_MODIFY') { |
|
329 | + dol_syslog( |
|
330 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
331 | + ); |
|
332 | + } elseif ($action == 'USER_NEW_PASSWORD') { |
|
333 | + dol_syslog( |
|
334 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
335 | + ); |
|
336 | + } elseif ($action == 'USER_ENABLEDISABLE') { |
|
337 | + dol_syslog( |
|
338 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
339 | + ); |
|
340 | + } elseif ($action == 'USER_DELETE') { |
|
341 | + dol_syslog( |
|
342 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
343 | + ); |
|
344 | + } elseif ($action == 'USER_LOGOUT') { |
|
345 | + dol_syslog( |
|
346 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
347 | + ); |
|
348 | + } elseif ($action == 'USER_SETINGROUP') { |
|
349 | + dol_syslog( |
|
350 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
351 | + ); |
|
352 | + } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
353 | + dol_syslog( |
|
354 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
355 | + ); |
|
356 | + } |
|
357 | + |
|
358 | + // Groups |
|
359 | + elseif ($action == 'GROUP_CREATE') { |
|
360 | + dol_syslog( |
|
361 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
362 | + ); |
|
363 | + } elseif ($action == 'GROUP_MODIFY') { |
|
364 | + dol_syslog( |
|
365 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
366 | + ); |
|
367 | + } elseif ($action == 'GROUP_DELETE') { |
|
368 | + dol_syslog( |
|
369 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
370 | + ); |
|
371 | + } |
|
372 | + |
|
373 | + // Companies |
|
374 | + elseif ($action == 'COMPANY_CREATE') { |
|
375 | + dol_syslog( |
|
376 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
377 | + ); |
|
378 | + } elseif ($action == 'COMPANY_MODIFY') { |
|
379 | + dol_syslog( |
|
380 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
381 | + ); |
|
382 | + } elseif ($action == 'COMPANY_DELETE') { |
|
383 | + dol_syslog( |
|
384 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
385 | + ); |
|
386 | + } |
|
387 | + |
|
388 | + // Contacts |
|
389 | + elseif ($action == 'CONTACT_CREATE') { |
|
390 | + dol_syslog( |
|
391 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
392 | + ); |
|
393 | + } elseif ($action == 'CONTACT_MODIFY') { |
|
394 | + dol_syslog( |
|
395 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
396 | + ); |
|
397 | + } elseif ($action == 'CONTACT_DELETE') { |
|
398 | + dol_syslog( |
|
399 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
400 | + ); |
|
401 | + } |
|
402 | + |
|
403 | + // Products |
|
404 | + elseif ($action == 'PRODUCT_CREATE') { |
|
405 | + dol_syslog( |
|
406 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
407 | + ); |
|
408 | + } elseif ($action == 'PRODUCT_MODIFY') { |
|
409 | + dol_syslog( |
|
410 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
411 | + ); |
|
412 | + } elseif ($action == 'PRODUCT_DELETE') { |
|
413 | + dol_syslog( |
|
414 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
415 | + ); |
|
416 | + } |
|
417 | + |
|
418 | + // Customer orders |
|
419 | + elseif ($action == 'ORDER_CREATE') { |
|
420 | + dol_syslog( |
|
421 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
422 | + ); |
|
423 | + } elseif ($action == 'ORDER_VALIDATE') { |
|
424 | + dol_syslog( |
|
425 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
426 | + ); |
|
427 | + } elseif ($action == 'ORDER_DELETE') { |
|
428 | + dol_syslog( |
|
429 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
430 | + ); |
|
431 | + } elseif ($action == 'ORDER_BUILDDOC') { |
|
432 | + dol_syslog( |
|
433 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
434 | + ); |
|
435 | + } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
436 | + dol_syslog( |
|
437 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
438 | + ); |
|
439 | + } elseif ($action == 'LINEORDER_INSERT') { |
|
440 | + dol_syslog( |
|
441 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
442 | + ); |
|
443 | + } elseif ($action == 'LINEORDER_DELETE') { |
|
444 | + dol_syslog( |
|
445 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
446 | + ); |
|
447 | + } |
|
448 | + |
|
449 | + // Supplier orders |
|
450 | + elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
451 | + dol_syslog( |
|
452 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
453 | + ); |
|
454 | + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
455 | + dol_syslog( |
|
456 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
457 | + ); |
|
458 | + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
459 | + dol_syslog( |
|
460 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
461 | + ); |
|
462 | + } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
463 | + dol_syslog( |
|
464 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
465 | + ); |
|
466 | + } |
|
467 | + |
|
468 | + // Proposals |
|
469 | + elseif ($action == 'PROPAL_CREATE') { |
|
470 | + dol_syslog( |
|
471 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
472 | + ); |
|
473 | + } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
474 | + dol_syslog( |
|
475 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
476 | + ); |
|
477 | 477 | |
478 | 478 | $doli_action = GETPOST('action'); |
479 | 479 | |
@@ -506,277 +506,277 @@ discard block |
||
506 | 506 | if (!empty($line)) $object->update_price(1); |
507 | 507 | } |
508 | 508 | |
509 | - } elseif ($action == 'PROPAL_MODIFY') { |
|
510 | - dol_syslog( |
|
511 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
512 | - ); |
|
513 | - } elseif ($action == 'PROPAL_VALIDATE') { |
|
514 | - dol_syslog( |
|
515 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
516 | - ); |
|
517 | - } elseif ($action == 'PROPAL_BUILDDOC') { |
|
518 | - dol_syslog( |
|
519 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
520 | - ); |
|
521 | - } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
522 | - dol_syslog( |
|
523 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
524 | - ); |
|
525 | - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
526 | - dol_syslog( |
|
527 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
528 | - ); |
|
529 | - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
530 | - dol_syslog( |
|
531 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
532 | - ); |
|
533 | - } elseif ($action == 'PROPAL_DELETE') { |
|
534 | - dol_syslog( |
|
535 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
536 | - ); |
|
537 | - } elseif ($action == 'LINEPROPAL_INSERT') { |
|
538 | - dol_syslog( |
|
539 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
540 | - ); |
|
541 | - } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
542 | - dol_syslog( |
|
543 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
544 | - ); |
|
545 | - } elseif ($action == 'LINEPROPAL_DELETE') { |
|
546 | - dol_syslog( |
|
547 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
548 | - ); |
|
549 | - } |
|
550 | - |
|
551 | - // Contracts |
|
552 | - elseif ($action == 'CONTRACT_CREATE') { |
|
553 | - dol_syslog( |
|
554 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
555 | - ); |
|
556 | - } elseif ($action == 'CONTRACT_MODIFY') { |
|
557 | - dol_syslog( |
|
558 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
559 | - ); |
|
560 | - } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
561 | - dol_syslog( |
|
562 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
563 | - ); |
|
564 | - } elseif ($action == 'CONTRACT_CANCEL') { |
|
565 | - dol_syslog( |
|
566 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
567 | - ); |
|
568 | - } elseif ($action == 'CONTRACT_CLOSE') { |
|
569 | - dol_syslog( |
|
570 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
571 | - ); |
|
572 | - } elseif ($action == 'CONTRACT_DELETE') { |
|
573 | - dol_syslog( |
|
574 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
575 | - ); |
|
576 | - } |
|
509 | + } elseif ($action == 'PROPAL_MODIFY') { |
|
510 | + dol_syslog( |
|
511 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
512 | + ); |
|
513 | + } elseif ($action == 'PROPAL_VALIDATE') { |
|
514 | + dol_syslog( |
|
515 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
516 | + ); |
|
517 | + } elseif ($action == 'PROPAL_BUILDDOC') { |
|
518 | + dol_syslog( |
|
519 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
520 | + ); |
|
521 | + } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
522 | + dol_syslog( |
|
523 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
524 | + ); |
|
525 | + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
526 | + dol_syslog( |
|
527 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
528 | + ); |
|
529 | + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
530 | + dol_syslog( |
|
531 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
532 | + ); |
|
533 | + } elseif ($action == 'PROPAL_DELETE') { |
|
534 | + dol_syslog( |
|
535 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
536 | + ); |
|
537 | + } elseif ($action == 'LINEPROPAL_INSERT') { |
|
538 | + dol_syslog( |
|
539 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
540 | + ); |
|
541 | + } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
542 | + dol_syslog( |
|
543 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
544 | + ); |
|
545 | + } elseif ($action == 'LINEPROPAL_DELETE') { |
|
546 | + dol_syslog( |
|
547 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
548 | + ); |
|
549 | + } |
|
550 | + |
|
551 | + // Contracts |
|
552 | + elseif ($action == 'CONTRACT_CREATE') { |
|
553 | + dol_syslog( |
|
554 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
555 | + ); |
|
556 | + } elseif ($action == 'CONTRACT_MODIFY') { |
|
557 | + dol_syslog( |
|
558 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
559 | + ); |
|
560 | + } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
561 | + dol_syslog( |
|
562 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
563 | + ); |
|
564 | + } elseif ($action == 'CONTRACT_CANCEL') { |
|
565 | + dol_syslog( |
|
566 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
567 | + ); |
|
568 | + } elseif ($action == 'CONTRACT_CLOSE') { |
|
569 | + dol_syslog( |
|
570 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
571 | + ); |
|
572 | + } elseif ($action == 'CONTRACT_DELETE') { |
|
573 | + dol_syslog( |
|
574 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
575 | + ); |
|
576 | + } |
|
577 | 577 | |
578 | 578 | elseif ($action == 'BILL_MODIFY') { |
579 | - dol_syslog( |
|
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | - ); |
|
582 | - } elseif ($action == 'BILL_VALIDATE') { |
|
583 | - dol_syslog( |
|
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | - ); |
|
586 | - } elseif ($action == 'BILL_BUILDDOC') { |
|
587 | - dol_syslog( |
|
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | - ); |
|
590 | - } elseif ($action == 'BILL_SENTBYMAIL') { |
|
591 | - dol_syslog( |
|
592 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
593 | - ); |
|
594 | - } elseif ($action == 'BILL_CANCEL') { |
|
595 | - dol_syslog( |
|
596 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
597 | - ); |
|
598 | - } elseif ($action == 'BILL_DELETE') { |
|
599 | - dol_syslog( |
|
600 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
601 | - ); |
|
602 | - } elseif ($action == 'LINEBILL_INSERT') { |
|
579 | + dol_syslog( |
|
580 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | + ); |
|
582 | + } elseif ($action == 'BILL_VALIDATE') { |
|
583 | + dol_syslog( |
|
584 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | + ); |
|
586 | + } elseif ($action == 'BILL_BUILDDOC') { |
|
587 | + dol_syslog( |
|
588 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | + ); |
|
590 | + } elseif ($action == 'BILL_SENTBYMAIL') { |
|
591 | + dol_syslog( |
|
592 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
593 | + ); |
|
594 | + } elseif ($action == 'BILL_CANCEL') { |
|
595 | + dol_syslog( |
|
596 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
597 | + ); |
|
598 | + } elseif ($action == 'BILL_DELETE') { |
|
599 | + dol_syslog( |
|
600 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
601 | + ); |
|
602 | + } elseif ($action == 'LINEBILL_INSERT') { |
|
603 | 603 | |
604 | - dol_syslog( |
|
605 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
606 | - ); |
|
607 | - } elseif ($action == 'LINEBILL_DELETE') { |
|
608 | - dol_syslog( |
|
609 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
610 | - ); |
|
611 | - } |
|
612 | - |
|
613 | - // Payments |
|
614 | - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
615 | - dol_syslog( |
|
616 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
617 | - ); |
|
618 | - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
619 | - dol_syslog( |
|
620 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
621 | - ); |
|
622 | - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
623 | - dol_syslog( |
|
624 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
625 | - ); |
|
626 | - } elseif ($action == 'PAYMENT_DELETE') { |
|
627 | - dol_syslog( |
|
628 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
629 | - ); |
|
630 | - } |
|
631 | - |
|
632 | - // Interventions |
|
633 | - elseif ($action == 'FICHEINTER_CREATE') { |
|
634 | - dol_syslog( |
|
635 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
636 | - ); |
|
637 | - } elseif ($action == 'FICHEINTER_MODIFY') { |
|
638 | - dol_syslog( |
|
639 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
640 | - ); |
|
641 | - } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
642 | - dol_syslog( |
|
643 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
644 | - ); |
|
645 | - } elseif ($action == 'FICHEINTER_DELETE') { |
|
646 | - dol_syslog( |
|
647 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
648 | - ); |
|
649 | - } |
|
650 | - |
|
651 | - // Members |
|
652 | - elseif ($action == 'MEMBER_CREATE') { |
|
653 | - dol_syslog( |
|
654 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
655 | - ); |
|
656 | - } elseif ($action == 'MEMBER_VALIDATE') { |
|
657 | - dol_syslog( |
|
658 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
659 | - ); |
|
660 | - } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
661 | - dol_syslog( |
|
662 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
663 | - ); |
|
664 | - } elseif ($action == 'MEMBER_MODIFY') { |
|
665 | - dol_syslog( |
|
666 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
667 | - ); |
|
668 | - } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
669 | - dol_syslog( |
|
670 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
671 | - ); |
|
672 | - } elseif ($action == 'MEMBER_RESILIATE') { |
|
673 | - dol_syslog( |
|
674 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
675 | - ); |
|
676 | - } elseif ($action == 'MEMBER_DELETE') { |
|
677 | - dol_syslog( |
|
678 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
679 | - ); |
|
680 | - } |
|
681 | - |
|
682 | - // Categories |
|
683 | - elseif ($action == 'CATEGORY_CREATE') { |
|
684 | - dol_syslog( |
|
685 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
686 | - ); |
|
687 | - } elseif ($action == 'CATEGORY_MODIFY') { |
|
688 | - dol_syslog( |
|
689 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
690 | - ); |
|
691 | - } elseif ($action == 'CATEGORY_DELETE') { |
|
692 | - dol_syslog( |
|
693 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
694 | - ); |
|
695 | - } |
|
696 | - |
|
697 | - // Projects |
|
698 | - elseif ($action == 'PROJECT_CREATE') { |
|
699 | - dol_syslog( |
|
700 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
701 | - ); |
|
702 | - } elseif ($action == 'PROJECT_MODIFY') { |
|
703 | - dol_syslog( |
|
704 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
705 | - ); |
|
706 | - } elseif ($action == 'PROJECT_DELETE') { |
|
707 | - dol_syslog( |
|
708 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
709 | - ); |
|
710 | - } |
|
711 | - |
|
712 | - // Project tasks |
|
713 | - elseif ($action == 'TASK_CREATE') { |
|
714 | - dol_syslog( |
|
715 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
716 | - ); |
|
717 | - } elseif ($action == 'TASK_MODIFY') { |
|
718 | - dol_syslog( |
|
719 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
720 | - ); |
|
721 | - } elseif ($action == 'TASK_DELETE') { |
|
722 | - dol_syslog( |
|
723 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
724 | - ); |
|
725 | - } |
|
726 | - |
|
727 | - // Task time spent |
|
728 | - elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
729 | - dol_syslog( |
|
730 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
731 | - ); |
|
732 | - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
733 | - dol_syslog( |
|
734 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
735 | - ); |
|
736 | - } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
737 | - dol_syslog( |
|
738 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
739 | - ); |
|
740 | - } |
|
741 | - |
|
742 | - // Shipping |
|
743 | - elseif ($action == 'SHIPPING_CREATE') { |
|
744 | - dol_syslog( |
|
745 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
746 | - ); |
|
747 | - } elseif ($action == 'SHIPPING_MODIFY') { |
|
748 | - dol_syslog( |
|
749 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
750 | - ); |
|
751 | - } elseif ($action == 'SHIPPING_VALIDATE') { |
|
752 | - dol_syslog( |
|
753 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
754 | - ); |
|
755 | - } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
756 | - dol_syslog( |
|
757 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
758 | - ); |
|
759 | - } elseif ($action == 'SHIPPING_DELETE') { |
|
760 | - dol_syslog( |
|
761 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
762 | - ); |
|
763 | - } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
764 | - dol_syslog( |
|
765 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
766 | - ); |
|
767 | - } |
|
768 | - |
|
769 | - // File |
|
770 | - elseif ($action == 'FILE_UPLOAD') { |
|
771 | - dol_syslog( |
|
772 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
773 | - ); |
|
774 | - } elseif ($action == 'FILE_DELETE') { |
|
775 | - dol_syslog( |
|
776 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
777 | - ); |
|
778 | - } |
|
779 | - |
|
780 | - return 0; |
|
781 | - } |
|
604 | + dol_syslog( |
|
605 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
606 | + ); |
|
607 | + } elseif ($action == 'LINEBILL_DELETE') { |
|
608 | + dol_syslog( |
|
609 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
610 | + ); |
|
611 | + } |
|
612 | + |
|
613 | + // Payments |
|
614 | + elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
615 | + dol_syslog( |
|
616 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
617 | + ); |
|
618 | + } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
619 | + dol_syslog( |
|
620 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
621 | + ); |
|
622 | + } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
623 | + dol_syslog( |
|
624 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
625 | + ); |
|
626 | + } elseif ($action == 'PAYMENT_DELETE') { |
|
627 | + dol_syslog( |
|
628 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
629 | + ); |
|
630 | + } |
|
631 | + |
|
632 | + // Interventions |
|
633 | + elseif ($action == 'FICHEINTER_CREATE') { |
|
634 | + dol_syslog( |
|
635 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
636 | + ); |
|
637 | + } elseif ($action == 'FICHEINTER_MODIFY') { |
|
638 | + dol_syslog( |
|
639 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
640 | + ); |
|
641 | + } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
642 | + dol_syslog( |
|
643 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
644 | + ); |
|
645 | + } elseif ($action == 'FICHEINTER_DELETE') { |
|
646 | + dol_syslog( |
|
647 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
648 | + ); |
|
649 | + } |
|
650 | + |
|
651 | + // Members |
|
652 | + elseif ($action == 'MEMBER_CREATE') { |
|
653 | + dol_syslog( |
|
654 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
655 | + ); |
|
656 | + } elseif ($action == 'MEMBER_VALIDATE') { |
|
657 | + dol_syslog( |
|
658 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
659 | + ); |
|
660 | + } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
661 | + dol_syslog( |
|
662 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
663 | + ); |
|
664 | + } elseif ($action == 'MEMBER_MODIFY') { |
|
665 | + dol_syslog( |
|
666 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
667 | + ); |
|
668 | + } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
669 | + dol_syslog( |
|
670 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
671 | + ); |
|
672 | + } elseif ($action == 'MEMBER_RESILIATE') { |
|
673 | + dol_syslog( |
|
674 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
675 | + ); |
|
676 | + } elseif ($action == 'MEMBER_DELETE') { |
|
677 | + dol_syslog( |
|
678 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
679 | + ); |
|
680 | + } |
|
681 | + |
|
682 | + // Categories |
|
683 | + elseif ($action == 'CATEGORY_CREATE') { |
|
684 | + dol_syslog( |
|
685 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
686 | + ); |
|
687 | + } elseif ($action == 'CATEGORY_MODIFY') { |
|
688 | + dol_syslog( |
|
689 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
690 | + ); |
|
691 | + } elseif ($action == 'CATEGORY_DELETE') { |
|
692 | + dol_syslog( |
|
693 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
694 | + ); |
|
695 | + } |
|
696 | + |
|
697 | + // Projects |
|
698 | + elseif ($action == 'PROJECT_CREATE') { |
|
699 | + dol_syslog( |
|
700 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
701 | + ); |
|
702 | + } elseif ($action == 'PROJECT_MODIFY') { |
|
703 | + dol_syslog( |
|
704 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
705 | + ); |
|
706 | + } elseif ($action == 'PROJECT_DELETE') { |
|
707 | + dol_syslog( |
|
708 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
709 | + ); |
|
710 | + } |
|
711 | + |
|
712 | + // Project tasks |
|
713 | + elseif ($action == 'TASK_CREATE') { |
|
714 | + dol_syslog( |
|
715 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
716 | + ); |
|
717 | + } elseif ($action == 'TASK_MODIFY') { |
|
718 | + dol_syslog( |
|
719 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
720 | + ); |
|
721 | + } elseif ($action == 'TASK_DELETE') { |
|
722 | + dol_syslog( |
|
723 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
724 | + ); |
|
725 | + } |
|
726 | + |
|
727 | + // Task time spent |
|
728 | + elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
729 | + dol_syslog( |
|
730 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
731 | + ); |
|
732 | + } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
733 | + dol_syslog( |
|
734 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
735 | + ); |
|
736 | + } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
737 | + dol_syslog( |
|
738 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
739 | + ); |
|
740 | + } |
|
741 | + |
|
742 | + // Shipping |
|
743 | + elseif ($action == 'SHIPPING_CREATE') { |
|
744 | + dol_syslog( |
|
745 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
746 | + ); |
|
747 | + } elseif ($action == 'SHIPPING_MODIFY') { |
|
748 | + dol_syslog( |
|
749 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
750 | + ); |
|
751 | + } elseif ($action == 'SHIPPING_VALIDATE') { |
|
752 | + dol_syslog( |
|
753 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
754 | + ); |
|
755 | + } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
756 | + dol_syslog( |
|
757 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
758 | + ); |
|
759 | + } elseif ($action == 'SHIPPING_DELETE') { |
|
760 | + dol_syslog( |
|
761 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
762 | + ); |
|
763 | + } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
764 | + dol_syslog( |
|
765 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
766 | + ); |
|
767 | + } |
|
768 | + |
|
769 | + // File |
|
770 | + elseif ($action == 'FILE_UPLOAD') { |
|
771 | + dol_syslog( |
|
772 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
773 | + ); |
|
774 | + } elseif ($action == 'FILE_DELETE') { |
|
775 | + dol_syslog( |
|
776 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
777 | + ); |
|
778 | + } |
|
779 | + |
|
780 | + return 0; |
|
781 | + } |
|
782 | 782 | } |
783 | 783 | \ No newline at end of file |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | if ($object->id != $line->id && $line->rang > $rang) |
108 | 108 | { |
109 | 109 | // Update du rang de toutes les lignes suivant mon titre |
110 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
110 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre |
115 | - $parent->updateRangOfLine($object->id, $rang+1); |
|
116 | - $object->rang = $rang+1; |
|
115 | + $parent->updateRangOfLine($object->id, $rang + 1); |
|
116 | + $object->rang = $rang + 1; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function addToEnd(&$parent, &$object, $rang) |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($subtotal_line_found) |
138 | 138 | { |
139 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
139 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | { |
258 | 258 | $doli_action = GETPOST('action'); |
259 | 259 | $set = GETPOST('set'); |
260 | - if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
260 | + if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
261 | 261 | { |
262 | 262 | dol_syslog( |
263 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
263 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | $TTitle = TSubtotal::getAllTitleFromLine($object); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // $object correspond à la ligne ajoutée |
283 | - if(! empty($object->array_options['options_subtotal_nc'])) { |
|
283 | + if (!empty($object->array_options['options_subtotal_nc'])) { |
|
284 | 284 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
285 | 285 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
286 | 286 | |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | |
295 | 295 | // Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut |
296 | 296 | if ($action == 'BILL_CREATE' && $object->fac_rec > 0) { |
297 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
297 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
298 | 298 | |
299 | 299 | $object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline(); |
300 | 300 | |
301 | - foreach($object->lines as &$line) { |
|
302 | - if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) { |
|
301 | + foreach ($object->lines as &$line) { |
|
302 | + if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) { |
|
303 | 303 | $line->tva_tx = 0; |
304 | 304 | $line->update(); |
305 | 305 | } |
@@ -309,170 +309,170 @@ discard block |
||
309 | 309 | |
310 | 310 | if ($action == 'USER_LOGIN') { |
311 | 311 | dol_syslog( |
312 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
312 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
313 | 313 | ); |
314 | 314 | } elseif ($action == 'USER_UPDATE_SESSION') { |
315 | 315 | // Warning: To increase performances, this action is triggered only if |
316 | 316 | // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
317 | 317 | dol_syslog( |
318 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
318 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
319 | 319 | ); |
320 | 320 | } elseif ($action == 'USER_CREATE') { |
321 | 321 | dol_syslog( |
322 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
322 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
323 | 323 | ); |
324 | 324 | } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
325 | 325 | dol_syslog( |
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
326 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
327 | 327 | ); |
328 | 328 | } elseif ($action == 'USER_MODIFY') { |
329 | 329 | dol_syslog( |
330 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
330 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
331 | 331 | ); |
332 | 332 | } elseif ($action == 'USER_NEW_PASSWORD') { |
333 | 333 | dol_syslog( |
334 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
334 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
335 | 335 | ); |
336 | 336 | } elseif ($action == 'USER_ENABLEDISABLE') { |
337 | 337 | dol_syslog( |
338 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
338 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
339 | 339 | ); |
340 | 340 | } elseif ($action == 'USER_DELETE') { |
341 | 341 | dol_syslog( |
342 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
342 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
343 | 343 | ); |
344 | 344 | } elseif ($action == 'USER_LOGOUT') { |
345 | 345 | dol_syslog( |
346 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
346 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
347 | 347 | ); |
348 | 348 | } elseif ($action == 'USER_SETINGROUP') { |
349 | 349 | dol_syslog( |
350 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
350 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
351 | 351 | ); |
352 | 352 | } elseif ($action == 'USER_REMOVEFROMGROUP') { |
353 | 353 | dol_syslog( |
354 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
354 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
355 | 355 | ); |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Groups |
359 | 359 | elseif ($action == 'GROUP_CREATE') { |
360 | 360 | dol_syslog( |
361 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
361 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
362 | 362 | ); |
363 | 363 | } elseif ($action == 'GROUP_MODIFY') { |
364 | 364 | dol_syslog( |
365 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
365 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
366 | 366 | ); |
367 | 367 | } elseif ($action == 'GROUP_DELETE') { |
368 | 368 | dol_syslog( |
369 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
369 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
370 | 370 | ); |
371 | 371 | } |
372 | 372 | |
373 | 373 | // Companies |
374 | 374 | elseif ($action == 'COMPANY_CREATE') { |
375 | 375 | dol_syslog( |
376 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
376 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
377 | 377 | ); |
378 | 378 | } elseif ($action == 'COMPANY_MODIFY') { |
379 | 379 | dol_syslog( |
380 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
380 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
381 | 381 | ); |
382 | 382 | } elseif ($action == 'COMPANY_DELETE') { |
383 | 383 | dol_syslog( |
384 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
384 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | 388 | // Contacts |
389 | 389 | elseif ($action == 'CONTACT_CREATE') { |
390 | 390 | dol_syslog( |
391 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
391 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
392 | 392 | ); |
393 | 393 | } elseif ($action == 'CONTACT_MODIFY') { |
394 | 394 | dol_syslog( |
395 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
395 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
396 | 396 | ); |
397 | 397 | } elseif ($action == 'CONTACT_DELETE') { |
398 | 398 | dol_syslog( |
399 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
399 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
400 | 400 | ); |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Products |
404 | 404 | elseif ($action == 'PRODUCT_CREATE') { |
405 | 405 | dol_syslog( |
406 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
406 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
407 | 407 | ); |
408 | 408 | } elseif ($action == 'PRODUCT_MODIFY') { |
409 | 409 | dol_syslog( |
410 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
410 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
411 | 411 | ); |
412 | 412 | } elseif ($action == 'PRODUCT_DELETE') { |
413 | 413 | dol_syslog( |
414 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
414 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
415 | 415 | ); |
416 | 416 | } |
417 | 417 | |
418 | 418 | // Customer orders |
419 | 419 | elseif ($action == 'ORDER_CREATE') { |
420 | 420 | dol_syslog( |
421 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
421 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
422 | 422 | ); |
423 | 423 | } elseif ($action == 'ORDER_VALIDATE') { |
424 | 424 | dol_syslog( |
425 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
425 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
426 | 426 | ); |
427 | 427 | } elseif ($action == 'ORDER_DELETE') { |
428 | 428 | dol_syslog( |
429 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
429 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
430 | 430 | ); |
431 | 431 | } elseif ($action == 'ORDER_BUILDDOC') { |
432 | 432 | dol_syslog( |
433 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
433 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
434 | 434 | ); |
435 | 435 | } elseif ($action == 'ORDER_SENTBYMAIL') { |
436 | 436 | dol_syslog( |
437 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
437 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
438 | 438 | ); |
439 | 439 | } elseif ($action == 'LINEORDER_INSERT') { |
440 | 440 | dol_syslog( |
441 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
441 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
442 | 442 | ); |
443 | 443 | } elseif ($action == 'LINEORDER_DELETE') { |
444 | 444 | dol_syslog( |
445 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
445 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
446 | 446 | ); |
447 | 447 | } |
448 | 448 | |
449 | 449 | // Supplier orders |
450 | 450 | elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
451 | 451 | dol_syslog( |
452 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
452 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
453 | 453 | ); |
454 | 454 | } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
455 | 455 | dol_syslog( |
456 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
456 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
457 | 457 | ); |
458 | 458 | } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
459 | 459 | dol_syslog( |
460 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
460 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
461 | 461 | ); |
462 | 462 | } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
463 | 463 | dol_syslog( |
464 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
464 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
465 | 465 | ); |
466 | 466 | } |
467 | 467 | |
468 | 468 | // Proposals |
469 | 469 | elseif ($action == 'PROPAL_CREATE') { |
470 | 470 | dol_syslog( |
471 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
471 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
472 | 472 | ); |
473 | 473 | } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
474 | 474 | dol_syslog( |
475 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
475 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
476 | 476 | ); |
477 | 477 | |
478 | 478 | $doli_action = GETPOST('action'); |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone'))) |
481 | 481 | { |
482 | 482 | dol_syslog( |
483 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
483 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
484 | 484 | ); |
485 | 485 | |
486 | 486 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
@@ -508,272 +508,272 @@ discard block |
||
508 | 508 | |
509 | 509 | } elseif ($action == 'PROPAL_MODIFY') { |
510 | 510 | dol_syslog( |
511 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
511 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
512 | 512 | ); |
513 | 513 | } elseif ($action == 'PROPAL_VALIDATE') { |
514 | 514 | dol_syslog( |
515 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
515 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
516 | 516 | ); |
517 | 517 | } elseif ($action == 'PROPAL_BUILDDOC') { |
518 | 518 | dol_syslog( |
519 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
519 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
520 | 520 | ); |
521 | 521 | } elseif ($action == 'PROPAL_SENTBYMAIL') { |
522 | 522 | dol_syslog( |
523 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
523 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
524 | 524 | ); |
525 | 525 | } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
526 | 526 | dol_syslog( |
527 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
527 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
528 | 528 | ); |
529 | 529 | } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
530 | 530 | dol_syslog( |
531 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
531 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
532 | 532 | ); |
533 | 533 | } elseif ($action == 'PROPAL_DELETE') { |
534 | 534 | dol_syslog( |
535 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
535 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
536 | 536 | ); |
537 | 537 | } elseif ($action == 'LINEPROPAL_INSERT') { |
538 | 538 | dol_syslog( |
539 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
539 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
540 | 540 | ); |
541 | 541 | } elseif ($action == 'LINEPROPAL_MODIFY') { |
542 | 542 | dol_syslog( |
543 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
543 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
544 | 544 | ); |
545 | 545 | } elseif ($action == 'LINEPROPAL_DELETE') { |
546 | 546 | dol_syslog( |
547 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
547 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
548 | 548 | ); |
549 | 549 | } |
550 | 550 | |
551 | 551 | // Contracts |
552 | 552 | elseif ($action == 'CONTRACT_CREATE') { |
553 | 553 | dol_syslog( |
554 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
554 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
555 | 555 | ); |
556 | 556 | } elseif ($action == 'CONTRACT_MODIFY') { |
557 | 557 | dol_syslog( |
558 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
558 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
559 | 559 | ); |
560 | 560 | } elseif ($action == 'CONTRACT_ACTIVATE') { |
561 | 561 | dol_syslog( |
562 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
562 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
563 | 563 | ); |
564 | 564 | } elseif ($action == 'CONTRACT_CANCEL') { |
565 | 565 | dol_syslog( |
566 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
566 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
567 | 567 | ); |
568 | 568 | } elseif ($action == 'CONTRACT_CLOSE') { |
569 | 569 | dol_syslog( |
570 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
570 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
571 | 571 | ); |
572 | 572 | } elseif ($action == 'CONTRACT_DELETE') { |
573 | 573 | dol_syslog( |
574 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
574 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | |
578 | 578 | elseif ($action == 'BILL_MODIFY') { |
579 | 579 | dol_syslog( |
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
580 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
581 | 581 | ); |
582 | 582 | } elseif ($action == 'BILL_VALIDATE') { |
583 | 583 | dol_syslog( |
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
584 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
585 | 585 | ); |
586 | 586 | } elseif ($action == 'BILL_BUILDDOC') { |
587 | 587 | dol_syslog( |
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
588 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
589 | 589 | ); |
590 | 590 | } elseif ($action == 'BILL_SENTBYMAIL') { |
591 | 591 | dol_syslog( |
592 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
592 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
593 | 593 | ); |
594 | 594 | } elseif ($action == 'BILL_CANCEL') { |
595 | 595 | dol_syslog( |
596 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
596 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
597 | 597 | ); |
598 | 598 | } elseif ($action == 'BILL_DELETE') { |
599 | 599 | dol_syslog( |
600 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
600 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
601 | 601 | ); |
602 | 602 | } elseif ($action == 'LINEBILL_INSERT') { |
603 | 603 | |
604 | 604 | dol_syslog( |
605 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
605 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
606 | 606 | ); |
607 | 607 | } elseif ($action == 'LINEBILL_DELETE') { |
608 | 608 | dol_syslog( |
609 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
609 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
610 | 610 | ); |
611 | 611 | } |
612 | 612 | |
613 | 613 | // Payments |
614 | 614 | elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
615 | 615 | dol_syslog( |
616 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
616 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
617 | 617 | ); |
618 | 618 | } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
619 | 619 | dol_syslog( |
620 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
620 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
621 | 621 | ); |
622 | 622 | } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
623 | 623 | dol_syslog( |
624 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
624 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
625 | 625 | ); |
626 | 626 | } elseif ($action == 'PAYMENT_DELETE') { |
627 | 627 | dol_syslog( |
628 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
628 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
629 | 629 | ); |
630 | 630 | } |
631 | 631 | |
632 | 632 | // Interventions |
633 | 633 | elseif ($action == 'FICHEINTER_CREATE') { |
634 | 634 | dol_syslog( |
635 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
635 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
636 | 636 | ); |
637 | 637 | } elseif ($action == 'FICHEINTER_MODIFY') { |
638 | 638 | dol_syslog( |
639 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
639 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
640 | 640 | ); |
641 | 641 | } elseif ($action == 'FICHEINTER_VALIDATE') { |
642 | 642 | dol_syslog( |
643 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
643 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
644 | 644 | ); |
645 | 645 | } elseif ($action == 'FICHEINTER_DELETE') { |
646 | 646 | dol_syslog( |
647 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
647 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
648 | 648 | ); |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Members |
652 | 652 | elseif ($action == 'MEMBER_CREATE') { |
653 | 653 | dol_syslog( |
654 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
654 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
655 | 655 | ); |
656 | 656 | } elseif ($action == 'MEMBER_VALIDATE') { |
657 | 657 | dol_syslog( |
658 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
658 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
659 | 659 | ); |
660 | 660 | } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
661 | 661 | dol_syslog( |
662 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
662 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
663 | 663 | ); |
664 | 664 | } elseif ($action == 'MEMBER_MODIFY') { |
665 | 665 | dol_syslog( |
666 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
666 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
667 | 667 | ); |
668 | 668 | } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
669 | 669 | dol_syslog( |
670 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
670 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
671 | 671 | ); |
672 | 672 | } elseif ($action == 'MEMBER_RESILIATE') { |
673 | 673 | dol_syslog( |
674 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
674 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
675 | 675 | ); |
676 | 676 | } elseif ($action == 'MEMBER_DELETE') { |
677 | 677 | dol_syslog( |
678 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
678 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
679 | 679 | ); |
680 | 680 | } |
681 | 681 | |
682 | 682 | // Categories |
683 | 683 | elseif ($action == 'CATEGORY_CREATE') { |
684 | 684 | dol_syslog( |
685 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
685 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
686 | 686 | ); |
687 | 687 | } elseif ($action == 'CATEGORY_MODIFY') { |
688 | 688 | dol_syslog( |
689 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
689 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
690 | 690 | ); |
691 | 691 | } elseif ($action == 'CATEGORY_DELETE') { |
692 | 692 | dol_syslog( |
693 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
693 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
694 | 694 | ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | // Projects |
698 | 698 | elseif ($action == 'PROJECT_CREATE') { |
699 | 699 | dol_syslog( |
700 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
700 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
701 | 701 | ); |
702 | 702 | } elseif ($action == 'PROJECT_MODIFY') { |
703 | 703 | dol_syslog( |
704 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
704 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
705 | 705 | ); |
706 | 706 | } elseif ($action == 'PROJECT_DELETE') { |
707 | 707 | dol_syslog( |
708 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
708 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
709 | 709 | ); |
710 | 710 | } |
711 | 711 | |
712 | 712 | // Project tasks |
713 | 713 | elseif ($action == 'TASK_CREATE') { |
714 | 714 | dol_syslog( |
715 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
715 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
716 | 716 | ); |
717 | 717 | } elseif ($action == 'TASK_MODIFY') { |
718 | 718 | dol_syslog( |
719 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
719 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
720 | 720 | ); |
721 | 721 | } elseif ($action == 'TASK_DELETE') { |
722 | 722 | dol_syslog( |
723 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
723 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
724 | 724 | ); |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Task time spent |
728 | 728 | elseif ($action == 'TASK_TIMESPENT_CREATE') { |
729 | 729 | dol_syslog( |
730 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
730 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
731 | 731 | ); |
732 | 732 | } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
733 | 733 | dol_syslog( |
734 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
734 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
735 | 735 | ); |
736 | 736 | } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
737 | 737 | dol_syslog( |
738 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
738 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
739 | 739 | ); |
740 | 740 | } |
741 | 741 | |
742 | 742 | // Shipping |
743 | 743 | elseif ($action == 'SHIPPING_CREATE') { |
744 | 744 | dol_syslog( |
745 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
745 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
746 | 746 | ); |
747 | 747 | } elseif ($action == 'SHIPPING_MODIFY') { |
748 | 748 | dol_syslog( |
749 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
749 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
750 | 750 | ); |
751 | 751 | } elseif ($action == 'SHIPPING_VALIDATE') { |
752 | 752 | dol_syslog( |
753 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
753 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
754 | 754 | ); |
755 | 755 | } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
756 | 756 | dol_syslog( |
757 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
757 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
758 | 758 | ); |
759 | 759 | } elseif ($action == 'SHIPPING_DELETE') { |
760 | 760 | dol_syslog( |
761 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
761 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
762 | 762 | ); |
763 | 763 | } elseif ($action == 'SHIPPING_BUILDDOC') { |
764 | 764 | dol_syslog( |
765 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
765 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
766 | 766 | ); |
767 | 767 | } |
768 | 768 | |
769 | 769 | // File |
770 | 770 | elseif ($action == 'FILE_UPLOAD') { |
771 | 771 | dol_syslog( |
772 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
772 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
773 | 773 | ); |
774 | 774 | } elseif ($action == 'FILE_DELETE') { |
775 | 775 | dol_syslog( |
776 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
776 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
777 | 777 | ); |
778 | 778 | } |
779 | 779 |
@@ -89,12 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | if ($this->version == 'development') { |
91 | 91 | return $langs->trans("Development"); |
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
92 | + } elseif ($this->version == 'experimental') { |
|
93 | + |
|
94 | 94 | return $langs->trans("Experimental"); |
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
95 | + } elseif ($this->version == 'dolibarr') { |
|
96 | + return DOL_VERSION; |
|
97 | + } elseif ($this->version) { |
|
98 | + return $this->version; |
|
99 | + } else { |
|
98 | 100 | return $langs->trans("Unknown"); |
99 | 101 | } |
100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
122 | 124 | $subtotal_line_found = false; |
123 | 125 | foreach ($parent->lines as $k => &$line) |
124 | 126 | { |
125 | - if ($line->rang < $rang) continue; |
|
126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | + if ($line->rang < $rang) { |
|
128 | + continue; |
|
129 | + } elseif ($line->rang == $rang) { |
|
130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | 131 | { |
128 | 132 | $title_level = $line->qty; |
129 | 133 | } |
130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
131 | 136 | { |
132 | 137 | $subtotal_line_found = true; |
138 | + } |
|
133 | 139 | $rang = $line->rang; |
134 | 140 | } |
135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
191 | 197 | break; |
192 | 198 | } |
193 | 199 | |
194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
195 | - else $this->addToBegin($parent, $object, $rang); |
|
200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
201 | + $this->addToEnd($parent, $object, $rang); |
|
202 | + } else { |
|
203 | + $this->addToBegin($parent, $object, $rang); |
|
204 | + } |
|
196 | 205 | |
197 | 206 | } |
198 | 207 | |
@@ -220,7 +229,9 @@ discard block |
||
220 | 229 | $commande->fetch($current_fk_commande); |
221 | 230 | |
222 | 231 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
223 | - if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
232 | + if (empty($label)) { |
|
233 | + $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
234 | + } |
|
224 | 235 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
225 | 236 | |
226 | 237 | TSubtotal::addTitle($facture, $label, 1, $rang); |
@@ -271,10 +282,15 @@ discard block |
||
271 | 282 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
272 | 283 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
273 | 284 | |
274 | - if ($object->element == 'propal') $res = $object->update(1); |
|
275 | - else $res = $object->update($user, 1); |
|
285 | + if ($object->element == 'propal') { |
|
286 | + $res = $object->update(1); |
|
287 | + } else { |
|
288 | + $res = $object->update($user, 1); |
|
289 | + } |
|
276 | 290 | |
277 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
291 | + if ($res > 0) { |
|
292 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
293 | + } |
|
278 | 294 | break; |
279 | 295 | } |
280 | 296 | } |
@@ -284,10 +300,15 @@ discard block |
||
284 | 300 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
285 | 301 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
286 | 302 | |
287 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
288 | - else $res = $object->update($user, 1); |
|
303 | + if ($object->element == 'propaldet') { |
|
304 | + $res = $object->update(1); |
|
305 | + } else { |
|
306 | + $res = $object->update($user, 1); |
|
307 | + } |
|
289 | 308 | |
290 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
309 | + if ($res > 0) { |
|
310 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
311 | + } |
|
291 | 312 | } |
292 | 313 | } |
293 | 314 | } |
@@ -484,26 +505,38 @@ discard block |
||
484 | 505 | ); |
485 | 506 | |
486 | 507 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
487 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
488 | - else $object->fetch($object->id); |
|
508 | + if (method_exists($object, 'fetch_lines')) { |
|
509 | + $object->fetch_lines(); |
|
510 | + } else { |
|
511 | + $object->fetch($object->id); |
|
512 | + } |
|
489 | 513 | |
490 | 514 | foreach ($object->lines as &$line) |
491 | 515 | { |
492 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
516 | + if (empty($line->array_options)) { |
|
517 | + $line->fetch_optionals(); |
|
518 | + } |
|
493 | 519 | |
494 | 520 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
495 | 521 | { |
496 | 522 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
497 | 523 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
498 | 524 | |
499 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
500 | - else $res = $line->update($user, 1); |
|
525 | + if ($line->element == 'propaldet') { |
|
526 | + $res = $line->update(1); |
|
527 | + } else { |
|
528 | + $res = $line->update($user, 1); |
|
529 | + } |
|
501 | 530 | |
502 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
531 | + if ($res > 0) { |
|
532 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
533 | + } |
|
503 | 534 | } |
504 | 535 | } |
505 | 536 | |
506 | - if (!empty($line)) $object->update_price(1); |
|
537 | + if (!empty($line)) { |
|
538 | + $object->update_price(1); |
|
539 | + } |
|
507 | 540 | } |
508 | 541 | |
509 | 542 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -573,9 +606,7 @@ discard block |
||
573 | 606 | dol_syslog( |
574 | 607 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
575 | 608 | ); |
576 | - } |
|
577 | - |
|
578 | - elseif ($action == 'BILL_MODIFY') { |
|
609 | + } elseif ($action == 'BILL_MODIFY') { |
|
579 | 610 | dol_syslog( |
580 | 611 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
581 | 612 | ); |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @return void |
48 | 48 | */ |
49 | 49 | |
50 | - var $module_number = 104777; |
|
50 | + var $module_number = 104777; |
|
51 | 51 | |
52 | - function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
53 | - { |
|
54 | - global $langs,$db,$user, $conf; |
|
52 | + function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
|
53 | + { |
|
54 | + global $langs,$db,$user, $conf; |
|
55 | 55 | |
56 | 56 | $langs->load('subtotal@subtotal'); |
57 | 57 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
115 | 115 | |
116 | - TSubtotal::addSubTotalLine($object, $title, $qty); |
|
116 | + TSubtotal::addSubTotalLine($object, $title, $qty); |
|
117 | 117 | } |
118 | 118 | else if($action==='ask_deleteallline') { |
119 | 119 | $form=new Form($db); |
@@ -339,29 +339,29 @@ discard block |
||
339 | 339 | || in_array('ordercard',$TContext) |
340 | 340 | || in_array('invoicereccard',$TContext) |
341 | 341 | ) |
342 | - { |
|
342 | + { |
|
343 | 343 | $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
344 | 344 | $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
345 | 345 | $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : 0; |
346 | 346 | |
347 | 347 | $var=false; |
348 | - $out.= '<tr '.$bc[$var].'> |
|
348 | + $out.= '<tr '.$bc[$var].'> |
|
349 | 349 | <td colspan="4" align="right"> |
350 | 350 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
351 | 351 | <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
352 | 352 | </td> |
353 | 353 | </tr>'; |
354 | 354 | |
355 | - $var=!$var; |
|
356 | - $out.= '<tr '.$bc[$var].'> |
|
355 | + $var=!$var; |
|
356 | + $out.= '<tr '.$bc[$var].'> |
|
357 | 357 | <td colspan="4" align="right"> |
358 | 358 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
359 | 359 | <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
360 | 360 | </td> |
361 | 361 | </tr>'; |
362 | 362 | |
363 | - $var=!$var; |
|
364 | - $out.= '<tr '.$bc[$var].'> |
|
363 | + $var=!$var; |
|
364 | + $out.= '<tr '.$bc[$var].'> |
|
365 | 365 | <td colspan="4" align="right"> |
366 | 366 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
367 | 367 | <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
@@ -392,19 +392,19 @@ discard block |
||
392 | 392 | } |
393 | 393 | |
394 | 394 | |
395 | - return 1; |
|
395 | + return 1; |
|
396 | 396 | } |
397 | 397 | |
398 | - function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
399 | - { |
|
398 | + function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
|
399 | + { |
|
400 | 400 | |
401 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
402 | - { |
|
401 | + if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
402 | + { |
|
403 | 403 | |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - return 0; |
|
407 | - } |
|
406 | + return 0; |
|
407 | + } |
|
408 | 408 | |
409 | 409 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
410 | 410 | global $conf; |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | || in_array('propalcard',explode(':',$parameters['context'])) |
535 | 535 | || in_array('ordercard',explode(':',$parameters['context'])) |
536 | 536 | ) |
537 | - { |
|
537 | + { |
|
538 | 538 | if(in_array('invoicecard',explode(':',$parameters['context']))) { |
539 | 539 | $sessname = 'subtotal_hideInnerLines_facture'; |
540 | 540 | $sessname2 = 'subtotal_hidedetails_facture'; |
@@ -570,17 +570,17 @@ discard block |
||
570 | 570 | foreach($object->lines as &$line) { |
571 | 571 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
572 | 572 | |
573 | - if($line->qty>=90) { |
|
574 | - $line->modsubtotal_total = 1; |
|
575 | - } |
|
576 | - else{ |
|
577 | - $line->modsubtotal_title = 1; |
|
578 | - } |
|
573 | + if($line->qty>=90) { |
|
574 | + $line->modsubtotal_total = 1; |
|
575 | + } |
|
576 | + else{ |
|
577 | + $line->modsubtotal_title = 1; |
|
578 | + } |
|
579 | 579 | |
580 | 580 | $line->total_ht = $this->getTotalLineFromObject($object, $line, ''); |
581 | 581 | } |
582 | - } |
|
583 | - } |
|
582 | + } |
|
583 | + } |
|
584 | 584 | |
585 | 585 | } |
586 | 586 | else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
@@ -732,17 +732,17 @@ discard block |
||
732 | 732 | if($l->rang>=$rang) { |
733 | 733 | return price($total); |
734 | 734 | } |
735 | - if (TSubtotal::isSubtotal($l)){ |
|
736 | - $total = 0; |
|
737 | - } else if ($l->situation_percent > 0 ){ |
|
735 | + if (TSubtotal::isSubtotal($l)){ |
|
736 | + $total = 0; |
|
737 | + } else if ($l->situation_percent > 0 ){ |
|
738 | 738 | |
739 | 739 | |
740 | 740 | $prev_progress = $l->get_prev_progress($object->id); |
741 | 741 | $progress = ($l->situation_percent - $prev_progress) /100; |
742 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
742 | + $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
743 | 743 | |
744 | - } |
|
745 | - } |
|
744 | + } |
|
745 | + } |
|
746 | 746 | |
747 | 747 | return price($total); |
748 | 748 | } |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | if(method_exists('Closure','bind')) { |
775 | 775 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
776 | 776 | $sweetsThief = function ($pdf) { |
777 | - return $pdf->bMargin ; |
|
777 | + return $pdf->bMargin ; |
|
778 | 778 | }; |
779 | 779 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
780 | 780 | |
@@ -837,11 +837,11 @@ discard block |
||
837 | 837 | else |
838 | 838 | { |
839 | 839 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
840 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
841 | - $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
842 | - } else { |
|
843 | - $total_to_print = price($total); |
|
844 | - } |
|
840 | + if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
841 | + $total_to_print = $this->getTotalToPrintSituation($object, $line); |
|
842 | + } else { |
|
843 | + $total_to_print = price($total); |
|
844 | + } |
|
845 | 845 | |
846 | 846 | $line->total_ht = $total; |
847 | 847 | $line->total = $total; |
@@ -1031,19 +1031,19 @@ discard block |
||
1031 | 1031 | } |
1032 | 1032 | } |
1033 | 1033 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1034 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1035 | - else $i = (int)$parameters; |
|
1036 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1034 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1035 | + else $i = (int)$parameters; |
|
1036 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1037 | 1037 | } |
1038 | 1038 | if (!empty($hideprices) |
1039 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1040 | - ) |
|
1039 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1040 | + ) |
|
1041 | 1041 | { |
1042 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1043 | - { |
|
1044 | - $this->resprints = ' '; |
|
1045 | - return 1; |
|
1046 | - } |
|
1042 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1043 | + { |
|
1044 | + $this->resprints = ' '; |
|
1045 | + return 1; |
|
1046 | + } |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | return 0; |
@@ -1323,11 +1323,11 @@ discard block |
||
1323 | 1323 | $hidedetails = (int)GETPOST('hidedetails'); |
1324 | 1324 | |
1325 | 1325 | if ($hideInnerLines) { // si c une ligne de titre |
1326 | - $fk_parent_line=0; |
|
1326 | + $fk_parent_line=0; |
|
1327 | 1327 | $TLines =array(); |
1328 | 1328 | |
1329 | 1329 | $original_count=count($object->lines); |
1330 | - $TTvas = array(); // tableau de tva |
|
1330 | + $TTvas = array(); // tableau de tva |
|
1331 | 1331 | |
1332 | 1332 | foreach($object->lines as $k=>&$line) |
1333 | 1333 | { |
@@ -1357,48 +1357,48 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | if ($hideInnerLines) |
1359 | 1359 | { |
1360 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1361 | - { |
|
1362 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1360 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1361 | + { |
|
1362 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1363 | 1363 | |
1364 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1365 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1366 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1367 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1368 | - } |
|
1369 | - if($line->product_type==9 && $line->rowid>0) |
|
1370 | - { |
|
1371 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1372 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1373 | - $nbtva = count($TTvas); |
|
1374 | - if(!empty($nbtva)){ |
|
1375 | - foreach ($TTvas as $tx =>$val){ |
|
1376 | - $l = clone $line; |
|
1377 | - $l->product_type = 1; |
|
1378 | - $l->special_code = ''; |
|
1379 | - $l->qty = 1; |
|
1380 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1381 | - $l->tva_tx = $tx; |
|
1382 | - $l->total_ht = $val['total_ht']; |
|
1383 | - $l->total_tva = $val['total_tva']; |
|
1384 | - $l->total = $line->total_ht; |
|
1385 | - $l->total_ttc = $val['total_ttc']; |
|
1386 | - $TLines[] = $l; |
|
1387 | - array_shift($TTvas); |
|
1388 | - } |
|
1389 | - } |
|
1364 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1365 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1366 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1367 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1368 | + } |
|
1369 | + if($line->product_type==9 && $line->rowid>0) |
|
1370 | + { |
|
1371 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1372 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1373 | + $nbtva = count($TTvas); |
|
1374 | + if(!empty($nbtva)){ |
|
1375 | + foreach ($TTvas as $tx =>$val){ |
|
1376 | + $l = clone $line; |
|
1377 | + $l->product_type = 1; |
|
1378 | + $l->special_code = ''; |
|
1379 | + $l->qty = 1; |
|
1380 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1381 | + $l->tva_tx = $tx; |
|
1382 | + $l->total_ht = $val['total_ht']; |
|
1383 | + $l->total_tva = $val['total_tva']; |
|
1384 | + $l->total = $line->total_ht; |
|
1385 | + $l->total_ttc = $val['total_ttc']; |
|
1386 | + $TLines[] = $l; |
|
1387 | + array_shift($TTvas); |
|
1388 | + } |
|
1389 | + } |
|
1390 | 1390 | |
1391 | - // ajoute la ligne de sous-total |
|
1392 | - $TLines[] = $line; |
|
1393 | - } |
|
1394 | - } else { |
|
1391 | + // ajoute la ligne de sous-total |
|
1392 | + $TLines[] = $line; |
|
1393 | + } |
|
1394 | + } else { |
|
1395 | 1395 | |
1396 | - if($line->product_type==9 && $line->rowid>0) |
|
1397 | - { |
|
1398 | - // ajoute la ligne de sous-total |
|
1399 | - $TLines[] = $line; |
|
1400 | - } |
|
1401 | - } |
|
1396 | + if($line->product_type==9 && $line->rowid>0) |
|
1397 | + { |
|
1398 | + // ajoute la ligne de sous-total |
|
1399 | + $TLines[] = $line; |
|
1400 | + } |
|
1401 | + } |
|
1402 | 1402 | |
1403 | 1403 | |
1404 | 1404 | } |
@@ -1423,20 +1423,20 @@ discard block |
||
1423 | 1423 | $nbtva = count($TTvas); |
1424 | 1424 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1425 | 1425 | { |
1426 | - foreach ($TTvas as $tx =>$val){ |
|
1427 | - $l = clone $line; |
|
1428 | - $l->product_type = 1; |
|
1429 | - $l->special_code = ''; |
|
1430 | - $l->qty = 1; |
|
1431 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1432 | - $l->tva_tx = $tx; |
|
1433 | - $l->total_ht = $val['total_ht']; |
|
1434 | - $l->total_tva = $val['total_tva']; |
|
1435 | - $l->total = $line->total_ht; |
|
1436 | - $l->total_ttc = $val['total_ttc']; |
|
1437 | - $TLines[] = $l; |
|
1438 | - array_shift($TTvas); |
|
1439 | - } |
|
1426 | + foreach ($TTvas as $tx =>$val){ |
|
1427 | + $l = clone $line; |
|
1428 | + $l->product_type = 1; |
|
1429 | + $l->special_code = ''; |
|
1430 | + $l->qty = 1; |
|
1431 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1432 | + $l->tva_tx = $tx; |
|
1433 | + $l->total_ht = $val['total_ht']; |
|
1434 | + $l->total_tva = $val['total_tva']; |
|
1435 | + $l->total = $line->total_ht; |
|
1436 | + $l->total_ttc = $val['total_ttc']; |
|
1437 | + $TLines[] = $l; |
|
1438 | + array_shift($TTvas); |
|
1439 | + } |
|
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | global $nblignes; |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | $this->resprints = ''; |
1449 | 1449 | return 0; |
1450 | 1450 | } |
1451 | - } |
|
1451 | + } |
|
1452 | 1452 | |
1453 | 1453 | return 0; |
1454 | 1454 | } |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | null; |
1615 | 1615 | } |
1616 | 1616 | else if (in_array('invoicecard',$contexts) || in_array('propalcard',$contexts) || in_array('ordercard',$contexts) || in_array('invoicereccard',$contexts)) |
1617 | - { |
|
1617 | + { |
|
1618 | 1618 | if($object->element=='facture')$idvar = 'facid'; |
1619 | 1619 | else $idvar='id'; |
1620 | 1620 | |
@@ -1659,7 +1659,7 @@ discard block |
||
1659 | 1659 | //var_dump($line); |
1660 | 1660 | |
1661 | 1661 | // HTML 5 data for js |
1662 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1662 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1663 | 1663 | |
1664 | 1664 | |
1665 | 1665 | ?> |
@@ -2088,80 +2088,80 @@ discard block |
||
2088 | 2088 | // HTML 5 data for js |
2089 | 2089 | private function _getHtmlData($parameters, &$object, &$action, $hookmanager) |
2090 | 2090 | { |
2091 | - $line = &$parameters['line']; |
|
2091 | + $line = &$parameters['line']; |
|
2092 | 2092 | |
2093 | - $ThtmlData['data-id'] = $line->id; |
|
2094 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2095 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2096 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2093 | + $ThtmlData['data-id'] = $line->id; |
|
2094 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2095 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2096 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2097 | 2097 | |
2098 | - if(TSubtotal::isTitle($line)){ |
|
2099 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2100 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2101 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2102 | - } |
|
2103 | - else{ |
|
2104 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2105 | - } |
|
2098 | + if(TSubtotal::isTitle($line)){ |
|
2099 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2100 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2101 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2102 | + } |
|
2103 | + else{ |
|
2104 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2105 | + } |
|
2106 | 2106 | |
2107 | 2107 | |
2108 | - // Change or add data from hooks |
|
2109 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2108 | + // Change or add data from hooks |
|
2109 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2110 | 2110 | |
2111 | - // hook |
|
2112 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2113 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2114 | - if ($reshook>0) |
|
2115 | - { |
|
2116 | - $ThtmlData = $hookmanager->resArray; |
|
2117 | - } |
|
2118 | - |
|
2119 | - return $this->implodeHtmlData($ThtmlData); |
|
2111 | + // hook |
|
2112 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2113 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2114 | + if ($reshook>0) |
|
2115 | + { |
|
2116 | + $ThtmlData = $hookmanager->resArray; |
|
2117 | + } |
|
2118 | + |
|
2119 | + return $this->implodeHtmlData($ThtmlData); |
|
2120 | 2120 | |
2121 | 2121 | } |
2122 | 2122 | |
2123 | 2123 | |
2124 | 2124 | function implodeHtmlData($ThtmlData = array()) |
2125 | 2125 | { |
2126 | - $data = ''; |
|
2127 | - foreach($ThtmlData as $k => $h ) |
|
2128 | - { |
|
2129 | - if(is_array($h)) |
|
2130 | - { |
|
2131 | - $h = json_encode($h); |
|
2132 | - } |
|
2126 | + $data = ''; |
|
2127 | + foreach($ThtmlData as $k => $h ) |
|
2128 | + { |
|
2129 | + if(is_array($h)) |
|
2130 | + { |
|
2131 | + $h = json_encode($h); |
|
2132 | + } |
|
2133 | 2133 | |
2134 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2135 | - } |
|
2134 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2135 | + } |
|
2136 | 2136 | |
2137 | - return $data; |
|
2137 | + return $data; |
|
2138 | 2138 | } |
2139 | 2139 | |
2140 | 2140 | function _ajax_block_order_js($object) |
2141 | 2141 | { |
2142 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2142 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2143 | 2143 | |
2144 | - /* |
|
2144 | + /* |
|
2145 | 2145 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2146 | 2146 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2147 | 2147 | */ |
2148 | 2148 | |
2149 | - $id=$object->id; |
|
2150 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2151 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2149 | + $id=$object->id; |
|
2150 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2151 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2152 | 2152 | |
2153 | - $id=$object->id; |
|
2154 | - $fk_element=$object->fk_element; |
|
2155 | - $table_element_line=$object->table_element_line; |
|
2156 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2157 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2158 | - $filepath=(empty($filepath)?'':$filepath); |
|
2153 | + $id=$object->id; |
|
2154 | + $fk_element=$object->fk_element; |
|
2155 | + $table_element_line=$object->table_element_line; |
|
2156 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2157 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2158 | + $filepath=(empty($filepath)?'':$filepath); |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2162 | - { |
|
2161 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2162 | + { |
|
2163 | 2163 | |
2164 | - ?> |
|
2164 | + ?> |
|
2165 | 2165 | |
2166 | 2166 | |
2167 | 2167 | <script type="text/javascript"> |
@@ -51,37 +51,37 @@ discard block |
||
51 | 51 | |
52 | 52 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
53 | 53 | { |
54 | - global $langs,$db,$user, $conf; |
|
54 | + global $langs, $db, $user, $conf; |
|
55 | 55 | |
56 | 56 | $langs->load('subtotal@subtotal'); |
57 | 57 | |
58 | - $contexts = explode(':',$parameters['context']); |
|
58 | + $contexts = explode(':', $parameters['context']); |
|
59 | 59 | |
60 | - if(in_array('ordercard',$contexts) || in_array('propalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
60 | + if (in_array('ordercard', $contexts) || in_array('propalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
61 | 61 | |
62 | 62 | $createRight = $user->rights->{$object->element}->creer; |
63 | - if($object->element == 'facturerec' ) |
|
63 | + if ($object->element == 'facturerec') |
|
64 | 64 | { |
65 | 65 | $object->statut = 0; // hack for facture rec |
66 | 66 | $createRight = $user->rights->facture->creer; |
67 | 67 | } |
68 | 68 | |
69 | - if ($object->statut == 0 && $createRight) { |
|
69 | + if ($object->statut == 0 && $createRight) { |
|
70 | 70 | |
71 | 71 | |
72 | - if($object->element=='facture')$idvar = 'facid'; |
|
73 | - else $idvar='id'; |
|
72 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
73 | + else $idvar = 'id'; |
|
74 | 74 | |
75 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
75 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
76 | 76 | { |
77 | 77 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
78 | 78 | |
79 | - if($action=='add_title_line') { |
|
79 | + if ($action == 'add_title_line') { |
|
80 | 80 | $title = GETPOST('title'); |
81 | - if(empty($title)) $title = $langs->trans('title'); |
|
82 | - $qty = $level<1 ? 1 : $level ; |
|
81 | + if (empty($title)) $title = $langs->trans('title'); |
|
82 | + $qty = $level < 1 ? 1 : $level; |
|
83 | 83 | } |
84 | - else if($action=='add_free_text') { |
|
84 | + else if ($action == 'add_free_text') { |
|
85 | 85 | $title = GETPOST('title'); |
86 | 86 | |
87 | 87 | if (empty($title)) { |
@@ -93,21 +93,21 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |
96 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
96 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
97 | 97 | $qty = 50; |
98 | 98 | } |
99 | - else if($action=='add_subtitle_line') { |
|
99 | + else if ($action == 'add_subtitle_line') { |
|
100 | 100 | $title = GETPOST('title'); |
101 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
101 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
102 | 102 | $qty = 2; |
103 | 103 | } |
104 | - else if($action=='add_subtotal_line') { |
|
104 | + else if ($action == 'add_subtotal_line') { |
|
105 | 105 | $title = $langs->trans('SubSubTotal'); |
106 | 106 | $qty = 98; |
107 | 107 | } |
108 | 108 | else { |
109 | 109 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
110 | - $qty = $level ? 100-$level : 99; |
|
110 | + $qty = $level ? 100 - $level : 99; |
|
111 | 111 | } |
112 | 112 | dol_include_once('/subtotal/class/subtotal.class.php'); |
113 | 113 | |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | |
116 | 116 | TSubtotal::addSubTotalLine($object, $title, $qty); |
117 | 117 | } |
118 | - else if($action==='ask_deleteallline') { |
|
119 | - $form=new Form($db); |
|
118 | + else if ($action === 'ask_deleteallline') { |
|
119 | + $form = new Form($db); |
|
120 | 120 | |
121 | - $lineid = GETPOST('lineid','integer'); |
|
121 | + $lineid = GETPOST('lineid', 'integer'); |
|
122 | 122 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
123 | 123 | |
124 | 124 | $nbLines = count($TIdForGroup); |
125 | 125 | |
126 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
126 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
127 | 127 | print $formconfirm; |
128 | 128 | } |
129 | 129 | |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | - if($action!='editline') { |
|
136 | + if ($action != 'editline') { |
|
137 | 137 | // New format is for 3.8 |
138 | 138 | $this->printNewFormat($object, $conf, $langs, $idvar); |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
142 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
143 | 143 | { |
144 | 144 | ?> |
145 | 145 | <script type="text/javascript"> |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $(document).ready(function() { |
165 | 165 | $('div.fiche div.tabsAction').append('<br />'); |
166 | 166 | |
167 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
167 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
168 | 168 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
169 | 169 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
170 | 170 | |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | $('body').append(dialog_html); |
216 | 216 | |
217 | 217 | <?php |
218 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
219 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
220 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
218 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
219 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
220 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
221 | 221 | ?> |
222 | 222 | if (action == 'addTitle' || action == 'addFreeTxt') |
223 | 223 | { |
@@ -332,57 +332,57 @@ discard block |
||
332 | 332 | global $conf, $langs, $bc; |
333 | 333 | |
334 | 334 | $action = GETPOST('action'); |
335 | - $TContext = explode(':',$parameters['context']); |
|
335 | + $TContext = explode(':', $parameters['context']); |
|
336 | 336 | if ( |
337 | - in_array('invoicecard',$TContext) |
|
338 | - || in_array('propalcard',$TContext) |
|
339 | - || in_array('ordercard',$TContext) |
|
340 | - || in_array('invoicereccard',$TContext) |
|
337 | + in_array('invoicecard', $TContext) |
|
338 | + || in_array('propalcard', $TContext) |
|
339 | + || in_array('ordercard', $TContext) |
|
340 | + || in_array('invoicereccard', $TContext) |
|
341 | 341 | ) |
342 | 342 | { |
343 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
344 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
345 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : 0; |
|
343 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']] : 0; |
|
344 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']] : 0; |
|
345 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']] : 0; |
|
346 | 346 | |
347 | - $var=false; |
|
348 | - $out.= '<tr '.$bc[$var].'> |
|
347 | + $var = false; |
|
348 | + $out .= '<tr '.$bc[$var].'> |
|
349 | 349 | <td colspan="4" align="right"> |
350 | 350 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
351 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
351 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
352 | 352 | </td> |
353 | 353 | </tr>'; |
354 | 354 | |
355 | - $var=!$var; |
|
356 | - $out.= '<tr '.$bc[$var].'> |
|
355 | + $var = !$var; |
|
356 | + $out .= '<tr '.$bc[$var].'> |
|
357 | 357 | <td colspan="4" align="right"> |
358 | 358 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
359 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
359 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
360 | 360 | </td> |
361 | 361 | </tr>'; |
362 | 362 | |
363 | - $var=!$var; |
|
364 | - $out.= '<tr '.$bc[$var].'> |
|
363 | + $var = !$var; |
|
364 | + $out .= '<tr '.$bc[$var].'> |
|
365 | 365 | <td colspan="4" align="right"> |
366 | 366 | <label for="hidedetails">'.$langs->trans('SubTotalhidePrice').'</label> |
367 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
367 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
368 | 368 | </td> |
369 | 369 | </tr>'; |
370 | 370 | |
371 | 371 | |
372 | 372 | |
373 | 373 | if ( |
374 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
375 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
376 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
377 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
374 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
375 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
376 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
377 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
378 | 378 | ) |
379 | 379 | { |
380 | - $var=!$var; |
|
381 | - $out.= ' |
|
380 | + $var = !$var; |
|
381 | + $out .= ' |
|
382 | 382 | <tr '.$bc[$var].'> |
383 | 383 | <td colspan="4" align="right"> |
384 | 384 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
385 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
385 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
386 | 386 | </td> |
387 | 387 | </tr>'; |
388 | 388 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
399 | 399 | { |
400 | 400 | |
401 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
401 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
402 | 402 | { |
403 | 403 | |
404 | 404 | } |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
410 | 410 | global $conf; |
411 | 411 | |
412 | - if($action === 'builddoc') { |
|
412 | + if ($action === 'builddoc') { |
|
413 | 413 | |
414 | 414 | $line = &$parameters['line']; |
415 | 415 | $object = &$parameters['object']; |
416 | 416 | $substitutionarray = &$parameters['substitutionarray']; |
417 | 417 | |
418 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
418 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
419 | 419 | $substitutionarray['line_modsubtotal'] = 1; |
420 | 420 | |
421 | 421 | $substitutionarray['line_price_ht'] |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | = $substitutionarray['line_up'] |
427 | 427 | = ''; |
428 | 428 | |
429 | - if($line->qty>90) { |
|
429 | + if ($line->qty > 90) { |
|
430 | 430 | $substitutionarray['line_modsubtotal_total'] = true; |
431 | 431 | |
432 | 432 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | } |
443 | - else{ |
|
443 | + else { |
|
444 | 444 | $substitutionarray['line_not_modsubtotal'] = true; |
445 | 445 | $substitutionarray['line_modsubtotal'] = 0; |
446 | 446 | } |
@@ -452,26 +452,26 @@ discard block |
||
452 | 452 | function createFrom($parameters, &$object, $action, $hookmanager) { |
453 | 453 | |
454 | 454 | if ( |
455 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
456 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
457 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
458 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
455 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
456 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
457 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
458 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
459 | 459 | ) { |
460 | 460 | |
461 | 461 | global $db; |
462 | 462 | |
463 | 463 | $objFrom = $parameters['objFrom']; |
464 | 464 | |
465 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
465 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
466 | 466 | |
467 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
467 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
468 | 468 | |
469 | 469 | $line = & $object->lines[$k]; |
470 | 470 | |
471 | 471 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
472 | 472 | |
473 | 473 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
474 | - SET info_bits=".(int)$lineOld->info_bits." |
|
474 | + SET info_bits=".(int) $lineOld->info_bits." |
|
475 | 475 | WHERE rowid = ".$idLine." |
476 | 476 | "); |
477 | 477 | |
@@ -487,15 +487,15 @@ discard block |
||
487 | 487 | |
488 | 488 | function doActions($parameters, &$object, $action, $hookmanager) |
489 | 489 | { |
490 | - global $db, $conf, $langs,$user; |
|
490 | + global $db, $conf, $langs, $user; |
|
491 | 491 | |
492 | 492 | dol_include_once('/subtotal/class/subtotal.class.php'); |
493 | 493 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
494 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
494 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
495 | 495 | |
496 | 496 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
497 | 497 | |
498 | - if($object->element=='facture') $idvar = 'facid'; |
|
498 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
499 | 499 | else $idvar = 'id'; |
500 | 500 | |
501 | 501 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
509 | 509 | { |
510 | 510 | $found = true; |
511 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
511 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
512 | 512 | $extrafieldsline = new ExtraFields($db); |
513 | 513 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
514 | 514 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -527,25 +527,25 @@ discard block |
||
527 | 527 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
528 | 528 | } |
529 | 529 | } |
530 | - else if($action === 'builddoc') { |
|
530 | + else if ($action === 'builddoc') { |
|
531 | 531 | |
532 | 532 | if ( |
533 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
534 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
535 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
533 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
534 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
535 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
536 | 536 | ) |
537 | 537 | { |
538 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
538 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
539 | 539 | $sessname = 'subtotal_hideInnerLines_facture'; |
540 | 540 | $sessname2 = 'subtotal_hidedetails_facture'; |
541 | 541 | $sessname3 = 'subtotal_hideprices_facture'; |
542 | 542 | } |
543 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
543 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
544 | 544 | $sessname = 'subtotal_hideInnerLines_propal'; |
545 | 545 | $sessname2 = 'subtotal_hidedetails_propal'; |
546 | 546 | $sessname3 = 'subtotal_hideprices_propal'; |
547 | 547 | } |
548 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
548 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
549 | 549 | $sessname = 'subtotal_hideInnerLines_commande'; |
550 | 550 | $sessname2 = 'subtotal_hidedetails_commande'; |
551 | 551 | $sessname3 = 'subtotal_hideprices_commande'; |
@@ -558,22 +558,22 @@ discard block |
||
558 | 558 | |
559 | 559 | global $hideprices; |
560 | 560 | |
561 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
561 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
562 | 562 | $_SESSION[$sessname] = $hideInnerLines; |
563 | 563 | |
564 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
564 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
565 | 565 | $_SESSION[$sessname2] = $hidedetails; |
566 | 566 | |
567 | - $hideprices= (int)GETPOST('hideprices'); |
|
567 | + $hideprices = (int) GETPOST('hideprices'); |
|
568 | 568 | $_SESSION[$sessname3] = $hideprices; |
569 | 569 | |
570 | - foreach($object->lines as &$line) { |
|
570 | + foreach ($object->lines as &$line) { |
|
571 | 571 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
572 | 572 | |
573 | - if($line->qty>=90) { |
|
573 | + if ($line->qty >= 90) { |
|
574 | 574 | $line->modsubtotal_total = 1; |
575 | 575 | } |
576 | - else{ |
|
576 | + else { |
|
577 | 577 | $line->modsubtotal_title = 1; |
578 | 578 | } |
579 | 579 | |
@@ -583,23 +583,23 @@ discard block |
||
583 | 583 | } |
584 | 584 | |
585 | 585 | } |
586 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
586 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
587 | 587 | |
588 | 588 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
589 | 589 | |
590 | - foreach($Tab as $idLine) { |
|
590 | + foreach ($Tab as $idLine) { |
|
591 | 591 | /** |
592 | 592 | * @var $object Facture |
593 | 593 | */ |
594 | - if($object->element=='facture') $object->deleteline($idLine); |
|
594 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
595 | 595 | /** |
596 | 596 | * @var $object Propal |
597 | 597 | */ |
598 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
598 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
599 | 599 | /** |
600 | 600 | * @var $object Commande |
601 | 601 | */ |
602 | - else if($object->element=='commande') |
|
602 | + else if ($object->element == 'commande') |
|
603 | 603 | { |
604 | 604 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
605 | 605 | else $object->deleteline($idLine); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | /** |
608 | 608 | * @var $object Facturerec |
609 | 609 | */ |
610 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
610 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | header('location:?id='.$object->id); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | return 0; |
631 | 631 | } |
632 | 632 | |
633 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
633 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
634 | 634 | return 0; |
635 | 635 | } |
636 | 636 | |
@@ -642,20 +642,20 @@ discard block |
||
642 | 642 | |
643 | 643 | $found = false; |
644 | 644 | |
645 | - $Tab= array(); |
|
645 | + $Tab = array(); |
|
646 | 646 | |
647 | - foreach($object->lines as $l) { |
|
647 | + foreach ($object->lines as $l) { |
|
648 | 648 | |
649 | - if($l->rowid == $lineid) { |
|
649 | + if ($l->rowid == $lineid) { |
|
650 | 650 | $found = true; |
651 | 651 | $qty_line = $l->qty; |
652 | 652 | } |
653 | 653 | |
654 | - if($found) { |
|
654 | + if ($found) { |
|
655 | 655 | |
656 | 656 | $Tab[] = $l->rowid; |
657 | 657 | |
658 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
658 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
659 | 659 | break; // end of story |
660 | 660 | } |
661 | 661 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * |
685 | 685 | * @param $use_level isn't used anymore |
686 | 686 | */ |
687 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
687 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
688 | 688 | |
689 | 689 | $rang = $line->rang; |
690 | 690 | $qty_line = $line->qty; |
@@ -695,21 +695,21 @@ discard block |
||
695 | 695 | $TTotal_tva = array(); |
696 | 696 | |
697 | 697 | dol_include_once('/subtotal/class/subtotal.class.php'); |
698 | - foreach($object->lines as $l) { |
|
698 | + foreach ($object->lines as $l) { |
|
699 | 699 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
700 | - if($l->rang>=$rang) { |
|
700 | + if ($l->rang >= $rang) { |
|
701 | 701 | //echo 'return!<br>'; |
702 | 702 | if (!$return_all) return $total; |
703 | 703 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
704 | 704 | } |
705 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
705 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
706 | 706 | { |
707 | 707 | $total = 0; |
708 | 708 | $total_tva = 0; |
709 | 709 | $total_ttc = 0; |
710 | 710 | $TTotal_tva = array(); |
711 | 711 | } |
712 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
712 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
713 | 713 | $total += $l->total_ht; |
714 | 714 | $total_tva += $l->total_tva; |
715 | 715 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -728,18 +728,18 @@ discard block |
||
728 | 728 | |
729 | 729 | $rang = $line->rang; |
730 | 730 | $total = 0; |
731 | - foreach($object->lines as $l) { |
|
732 | - if($l->rang>=$rang) { |
|
731 | + foreach ($object->lines as $l) { |
|
732 | + if ($l->rang >= $rang) { |
|
733 | 733 | return price($total); |
734 | 734 | } |
735 | - if (TSubtotal::isSubtotal($l)){ |
|
735 | + if (TSubtotal::isSubtotal($l)) { |
|
736 | 736 | $total = 0; |
737 | - } else if ($l->situation_percent > 0 ){ |
|
737 | + } else if ($l->situation_percent > 0) { |
|
738 | 738 | |
739 | 739 | |
740 | 740 | $prev_progress = $l->get_prev_progress($object->id); |
741 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
742 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
741 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
742 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
743 | 743 | |
744 | 744 | } |
745 | 745 | } |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * @param $w float width |
759 | 759 | * @param $h float height |
760 | 760 | */ |
761 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
762 | - global $conf,$subtotal_last_title_posy; |
|
761 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
762 | + global $conf, $subtotal_last_title_posy; |
|
763 | 763 | |
764 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
764 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
765 | 765 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
766 | 766 | { |
767 | 767 | $posy = $subtotal_last_title_posy; |
@@ -771,34 +771,34 @@ discard block |
||
771 | 771 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
772 | 772 | |
773 | 773 | $set_pagebreak_margin = false; |
774 | - if(method_exists('Closure','bind')) { |
|
774 | + if (method_exists('Closure', 'bind')) { |
|
775 | 775 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
776 | - $sweetsThief = function ($pdf) { |
|
777 | - return $pdf->bMargin ; |
|
776 | + $sweetsThief = function($pdf) { |
|
777 | + return $pdf->bMargin; |
|
778 | 778 | }; |
779 | 779 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
780 | 780 | |
781 | - $bMargin = $sweetsThief($pdf); |
|
781 | + $bMargin = $sweetsThief($pdf); |
|
782 | 782 | |
783 | - $pdf->SetAutoPageBreak( false ); |
|
783 | + $pdf->SetAutoPageBreak(false); |
|
784 | 784 | |
785 | 785 | $set_pagebreak_margin = true; |
786 | 786 | } |
787 | 787 | |
788 | 788 | |
789 | - if($line->qty==99) |
|
790 | - $pdf->SetFillColor(220,220,220); |
|
791 | - elseif ($line->qty==98) |
|
792 | - $pdf->SetFillColor(230,230,230); |
|
789 | + if ($line->qty == 99) |
|
790 | + $pdf->SetFillColor(220, 220, 220); |
|
791 | + elseif ($line->qty == 98) |
|
792 | + $pdf->SetFillColor(230, 230, 230); |
|
793 | 793 | else |
794 | - $pdf->SetFillColor(240,240,240); |
|
794 | + $pdf->SetFillColor(240, 240, 240); |
|
795 | 795 | |
796 | 796 | $style = 'B'; |
797 | 797 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
798 | 798 | |
799 | 799 | $pdf->SetFont('', $style, 9); |
800 | 800 | |
801 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
801 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
802 | 802 | // var_dump($bMargin); |
803 | 803 | $pageAfter = $pdf->getPage(); |
804 | 804 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | } |
824 | 824 | } |
825 | 825 | |
826 | - if($total_to_print) { |
|
826 | + if ($total_to_print) { |
|
827 | 827 | |
828 | 828 | if (GETPOST('hideInnerLines')) |
829 | 829 | { |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | else |
838 | 838 | { |
839 | 839 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
840 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
840 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
841 | 841 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
842 | 842 | } else { |
843 | 843 | $total_to_print = price($total); |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | $pdf->SetXY($pdf->postotalht, $posy); |
854 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
855 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
854 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
855 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
856 | 856 | } |
857 | - else{ |
|
858 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
857 | + else { |
|
858 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | $posy = $posy + $cell_height; |
@@ -875,22 +875,22 @@ discard block |
||
875 | 875 | * @param $w float width |
876 | 876 | * @param $h float height |
877 | 877 | */ |
878 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
878 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
879 | 879 | |
880 | - global $db,$conf,$subtotal_last_title_posy; |
|
880 | + global $db, $conf, $subtotal_last_title_posy; |
|
881 | 881 | |
882 | 882 | $subtotal_last_title_posy = $posy; |
883 | - $pdf->SetXY ($posx, $posy); |
|
883 | + $pdf->SetXY($posx, $posy); |
|
884 | 884 | |
885 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
885 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
886 | 886 | |
887 | 887 | |
888 | 888 | |
889 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
889 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
890 | 890 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
891 | 891 | |
892 | - if($hideInnerLines) { |
|
893 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
892 | + if ($hideInnerLines) { |
|
893 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
894 | 894 | else |
895 | 895 | { |
896 | 896 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -899,43 +899,43 @@ discard block |
||
899 | 899 | } |
900 | 900 | else { |
901 | 901 | |
902 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
902 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
903 | 903 | else $pdf->SetFont('', $style, 9); |
904 | 904 | |
905 | 905 | } |
906 | 906 | |
907 | 907 | 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 |
908 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
908 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
909 | 909 | |
910 | - if($description && !$hidedesc) { |
|
910 | + if ($description && !$hidedesc) { |
|
911 | 911 | $posy = $pdf->GetY(); |
912 | 912 | |
913 | 913 | $pdf->SetFont('', '', 8); |
914 | 914 | |
915 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
915 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
916 | 916 | |
917 | 917 | } |
918 | 918 | |
919 | 919 | } |
920 | 920 | |
921 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
921 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
922 | 922 | // ultimate PDF hook O_o |
923 | 923 | |
924 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
924 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
925 | 925 | |
926 | 926 | } |
927 | 927 | |
928 | 928 | function isModSubtotalLine(&$parameters, &$object) { |
929 | 929 | |
930 | - if(is_array($parameters)) { |
|
930 | + if (is_array($parameters)) { |
|
931 | 931 | $i = & $parameters['i']; |
932 | 932 | } |
933 | 933 | else { |
934 | - $i = (int)$parameters; |
|
934 | + $i = (int) $parameters; |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | |
938 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
938 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
939 | 939 | return true; |
940 | 940 | } |
941 | 941 | |
@@ -943,43 +943,43 @@ discard block |
||
943 | 943 | |
944 | 944 | } |
945 | 945 | |
946 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
947 | - global $conf,$hideprices; |
|
946 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
947 | + global $conf, $hideprices; |
|
948 | 948 | |
949 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
949 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
950 | 950 | |
951 | 951 | $this->resprints = ' '; |
952 | 952 | |
953 | - if((float)DOL_VERSION<=3.6) { |
|
953 | + if ((float) DOL_VERSION <= 3.6) { |
|
954 | 954 | return ''; |
955 | 955 | } |
956 | - else if((float)DOL_VERSION>=3.8) { |
|
956 | + else if ((float) DOL_VERSION >= 3.8) { |
|
957 | 957 | return 1; |
958 | 958 | } |
959 | 959 | |
960 | 960 | } |
961 | - elseif(!empty($hideprices)) { |
|
961 | + elseif (!empty($hideprices)) { |
|
962 | 962 | $this->resprints = $object->lines[$parameters['i']]->qty; |
963 | 963 | return 1; |
964 | 964 | } |
965 | 965 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
966 | 966 | { |
967 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
968 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
967 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
968 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
969 | 969 | if (empty($hideInnerLines) && !empty($hidedetails)) |
970 | 970 | { |
971 | 971 | $this->resprints = $object->lines[$parameters['i']]->qty; |
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
976 | - else $i = (int)$parameters; |
|
975 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
976 | + else $i = (int) $parameters; |
|
977 | 977 | |
978 | 978 | 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) |
979 | 979 | |
980 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
980 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
981 | 981 | |
982 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
982 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
983 | 983 | { |
984 | 984 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
985 | 985 | { |
@@ -991,25 +991,25 @@ discard block |
||
991 | 991 | return 0; |
992 | 992 | } |
993 | 993 | |
994 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
994 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
995 | 995 | global $conf, $hideprices; |
996 | 996 | |
997 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
997 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
998 | 998 | |
999 | 999 | $this->resprints = ' '; |
1000 | 1000 | |
1001 | - if((float)DOL_VERSION<=3.6) { |
|
1001 | + if ((float) DOL_VERSION <= 3.6) { |
|
1002 | 1002 | return ''; |
1003 | 1003 | } |
1004 | - else if((float)DOL_VERSION>=3.8) { |
|
1004 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1005 | 1005 | return 1; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | } |
1009 | 1009 | elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
1010 | 1010 | { |
1011 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1012 | - else $i = (int)$parameters; |
|
1011 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1012 | + else $i = (int) $parameters; |
|
1013 | 1013 | |
1014 | 1014 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1015 | 1015 | { |
@@ -1030,13 +1030,13 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | } |
1033 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1034 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1035 | - else $i = (int)$parameters; |
|
1033 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1034 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1035 | + else $i = (int) $parameters; |
|
1036 | 1036 | $this->resprints = price($object->lines[$i]->total_ht); |
1037 | 1037 | } |
1038 | 1038 | if (!empty($hideprices) |
1039 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1039 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1040 | 1040 | ) |
1041 | 1041 | { |
1042 | 1042 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1049,25 +1049,25 @@ discard block |
||
1049 | 1049 | return 0; |
1050 | 1050 | } |
1051 | 1051 | |
1052 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1052 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1053 | 1053 | global $conf; |
1054 | 1054 | |
1055 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1055 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1056 | 1056 | |
1057 | 1057 | $this->resprints = ' '; |
1058 | 1058 | |
1059 | - if((float)DOL_VERSION<=3.6) { |
|
1059 | + if ((float) DOL_VERSION <= 3.6) { |
|
1060 | 1060 | return ''; |
1061 | 1061 | } |
1062 | - else if((float)DOL_VERSION>=3.8) { |
|
1062 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1063 | 1063 | return 1; |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1068 | - else $i = (int)$parameters; |
|
1067 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1068 | + else $i = (int) $parameters; |
|
1069 | 1069 | |
1070 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1070 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1071 | 1071 | { |
1072 | 1072 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1073 | 1073 | { |
@@ -1079,24 +1079,24 @@ discard block |
||
1079 | 1079 | return 0; |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1082 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1083 | 1083 | global $conf; |
1084 | 1084 | |
1085 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1085 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1086 | 1086 | $this->resprints = ' '; |
1087 | 1087 | |
1088 | - if((float)DOL_VERSION<=3.6) { |
|
1088 | + if ((float) DOL_VERSION <= 3.6) { |
|
1089 | 1089 | return ''; |
1090 | 1090 | } |
1091 | - else if((float)DOL_VERSION>=3.8) { |
|
1091 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1092 | 1092 | return 1; |
1093 | 1093 | } |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1097 | - else $i = (int)$parameters; |
|
1096 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1097 | + else $i = (int) $parameters; |
|
1098 | 1098 | |
1099 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1099 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1100 | 1100 | { |
1101 | 1101 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1102 | 1102 | { |
@@ -1108,24 +1108,24 @@ discard block |
||
1108 | 1108 | return 0; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1112 | - global $conf,$hideprices; |
|
1111 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1112 | + global $conf, $hideprices; |
|
1113 | 1113 | |
1114 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1114 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1115 | 1115 | $this->resprints = ' '; |
1116 | 1116 | |
1117 | - if((float)DOL_VERSION<=3.6) { |
|
1117 | + if ((float) DOL_VERSION <= 3.6) { |
|
1118 | 1118 | return ''; |
1119 | 1119 | } |
1120 | - else if((float)DOL_VERSION>=3.8) { |
|
1120 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1121 | 1121 | return 1; |
1122 | 1122 | } |
1123 | 1123 | } |
1124 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1125 | - else $i = (int)$parameters; |
|
1124 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1125 | + else $i = (int) $parameters; |
|
1126 | 1126 | |
1127 | 1127 | if (!empty($hideprices) |
1128 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1128 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1129 | 1129 | ) |
1130 | 1130 | { |
1131 | 1131 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1138,24 +1138,24 @@ discard block |
||
1138 | 1138 | return 0; |
1139 | 1139 | } |
1140 | 1140 | |
1141 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1142 | - global $conf,$hideprices; |
|
1141 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1142 | + global $conf, $hideprices; |
|
1143 | 1143 | |
1144 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1144 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1145 | 1145 | $this->resprints = ' '; |
1146 | - if((float)DOL_VERSION<=3.6) { |
|
1146 | + if ((float) DOL_VERSION <= 3.6) { |
|
1147 | 1147 | return ''; |
1148 | 1148 | } |
1149 | - else if((float)DOL_VERSION>=3.8) { |
|
1149 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1150 | 1150 | return 1; |
1151 | 1151 | } |
1152 | 1152 | } |
1153 | 1153 | |
1154 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1155 | - else $i = (int)$parameters; |
|
1154 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1155 | + else $i = (int) $parameters; |
|
1156 | 1156 | |
1157 | 1157 | if (!empty($hideprices) |
1158 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1158 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1159 | 1159 | ) |
1160 | 1160 | { |
1161 | 1161 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1168,27 +1168,27 @@ discard block |
||
1168 | 1168 | return 0; |
1169 | 1169 | } |
1170 | 1170 | |
1171 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1171 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1172 | 1172 | global $conf; |
1173 | 1173 | |
1174 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1174 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1175 | 1175 | $this->resprints = ' '; |
1176 | 1176 | |
1177 | - if((float)DOL_VERSION<=3.6) { |
|
1177 | + if ((float) DOL_VERSION <= 3.6) { |
|
1178 | 1178 | return ''; |
1179 | 1179 | } |
1180 | - else if((float)DOL_VERSION>=3.8) { |
|
1180 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1181 | 1181 | return 1; |
1182 | 1182 | } |
1183 | 1183 | } |
1184 | 1184 | |
1185 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1186 | - else $i = (int)$parameters; |
|
1185 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1186 | + else $i = (int) $parameters; |
|
1187 | 1187 | |
1188 | 1188 | 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) |
1189 | 1189 | |
1190 | 1190 | $object->lines[$i]->fetch_optionals(); |
1191 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1191 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1192 | 1192 | { |
1193 | 1193 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1194 | 1194 | { |
@@ -1200,23 +1200,23 @@ discard block |
||
1200 | 1200 | return 0; |
1201 | 1201 | } |
1202 | 1202 | |
1203 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1203 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1204 | 1204 | global $conf; |
1205 | 1205 | |
1206 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1206 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1207 | 1207 | $this->resprints = ' '; |
1208 | - if((float)DOL_VERSION<=3.6) { |
|
1208 | + if ((float) DOL_VERSION <= 3.6) { |
|
1209 | 1209 | return ''; |
1210 | 1210 | } |
1211 | - else if((float)DOL_VERSION>=3.8) { |
|
1211 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1212 | 1212 | return 1; |
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | |
1216 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1217 | - else $i = (int)$parameters; |
|
1216 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1217 | + else $i = (int) $parameters; |
|
1218 | 1218 | |
1219 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1219 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1220 | 1220 | { |
1221 | 1221 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1222 | 1222 | { |
@@ -1231,12 +1231,12 @@ discard block |
||
1231 | 1231 | function add_numerotation(&$object) { |
1232 | 1232 | global $conf; |
1233 | 1233 | |
1234 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1234 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1235 | 1235 | |
1236 | 1236 | $TLevelTitre = array(); |
1237 | 1237 | $prevlevel = 0; |
1238 | 1238 | |
1239 | - foreach($object->lines as $k=>&$line) |
|
1239 | + foreach ($object->lines as $k=>&$line) |
|
1240 | 1240 | { |
1241 | 1241 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1242 | 1242 | { |
@@ -1250,12 +1250,12 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1253 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1253 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1254 | 1254 | { |
1255 | 1255 | $TTitle = array(); |
1256 | 1256 | |
1257 | - $i=1; |
|
1258 | - $j=0; |
|
1257 | + $i = 1; |
|
1258 | + $j = 0; |
|
1259 | 1259 | foreach ($TLineTitle as $k => &$line) |
1260 | 1260 | { |
1261 | 1261 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | { |
1266 | 1266 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1267 | 1267 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1268 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1268 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1269 | 1269 | { |
1270 | 1270 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1271 | 1271 | $line->desc = $line->description = ''; |
@@ -1291,26 +1291,26 @@ discard block |
||
1291 | 1291 | |
1292 | 1292 | function setDocTVA(&$pdf, &$object) { |
1293 | 1293 | |
1294 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1294 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1295 | 1295 | |
1296 | - if(empty($hidedetails)) return false; |
|
1296 | + if (empty($hidedetails)) return false; |
|
1297 | 1297 | |
1298 | 1298 | // TODO can't add VAT to document without lines... :-/ |
1299 | 1299 | |
1300 | 1300 | return true; |
1301 | 1301 | } |
1302 | 1302 | |
1303 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1303 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1304 | 1304 | { |
1305 | 1305 | /** |
1306 | 1306 | * @var $pdf TCPDF |
1307 | 1307 | */ |
1308 | - global $pdf,$conf, $langs; |
|
1308 | + global $pdf, $conf, $langs; |
|
1309 | 1309 | |
1310 | 1310 | // var_dump($object->lines); |
1311 | 1311 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1312 | 1312 | |
1313 | - foreach($parameters as $key=>$value) { |
|
1313 | + foreach ($parameters as $key=>$value) { |
|
1314 | 1314 | ${$key} = $value; |
1315 | 1315 | } |
1316 | 1316 | |
@@ -1319,25 +1319,25 @@ discard block |
||
1319 | 1319 | $this->add_numerotation($object); |
1320 | 1320 | |
1321 | 1321 | |
1322 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1323 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1322 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1323 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1324 | 1324 | |
1325 | 1325 | if ($hideInnerLines) { // si c une ligne de titre |
1326 | - $fk_parent_line=0; |
|
1327 | - $TLines =array(); |
|
1326 | + $fk_parent_line = 0; |
|
1327 | + $TLines = array(); |
|
1328 | 1328 | |
1329 | - $original_count=count($object->lines); |
|
1329 | + $original_count = count($object->lines); |
|
1330 | 1330 | $TTvas = array(); // tableau de tva |
1331 | 1331 | |
1332 | - foreach($object->lines as $k=>&$line) |
|
1332 | + foreach ($object->lines as $k=>&$line) |
|
1333 | 1333 | { |
1334 | 1334 | |
1335 | - if($line->product_type==9 && $line->rowid>0) |
|
1335 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1336 | 1336 | { |
1337 | 1337 | $fk_parent_line = $line->rowid; |
1338 | 1338 | |
1339 | 1339 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
1340 | - if(TSubtotal::isSubtotal($line)) |
|
1340 | + if (TSubtotal::isSubtotal($line)) |
|
1341 | 1341 | { |
1342 | 1342 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1343 | 1343 | |
@@ -1357,22 +1357,22 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | if ($hideInnerLines) |
1359 | 1359 | { |
1360 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1360 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1361 | 1361 | { |
1362 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1362 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1363 | 1363 | |
1364 | 1364 | // on remplit le tableau de tva pour substituer les lignes cachées |
1365 | 1365 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1366 | 1366 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1367 | 1367 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1368 | 1368 | } |
1369 | - if($line->product_type==9 && $line->rowid>0) |
|
1369 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1370 | 1370 | { |
1371 | 1371 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1372 | 1372 | // génère des lignes d'affichage des montants HT soumis à tva |
1373 | 1373 | $nbtva = count($TTvas); |
1374 | - if(!empty($nbtva)){ |
|
1375 | - foreach ($TTvas as $tx =>$val){ |
|
1374 | + if (!empty($nbtva)) { |
|
1375 | + foreach ($TTvas as $tx =>$val) { |
|
1376 | 1376 | $l = clone $line; |
1377 | 1377 | $l->product_type = 1; |
1378 | 1378 | $l->special_code = ''; |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | } |
1394 | 1394 | } else { |
1395 | 1395 | |
1396 | - if($line->product_type==9 && $line->rowid>0) |
|
1396 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1397 | 1397 | { |
1398 | 1398 | // ajoute la ligne de sous-total |
1399 | 1399 | $TLines[] = $line; |
@@ -1421,9 +1421,9 @@ discard block |
||
1421 | 1421 | |
1422 | 1422 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1423 | 1423 | $nbtva = count($TTvas); |
1424 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1424 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1425 | 1425 | { |
1426 | - foreach ($TTvas as $tx =>$val){ |
|
1426 | + foreach ($TTvas as $tx =>$val) { |
|
1427 | 1427 | $l = clone $line; |
1428 | 1428 | $l->product_type = 1; |
1429 | 1429 | $l->special_code = ''; |
@@ -1440,11 +1440,11 @@ discard block |
||
1440 | 1440 | } |
1441 | 1441 | |
1442 | 1442 | global $nblignes; |
1443 | - $nblignes=count($TLines); |
|
1443 | + $nblignes = count($TLines); |
|
1444 | 1444 | |
1445 | 1445 | $object->lines = $TLines; |
1446 | 1446 | |
1447 | - if($i>count($object->lines)) { |
|
1447 | + if ($i > count($object->lines)) { |
|
1448 | 1448 | $this->resprints = ''; |
1449 | 1449 | return 0; |
1450 | 1450 | } |
@@ -1453,59 +1453,59 @@ discard block |
||
1453 | 1453 | return 0; |
1454 | 1454 | } |
1455 | 1455 | |
1456 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1456 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1457 | 1457 | { |
1458 | 1458 | /** |
1459 | 1459 | * @var $pdf TCPDF |
1460 | 1460 | */ |
1461 | - global $pdf,$conf; |
|
1461 | + global $pdf, $conf; |
|
1462 | 1462 | |
1463 | - foreach($parameters as $key=>$value) { |
|
1463 | + foreach ($parameters as $key=>$value) { |
|
1464 | 1464 | ${$key} = $value; |
1465 | 1465 | } |
1466 | 1466 | |
1467 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1468 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1467 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1468 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1469 | 1469 | |
1470 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1470 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1471 | 1471 | |
1472 | 1472 | global $hideprices; |
1473 | 1473 | |
1474 | - if(!empty($hideprices)) { |
|
1475 | - foreach($object->lines as &$line) { |
|
1476 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1474 | + if (!empty($hideprices)) { |
|
1475 | + foreach ($object->lines as &$line) { |
|
1476 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1477 | 1477 | } |
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | $line = &$object->lines[$i]; |
1481 | 1481 | |
1482 | - if($line->info_bits>0) { // PAGE BREAK |
|
1482 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1483 | 1483 | $pdf->addPage(); |
1484 | 1484 | $posy = $pdf->GetY(); |
1485 | 1485 | } |
1486 | 1486 | |
1487 | 1487 | $label = $line->label; |
1488 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1488 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1489 | 1489 | |
1490 | - if(empty($label)) { |
|
1490 | + if (empty($label)) { |
|
1491 | 1491 | $label = $description; |
1492 | - $description=''; |
|
1492 | + $description = ''; |
|
1493 | 1493 | } |
1494 | 1494 | |
1495 | - if($line->qty>90) { |
|
1495 | + if ($line->qty > 90) { |
|
1496 | 1496 | |
1497 | 1497 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1498 | 1498 | |
1499 | 1499 | $pageBefore = $pdf->getPage(); |
1500 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1500 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1501 | 1501 | $pageAfter = $pdf->getPage(); |
1502 | 1502 | |
1503 | - if($pageAfter>$pageBefore) { |
|
1503 | + if ($pageAfter > $pageBefore) { |
|
1504 | 1504 | //print "ST $pageAfter>$pageBefore<br>"; |
1505 | 1505 | $pdf->rollbackTransaction(true); |
1506 | - $pdf->addPage('','', true); |
|
1506 | + $pdf->addPage('', '', true); |
|
1507 | 1507 | $posy = $pdf->GetY(); |
1508 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1508 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1509 | 1509 | $posy = $pdf->GetY(); |
1510 | 1510 | //print 'add ST'.$pdf->getPage().'<br />'; |
1511 | 1511 | } |
@@ -1516,7 +1516,7 @@ discard block |
||
1516 | 1516 | else if ($line->qty < 10) { |
1517 | 1517 | $pageBefore = $pdf->getPage(); |
1518 | 1518 | |
1519 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1519 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1520 | 1520 | $pageAfter = $pdf->getPage(); |
1521 | 1521 | |
1522 | 1522 | |
@@ -1591,9 +1591,9 @@ discard block |
||
1591 | 1591 | * @param $hookmanager HookManager |
1592 | 1592 | * @return int |
1593 | 1593 | */ |
1594 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1594 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1595 | 1595 | |
1596 | - global $conf,$langs,$user,$db,$bc; |
|
1596 | + global $conf, $langs, $user, $db, $bc; |
|
1597 | 1597 | |
1598 | 1598 | $num = &$parameters['num']; |
1599 | 1599 | $line = &$parameters['line']; |
@@ -1601,24 +1601,24 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | $var = &$parameters['var']; |
1603 | 1603 | |
1604 | - $contexts = explode(':',$parameters['context']); |
|
1604 | + $contexts = explode(':', $parameters['context']); |
|
1605 | 1605 | |
1606 | 1606 | $createRight = $user->rights->{$object->element}->creer; |
1607 | - if($object->element == 'facturerec' ) |
|
1607 | + if ($object->element == 'facturerec') |
|
1608 | 1608 | { |
1609 | 1609 | $object->statut = 0; // hack for facture rec |
1610 | 1610 | $createRight = $user->rights->facture->creer; |
1611 | 1611 | } |
1612 | 1612 | |
1613 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1613 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1614 | 1614 | null; |
1615 | 1615 | } |
1616 | - else if (in_array('invoicecard',$contexts) || in_array('propalcard',$contexts) || in_array('ordercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1616 | + else if (in_array('invoicecard', $contexts) || in_array('propalcard', $contexts) || in_array('ordercard', $contexts) || in_array('invoicereccard', $contexts)) |
|
1617 | 1617 | { |
1618 | - if($object->element=='facture')$idvar = 'facid'; |
|
1619 | - else $idvar='id'; |
|
1618 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1619 | + else $idvar = 'id'; |
|
1620 | 1620 | |
1621 | - if((float)DOL_VERSION <= 3.4) |
|
1621 | + if ((float) DOL_VERSION <= 3.4) |
|
1622 | 1622 | { |
1623 | 1623 | ?> |
1624 | 1624 | <script type="text/javascript"> |
@@ -1642,18 +1642,18 @@ discard block |
||
1642 | 1642 | <?php |
1643 | 1643 | } |
1644 | 1644 | |
1645 | - if(empty($line->description)) $line->description = $line->desc; |
|
1645 | + if (empty($line->description)) $line->description = $line->desc; |
|
1646 | 1646 | |
1647 | 1647 | $colspan = 5; |
1648 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1649 | - |
|
1650 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1651 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1652 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1653 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1654 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1655 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1656 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1648 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1649 | + |
|
1650 | + if (!empty($conf->multicurrency->enabled)) $colspan += 2; |
|
1651 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1652 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1653 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1654 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1655 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1656 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1657 | 1657 | |
1658 | 1658 | /* Titre */ |
1659 | 1659 | //var_dump($line); |
@@ -1663,35 +1663,35 @@ discard block |
||
1663 | 1663 | |
1664 | 1664 | |
1665 | 1665 | ?> |
1666 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1666 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1667 | 1667 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1668 | 1668 | { |
1669 | - if($line->qty==99) print 'background:#adadcf'; |
|
1670 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1671 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1672 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1673 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1674 | - else if($line->qty==50) print ''; |
|
1669 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1670 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1671 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1672 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1673 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1674 | + else if ($line->qty == 50) print ''; |
|
1675 | 1675 | else print 'background:#eeeeff;'; |
1676 | 1676 | |
1677 | 1677 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1678 | 1678 | } |
1679 | 1679 | else |
1680 | 1680 | { |
1681 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1682 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1683 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1684 | - else if($line->qty==50) print ''; |
|
1685 | - else print 'background:#eeffee;' ; |
|
1681 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
1682 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1683 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
1684 | + else if ($line->qty == 50) print ''; |
|
1685 | + else print 'background:#eeffee;'; |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | ?>;"> |
1689 | 1689 | |
1690 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
1691 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1690 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
1691 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1692 | 1692 | |
1693 | - $params=array('line'=>$line); |
|
1694 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
1693 | + $params = array('line'=>$line); |
|
1694 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
1695 | 1695 | |
1696 | 1696 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
1697 | 1697 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -1699,7 +1699,7 @@ discard block |
||
1699 | 1699 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
1700 | 1700 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
1701 | 1701 | |
1702 | - $isFreeText=false; |
|
1702 | + $isFreeText = false; |
|
1703 | 1703 | if (TSubtotal::isTitle($line)) |
1704 | 1704 | { |
1705 | 1705 | $qty_displayed = $line->qty; |
@@ -1717,13 +1717,13 @@ discard block |
||
1717 | 1717 | } |
1718 | 1718 | |
1719 | 1719 | $newlabel = $line->label; |
1720 | - if($line->label=='' && !$isFreeText) { |
|
1721 | - if(TSubtotal::isSubtotal($line)) { |
|
1720 | + if ($line->label == '' && !$isFreeText) { |
|
1721 | + if (TSubtotal::isSubtotal($line)) { |
|
1722 | 1722 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
1723 | - $line->description=''; |
|
1724 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
1725 | - $newlabel= $line->description; |
|
1726 | - $line->description=''; |
|
1723 | + $line->description = ''; |
|
1724 | + } elseif ((float) DOL_VERSION < 6) { |
|
1725 | + $newlabel = $line->description; |
|
1726 | + $line->description = ''; |
|
1727 | 1727 | } |
1728 | 1728 | } |
1729 | 1729 | |
@@ -1732,10 +1732,10 @@ discard block |
||
1732 | 1732 | |
1733 | 1733 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
1734 | 1734 | |
1735 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
1735 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
1736 | 1736 | { |
1737 | 1737 | $select = '<select name="subtotal_level">'; |
1738 | - for ($j=1; $j<10; $j++) |
|
1738 | + for ($j = 1; $j < 10; $j++) |
|
1739 | 1739 | { |
1740 | 1740 | if (!empty($readonlyForSituation)) { |
1741 | 1741 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | |
1749 | 1749 | |
1750 | 1750 | echo '<div class="subtotal_underline" style="margin-left:24px;">'; |
1751 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
1751 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
1752 | 1752 | |
1753 | 1753 | if (TSubtotal::isTitle($line)) |
1754 | 1754 | { |
@@ -1766,9 +1766,9 @@ discard block |
||
1766 | 1766 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
1767 | 1767 | echo '</div>'; |
1768 | 1768 | |
1769 | - if($line->qty<10) { |
|
1769 | + if ($line->qty < 10) { |
|
1770 | 1770 | // WYSIWYG editor |
1771 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
1771 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
1772 | 1772 | $nbrows = ROWS_2; |
1773 | 1773 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
1774 | 1774 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -1788,25 +1788,25 @@ discard block |
||
1788 | 1788 | |
1789 | 1789 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1790 | 1790 | { |
1791 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1791 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
1792 | 1792 | { |
1793 | - echo str_repeat(' ', $line->qty-1); |
|
1793 | + echo str_repeat(' ', $line->qty - 1); |
|
1794 | 1794 | |
1795 | 1795 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
1796 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1796 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
1797 | 1797 | } |
1798 | 1798 | } |
1799 | 1799 | else |
1800 | 1800 | { |
1801 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
1802 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1801 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
1802 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1803 | 1803 | } |
1804 | 1804 | |
1805 | 1805 | |
1806 | 1806 | // Get display styles and apply them |
1807 | 1807 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
1808 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1809 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1808 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
1809 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
1810 | 1810 | |
1811 | 1811 | if (empty($line->label)) { |
1812 | 1812 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -1814,16 +1814,16 @@ discard block |
||
1814 | 1814 | } |
1815 | 1815 | else { |
1816 | 1816 | |
1817 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1817 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
1818 | 1818 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
1819 | 1819 | } |
1820 | - else{ |
|
1820 | + else { |
|
1821 | 1821 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
1822 | 1822 | } |
1823 | 1823 | |
1824 | 1824 | } |
1825 | - if($line->qty>90) print ' : '; |
|
1826 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1825 | + if ($line->qty > 90) print ' : '; |
|
1826 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | ?></td> |
1833 | 1833 | |
1834 | 1834 | <?php |
1835 | - if($line->qty>90) { |
|
1835 | + if ($line->qty > 90) { |
|
1836 | 1836 | /* Total */ |
1837 | 1837 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
1838 | 1838 | echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | <?php |
1846 | 1846 | if ($action != 'selectlines') { |
1847 | 1847 | |
1848 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
1848 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
1849 | 1849 | ?> |
1850 | 1850 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
1851 | 1851 | <br /> |
@@ -1861,13 +1861,13 @@ discard block |
||
1861 | 1861 | <?php |
1862 | 1862 | |
1863 | 1863 | } |
1864 | - else{ |
|
1865 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
1864 | + else { |
|
1865 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
|
1866 | 1866 | { |
1867 | - 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>'; |
|
1867 | + 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>'; |
|
1868 | 1868 | } |
1869 | 1869 | |
1870 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1870 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
1871 | 1871 | { |
1872 | 1872 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
1873 | 1873 | } |
@@ -1882,7 +1882,7 @@ discard block |
||
1882 | 1882 | <?php |
1883 | 1883 | |
1884 | 1884 | if ($action != 'editline' && $action != 'selectlines') { |
1885 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1885 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
1886 | 1886 | { |
1887 | 1887 | |
1888 | 1888 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
1893 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
1894 | 1894 | { |
1895 | 1895 | $img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
1896 | 1896 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>'; |
@@ -1901,7 +1901,7 @@ discard block |
||
1901 | 1901 | </td> |
1902 | 1902 | |
1903 | 1903 | <?php |
1904 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
1904 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
1905 | 1905 | { |
1906 | 1906 | echo '<td class="subtotal_nc">'; |
1907 | 1907 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -1912,11 +1912,11 @@ discard block |
||
1912 | 1912 | <td align="center" class="tdlineupdown"> |
1913 | 1913 | </td> |
1914 | 1914 | <?php } else { ?> |
1915 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
1915 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
1916 | 1916 | <?php } ?> |
1917 | 1917 | |
1918 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
1919 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
1918 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
1919 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
1920 | 1920 | <?php } ?> |
1921 | 1921 | |
1922 | 1922 | </tr> |
@@ -1924,29 +1924,29 @@ discard block |
||
1924 | 1924 | |
1925 | 1925 | |
1926 | 1926 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
1927 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
1927 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
1928 | 1928 | |
1929 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
1929 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
1930 | 1930 | |
1931 | 1931 | // Extrafields |
1932 | 1932 | $extrafieldsline = new ExtraFields($db); |
1933 | 1933 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
1934 | 1934 | |
1935 | - $colspan+=3; $mode = 'view'; |
|
1936 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
1935 | + $colspan += 3; $mode = 'view'; |
|
1936 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
1937 | 1937 | |
1938 | 1938 | $ex_element = $line->element; |
1939 | 1939 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
1940 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
1940 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
1941 | 1941 | $isExtraSelected = false; |
1942 | - foreach($line->array_options as $option) { |
|
1943 | - if(!empty($option) && $option != "-1") { |
|
1942 | + foreach ($line->array_options as $option) { |
|
1943 | + if (!empty($option) && $option != "-1") { |
|
1944 | 1944 | $isExtraSelected = true; |
1945 | 1945 | break; |
1946 | 1946 | } |
1947 | 1947 | } |
1948 | 1948 | |
1949 | - if($mode === 'edit') { |
|
1949 | + if ($mode === 'edit') { |
|
1950 | 1950 | ?> |
1951 | 1951 | <script> |
1952 | 1952 | $(document).ready(function(){ |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
1955 | 1955 | <?php |
1956 | 1956 | // Si un extrafield est rempli alors on affiche directement les extrafields |
1957 | - if(!$isExtraSelected) { |
|
1957 | + if (!$isExtraSelected) { |
|
1958 | 1958 | echo 'all_tr_extrafields.hide();'; |
1959 | 1959 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
1960 | 1960 | echo 'var extra = 0;'; |
@@ -2000,7 +2000,7 @@ discard block |
||
2000 | 2000 | |
2001 | 2001 | |
2002 | 2002 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2003 | - global $conf,$langs; |
|
2003 | + global $conf, $langs; |
|
2004 | 2004 | |
2005 | 2005 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2006 | 2006 | { |
@@ -2095,23 +2095,23 @@ discard block |
||
2095 | 2095 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2096 | 2096 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2097 | 2097 | |
2098 | - if(TSubtotal::isTitle($line)){ |
|
2098 | + if (TSubtotal::isTitle($line)) { |
|
2099 | 2099 | $ThtmlData['data-issubtotal'] = 'title'; |
2100 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2100 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2101 | 2101 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2102 | 2102 | } |
2103 | - else{ |
|
2103 | + else { |
|
2104 | 2104 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2105 | 2105 | } |
2106 | 2106 | |
2107 | 2107 | |
2108 | 2108 | // Change or add data from hooks |
2109 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2109 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2110 | 2110 | |
2111 | 2111 | // hook |
2112 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2112 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2113 | 2113 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2114 | - if ($reshook>0) |
|
2114 | + if ($reshook > 0) |
|
2115 | 2115 | { |
2116 | 2116 | $ThtmlData = $hookmanager->resArray; |
2117 | 2117 | } |
@@ -2124,14 +2124,14 @@ discard block |
||
2124 | 2124 | function implodeHtmlData($ThtmlData = array()) |
2125 | 2125 | { |
2126 | 2126 | $data = ''; |
2127 | - foreach($ThtmlData as $k => $h ) |
|
2127 | + foreach ($ThtmlData as $k => $h) |
|
2128 | 2128 | { |
2129 | - if(is_array($h)) |
|
2129 | + if (is_array($h)) |
|
2130 | 2130 | { |
2131 | 2131 | $h = json_encode($h); |
2132 | 2132 | } |
2133 | 2133 | |
2134 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2134 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2135 | 2135 | } |
2136 | 2136 | |
2137 | 2137 | return $data; |
@@ -2139,26 +2139,26 @@ discard block |
||
2139 | 2139 | |
2140 | 2140 | function _ajax_block_order_js($object) |
2141 | 2141 | { |
2142 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2142 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2143 | 2143 | |
2144 | 2144 | /* |
2145 | 2145 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2146 | 2146 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2147 | 2147 | */ |
2148 | 2148 | |
2149 | - $id=$object->id; |
|
2150 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2151 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2149 | + $id = $object->id; |
|
2150 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2151 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2152 | 2152 | |
2153 | - $id=$object->id; |
|
2154 | - $fk_element=$object->fk_element; |
|
2155 | - $table_element_line=$object->table_element_line; |
|
2156 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2157 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2158 | - $filepath=(empty($filepath)?'':$filepath); |
|
2153 | + $id = $object->id; |
|
2154 | + $fk_element = $object->fk_element; |
|
2155 | + $table_element_line = $object->table_element_line; |
|
2156 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2157 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2158 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2161 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2162 | 2162 | { |
2163 | 2163 | |
2164 | 2164 | ?> |
@@ -2176,7 +2176,7 @@ discard block |
||
2176 | 2176 | moveBlockCol.disableSelection(); // prevent selection |
2177 | 2177 | |
2178 | 2178 | // apply some graphical stuff |
2179 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2179 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2180 | 2180 | moveBlockCol.css("background-repeat","no-repeat"); |
2181 | 2181 | moveBlockCol.css("background-position","center center"); |
2182 | 2182 | moveBlockCol.css("cursor","move"); |
@@ -69,8 +69,11 @@ discard block |
||
69 | 69 | if ($object->statut == 0 && $createRight) { |
70 | 70 | |
71 | 71 | |
72 | - if($object->element=='facture')$idvar = 'facid'; |
|
73 | - else $idvar='id'; |
|
72 | + if($object->element=='facture') { |
|
73 | + $idvar = 'facid'; |
|
74 | + } else { |
|
75 | + $idvar='id'; |
|
76 | + } |
|
74 | 77 | |
75 | 78 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
76 | 79 | { |
@@ -78,10 +81,11 @@ discard block |
||
78 | 81 | |
79 | 82 | if($action=='add_title_line') { |
80 | 83 | $title = GETPOST('title'); |
81 | - if(empty($title)) $title = $langs->trans('title'); |
|
84 | + if(empty($title)) { |
|
85 | + $title = $langs->trans('title'); |
|
86 | + } |
|
82 | 87 | $qty = $level<1 ? 1 : $level ; |
83 | - } |
|
84 | - else if($action=='add_free_text') { |
|
88 | + } else if($action=='add_free_text') { |
|
85 | 89 | $title = GETPOST('title'); |
86 | 90 | |
87 | 91 | if (empty($title)) { |
@@ -93,29 +97,31 @@ discard block |
||
93 | 97 | } |
94 | 98 | } |
95 | 99 | } |
96 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
100 | + if(empty($title)) { |
|
101 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
102 | + } |
|
97 | 103 | $qty = 50; |
98 | - } |
|
99 | - else if($action=='add_subtitle_line') { |
|
104 | + } else if($action=='add_subtitle_line') { |
|
100 | 105 | $title = GETPOST('title'); |
101 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
106 | + if(empty($title)) { |
|
107 | + $title = $langs->trans('subtitle'); |
|
108 | + } |
|
102 | 109 | $qty = 2; |
103 | - } |
|
104 | - else if($action=='add_subtotal_line') { |
|
110 | + } else if($action=='add_subtotal_line') { |
|
105 | 111 | $title = $langs->trans('SubSubTotal'); |
106 | 112 | $qty = 98; |
107 | - } |
|
108 | - else { |
|
113 | + } else { |
|
109 | 114 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
110 | 115 | $qty = $level ? 100-$level : 99; |
111 | 116 | } |
112 | 117 | dol_include_once('/subtotal/class/subtotal.class.php'); |
113 | 118 | |
114 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
119 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
120 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
121 | + } |
|
115 | 122 | |
116 | 123 | TSubtotal::addSubTotalLine($object, $title, $qty); |
117 | - } |
|
118 | - else if($action==='ask_deleteallline') { |
|
124 | + } else if($action==='ask_deleteallline') { |
|
119 | 125 | $form=new Form($db); |
120 | 126 | |
121 | 127 | $lineid = GETPOST('lineid','integer'); |
@@ -138,8 +144,7 @@ discard block |
||
138 | 144 | $this->printNewFormat($object, $conf, $langs, $idvar); |
139 | 145 | } |
140 | 146 | } |
141 | - } |
|
142 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
147 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
143 | 148 | { |
144 | 149 | ?> |
145 | 150 | <script type="text/javascript"> |
@@ -157,8 +162,13 @@ discard block |
||
157 | 162 | |
158 | 163 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
159 | 164 | { |
160 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
161 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
165 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
166 | + return false; |
|
167 | + } |
|
168 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
169 | + return false; |
|
170 | + } |
|
171 | + // Si facture de situation |
|
162 | 172 | ?> |
163 | 173 | <script type="text/javascript"> |
164 | 174 | $(document).ready(function() { |
@@ -439,8 +449,7 @@ discard block |
||
439 | 449 | } |
440 | 450 | |
441 | 451 | |
442 | - } |
|
443 | - else{ |
|
452 | + } else{ |
|
444 | 453 | $substitutionarray['line_not_modsubtotal'] = true; |
445 | 454 | $substitutionarray['line_modsubtotal'] = 0; |
446 | 455 | } |
@@ -495,8 +504,11 @@ discard block |
||
495 | 504 | |
496 | 505 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
497 | 506 | |
498 | - if($object->element=='facture') $idvar = 'facid'; |
|
499 | - else $idvar = 'id'; |
|
507 | + if($object->element=='facture') { |
|
508 | + $idvar = 'facid'; |
|
509 | + } else { |
|
510 | + $idvar = 'id'; |
|
511 | + } |
|
500 | 512 | |
501 | 513 | if ($action == 'updateligne' || $action == 'updateline') |
502 | 514 | { |
@@ -526,8 +538,7 @@ discard block |
||
526 | 538 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
527 | 539 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
528 | 540 | } |
529 | - } |
|
530 | - else if($action === 'builddoc') { |
|
541 | + } else if($action === 'builddoc') { |
|
531 | 542 | |
532 | 543 | if ( |
533 | 544 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -539,18 +550,15 @@ discard block |
||
539 | 550 | $sessname = 'subtotal_hideInnerLines_facture'; |
540 | 551 | $sessname2 = 'subtotal_hidedetails_facture'; |
541 | 552 | $sessname3 = 'subtotal_hideprices_facture'; |
542 | - } |
|
543 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
553 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
544 | 554 | $sessname = 'subtotal_hideInnerLines_propal'; |
545 | 555 | $sessname2 = 'subtotal_hidedetails_propal'; |
546 | 556 | $sessname3 = 'subtotal_hideprices_propal'; |
547 | - } |
|
548 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
557 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
549 | 558 | $sessname = 'subtotal_hideInnerLines_commande'; |
550 | 559 | $sessname2 = 'subtotal_hidedetails_commande'; |
551 | 560 | $sessname3 = 'subtotal_hideprices_commande'; |
552 | - } |
|
553 | - else { |
|
561 | + } else { |
|
554 | 562 | $sessname = 'subtotal_hideInnerLines_unknown'; |
555 | 563 | $sessname2 = 'subtotal_hidedetails_unknown'; |
556 | 564 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -572,8 +580,7 @@ discard block |
||
572 | 580 | |
573 | 581 | if($line->qty>=90) { |
574 | 582 | $line->modsubtotal_total = 1; |
575 | - } |
|
576 | - else{ |
|
583 | + } else{ |
|
577 | 584 | $line->modsubtotal_title = 1; |
578 | 585 | } |
579 | 586 | |
@@ -582,8 +589,7 @@ discard block |
||
582 | 589 | } |
583 | 590 | } |
584 | 591 | |
585 | - } |
|
586 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
592 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
587 | 593 | |
588 | 594 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
589 | 595 | |
@@ -591,37 +597,49 @@ discard block |
||
591 | 597 | /** |
592 | 598 | * @var $object Facture |
593 | 599 | */ |
594 | - if($object->element=='facture') $object->deleteline($idLine); |
|
600 | + if($object->element=='facture') { |
|
601 | + $object->deleteline($idLine); |
|
602 | + } |
|
595 | 603 | /** |
596 | 604 | * @var $object Propal |
597 | 605 | */ |
598 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
606 | + else if($object->element=='propal') { |
|
607 | + $object->deleteline($idLine); |
|
608 | + } |
|
599 | 609 | /** |
600 | 610 | * @var $object Commande |
601 | 611 | */ |
602 | 612 | else if($object->element=='commande') |
603 | 613 | { |
604 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
605 | - else $object->deleteline($idLine); |
|
614 | + if ((float) DOL_VERSION >= 5.0) { |
|
615 | + $object->deleteline($user, $idLine); |
|
616 | + } else { |
|
617 | + $object->deleteline($idLine); |
|
618 | + } |
|
606 | 619 | } |
607 | 620 | /** |
608 | 621 | * @var $object Facturerec |
609 | 622 | */ |
610 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
623 | + else if($object->element=='facturerec') { |
|
624 | + $object->deleteline($idLine); |
|
625 | + } |
|
611 | 626 | } |
612 | 627 | |
613 | 628 | header('location:?id='.$object->id); |
614 | 629 | exit; |
615 | 630 | |
616 | - } |
|
617 | - else if ($action == 'duplicate') |
|
631 | + } else if ($action == 'duplicate') |
|
618 | 632 | { |
619 | 633 | $lineid = GETPOST('lineid', 'int'); |
620 | 634 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
621 | 635 | |
622 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
623 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
624 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
636 | + if ($nbDuplicate > 0) { |
|
637 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
638 | + } elseif ($nbDuplicate == 0) { |
|
639 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
640 | + } else { |
|
641 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
642 | + } |
|
625 | 643 | |
626 | 644 | header('Location: ?id='.$object->id); |
627 | 645 | exit; |
@@ -699,17 +717,18 @@ discard block |
||
699 | 717 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
700 | 718 | if($l->rang>=$rang) { |
701 | 719 | //echo 'return!<br>'; |
702 | - if (!$return_all) return $total; |
|
703 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
704 | - } |
|
705 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
720 | + if (!$return_all) { |
|
721 | + return $total; |
|
722 | + } else { |
|
723 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
724 | + } |
|
725 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
706 | 726 | { |
707 | 727 | $total = 0; |
708 | 728 | $total_tva = 0; |
709 | 729 | $total_ttc = 0; |
710 | 730 | $TTotal_tva = array(); |
711 | - } |
|
712 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
731 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
713 | 732 | $total += $l->total_ht; |
714 | 733 | $total_tva += $l->total_tva; |
715 | 734 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -717,8 +736,11 @@ discard block |
||
717 | 736 | } |
718 | 737 | |
719 | 738 | } |
720 | - if (!$return_all) return $total; |
|
721 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
739 | + if (!$return_all) { |
|
740 | + return $total; |
|
741 | + } else { |
|
742 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
743 | + } |
|
722 | 744 | } |
723 | 745 | |
724 | 746 | /* |
@@ -786,15 +808,18 @@ discard block |
||
786 | 808 | } |
787 | 809 | |
788 | 810 | |
789 | - if($line->qty==99) |
|
790 | - $pdf->SetFillColor(220,220,220); |
|
791 | - elseif ($line->qty==98) |
|
792 | - $pdf->SetFillColor(230,230,230); |
|
793 | - else |
|
794 | - $pdf->SetFillColor(240,240,240); |
|
811 | + if($line->qty==99) { |
|
812 | + $pdf->SetFillColor(220,220,220); |
|
813 | + } elseif ($line->qty==98) { |
|
814 | + $pdf->SetFillColor(230,230,230); |
|
815 | + } else { |
|
816 | + $pdf->SetFillColor(240,240,240); |
|
817 | + } |
|
795 | 818 | |
796 | 819 | $style = 'B'; |
797 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
820 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
821 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
822 | + } |
|
798 | 823 | |
799 | 824 | $pdf->SetFont('', $style, 9); |
800 | 825 | |
@@ -833,8 +858,7 @@ discard block |
||
833 | 858 | // $line->total_tva |
834 | 859 | // $line->total |
835 | 860 | // $line->total_ttc |
836 | - } |
|
837 | - else |
|
861 | + } else |
|
838 | 862 | { |
839 | 863 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
840 | 864 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -851,11 +875,14 @@ discard block |
||
851 | 875 | } |
852 | 876 | |
853 | 877 | $pdf->SetXY($pdf->postotalht, $posy); |
854 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
878 | + if($set_pagebreak_margin) { |
|
879 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
880 | + } |
|
855 | 881 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
856 | - } |
|
857 | - else{ |
|
858 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
882 | + } else{ |
|
883 | + if($set_pagebreak_margin) { |
|
884 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
885 | + } |
|
859 | 886 | } |
860 | 887 | |
861 | 888 | $posy = $posy + $cell_height; |
@@ -887,25 +914,40 @@ discard block |
||
887 | 914 | |
888 | 915 | |
889 | 916 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
890 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
917 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
918 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
919 | + } |
|
891 | 920 | |
892 | 921 | if($hideInnerLines) { |
893 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
894 | - else |
|
922 | + if($line->qty==1) { |
|
923 | + $pdf->SetFont('', $style, 9); |
|
924 | + } else |
|
895 | 925 | { |
896 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
926 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
927 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
928 | + } |
|
897 | 929 | $pdf->SetFont('', $style, 9); |
898 | 930 | } |
899 | - } |
|
900 | - else { |
|
931 | + } else { |
|
901 | 932 | |
902 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
903 | - else $pdf->SetFont('', $style, 9); |
|
933 | + if($line->qty==1) { |
|
934 | + $pdf->SetFont('', $style, 9); |
|
935 | + } |
|
936 | + //TODO if super utile |
|
937 | + else { |
|
938 | + $pdf->SetFont('', $style, 9); |
|
939 | + } |
|
904 | 940 | |
905 | 941 | } |
906 | 942 | |
907 | - 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 |
|
908 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
943 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
944 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
945 | + } |
|
946 | + // Pas de HTML dans la chaine |
|
947 | + else { |
|
948 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
949 | + } |
|
950 | + // et maintenant avec du HTML |
|
909 | 951 | |
910 | 952 | if($description && !$hidedesc) { |
911 | 953 | $posy = $pdf->GetY(); |
@@ -929,8 +971,7 @@ discard block |
||
929 | 971 | |
930 | 972 | if(is_array($parameters)) { |
931 | 973 | $i = & $parameters['i']; |
932 | - } |
|
933 | - else { |
|
974 | + } else { |
|
934 | 975 | $i = (int)$parameters; |
935 | 976 | } |
936 | 977 | |
@@ -952,17 +993,14 @@ discard block |
||
952 | 993 | |
953 | 994 | if((float)DOL_VERSION<=3.6) { |
954 | 995 | return ''; |
955 | - } |
|
956 | - else if((float)DOL_VERSION>=3.8) { |
|
996 | + } else if((float)DOL_VERSION>=3.8) { |
|
957 | 997 | return 1; |
958 | 998 | } |
959 | 999 | |
960 | - } |
|
961 | - elseif(!empty($hideprices)) { |
|
1000 | + } elseif(!empty($hideprices)) { |
|
962 | 1001 | $this->resprints = $object->lines[$parameters['i']]->qty; |
963 | 1002 | return 1; |
964 | - } |
|
965 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1003 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
966 | 1004 | { |
967 | 1005 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
968 | 1006 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -972,12 +1010,20 @@ discard block |
||
972 | 1010 | } |
973 | 1011 | } |
974 | 1012 | |
975 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
976 | - else $i = (int)$parameters; |
|
1013 | + if(is_array($parameters)) { |
|
1014 | + $i = & $parameters['i']; |
|
1015 | + } else { |
|
1016 | + $i = (int)$parameters; |
|
1017 | + } |
|
977 | 1018 | |
978 | - 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) |
|
1019 | + if (empty($object->lines[$i])) { |
|
1020 | + return 0; |
|
1021 | + } |
|
1022 | + // 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) |
|
979 | 1023 | |
980 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1024 | + if(empty($object->lines[$i]->array_options)) { |
|
1025 | + $object->lines[$i]->fetch_optionals(); |
|
1026 | + } |
|
981 | 1027 | |
982 | 1028 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
983 | 1029 | { |
@@ -1000,16 +1046,17 @@ discard block |
||
1000 | 1046 | |
1001 | 1047 | if((float)DOL_VERSION<=3.6) { |
1002 | 1048 | return ''; |
1003 | - } |
|
1004 | - else if((float)DOL_VERSION>=3.8) { |
|
1049 | + } else if((float)DOL_VERSION>=3.8) { |
|
1005 | 1050 | return 1; |
1006 | 1051 | } |
1007 | 1052 | |
1008 | - } |
|
1009 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1053 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1010 | 1054 | { |
1011 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1012 | - else $i = (int)$parameters; |
|
1055 | + if(is_array($parameters)) { |
|
1056 | + $i = & $parameters['i']; |
|
1057 | + } else { |
|
1058 | + $i = (int)$parameters; |
|
1059 | + } |
|
1013 | 1060 | |
1014 | 1061 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1015 | 1062 | { |
@@ -1031,8 +1078,11 @@ discard block |
||
1031 | 1078 | } |
1032 | 1079 | } |
1033 | 1080 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1034 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1035 | - else $i = (int)$parameters; |
|
1081 | + if(is_array($parameters)) { |
|
1082 | + $i = & $parameters['i']; |
|
1083 | + } else { |
|
1084 | + $i = (int)$parameters; |
|
1085 | + } |
|
1036 | 1086 | $this->resprints = price($object->lines[$i]->total_ht); |
1037 | 1087 | } |
1038 | 1088 | if (!empty($hideprices) |
@@ -1058,14 +1108,16 @@ discard block |
||
1058 | 1108 | |
1059 | 1109 | if((float)DOL_VERSION<=3.6) { |
1060 | 1110 | return ''; |
1061 | - } |
|
1062 | - else if((float)DOL_VERSION>=3.8) { |
|
1111 | + } else if((float)DOL_VERSION>=3.8) { |
|
1063 | 1112 | return 1; |
1064 | 1113 | } |
1065 | 1114 | } |
1066 | 1115 | |
1067 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1068 | - else $i = (int)$parameters; |
|
1116 | + if(is_array($parameters)) { |
|
1117 | + $i = & $parameters['i']; |
|
1118 | + } else { |
|
1119 | + $i = (int)$parameters; |
|
1120 | + } |
|
1069 | 1121 | |
1070 | 1122 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1071 | 1123 | { |
@@ -1087,14 +1139,16 @@ discard block |
||
1087 | 1139 | |
1088 | 1140 | if((float)DOL_VERSION<=3.6) { |
1089 | 1141 | return ''; |
1090 | - } |
|
1091 | - else if((float)DOL_VERSION>=3.8) { |
|
1142 | + } else if((float)DOL_VERSION>=3.8) { |
|
1092 | 1143 | return 1; |
1093 | 1144 | } |
1094 | 1145 | } |
1095 | 1146 | |
1096 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1097 | - else $i = (int)$parameters; |
|
1147 | + if(is_array($parameters)) { |
|
1148 | + $i = & $parameters['i']; |
|
1149 | + } else { |
|
1150 | + $i = (int)$parameters; |
|
1151 | + } |
|
1098 | 1152 | |
1099 | 1153 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1100 | 1154 | { |
@@ -1116,13 +1170,15 @@ discard block |
||
1116 | 1170 | |
1117 | 1171 | if((float)DOL_VERSION<=3.6) { |
1118 | 1172 | return ''; |
1119 | - } |
|
1120 | - else if((float)DOL_VERSION>=3.8) { |
|
1173 | + } else if((float)DOL_VERSION>=3.8) { |
|
1121 | 1174 | return 1; |
1122 | 1175 | } |
1123 | 1176 | } |
1124 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1125 | - else $i = (int)$parameters; |
|
1177 | + if(is_array($parameters)) { |
|
1178 | + $i = & $parameters['i']; |
|
1179 | + } else { |
|
1180 | + $i = (int)$parameters; |
|
1181 | + } |
|
1126 | 1182 | |
1127 | 1183 | if (!empty($hideprices) |
1128 | 1184 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1145,14 +1201,16 @@ discard block |
||
1145 | 1201 | $this->resprints = ' '; |
1146 | 1202 | if((float)DOL_VERSION<=3.6) { |
1147 | 1203 | return ''; |
1148 | - } |
|
1149 | - else if((float)DOL_VERSION>=3.8) { |
|
1204 | + } else if((float)DOL_VERSION>=3.8) { |
|
1150 | 1205 | return 1; |
1151 | 1206 | } |
1152 | 1207 | } |
1153 | 1208 | |
1154 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1155 | - else $i = (int)$parameters; |
|
1209 | + if(is_array($parameters)) { |
|
1210 | + $i = & $parameters['i']; |
|
1211 | + } else { |
|
1212 | + $i = (int)$parameters; |
|
1213 | + } |
|
1156 | 1214 | |
1157 | 1215 | if (!empty($hideprices) |
1158 | 1216 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1176,16 +1234,21 @@ discard block |
||
1176 | 1234 | |
1177 | 1235 | if((float)DOL_VERSION<=3.6) { |
1178 | 1236 | return ''; |
1179 | - } |
|
1180 | - else if((float)DOL_VERSION>=3.8) { |
|
1237 | + } else if((float)DOL_VERSION>=3.8) { |
|
1181 | 1238 | return 1; |
1182 | 1239 | } |
1183 | 1240 | } |
1184 | 1241 | |
1185 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1186 | - else $i = (int)$parameters; |
|
1242 | + if(is_array($parameters)) { |
|
1243 | + $i = & $parameters['i']; |
|
1244 | + } else { |
|
1245 | + $i = (int)$parameters; |
|
1246 | + } |
|
1187 | 1247 | |
1188 | - 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) |
|
1248 | + if (empty($object->lines[$i])) { |
|
1249 | + return 0; |
|
1250 | + } |
|
1251 | + // 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) |
|
1189 | 1252 | |
1190 | 1253 | $object->lines[$i]->fetch_optionals(); |
1191 | 1254 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1207,14 +1270,16 @@ discard block |
||
1207 | 1270 | $this->resprints = ' '; |
1208 | 1271 | if((float)DOL_VERSION<=3.6) { |
1209 | 1272 | return ''; |
1210 | - } |
|
1211 | - else if((float)DOL_VERSION>=3.8) { |
|
1273 | + } else if((float)DOL_VERSION>=3.8) { |
|
1212 | 1274 | return 1; |
1213 | 1275 | } |
1214 | 1276 | } |
1215 | 1277 | |
1216 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1217 | - else $i = (int)$parameters; |
|
1278 | + if(is_array($parameters)) { |
|
1279 | + $i = & $parameters['i']; |
|
1280 | + } else { |
|
1281 | + $i = (int)$parameters; |
|
1282 | + } |
|
1218 | 1283 | |
1219 | 1284 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1220 | 1285 | { |
@@ -1244,7 +1309,9 @@ discard block |
||
1244 | 1309 | } |
1245 | 1310 | } |
1246 | 1311 | |
1247 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1312 | + if (!empty($TLineTitle)) { |
|
1313 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1314 | + } |
|
1248 | 1315 | } |
1249 | 1316 | |
1250 | 1317 | } |
@@ -1258,8 +1325,12 @@ discard block |
||
1258 | 1325 | $j=0; |
1259 | 1326 | foreach ($TLineTitle as $k => &$line) |
1260 | 1327 | { |
1261 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1262 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1328 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1329 | + continue; |
|
1330 | + } |
|
1331 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1332 | + break; |
|
1333 | + } |
|
1263 | 1334 | |
1264 | 1335 | if ($line->qty == $level) |
1265 | 1336 | { |
@@ -1293,7 +1364,9 @@ discard block |
||
1293 | 1364 | |
1294 | 1365 | $hidedetails = (int)GETPOST('hidedetails'); |
1295 | 1366 | |
1296 | - if(empty($hidedetails)) return false; |
|
1367 | + if(empty($hidedetails)) { |
|
1368 | + return false; |
|
1369 | + } |
|
1297 | 1370 | |
1298 | 1371 | // TODO can't add VAT to document without lines... :-/ |
1299 | 1372 | |
@@ -1346,7 +1419,9 @@ discard block |
||
1346 | 1419 | */ |
1347 | 1420 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1348 | 1421 | |
1349 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1422 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1423 | + $line->TTotal_tva = $TTotal_tva; |
|
1424 | + } |
|
1350 | 1425 | $line->total_ht = $total; |
1351 | 1426 | $line->total_tva = $total_tva; |
1352 | 1427 | $line->total = $line->total_ht; |
@@ -1401,8 +1476,7 @@ discard block |
||
1401 | 1476 | } |
1402 | 1477 | |
1403 | 1478 | |
1404 | - } |
|
1405 | - elseif ($hidedetails) |
|
1479 | + } elseif ($hidedetails) |
|
1406 | 1480 | { |
1407 | 1481 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1408 | 1482 | } |
@@ -1473,7 +1547,9 @@ discard block |
||
1473 | 1547 | |
1474 | 1548 | if(!empty($hideprices)) { |
1475 | 1549 | foreach($object->lines as &$line) { |
1476 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1550 | + if($line->fk_product_type!=9) { |
|
1551 | + $line->fk_parent_line = -1; |
|
1552 | + } |
|
1477 | 1553 | } |
1478 | 1554 | } |
1479 | 1555 | |
@@ -1494,7 +1570,9 @@ discard block |
||
1494 | 1570 | |
1495 | 1571 | if($line->qty>90) { |
1496 | 1572 | |
1497 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1573 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1574 | + $label .= ' '.$this->getTitle($object, $line); |
|
1575 | + } |
|
1498 | 1576 | |
1499 | 1577 | $pageBefore = $pdf->getPage(); |
1500 | 1578 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1512,8 +1590,7 @@ discard block |
||
1512 | 1590 | |
1513 | 1591 | $posy = $pdf->GetY(); |
1514 | 1592 | return 1; |
1515 | - } |
|
1516 | - else if ($line->qty < 10) { |
|
1593 | + } else if ($line->qty < 10) { |
|
1517 | 1594 | $pageBefore = $pdf->getPage(); |
1518 | 1595 | |
1519 | 1596 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1537,8 +1614,7 @@ discard block |
||
1537 | 1614 | // if($line->rowid==47) exit; |
1538 | 1615 | |
1539 | 1616 | return 0; |
1540 | - } |
|
1541 | - elseif (empty($object->lines[$parameters['i']])) |
|
1617 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1542 | 1618 | { |
1543 | 1619 | $this->resprints = -1; |
1544 | 1620 | } |
@@ -1571,7 +1647,9 @@ discard block |
||
1571 | 1647 | |
1572 | 1648 | foreach ($object->lines as $line) |
1573 | 1649 | { |
1574 | - if ($line->id == $currentLine->id) break; |
|
1650 | + if ($line->id == $currentLine->id) { |
|
1651 | + break; |
|
1652 | + } |
|
1575 | 1653 | |
1576 | 1654 | $qty_search = 100 - $currentLine->qty; |
1577 | 1655 | |
@@ -1612,11 +1690,13 @@ discard block |
||
1612 | 1690 | |
1613 | 1691 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1614 | 1692 | null; |
1615 | - } |
|
1616 | - else if (in_array('invoicecard',$contexts) || in_array('propalcard',$contexts) || in_array('ordercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1693 | + } else if (in_array('invoicecard',$contexts) || in_array('propalcard',$contexts) || in_array('ordercard',$contexts) || in_array('invoicereccard',$contexts)) |
|
1617 | 1694 | { |
1618 | - if($object->element=='facture')$idvar = 'facid'; |
|
1619 | - else $idvar='id'; |
|
1695 | + if($object->element=='facture') { |
|
1696 | + $idvar = 'facid'; |
|
1697 | + } else { |
|
1698 | + $idvar='id'; |
|
1699 | + } |
|
1620 | 1700 | |
1621 | 1701 | if((float)DOL_VERSION <= 3.4) |
1622 | 1702 | { |
@@ -1642,18 +1722,36 @@ discard block |
||
1642 | 1722 | <?php |
1643 | 1723 | } |
1644 | 1724 | |
1645 | - if(empty($line->description)) $line->description = $line->desc; |
|
1725 | + if(empty($line->description)) { |
|
1726 | + $line->description = $line->desc; |
|
1727 | + } |
|
1646 | 1728 | |
1647 | 1729 | $colspan = 5; |
1648 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1649 | - |
|
1650 | - if(!empty($conf->multicurrency->enabled)) $colspan+=2; |
|
1651 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1652 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1653 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1654 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1655 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1656 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1730 | + if($object->element == 'facturerec' ) { |
|
1731 | + $colspan = 3; |
|
1732 | + } |
|
1733 | + |
|
1734 | + if(!empty($conf->multicurrency->enabled)) { |
|
1735 | + $colspan+=2; |
|
1736 | + } |
|
1737 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
1738 | + $colspan++; |
|
1739 | + } |
|
1740 | + if(!empty($conf->margin->enabled)) { |
|
1741 | + $colspan++; |
|
1742 | + } |
|
1743 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
1744 | + $colspan++; |
|
1745 | + } |
|
1746 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
1747 | + $colspan++; |
|
1748 | + } |
|
1749 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
1750 | + $colspan++; |
|
1751 | + } |
|
1752 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
1753 | + $colspan++; |
|
1754 | + } |
|
1657 | 1755 | |
1658 | 1756 | /* Titre */ |
1659 | 1757 | //var_dump($line); |
@@ -1666,23 +1764,36 @@ discard block |
||
1666 | 1764 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1667 | 1765 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1668 | 1766 | { |
1669 | - if($line->qty==99) print 'background:#adadcf'; |
|
1670 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1671 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1672 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1673 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1674 | - else if($line->qty==50) print ''; |
|
1675 | - else print 'background:#eeeeff;'; |
|
1767 | + if($line->qty==99) { |
|
1768 | + print 'background:#adadcf'; |
|
1769 | + } else if($line->qty==98) { |
|
1770 | + print 'background:#ddddff;'; |
|
1771 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
1772 | + print 'background:#eeeeff;'; |
|
1773 | + } else if($line->qty==1) { |
|
1774 | + print 'background:#adadcf;'; |
|
1775 | + } else if($line->qty==2) { |
|
1776 | + print 'background:#ddddff;'; |
|
1777 | + } else if($line->qty==50) { |
|
1778 | + print ''; |
|
1779 | + } else { |
|
1780 | + print 'background:#eeeeff;'; |
|
1781 | + } |
|
1676 | 1782 | |
1677 | 1783 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1678 | - } |
|
1679 | - else |
|
1784 | + } else |
|
1680 | 1785 | { |
1681 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1682 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1683 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1684 | - else if($line->qty==50) print ''; |
|
1685 | - else print 'background:#eeffee;' ; |
|
1786 | + if($line->qty==99) { |
|
1787 | + print 'background:#ddffdd'; |
|
1788 | + } else if($line->qty==98) { |
|
1789 | + print 'background:#ddddff;'; |
|
1790 | + } else if($line->qty==2) { |
|
1791 | + print 'background:#eeeeff; '; |
|
1792 | + } else if($line->qty==50) { |
|
1793 | + print ''; |
|
1794 | + } else { |
|
1795 | + print 'background:#eeffee;' ; |
|
1796 | + } |
|
1686 | 1797 | } |
1687 | 1798 | |
1688 | 1799 | ?>;"> |
@@ -1705,13 +1816,11 @@ discard block |
||
1705 | 1816 | $qty_displayed = $line->qty; |
1706 | 1817 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1707 | 1818 | |
1708 | - } |
|
1709 | - else if (TSubtotal::isSubtotal($line)) |
|
1819 | + } else if (TSubtotal::isSubtotal($line)) |
|
1710 | 1820 | { |
1711 | 1821 | $qty_displayed = 100 - $line->qty; |
1712 | 1822 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
1713 | - } |
|
1714 | - else |
|
1823 | + } else |
|
1715 | 1824 | { |
1716 | 1825 | $isFreeText = true; |
1717 | 1826 | } |
@@ -1728,9 +1837,13 @@ discard block |
||
1728 | 1837 | } |
1729 | 1838 | |
1730 | 1839 | $readonlyForSituation = ''; |
1731 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
1840 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
1841 | + $readonlyForSituation = 'readonly'; |
|
1842 | + } |
|
1732 | 1843 | |
1733 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
1844 | + if (!$isFreeText) { |
|
1845 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
1846 | + } |
|
1734 | 1847 | |
1735 | 1848 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
1736 | 1849 | { |
@@ -1738,8 +1851,12 @@ discard block |
||
1738 | 1851 | for ($j=1; $j<10; $j++) |
1739 | 1852 | { |
1740 | 1853 | if (!empty($readonlyForSituation)) { |
1741 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1742 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1854 | + if ($qty_displayed == $j) { |
|
1855 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1856 | + } |
|
1857 | + } else { |
|
1858 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
1859 | + } |
|
1743 | 1860 | } |
1744 | 1861 | $select .= '</select> '; |
1745 | 1862 | |
@@ -1755,15 +1872,18 @@ discard block |
||
1755 | 1872 | $form = new Form($db); |
1756 | 1873 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
1757 | 1874 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
1758 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
1875 | + if (empty($readonlyForSituation)) { |
|
1876 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
1877 | + } |
|
1759 | 1878 | echo '</select> '; |
1760 | 1879 | |
1761 | 1880 | if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
1762 | 1881 | { |
1763 | 1882 | echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
1764 | 1883 | } |
1884 | + } else if ($isFreeText) { |
|
1885 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1765 | 1886 | } |
1766 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
1767 | 1887 | echo '</div>'; |
1768 | 1888 | |
1769 | 1889 | if($line->qty<10) { |
@@ -1783,8 +1903,7 @@ discard block |
||
1783 | 1903 | $doleditor->Create(); |
1784 | 1904 | } |
1785 | 1905 | |
1786 | - } |
|
1787 | - else { |
|
1906 | + } else { |
|
1788 | 1907 | |
1789 | 1908 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
1790 | 1909 | { |
@@ -1792,14 +1911,19 @@ discard block |
||
1792 | 1911 | { |
1793 | 1912 | echo str_repeat(' ', $line->qty-1); |
1794 | 1913 | |
1795 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
1796 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1914 | + if (TSubtotal::isTitle($line)) { |
|
1915 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
1916 | + } else { |
|
1917 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
1918 | + } |
|
1797 | 1919 | } |
1798 | - } |
|
1799 | - else |
|
1920 | + } else |
|
1800 | 1921 | { |
1801 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
1802 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
1922 | + if($line->qty<=1) { |
|
1923 | + print img_picto('', 'subtotal@subtotal'); |
|
1924 | + } else if($line->qty==2) { |
|
1925 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
1926 | + } |
|
1803 | 1927 | } |
1804 | 1928 | |
1805 | 1929 | |
@@ -1809,21 +1933,26 @@ discard block |
||
1809 | 1933 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
1810 | 1934 | |
1811 | 1935 | if (empty($line->label)) { |
1812 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
1813 | - else print $line->description; |
|
1814 | - } |
|
1815 | - else { |
|
1936 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1937 | + print $line->description.' '.$this->getTitle($object, $line); |
|
1938 | + } else { |
|
1939 | + print $line->description; |
|
1940 | + } |
|
1941 | + } else { |
|
1816 | 1942 | |
1817 | 1943 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
1818 | 1944 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
1819 | - } |
|
1820 | - else{ |
|
1945 | + } else{ |
|
1821 | 1946 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
1822 | 1947 | } |
1823 | 1948 | |
1824 | 1949 | } |
1825 | - if($line->qty>90) print ' : '; |
|
1826 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1950 | + if($line->qty>90) { |
|
1951 | + print ' : '; |
|
1952 | + } |
|
1953 | + if($line->info_bits > 0) { |
|
1954 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
1955 | + } |
|
1827 | 1956 | |
1828 | 1957 | |
1829 | 1958 | |
@@ -1860,11 +1989,12 @@ discard block |
||
1860 | 1989 | </script> |
1861 | 1990 | <?php |
1862 | 1991 | |
1863 | - } |
|
1864 | - else{ |
|
1992 | + } else{ |
|
1865 | 1993 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK)) |
1866 | 1994 | { |
1867 | - 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>'; |
|
1995 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
1996 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
1997 | + } |
|
1868 | 1998 | } |
1869 | 1999 | |
1870 | 2000 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -1933,7 +2063,9 @@ discard block |
||
1933 | 2063 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
1934 | 2064 | |
1935 | 2065 | $colspan+=3; $mode = 'view'; |
1936 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2066 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2067 | + $mode = 'edit'; |
|
2068 | + } |
|
1937 | 2069 | |
1938 | 2070 | $ex_element = $line->element; |
1939 | 2071 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2081,7 +2213,9 @@ discard block |
||
2081 | 2213 | |
2082 | 2214 | if ((!empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP) && $object->element == 'propal') || (!empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP) && $object->element == 'commande') || (!empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP) && $object->element == 'facture')) |
2083 | 2215 | { |
2084 | - if (GETPOST('subtotal_add_recap')) TSubtotal::addRecapPage($parameters, $pdf); |
|
2216 | + if (GETPOST('subtotal_add_recap')) { |
|
2217 | + TSubtotal::addRecapPage($parameters, $pdf); |
|
2218 | + } |
|
2085 | 2219 | } |
2086 | 2220 | } |
2087 | 2221 | |
@@ -2097,10 +2231,9 @@ discard block |
||
2097 | 2231 | |
2098 | 2232 | if(TSubtotal::isTitle($line)){ |
2099 | 2233 | $ThtmlData['data-issubtotal'] = 'title'; |
2100 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2234 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2101 | 2235 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2102 | - } |
|
2103 | - else{ |
|
2236 | + } else{ |
|
2104 | 2237 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2105 | 2238 | } |
2106 | 2239 | |
@@ -2110,7 +2243,9 @@ discard block |
||
2110 | 2243 | |
2111 | 2244 | // hook |
2112 | 2245 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2113 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2246 | + if ($reshook < 0) { |
|
2247 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2248 | + } |
|
2114 | 2249 | if ($reshook>0) |
2115 | 2250 | { |
2116 | 2251 | $ThtmlData = $hookmanager->resArray; |