@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Dolibarr environment |
26 | 26 | $res = @include("../../main.inc.php"); // From htdocs directory |
27 | 27 | if (! $res) { |
28 | - $res = @include("../../../main.inc.php"); // From "custom" directory |
|
28 | + $res = @include("../../../main.inc.php"); // From "custom" directory |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Libraries |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | // Access control |
39 | 39 | if (! $user->admin) { |
40 | - accessforbidden(); |
|
40 | + accessforbidden(); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /* |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | |
49 | 49 | // Subheader |
50 | 50 | $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' |
51 | - . $langs->trans("BackToModuleList") . '</a>'; |
|
51 | + . $langs->trans("BackToModuleList") . '</a>'; |
|
52 | 52 | print_fiche_titre($langs->trans($page_name), $linkback); |
53 | 53 | |
54 | 54 | // Configuration header |
55 | 55 | $head = subtotalAdminPrepareHead(); |
56 | 56 | dol_fiche_head( |
57 | - $head, |
|
58 | - 'about', |
|
59 | - $langs->trans("Module104777Name"), |
|
60 | - 0, |
|
61 | - 'subtotal@subtotal' |
|
57 | + $head, |
|
58 | + 'about', |
|
59 | + $langs->trans("Module104777Name"), |
|
60 | + 0, |
|
61 | + 'subtotal@subtotal' |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // About page goes here |
@@ -56,33 +56,33 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | - $res = $db->query("SELECT DISTINCT(fk_facture) as fk_facture FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code=104777"); |
|
60 | - while($obj = $db->fetch_object($res)) { |
|
61 | - $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture=".$obj->fk_propal." ORDER BY rang "); |
|
62 | - $k = 1; |
|
63 | - while($objLine = $db->fetch_object($resLine)) { |
|
59 | + $res = $db->query("SELECT DISTINCT(fk_facture) as fk_facture FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code=104777"); |
|
60 | + while($obj = $db->fetch_object($res)) { |
|
61 | + $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture=".$obj->fk_propal." ORDER BY rang "); |
|
62 | + $k = 1; |
|
63 | + while($objLine = $db->fetch_object($resLine)) { |
|
64 | 64 | |
65 | - $sql="UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
65 | + $sql="UPDATE ".MAIN_DB_PREFIX."facturedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
66 | 66 | |
67 | - print $sql.";<br />"; |
|
68 | - $k++; |
|
69 | - } |
|
67 | + print $sql.";<br />"; |
|
68 | + $k++; |
|
69 | + } |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - $res = $db->query("SELECT DISTINCT(fk_commande) as fk_commande FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code=104777"); |
|
74 | - while($obj = $db->fetch_object($res)) { |
|
75 | - $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande=".$obj->fk_propal." ORDER BY rang "); |
|
76 | - $k = 1; |
|
77 | - while($objLine = $db->fetch_object($resLine)) { |
|
73 | + $res = $db->query("SELECT DISTINCT(fk_commande) as fk_commande FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code=104777"); |
|
74 | + while($obj = $db->fetch_object($res)) { |
|
75 | + $resLine = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande=".$obj->fk_propal." ORDER BY rang "); |
|
76 | + $k = 1; |
|
77 | + while($objLine = $db->fetch_object($resLine)) { |
|
78 | 78 | |
79 | - $sql="UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
79 | + $sql="UPDATE ".MAIN_DB_PREFIX."commandedet SET rang=".$k.",fk_parent_line=NULL WHERE rowid=".$objLine->rowid; |
|
80 | 80 | |
81 | - print $sql.";<br />"; |
|
82 | - $k++; |
|
83 | - } |
|
81 | + print $sql.";<br />"; |
|
82 | + $k++; |
|
83 | + } |
|
84 | 84 | |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | 88 | print $sql.";<br />"; |
@@ -127,7 +127,7 @@ |
||
127 | 127 | else require_once FPDF_PATH.'fpdf.php'; |
128 | 128 | |
129 | 129 | // We need to instantiate tcpdi or fpdi object (instead of tcpdf) to use merging features. But we can disable it (this will break all merge features). |
130 | - if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php'; |
|
130 | + if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php'; |
|
131 | 131 | else if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php'; |
132 | 132 | |
133 | 133 | //$arrayformat=pdf_getFormat(); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Function to build pdf onto disk |
|
132 | - * |
|
133 | - * @param Object $object Object to generate |
|
134 | - * @param Translate $outputlangs Lang output object |
|
135 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
136 | - * @param int $hidedetails Do not show line details |
|
137 | - * @param int $hidedesc Do not show desc |
|
138 | - * @param int $hideref Do not show ref |
|
139 | - * @return int 1=OK, 0=KO |
|
131 | + * Function to build pdf onto disk |
|
132 | + * |
|
133 | + * @param Object $object Object to generate |
|
134 | + * @param Translate $outputlangs Lang output object |
|
135 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
136 | + * @param int $hidedetails Do not show line details |
|
137 | + * @param int $hidedesc Do not show desc |
|
138 | + * @param int $hideref Do not show ref |
|
139 | + * @return int 1=OK, 0=KO |
|
140 | 140 | */ |
141 | 141 | function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
142 | 142 | { |
@@ -259,25 +259,25 @@ discard block |
||
259 | 259 | $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
260 | 260 | |
261 | 261 | // Create pdf instance |
262 | - $pdf=pdf_getInstance($this->format); |
|
263 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
264 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
265 | - $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 |
|
266 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
267 | - $pdf->SetAutoPageBreak(1,0); |
|
268 | - |
|
269 | - if (class_exists('TCPDF')) |
|
270 | - { |
|
271 | - $pdf->setPrintHeader(false); |
|
272 | - $pdf->setPrintFooter(false); |
|
273 | - } |
|
274 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
275 | - // Set path to the background PDF File |
|
276 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
277 | - { |
|
278 | - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
279 | - $tplidx = $pdf->importPage(1); |
|
280 | - } |
|
262 | + $pdf=pdf_getInstance($this->format); |
|
263 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
264 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
265 | + $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 |
|
266 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
267 | + $pdf->SetAutoPageBreak(1,0); |
|
268 | + |
|
269 | + if (class_exists('TCPDF')) |
|
270 | + { |
|
271 | + $pdf->setPrintHeader(false); |
|
272 | + $pdf->setPrintFooter(false); |
|
273 | + } |
|
274 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
275 | + // Set path to the background PDF File |
|
276 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
277 | + { |
|
278 | + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
279 | + $tplidx = $pdf->importPage(1); |
|
280 | + } |
|
281 | 281 | |
282 | 282 | $pdf->Open(); |
283 | 283 | $pagenb=0; |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | $localtax2_type = $localtaxtmp_array[2]; |
613 | 613 | } |
614 | 614 | |
615 | - // retrieve global local tax |
|
615 | + // retrieve global local tax |
|
616 | 616 | if ($localtax1_type && $localtax1ligne != 0) |
617 | 617 | $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
618 | 618 | if ($localtax2_type && $localtax2ligne != 0) |
@@ -750,11 +750,11 @@ discard block |
||
750 | 750 | /** |
751 | 751 | * Show payments table |
752 | 752 | * |
753 | - * @param PDF $pdf Object PDF |
|
754 | - * @param Object $object Object proposal |
|
755 | - * @param int $posy Position y in PDF |
|
756 | - * @param Translate $outputlangs Object langs for output |
|
757 | - * @return int <0 if KO, >0 if OK |
|
753 | + * @param PDF $pdf Object PDF |
|
754 | + * @param Object $object Object proposal |
|
755 | + * @param int $posy Position y in PDF |
|
756 | + * @param Translate $outputlangs Object langs for output |
|
757 | + * @return int <0 if KO, >0 if OK |
|
758 | 758 | */ |
759 | 759 | function _tableau_versements(&$pdf, $object, $posy, $outputlangs) |
760 | 760 | { |
@@ -790,10 +790,10 @@ discard block |
||
790 | 790 | |
791 | 791 | $posxval=52; |
792 | 792 | |
793 | - // Show shipping date |
|
794 | - if (! empty($object->date_livraison)) |
|
793 | + // Show shipping date |
|
794 | + if (! empty($object->date_livraison)) |
|
795 | 795 | { |
796 | - $outputlangs->load("sendings"); |
|
796 | + $outputlangs->load("sendings"); |
|
797 | 797 | $pdf->SetFont('','B', $default_font_size - 2); |
798 | 798 | $pdf->SetXY($this->marge_gauche, $posy); |
799 | 799 | $titre = $outputlangs->transnoentities("DateDeliveryPlanned").':'; |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | $dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); |
804 | 804 | $pdf->MultiCell(80, 4, $dlp, 0, 'L'); |
805 | 805 | |
806 | - $posy=$pdf->GetY()+1; |
|
806 | + $posy=$pdf->GetY()+1; |
|
807 | 807 | } |
808 | - elseif ($object->availability_code || $object->availability) // Show availability conditions |
|
808 | + elseif ($object->availability_code || $object->availability) // Show availability conditions |
|
809 | 809 | { |
810 | 810 | $pdf->SetFont('','B', $default_font_size - 2); |
811 | 811 | $pdf->SetXY($this->marge_gauche, $posy); |
@@ -891,13 +891,13 @@ discard block |
||
891 | 891 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
892 | 892 | $posy=$pdf->GetY()+1; |
893 | 893 | |
894 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
895 | - { |
|
894 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
895 | + { |
|
896 | 896 | $pdf->SetXY($this->marge_gauche, $posy); |
897 | 897 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
898 | 898 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
899 | 899 | $posy=$pdf->GetY()+2; |
900 | - } |
|
900 | + } |
|
901 | 901 | } |
902 | 902 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
903 | 903 | { |
@@ -906,13 +906,13 @@ discard block |
||
906 | 906 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
907 | 907 | $posy=$pdf->GetY()+1; |
908 | 908 | |
909 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
910 | - { |
|
909 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
910 | + { |
|
911 | 911 | $pdf->SetXY($this->marge_gauche, $posy); |
912 | 912 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
913 | 913 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
914 | 914 | $posy=$pdf->GetY()+2; |
915 | - } |
|
915 | + } |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | } |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | } |
1025 | - //} |
|
1025 | + //} |
|
1026 | 1026 | //Local tax 2 before VAT |
1027 | 1027 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1028 | 1028 | //{ |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | } |
1117 | - //} |
|
1117 | + //} |
|
1118 | 1118 | //Local tax 2 after VAT |
1119 | 1119 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1120 | 1120 | //{ |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | foreach( $localtax_rate as $tvakey => $tvaval ) |
1126 | 1126 | { |
1127 | - // retrieve global local tax |
|
1127 | + // retrieve global local tax |
|
1128 | 1128 | if ($tvakey != 0) // On affiche pas taux 0 |
1129 | 1129 | { |
1130 | 1130 | //$this->atleastoneratenotnull++; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | // Show Draft Watermark |
1342 | 1342 | if($object->statut==0 && (! empty($conf->global->PROPALE_DRAFT_WATERMARK)) ) |
1343 | 1343 | { |
1344 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK); |
|
1344 | + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->PROPALE_DRAFT_WATERMARK); |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $pdf->SetTextColor(0,0,60); |
@@ -1358,8 +1358,8 @@ discard block |
||
1358 | 1358 | { |
1359 | 1359 | if (is_readable($logo)) |
1360 | 1360 | { |
1361 | - $height=pdf_getHeightForLogo($logo); |
|
1362 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1361 | + $height=pdf_getHeightForLogo($logo); |
|
1362 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
1363 | 1363 | } |
1364 | 1364 | else |
1365 | 1365 | { |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | |
1518 | 1518 | /** |
1519 | 1519 | * Show footer of page. Need this->emetteur object |
1520 | - * |
|
1520 | + * |
|
1521 | 1521 | * @param PDF $pdf PDF |
1522 | 1522 | * @param Object $object Object to show |
1523 | 1523 | * @param Translate $outputlangs Object lang for output |
@@ -6,73 +6,73 @@ |
||
6 | 6 | |
7 | 7 | if((float)DOL_VERSION >= 7) |
8 | 8 | { |
9 | - print "Début de conversion des lignes de propale<br>"; |
|
10 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
11 | - $res = $db->query($sql); |
|
12 | - if($res) |
|
13 | - { |
|
14 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
15 | - $i = 0; |
|
16 | - while ($obj = $db->fetch_object($res)) |
|
17 | - { |
|
18 | - $prop = new PropaleLigne($db); |
|
19 | - $prop->fetch($obj->rowid); |
|
20 | - $prop->fetch_optionals(); |
|
21 | - if (empty($prop->label)){ |
|
22 | - $prop->label = strip_tags($prop->desc); |
|
23 | - $prop->desc = ''; |
|
24 | - } |
|
25 | - $ret = $prop->update(1); |
|
26 | - if($ret>0) $i++; |
|
27 | - } |
|
28 | - print $i." lignes converties<br>"; |
|
29 | - } |
|
9 | + print "Début de conversion des lignes de propale<br>"; |
|
10 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propaldet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
11 | + $res = $db->query($sql); |
|
12 | + if($res) |
|
13 | + { |
|
14 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
15 | + $i = 0; |
|
16 | + while ($obj = $db->fetch_object($res)) |
|
17 | + { |
|
18 | + $prop = new PropaleLigne($db); |
|
19 | + $prop->fetch($obj->rowid); |
|
20 | + $prop->fetch_optionals(); |
|
21 | + if (empty($prop->label)){ |
|
22 | + $prop->label = strip_tags($prop->desc); |
|
23 | + $prop->desc = ''; |
|
24 | + } |
|
25 | + $ret = $prop->update(1); |
|
26 | + if($ret>0) $i++; |
|
27 | + } |
|
28 | + print $i." lignes converties<br>"; |
|
29 | + } |
|
30 | 30 | |
31 | - print "Début de conversion des lignes de commande<br>"; |
|
32 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
33 | - $res = $db->query($sql); |
|
34 | - if($res) |
|
35 | - { |
|
36 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
37 | - $i = 0; |
|
38 | - while ($obj = $db->fetch_object($res)) |
|
39 | - { |
|
40 | - $cdeline = new OrderLine($db); |
|
41 | - $cdeline->fetch($obj->rowid); |
|
42 | - $cdeline->fetch_optionals($obj->rowid); |
|
43 | - if (empty($cdeline->label)){ |
|
44 | - $cdeline->label = strip_tags($cdeline->desc); |
|
45 | - $cdeline->desc = ''; |
|
46 | - } |
|
47 | - $ret = $cdeline->update($user, 1); |
|
48 | - if($ret>0) $i++; |
|
49 | - } |
|
31 | + print "Début de conversion des lignes de commande<br>"; |
|
32 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commandedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
33 | + $res = $db->query($sql); |
|
34 | + if($res) |
|
35 | + { |
|
36 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
37 | + $i = 0; |
|
38 | + while ($obj = $db->fetch_object($res)) |
|
39 | + { |
|
40 | + $cdeline = new OrderLine($db); |
|
41 | + $cdeline->fetch($obj->rowid); |
|
42 | + $cdeline->fetch_optionals($obj->rowid); |
|
43 | + if (empty($cdeline->label)){ |
|
44 | + $cdeline->label = strip_tags($cdeline->desc); |
|
45 | + $cdeline->desc = ''; |
|
46 | + } |
|
47 | + $ret = $cdeline->update($user, 1); |
|
48 | + if($ret>0) $i++; |
|
49 | + } |
|
50 | 50 | |
51 | - print $i." lignes converties<br>"; |
|
52 | - } |
|
51 | + print $i." lignes converties<br>"; |
|
52 | + } |
|
53 | 53 | |
54 | - print "Début de conversion des lignes de facture<br>"; |
|
55 | - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
54 | + print "Début de conversion des lignes de facture<br>"; |
|
55 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet WHERE special_code = 104777 AND qty != 50 AND product_type = 9 AND (label = '' OR label IS NULL)"; |
|
56 | 56 | |
57 | - $res = $db->query($sql); |
|
58 | - if($res) |
|
59 | - { |
|
60 | - print $db->num_rows($res)." lignes à convertir<br>"; |
|
61 | - $i = 0; |
|
62 | - while ($obj = $db->fetch_object($res)) |
|
63 | - { |
|
64 | - $facline = new FactureLigne($db); |
|
65 | - $facline->fetch($obj->rowid); |
|
66 | - $facline->fetch_optionals($obj->rowid); |
|
67 | - if (empty($facline->label)){ |
|
68 | - $facline->label = strip_tags($facline->desc); |
|
69 | - $facline->desc = ''; |
|
70 | - } |
|
71 | - $ret = $facline->update($user, 1); |
|
72 | - if($ret>0) $i++; |
|
73 | - } |
|
57 | + $res = $db->query($sql); |
|
58 | + if($res) |
|
59 | + { |
|
60 | + print $db->num_rows($res)." lignes à convertir<br>"; |
|
61 | + $i = 0; |
|
62 | + while ($obj = $db->fetch_object($res)) |
|
63 | + { |
|
64 | + $facline = new FactureLigne($db); |
|
65 | + $facline->fetch($obj->rowid); |
|
66 | + $facline->fetch_optionals($obj->rowid); |
|
67 | + if (empty($facline->label)){ |
|
68 | + $facline->label = strip_tags($facline->desc); |
|
69 | + $facline->desc = ''; |
|
70 | + } |
|
71 | + $ret = $facline->update($user, 1); |
|
72 | + if($ret>0) $i++; |
|
73 | + } |
|
74 | 74 | |
75 | - print $i." lignes converties<br>"; |
|
76 | - } |
|
75 | + print $i." lignes converties<br>"; |
|
76 | + } |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | \ No newline at end of file |
@@ -25,25 +25,25 @@ discard block |
||
25 | 25 | |
26 | 26 | function subtotalAdminPrepareHead() |
27 | 27 | { |
28 | - global $langs, $conf; |
|
28 | + global $langs, $conf; |
|
29 | 29 | |
30 | - $langs->load("subtotal@subtotal"); |
|
30 | + $langs->load("subtotal@subtotal"); |
|
31 | 31 | |
32 | - $h = 0; |
|
33 | - $head = array(); |
|
32 | + $h = 0; |
|
33 | + $head = array(); |
|
34 | 34 | |
35 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
36 | - $head[$h][1] = $langs->trans("Parameters"); |
|
37 | - $head[$h][2] = 'settings'; |
|
38 | - $h++; |
|
39 | - $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
40 | - $head[$h][1] = $langs->trans("About"); |
|
41 | - $head[$h][2] = 'about'; |
|
42 | - $h++; |
|
35 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1); |
|
36 | + $head[$h][1] = $langs->trans("Parameters"); |
|
37 | + $head[$h][2] = 'settings'; |
|
38 | + $h++; |
|
39 | + $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1); |
|
40 | + $head[$h][1] = $langs->trans("About"); |
|
41 | + $head[$h][2] = 'about'; |
|
42 | + $h++; |
|
43 | 43 | |
44 | - complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
44 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false); |
|
45 | 45 | |
46 | - return $head; |
|
46 | + return $head; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | function getHtmlSelectTitle(&$object, $showLabel=false) |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | $label = GETPOST('line-title'); |
131 | 131 | $description = ($line->qty>90) ? '' : GETPOST('line-description'); |
132 | 132 | $pagebreak = (int) GETPOST('line-pagebreak'); |
133 | - $showTotalHT = (int) GETPOST('line-showTotalHT'); |
|
134 | - $showReduc = (int) GETPOST('line-showReduc'); |
|
133 | + $showTotalHT = (int) GETPOST('line-showTotalHT'); |
|
134 | + $showReduc = (int) GETPOST('line-showReduc'); |
|
135 | 135 | |
136 | 136 | $level = GETPOST('subtotal_level', 'int'); |
137 | 137 | if (!empty($level)) |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total |
140 | 140 | else $line->qty = $level; |
141 | 141 | } |
142 | - $line->array_options['options_show_total_ht'] = $showTotalHT; |
|
143 | - $line->array_options['options_show_reduc'] = $showReduc; |
|
142 | + $line->array_options['options_show_total_ht'] = $showTotalHT; |
|
143 | + $line->array_options['options_show_reduc'] = $showReduc; |
|
144 | 144 | |
145 | 145 | $res = TSubtotal::doUpdateLine($object, $line->id, $description, 0, $line->qty, 0, '', '', 0, 9, 0, 0, 'HT', $pagebreak, 0, 1, null, 0, $label, TSubtotal::$module_number, $line->array_options); |
146 | 146 | |
@@ -246,17 +246,17 @@ discard block |
||
246 | 246 | $classname = ucfirst($element); |
247 | 247 | |
248 | 248 | switch ($element) { |
249 | - case 'supplier_proposal': |
|
250 | - $classname = 'SupplierProposal'; |
|
251 | - break; |
|
249 | + case 'supplier_proposal': |
|
250 | + $classname = 'SupplierProposal'; |
|
251 | + break; |
|
252 | 252 | |
253 | - case 'order_supplier': |
|
254 | - $classname = 'CommandeFournisseur'; |
|
255 | - break; |
|
253 | + case 'order_supplier': |
|
254 | + $classname = 'CommandeFournisseur'; |
|
255 | + break; |
|
256 | 256 | |
257 | - case 'invoice_supplier': |
|
258 | - $classname = 'FactureFournisseur'; |
|
259 | - break; |
|
257 | + case 'invoice_supplier': |
|
258 | + $classname = 'FactureFournisseur'; |
|
259 | + break; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | $object = new $classname($db); // Propal | Commande | Facture |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | else $res = $line->update($user, $notrigger); |
330 | 330 | } |
331 | 331 | else { |
332 | - if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
333 | - if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
332 | + if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) { |
|
333 | + if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label |
|
334 | 334 | |
335 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
336 | - $extrafields=new ExtraFields($object->db); |
|
337 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
338 | - $line->fetch_optionals($line->id,$extralabels); |
|
339 | - } |
|
335 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
336 | + $extrafields=new ExtraFields($object->db); |
|
337 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
338 | + $line->fetch_optionals($line->id,$extralabels); |
|
339 | + } |
|
340 | 340 | $line->array_options['options_subtotal_nc'] = 0; |
341 | 341 | if($object->element == 'order_supplier') $line->update($user); |
342 | 342 | $res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $notrigger); |
@@ -31,187 +31,187 @@ 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.3.0'; |
|
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( |
|
100 | - 'invoicecard' |
|
101 | - ,'invoicesuppliercard' |
|
102 | - ,'propalcard' |
|
103 | - ,'supplier_proposalcard' |
|
104 | - ,'ordercard' |
|
105 | - ,'ordersuppliercard' |
|
106 | - ,'odtgeneration' |
|
107 | - ,'orderstoinvoice' |
|
108 | - ,'orderstoinvoicesupplier' |
|
109 | - ,'admin' |
|
110 | - ,'invoicereccard' |
|
111 | - ,'consumptionthirdparty' |
|
112 | - ,'ordershipmentcard' |
|
113 | - ,'expeditioncard' |
|
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.3.0'; |
|
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( |
|
100 | + 'invoicecard' |
|
101 | + ,'invoicesuppliercard' |
|
102 | + ,'propalcard' |
|
103 | + ,'supplier_proposalcard' |
|
104 | + ,'ordercard' |
|
105 | + ,'ordersuppliercard' |
|
106 | + ,'odtgeneration' |
|
107 | + ,'orderstoinvoice' |
|
108 | + ,'orderstoinvoicesupplier' |
|
109 | + ,'admin' |
|
110 | + ,'invoicereccard' |
|
111 | + ,'consumptionthirdparty' |
|
112 | + ,'ordershipmentcard' |
|
113 | + ,'expeditioncard' |
|
114 | 114 | ,'deliverycard' |
115 | 115 | ,'paiementcard' |
116 | - ) |
|
117 | - // Set here all workflow context managed by module |
|
118 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
119 | - ); |
|
116 | + ) |
|
117 | + // Set here all workflow context managed by module |
|
118 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
119 | + ); |
|
120 | 120 | |
121 | - // Data directories to create when module is enabled. |
|
122 | - // Example: this->dirs = array("/titre/temp"); |
|
123 | - $this->dirs = array(); |
|
121 | + // Data directories to create when module is enabled. |
|
122 | + // Example: this->dirs = array("/titre/temp"); |
|
123 | + $this->dirs = array(); |
|
124 | 124 | |
125 | - // Config pages. Put here list of php pages |
|
126 | - // stored into titre/admin directory, used to setup module. |
|
127 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
125 | + // Config pages. Put here list of php pages |
|
126 | + // stored into titre/admin directory, used to setup module. |
|
127 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
128 | 128 | |
129 | - // Dependencies |
|
130 | - // List of modules id that must be enabled if this module is enabled |
|
131 | - $this->depends = array(); |
|
129 | + // Dependencies |
|
130 | + // List of modules id that must be enabled if this module is enabled |
|
131 | + $this->depends = array(); |
|
132 | 132 | |
133 | 133 | $this->conflictwith=array('modMilestone'); |
134 | - // List of modules id to disable if this one is disabled |
|
135 | - $this->requiredby = array(); |
|
136 | - // Minimum version of PHP required by module |
|
137 | - $this->phpmin = array(5, 3); |
|
138 | - // Minimum version of Dolibarr required by module |
|
139 | - $this->need_dolibarr_version = array(3, 2); |
|
140 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
141 | - // Constants |
|
142 | - // List of particular constants to add when module is enabled |
|
143 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
144 | - // Example: |
|
145 | - $this->const = array( |
|
146 | - 0=>array( |
|
147 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
148 | - 'chaine', |
|
149 | - 'I', |
|
150 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
151 | - 1 |
|
152 | - ) |
|
134 | + // List of modules id to disable if this one is disabled |
|
135 | + $this->requiredby = array(); |
|
136 | + // Minimum version of PHP required by module |
|
137 | + $this->phpmin = array(5, 3); |
|
138 | + // Minimum version of Dolibarr required by module |
|
139 | + $this->need_dolibarr_version = array(3, 2); |
|
140 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
141 | + // Constants |
|
142 | + // List of particular constants to add when module is enabled |
|
143 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
144 | + // Example: |
|
145 | + $this->const = array( |
|
146 | + 0=>array( |
|
147 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
148 | + 'chaine', |
|
149 | + 'I', |
|
150 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
151 | + 1 |
|
152 | + ) |
|
153 | 153 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
154 | 154 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
155 | 155 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
156 | 156 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
157 | 157 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
158 | - // 1=>array( |
|
159 | - // 'MYMODULE_MYNEWCONST2', |
|
160 | - // 'chaine', |
|
161 | - // 'myvalue', |
|
162 | - // 'This is another constant to add', |
|
163 | - // 0 |
|
164 | - // ) |
|
165 | - ); |
|
158 | + // 1=>array( |
|
159 | + // 'MYMODULE_MYNEWCONST2', |
|
160 | + // 'chaine', |
|
161 | + // 'myvalue', |
|
162 | + // 'This is another constant to add', |
|
163 | + // 0 |
|
164 | + // ) |
|
165 | + ); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
169 | 169 | |
170 | - // Array to add new pages in new tabs |
|
171 | - // Example: |
|
172 | - $this->tabs = array( |
|
173 | - // // To add a new tab identified by code tabname1 |
|
174 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
175 | - // // To add another new tab identified by code tabname2 |
|
176 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
177 | - // // To remove an existing tab identified by code tabname |
|
178 | - // 'objecttype:-tabname' |
|
179 | - ); |
|
180 | - // where objecttype can be |
|
181 | - // 'thirdparty' to add a tab in third party view |
|
182 | - // 'intervention' to add a tab in intervention view |
|
183 | - // 'order_supplier' to add a tab in supplier order view |
|
184 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
185 | - // 'invoice' to add a tab in customer invoice view |
|
186 | - // 'order' to add a tab in customer order view |
|
187 | - // 'product' to add a tab in product view |
|
188 | - // 'stock' to add a tab in stock view |
|
189 | - // 'propal' to add a tab in propal view |
|
190 | - // 'member' to add a tab in fundation member view |
|
191 | - // 'contract' to add a tab in contract view |
|
192 | - // 'user' to add a tab in user view |
|
193 | - // 'group' to add a tab in group view |
|
194 | - // 'contact' to add a tab in contact view |
|
195 | - // 'categories_x' to add a tab in category view |
|
196 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
197 | - // Dictionnaries |
|
198 | - if (! isset($conf->subtotal->enabled)) { |
|
199 | - $conf->subtotal=new stdClass(); |
|
200 | - $conf->subtotal->enabled = 0; |
|
201 | - } |
|
202 | - $this->dictionaries = array( |
|
170 | + // Array to add new pages in new tabs |
|
171 | + // Example: |
|
172 | + $this->tabs = array( |
|
173 | + // // To add a new tab identified by code tabname1 |
|
174 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
175 | + // // To add another new tab identified by code tabname2 |
|
176 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
177 | + // // To remove an existing tab identified by code tabname |
|
178 | + // 'objecttype:-tabname' |
|
179 | + ); |
|
180 | + // where objecttype can be |
|
181 | + // 'thirdparty' to add a tab in third party view |
|
182 | + // 'intervention' to add a tab in intervention view |
|
183 | + // 'order_supplier' to add a tab in supplier order view |
|
184 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
185 | + // 'invoice' to add a tab in customer invoice view |
|
186 | + // 'order' to add a tab in customer order view |
|
187 | + // 'product' to add a tab in product view |
|
188 | + // 'stock' to add a tab in stock view |
|
189 | + // 'propal' to add a tab in propal view |
|
190 | + // 'member' to add a tab in fundation member view |
|
191 | + // 'contract' to add a tab in contract view |
|
192 | + // 'user' to add a tab in user view |
|
193 | + // 'group' to add a tab in group view |
|
194 | + // 'contact' to add a tab in contact view |
|
195 | + // 'categories_x' to add a tab in category view |
|
196 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
197 | + // Dictionnaries |
|
198 | + if (! isset($conf->subtotal->enabled)) { |
|
199 | + $conf->subtotal=new stdClass(); |
|
200 | + $conf->subtotal->enabled = 0; |
|
201 | + } |
|
202 | + $this->dictionaries = array( |
|
203 | 203 | 'langs'=>'subtotal@subtotal', |
204 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
205 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
206 | - '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 |
|
207 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
208 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
209 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
210 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
211 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
212 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
204 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
205 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
206 | + '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 |
|
207 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
208 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
209 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
210 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
211 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
212 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
213 | 213 | ); |
214 | - /* Example: |
|
214 | + /* Example: |
|
215 | 215 | // This is to avoid warnings |
216 | 216 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
217 | 217 | $this->dictionnaries=array( |
@@ -252,223 +252,223 @@ discard block |
||
252 | 252 | ); |
253 | 253 | */ |
254 | 254 | |
255 | - // Boxes |
|
256 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
257 | - $this->boxes = array(); // Boxes list |
|
255 | + // Boxes |
|
256 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
257 | + $this->boxes = array(); // Boxes list |
|
258 | 258 | |
259 | - /* |
|
259 | + /* |
|
260 | 260 | $this->boxes[$r][1] = "myboxb.php"; |
261 | 261 | $r++; |
262 | 262 | */ |
263 | 263 | |
264 | - // Permissions |
|
265 | - $this->rights = array(); // Permission array used by this module |
|
266 | - $r = 0; |
|
264 | + // Permissions |
|
265 | + $this->rights = array(); // Permission array used by this module |
|
266 | + $r = 0; |
|
267 | 267 | |
268 | - // Add here list of permission defined by |
|
269 | - // an id, a label, a boolean and two constant strings. |
|
270 | - // Example: |
|
271 | - //// Permission id (must not be already used) |
|
272 | - //$this->rights[$r][0] = 2000; |
|
273 | - //// Permission label |
|
274 | - //$this->rights[$r][1] = 'Permision label'; |
|
275 | - //// Permission by default for new user (0/1) |
|
276 | - //$this->rights[$r][3] = 1; |
|
277 | - //// In php code, permission will be checked by test |
|
278 | - //// if ($user->rights->permkey->level1->level2) |
|
279 | - //$this->rights[$r][4] = 'level1'; |
|
280 | - //// In php code, permission will be checked by test |
|
281 | - //// if ($user->rights->permkey->level1->level2) |
|
282 | - //$this->rights[$r][5] = 'level2'; |
|
283 | - //$r++; |
|
284 | - // Main menu entries |
|
285 | - $this->menus = array(); // List of menus to add |
|
286 | - $r = 0; |
|
268 | + // Add here list of permission defined by |
|
269 | + // an id, a label, a boolean and two constant strings. |
|
270 | + // Example: |
|
271 | + //// Permission id (must not be already used) |
|
272 | + //$this->rights[$r][0] = 2000; |
|
273 | + //// Permission label |
|
274 | + //$this->rights[$r][1] = 'Permision label'; |
|
275 | + //// Permission by default for new user (0/1) |
|
276 | + //$this->rights[$r][3] = 1; |
|
277 | + //// In php code, permission will be checked by test |
|
278 | + //// if ($user->rights->permkey->level1->level2) |
|
279 | + //$this->rights[$r][4] = 'level1'; |
|
280 | + //// In php code, permission will be checked by test |
|
281 | + //// if ($user->rights->permkey->level1->level2) |
|
282 | + //$this->rights[$r][5] = 'level2'; |
|
283 | + //$r++; |
|
284 | + // Main menu entries |
|
285 | + $this->menus = array(); // List of menus to add |
|
286 | + $r = 0; |
|
287 | 287 | |
288 | - // Add here entries to declare new menus |
|
289 | - // |
|
290 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
291 | - //$this->menu[$r]=array( |
|
292 | - // // Put 0 if this is a top menu |
|
293 | - // 'fk_menu'=>0, |
|
294 | - // // This is a Top menu entry |
|
295 | - // 'type'=>'top', |
|
296 | - // 'titre'=>'titre top menu', |
|
297 | - // 'mainmenu'=>'titre', |
|
298 | - // 'leftmenu'=>'titre', |
|
299 | - // 'url'=>'/titre/pagetop.php', |
|
300 | - // // Lang file to use (without .lang) by module. |
|
301 | - // // File must be in langs/code_CODE/ directory. |
|
302 | - // 'langs'=>'mylangfile', |
|
303 | - // 'position'=>100, |
|
304 | - // // Define condition to show or hide menu entry. |
|
305 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
306 | - // 'enabled'=>'$conf->titre->enabled', |
|
307 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
308 | - // // if you want your menu with a permission rules |
|
309 | - // 'perms'=>'1', |
|
310 | - // 'target'=>'', |
|
311 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
312 | - // 'user'=>2 |
|
313 | - //); |
|
314 | - //$r++; |
|
315 | - //$this->menu[$r]=array( |
|
316 | - // // Use r=value where r is index key used for the parent menu entry |
|
317 | - // // (higher parent must be a top menu entry) |
|
318 | - // 'fk_menu'=>'r=0', |
|
319 | - // // This is a Left menu entry |
|
320 | - // 'type'=>'left', |
|
321 | - // 'titre'=>'titre left menu', |
|
322 | - // 'mainmenu'=>'titre', |
|
323 | - // 'leftmenu'=>'titre', |
|
324 | - // 'url'=>'/titre/pagelevel1.php', |
|
325 | - // // Lang file to use (without .lang) by module. |
|
326 | - // // File must be in langs/code_CODE/ directory. |
|
327 | - // 'langs'=>'mylangfile', |
|
328 | - // 'position'=>100, |
|
329 | - // // Define condition to show or hide menu entry. |
|
330 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
331 | - // 'enabled'=>'$conf->titre->enabled', |
|
332 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
333 | - // // if you want your menu with a permission rules |
|
334 | - // 'perms'=>'1', |
|
335 | - // 'target'=>'', |
|
336 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
337 | - // 'user'=>2 |
|
338 | - //); |
|
339 | - //$r++; |
|
340 | - // |
|
341 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
342 | - //$this->menu[$r]=array( |
|
343 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
344 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
345 | - // // This is a Left menu entry |
|
346 | - // 'type'=>'left', |
|
347 | - // 'titre'=>'titre left menu', |
|
348 | - // 'mainmenu'=>'mainmenucode', |
|
349 | - // 'leftmenu'=>'titre', |
|
350 | - // 'url'=>'/titre/pagelevel2.php', |
|
351 | - // // Lang file to use (without .lang) by module. |
|
352 | - // // File must be in langs/code_CODE/ directory. |
|
353 | - // 'langs'=>'mylangfile', |
|
354 | - // 'position'=>100, |
|
355 | - // // Define condition to show or hide menu entry. |
|
356 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
357 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
358 | - // 'enabled'=>'$conf->titre->enabled', |
|
359 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
360 | - // // if you want your menu with a permission rules |
|
361 | - // 'perms'=>'1', |
|
362 | - // 'target'=>'', |
|
363 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
364 | - // 'user'=>2 |
|
365 | - //); |
|
366 | - //$r++; |
|
367 | - // Exports |
|
368 | - $r = 1; |
|
288 | + // Add here entries to declare new menus |
|
289 | + // |
|
290 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
291 | + //$this->menu[$r]=array( |
|
292 | + // // Put 0 if this is a top menu |
|
293 | + // 'fk_menu'=>0, |
|
294 | + // // This is a Top menu entry |
|
295 | + // 'type'=>'top', |
|
296 | + // 'titre'=>'titre top menu', |
|
297 | + // 'mainmenu'=>'titre', |
|
298 | + // 'leftmenu'=>'titre', |
|
299 | + // 'url'=>'/titre/pagetop.php', |
|
300 | + // // Lang file to use (without .lang) by module. |
|
301 | + // // File must be in langs/code_CODE/ directory. |
|
302 | + // 'langs'=>'mylangfile', |
|
303 | + // 'position'=>100, |
|
304 | + // // Define condition to show or hide menu entry. |
|
305 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
306 | + // 'enabled'=>'$conf->titre->enabled', |
|
307 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
308 | + // // if you want your menu with a permission rules |
|
309 | + // 'perms'=>'1', |
|
310 | + // 'target'=>'', |
|
311 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
312 | + // 'user'=>2 |
|
313 | + //); |
|
314 | + //$r++; |
|
315 | + //$this->menu[$r]=array( |
|
316 | + // // Use r=value where r is index key used for the parent menu entry |
|
317 | + // // (higher parent must be a top menu entry) |
|
318 | + // 'fk_menu'=>'r=0', |
|
319 | + // // This is a Left menu entry |
|
320 | + // 'type'=>'left', |
|
321 | + // 'titre'=>'titre left menu', |
|
322 | + // 'mainmenu'=>'titre', |
|
323 | + // 'leftmenu'=>'titre', |
|
324 | + // 'url'=>'/titre/pagelevel1.php', |
|
325 | + // // Lang file to use (without .lang) by module. |
|
326 | + // // File must be in langs/code_CODE/ directory. |
|
327 | + // 'langs'=>'mylangfile', |
|
328 | + // 'position'=>100, |
|
329 | + // // Define condition to show or hide menu entry. |
|
330 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
331 | + // 'enabled'=>'$conf->titre->enabled', |
|
332 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
333 | + // // if you want your menu with a permission rules |
|
334 | + // 'perms'=>'1', |
|
335 | + // 'target'=>'', |
|
336 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
337 | + // 'user'=>2 |
|
338 | + //); |
|
339 | + //$r++; |
|
340 | + // |
|
341 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
342 | + //$this->menu[$r]=array( |
|
343 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
344 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
345 | + // // This is a Left menu entry |
|
346 | + // 'type'=>'left', |
|
347 | + // 'titre'=>'titre left menu', |
|
348 | + // 'mainmenu'=>'mainmenucode', |
|
349 | + // 'leftmenu'=>'titre', |
|
350 | + // 'url'=>'/titre/pagelevel2.php', |
|
351 | + // // Lang file to use (without .lang) by module. |
|
352 | + // // File must be in langs/code_CODE/ directory. |
|
353 | + // 'langs'=>'mylangfile', |
|
354 | + // 'position'=>100, |
|
355 | + // // Define condition to show or hide menu entry. |
|
356 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
357 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
358 | + // 'enabled'=>'$conf->titre->enabled', |
|
359 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
360 | + // // if you want your menu with a permission rules |
|
361 | + // 'perms'=>'1', |
|
362 | + // 'target'=>'', |
|
363 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
364 | + // 'user'=>2 |
|
365 | + //); |
|
366 | + //$r++; |
|
367 | + // Exports |
|
368 | + $r = 1; |
|
369 | 369 | |
370 | - // Example: |
|
371 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
372 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
373 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
374 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
375 | - //// Set to 1 to always show when module is enabled. |
|
376 | - //$this->export_enabled[$r]='1'; |
|
377 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
378 | - //$this->export_fields_array[$r]=array( |
|
379 | - // 's.rowid'=>"IdCompany", |
|
380 | - // 's.nom'=>'CompanyName', |
|
381 | - // 's.address'=>'Address', |
|
382 | - // 's.cp'=>'Zip', |
|
383 | - // 's.ville'=>'Town', |
|
384 | - // 's.fk_pays'=>'Country', |
|
385 | - // 's.tel'=>'Phone', |
|
386 | - // 's.siren'=>'ProfId1', |
|
387 | - // 's.siret'=>'ProfId2', |
|
388 | - // 's.ape'=>'ProfId3', |
|
389 | - // 's.idprof4'=>'ProfId4', |
|
390 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
391 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
392 | - // 'f.rowid'=>"InvoiceId", |
|
393 | - // 'f.facnumber'=>"InvoiceRef", |
|
394 | - // 'f.datec'=>"InvoiceDateCreation", |
|
395 | - // 'f.datef'=>"DateInvoice", |
|
396 | - // 'f.total'=>"TotalHT", |
|
397 | - // 'f.total_ttc'=>"TotalTTC", |
|
398 | - // 'f.tva'=>"TotalVAT", |
|
399 | - // 'f.paye'=>"InvoicePaid", |
|
400 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
401 | - // 'f.note'=>"InvoiceNote", |
|
402 | - // 'fd.rowid'=>'LineId', |
|
403 | - // 'fd.description'=>"LineDescription", |
|
404 | - // 'fd.price'=>"LineUnitPrice", |
|
405 | - // 'fd.tva_tx'=>"LineVATRate", |
|
406 | - // 'fd.qty'=>"LineQty", |
|
407 | - // 'fd.total_ht'=>"LineTotalHT", |
|
408 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
409 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
410 | - // 'fd.date_start'=>"DateStart", |
|
411 | - // 'fd.date_end'=>"DateEnd", |
|
412 | - // 'fd.fk_product'=>'ProductId', |
|
413 | - // 'p.ref'=>'ProductRef' |
|
414 | - //); |
|
415 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
416 | - // 's.nom'=>'company', |
|
417 | - // 's.address'=>'company', |
|
418 | - // 's.cp'=>'company', |
|
419 | - // 's.ville'=>'company', |
|
420 | - // 's.fk_pays'=>'company', |
|
421 | - // 's.tel'=>'company', |
|
422 | - // 's.siren'=>'company', |
|
423 | - // 's.siret'=>'company', |
|
424 | - // 's.ape'=>'company', |
|
425 | - // 's.idprof4'=>'company', |
|
426 | - // 's.code_compta'=>'company', |
|
427 | - // 's.code_compta_fournisseur'=>'company', |
|
428 | - // 'f.rowid'=>"invoice", |
|
429 | - // 'f.facnumber'=>"invoice", |
|
430 | - // 'f.datec'=>"invoice", |
|
431 | - // 'f.datef'=>"invoice", |
|
432 | - // 'f.total'=>"invoice", |
|
433 | - // 'f.total_ttc'=>"invoice", |
|
434 | - // 'f.tva'=>"invoice", |
|
435 | - // 'f.paye'=>"invoice", |
|
436 | - // 'f.fk_statut'=>'invoice', |
|
437 | - // 'f.note'=>"invoice", |
|
438 | - // 'fd.rowid'=>'invoice_line', |
|
439 | - // 'fd.description'=>"invoice_line", |
|
440 | - // 'fd.price'=>"invoice_line", |
|
441 | - // 'fd.total_ht'=>"invoice_line", |
|
442 | - // 'fd.total_tva'=>"invoice_line", |
|
443 | - // 'fd.total_ttc'=>"invoice_line", |
|
444 | - // 'fd.tva_tx'=>"invoice_line", |
|
445 | - // 'fd.qty'=>"invoice_line", |
|
446 | - // 'fd.date_start'=>"invoice_line", |
|
447 | - // 'fd.date_end'=>"invoice_line", |
|
448 | - // 'fd.fk_product'=>'product', |
|
449 | - // 'p.ref'=>'product' |
|
450 | - //); |
|
451 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
452 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
453 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
454 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
455 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
456 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
457 | - // . 'AND f.rowid = fd.fk_facture'; |
|
458 | - //$r++; |
|
459 | - } |
|
370 | + // Example: |
|
371 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
372 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
373 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
374 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
375 | + //// Set to 1 to always show when module is enabled. |
|
376 | + //$this->export_enabled[$r]='1'; |
|
377 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
378 | + //$this->export_fields_array[$r]=array( |
|
379 | + // 's.rowid'=>"IdCompany", |
|
380 | + // 's.nom'=>'CompanyName', |
|
381 | + // 's.address'=>'Address', |
|
382 | + // 's.cp'=>'Zip', |
|
383 | + // 's.ville'=>'Town', |
|
384 | + // 's.fk_pays'=>'Country', |
|
385 | + // 's.tel'=>'Phone', |
|
386 | + // 's.siren'=>'ProfId1', |
|
387 | + // 's.siret'=>'ProfId2', |
|
388 | + // 's.ape'=>'ProfId3', |
|
389 | + // 's.idprof4'=>'ProfId4', |
|
390 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
391 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
392 | + // 'f.rowid'=>"InvoiceId", |
|
393 | + // 'f.facnumber'=>"InvoiceRef", |
|
394 | + // 'f.datec'=>"InvoiceDateCreation", |
|
395 | + // 'f.datef'=>"DateInvoice", |
|
396 | + // 'f.total'=>"TotalHT", |
|
397 | + // 'f.total_ttc'=>"TotalTTC", |
|
398 | + // 'f.tva'=>"TotalVAT", |
|
399 | + // 'f.paye'=>"InvoicePaid", |
|
400 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
401 | + // 'f.note'=>"InvoiceNote", |
|
402 | + // 'fd.rowid'=>'LineId', |
|
403 | + // 'fd.description'=>"LineDescription", |
|
404 | + // 'fd.price'=>"LineUnitPrice", |
|
405 | + // 'fd.tva_tx'=>"LineVATRate", |
|
406 | + // 'fd.qty'=>"LineQty", |
|
407 | + // 'fd.total_ht'=>"LineTotalHT", |
|
408 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
409 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
410 | + // 'fd.date_start'=>"DateStart", |
|
411 | + // 'fd.date_end'=>"DateEnd", |
|
412 | + // 'fd.fk_product'=>'ProductId', |
|
413 | + // 'p.ref'=>'ProductRef' |
|
414 | + //); |
|
415 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
416 | + // 's.nom'=>'company', |
|
417 | + // 's.address'=>'company', |
|
418 | + // 's.cp'=>'company', |
|
419 | + // 's.ville'=>'company', |
|
420 | + // 's.fk_pays'=>'company', |
|
421 | + // 's.tel'=>'company', |
|
422 | + // 's.siren'=>'company', |
|
423 | + // 's.siret'=>'company', |
|
424 | + // 's.ape'=>'company', |
|
425 | + // 's.idprof4'=>'company', |
|
426 | + // 's.code_compta'=>'company', |
|
427 | + // 's.code_compta_fournisseur'=>'company', |
|
428 | + // 'f.rowid'=>"invoice", |
|
429 | + // 'f.facnumber'=>"invoice", |
|
430 | + // 'f.datec'=>"invoice", |
|
431 | + // 'f.datef'=>"invoice", |
|
432 | + // 'f.total'=>"invoice", |
|
433 | + // 'f.total_ttc'=>"invoice", |
|
434 | + // 'f.tva'=>"invoice", |
|
435 | + // 'f.paye'=>"invoice", |
|
436 | + // 'f.fk_statut'=>'invoice', |
|
437 | + // 'f.note'=>"invoice", |
|
438 | + // 'fd.rowid'=>'invoice_line', |
|
439 | + // 'fd.description'=>"invoice_line", |
|
440 | + // 'fd.price'=>"invoice_line", |
|
441 | + // 'fd.total_ht'=>"invoice_line", |
|
442 | + // 'fd.total_tva'=>"invoice_line", |
|
443 | + // 'fd.total_ttc'=>"invoice_line", |
|
444 | + // 'fd.tva_tx'=>"invoice_line", |
|
445 | + // 'fd.qty'=>"invoice_line", |
|
446 | + // 'fd.date_start'=>"invoice_line", |
|
447 | + // 'fd.date_end'=>"invoice_line", |
|
448 | + // 'fd.fk_product'=>'product', |
|
449 | + // 'p.ref'=>'product' |
|
450 | + //); |
|
451 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
452 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
453 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
454 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
455 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
456 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
457 | + // . 'AND f.rowid = fd.fk_facture'; |
|
458 | + //$r++; |
|
459 | + } |
|
460 | 460 | |
461 | - /** |
|
462 | - * Function called when module is enabled. |
|
463 | - * The init function add constants, boxes, permissions and menus |
|
464 | - * (defined in constructor) into Dolibarr database. |
|
465 | - * It also creates data directories |
|
466 | - * |
|
467 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
468 | - * @return int 1 if OK, 0 if KO |
|
469 | - */ |
|
470 | - public function init($options = '') |
|
471 | - { |
|
461 | + /** |
|
462 | + * Function called when module is enabled. |
|
463 | + * The init function add constants, boxes, permissions and menus |
|
464 | + * (defined in constructor) into Dolibarr database. |
|
465 | + * It also creates data directories |
|
466 | + * |
|
467 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
468 | + * @return int 1 if OK, 0 if KO |
|
469 | + */ |
|
470 | + public function init($options = '') |
|
471 | + { |
|
472 | 472 | global $conf, $db; |
473 | 473 | |
474 | 474 | |
@@ -476,46 +476,46 @@ discard block |
||
476 | 476 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
477 | 477 | } |
478 | 478 | */ |
479 | - $sql = array(); |
|
479 | + $sql = array(); |
|
480 | 480 | |
481 | - $result = $this->loadTables(); |
|
482 | - dol_include_once('/core/class/extrafields.class.php'); |
|
481 | + $result = $this->loadTables(); |
|
482 | + dol_include_once('/core/class/extrafields.class.php'); |
|
483 | 483 | |
484 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
485 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
486 | - foreach($TElementType as $element_type) { |
|
487 | - $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
488 | - $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
489 | - } |
|
484 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
485 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
486 | + foreach($TElementType as $element_type) { |
|
487 | + $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
488 | + $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
489 | + } |
|
490 | 490 | |
491 | - return $this->_init($sql, $options); |
|
492 | - } |
|
491 | + return $this->_init($sql, $options); |
|
492 | + } |
|
493 | 493 | |
494 | - /** |
|
495 | - * Function called when module is disabled. |
|
496 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
497 | - * Data directories are not deleted |
|
498 | - * |
|
499 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
500 | - * @return int 1 if OK, 0 if KO |
|
501 | - */ |
|
502 | - public function remove($options = '') |
|
503 | - { |
|
504 | - $sql = array(); |
|
494 | + /** |
|
495 | + * Function called when module is disabled. |
|
496 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
497 | + * Data directories are not deleted |
|
498 | + * |
|
499 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
500 | + * @return int 1 if OK, 0 if KO |
|
501 | + */ |
|
502 | + public function remove($options = '') |
|
503 | + { |
|
504 | + $sql = array(); |
|
505 | 505 | |
506 | - return $this->_remove($sql, $options); |
|
507 | - } |
|
506 | + return $this->_remove($sql, $options); |
|
507 | + } |
|
508 | 508 | |
509 | - /** |
|
510 | - * Create tables, keys and data required by module |
|
511 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
512 | - * and create data commands must be stored in directory /titre/sql/ |
|
513 | - * This function is called by this->init |
|
514 | - * |
|
515 | - * @return int <=0 if KO, >0 if OK |
|
516 | - */ |
|
517 | - private function loadTables() |
|
518 | - { |
|
519 | - return $this->_load_tables('/subtotal/sql/'); |
|
520 | - } |
|
509 | + /** |
|
510 | + * Create tables, keys and data required by module |
|
511 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
512 | + * and create data commands must be stored in directory /titre/sql/ |
|
513 | + * This function is called by this->init |
|
514 | + * |
|
515 | + * @return int <=0 if KO, >0 if OK |
|
516 | + */ |
|
517 | + private function loadTables() |
|
518 | + { |
|
519 | + return $this->_load_tables('/subtotal/sql/'); |
|
520 | + } |
|
521 | 521 | } |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | */ |
39 | 39 | class pdf_crabe_subtotal extends ModelePDFFactures |
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; |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | /** |
133 | - * Function to build pdf onto disk |
|
134 | - * |
|
135 | - * @param Object $object Object to generate |
|
136 | - * @param Translate $outputlangs Lang output object |
|
137 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
138 | - * @param int $hidedetails Do not show line details |
|
139 | - * @param int $hidedesc Do not show desc |
|
140 | - * @param int $hideref Do not show ref |
|
141 | - * @return int 1=OK, 0=KO |
|
133 | + * Function to build pdf onto disk |
|
134 | + * |
|
135 | + * @param Object $object Object to generate |
|
136 | + * @param Translate $outputlangs Lang output object |
|
137 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
138 | + * @param int $hidedetails Do not show line details |
|
139 | + * @param int $hidedesc Do not show desc |
|
140 | + * @param int $hideref Do not show ref |
|
141 | + * @return int 1=OK, 0=KO |
|
142 | 142 | */ |
143 | 143 | function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
144 | 144 | { |
@@ -230,25 +230,25 @@ discard block |
||
230 | 230 | |
231 | 231 | // Create pdf instance |
232 | 232 | $pdf=pdf_getInstance($this->format); |
233 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
233 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
234 | 234 | $heightforinfotot = 50; // Height reserved to output the info and total part |
235 | - $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 |
|
236 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
237 | - $pdf->SetAutoPageBreak(1,0); |
|
238 | - |
|
239 | - if (class_exists('TCPDF')) |
|
240 | - { |
|
241 | - $pdf->setPrintHeader(false); |
|
242 | - $pdf->setPrintFooter(false); |
|
243 | - } |
|
244 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
245 | - |
|
246 | - // Set path to the background PDF File |
|
247 | - if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
248 | - { |
|
249 | - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
250 | - $tplidx = $pdf->importPage(1); |
|
251 | - } |
|
235 | + $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 |
|
236 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
237 | + $pdf->SetAutoPageBreak(1,0); |
|
238 | + |
|
239 | + if (class_exists('TCPDF')) |
|
240 | + { |
|
241 | + $pdf->setPrintHeader(false); |
|
242 | + $pdf->setPrintFooter(false); |
|
243 | + } |
|
244 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
245 | + |
|
246 | + // Set path to the background PDF File |
|
247 | + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
248 | + { |
|
249 | + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
250 | + $tplidx = $pdf->importPage(1); |
|
251 | + } |
|
252 | 252 | |
253 | 253 | $pdf->Open(); |
254 | 254 | $pagenb=0; |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | // Discount on line |
539 | 539 | if ($object->lines[$i]->remise_percent) |
540 | 540 | { |
541 | - $pdf->SetXY($this->posxdiscount-2, $curY); |
|
542 | - $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
|
541 | + $pdf->SetXY($this->posxdiscount-2, $curY); |
|
542 | + $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); |
|
543 | 543 | $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); |
544 | 544 | } |
545 | 545 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $localtax2_type = $localtaxtmp_array[2]; |
578 | 578 | } |
579 | 579 | |
580 | - // retrieve global local tax |
|
580 | + // retrieve global local tax |
|
581 | 581 | if ($localtax1_type && $localtax1ligne != 0) |
582 | 582 | $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; |
583 | 583 | if ($localtax2_type && $localtax2ligne != 0) |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | } |
596 | 596 | else { |
597 | 597 | // standard |
598 | - if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne; |
|
598 | + if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne; |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; |
@@ -713,20 +713,20 @@ discard block |
||
713 | 713 | /** |
714 | 714 | * Show payments table |
715 | 715 | * |
716 | - * @param PDF $pdf Object PDF |
|
717 | - * @param Object $object Object invoice |
|
718 | - * @param int $posy Position y in PDF |
|
719 | - * @param Translate $outputlangs Object langs for output |
|
720 | - * @return int <0 if KO, >0 if OK |
|
716 | + * @param PDF $pdf Object PDF |
|
717 | + * @param Object $object Object invoice |
|
718 | + * @param int $posy Position y in PDF |
|
719 | + * @param Translate $outputlangs Object langs for output |
|
720 | + * @return int <0 if KO, >0 if OK |
|
721 | 721 | */ |
722 | 722 | function _tableau_versements(&$pdf, $object, $posy, $outputlangs) |
723 | 723 | { |
724 | 724 | global $conf; |
725 | 725 | |
726 | - $sign=1; |
|
727 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
726 | + $sign=1; |
|
727 | + if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
728 | 728 | |
729 | - $tab3_posx = 120; |
|
729 | + $tab3_posx = 120; |
|
730 | 730 | $tab3_top = $posy + 8; |
731 | 731 | $tab3_width = 80; |
732 | 732 | $tab3_height = 4; |
@@ -953,13 +953,13 @@ discard block |
||
953 | 953 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); |
954 | 954 | $posy=$pdf->GetY()+1; |
955 | 955 | |
956 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
957 | - { |
|
956 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
957 | + { |
|
958 | 958 | $pdf->SetXY($this->marge_gauche, $posy); |
959 | 959 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
960 | 960 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); |
961 | 961 | $posy=$pdf->GetY()+2; |
962 | - } |
|
962 | + } |
|
963 | 963 | } |
964 | 964 | if ($conf->global->FACTURE_CHQ_NUMBER == -1) |
965 | 965 | { |
@@ -968,13 +968,13 @@ discard block |
||
968 | 968 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); |
969 | 969 | $posy=$pdf->GetY()+1; |
970 | 970 | |
971 | - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
972 | - { |
|
971 | + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) |
|
972 | + { |
|
973 | 973 | $pdf->SetXY($this->marge_gauche, $posy); |
974 | 974 | $pdf->SetFont('','', $default_font_size - $diffsizetitle); |
975 | 975 | $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); |
976 | 976 | $posy=$pdf->GetY()+2; |
977 | - } |
|
977 | + } |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | } |
@@ -1016,10 +1016,10 @@ discard block |
||
1016 | 1016 | { |
1017 | 1017 | global $conf,$mysoc; |
1018 | 1018 | |
1019 | - $sign=1; |
|
1020 | - if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
1019 | + $sign=1; |
|
1020 | + if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; |
|
1021 | 1021 | |
1022 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
1022 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
1023 | 1023 | |
1024 | 1024 | $tab2_top = $posy; |
1025 | 1025 | $tab2_hl = 4; |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } |
1091 | - //} |
|
1091 | + //} |
|
1092 | 1092 | //Local tax 2 before VAT |
1093 | 1093 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1094 | 1094 | //{ |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | } |
1182 | 1182 | } |
1183 | - //} |
|
1183 | + //} |
|
1184 | 1184 | //Local tax 2 after VAT |
1185 | 1185 | //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') |
1186 | 1186 | //{ |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | |
1191 | 1191 | foreach( $localtax_rate as $tvakey => $tvaval ) |
1192 | 1192 | { |
1193 | - // retrieve global local tax |
|
1193 | + // retrieve global local tax |
|
1194 | 1194 | if ($tvakey != 0) // On affiche pas taux 0 |
1195 | 1195 | { |
1196 | 1196 | //$this->atleastoneratenotnull++; |
@@ -1424,15 +1424,15 @@ discard block |
||
1424 | 1424 | |
1425 | 1425 | // Show Draft Watermark |
1426 | 1426 | if($object->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) ) |
1427 | - { |
|
1428 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK); |
|
1429 | - } |
|
1427 | + { |
|
1428 | + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FACTURE_DRAFT_WATERMARK); |
|
1429 | + } |
|
1430 | 1430 | |
1431 | 1431 | $pdf->SetTextColor(0,0,60); |
1432 | 1432 | $pdf->SetFont('','B', $default_font_size + 3); |
1433 | 1433 | |
1434 | 1434 | $posy=$this->marge_haute; |
1435 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
1435 | + $posx=$this->page_largeur-$this->marge_droite-100; |
|
1436 | 1436 | |
1437 | 1437 | $pdf->SetXY($this->marge_gauche,$posy); |
1438 | 1438 | |
@@ -1442,7 +1442,7 @@ discard block |
||
1442 | 1442 | { |
1443 | 1443 | if (is_readable($logo)) |
1444 | 1444 | { |
1445 | - $height=pdf_getHeightForLogo($logo); |
|
1445 | + $height=pdf_getHeightForLogo($logo); |
|
1446 | 1446 | $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
1447 | 1447 | } |
1448 | 1448 | else |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | |
1634 | 1634 | /** |
1635 | 1635 | * Show footer of page. Need this->emetteur object |
1636 | - * |
|
1636 | + * |
|
1637 | 1637 | * @param PDF $pdf PDF |
1638 | 1638 | * @param Object $object Object to show |
1639 | 1639 | * @param Translate $outputlangs Object lang for output |
@@ -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) |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | else { |
543 | 543 | // standard |
544 | - if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne; |
|
544 | + if(!empty($tvaligne)) $this->tva[$vatrate] += $tvaligne; |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | // Add line |
@@ -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 |