@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | */ |
34 | 34 | class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal |
35 | 35 | { |
36 | - /** |
|
36 | + /** |
|
37 | 37 | * Dolibarr version of the loaded document |
38 | 38 | * @public string |
39 | 39 | */ |
40 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
40 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
41 | 41 | |
42 | - /** |
|
42 | + /** |
|
43 | 43 | * @var string Error code (or message) |
44 | 44 | */ |
45 | 45 | public $error = ''; |
46 | 46 | |
47 | - /** |
|
48 | - * @var string Nom du modele |
|
49 | - * @deprecated |
|
50 | - * @see name |
|
51 | - */ |
|
52 | - public $nom='Saphir'; |
|
47 | + /** |
|
48 | + * @var string Nom du modele |
|
49 | + * @deprecated |
|
50 | + * @see name |
|
51 | + */ |
|
52 | + public $nom='Saphir'; |
|
53 | 53 | |
54 | - /** |
|
55 | - * @var string model name |
|
56 | - */ |
|
57 | - public $name='Saphir'; |
|
54 | + /** |
|
55 | + * @var string model name |
|
56 | + */ |
|
57 | + public $name='Saphir'; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -62,39 +62,39 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Texte descripif |
64 | 64 | */ |
65 | - function info() |
|
65 | + function info() |
|
66 | 66 | { |
67 | - global $conf, $langs; |
|
67 | + global $conf, $langs; |
|
68 | 68 | |
69 | - $langs->load("bills"); |
|
69 | + $langs->load("bills"); |
|
70 | 70 | |
71 | - $form = new Form($this->db); |
|
71 | + $form = new Form($this->db); |
|
72 | 72 | |
73 | - $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
74 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | - $texte.= '<input type="hidden" name="maskconstsupplier_proposal" value="SUPPLIER_PROPOSAL_SAPHIR_MASK">'; |
|
78 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
73 | + $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
74 | + $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | + $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | + $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | + $texte.= '<input type="hidden" name="maskconstsupplier_proposal" value="SUPPLIER_PROPOSAL_SAPHIR_MASK">'; |
|
78 | + $texte.= '<table class="nobordernopadding" width="100%">'; |
|
79 | 79 | |
80 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
83 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
84 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
80 | + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
81 | + $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
82 | + $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
83 | + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
84 | + $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
85 | 85 | |
86 | - // Parametrage du prefix |
|
87 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplier_proposal" value="'.$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK.'">',$tooltip,1,1).'</td>'; |
|
86 | + // Parametrage du prefix |
|
87 | + $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | + $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplier_proposal" value="'.$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK.'">',$tooltip,1,1).'</td>'; |
|
89 | 89 | |
90 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
90 | + $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
91 | 91 | |
92 | - $texte.= '</tr>'; |
|
92 | + $texte.= '</tr>'; |
|
93 | 93 | |
94 | - $texte.= '</table>'; |
|
95 | - $texte.= '</form>'; |
|
94 | + $texte.= '</table>'; |
|
95 | + $texte.= '</form>'; |
|
96 | 96 | |
97 | - return $texte; |
|
97 | + return $texte; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -104,46 +104,46 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function getExample() |
106 | 106 | { |
107 | - global $conf,$langs,$mysoc; |
|
108 | - |
|
109 | - $old_code_client=$mysoc->code_client; |
|
110 | - $mysoc->code_client='CCCCCCCCCC'; |
|
111 | - $numExample = $this->getNextValue($mysoc,''); |
|
112 | - $mysoc->code_client=$old_code_client; |
|
113 | - |
|
114 | - if (! $numExample) |
|
115 | - { |
|
116 | - $numExample = 'NotConfigured'; |
|
117 | - } |
|
118 | - return $numExample; |
|
107 | + global $conf,$langs,$mysoc; |
|
108 | + |
|
109 | + $old_code_client=$mysoc->code_client; |
|
110 | + $mysoc->code_client='CCCCCCCCCC'; |
|
111 | + $numExample = $this->getNextValue($mysoc,''); |
|
112 | + $mysoc->code_client=$old_code_client; |
|
113 | + |
|
114 | + if (! $numExample) |
|
115 | + { |
|
116 | + $numExample = 'NotConfigured'; |
|
117 | + } |
|
118 | + return $numExample; |
|
119 | 119 | } |
120 | 120 | |
121 | - /** |
|
122 | - * Return next value |
|
123 | - * |
|
124 | - * @param Societe $objsoc Object third party |
|
125 | - * @param Propal $supplier_proposal Object supplier_proposal |
|
126 | - * @return string Value if OK, 0 if KO |
|
127 | - */ |
|
128 | - function getNextValue($objsoc,$supplier_proposal) |
|
129 | - { |
|
130 | - global $db,$conf; |
|
131 | - |
|
132 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
133 | - |
|
134 | - // On defini critere recherche compteur |
|
135 | - $mask=$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; |
|
136 | - |
|
137 | - if (! $mask) |
|
138 | - { |
|
139 | - $this->error='NotConfigured'; |
|
140 | - return 0; |
|
141 | - } |
|
142 | - |
|
143 | - $date=$supplier_proposal->datep; |
|
144 | - $customercode=$objsoc->code_client; |
|
145 | - $numFinal=get_next_value($db,$mask,'supplier_proposal','ref','',$customercode,$date); |
|
146 | - |
|
147 | - return $numFinal; |
|
148 | - } |
|
121 | + /** |
|
122 | + * Return next value |
|
123 | + * |
|
124 | + * @param Societe $objsoc Object third party |
|
125 | + * @param Propal $supplier_proposal Object supplier_proposal |
|
126 | + * @return string Value if OK, 0 if KO |
|
127 | + */ |
|
128 | + function getNextValue($objsoc,$supplier_proposal) |
|
129 | + { |
|
130 | + global $db,$conf; |
|
131 | + |
|
132 | + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
133 | + |
|
134 | + // On defini critere recherche compteur |
|
135 | + $mask=$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; |
|
136 | + |
|
137 | + if (! $mask) |
|
138 | + { |
|
139 | + $this->error='NotConfigured'; |
|
140 | + return 0; |
|
141 | + } |
|
142 | + |
|
143 | + $date=$supplier_proposal->datep; |
|
144 | + $customercode=$objsoc->code_client; |
|
145 | + $numFinal=get_next_value($db,$mask,'supplier_proposal','ref','',$customercode,$date); |
|
146 | + |
|
147 | + return $numFinal; |
|
148 | + } |
|
149 | 149 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief File that contains the numbering module rules Saphir |
26 | 26 | */ |
27 | 27 | |
28 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_proposal/modules_supplier_proposal.php'; |
|
28 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_proposal/modules_supplier_proposal.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * Dolibarr version of the loaded document |
38 | 38 | * @public string |
39 | 39 | */ |
40 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
40 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var string Error code (or message) |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @deprecated |
50 | 50 | * @see name |
51 | 51 | */ |
52 | - public $nom='Saphir'; |
|
52 | + public $nom = 'Saphir'; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var string model name |
56 | 56 | */ |
57 | - public $name='Saphir'; |
|
57 | + public $name = 'Saphir'; |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -71,28 +71,28 @@ discard block |
||
71 | 71 | $form = new Form($this->db); |
72 | 72 | |
73 | 73 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
74 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | - $texte.= '<input type="hidden" name="maskconstsupplier_proposal" value="SUPPLIER_PROPOSAL_SAPHIR_MASK">'; |
|
78 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
79 | - |
|
80 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
83 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest")); |
|
84 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
74 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
75 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
76 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
77 | + $texte .= '<input type="hidden" name="maskconstsupplier_proposal" value="SUPPLIER_PROPOSAL_SAPHIR_MASK">'; |
|
78 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
79 | + |
|
80 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); |
|
81 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
82 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
83 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); |
|
84 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
85 | 85 | |
86 | 86 | // Parametrage du prefix |
87 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplier_proposal" value="'.$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK.'">',$tooltip,1,1).'</td>'; |
|
87 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
88 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplier_proposal" value="'.$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
89 | 89 | |
90 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
90 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
91 | 91 | |
92 | - $texte.= '</tr>'; |
|
92 | + $texte .= '</tr>'; |
|
93 | 93 | |
94 | - $texte.= '</table>'; |
|
95 | - $texte.= '</form>'; |
|
94 | + $texte .= '</table>'; |
|
95 | + $texte .= '</form>'; |
|
96 | 96 | |
97 | 97 | return $texte; |
98 | 98 | } |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | */ |
105 | 105 | function getExample() |
106 | 106 | { |
107 | - global $conf,$langs,$mysoc; |
|
107 | + global $conf, $langs, $mysoc; |
|
108 | 108 | |
109 | - $old_code_client=$mysoc->code_client; |
|
110 | - $mysoc->code_client='CCCCCCCCCC'; |
|
111 | - $numExample = $this->getNextValue($mysoc,''); |
|
112 | - $mysoc->code_client=$old_code_client; |
|
109 | + $old_code_client = $mysoc->code_client; |
|
110 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
111 | + $numExample = $this->getNextValue($mysoc, ''); |
|
112 | + $mysoc->code_client = $old_code_client; |
|
113 | 113 | |
114 | - if (! $numExample) |
|
114 | + if (!$numExample) |
|
115 | 115 | { |
116 | 116 | $numExample = 'NotConfigured'; |
117 | 117 | } |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param Propal $supplier_proposal Object supplier_proposal |
126 | 126 | * @return string Value if OK, 0 if KO |
127 | 127 | */ |
128 | - function getNextValue($objsoc,$supplier_proposal) |
|
128 | + function getNextValue($objsoc, $supplier_proposal) |
|
129 | 129 | { |
130 | - global $db,$conf; |
|
130 | + global $db, $conf; |
|
131 | 131 | |
132 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
132 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
133 | 133 | |
134 | 134 | // On defini critere recherche compteur |
135 | - $mask=$conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; |
|
135 | + $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; |
|
136 | 136 | |
137 | - if (! $mask) |
|
137 | + if (!$mask) |
|
138 | 138 | { |
139 | - $this->error='NotConfigured'; |
|
139 | + $this->error = 'NotConfigured'; |
|
140 | 140 | return 0; |
141 | 141 | } |
142 | 142 | |
143 | - $date=$supplier_proposal->datep; |
|
144 | - $customercode=$objsoc->code_client; |
|
145 | - $numFinal=get_next_value($db,$mask,'supplier_proposal','ref','',$customercode,$date); |
|
143 | + $date = $supplier_proposal->datep; |
|
144 | + $customercode = $objsoc->code_client; |
|
145 | + $numFinal = get_next_value($db, $mask, 'supplier_proposal', 'ref', '', $customercode, $date); |
|
146 | 146 | |
147 | 147 | return $numFinal; |
148 | 148 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | abstract class ModelePDFSupplierProposal extends CommonDocGenerator |
38 | 38 | { |
39 | - /** |
|
40 | - * @var string Error code (or message) |
|
41 | - */ |
|
42 | - public $error=''; |
|
39 | + /** |
|
40 | + * @var string Error code (or message) |
|
41 | + */ |
|
42 | + public $error=''; |
|
43 | 43 | |
44 | 44 | |
45 | 45 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -49,20 +49,20 @@ discard block |
||
49 | 49 | * @param DoliDB $db Database handler |
50 | 50 | * @param integer $maxfilenamelength Max length of value to show |
51 | 51 | * @return array List of templates |
52 | - */ |
|
53 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
54 | - { |
|
52 | + */ |
|
53 | + static function liste_modeles($db,$maxfilenamelength=0) |
|
54 | + { |
|
55 | 55 | // phpcs:enable |
56 | - global $conf; |
|
56 | + global $conf; |
|
57 | 57 | |
58 | - $type='supplier_proposal'; |
|
59 | - $liste=array(); |
|
58 | + $type='supplier_proposal'; |
|
59 | + $liste=array(); |
|
60 | 60 | |
61 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
62 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
61 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
62 | + $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
63 | 63 | |
64 | - return $liste; |
|
65 | - } |
|
64 | + return $liste; |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -71,83 +71,83 @@ discard block |
||
71 | 71 | */ |
72 | 72 | abstract class ModeleNumRefSupplierProposal |
73 | 73 | { |
74 | - /** |
|
75 | - * @var string Error code (or message) |
|
76 | - */ |
|
77 | - public $error=''; |
|
78 | - |
|
79 | - /** |
|
80 | - * Return if a module can be used or not |
|
81 | - * |
|
82 | - * @return boolean true if module can be used |
|
83 | - */ |
|
84 | - function isEnabled() |
|
85 | - { |
|
86 | - return true; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * Renvoi la description par defaut du modele de numerotation |
|
91 | - * |
|
92 | - * @return string Texte descripif |
|
93 | - */ |
|
94 | - function info() |
|
95 | - { |
|
96 | - global $langs; |
|
97 | - $langs->load("supplier_proposal"); |
|
98 | - return $langs->trans("NoDescription"); |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Renvoi un exemple de numerotation |
|
103 | - * |
|
104 | - * @return string Example |
|
105 | - */ |
|
106 | - function getExample() |
|
107 | - { |
|
108 | - global $langs; |
|
109 | - $langs->load("supplier_proposal"); |
|
110 | - return $langs->trans("NoExample"); |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
115 | - * de conflits qui empechera cette numerotation de fonctionner. |
|
116 | - * |
|
117 | - * @return boolean false si conflit, true si ok |
|
118 | - */ |
|
119 | - function canBeActivated() |
|
120 | - { |
|
121 | - return true; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Renvoi prochaine valeur attribuee |
|
126 | - * |
|
127 | - * @param Societe $objsoc Object third party |
|
128 | - * @param Propal $propal Object commercial proposal |
|
129 | - * @return string Valeur |
|
130 | - */ |
|
131 | - function getNextValue($objsoc,$propal) |
|
132 | - { |
|
133 | - global $langs; |
|
134 | - return $langs->trans("NotAvailable"); |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Renvoi version du module numerotation |
|
139 | - * |
|
140 | - * @return string Valeur |
|
141 | - */ |
|
142 | - function getVersion() |
|
143 | - { |
|
144 | - global $langs; |
|
145 | - $langs->load("admin"); |
|
146 | - |
|
147 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
148 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
149 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
150 | - if ($this->version) return $this->version; |
|
151 | - return $langs->trans("NotAvailable"); |
|
152 | - } |
|
74 | + /** |
|
75 | + * @var string Error code (or message) |
|
76 | + */ |
|
77 | + public $error=''; |
|
78 | + |
|
79 | + /** |
|
80 | + * Return if a module can be used or not |
|
81 | + * |
|
82 | + * @return boolean true if module can be used |
|
83 | + */ |
|
84 | + function isEnabled() |
|
85 | + { |
|
86 | + return true; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * Renvoi la description par defaut du modele de numerotation |
|
91 | + * |
|
92 | + * @return string Texte descripif |
|
93 | + */ |
|
94 | + function info() |
|
95 | + { |
|
96 | + global $langs; |
|
97 | + $langs->load("supplier_proposal"); |
|
98 | + return $langs->trans("NoDescription"); |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Renvoi un exemple de numerotation |
|
103 | + * |
|
104 | + * @return string Example |
|
105 | + */ |
|
106 | + function getExample() |
|
107 | + { |
|
108 | + global $langs; |
|
109 | + $langs->load("supplier_proposal"); |
|
110 | + return $langs->trans("NoExample"); |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
115 | + * de conflits qui empechera cette numerotation de fonctionner. |
|
116 | + * |
|
117 | + * @return boolean false si conflit, true si ok |
|
118 | + */ |
|
119 | + function canBeActivated() |
|
120 | + { |
|
121 | + return true; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Renvoi prochaine valeur attribuee |
|
126 | + * |
|
127 | + * @param Societe $objsoc Object third party |
|
128 | + * @param Propal $propal Object commercial proposal |
|
129 | + * @return string Valeur |
|
130 | + */ |
|
131 | + function getNextValue($objsoc,$propal) |
|
132 | + { |
|
133 | + global $langs; |
|
134 | + return $langs->trans("NotAvailable"); |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Renvoi version du module numerotation |
|
139 | + * |
|
140 | + * @return string Valeur |
|
141 | + */ |
|
142 | + function getVersion() |
|
143 | + { |
|
144 | + global $langs; |
|
145 | + $langs->load("admin"); |
|
146 | + |
|
147 | + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
148 | + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
149 | + if ($this->version == 'dolibarr') return DOL_VERSION; |
|
150 | + if ($this->version) return $this->version; |
|
151 | + return $langs->trans("NotAvailable"); |
|
152 | + } |
|
153 | 153 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
31 | -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent |
|
31 | +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @var string Error code (or message) |
41 | 41 | */ |
42 | - public $error=''; |
|
42 | + public $error = ''; |
|
43 | 43 | |
44 | 44 | |
45 | 45 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | * @param integer $maxfilenamelength Max length of value to show |
51 | 51 | * @return array List of templates |
52 | 52 | */ |
53 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
53 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
54 | 54 | { |
55 | 55 | // phpcs:enable |
56 | 56 | global $conf; |
57 | 57 | |
58 | - $type='supplier_proposal'; |
|
59 | - $liste=array(); |
|
58 | + $type = 'supplier_proposal'; |
|
59 | + $liste = array(); |
|
60 | 60 | |
61 | 61 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
62 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
62 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
63 | 63 | |
64 | 64 | return $liste; |
65 | 65 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | /** |
75 | 75 | * @var string Error code (or message) |
76 | 76 | */ |
77 | - public $error=''; |
|
77 | + public $error = ''; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Return if a module can be used or not |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param Propal $propal Object commercial proposal |
129 | 129 | * @return string Valeur |
130 | 130 | */ |
131 | - function getNextValue($objsoc,$propal) |
|
131 | + function getNextValue($objsoc, $propal) |
|
132 | 132 | { |
133 | 133 | global $langs; |
134 | 134 | return $langs->trans("NotAvailable"); |
@@ -142,10 +142,18 @@ |
||
142 | 142 | global $langs; |
143 | 143 | $langs->load("admin"); |
144 | 144 | |
145 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
146 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
147 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
148 | - if ($this->version) return $this->version; |
|
145 | + if ($this->version == 'development') { |
|
146 | + return $langs->trans("VersionDevelopment"); |
|
147 | + } |
|
148 | + if ($this->version == 'experimental') { |
|
149 | + return $langs->trans("VersionExperimental"); |
|
150 | + } |
|
151 | + if ($this->version == 'dolibarr') { |
|
152 | + return DOL_VERSION; |
|
153 | + } |
|
154 | + if ($this->version) { |
|
155 | + return $this->version; |
|
156 | + } |
|
149 | 157 | return $langs->trans("NotAvailable"); |
150 | 158 | } |
151 | 159 | } |
@@ -32,73 +32,73 @@ |
||
32 | 32 | class modSyslog extends DolibarrModules |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
36 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | - * |
|
38 | - * @param DoliDB $db Database handler |
|
39 | - */ |
|
40 | - function __construct($db) |
|
41 | - { |
|
42 | - $this->db = $db; |
|
43 | - $this->numero = 42; |
|
35 | + /** |
|
36 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | + * |
|
38 | + * @param DoliDB $db Database handler |
|
39 | + */ |
|
40 | + function __construct($db) |
|
41 | + { |
|
42 | + $this->db = $db; |
|
43 | + $this->numero = 42; |
|
44 | 44 | |
45 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
46 | - // It is used to group modules in module setup page |
|
47 | - $this->family = "base"; |
|
48 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
49 | - $this->module_position = '50'; |
|
50 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | - // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
53 | - $this->description = "Activate debug logs (syslog)"; |
|
54 | - // Can be enabled / disabled only in the main company |
|
55 | - $this->core_enabled = 1; |
|
56 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | - $this->version = 'dolibarr'; |
|
58 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
59 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | - // Name of image file used for this module. |
|
61 | - $this->picto='technic'; |
|
45 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
46 | + // It is used to group modules in module setup page |
|
47 | + $this->family = "base"; |
|
48 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
49 | + $this->module_position = '50'; |
|
50 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
51 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
53 | + $this->description = "Activate debug logs (syslog)"; |
|
54 | + // Can be enabled / disabled only in the main company |
|
55 | + $this->core_enabled = 1; |
|
56 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | + $this->version = 'dolibarr'; |
|
58 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
59 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
60 | + // Name of image file used for this module. |
|
61 | + $this->picto='technic'; |
|
62 | 62 | |
63 | - // Data directories to create when module is enabled |
|
64 | - $this->dirs = array(); |
|
63 | + // Data directories to create when module is enabled |
|
64 | + $this->dirs = array(); |
|
65 | 65 | |
66 | - // Config pages |
|
67 | - $this->config_page_url = array("syslog.php"); |
|
66 | + // Config pages |
|
67 | + $this->config_page_url = array("syslog.php"); |
|
68 | 68 | |
69 | - // Dependencies |
|
70 | - $this->hidden = false; // A condition to hide module |
|
71 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
72 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
73 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
74 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
69 | + // Dependencies |
|
70 | + $this->hidden = false; // A condition to hide module |
|
71 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
72 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
73 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
74 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
75 | 75 | |
76 | - // Constants |
|
77 | - $this->const = array(); |
|
76 | + // Constants |
|
77 | + $this->const = array(); |
|
78 | 78 | |
79 | - // Boxes |
|
80 | - $this->boxes = array(); |
|
79 | + // Boxes |
|
80 | + $this->boxes = array(); |
|
81 | 81 | |
82 | - // Permissions |
|
83 | - $this->rights = array(); |
|
84 | - $this->rights_class = 'syslog'; |
|
82 | + // Permissions |
|
83 | + $this->rights = array(); |
|
84 | + $this->rights_class = 'syslog'; |
|
85 | 85 | |
86 | - // Cronjobs |
|
87 | - $this->cronjobs = array( |
|
88 | - 0 => array( |
|
89 | - 'label' => 'CompressSyslogs', |
|
90 | - 'jobtype' => 'method', |
|
91 | - 'class' => 'core/class/utils.class.php', |
|
92 | - 'objectname' => 'Utils', |
|
93 | - 'method' => 'compressSyslogs', |
|
94 | - 'parameters' => '', |
|
95 | - 'comment' => 'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', |
|
96 | - 'frequency' => 1, |
|
97 | - 'unitfrequency' => 3600 * 24, |
|
98 | - 'priority' => 50, |
|
99 | - 'status' => 0, |
|
100 | - 'test' => true |
|
101 | - ) |
|
102 | - ); |
|
103 | - } |
|
86 | + // Cronjobs |
|
87 | + $this->cronjobs = array( |
|
88 | + 0 => array( |
|
89 | + 'label' => 'CompressSyslogs', |
|
90 | + 'jobtype' => 'method', |
|
91 | + 'class' => 'core/class/utils.class.php', |
|
92 | + 'objectname' => 'Utils', |
|
93 | + 'method' => 'compressSyslogs', |
|
94 | + 'parameters' => '', |
|
95 | + 'comment' => 'Compress and archive log files. Warning: batch must be run with same account than your web server to avoid to get log files with different owner than required by web server. Another solution is to set web server Operating System group as the group of directory documents and set GROUP permission "rws" on this directory so log files will always have the group and permissions of the web server Operating System group', |
|
96 | + 'frequency' => 1, |
|
97 | + 'unitfrequency' => 3600 * 24, |
|
98 | + 'priority' => 50, |
|
99 | + 'status' => 0, |
|
100 | + 'test' => true |
|
101 | + ) |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Fichier de description et activation du module de syslog |
25 | 25 | */ |
26 | 26 | |
27 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
27 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Class to enable/disable module Logs |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | // Module position in the family on 2 digits ('01', '10', '20', ...) |
49 | 49 | $this->module_position = '50'; |
50 | 50 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
51 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
52 | 52 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
53 | 53 | $this->description = "Activate debug logs (syslog)"; |
54 | 54 | // Can be enabled / disabled only in the main company |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | // Name of image file used for this module. |
61 | - $this->picto='technic'; |
|
61 | + $this->picto = 'technic'; |
|
62 | 62 | |
63 | 63 | // Data directories to create when module is enabled |
64 | 64 | $this->dirs = array(); |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | $this->config_page_url = array("syslog.php"); |
68 | 68 | |
69 | 69 | // Dependencies |
70 | - $this->hidden = false; // A condition to hide module |
|
71 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
72 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
73 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
74 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | + $this->hidden = false; // A condition to hide module |
|
71 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
72 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
73 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
74 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
75 | 75 | |
76 | 76 | // Constants |
77 | 77 | $this->const = array(); |
@@ -38,465 +38,465 @@ discard block |
||
38 | 38 | */ |
39 | 39 | class pdf_soleil extends ModelePDFFicheinter |
40 | 40 | { |
41 | - /** |
|
42 | - * @var DoliDb Database handler |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var DoliDb Database handler |
|
43 | + */ |
|
44 | 44 | public $db; |
45 | 45 | |
46 | - /** |
|
46 | + /** |
|
47 | 47 | * @var string model name |
48 | 48 | */ |
49 | 49 | public $name; |
50 | 50 | |
51 | - /** |
|
51 | + /** |
|
52 | 52 | * @var string model description (short text) |
53 | 53 | */ |
54 | 54 | public $description; |
55 | 55 | |
56 | - /** |
|
56 | + /** |
|
57 | 57 | * @var string document type |
58 | 58 | */ |
59 | 59 | public $type; |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @var array() Minimum version of PHP required by module. |
63 | - * e.g.: PHP ≥ 5.4 = array(5, 4) |
|
63 | + * e.g.: PHP ≥ 5.4 = array(5, 4) |
|
64 | 64 | */ |
65 | - public $phpmin = array(5, 4); |
|
65 | + public $phpmin = array(5, 4); |
|
66 | 66 | |
67 | - /** |
|
67 | + /** |
|
68 | 68 | * Dolibarr version of the loaded document |
69 | 69 | * @public string |
70 | 70 | */ |
71 | - public $version = 'dolibarr'; |
|
71 | + public $version = 'dolibarr'; |
|
72 | 72 | |
73 | - /** |
|
73 | + /** |
|
74 | 74 | * @var int page_largeur |
75 | 75 | */ |
76 | 76 | public $page_largeur; |
77 | 77 | |
78 | - /** |
|
78 | + /** |
|
79 | 79 | * @var int page_hauteur |
80 | 80 | */ |
81 | 81 | public $page_hauteur; |
82 | 82 | |
83 | - /** |
|
83 | + /** |
|
84 | 84 | * @var array format |
85 | 85 | */ |
86 | 86 | public $format; |
87 | 87 | |
88 | - /** |
|
88 | + /** |
|
89 | 89 | * @var int marge_gauche |
90 | 90 | */ |
91 | - public $marge_gauche; |
|
91 | + public $marge_gauche; |
|
92 | 92 | |
93 | - /** |
|
93 | + /** |
|
94 | 94 | * @var int marge_droite |
95 | 95 | */ |
96 | - public $marge_droite; |
|
96 | + public $marge_droite; |
|
97 | 97 | |
98 | - /** |
|
98 | + /** |
|
99 | 99 | * @var int marge_haute |
100 | 100 | */ |
101 | - public $marge_haute; |
|
101 | + public $marge_haute; |
|
102 | 102 | |
103 | - /** |
|
103 | + /** |
|
104 | 104 | * @var int marge_basse |
105 | 105 | */ |
106 | - public $marge_basse; |
|
107 | - |
|
108 | - /** |
|
109 | - * Issuer |
|
110 | - * @var Company object that emits |
|
111 | - */ |
|
112 | - public $emetteur; |
|
113 | - |
|
114 | - /** |
|
115 | - * Constructor |
|
116 | - * |
|
117 | - * @param DoliDB $db Database handler |
|
118 | - */ |
|
119 | - function __construct($db) |
|
120 | - { |
|
121 | - global $conf,$langs,$mysoc; |
|
122 | - |
|
123 | - $this->db = $db; |
|
124 | - $this->name = 'soleil'; |
|
125 | - $this->description = $langs->trans("DocumentModelStandardPDF"); |
|
126 | - |
|
127 | - // Dimension page pour format A4 |
|
128 | - $this->type = 'pdf'; |
|
129 | - $formatarray=pdf_getFormat(); |
|
130 | - $this->page_largeur = $formatarray['width']; |
|
131 | - $this->page_hauteur = $formatarray['height']; |
|
132 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
133 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
134 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
135 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
136 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
137 | - |
|
138 | - $this->option_logo = 1; // Affiche logo |
|
139 | - $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION |
|
140 | - $this->option_modereg = 0; // Affiche mode reglement |
|
141 | - $this->option_condreg = 0; // Affiche conditions reglement |
|
142 | - $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
143 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
144 | - $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
145 | - |
|
146 | - // Get source company |
|
147 | - $this->emetteur=$mysoc; |
|
148 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined |
|
149 | - |
|
150 | - // Define position of columns |
|
151 | - $this->posxdesc=$this->marge_gauche+1; |
|
152 | - } |
|
153 | - |
|
154 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
|
155 | - /** |
|
156 | - * Function to build pdf onto disk |
|
157 | - * |
|
158 | - * @param Object $object Object to generate |
|
159 | - * @param Translate $outputlangs Lang output object |
|
160 | - * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
161 | - * @param int $hidedetails Do not show line details |
|
162 | - * @param int $hidedesc Do not show desc |
|
163 | - * @param int $hideref Do not show ref |
|
164 | - * @return int 1=OK, 0=KO |
|
165 | - */ |
|
166 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
167 | - { |
|
168 | - // phpcs:enable |
|
169 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
106 | + public $marge_basse; |
|
170 | 107 | |
171 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
172 | - // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
|
173 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
108 | + /** |
|
109 | + * Issuer |
|
110 | + * @var Company object that emits |
|
111 | + */ |
|
112 | + public $emetteur; |
|
174 | 113 | |
175 | - // Load traductions files requiredby by page |
|
176 | - $outputlangs->loadLangs(array("main", "interventions", "dict", "companies")); |
|
114 | + /** |
|
115 | + * Constructor |
|
116 | + * |
|
117 | + * @param DoliDB $db Database handler |
|
118 | + */ |
|
119 | + function __construct($db) |
|
120 | + { |
|
121 | + global $conf,$langs,$mysoc; |
|
122 | + |
|
123 | + $this->db = $db; |
|
124 | + $this->name = 'soleil'; |
|
125 | + $this->description = $langs->trans("DocumentModelStandardPDF"); |
|
126 | + |
|
127 | + // Dimension page pour format A4 |
|
128 | + $this->type = 'pdf'; |
|
129 | + $formatarray=pdf_getFormat(); |
|
130 | + $this->page_largeur = $formatarray['width']; |
|
131 | + $this->page_hauteur = $formatarray['height']; |
|
132 | + $this->format = array($this->page_largeur,$this->page_hauteur); |
|
133 | + $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
134 | + $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
135 | + $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
136 | + $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
137 | + |
|
138 | + $this->option_logo = 1; // Affiche logo |
|
139 | + $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION |
|
140 | + $this->option_modereg = 0; // Affiche mode reglement |
|
141 | + $this->option_condreg = 0; // Affiche conditions reglement |
|
142 | + $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
143 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
144 | + $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
145 | + |
|
146 | + // Get source company |
|
147 | + $this->emetteur=$mysoc; |
|
148 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined |
|
149 | + |
|
150 | + // Define position of columns |
|
151 | + $this->posxdesc=$this->marge_gauche+1; |
|
152 | + } |
|
177 | 153 | |
178 | - if ($conf->ficheinter->dir_output) |
|
179 | - { |
|
180 | - $object->fetch_thirdparty(); |
|
181 | - |
|
182 | - // Definition of $dir and $file |
|
183 | - if ($object->specimen) |
|
184 | - { |
|
185 | - $dir = $conf->ficheinter->dir_output; |
|
186 | - $file = $dir . "/SPECIMEN.pdf"; |
|
187 | - } |
|
188 | - else |
|
189 | - { |
|
190 | - $objectref = dol_sanitizeFileName($object->ref); |
|
191 | - $dir = $conf->ficheinter->dir_output . "/" . $objectref; |
|
192 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
193 | - } |
|
194 | - |
|
195 | - if (! file_exists($dir)) |
|
196 | - { |
|
197 | - if (dol_mkdir($dir) < 0) |
|
198 | - { |
|
199 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
200 | - return 0; |
|
201 | - } |
|
202 | - } |
|
203 | - |
|
204 | - if (file_exists($dir)) |
|
205 | - { |
|
206 | - // Add pdfgeneration hook |
|
207 | - if (! is_object($hookmanager)) |
|
208 | - { |
|
209 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
210 | - $hookmanager=new HookManager($this->db); |
|
211 | - } |
|
212 | - |
|
213 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
214 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
215 | - global $action; |
|
216 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
217 | - |
|
218 | - $nblignes = count($object->lines); |
|
219 | - |
|
220 | - // Create pdf instance |
|
221 | - $pdf=pdf_getInstance($this->format); |
|
222 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
223 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
224 | - $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 |
|
225 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
226 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
227 | - $pdf->SetAutoPageBreak(1,0); |
|
228 | - |
|
229 | - if (class_exists('TCPDF')) |
|
230 | - { |
|
231 | - $pdf->setPrintHeader(false); |
|
232 | - $pdf->setPrintFooter(false); |
|
233 | - } |
|
234 | - $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
235 | - // Set path to the background PDF File |
|
236 | - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
237 | - { |
|
238 | - $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
239 | - $tplidx = $pdf->importPage(1); |
|
240 | - } |
|
241 | - |
|
242 | - $pdf->Open(); |
|
243 | - $pagenb=0; |
|
244 | - $pdf->SetDrawColor(128,128,128); |
|
245 | - |
|
246 | - $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
|
247 | - $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); |
|
248 | - $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
249 | - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
250 | - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); |
|
251 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
252 | - |
|
253 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
254 | - |
|
255 | - // New page |
|
256 | - $pdf->AddPage(); |
|
257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
258 | - $pagenb++; |
|
259 | - $this->_pagehead($pdf, $object, 1, $outputlangs); |
|
260 | - $pdf->SetFont('','', $default_font_size - 1); |
|
261 | - $pdf->SetTextColor(0,0,0); |
|
262 | - |
|
263 | - $tab_top = 90; |
|
264 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
265 | - $tab_height = 130; |
|
266 | - $tab_height_newpage = 150; |
|
267 | - |
|
268 | - // Affiche notes |
|
269 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
270 | - if ($notetoshow) |
|
271 | - { |
|
272 | - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
273 | - complete_substitutions_array($substitutionarray, $outputlangs, $object); |
|
274 | - $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
|
275 | - |
|
276 | - $tab_top = 88; |
|
277 | - |
|
278 | - $pdf->SetFont('','', $default_font_size - 1); |
|
279 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
280 | - $nexY = $pdf->GetY(); |
|
281 | - $height_note=$nexY-$tab_top; |
|
282 | - |
|
283 | - // Rect prend une longueur en 3eme param |
|
284 | - $pdf->SetDrawColor(192,192,192); |
|
285 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
286 | - |
|
287 | - $tab_height = $tab_height - $height_note; |
|
288 | - $tab_top = $nexY+6; |
|
289 | - } |
|
290 | - else |
|
291 | - { |
|
292 | - $height_note=0; |
|
293 | - } |
|
294 | - |
|
295 | - $iniY = $tab_top + 7; |
|
296 | - $curY = $tab_top + 7; |
|
297 | - $nexY = $tab_top + 7; |
|
298 | - |
|
299 | - $pdf->SetXY($this->marge_gauche, $tab_top); |
|
300 | - $pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0); |
|
301 | - $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5); |
|
302 | - |
|
303 | - $pdf->SetFont('', '', $default_font_size - 1); |
|
304 | - |
|
305 | - $pdf->SetXY($this->marge_gauche, $tab_top + 5); |
|
306 | - $text=$object->description; |
|
307 | - if ($object->duration > 0) |
|
308 | - { |
|
309 | - $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); |
|
310 | - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; |
|
311 | - } |
|
312 | - $desc=dol_htmlentitiesbr($text,1); |
|
313 | - //print $outputlangs->convToOutputCharset($desc); exit; |
|
314 | - |
|
315 | - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); |
|
316 | - $nexY = $pdf->GetY(); |
|
317 | - |
|
318 | - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); |
|
319 | - |
|
320 | - $nblines = count($object->lines); |
|
321 | - |
|
322 | - // Loop on each lines |
|
323 | - for ($i = 0; $i < $nblines; $i++) |
|
324 | - { |
|
325 | - $objectligne = $object->lines[$i]; |
|
326 | - |
|
327 | - $valide = empty($objectligne->id) ? 0 : $objectligne->fetch($objectligne->id); |
|
328 | - if ($valide > 0 || $object->specimen) |
|
329 | - { |
|
330 | - $curY = $nexY; |
|
331 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
332 | - $pdf->SetTextColor(0,0,0); |
|
333 | - |
|
334 | - $pdf->setTopMargin($tab_top_newpage); |
|
335 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
336 | - $pageposbefore=$pdf->getPage(); |
|
337 | - |
|
338 | - // Description of product line |
|
339 | - $curX = $this->posxdesc-1; |
|
340 | - |
|
341 | - // Description of product line |
|
154 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
|
155 | + /** |
|
156 | + * Function to build pdf onto disk |
|
157 | + * |
|
158 | + * @param Object $object Object to generate |
|
159 | + * @param Translate $outputlangs Lang output object |
|
160 | + * @param string $srctemplatepath Full path of source filename for generator using a template file |
|
161 | + * @param int $hidedetails Do not show line details |
|
162 | + * @param int $hidedesc Do not show desc |
|
163 | + * @param int $hideref Do not show ref |
|
164 | + * @return int 1=OK, 0=KO |
|
165 | + */ |
|
166 | + function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
167 | + { |
|
168 | + // phpcs:enable |
|
169 | + global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
170 | + |
|
171 | + if (! is_object($outputlangs)) $outputlangs=$langs; |
|
172 | + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
|
173 | + if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
174 | + |
|
175 | + // Load traductions files requiredby by page |
|
176 | + $outputlangs->loadLangs(array("main", "interventions", "dict", "companies")); |
|
177 | + |
|
178 | + if ($conf->ficheinter->dir_output) |
|
179 | + { |
|
180 | + $object->fetch_thirdparty(); |
|
181 | + |
|
182 | + // Definition of $dir and $file |
|
183 | + if ($object->specimen) |
|
184 | + { |
|
185 | + $dir = $conf->ficheinter->dir_output; |
|
186 | + $file = $dir . "/SPECIMEN.pdf"; |
|
187 | + } |
|
188 | + else |
|
189 | + { |
|
190 | + $objectref = dol_sanitizeFileName($object->ref); |
|
191 | + $dir = $conf->ficheinter->dir_output . "/" . $objectref; |
|
192 | + $file = $dir . "/" . $objectref . ".pdf"; |
|
193 | + } |
|
194 | + |
|
195 | + if (! file_exists($dir)) |
|
196 | + { |
|
197 | + if (dol_mkdir($dir) < 0) |
|
198 | + { |
|
199 | + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
200 | + return 0; |
|
201 | + } |
|
202 | + } |
|
203 | + |
|
204 | + if (file_exists($dir)) |
|
205 | + { |
|
206 | + // Add pdfgeneration hook |
|
207 | + if (! is_object($hookmanager)) |
|
208 | + { |
|
209 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
210 | + $hookmanager=new HookManager($this->db); |
|
211 | + } |
|
212 | + |
|
213 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
214 | + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
215 | + global $action; |
|
216 | + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
217 | + |
|
218 | + $nblignes = count($object->lines); |
|
219 | + |
|
220 | + // Create pdf instance |
|
221 | + $pdf=pdf_getInstance($this->format); |
|
222 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
223 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
224 | + $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 |
|
225 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
226 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
227 | + $pdf->SetAutoPageBreak(1,0); |
|
228 | + |
|
229 | + if (class_exists('TCPDF')) |
|
230 | + { |
|
231 | + $pdf->setPrintHeader(false); |
|
232 | + $pdf->setPrintFooter(false); |
|
233 | + } |
|
234 | + $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
|
235 | + // Set path to the background PDF File |
|
236 | + if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
237 | + { |
|
238 | + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
|
239 | + $tplidx = $pdf->importPage(1); |
|
240 | + } |
|
241 | + |
|
242 | + $pdf->Open(); |
|
243 | + $pagenb=0; |
|
244 | + $pdf->SetDrawColor(128,128,128); |
|
245 | + |
|
246 | + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
|
247 | + $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); |
|
248 | + $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
249 | + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
250 | + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); |
|
251 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
252 | + |
|
253 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
254 | + |
|
255 | + // New page |
|
256 | + $pdf->AddPage(); |
|
257 | + if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
258 | + $pagenb++; |
|
259 | + $this->_pagehead($pdf, $object, 1, $outputlangs); |
|
260 | + $pdf->SetFont('','', $default_font_size - 1); |
|
261 | + $pdf->SetTextColor(0,0,0); |
|
262 | + |
|
263 | + $tab_top = 90; |
|
264 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
265 | + $tab_height = 130; |
|
266 | + $tab_height_newpage = 150; |
|
267 | + |
|
268 | + // Affiche notes |
|
269 | + $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
270 | + if ($notetoshow) |
|
271 | + { |
|
272 | + $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
273 | + complete_substitutions_array($substitutionarray, $outputlangs, $object); |
|
274 | + $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
|
275 | + |
|
276 | + $tab_top = 88; |
|
277 | + |
|
278 | + $pdf->SetFont('','', $default_font_size - 1); |
|
279 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
280 | + $nexY = $pdf->GetY(); |
|
281 | + $height_note=$nexY-$tab_top; |
|
282 | + |
|
283 | + // Rect prend une longueur en 3eme param |
|
284 | + $pdf->SetDrawColor(192,192,192); |
|
285 | + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
286 | + |
|
287 | + $tab_height = $tab_height - $height_note; |
|
288 | + $tab_top = $nexY+6; |
|
289 | + } |
|
290 | + else |
|
291 | + { |
|
292 | + $height_note=0; |
|
293 | + } |
|
294 | + |
|
295 | + $iniY = $tab_top + 7; |
|
296 | + $curY = $tab_top + 7; |
|
297 | + $nexY = $tab_top + 7; |
|
298 | + |
|
299 | + $pdf->SetXY($this->marge_gauche, $tab_top); |
|
300 | + $pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0); |
|
301 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5); |
|
302 | + |
|
303 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
304 | + |
|
305 | + $pdf->SetXY($this->marge_gauche, $tab_top + 5); |
|
306 | + $text=$object->description; |
|
307 | + if ($object->duration > 0) |
|
308 | + { |
|
309 | + $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); |
|
310 | + $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; |
|
311 | + } |
|
312 | + $desc=dol_htmlentitiesbr($text,1); |
|
313 | + //print $outputlangs->convToOutputCharset($desc); exit; |
|
314 | + |
|
315 | + $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); |
|
316 | + $nexY = $pdf->GetY(); |
|
317 | + |
|
318 | + $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); |
|
319 | + |
|
320 | + $nblines = count($object->lines); |
|
321 | + |
|
322 | + // Loop on each lines |
|
323 | + for ($i = 0; $i < $nblines; $i++) |
|
324 | + { |
|
325 | + $objectligne = $object->lines[$i]; |
|
326 | + |
|
327 | + $valide = empty($objectligne->id) ? 0 : $objectligne->fetch($objectligne->id); |
|
328 | + if ($valide > 0 || $object->specimen) |
|
329 | + { |
|
330 | + $curY = $nexY; |
|
331 | + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
332 | + $pdf->SetTextColor(0,0,0); |
|
333 | + |
|
334 | + $pdf->setTopMargin($tab_top_newpage); |
|
335 | + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
336 | + $pageposbefore=$pdf->getPage(); |
|
337 | + |
|
338 | + // Description of product line |
|
339 | + $curX = $this->posxdesc-1; |
|
340 | + |
|
341 | + // Description of product line |
|
342 | 342 | if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) |
343 | 343 | { |
344 | - $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); |
|
344 | + $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); |
|
345 | 345 | } |
346 | 346 | else |
347 | 347 | { |
348 | 348 | $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true); |
349 | 349 | } |
350 | 350 | |
351 | - if ($objectligne->duration > 0) |
|
352 | - { |
|
353 | - $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); |
|
354 | - } |
|
355 | - $txt='<strong>'.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).'</strong>'; |
|
356 | - $desc=dol_htmlentitiesbr($objectligne->desc,1); |
|
357 | - |
|
358 | - $pdf->startTransaction(); |
|
359 | - $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
360 | - $pageposafter=$pdf->getPage(); |
|
361 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
362 | - { |
|
363 | - $pdf->rollbackTransaction(true); |
|
364 | - $pageposafter=$pageposbefore; |
|
365 | - //print $pageposafter.'-'.$pageposbefore;exit; |
|
366 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
367 | - $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
368 | - $pageposafter=$pdf->getPage(); |
|
369 | - $posyafter=$pdf->GetY(); |
|
370 | - //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
|
371 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
372 | - { |
|
373 | - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page |
|
374 | - { |
|
375 | - $pdf->AddPage('','',true); |
|
376 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
377 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
378 | - $pdf->setPage($pageposafter+1); |
|
379 | - } |
|
380 | - } |
|
381 | - } |
|
382 | - else // No pagebreak |
|
383 | - { |
|
384 | - $pdf->commitTransaction(); |
|
385 | - } |
|
386 | - |
|
387 | - $nexY = $pdf->GetY(); |
|
388 | - $pageposafter=$pdf->getPage(); |
|
389 | - $pdf->setPage($pageposbefore); |
|
390 | - $pdf->setTopMargin($this->marge_haute); |
|
391 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
392 | - |
|
393 | - // We suppose that a too long description is moved completely on next page |
|
394 | - if ($pageposafter > $pageposbefore) { |
|
395 | - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
|
396 | - } |
|
397 | - |
|
398 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
399 | - |
|
400 | - // Detect if some page were added automatically and output _tableau for past pages |
|
401 | - while ($pagenb < $pageposafter) |
|
402 | - { |
|
403 | - $pdf->setPage($pagenb); |
|
404 | - if ($pagenb == 1) |
|
405 | - { |
|
406 | - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
|
407 | - } |
|
408 | - else |
|
409 | - { |
|
410 | - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
|
411 | - } |
|
412 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
413 | - $pagenb++; |
|
414 | - $pdf->setPage($pagenb); |
|
415 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
416 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
417 | - } |
|
418 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
419 | - { |
|
420 | - if ($pagenb == 1) |
|
421 | - { |
|
422 | - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
|
423 | - } |
|
424 | - else |
|
425 | - { |
|
426 | - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
|
427 | - } |
|
428 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
429 | - // New page |
|
430 | - $pdf->AddPage(); |
|
431 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
432 | - $pagenb++; |
|
433 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
434 | - } |
|
435 | - } |
|
436 | - } |
|
437 | - |
|
438 | - // Show square |
|
439 | - if ($pagenb == 1) |
|
440 | - { |
|
441 | - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
|
442 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
443 | - } |
|
444 | - else |
|
445 | - { |
|
446 | - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
|
447 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
448 | - } |
|
449 | - |
|
450 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
451 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
452 | - |
|
453 | - $pdf->Close(); |
|
454 | - $pdf->Output($file,'F'); |
|
455 | - |
|
456 | - // Add pdfgeneration hook |
|
457 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
458 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
459 | - global $action; |
|
460 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
461 | - |
|
462 | - if (! empty($conf->global->MAIN_UMASK)) |
|
463 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
464 | - |
|
465 | - $this->result = array('fullpath'=>$file); |
|
466 | - |
|
467 | - return 1; |
|
468 | - } |
|
469 | - else |
|
470 | - { |
|
471 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
472 | - return 0; |
|
473 | - } |
|
474 | - } |
|
475 | - else |
|
476 | - { |
|
477 | - $this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR"); |
|
478 | - return 0; |
|
479 | - } |
|
480 | - } |
|
481 | - |
|
482 | - /** |
|
483 | - * Show table for lines |
|
484 | - * |
|
485 | - * @param PDF $pdf Object PDF |
|
486 | - * @param string $tab_top Top position of table |
|
487 | - * @param string $tab_height Height of table (rectangle) |
|
488 | - * @param int $nexY Y |
|
489 | - * @param Translate $outputlangs Langs object |
|
490 | - * @param int $hidetop Hide top bar of array |
|
491 | - * @param int $hidebottom Hide bottom bar of array |
|
492 | - * @return void |
|
493 | - */ |
|
494 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
495 | - { |
|
496 | - global $conf; |
|
497 | - |
|
498 | - |
|
499 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
351 | + if ($objectligne->duration > 0) |
|
352 | + { |
|
353 | + $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); |
|
354 | + } |
|
355 | + $txt='<strong>'.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).'</strong>'; |
|
356 | + $desc=dol_htmlentitiesbr($objectligne->desc,1); |
|
357 | + |
|
358 | + $pdf->startTransaction(); |
|
359 | + $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
360 | + $pageposafter=$pdf->getPage(); |
|
361 | + if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
362 | + { |
|
363 | + $pdf->rollbackTransaction(true); |
|
364 | + $pageposafter=$pageposbefore; |
|
365 | + //print $pageposafter.'-'.$pageposbefore;exit; |
|
366 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
367 | + $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
368 | + $pageposafter=$pdf->getPage(); |
|
369 | + $posyafter=$pdf->GetY(); |
|
370 | + //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
|
371 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
372 | + { |
|
373 | + if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page |
|
374 | + { |
|
375 | + $pdf->AddPage('','',true); |
|
376 | + if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
377 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
378 | + $pdf->setPage($pageposafter+1); |
|
379 | + } |
|
380 | + } |
|
381 | + } |
|
382 | + else // No pagebreak |
|
383 | + { |
|
384 | + $pdf->commitTransaction(); |
|
385 | + } |
|
386 | + |
|
387 | + $nexY = $pdf->GetY(); |
|
388 | + $pageposafter=$pdf->getPage(); |
|
389 | + $pdf->setPage($pageposbefore); |
|
390 | + $pdf->setTopMargin($this->marge_haute); |
|
391 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
392 | + |
|
393 | + // We suppose that a too long description is moved completely on next page |
|
394 | + if ($pageposafter > $pageposbefore) { |
|
395 | + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
|
396 | + } |
|
397 | + |
|
398 | + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
399 | + |
|
400 | + // Detect if some page were added automatically and output _tableau for past pages |
|
401 | + while ($pagenb < $pageposafter) |
|
402 | + { |
|
403 | + $pdf->setPage($pagenb); |
|
404 | + if ($pagenb == 1) |
|
405 | + { |
|
406 | + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
|
407 | + } |
|
408 | + else |
|
409 | + { |
|
410 | + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
|
411 | + } |
|
412 | + $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
413 | + $pagenb++; |
|
414 | + $pdf->setPage($pagenb); |
|
415 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
416 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
417 | + } |
|
418 | + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
419 | + { |
|
420 | + if ($pagenb == 1) |
|
421 | + { |
|
422 | + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
|
423 | + } |
|
424 | + else |
|
425 | + { |
|
426 | + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
|
427 | + } |
|
428 | + $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
429 | + // New page |
|
430 | + $pdf->AddPage(); |
|
431 | + if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
432 | + $pagenb++; |
|
433 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
434 | + } |
|
435 | + } |
|
436 | + } |
|
437 | + |
|
438 | + // Show square |
|
439 | + if ($pagenb == 1) |
|
440 | + { |
|
441 | + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
|
442 | + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
443 | + } |
|
444 | + else |
|
445 | + { |
|
446 | + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
|
447 | + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
448 | + } |
|
449 | + |
|
450 | + $this->_pagefoot($pdf,$object,$outputlangs); |
|
451 | + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
452 | + |
|
453 | + $pdf->Close(); |
|
454 | + $pdf->Output($file,'F'); |
|
455 | + |
|
456 | + // Add pdfgeneration hook |
|
457 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
458 | + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
459 | + global $action; |
|
460 | + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
461 | + |
|
462 | + if (! empty($conf->global->MAIN_UMASK)) |
|
463 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
464 | + |
|
465 | + $this->result = array('fullpath'=>$file); |
|
466 | + |
|
467 | + return 1; |
|
468 | + } |
|
469 | + else |
|
470 | + { |
|
471 | + $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
472 | + return 0; |
|
473 | + } |
|
474 | + } |
|
475 | + else |
|
476 | + { |
|
477 | + $this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR"); |
|
478 | + return 0; |
|
479 | + } |
|
480 | + } |
|
481 | + |
|
482 | + /** |
|
483 | + * Show table for lines |
|
484 | + * |
|
485 | + * @param PDF $pdf Object PDF |
|
486 | + * @param string $tab_top Top position of table |
|
487 | + * @param string $tab_height Height of table (rectangle) |
|
488 | + * @param int $nexY Y |
|
489 | + * @param Translate $outputlangs Langs object |
|
490 | + * @param int $hidetop Hide top bar of array |
|
491 | + * @param int $hidebottom Hide bottom bar of array |
|
492 | + * @return void |
|
493 | + */ |
|
494 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
495 | + { |
|
496 | + global $conf; |
|
497 | + |
|
498 | + |
|
499 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
500 | 500 | /* |
501 | 501 | $pdf->SetXY($this->marge_gauche, $tab_top); |
502 | 502 | $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); |
@@ -523,214 +523,214 @@ discard block |
||
523 | 523 | $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. |
524 | 524 | */ |
525 | 525 | |
526 | - // Output Rect |
|
527 | - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param |
|
528 | - |
|
529 | - if (empty($hidebottom)) |
|
530 | - { |
|
531 | - $pdf->SetXY(20,230); |
|
532 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); |
|
533 | - |
|
534 | - $pdf->SetXY(20,235); |
|
535 | - $pdf->MultiCell(80,25, '', 1); |
|
536 | - |
|
537 | - $pdf->SetXY(110,230); |
|
538 | - $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); |
|
539 | - |
|
540 | - $pdf->SetXY(110,235); |
|
541 | - $pdf->MultiCell(80,25, '', 1); |
|
542 | - } |
|
543 | - } |
|
544 | - |
|
545 | - /** |
|
546 | - * Show top header of page. |
|
547 | - * |
|
548 | - * @param PDF $pdf Object PDF |
|
549 | - * @param Object $object Object to show |
|
550 | - * @param int $showaddress 0=no, 1=yes |
|
551 | - * @param Translate $outputlangs Object lang for output |
|
552 | - * @return void |
|
553 | - */ |
|
554 | - function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
|
555 | - { |
|
556 | - global $conf,$langs; |
|
557 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
558 | - |
|
559 | - // Load traductions files requiredby by page |
|
560 | - $outputlangs->loadLangs(array("main", "dict", "companies", "interventions")); |
|
561 | - |
|
562 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
563 | - |
|
564 | - //Affiche le filigrane brouillon - Print Draft Watermark |
|
565 | - if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) |
|
566 | - { |
|
567 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); |
|
568 | - } |
|
569 | - |
|
570 | - //Prepare la suite |
|
571 | - $pdf->SetTextColor(0,0,60); |
|
572 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
573 | - |
|
574 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
575 | - $posy=$this->marge_haute; |
|
576 | - |
|
577 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
526 | + // Output Rect |
|
527 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param |
|
578 | 528 | |
579 | - // Logo |
|
580 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
581 | - if ($this->emetteur->logo) |
|
582 | - { |
|
583 | - if (is_readable($logo)) |
|
584 | - { |
|
585 | - $height=pdf_getHeightForLogo($logo); |
|
586 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
587 | - } |
|
588 | - else |
|
589 | - { |
|
590 | - $pdf->SetTextColor(200,0,0); |
|
591 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
592 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
593 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
|
594 | - } |
|
595 | - } |
|
596 | - else |
|
597 | - { |
|
598 | - $text=$this->emetteur->name; |
|
599 | - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
|
600 | - } |
|
529 | + if (empty($hidebottom)) |
|
530 | + { |
|
531 | + $pdf->SetXY(20,230); |
|
532 | + $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); |
|
601 | 533 | |
602 | - $pdf->SetFont('','B',$default_font_size + 3); |
|
603 | - $pdf->SetXY($posx,$posy); |
|
604 | - $pdf->SetTextColor(0,0,60); |
|
605 | - $title=$outputlangs->transnoentities("InterventionCard"); |
|
606 | - $pdf->MultiCell(100, 4, $title, '', 'R'); |
|
534 | + $pdf->SetXY(20,235); |
|
535 | + $pdf->MultiCell(80,25, '', 1); |
|
607 | 536 | |
608 | - $pdf->SetFont('','B',$default_font_size + 2); |
|
537 | + $pdf->SetXY(110,230); |
|
538 | + $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); |
|
609 | 539 | |
610 | - $posy+=5; |
|
611 | - $pdf->SetXY($posx,$posy); |
|
612 | - $pdf->SetTextColor(0,0,60); |
|
613 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
540 | + $pdf->SetXY(110,235); |
|
541 | + $pdf->MultiCell(80,25, '', 1); |
|
542 | + } |
|
543 | + } |
|
614 | 544 | |
615 | - $posy+=1; |
|
616 | - $pdf->SetFont('','', $default_font_size); |
|
617 | - |
|
618 | - $posy+=4; |
|
619 | - $pdf->SetXY($posx,$posy); |
|
620 | - $pdf->SetTextColor(0,0,60); |
|
621 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); |
|
622 | - |
|
623 | - if ($object->thirdparty->code_client) |
|
624 | - { |
|
625 | - $posy+=4; |
|
626 | - $pdf->SetXY($posx,$posy); |
|
627 | - $pdf->SetTextColor(0,0,60); |
|
628 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
629 | - } |
|
545 | + /** |
|
546 | + * Show top header of page. |
|
547 | + * |
|
548 | + * @param PDF $pdf Object PDF |
|
549 | + * @param Object $object Object to show |
|
550 | + * @param int $showaddress 0=no, 1=yes |
|
551 | + * @param Translate $outputlangs Object lang for output |
|
552 | + * @return void |
|
553 | + */ |
|
554 | + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
|
555 | + { |
|
556 | + global $conf,$langs; |
|
557 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
558 | + |
|
559 | + // Load traductions files requiredby by page |
|
560 | + $outputlangs->loadLangs(array("main", "dict", "companies", "interventions")); |
|
561 | + |
|
562 | + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
563 | + |
|
564 | + //Affiche le filigrane brouillon - Print Draft Watermark |
|
565 | + if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) |
|
566 | + { |
|
567 | + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); |
|
568 | + } |
|
569 | + |
|
570 | + //Prepare la suite |
|
571 | + $pdf->SetTextColor(0,0,60); |
|
572 | + $pdf->SetFont('','B', $default_font_size + 3); |
|
573 | + |
|
574 | + $posx=$this->page_largeur-$this->marge_droite-100; |
|
575 | + $posy=$this->marge_haute; |
|
576 | + |
|
577 | + $pdf->SetXY($this->marge_gauche,$posy); |
|
578 | + |
|
579 | + // Logo |
|
580 | + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
581 | + if ($this->emetteur->logo) |
|
582 | + { |
|
583 | + if (is_readable($logo)) |
|
584 | + { |
|
585 | + $height=pdf_getHeightForLogo($logo); |
|
586 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
587 | + } |
|
588 | + else |
|
589 | + { |
|
590 | + $pdf->SetTextColor(200,0,0); |
|
591 | + $pdf->SetFont('','B',$default_font_size - 2); |
|
592 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
593 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
|
594 | + } |
|
595 | + } |
|
596 | + else |
|
597 | + { |
|
598 | + $text=$this->emetteur->name; |
|
599 | + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
|
600 | + } |
|
601 | + |
|
602 | + $pdf->SetFont('','B',$default_font_size + 3); |
|
603 | + $pdf->SetXY($posx,$posy); |
|
604 | + $pdf->SetTextColor(0,0,60); |
|
605 | + $title=$outputlangs->transnoentities("InterventionCard"); |
|
606 | + $pdf->MultiCell(100, 4, $title, '', 'R'); |
|
607 | + |
|
608 | + $pdf->SetFont('','B',$default_font_size + 2); |
|
609 | + |
|
610 | + $posy+=5; |
|
611 | + $pdf->SetXY($posx,$posy); |
|
612 | + $pdf->SetTextColor(0,0,60); |
|
613 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
614 | + |
|
615 | + $posy+=1; |
|
616 | + $pdf->SetFont('','', $default_font_size); |
|
617 | + |
|
618 | + $posy+=4; |
|
619 | + $pdf->SetXY($posx,$posy); |
|
620 | + $pdf->SetTextColor(0,0,60); |
|
621 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); |
|
622 | + |
|
623 | + if ($object->thirdparty->code_client) |
|
624 | + { |
|
625 | + $posy+=4; |
|
626 | + $pdf->SetXY($posx,$posy); |
|
627 | + $pdf->SetTextColor(0,0,60); |
|
628 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
629 | + } |
|
630 | + |
|
631 | + if ($showaddress) |
|
632 | + { |
|
633 | + // Sender properties |
|
634 | + $carac_emetteur=''; |
|
635 | + // Add internal contact of proposal if defined |
|
636 | + $arrayidcontact=$object->getIdContact('internal','INTERREPFOLL'); |
|
637 | + if (count($arrayidcontact) > 0) |
|
638 | + { |
|
639 | + $object->fetch_user($arrayidcontact[0]); |
|
640 | + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
641 | + } |
|
642 | + |
|
643 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
644 | + |
|
645 | + // Show sender |
|
646 | + $posy=42; |
|
647 | + $posx=$this->marge_gauche; |
|
648 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
649 | + $hautcadre=40; |
|
650 | + |
|
651 | + // Show sender frame |
|
652 | + $pdf->SetTextColor(0,0,0); |
|
653 | + $pdf->SetFont('','', $default_font_size - 2); |
|
654 | + $pdf->SetXY($posx,$posy-5); |
|
655 | + $pdf->SetXY($posx,$posy); |
|
656 | + $pdf->SetFillColor(230,230,230); |
|
657 | + $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
|
658 | + |
|
659 | + // Show sender name |
|
660 | + $pdf->SetXY($posx+2,$posy+3); |
|
661 | + $pdf->SetTextColor(0,0,60); |
|
662 | + $pdf->SetFont('','B',$default_font_size); |
|
663 | + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
|
664 | + $posy=$pdf->getY(); |
|
665 | + |
|
666 | + // Show sender information |
|
667 | + $pdf->SetFont('','', $default_font_size - 1); |
|
668 | + $pdf->SetXY($posx+2,$posy); |
|
669 | + $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
|
670 | + |
|
671 | + |
|
672 | + // If CUSTOMER contact defined, we use it |
|
673 | + $usecontact=false; |
|
674 | + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
675 | + if (count($arrayidcontact) > 0) |
|
676 | + { |
|
677 | + $usecontact=true; |
|
678 | + $result=$object->fetch_contact($arrayidcontact[0]); |
|
679 | + } |
|
680 | + |
|
681 | + //Recipient name |
|
682 | + // On peut utiliser le nom de la societe du contact |
|
683 | + if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { |
|
684 | + $thirdparty = $object->contact; |
|
685 | + } else { |
|
686 | + $thirdparty = $object->thirdparty; |
|
687 | + } |
|
688 | + |
|
689 | + $carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
690 | + |
|
691 | + $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object); |
|
692 | + |
|
693 | + // Show recipient |
|
694 | + $widthrecbox=100; |
|
695 | + if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
696 | + $posy=42; |
|
697 | + $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
698 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
699 | + |
|
700 | + // Show recipient frame |
|
701 | + $pdf->SetTextColor(0,0,0); |
|
702 | + $pdf->SetFont('','', $default_font_size - 2); |
|
703 | + $pdf->SetXY($posx+2,$posy-5); |
|
704 | + $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
|
705 | + $pdf->SetTextColor(0,0,0); |
|
706 | + |
|
707 | + // Show recipient name |
|
708 | + $pdf->SetXY($posx+2,$posy+3); |
|
709 | + $pdf->SetFont('','B', $default_font_size); |
|
710 | + $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
|
711 | + |
|
712 | + $posy = $pdf->getY(); |
|
713 | + |
|
714 | + // Show recipient information |
|
715 | + $pdf->SetFont('','', $default_font_size - 1); |
|
716 | + $pdf->SetXY($posx+2,$posy); |
|
717 | + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
|
718 | + } |
|
719 | + } |
|
630 | 720 | |
631 | - if ($showaddress) |
|
632 | - { |
|
633 | - // Sender properties |
|
634 | - $carac_emetteur=''; |
|
635 | - // Add internal contact of proposal if defined |
|
636 | - $arrayidcontact=$object->getIdContact('internal','INTERREPFOLL'); |
|
637 | - if (count($arrayidcontact) > 0) |
|
638 | - { |
|
639 | - $object->fetch_user($arrayidcontact[0]); |
|
640 | - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
641 | - } |
|
642 | - |
|
643 | - $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
644 | - |
|
645 | - // Show sender |
|
646 | - $posy=42; |
|
647 | - $posx=$this->marge_gauche; |
|
648 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
649 | - $hautcadre=40; |
|
650 | - |
|
651 | - // Show sender frame |
|
652 | - $pdf->SetTextColor(0,0,0); |
|
653 | - $pdf->SetFont('','', $default_font_size - 2); |
|
654 | - $pdf->SetXY($posx,$posy-5); |
|
655 | - $pdf->SetXY($posx,$posy); |
|
656 | - $pdf->SetFillColor(230,230,230); |
|
657 | - $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
|
658 | - |
|
659 | - // Show sender name |
|
660 | - $pdf->SetXY($posx+2,$posy+3); |
|
661 | - $pdf->SetTextColor(0,0,60); |
|
662 | - $pdf->SetFont('','B',$default_font_size); |
|
663 | - $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
|
664 | - $posy=$pdf->getY(); |
|
665 | - |
|
666 | - // Show sender information |
|
667 | - $pdf->SetFont('','', $default_font_size - 1); |
|
668 | - $pdf->SetXY($posx+2,$posy); |
|
669 | - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
|
670 | - |
|
671 | - |
|
672 | - // If CUSTOMER contact defined, we use it |
|
673 | - $usecontact=false; |
|
674 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
675 | - if (count($arrayidcontact) > 0) |
|
676 | - { |
|
677 | - $usecontact=true; |
|
678 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
679 | - } |
|
680 | - |
|
681 | - //Recipient name |
|
682 | - // On peut utiliser le nom de la societe du contact |
|
683 | - if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) { |
|
684 | - $thirdparty = $object->contact; |
|
685 | - } else { |
|
686 | - $thirdparty = $object->thirdparty; |
|
687 | - } |
|
688 | - |
|
689 | - $carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
690 | - |
|
691 | - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object); |
|
692 | - |
|
693 | - // Show recipient |
|
694 | - $widthrecbox=100; |
|
695 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
696 | - $posy=42; |
|
697 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
698 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
699 | - |
|
700 | - // Show recipient frame |
|
701 | - $pdf->SetTextColor(0,0,0); |
|
702 | - $pdf->SetFont('','', $default_font_size - 2); |
|
703 | - $pdf->SetXY($posx+2,$posy-5); |
|
704 | - $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
|
705 | - $pdf->SetTextColor(0,0,0); |
|
706 | - |
|
707 | - // Show recipient name |
|
708 | - $pdf->SetXY($posx+2,$posy+3); |
|
709 | - $pdf->SetFont('','B', $default_font_size); |
|
710 | - $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
|
711 | - |
|
712 | - $posy = $pdf->getY(); |
|
713 | - |
|
714 | - // Show recipient information |
|
715 | - $pdf->SetFont('','', $default_font_size - 1); |
|
716 | - $pdf->SetXY($posx+2,$posy); |
|
717 | - $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
|
718 | - } |
|
719 | - } |
|
720 | - |
|
721 | - /** |
|
722 | - * Show footer of page. Need this->emetteur object |
|
723 | - * |
|
724 | - * @param PDF $pdf PDF |
|
725 | - * @param Object $object Object to show |
|
726 | - * @param Translate $outputlangs Object lang for output |
|
727 | - * @param int $hidefreetext 1=Hide free text |
|
728 | - * @return integer |
|
729 | - */ |
|
730 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
731 | - { |
|
732 | - global $conf; |
|
733 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
734 | - return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
735 | - } |
|
721 | + /** |
|
722 | + * Show footer of page. Need this->emetteur object |
|
723 | + * |
|
724 | + * @param PDF $pdf PDF |
|
725 | + * @param Object $object Object to show |
|
726 | + * @param Translate $outputlangs Object lang for output |
|
727 | + * @param int $hidefreetext 1=Hide free text |
|
728 | + * @return integer |
|
729 | + */ |
|
730 | + function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
731 | + { |
|
732 | + global $conf; |
|
733 | + $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
734 | + return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
735 | + } |
|
736 | 736 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function __construct($db) |
120 | 120 | { |
121 | - global $conf,$langs,$mysoc; |
|
121 | + global $conf, $langs, $mysoc; |
|
122 | 122 | |
123 | 123 | $this->db = $db; |
124 | 124 | $this->name = 'soleil'; |
@@ -126,29 +126,29 @@ discard block |
||
126 | 126 | |
127 | 127 | // Dimension page pour format A4 |
128 | 128 | $this->type = 'pdf'; |
129 | - $formatarray=pdf_getFormat(); |
|
129 | + $formatarray = pdf_getFormat(); |
|
130 | 130 | $this->page_largeur = $formatarray['width']; |
131 | 131 | $this->page_hauteur = $formatarray['height']; |
132 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
133 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
134 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
135 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
136 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
137 | - |
|
138 | - $this->option_logo = 1; // Affiche logo |
|
139 | - $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION |
|
140 | - $this->option_modereg = 0; // Affiche mode reglement |
|
141 | - $this->option_condreg = 0; // Affiche conditions reglement |
|
142 | - $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
143 | - $this->option_multilang = 1; // Dispo en plusieurs langues |
|
144 | - $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
132 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
133 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
134 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
135 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
136 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
137 | + |
|
138 | + $this->option_logo = 1; // Affiche logo |
|
139 | + $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION |
|
140 | + $this->option_modereg = 0; // Affiche mode reglement |
|
141 | + $this->option_condreg = 0; // Affiche conditions reglement |
|
142 | + $this->option_codeproduitservice = 0; // Affiche code produit-service |
|
143 | + $this->option_multilang = 1; // Dispo en plusieurs langues |
|
144 | + $this->option_draft_watermark = 1; //Support add of a watermark on drafts |
|
145 | 145 | |
146 | 146 | // Get source company |
147 | - $this->emetteur=$mysoc; |
|
148 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined |
|
147 | + $this->emetteur = $mysoc; |
|
148 | + if (empty($this->emetteur->country_code)) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if not defined |
|
149 | 149 | |
150 | 150 | // Define position of columns |
151 | - $this->posxdesc=$this->marge_gauche+1; |
|
151 | + $this->posxdesc = $this->marge_gauche + 1; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | * @param int $hideref Do not show ref |
164 | 164 | * @return int 1=OK, 0=KO |
165 | 165 | */ |
166 | - function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) |
|
166 | + function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
167 | 167 | { |
168 | 168 | // phpcs:enable |
169 | - global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
|
169 | + global $user, $langs, $conf, $mysoc, $db, $hookmanager; |
|
170 | 170 | |
171 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
171 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
172 | 172 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
173 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
173 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
174 | 174 | |
175 | 175 | // Load traductions files requiredby by page |
176 | 176 | $outputlangs->loadLangs(array("main", "interventions", "dict", "companies")); |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | if ($object->specimen) |
184 | 184 | { |
185 | 185 | $dir = $conf->ficheinter->dir_output; |
186 | - $file = $dir . "/SPECIMEN.pdf"; |
|
186 | + $file = $dir."/SPECIMEN.pdf"; |
|
187 | 187 | } |
188 | 188 | else |
189 | 189 | { |
190 | 190 | $objectref = dol_sanitizeFileName($object->ref); |
191 | - $dir = $conf->ficheinter->dir_output . "/" . $objectref; |
|
192 | - $file = $dir . "/" . $objectref . ".pdf"; |
|
191 | + $dir = $conf->ficheinter->dir_output."/".$objectref; |
|
192 | + $file = $dir."/".$objectref.".pdf"; |
|
193 | 193 | } |
194 | 194 | |
195 | - if (! file_exists($dir)) |
|
195 | + if (!file_exists($dir)) |
|
196 | 196 | { |
197 | 197 | if (dol_mkdir($dir) < 0) |
198 | 198 | { |
199 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
199 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
200 | 200 | return 0; |
201 | 201 | } |
202 | 202 | } |
@@ -204,27 +204,27 @@ discard block |
||
204 | 204 | if (file_exists($dir)) |
205 | 205 | { |
206 | 206 | // Add pdfgeneration hook |
207 | - if (! is_object($hookmanager)) |
|
207 | + if (!is_object($hookmanager)) |
|
208 | 208 | { |
209 | 209 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
210 | - $hookmanager=new HookManager($this->db); |
|
210 | + $hookmanager = new HookManager($this->db); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $hookmanager->initHooks(array('pdfgeneration')); |
214 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
214 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
215 | 215 | global $action; |
216 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
216 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
217 | 217 | |
218 | 218 | $nblignes = count($object->lines); |
219 | 219 | |
220 | 220 | // Create pdf instance |
221 | - $pdf=pdf_getInstance($this->format); |
|
222 | - $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
223 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
224 | - $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 |
|
225 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
226 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
227 | - $pdf->SetAutoPageBreak(1,0); |
|
221 | + $pdf = pdf_getInstance($this->format); |
|
222 | + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance |
|
223 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
224 | + $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 |
|
225 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
226 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
227 | + $pdf->SetAutoPageBreak(1, 0); |
|
228 | 228 | |
229 | 229 | if (class_exists('TCPDF')) |
230 | 230 | { |
@@ -233,63 +233,63 @@ discard block |
||
233 | 233 | } |
234 | 234 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
235 | 235 | // Set path to the background PDF File |
236 | - if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
236 | + if (!empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) |
|
237 | 237 | { |
238 | 238 | $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); |
239 | 239 | $tplidx = $pdf->importPage(1); |
240 | 240 | } |
241 | 241 | |
242 | 242 | $pdf->Open(); |
243 | - $pagenb=0; |
|
244 | - $pdf->SetDrawColor(128,128,128); |
|
243 | + $pagenb = 0; |
|
244 | + $pdf->SetDrawColor(128, 128, 128); |
|
245 | 245 | |
246 | 246 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
247 | 247 | $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); |
248 | 248 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
249 | 249 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
250 | 250 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); |
251 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
251 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
252 | 252 | |
253 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
253 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
254 | 254 | |
255 | 255 | // New page |
256 | 256 | $pdf->AddPage(); |
257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
257 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
258 | 258 | $pagenb++; |
259 | 259 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
260 | - $pdf->SetFont('','', $default_font_size - 1); |
|
261 | - $pdf->SetTextColor(0,0,0); |
|
260 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
261 | + $pdf->SetTextColor(0, 0, 0); |
|
262 | 262 | |
263 | 263 | $tab_top = 90; |
264 | - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); |
|
264 | + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10); |
|
265 | 265 | $tab_height = 130; |
266 | 266 | $tab_height_newpage = 150; |
267 | 267 | |
268 | 268 | // Affiche notes |
269 | - $notetoshow=empty($object->note_public)?'':$object->note_public; |
|
269 | + $notetoshow = empty($object->note_public) ? '' : $object->note_public; |
|
270 | 270 | if ($notetoshow) |
271 | 271 | { |
272 | - $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); |
|
272 | + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); |
|
273 | 273 | complete_substitutions_array($substitutionarray, $outputlangs, $object); |
274 | 274 | $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); |
275 | 275 | |
276 | 276 | $tab_top = 88; |
277 | 277 | |
278 | - $pdf->SetFont('','', $default_font_size - 1); |
|
279 | - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
278 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
279 | + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); |
|
280 | 280 | $nexY = $pdf->GetY(); |
281 | - $height_note=$nexY-$tab_top; |
|
281 | + $height_note = $nexY - $tab_top; |
|
282 | 282 | |
283 | 283 | // Rect prend une longueur en 3eme param |
284 | - $pdf->SetDrawColor(192,192,192); |
|
285 | - $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); |
|
284 | + $pdf->SetDrawColor(192, 192, 192); |
|
285 | + $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1); |
|
286 | 286 | |
287 | 287 | $tab_height = $tab_height - $height_note; |
288 | - $tab_top = $nexY+6; |
|
288 | + $tab_top = $nexY + 6; |
|
289 | 289 | } |
290 | 290 | else |
291 | 291 | { |
292 | - $height_note=0; |
|
292 | + $height_note = 0; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $iniY = $tab_top + 7; |
@@ -297,25 +297,25 @@ discard block |
||
297 | 297 | $nexY = $tab_top + 7; |
298 | 298 | |
299 | 299 | $pdf->SetXY($this->marge_gauche, $tab_top); |
300 | - $pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0); |
|
301 | - $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5); |
|
300 | + $pdf->MultiCell(190, 5, $outputlangs->transnoentities("Description"), 0, 'L', 0); |
|
301 | + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5); |
|
302 | 302 | |
303 | 303 | $pdf->SetFont('', '', $default_font_size - 1); |
304 | 304 | |
305 | 305 | $pdf->SetXY($this->marge_gauche, $tab_top + 5); |
306 | - $text=$object->description; |
|
306 | + $text = $object->description; |
|
307 | 307 | if ($object->duration > 0) |
308 | 308 | { |
309 | - $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); |
|
310 | - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; |
|
309 | + $totaltime = convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); |
|
310 | + $text .= ($text ? ' - ' : '').$langs->trans("Total").": ".$totaltime; |
|
311 | 311 | } |
312 | - $desc=dol_htmlentitiesbr($text,1); |
|
312 | + $desc = dol_htmlentitiesbr($text, 1); |
|
313 | 313 | //print $outputlangs->convToOutputCharset($desc); exit; |
314 | 314 | |
315 | 315 | $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); |
316 | 316 | $nexY = $pdf->GetY(); |
317 | 317 | |
318 | - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); |
|
318 | + $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); |
|
319 | 319 | |
320 | 320 | $nblines = count($object->lines); |
321 | 321 | |
@@ -328,54 +328,54 @@ discard block |
||
328 | 328 | if ($valide > 0 || $object->specimen) |
329 | 329 | { |
330 | 330 | $curY = $nexY; |
331 | - $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage |
|
332 | - $pdf->SetTextColor(0,0,0); |
|
331 | + $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage |
|
332 | + $pdf->SetTextColor(0, 0, 0); |
|
333 | 333 | |
334 | 334 | $pdf->setTopMargin($tab_top_newpage); |
335 | - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
336 | - $pageposbefore=$pdf->getPage(); |
|
335 | + $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
|
336 | + $pageposbefore = $pdf->getPage(); |
|
337 | 337 | |
338 | 338 | // Description of product line |
339 | - $curX = $this->posxdesc-1; |
|
339 | + $curX = $this->posxdesc - 1; |
|
340 | 340 | |
341 | 341 | // Description of product line |
342 | 342 | if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) |
343 | 343 | { |
344 | - $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); |
|
344 | + $txt = $outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'dayhour', false, $outputlangs, true); |
|
345 | 345 | } |
346 | 346 | else |
347 | 347 | { |
348 | - $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true); |
|
348 | + $txt = $outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei, 'day', false, $outputlangs, true); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | if ($objectligne->duration > 0) |
352 | 352 | { |
353 | - $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); |
|
353 | + $txt .= " - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); |
|
354 | 354 | } |
355 | - $txt='<strong>'.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).'</strong>'; |
|
356 | - $desc=dol_htmlentitiesbr($objectligne->desc,1); |
|
355 | + $txt = '<strong>'.dol_htmlentitiesbr($txt, 1, $outputlangs->charset_output).'</strong>'; |
|
356 | + $desc = dol_htmlentitiesbr($objectligne->desc, 1); |
|
357 | 357 | |
358 | 358 | $pdf->startTransaction(); |
359 | - $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
360 | - $pageposafter=$pdf->getPage(); |
|
359 | + $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt, $desc), 0, 1, 0); |
|
360 | + $pageposafter = $pdf->getPage(); |
|
361 | 361 | if ($pageposafter > $pageposbefore) // There is a pagebreak |
362 | 362 | { |
363 | 363 | $pdf->rollbackTransaction(true); |
364 | - $pageposafter=$pageposbefore; |
|
364 | + $pageposafter = $pageposbefore; |
|
365 | 365 | //print $pageposafter.'-'.$pageposbefore;exit; |
366 | - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
367 | - $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); |
|
368 | - $pageposafter=$pdf->getPage(); |
|
369 | - $posyafter=$pdf->GetY(); |
|
366 | + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
|
367 | + $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt, $desc), 0, 1, 0); |
|
368 | + $pageposafter = $pdf->getPage(); |
|
369 | + $posyafter = $pdf->GetY(); |
|
370 | 370 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
371 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
371 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text |
|
372 | 372 | { |
373 | - if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page |
|
373 | + if ($i == ($nblines - 1)) // No more lines, and no space left to show total, so we create a new page |
|
374 | 374 | { |
375 | - $pdf->AddPage('','',true); |
|
376 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
375 | + $pdf->AddPage('', '', true); |
|
376 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
377 | 377 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
378 | - $pdf->setPage($pageposafter+1); |
|
378 | + $pdf->setPage($pageposafter + 1); |
|
379 | 379 | } |
380 | 380 | } |
381 | 381 | } |
@@ -385,17 +385,17 @@ discard block |
||
385 | 385 | } |
386 | 386 | |
387 | 387 | $nexY = $pdf->GetY(); |
388 | - $pageposafter=$pdf->getPage(); |
|
388 | + $pageposafter = $pdf->getPage(); |
|
389 | 389 | $pdf->setPage($pageposbefore); |
390 | 390 | $pdf->setTopMargin($this->marge_haute); |
391 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
391 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
392 | 392 | |
393 | 393 | // We suppose that a too long description is moved completely on next page |
394 | 394 | if ($pageposafter > $pageposbefore) { |
395 | 395 | $pdf->setPage($pageposafter); $curY = $tab_top_newpage; |
396 | 396 | } |
397 | 397 | |
398 | - $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut |
|
398 | + $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut |
|
399 | 399 | |
400 | 400 | // Detect if some page were added automatically and output _tableau for past pages |
401 | 401 | while ($pagenb < $pageposafter) |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | { |
410 | 410 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
411 | 411 | } |
412 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
412 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
413 | 413 | $pagenb++; |
414 | 414 | $pdf->setPage($pagenb); |
415 | - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
415 | + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
|
416 | 416 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
417 | 417 | } |
418 | - if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
|
418 | + if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) |
|
419 | 419 | { |
420 | 420 | if ($pagenb == 1) |
421 | 421 | { |
@@ -425,10 +425,10 @@ discard block |
||
425 | 425 | { |
426 | 426 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
427 | 427 | } |
428 | - $this->_pagefoot($pdf,$object,$outputlangs,1); |
|
428 | + $this->_pagefoot($pdf, $object, $outputlangs, 1); |
|
429 | 429 | // New page |
430 | 430 | $pdf->AddPage(); |
431 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
431 | + if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
432 | 432 | $pagenb++; |
433 | 433 | if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
434 | 434 | } |
@@ -439,27 +439,27 @@ discard block |
||
439 | 439 | if ($pagenb == 1) |
440 | 440 | { |
441 | 441 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
442 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
442 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
443 | 443 | } |
444 | 444 | else |
445 | 445 | { |
446 | 446 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
447 | - $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
447 | + $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
|
448 | 448 | } |
449 | 449 | |
450 | - $this->_pagefoot($pdf,$object,$outputlangs); |
|
451 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
450 | + $this->_pagefoot($pdf, $object, $outputlangs); |
|
451 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
452 | 452 | |
453 | 453 | $pdf->Close(); |
454 | - $pdf->Output($file,'F'); |
|
454 | + $pdf->Output($file, 'F'); |
|
455 | 455 | |
456 | 456 | // Add pdfgeneration hook |
457 | 457 | $hookmanager->initHooks(array('pdfgeneration')); |
458 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
458 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
459 | 459 | global $action; |
460 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
460 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
461 | 461 | |
462 | - if (! empty($conf->global->MAIN_UMASK)) |
|
462 | + if (!empty($conf->global->MAIN_UMASK)) |
|
463 | 463 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
464 | 464 | |
465 | 465 | $this->result = array('fullpath'=>$file); |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | } |
469 | 469 | else |
470 | 470 | { |
471 | - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
|
471 | + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); |
|
472 | 472 | return 0; |
473 | 473 | } |
474 | 474 | } |
475 | 475 | else |
476 | 476 | { |
477 | - $this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR"); |
|
477 | + $this->error = $langs->trans("ErrorConstantNotDefined", "FICHEINTER_OUTPUTDIR"); |
|
478 | 478 | return 0; |
479 | 479 | } |
480 | 480 | } |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param int $hidebottom Hide bottom bar of array |
492 | 492 | * @return void |
493 | 493 | */ |
494 | - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) |
|
494 | + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0) |
|
495 | 495 | { |
496 | 496 | global $conf; |
497 | 497 | |
@@ -524,21 +524,21 @@ discard block |
||
524 | 524 | */ |
525 | 525 | |
526 | 526 | // Output Rect |
527 | - $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param |
|
527 | + $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height + 1, 0, 0); // Rect prend une longueur en 3eme param et 4eme param |
|
528 | 528 | |
529 | 529 | if (empty($hidebottom)) |
530 | 530 | { |
531 | - $pdf->SetXY(20,230); |
|
532 | - $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); |
|
531 | + $pdf->SetXY(20, 230); |
|
532 | + $pdf->MultiCell(66, 5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"), 0, 'L', 0); |
|
533 | 533 | |
534 | - $pdf->SetXY(20,235); |
|
535 | - $pdf->MultiCell(80,25, '', 1); |
|
534 | + $pdf->SetXY(20, 235); |
|
535 | + $pdf->MultiCell(80, 25, '', 1); |
|
536 | 536 | |
537 | - $pdf->SetXY(110,230); |
|
538 | - $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); |
|
537 | + $pdf->SetXY(110, 230); |
|
538 | + $pdf->MultiCell(80, 5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"), 0, 'L', 0); |
|
539 | 539 | |
540 | - $pdf->SetXY(110,235); |
|
541 | - $pdf->MultiCell(80,25, '', 1); |
|
540 | + $pdf->SetXY(110, 235); |
|
541 | + $pdf->MultiCell(80, 25, '', 1); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -553,129 +553,129 @@ discard block |
||
553 | 553 | */ |
554 | 554 | function _pagehead(&$pdf, $object, $showaddress, $outputlangs) |
555 | 555 | { |
556 | - global $conf,$langs; |
|
556 | + global $conf, $langs; |
|
557 | 557 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
558 | 558 | |
559 | 559 | // Load traductions files requiredby by page |
560 | 560 | $outputlangs->loadLangs(array("main", "dict", "companies", "interventions")); |
561 | 561 | |
562 | - pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); |
|
562 | + pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); |
|
563 | 563 | |
564 | 564 | //Affiche le filigrane brouillon - Print Draft Watermark |
565 | - if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) |
|
565 | + if ($object->statut == 0 && (!empty($conf->global->FICHINTER_DRAFT_WATERMARK))) |
|
566 | 566 | { |
567 | - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); |
|
567 | + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FICHINTER_DRAFT_WATERMARK); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | //Prepare la suite |
571 | - $pdf->SetTextColor(0,0,60); |
|
572 | - $pdf->SetFont('','B', $default_font_size + 3); |
|
571 | + $pdf->SetTextColor(0, 0, 60); |
|
572 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
573 | 573 | |
574 | - $posx=$this->page_largeur-$this->marge_droite-100; |
|
575 | - $posy=$this->marge_haute; |
|
574 | + $posx = $this->page_largeur - $this->marge_droite - 100; |
|
575 | + $posy = $this->marge_haute; |
|
576 | 576 | |
577 | - $pdf->SetXY($this->marge_gauche,$posy); |
|
577 | + $pdf->SetXY($this->marge_gauche, $posy); |
|
578 | 578 | |
579 | 579 | // Logo |
580 | - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
580 | + $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; |
|
581 | 581 | if ($this->emetteur->logo) |
582 | 582 | { |
583 | 583 | if (is_readable($logo)) |
584 | 584 | { |
585 | - $height=pdf_getHeightForLogo($logo); |
|
586 | - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
585 | + $height = pdf_getHeightForLogo($logo); |
|
586 | + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
|
587 | 587 | } |
588 | 588 | else |
589 | 589 | { |
590 | - $pdf->SetTextColor(200,0,0); |
|
591 | - $pdf->SetFont('','B',$default_font_size - 2); |
|
592 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
|
590 | + $pdf->SetTextColor(200, 0, 0); |
|
591 | + $pdf->SetFont('', 'B', $default_font_size - 2); |
|
592 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); |
|
593 | 593 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
594 | 594 | } |
595 | 595 | } |
596 | 596 | else |
597 | 597 | { |
598 | - $text=$this->emetteur->name; |
|
598 | + $text = $this->emetteur->name; |
|
599 | 599 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
600 | 600 | } |
601 | 601 | |
602 | - $pdf->SetFont('','B',$default_font_size + 3); |
|
603 | - $pdf->SetXY($posx,$posy); |
|
604 | - $pdf->SetTextColor(0,0,60); |
|
605 | - $title=$outputlangs->transnoentities("InterventionCard"); |
|
602 | + $pdf->SetFont('', 'B', $default_font_size + 3); |
|
603 | + $pdf->SetXY($posx, $posy); |
|
604 | + $pdf->SetTextColor(0, 0, 60); |
|
605 | + $title = $outputlangs->transnoentities("InterventionCard"); |
|
606 | 606 | $pdf->MultiCell(100, 4, $title, '', 'R'); |
607 | 607 | |
608 | - $pdf->SetFont('','B',$default_font_size + 2); |
|
608 | + $pdf->SetFont('', 'B', $default_font_size + 2); |
|
609 | 609 | |
610 | - $posy+=5; |
|
611 | - $pdf->SetXY($posx,$posy); |
|
612 | - $pdf->SetTextColor(0,0,60); |
|
613 | - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
610 | + $posy += 5; |
|
611 | + $pdf->SetXY($posx, $posy); |
|
612 | + $pdf->SetTextColor(0, 0, 60); |
|
613 | + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref), '', 'R'); |
|
614 | 614 | |
615 | - $posy+=1; |
|
616 | - $pdf->SetFont('','', $default_font_size); |
|
615 | + $posy += 1; |
|
616 | + $pdf->SetFont('', '', $default_font_size); |
|
617 | 617 | |
618 | - $posy+=4; |
|
619 | - $pdf->SetXY($posx,$posy); |
|
620 | - $pdf->SetTextColor(0,0,60); |
|
621 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); |
|
618 | + $posy += 4; |
|
619 | + $pdf->SetXY($posx, $posy); |
|
620 | + $pdf->SetTextColor(0, 0, 60); |
|
621 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R'); |
|
622 | 622 | |
623 | 623 | if ($object->thirdparty->code_client) |
624 | 624 | { |
625 | - $posy+=4; |
|
626 | - $pdf->SetXY($posx,$posy); |
|
627 | - $pdf->SetTextColor(0,0,60); |
|
628 | - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
625 | + $posy += 4; |
|
626 | + $pdf->SetXY($posx, $posy); |
|
627 | + $pdf->SetTextColor(0, 0, 60); |
|
628 | + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : ".$outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | if ($showaddress) |
632 | 632 | { |
633 | 633 | // Sender properties |
634 | - $carac_emetteur=''; |
|
634 | + $carac_emetteur = ''; |
|
635 | 635 | // Add internal contact of proposal if defined |
636 | - $arrayidcontact=$object->getIdContact('internal','INTERREPFOLL'); |
|
636 | + $arrayidcontact = $object->getIdContact('internal', 'INTERREPFOLL'); |
|
637 | 637 | if (count($arrayidcontact) > 0) |
638 | 638 | { |
639 | 639 | $object->fetch_user($arrayidcontact[0]); |
640 | - $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
640 | + $carac_emetteur .= ($carac_emetteur ? "\n" : '').$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
644 | 644 | |
645 | 645 | // Show sender |
646 | - $posy=42; |
|
647 | - $posx=$this->marge_gauche; |
|
648 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
649 | - $hautcadre=40; |
|
646 | + $posy = 42; |
|
647 | + $posx = $this->marge_gauche; |
|
648 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
649 | + $hautcadre = 40; |
|
650 | 650 | |
651 | 651 | // Show sender frame |
652 | - $pdf->SetTextColor(0,0,0); |
|
653 | - $pdf->SetFont('','', $default_font_size - 2); |
|
654 | - $pdf->SetXY($posx,$posy-5); |
|
655 | - $pdf->SetXY($posx,$posy); |
|
656 | - $pdf->SetFillColor(230,230,230); |
|
652 | + $pdf->SetTextColor(0, 0, 0); |
|
653 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
654 | + $pdf->SetXY($posx, $posy - 5); |
|
655 | + $pdf->SetXY($posx, $posy); |
|
656 | + $pdf->SetFillColor(230, 230, 230); |
|
657 | 657 | $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); |
658 | 658 | |
659 | 659 | // Show sender name |
660 | - $pdf->SetXY($posx+2,$posy+3); |
|
661 | - $pdf->SetTextColor(0,0,60); |
|
662 | - $pdf->SetFont('','B',$default_font_size); |
|
660 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
661 | + $pdf->SetTextColor(0, 0, 60); |
|
662 | + $pdf->SetFont('', 'B', $default_font_size); |
|
663 | 663 | $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); |
664 | - $posy=$pdf->getY(); |
|
664 | + $posy = $pdf->getY(); |
|
665 | 665 | |
666 | 666 | // Show sender information |
667 | - $pdf->SetFont('','', $default_font_size - 1); |
|
668 | - $pdf->SetXY($posx+2,$posy); |
|
667 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
668 | + $pdf->SetXY($posx + 2, $posy); |
|
669 | 669 | $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); |
670 | 670 | |
671 | 671 | |
672 | 672 | // If CUSTOMER contact defined, we use it |
673 | - $usecontact=false; |
|
674 | - $arrayidcontact=$object->getIdContact('external','CUSTOMER'); |
|
673 | + $usecontact = false; |
|
674 | + $arrayidcontact = $object->getIdContact('external', 'CUSTOMER'); |
|
675 | 675 | if (count($arrayidcontact) > 0) |
676 | 676 | { |
677 | - $usecontact=true; |
|
678 | - $result=$object->fetch_contact($arrayidcontact[0]); |
|
677 | + $usecontact = true; |
|
678 | + $result = $object->fetch_contact($arrayidcontact[0]); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | //Recipient name |
@@ -686,34 +686,34 @@ discard block |
||
686 | 686 | $thirdparty = $object->thirdparty; |
687 | 687 | } |
688 | 688 | |
689 | - $carac_client_name=pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
689 | + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
690 | 690 | |
691 | - $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target',$object); |
|
691 | + $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact) ? $object->contact : ''), $usecontact, 'target', $object); |
|
692 | 692 | |
693 | 693 | // Show recipient |
694 | - $widthrecbox=100; |
|
695 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
696 | - $posy=42; |
|
697 | - $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
|
698 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
694 | + $widthrecbox = 100; |
|
695 | + if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
696 | + $posy = 42; |
|
697 | + $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
|
698 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
699 | 699 | |
700 | 700 | // Show recipient frame |
701 | - $pdf->SetTextColor(0,0,0); |
|
702 | - $pdf->SetFont('','', $default_font_size - 2); |
|
703 | - $pdf->SetXY($posx+2,$posy-5); |
|
701 | + $pdf->SetTextColor(0, 0, 0); |
|
702 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
703 | + $pdf->SetXY($posx + 2, $posy - 5); |
|
704 | 704 | $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); |
705 | - $pdf->SetTextColor(0,0,0); |
|
705 | + $pdf->SetTextColor(0, 0, 0); |
|
706 | 706 | |
707 | 707 | // Show recipient name |
708 | - $pdf->SetXY($posx+2,$posy+3); |
|
709 | - $pdf->SetFont('','B', $default_font_size); |
|
708 | + $pdf->SetXY($posx + 2, $posy + 3); |
|
709 | + $pdf->SetFont('', 'B', $default_font_size); |
|
710 | 710 | $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); |
711 | 711 | |
712 | 712 | $posy = $pdf->getY(); |
713 | 713 | |
714 | 714 | // Show recipient information |
715 | - $pdf->SetFont('','', $default_font_size - 1); |
|
716 | - $pdf->SetXY($posx+2,$posy); |
|
715 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
716 | + $pdf->SetXY($posx + 2, $posy); |
|
717 | 717 | $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); |
718 | 718 | } |
719 | 719 | } |
@@ -727,10 +727,10 @@ discard block |
||
727 | 727 | * @param int $hidefreetext 1=Hide free text |
728 | 728 | * @return integer |
729 | 729 | */ |
730 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
730 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
731 | 731 | { |
732 | 732 | global $conf; |
733 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
734 | - return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
733 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
734 | + return pdf_pagefoot($pdf, $outputlangs, 'FICHINTER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
735 | 735 | } |
736 | 736 | } |
@@ -145,7 +145,10 @@ discard block |
||
145 | 145 | |
146 | 146 | // Get source company |
147 | 147 | $this->emetteur=$mysoc; |
148 | - if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if not defined |
|
148 | + if (empty($this->emetteur->country_code)) { |
|
149 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
150 | + } |
|
151 | + // By default, if not defined |
|
149 | 152 | |
150 | 153 | // Define position of columns |
151 | 154 | $this->posxdesc=$this->marge_gauche+1; |
@@ -168,9 +171,13 @@ discard block |
||
168 | 171 | // phpcs:enable |
169 | 172 | global $user,$langs,$conf,$mysoc,$db,$hookmanager; |
170 | 173 | |
171 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
174 | + if (! is_object($outputlangs)) { |
|
175 | + $outputlangs=$langs; |
|
176 | + } |
|
172 | 177 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
173 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
178 | + if (! empty($conf->global->MAIN_USE_FPDF)) { |
|
179 | + $outputlangs->charset_output='ISO-8859-1'; |
|
180 | + } |
|
174 | 181 | |
175 | 182 | // Load traductions files requiredby by page |
176 | 183 | $outputlangs->loadLangs(array("main", "interventions", "dict", "companies")); |
@@ -184,8 +191,7 @@ discard block |
||
184 | 191 | { |
185 | 192 | $dir = $conf->ficheinter->dir_output; |
186 | 193 | $file = $dir . "/SPECIMEN.pdf"; |
187 | - } |
|
188 | - else |
|
194 | + } else |
|
189 | 195 | { |
190 | 196 | $objectref = dol_sanitizeFileName($object->ref); |
191 | 197 | $dir = $conf->ficheinter->dir_output . "/" . $objectref; |
@@ -223,7 +229,9 @@ discard block |
||
223 | 229 | $heightforinfotot = 50; // Height reserved to output the info and total part |
224 | 230 | $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 |
225 | 231 | $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
226 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
232 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) { |
|
233 | + $heightforfooter+= 6; |
|
234 | + } |
|
227 | 235 | $pdf->SetAutoPageBreak(1,0); |
228 | 236 | |
229 | 237 | if (class_exists('TCPDF')) |
@@ -248,13 +256,17 @@ discard block |
||
248 | 256 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
249 | 257 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
250 | 258 | $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); |
251 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
259 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
260 | + $pdf->SetCompression(false); |
|
261 | + } |
|
252 | 262 | |
253 | 263 | $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
254 | 264 | |
255 | 265 | // New page |
256 | 266 | $pdf->AddPage(); |
257 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
267 | + if (! empty($tplidx)) { |
|
268 | + $pdf->useTemplate($tplidx); |
|
269 | + } |
|
258 | 270 | $pagenb++; |
259 | 271 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
260 | 272 | $pdf->SetFont('','', $default_font_size - 1); |
@@ -286,8 +298,7 @@ discard block |
||
286 | 298 | |
287 | 299 | $tab_height = $tab_height - $height_note; |
288 | 300 | $tab_top = $nexY+6; |
289 | - } |
|
290 | - else |
|
301 | + } else |
|
291 | 302 | { |
292 | 303 | $height_note=0; |
293 | 304 | } |
@@ -342,8 +353,7 @@ discard block |
||
342 | 353 | if (empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) |
343 | 354 | { |
344 | 355 | $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); |
345 | - } |
|
346 | - else |
|
356 | + } else |
|
347 | 357 | { |
348 | 358 | $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'day',false,$outputlangs,true); |
349 | 359 | } |
@@ -358,9 +368,11 @@ discard block |
||
358 | 368 | $pdf->startTransaction(); |
359 | 369 | $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); |
360 | 370 | $pageposafter=$pdf->getPage(); |
361 | - if ($pageposafter > $pageposbefore) // There is a pagebreak |
|
371 | + if ($pageposafter > $pageposbefore) { |
|
372 | + // There is a pagebreak |
|
362 | 373 | { |
363 | 374 | $pdf->rollbackTransaction(true); |
375 | + } |
|
364 | 376 | $pageposafter=$pageposbefore; |
365 | 377 | //print $pageposafter.'-'.$pageposbefore;exit; |
366 | 378 | $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. |
@@ -368,18 +380,23 @@ discard block |
||
368 | 380 | $pageposafter=$pdf->getPage(); |
369 | 381 | $posyafter=$pdf->GetY(); |
370 | 382 | //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; |
371 | - if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text |
|
383 | + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) { |
|
384 | + // There is no space left for total+free text |
|
372 | 385 | { |
373 | 386 | if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page |
374 | 387 | { |
375 | 388 | $pdf->AddPage('','',true); |
376 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
377 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
389 | + } |
|
390 | + if (! empty($tplidx)) { |
|
391 | + $pdf->useTemplate($tplidx); |
|
392 | + } |
|
393 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
394 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
395 | + } |
|
378 | 396 | $pdf->setPage($pageposafter+1); |
379 | 397 | } |
380 | 398 | } |
381 | - } |
|
382 | - else // No pagebreak |
|
399 | + } else // No pagebreak |
|
383 | 400 | { |
384 | 401 | $pdf->commitTransaction(); |
385 | 402 | } |
@@ -404,8 +421,7 @@ discard block |
||
404 | 421 | if ($pagenb == 1) |
405 | 422 | { |
406 | 423 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
407 | - } |
|
408 | - else |
|
424 | + } else |
|
409 | 425 | { |
410 | 426 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
411 | 427 | } |
@@ -413,24 +429,29 @@ discard block |
||
413 | 429 | $pagenb++; |
414 | 430 | $pdf->setPage($pagenb); |
415 | 431 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
416 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
432 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
433 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
434 | + } |
|
417 | 435 | } |
418 | 436 | if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) |
419 | 437 | { |
420 | 438 | if ($pagenb == 1) |
421 | 439 | { |
422 | 440 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); |
423 | - } |
|
424 | - else |
|
441 | + } else |
|
425 | 442 | { |
426 | 443 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); |
427 | 444 | } |
428 | 445 | $this->_pagefoot($pdf,$object,$outputlangs,1); |
429 | 446 | // New page |
430 | 447 | $pdf->AddPage(); |
431 | - if (! empty($tplidx)) $pdf->useTemplate($tplidx); |
|
448 | + if (! empty($tplidx)) { |
|
449 | + $pdf->useTemplate($tplidx); |
|
450 | + } |
|
432 | 451 | $pagenb++; |
433 | - if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
452 | + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { |
|
453 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
454 | + } |
|
434 | 455 | } |
435 | 456 | } |
436 | 457 | } |
@@ -440,15 +461,16 @@ discard block |
||
440 | 461 | { |
441 | 462 | $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); |
442 | 463 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
443 | - } |
|
444 | - else |
|
464 | + } else |
|
445 | 465 | { |
446 | 466 | $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); |
447 | 467 | $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; |
448 | 468 | } |
449 | 469 | |
450 | 470 | $this->_pagefoot($pdf,$object,$outputlangs); |
451 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
471 | + if (method_exists($pdf,'AliasNbPages')) { |
|
472 | + $pdf->AliasNbPages(); |
|
473 | + } |
|
452 | 474 | |
453 | 475 | $pdf->Close(); |
454 | 476 | $pdf->Output($file,'F'); |
@@ -459,20 +481,19 @@ discard block |
||
459 | 481 | global $action; |
460 | 482 | $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
461 | 483 | |
462 | - if (! empty($conf->global->MAIN_UMASK)) |
|
463 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
484 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
485 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
486 | + } |
|
464 | 487 | |
465 | 488 | $this->result = array('fullpath'=>$file); |
466 | 489 | |
467 | 490 | return 1; |
468 | - } |
|
469 | - else |
|
491 | + } else |
|
470 | 492 | { |
471 | 493 | $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); |
472 | 494 | return 0; |
473 | 495 | } |
474 | - } |
|
475 | - else |
|
496 | + } else |
|
476 | 497 | { |
477 | 498 | $this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR"); |
478 | 499 | return 0; |
@@ -584,16 +605,14 @@ discard block |
||
584 | 605 | { |
585 | 606 | $height=pdf_getHeightForLogo($logo); |
586 | 607 | $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) |
587 | - } |
|
588 | - else |
|
608 | + } else |
|
589 | 609 | { |
590 | 610 | $pdf->SetTextColor(200,0,0); |
591 | 611 | $pdf->SetFont('','B',$default_font_size - 2); |
592 | 612 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); |
593 | 613 | $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); |
594 | 614 | } |
595 | - } |
|
596 | - else |
|
615 | + } else |
|
597 | 616 | { |
598 | 617 | $text=$this->emetteur->name; |
599 | 618 | $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); |
@@ -645,7 +664,9 @@ discard block |
||
645 | 664 | // Show sender |
646 | 665 | $posy=42; |
647 | 666 | $posx=$this->marge_gauche; |
648 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; |
|
667 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
668 | + $posx=$this->page_largeur-$this->marge_droite-80; |
|
669 | + } |
|
649 | 670 | $hautcadre=40; |
650 | 671 | |
651 | 672 | // Show sender frame |
@@ -692,10 +713,15 @@ discard block |
||
692 | 713 | |
693 | 714 | // Show recipient |
694 | 715 | $widthrecbox=100; |
695 | - if ($this->page_largeur < 210) $widthrecbox=84; // To work with US executive format |
|
716 | + if ($this->page_largeur < 210) { |
|
717 | + $widthrecbox=84; |
|
718 | + } |
|
719 | + // To work with US executive format |
|
696 | 720 | $posy=42; |
697 | 721 | $posx=$this->page_largeur-$this->marge_droite-$widthrecbox; |
698 | - if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; |
|
722 | + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
723 | + $posx=$this->marge_gauche; |
|
724 | + } |
|
699 | 725 | |
700 | 726 | // Show recipient frame |
701 | 727 | $pdf->SetTextColor(0,0,0); |
@@ -34,132 +34,132 @@ |
||
34 | 34 | * Dolibarr version of the loaded document |
35 | 35 | * @public string |
36 | 36 | */ |
37 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
38 | 38 | |
39 | - public $prefix='FI'; |
|
39 | + public $prefix='FI'; |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var string Error code (or message) |
|
43 | - */ |
|
44 | - public $error=''; |
|
41 | + /** |
|
42 | + * @var string Error code (or message) |
|
43 | + */ |
|
44 | + public $error=''; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var string Nom du modele |
|
48 | - * @deprecated |
|
49 | - * @see name |
|
50 | - */ |
|
51 | - public $nom='pacific'; |
|
46 | + /** |
|
47 | + * @var string Nom du modele |
|
48 | + * @deprecated |
|
49 | + * @see name |
|
50 | + */ |
|
51 | + public $nom='pacific'; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @var string model name |
|
55 | - */ |
|
56 | - public $name='pacific'; |
|
53 | + /** |
|
54 | + * @var string model name |
|
55 | + */ |
|
56 | + public $name='pacific'; |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Return description of numbering module |
|
61 | - * |
|
59 | + /** |
|
60 | + * Return description of numbering module |
|
61 | + * |
|
62 | 62 | * @return string Text with description |
63 | 63 | */ |
64 | 64 | function info() |
65 | 65 | { |
66 | - global $langs; |
|
67 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
66 | + global $langs; |
|
67 | + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Renvoi un exemple de numerotation |
|
72 | + * |
|
73 | + * @return string Example |
|
74 | + */ |
|
75 | + function getExample() |
|
76 | + { |
|
77 | + return $this->prefix."0501-0001"; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
82 | + * de conflits qui empechera cette numerotation de fonctionner. |
|
83 | + * |
|
84 | + * @return boolean false si conflit, true si ok |
|
85 | + */ |
|
86 | + function canBeActivated() |
|
87 | + { |
|
88 | + global $langs,$conf,$db; |
|
89 | + |
|
90 | + $langs->load("bills"); |
|
91 | + |
|
92 | + $fayymm=''; $max=''; |
|
93 | + |
|
94 | + $posindice=8; |
|
95 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
96 | + $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
97 | + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | + $sql.= " WHERE entity = ".$conf->entity; |
|
99 | + |
|
100 | + $resql=$db->query($sql); |
|
101 | + if ($resql) |
|
102 | + { |
|
103 | + $row = $db->fetch_row($resql); |
|
104 | + if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; } |
|
105 | + } |
|
106 | + if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm)) |
|
107 | + { |
|
108 | + return true; |
|
109 | + } |
|
110 | + else |
|
111 | + { |
|
112 | + $langs->load("errors"); |
|
113 | + $this->error=$langs->trans('ErrorNumRefModel',$max); |
|
114 | + return false; |
|
115 | + } |
|
68 | 116 | } |
69 | 117 | |
70 | - /** |
|
71 | - * Renvoi un exemple de numerotation |
|
72 | - * |
|
73 | - * @return string Example |
|
74 | - */ |
|
75 | - function getExample() |
|
76 | - { |
|
77 | - return $this->prefix."0501-0001"; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
82 | - * de conflits qui empechera cette numerotation de fonctionner. |
|
83 | - * |
|
84 | - * @return boolean false si conflit, true si ok |
|
85 | - */ |
|
86 | - function canBeActivated() |
|
87 | - { |
|
88 | - global $langs,$conf,$db; |
|
89 | - |
|
90 | - $langs->load("bills"); |
|
91 | - |
|
92 | - $fayymm=''; $max=''; |
|
93 | - |
|
94 | - $posindice=8; |
|
95 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
96 | - $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
97 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | - $sql.= " WHERE entity = ".$conf->entity; |
|
99 | - |
|
100 | - $resql=$db->query($sql); |
|
101 | - if ($resql) |
|
102 | - { |
|
103 | - $row = $db->fetch_row($resql); |
|
104 | - if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; } |
|
105 | - } |
|
106 | - if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm)) |
|
107 | - { |
|
108 | - return true; |
|
109 | - } |
|
110 | - else |
|
111 | - { |
|
112 | - $langs->load("errors"); |
|
113 | - $this->error=$langs->trans('ErrorNumRefModel',$max); |
|
114 | - return false; |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Return next free value |
|
120 | - * |
|
121 | - * @param Societe $objsoc Object thirdparty |
|
122 | - * @param Object $object Object we need next value for |
|
123 | - * @return string Value if KO, <0 if KO |
|
124 | - */ |
|
125 | - function getNextValue($objsoc=0,$object='') |
|
126 | - { |
|
127 | - global $db,$conf; |
|
128 | - |
|
129 | - // D'abord on recupere la valeur max |
|
130 | - $posindice=8; |
|
131 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
132 | - $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
133 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | - $sql.= " AND entity = ".$conf->entity; |
|
135 | - |
|
136 | - $resql=$db->query($sql); |
|
137 | - if ($resql) |
|
138 | - { |
|
139 | - $obj = $db->fetch_object($resql); |
|
140 | - if ($obj) $max = intval($obj->max); |
|
141 | - else $max=0; |
|
142 | - } |
|
143 | - |
|
144 | - //$date=time(); |
|
145 | - $date=$object->datec; |
|
146 | - $yymm = strftime("%y%m",$date); |
|
147 | - |
|
148 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | - else $num = sprintf("%04s",$max+1); |
|
150 | - |
|
151 | - return $this->prefix.$yymm."-".$num; |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Return next free value |
|
156 | - * |
|
157 | - * @param Societe $objsoc Object third party |
|
158 | - * @param Object $objforref Object for number to search |
|
159 | - * @return string Next free value |
|
160 | - */ |
|
161 | - function getNumRef($objsoc,$objforref) |
|
162 | - { |
|
163 | - return $this->getNextValue($objsoc,$objforref); |
|
164 | - } |
|
118 | + /** |
|
119 | + * Return next free value |
|
120 | + * |
|
121 | + * @param Societe $objsoc Object thirdparty |
|
122 | + * @param Object $object Object we need next value for |
|
123 | + * @return string Value if KO, <0 if KO |
|
124 | + */ |
|
125 | + function getNextValue($objsoc=0,$object='') |
|
126 | + { |
|
127 | + global $db,$conf; |
|
128 | + |
|
129 | + // D'abord on recupere la valeur max |
|
130 | + $posindice=8; |
|
131 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
132 | + $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
133 | + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | + $sql.= " AND entity = ".$conf->entity; |
|
135 | + |
|
136 | + $resql=$db->query($sql); |
|
137 | + if ($resql) |
|
138 | + { |
|
139 | + $obj = $db->fetch_object($resql); |
|
140 | + if ($obj) $max = intval($obj->max); |
|
141 | + else $max=0; |
|
142 | + } |
|
143 | + |
|
144 | + //$date=time(); |
|
145 | + $date=$object->datec; |
|
146 | + $yymm = strftime("%y%m",$date); |
|
147 | + |
|
148 | + if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | + else $num = sprintf("%04s",$max+1); |
|
150 | + |
|
151 | + return $this->prefix.$yymm."-".$num; |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Return next free value |
|
156 | + * |
|
157 | + * @param Societe $objsoc Object third party |
|
158 | + * @param Object $objforref Object for number to search |
|
159 | + * @return string Next free value |
|
160 | + */ |
|
161 | + function getNumRef($objsoc,$objforref) |
|
162 | + { |
|
163 | + return $this->getNextValue($objsoc,$objforref); |
|
164 | + } |
|
165 | 165 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup fiche intervention |
24 | 24 | * \brief File with Pacific numbering module for interventions |
25 | 25 | */ |
26 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php'; |
|
26 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Class to manage numbering of intervention cards with rule Pacific. |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | * Dolibarr version of the loaded document |
35 | 35 | * @public string |
36 | 36 | */ |
37 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
38 | 38 | |
39 | - public $prefix='FI'; |
|
39 | + public $prefix = 'FI'; |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @var string Error code (or message) |
43 | 43 | */ |
44 | - public $error=''; |
|
44 | + public $error = ''; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var string Nom du modele |
48 | 48 | * @deprecated |
49 | 49 | * @see name |
50 | 50 | */ |
51 | - public $nom='pacific'; |
|
51 | + public $nom = 'pacific'; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @var string model name |
55 | 55 | */ |
56 | - public $name='pacific'; |
|
56 | + public $name = 'pacific'; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | function info() |
65 | 65 | { |
66 | 66 | global $langs; |
67 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
67 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -85,32 +85,32 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function canBeActivated() |
87 | 87 | { |
88 | - global $langs,$conf,$db; |
|
88 | + global $langs, $conf, $db; |
|
89 | 89 | |
90 | 90 | $langs->load("bills"); |
91 | 91 | |
92 | - $fayymm=''; $max=''; |
|
92 | + $fayymm = ''; $max = ''; |
|
93 | 93 | |
94 | - $posindice=8; |
|
94 | + $posindice = 8; |
|
95 | 95 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
96 | - $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
97 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | - $sql.= " WHERE entity = ".$conf->entity; |
|
96 | + $sql .= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
97 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
98 | + $sql .= " WHERE entity = ".$conf->entity; |
|
99 | 99 | |
100 | - $resql=$db->query($sql); |
|
100 | + $resql = $db->query($sql); |
|
101 | 101 | if ($resql) |
102 | 102 | { |
103 | 103 | $row = $db->fetch_row($resql); |
104 | - if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; } |
|
104 | + if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
105 | 105 | } |
106 | - if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm)) |
|
106 | + if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) |
|
107 | 107 | { |
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
112 | 112 | $langs->load("errors"); |
113 | - $this->error=$langs->trans('ErrorNumRefModel',$max); |
|
113 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | } |
@@ -122,31 +122,31 @@ discard block |
||
122 | 122 | * @param Object $object Object we need next value for |
123 | 123 | * @return string Value if KO, <0 if KO |
124 | 124 | */ |
125 | - function getNextValue($objsoc=0,$object='') |
|
125 | + function getNextValue($objsoc = 0, $object = '') |
|
126 | 126 | { |
127 | - global $db,$conf; |
|
127 | + global $db, $conf; |
|
128 | 128 | |
129 | 129 | // D'abord on recupere la valeur max |
130 | - $posindice=8; |
|
130 | + $posindice = 8; |
|
131 | 131 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
132 | - $sql.= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
133 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | - $sql.= " AND entity = ".$conf->entity; |
|
132 | + $sql .= " FROM ".MAIN_DB_PREFIX."fichinter"; |
|
133 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
134 | + $sql .= " AND entity = ".$conf->entity; |
|
135 | 135 | |
136 | - $resql=$db->query($sql); |
|
136 | + $resql = $db->query($sql); |
|
137 | 137 | if ($resql) |
138 | 138 | { |
139 | 139 | $obj = $db->fetch_object($resql); |
140 | 140 | if ($obj) $max = intval($obj->max); |
141 | - else $max=0; |
|
141 | + else $max = 0; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | //$date=time(); |
145 | - $date=$object->datec; |
|
146 | - $yymm = strftime("%y%m",$date); |
|
145 | + $date = $object->datec; |
|
146 | + $yymm = strftime("%y%m", $date); |
|
147 | 147 | |
148 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | - else $num = sprintf("%04s",$max+1); |
|
148 | + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | + else $num = sprintf("%04s", $max + 1); |
|
150 | 150 | |
151 | 151 | return $this->prefix.$yymm."-".$num; |
152 | 152 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @param Object $objforref Object for number to search |
159 | 159 | * @return string Next free value |
160 | 160 | */ |
161 | - function getNumRef($objsoc,$objforref) |
|
161 | + function getNumRef($objsoc, $objforref) |
|
162 | 162 | { |
163 | - return $this->getNextValue($objsoc,$objforref); |
|
163 | + return $this->getNextValue($objsoc, $objforref); |
|
164 | 164 | } |
165 | 165 | } |
@@ -106,8 +106,7 @@ discard block |
||
106 | 106 | if (! $fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm)) |
107 | 107 | { |
108 | 108 | return true; |
109 | - } |
|
110 | - else |
|
109 | + } else |
|
111 | 110 | { |
112 | 111 | $langs->load("errors"); |
113 | 112 | $this->error=$langs->trans('ErrorNumRefModel',$max); |
@@ -137,16 +136,24 @@ discard block |
||
137 | 136 | if ($resql) |
138 | 137 | { |
139 | 138 | $obj = $db->fetch_object($resql); |
140 | - if ($obj) $max = intval($obj->max); |
|
141 | - else $max=0; |
|
139 | + if ($obj) { |
|
140 | + $max = intval($obj->max); |
|
141 | + } else { |
|
142 | + $max=0; |
|
143 | + } |
|
142 | 144 | } |
143 | 145 | |
144 | 146 | //$date=time(); |
145 | 147 | $date=$object->datec; |
146 | 148 | $yymm = strftime("%y%m",$date); |
147 | 149 | |
148 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
149 | - else $num = sprintf("%04s",$max+1); |
|
150 | + if ($max >= (pow(10, 4) - 1)) { |
|
151 | + $num=$max+1; |
|
152 | + } |
|
153 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
154 | + else { |
|
155 | + $num = sprintf("%04s",$max+1); |
|
156 | + } |
|
150 | 157 | |
151 | 158 | return $this->prefix.$yymm."-".$num; |
152 | 159 | } |
@@ -34,33 +34,33 @@ discard block |
||
34 | 34 | */ |
35 | 35 | abstract class ModelePDFFicheinter extends CommonDocGenerator |
36 | 36 | { |
37 | - /** |
|
38 | - * @var string Error code (or message) |
|
39 | - */ |
|
40 | - public $error=''; |
|
37 | + /** |
|
38 | + * @var string Error code (or message) |
|
39 | + */ |
|
40 | + public $error=''; |
|
41 | 41 | |
42 | 42 | |
43 | 43 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
44 | - /** |
|
45 | - * Return list of active generation modules |
|
46 | - * |
|
44 | + /** |
|
45 | + * Return list of active generation modules |
|
46 | + * |
|
47 | 47 | * @param DoliDB $db Database handler |
48 | 48 | * @param integer $maxfilenamelength Max length of value to show |
49 | 49 | * @return array List of templates |
50 | - */ |
|
51 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
52 | - { |
|
50 | + */ |
|
51 | + static function liste_modeles($db,$maxfilenamelength=0) |
|
52 | + { |
|
53 | 53 | // phpcs:enable |
54 | - global $conf; |
|
54 | + global $conf; |
|
55 | 55 | |
56 | - $type='ficheinter'; |
|
57 | - $liste=array(); |
|
56 | + $type='ficheinter'; |
|
57 | + $liste=array(); |
|
58 | 58 | |
59 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
60 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
59 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
60 | + $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
61 | 61 | |
62 | - return $liste; |
|
63 | - } |
|
62 | + return $liste; |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -69,83 +69,83 @@ discard block |
||
69 | 69 | */ |
70 | 70 | abstract class ModeleNumRefFicheinter |
71 | 71 | { |
72 | - /** |
|
73 | - * @var string Error code (or message) |
|
74 | - */ |
|
75 | - public $error=''; |
|
76 | - |
|
77 | - /** |
|
78 | - * Return if a module can be used or not |
|
79 | - * |
|
80 | - * @return boolean true if module can be used |
|
81 | - */ |
|
82 | - function isEnabled() |
|
83 | - { |
|
84 | - return true; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Renvoi la description par defaut du modele de numerotation |
|
89 | - * |
|
90 | - * @return string Texte descripif |
|
91 | - */ |
|
92 | - function info() |
|
93 | - { |
|
94 | - global $langs; |
|
95 | - $langs->load("ficheinter"); |
|
96 | - return $langs->trans("NoDescription"); |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Renvoi un exemple de numerotation |
|
101 | - * |
|
102 | - * @return string Example |
|
103 | - */ |
|
104 | - function getExample() |
|
105 | - { |
|
106 | - global $langs; |
|
107 | - $langs->load("ficheinter"); |
|
108 | - return $langs->trans("NoExample"); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
113 | - * de conflits qui empechera cette numerotation de fonctionner. |
|
114 | - * |
|
115 | - * @return boolean false si conflit, true si ok |
|
116 | - */ |
|
117 | - function canBeActivated() |
|
118 | - { |
|
119 | - return true; |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Renvoi prochaine valeur attribuee |
|
124 | - * |
|
125 | - * @return string Valeur |
|
126 | - */ |
|
127 | - function getNextValue() |
|
128 | - { |
|
129 | - global $langs; |
|
130 | - return $langs->trans("NotAvailable"); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Renvoi version du module numerotation |
|
135 | - * |
|
136 | - * @return string Valeur |
|
137 | - */ |
|
138 | - function getVersion() |
|
139 | - { |
|
140 | - global $langs; |
|
141 | - $langs->load("admin"); |
|
142 | - |
|
143 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
144 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
145 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
146 | - if ($this->version) return $this->version; |
|
147 | - return $langs->trans("NotAvailable"); |
|
148 | - } |
|
72 | + /** |
|
73 | + * @var string Error code (or message) |
|
74 | + */ |
|
75 | + public $error=''; |
|
76 | + |
|
77 | + /** |
|
78 | + * Return if a module can be used or not |
|
79 | + * |
|
80 | + * @return boolean true if module can be used |
|
81 | + */ |
|
82 | + function isEnabled() |
|
83 | + { |
|
84 | + return true; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Renvoi la description par defaut du modele de numerotation |
|
89 | + * |
|
90 | + * @return string Texte descripif |
|
91 | + */ |
|
92 | + function info() |
|
93 | + { |
|
94 | + global $langs; |
|
95 | + $langs->load("ficheinter"); |
|
96 | + return $langs->trans("NoDescription"); |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Renvoi un exemple de numerotation |
|
101 | + * |
|
102 | + * @return string Example |
|
103 | + */ |
|
104 | + function getExample() |
|
105 | + { |
|
106 | + global $langs; |
|
107 | + $langs->load("ficheinter"); |
|
108 | + return $langs->trans("NoExample"); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Test si les numeros deja en vigueur dans la base ne provoquent pas de |
|
113 | + * de conflits qui empechera cette numerotation de fonctionner. |
|
114 | + * |
|
115 | + * @return boolean false si conflit, true si ok |
|
116 | + */ |
|
117 | + function canBeActivated() |
|
118 | + { |
|
119 | + return true; |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Renvoi prochaine valeur attribuee |
|
124 | + * |
|
125 | + * @return string Valeur |
|
126 | + */ |
|
127 | + function getNextValue() |
|
128 | + { |
|
129 | + global $langs; |
|
130 | + return $langs->trans("NotAvailable"); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Renvoi version du module numerotation |
|
135 | + * |
|
136 | + * @return string Valeur |
|
137 | + */ |
|
138 | + function getVersion() |
|
139 | + { |
|
140 | + global $langs; |
|
141 | + $langs->load("admin"); |
|
142 | + |
|
143 | + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
144 | + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
145 | + if ($this->version == 'dolibarr') return DOL_VERSION; |
|
146 | + if ($this->version) return $this->version; |
|
147 | + return $langs->trans("NotAvailable"); |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -165,86 +165,86 @@ discard block |
||
165 | 165 | function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
166 | 166 | { |
167 | 167 | // phpcs:enable |
168 | - global $conf,$langs,$user; |
|
169 | - $langs->load("ficheinter"); |
|
170 | - |
|
171 | - $error=0; |
|
172 | - |
|
173 | - $srctemplatepath=''; |
|
174 | - |
|
175 | - // Positionne modele sur le nom du modele de fichinter a utiliser |
|
176 | - if (! dol_strlen($modele)) |
|
177 | - { |
|
178 | - if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
179 | - { |
|
180 | - $modele = $conf->global->FICHEINTER_ADDON_PDF; |
|
181 | - } |
|
182 | - else |
|
183 | - { |
|
184 | - $modele = 'soleil'; |
|
185 | - } |
|
186 | - } |
|
187 | - |
|
188 | - // If selected modele is a filename template (then $modele="modelname:filename") |
|
189 | - $tmp=explode(':',$modele,2); |
|
168 | + global $conf,$langs,$user; |
|
169 | + $langs->load("ficheinter"); |
|
170 | + |
|
171 | + $error=0; |
|
172 | + |
|
173 | + $srctemplatepath=''; |
|
174 | + |
|
175 | + // Positionne modele sur le nom du modele de fichinter a utiliser |
|
176 | + if (! dol_strlen($modele)) |
|
177 | + { |
|
178 | + if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
179 | + { |
|
180 | + $modele = $conf->global->FICHEINTER_ADDON_PDF; |
|
181 | + } |
|
182 | + else |
|
183 | + { |
|
184 | + $modele = 'soleil'; |
|
185 | + } |
|
186 | + } |
|
187 | + |
|
188 | + // If selected modele is a filename template (then $modele="modelname:filename") |
|
189 | + $tmp=explode(':',$modele,2); |
|
190 | 190 | if (! empty($tmp[1])) |
191 | 191 | { |
192 | 192 | $modele=$tmp[0]; |
193 | 193 | $srctemplatepath=$tmp[1]; |
194 | 194 | } |
195 | 195 | |
196 | - // Search template files |
|
197 | - $file=''; $classname=''; $filefound=0; |
|
198 | - $dirmodels=array('/'); |
|
199 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
200 | - foreach($dirmodels as $reldir) |
|
201 | - { |
|
202 | - foreach(array('doc','pdf') as $prefix) |
|
203 | - { |
|
204 | - $file = $prefix."_".$modele.".modules.php"; |
|
205 | - |
|
206 | - // On verifie l'emplacement du modele |
|
207 | - $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
208 | - if (file_exists($file)) |
|
209 | - { |
|
210 | - $filefound=1; |
|
211 | - $classname=$prefix.'_'.$modele; |
|
212 | - break; |
|
213 | - } |
|
214 | - } |
|
215 | - if ($filefound) break; |
|
196 | + // Search template files |
|
197 | + $file=''; $classname=''; $filefound=0; |
|
198 | + $dirmodels=array('/'); |
|
199 | + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
200 | + foreach($dirmodels as $reldir) |
|
201 | + { |
|
202 | + foreach(array('doc','pdf') as $prefix) |
|
203 | + { |
|
204 | + $file = $prefix."_".$modele.".modules.php"; |
|
205 | + |
|
206 | + // On verifie l'emplacement du modele |
|
207 | + $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
208 | + if (file_exists($file)) |
|
209 | + { |
|
210 | + $filefound=1; |
|
211 | + $classname=$prefix.'_'.$modele; |
|
212 | + break; |
|
213 | + } |
|
214 | + } |
|
215 | + if ($filefound) break; |
|
216 | 216 | } |
217 | 217 | |
218 | - // Charge le modele |
|
219 | - if ($filefound) |
|
220 | - { |
|
221 | - require_once $file; |
|
222 | - |
|
223 | - $obj = new $classname($db); |
|
224 | - |
|
225 | - // We save charset_output to restore it because write_file can change it if needed for |
|
226 | - // output format that does not support UTF8. |
|
227 | - $sav_charset_output=$outputlangs->charset_output; |
|
228 | - if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
229 | - { |
|
230 | - $outputlangs->charset_output=$sav_charset_output; |
|
231 | - |
|
232 | - // We delete old preview |
|
233 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
234 | - dol_delete_preview($object); |
|
235 | - |
|
236 | - return 1; |
|
237 | - } |
|
238 | - else |
|
239 | - { |
|
240 | - $outputlangs->charset_output=$sav_charset_output; |
|
241 | - dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
|
242 | - return 0; |
|
243 | - } |
|
244 | - } |
|
245 | - else |
|
246 | - { |
|
247 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
248 | - return 0; |
|
249 | - } |
|
218 | + // Charge le modele |
|
219 | + if ($filefound) |
|
220 | + { |
|
221 | + require_once $file; |
|
222 | + |
|
223 | + $obj = new $classname($db); |
|
224 | + |
|
225 | + // We save charset_output to restore it because write_file can change it if needed for |
|
226 | + // output format that does not support UTF8. |
|
227 | + $sav_charset_output=$outputlangs->charset_output; |
|
228 | + if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
|
229 | + { |
|
230 | + $outputlangs->charset_output=$sav_charset_output; |
|
231 | + |
|
232 | + // We delete old preview |
|
233 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
234 | + dol_delete_preview($object); |
|
235 | + |
|
236 | + return 1; |
|
237 | + } |
|
238 | + else |
|
239 | + { |
|
240 | + $outputlangs->charset_output=$sav_charset_output; |
|
241 | + dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
|
242 | + return 0; |
|
243 | + } |
|
244 | + } |
|
245 | + else |
|
246 | + { |
|
247 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
248 | + return 0; |
|
249 | + } |
|
250 | 250 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** |
38 | 38 | * @var string Error code (or message) |
39 | 39 | */ |
40 | - public $error=''; |
|
40 | + public $error = ''; |
|
41 | 41 | |
42 | 42 | |
43 | 43 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -48,16 +48,16 @@ discard block |
||
48 | 48 | * @param integer $maxfilenamelength Max length of value to show |
49 | 49 | * @return array List of templates |
50 | 50 | */ |
51 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
51 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
52 | 52 | { |
53 | 53 | // phpcs:enable |
54 | 54 | global $conf; |
55 | 55 | |
56 | - $type='ficheinter'; |
|
57 | - $liste=array(); |
|
56 | + $type = 'ficheinter'; |
|
57 | + $liste = array(); |
|
58 | 58 | |
59 | 59 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
60 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
60 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
61 | 61 | |
62 | 62 | return $liste; |
63 | 63 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @var string Error code (or message) |
74 | 74 | */ |
75 | - public $error=''; |
|
75 | + public $error = ''; |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Return if a module can be used or not |
@@ -162,20 +162,20 @@ discard block |
||
162 | 162 | * @param int $hideref Hide ref |
163 | 163 | * @return int 0 if KO, 1 if OK |
164 | 164 | */ |
165 | -function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
165 | +function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
166 | 166 | { |
167 | 167 | // phpcs:enable |
168 | - global $conf,$langs,$user; |
|
168 | + global $conf, $langs, $user; |
|
169 | 169 | $langs->load("ficheinter"); |
170 | 170 | |
171 | - $error=0; |
|
171 | + $error = 0; |
|
172 | 172 | |
173 | - $srctemplatepath=''; |
|
173 | + $srctemplatepath = ''; |
|
174 | 174 | |
175 | 175 | // Positionne modele sur le nom du modele de fichinter a utiliser |
176 | - if (! dol_strlen($modele)) |
|
176 | + if (!dol_strlen($modele)) |
|
177 | 177 | { |
178 | - if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
178 | + if (!empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
179 | 179 | { |
180 | 180 | $modele = $conf->global->FICHEINTER_ADDON_PDF; |
181 | 181 | } |
@@ -186,29 +186,29 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | // If selected modele is a filename template (then $modele="modelname:filename") |
189 | - $tmp=explode(':',$modele,2); |
|
190 | - if (! empty($tmp[1])) |
|
189 | + $tmp = explode(':', $modele, 2); |
|
190 | + if (!empty($tmp[1])) |
|
191 | 191 | { |
192 | - $modele=$tmp[0]; |
|
193 | - $srctemplatepath=$tmp[1]; |
|
192 | + $modele = $tmp[0]; |
|
193 | + $srctemplatepath = $tmp[1]; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Search template files |
197 | - $file=''; $classname=''; $filefound=0; |
|
198 | - $dirmodels=array('/'); |
|
199 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
200 | - foreach($dirmodels as $reldir) |
|
197 | + $file = ''; $classname = ''; $filefound = 0; |
|
198 | + $dirmodels = array('/'); |
|
199 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
200 | + foreach ($dirmodels as $reldir) |
|
201 | 201 | { |
202 | - foreach(array('doc','pdf') as $prefix) |
|
202 | + foreach (array('doc', 'pdf') as $prefix) |
|
203 | 203 | { |
204 | 204 | $file = $prefix."_".$modele.".modules.php"; |
205 | 205 | |
206 | 206 | // On verifie l'emplacement du modele |
207 | - $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
207 | + $file = dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0); |
|
208 | 208 | if (file_exists($file)) |
209 | 209 | { |
210 | - $filefound=1; |
|
211 | - $classname=$prefix.'_'.$modele; |
|
210 | + $filefound = 1; |
|
211 | + $classname = $prefix.'_'.$modele; |
|
212 | 212 | break; |
213 | 213 | } |
214 | 214 | } |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | |
225 | 225 | // We save charset_output to restore it because write_file can change it if needed for |
226 | 226 | // output format that does not support UTF8. |
227 | - $sav_charset_output=$outputlangs->charset_output; |
|
227 | + $sav_charset_output = $outputlangs->charset_output; |
|
228 | 228 | if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
229 | 229 | { |
230 | - $outputlangs->charset_output=$sav_charset_output; |
|
230 | + $outputlangs->charset_output = $sav_charset_output; |
|
231 | 231 | |
232 | 232 | // We delete old preview |
233 | 233 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | } |
238 | 238 | else |
239 | 239 | { |
240 | - $outputlangs->charset_output=$sav_charset_output; |
|
241 | - dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
|
240 | + $outputlangs->charset_output = $sav_charset_output; |
|
241 | + dol_print_error($db, "fichinter_pdf_create Error: ".$obj->error); |
|
242 | 242 | return 0; |
243 | 243 | } |
244 | 244 | } |
245 | 245 | else |
246 | 246 | { |
247 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
247 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); |
|
248 | 248 | return 0; |
249 | 249 | } |
250 | 250 | } |
@@ -140,10 +140,18 @@ discard block |
||
140 | 140 | global $langs; |
141 | 141 | $langs->load("admin"); |
142 | 142 | |
143 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
144 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
145 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
146 | - if ($this->version) return $this->version; |
|
143 | + if ($this->version == 'development') { |
|
144 | + return $langs->trans("VersionDevelopment"); |
|
145 | + } |
|
146 | + if ($this->version == 'experimental') { |
|
147 | + return $langs->trans("VersionExperimental"); |
|
148 | + } |
|
149 | + if ($this->version == 'dolibarr') { |
|
150 | + return DOL_VERSION; |
|
151 | + } |
|
152 | + if ($this->version) { |
|
153 | + return $this->version; |
|
154 | + } |
|
147 | 155 | return $langs->trans("NotAvailable"); |
148 | 156 | } |
149 | 157 | } |
@@ -178,8 +186,7 @@ discard block |
||
178 | 186 | if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
179 | 187 | { |
180 | 188 | $modele = $conf->global->FICHEINTER_ADDON_PDF; |
181 | - } |
|
182 | - else |
|
189 | + } else |
|
183 | 190 | { |
184 | 191 | $modele = 'soleil'; |
185 | 192 | } |
@@ -196,7 +203,9 @@ discard block |
||
196 | 203 | // Search template files |
197 | 204 | $file=''; $classname=''; $filefound=0; |
198 | 205 | $dirmodels=array('/'); |
199 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
206 | + if (is_array($conf->modules_parts['models'])) { |
|
207 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
208 | + } |
|
200 | 209 | foreach($dirmodels as $reldir) |
201 | 210 | { |
202 | 211 | foreach(array('doc','pdf') as $prefix) |
@@ -212,7 +221,9 @@ discard block |
||
212 | 221 | break; |
213 | 222 | } |
214 | 223 | } |
215 | - if ($filefound) break; |
|
224 | + if ($filefound) { |
|
225 | + break; |
|
226 | + } |
|
216 | 227 | } |
217 | 228 | |
218 | 229 | // Charge le modele |
@@ -234,15 +245,13 @@ discard block |
||
234 | 245 | dol_delete_preview($object); |
235 | 246 | |
236 | 247 | return 1; |
237 | - } |
|
238 | - else |
|
248 | + } else |
|
239 | 249 | { |
240 | 250 | $outputlangs->charset_output=$sav_charset_output; |
241 | 251 | dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
242 | 252 | return 0; |
243 | 253 | } |
244 | - } |
|
245 | - else |
|
254 | + } else |
|
246 | 255 | { |
247 | 256 | print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
248 | 257 | return 0; |
@@ -32,68 +32,68 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class mod_arctic extends ModeleNumRefFicheinter |
34 | 34 | { |
35 | - /** |
|
35 | + /** |
|
36 | 36 | * Dolibarr version of the loaded document |
37 | 37 | * @public string |
38 | 38 | */ |
39 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
39 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
40 | 40 | |
41 | - /** |
|
42 | - * @var string Error message |
|
43 | - */ |
|
44 | - public $error = ''; |
|
41 | + /** |
|
42 | + * @var string Error message |
|
43 | + */ |
|
44 | + public $error = ''; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var string Nom du modele |
|
48 | - * @deprecated |
|
49 | - * @see name |
|
50 | - */ |
|
51 | - public $nom='arctic'; |
|
46 | + /** |
|
47 | + * @var string Nom du modele |
|
48 | + * @deprecated |
|
49 | + * @see name |
|
50 | + */ |
|
51 | + public $nom='arctic'; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @var string model name |
|
55 | - */ |
|
56 | - public $name='arctic'; |
|
53 | + /** |
|
54 | + * @var string model name |
|
55 | + */ |
|
56 | + public $name='arctic'; |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
59 | + /** |
|
60 | 60 | * Renvoi la description du modele de numerotation |
61 | 61 | * |
62 | 62 | * @return string Texte descripif |
63 | 63 | */ |
64 | - function info() |
|
64 | + function info() |
|
65 | 65 | { |
66 | - global $conf, $langs; |
|
66 | + global $conf, $langs; |
|
67 | 67 | |
68 | - $langs->load("bills"); |
|
68 | + $langs->load("bills"); |
|
69 | 69 | |
70 | - $form = new Form($this->db); |
|
70 | + $form = new Form($this->db); |
|
71 | 71 | |
72 | - $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
73 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
74 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
75 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
76 | - $texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">'; |
|
77 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
72 | + $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
73 | + $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
74 | + $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
75 | + $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
76 | + $texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">'; |
|
77 | + $texte.= '<table class="nobordernopadding" width="100%">'; |
|
78 | 78 | |
79 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
80 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
83 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
79 | + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
80 | + $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
81 | + $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
82 | + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
83 | + $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
84 | 84 | |
85 | - // Parametrage du prefix |
|
86 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
87 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>'; |
|
85 | + // Parametrage du prefix |
|
86 | + $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
87 | + $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>'; |
|
88 | 88 | |
89 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
89 | + $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
90 | 90 | |
91 | - $texte.= '</tr>'; |
|
91 | + $texte.= '</tr>'; |
|
92 | 92 | |
93 | - $texte.= '</table>'; |
|
94 | - $texte.= '</form>'; |
|
93 | + $texte.= '</table>'; |
|
94 | + $texte.= '</form>'; |
|
95 | 95 | |
96 | - return $texte; |
|
96 | + return $texte; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,53 +103,53 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function getExample() |
105 | 105 | { |
106 | - global $conf,$langs,$mysoc; |
|
107 | - |
|
108 | - $old_code_client=$mysoc->code_client; |
|
109 | - $mysoc->code_client='CCCCCCCCCC'; |
|
110 | - $numExample = $this->getNextValue($mysoc,''); |
|
111 | - $mysoc->code_client=$old_code_client; |
|
112 | - |
|
113 | - if (! $numExample) |
|
114 | - { |
|
115 | - $numExample = $langs->trans('NotConfigured'); |
|
116 | - } |
|
117 | - return $numExample; |
|
106 | + global $conf,$langs,$mysoc; |
|
107 | + |
|
108 | + $old_code_client=$mysoc->code_client; |
|
109 | + $mysoc->code_client='CCCCCCCCCC'; |
|
110 | + $numExample = $this->getNextValue($mysoc,''); |
|
111 | + $mysoc->code_client=$old_code_client; |
|
112 | + |
|
113 | + if (! $numExample) |
|
114 | + { |
|
115 | + $numExample = $langs->trans('NotConfigured'); |
|
116 | + } |
|
117 | + return $numExample; |
|
118 | 118 | } |
119 | 119 | |
120 | - /** |
|
121 | - * Return next free value |
|
122 | - * |
|
123 | - * @param Societe $objsoc Object thirdparty |
|
124 | - * @param Object $object Object we need next value for |
|
125 | - * @return string Value if KO, <0 if KO |
|
126 | - */ |
|
120 | + /** |
|
121 | + * Return next free value |
|
122 | + * |
|
123 | + * @param Societe $objsoc Object thirdparty |
|
124 | + * @param Object $object Object we need next value for |
|
125 | + * @return string Value if KO, <0 if KO |
|
126 | + */ |
|
127 | 127 | function getNextValue($objsoc=0,$object='') |
128 | 128 | { |
129 | - global $db,$conf; |
|
129 | + global $db,$conf; |
|
130 | 130 | |
131 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
131 | + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
132 | 132 | |
133 | - // On d�fini critere recherche compteur |
|
134 | - $mask=$conf->global->FICHINTER_ARTIC_MASK; |
|
133 | + // On d�fini critere recherche compteur |
|
134 | + $mask=$conf->global->FICHINTER_ARTIC_MASK; |
|
135 | 135 | |
136 | - if (! $mask) |
|
137 | - { |
|
138 | - $this->error='NotConfigured'; |
|
139 | - return 0; |
|
140 | - } |
|
136 | + if (! $mask) |
|
137 | + { |
|
138 | + $this->error='NotConfigured'; |
|
139 | + return 0; |
|
140 | + } |
|
141 | 141 | |
142 | - $numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec); |
|
142 | + $numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec); |
|
143 | 143 | |
144 | - return $numFinal; |
|
145 | - } |
|
144 | + return $numFinal; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | - /** |
|
149 | - * Return next free value |
|
150 | - * |
|
148 | + /** |
|
149 | + * Return next free value |
|
150 | + * |
|
151 | 151 | * @param Societe $objsoc Object third party |
152 | - * @param Object $objforref Object for number to search |
|
152 | + * @param Object $objforref Object for number to search |
|
153 | 153 | * @return string Next free value |
154 | 154 | */ |
155 | 155 | function getNumRef($objsoc,$objforref) |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup fiche intervention |
26 | 26 | * \brief File with Arctic numbering module for interventions |
27 | 27 | */ |
28 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/fichinter/modules_fichinter.php'; |
|
28 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Class to manage numbering of intervention cards with rule Artic. |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * Dolibarr version of the loaded document |
37 | 37 | * @public string |
38 | 38 | */ |
39 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
39 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * @var string Error message |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * @deprecated |
49 | 49 | * @see name |
50 | 50 | */ |
51 | - public $nom='arctic'; |
|
51 | + public $nom = 'arctic'; |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * @var string model name |
55 | 55 | */ |
56 | - public $name='arctic'; |
|
56 | + public $name = 'arctic'; |
|
57 | 57 | |
58 | 58 | |
59 | 59 | /** |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | $form = new Form($this->db); |
71 | 71 | |
72 | 72 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
73 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
74 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
75 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
76 | - $texte.= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">'; |
|
77 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
78 | - |
|
79 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
80 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
81 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
82 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("InterventionCard"),$langs->transnoentities("InterventionCard")); |
|
83 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
73 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
74 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
75 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
76 | + $texte .= '<input type="hidden" name="maskconst" value="FICHINTER_ARTIC_MASK">'; |
|
77 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
78 | + |
|
79 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard")); |
|
80 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
81 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
82 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("InterventionCard"), $langs->transnoentities("InterventionCard")); |
|
83 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
84 | 84 | |
85 | 85 | // Parametrage du prefix |
86 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
87 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">',$tooltip,1,1).'</td>'; |
|
86 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
87 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->FICHINTER_ARTIC_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
88 | 88 | |
89 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
89 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
90 | 90 | |
91 | - $texte.= '</tr>'; |
|
91 | + $texte .= '</tr>'; |
|
92 | 92 | |
93 | - $texte.= '</table>'; |
|
94 | - $texte.= '</form>'; |
|
93 | + $texte .= '</table>'; |
|
94 | + $texte .= '</form>'; |
|
95 | 95 | |
96 | 96 | return $texte; |
97 | 97 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | */ |
104 | 104 | function getExample() |
105 | 105 | { |
106 | - global $conf,$langs,$mysoc; |
|
106 | + global $conf, $langs, $mysoc; |
|
107 | 107 | |
108 | - $old_code_client=$mysoc->code_client; |
|
109 | - $mysoc->code_client='CCCCCCCCCC'; |
|
110 | - $numExample = $this->getNextValue($mysoc,''); |
|
111 | - $mysoc->code_client=$old_code_client; |
|
108 | + $old_code_client = $mysoc->code_client; |
|
109 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
110 | + $numExample = $this->getNextValue($mysoc, ''); |
|
111 | + $mysoc->code_client = $old_code_client; |
|
112 | 112 | |
113 | - if (! $numExample) |
|
113 | + if (!$numExample) |
|
114 | 114 | { |
115 | 115 | $numExample = $langs->trans('NotConfigured'); |
116 | 116 | } |
@@ -124,22 +124,22 @@ discard block |
||
124 | 124 | * @param Object $object Object we need next value for |
125 | 125 | * @return string Value if KO, <0 if KO |
126 | 126 | */ |
127 | - function getNextValue($objsoc=0,$object='') |
|
127 | + function getNextValue($objsoc = 0, $object = '') |
|
128 | 128 | { |
129 | - global $db,$conf; |
|
129 | + global $db, $conf; |
|
130 | 130 | |
131 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
131 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
132 | 132 | |
133 | 133 | // On d�fini critere recherche compteur |
134 | - $mask=$conf->global->FICHINTER_ARTIC_MASK; |
|
134 | + $mask = $conf->global->FICHINTER_ARTIC_MASK; |
|
135 | 135 | |
136 | - if (! $mask) |
|
136 | + if (!$mask) |
|
137 | 137 | { |
138 | - $this->error='NotConfigured'; |
|
138 | + $this->error = 'NotConfigured'; |
|
139 | 139 | return 0; |
140 | 140 | } |
141 | 141 | |
142 | - $numFinal=get_next_value($db,$mask,'fichinter','ref','',$objsoc,$object->datec); |
|
142 | + $numFinal = get_next_value($db, $mask, 'fichinter', 'ref', '', $objsoc, $object->datec); |
|
143 | 143 | |
144 | 144 | return $numFinal; |
145 | 145 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @param Object $objforref Object for number to search |
153 | 153 | * @return string Next free value |
154 | 154 | */ |
155 | - function getNumRef($objsoc,$objforref) |
|
155 | + function getNumRef($objsoc, $objforref) |
|
156 | 156 | { |
157 | - return $this->getNextValue($objsoc,$objforref); |
|
157 | + return $this->getNextValue($objsoc, $objforref); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 |
@@ -35,84 +35,84 @@ |
||
35 | 35 | { |
36 | 36 | |
37 | 37 | /** |
38 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | - * |
|
40 | - * @param DoliDB $db Database handler |
|
38 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | + * |
|
40 | + * @param DoliDB $db Database handler |
|
41 | 41 | */ |
42 | - function __construct($db) |
|
43 | - { |
|
44 | - $this->db = $db; |
|
45 | - |
|
46 | - // Id for module (must be unique). |
|
47 | - // Use here a free id. |
|
48 | - $this->numero = 100; |
|
49 | - |
|
50 | - // Family can be 'crm','financial','hr','projects','product','technic','other' |
|
51 | - // It is used to sort modules in module setup page |
|
52 | - $this->family = "interface"; |
|
53 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | - // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) |
|
56 | - $this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame."; |
|
57 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | - $this->version = 'dolibarr'; |
|
59 | - // Key used in llx_const table to save module status enabled/disabled (XXX is id value) |
|
60 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | - // Name of png file (without png) used for this module |
|
62 | - $this->picto='bookmark'; |
|
63 | - // Call to inside lang's file |
|
64 | - $this->langfiles = array("externalsite"); |
|
65 | - |
|
66 | - // Data directories to create when module is enabled |
|
67 | - $this->dirs = array(); |
|
68 | - |
|
69 | - // Config pages. Put here list of php page names stored in admmin directory used to setup module |
|
70 | - $this->config_page_url = array("externalsite.php@externalsite"); |
|
71 | - |
|
72 | - // Dependencies |
|
73 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | - |
|
76 | - // Constants |
|
77 | - // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
78 | - // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
79 | - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) |
|
80 | - // ); |
|
81 | - $this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0)); |
|
82 | - |
|
83 | - // Boxes |
|
84 | - $this->boxes = array(); // List of boxes |
|
85 | - $r=0; |
|
86 | - |
|
87 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
88 | - // Example: |
|
42 | + function __construct($db) |
|
43 | + { |
|
44 | + $this->db = $db; |
|
45 | + |
|
46 | + // Id for module (must be unique). |
|
47 | + // Use here a free id. |
|
48 | + $this->numero = 100; |
|
49 | + |
|
50 | + // Family can be 'crm','financial','hr','projects','product','technic','other' |
|
51 | + // It is used to sort modules in module setup page |
|
52 | + $this->family = "interface"; |
|
53 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | + // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) |
|
56 | + $this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame."; |
|
57 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | + $this->version = 'dolibarr'; |
|
59 | + // Key used in llx_const table to save module status enabled/disabled (XXX is id value) |
|
60 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | + // Name of png file (without png) used for this module |
|
62 | + $this->picto='bookmark'; |
|
63 | + // Call to inside lang's file |
|
64 | + $this->langfiles = array("externalsite"); |
|
65 | + |
|
66 | + // Data directories to create when module is enabled |
|
67 | + $this->dirs = array(); |
|
68 | + |
|
69 | + // Config pages. Put here list of php page names stored in admmin directory used to setup module |
|
70 | + $this->config_page_url = array("externalsite.php@externalsite"); |
|
71 | + |
|
72 | + // Dependencies |
|
73 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | + |
|
76 | + // Constants |
|
77 | + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
78 | + // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
|
79 | + // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) |
|
80 | + // ); |
|
81 | + $this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0)); |
|
82 | + |
|
83 | + // Boxes |
|
84 | + $this->boxes = array(); // List of boxes |
|
85 | + $r=0; |
|
86 | + |
|
87 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
88 | + // Example: |
|
89 | 89 | //$this->boxes[$r][1] = "myboxa.php"; |
90 | - //$r++; |
|
90 | + //$r++; |
|
91 | 91 | //$this->boxes[$r][1] = "myboxb.php"; |
92 | - //$r++; |
|
92 | + //$r++; |
|
93 | 93 | |
94 | - // Permissions |
|
95 | - $this->rights_class = 'externalsite'; // Permission key |
|
96 | - $this->rights = array(); // Permission array used by this module |
|
94 | + // Permissions |
|
95 | + $this->rights_class = 'externalsite'; // Permission key |
|
96 | + $this->rights = array(); // Permission array used by this module |
|
97 | 97 | |
98 | 98 | // Menus |
99 | - //------ |
|
100 | - $r=0; |
|
101 | - |
|
102 | - $this->menu[$r]=array( |
|
103 | - 'fk_menu'=>0, |
|
104 | - 'type'=>'top', |
|
105 | - 'titre'=>'__[EXTERNALSITE_LABEL]__', |
|
106 | - 'mainmenu'=>'externalsite', |
|
107 | - 'url'=>'/externalsite/frames.php', |
|
108 | - 'langs'=>'other', |
|
109 | - 'position'=>100, |
|
110 | - 'perms'=>'', |
|
111 | - 'enabled'=>'$conf->externalsite->enabled', |
|
112 | - 'target'=>'', |
|
113 | - 'user'=>0 |
|
114 | - ); |
|
115 | - $r++; |
|
116 | - } |
|
99 | + //------ |
|
100 | + $r=0; |
|
101 | + |
|
102 | + $this->menu[$r]=array( |
|
103 | + 'fk_menu'=>0, |
|
104 | + 'type'=>'top', |
|
105 | + 'titre'=>'__[EXTERNALSITE_LABEL]__', |
|
106 | + 'mainmenu'=>'externalsite', |
|
107 | + 'url'=>'/externalsite/frames.php', |
|
108 | + 'langs'=>'other', |
|
109 | + 'position'=>100, |
|
110 | + 'perms'=>'', |
|
111 | + 'enabled'=>'$conf->externalsite->enabled', |
|
112 | + 'target'=>'', |
|
113 | + 'user'=>0 |
|
114 | + ); |
|
115 | + $r++; |
|
116 | + } |
|
117 | 117 | } |
118 | 118 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief Description and activation file for module ExternalSite |
26 | 26 | */ |
27 | 27 | |
28 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | // It is used to sort modules in module setup page |
52 | 52 | $this->family = "interface"; |
53 | 53 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
54 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
54 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
55 | 55 | // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) |
56 | 56 | $this->description = "This module include an external web site or page into Dolibarr menus and view it into a Dolibarr frame."; |
57 | 57 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // Key used in llx_const table to save module status enabled/disabled (XXX is id value) |
60 | 60 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
61 | 61 | // Name of png file (without png) used for this module |
62 | - $this->picto='bookmark'; |
|
62 | + $this->picto = 'bookmark'; |
|
63 | 63 | // Call to inside lang's file |
64 | 64 | $this->langfiles = array("externalsite"); |
65 | 65 | |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | $this->config_page_url = array("externalsite.php@externalsite"); |
71 | 71 | |
72 | 72 | // Dependencies |
73 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
73 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | 75 | |
76 | 76 | // Constants |
77 | 77 | // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
78 | 78 | // Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), |
79 | 79 | // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) |
80 | 80 | // ); |
81 | - $this->const = array(0=>array('EXTERNALSITE_LABEL','chaine','ExternalSite','To declare label to use into external site menu entry', 0)); |
|
81 | + $this->const = array(0=>array('EXTERNALSITE_LABEL', 'chaine', 'ExternalSite', 'To declare label to use into external site menu entry', 0)); |
|
82 | 82 | |
83 | 83 | // Boxes |
84 | - $this->boxes = array(); // List of boxes |
|
85 | - $r=0; |
|
84 | + $this->boxes = array(); // List of boxes |
|
85 | + $r = 0; |
|
86 | 86 | |
87 | 87 | // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
88 | 88 | // Example: |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | //$r++; |
93 | 93 | |
94 | 94 | // Permissions |
95 | - $this->rights_class = 'externalsite'; // Permission key |
|
96 | - $this->rights = array(); // Permission array used by this module |
|
95 | + $this->rights_class = 'externalsite'; // Permission key |
|
96 | + $this->rights = array(); // Permission array used by this module |
|
97 | 97 | |
98 | 98 | // Menus |
99 | 99 | //------ |
100 | - $r=0; |
|
100 | + $r = 0; |
|
101 | 101 | |
102 | - $this->menu[$r]=array( |
|
102 | + $this->menu[$r] = array( |
|
103 | 103 | 'fk_menu'=>0, |
104 | 104 | 'type'=>'top', |
105 | 105 | 'titre'=>'__[EXTERNALSITE_LABEL]__', |
@@ -34,46 +34,46 @@ discard block |
||
34 | 34 | |
35 | 35 | class mod_livraison_jade extends ModeleNumRefDeliveryOrder |
36 | 36 | { |
37 | - /** |
|
37 | + /** |
|
38 | 38 | * Dolibarr version of the loaded document |
39 | 39 | * @public string |
40 | 40 | */ |
41 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
41 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
42 | 42 | |
43 | - /** |
|
44 | - * @var string Error message |
|
45 | - */ |
|
46 | - public $error = ''; |
|
43 | + /** |
|
44 | + * @var string Error message |
|
45 | + */ |
|
46 | + public $error = ''; |
|
47 | 47 | |
48 | - /** |
|
49 | - * @var string Nom du modele |
|
50 | - * @deprecated |
|
51 | - * @see name |
|
52 | - */ |
|
53 | - public $nom='Jade'; |
|
48 | + /** |
|
49 | + * @var string Nom du modele |
|
50 | + * @deprecated |
|
51 | + * @see name |
|
52 | + */ |
|
53 | + public $nom='Jade'; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @var string model name |
|
57 | - */ |
|
58 | - public $name='Jade'; |
|
55 | + /** |
|
56 | + * @var string model name |
|
57 | + */ |
|
58 | + public $name='Jade'; |
|
59 | 59 | |
60 | 60 | public $prefix='BL'; |
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * Renvoi la description du modele de numerotation |
|
65 | - * |
|
66 | - * @return string Texte descripif |
|
67 | - */ |
|
68 | - function info() |
|
69 | - { |
|
70 | - global $langs; |
|
71 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Renvoi un exemple de numerotation |
|
76 | - * |
|
63 | + /** |
|
64 | + * Renvoi la description du modele de numerotation |
|
65 | + * |
|
66 | + * @return string Texte descripif |
|
67 | + */ |
|
68 | + function info() |
|
69 | + { |
|
70 | + global $langs; |
|
71 | + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Renvoi un exemple de numerotation |
|
76 | + * |
|
77 | 77 | * @return string Example |
78 | 78 | */ |
79 | 79 | function getExample() |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | - * Return next free value |
|
123 | - * |
|
124 | - * @param Societe $objsoc Object thirdparty |
|
125 | - * @param Object $object Object we need next value for |
|
126 | - * @return string Value if KO, <0 if KO |
|
127 | - */ |
|
122 | + * Return next free value |
|
123 | + * |
|
124 | + * @param Societe $objsoc Object thirdparty |
|
125 | + * @param Object $object Object we need next value for |
|
126 | + * @return string Value if KO, <0 if KO |
|
127 | + */ |
|
128 | 128 | function getNextValue($objsoc,$object) |
129 | 129 | { |
130 | 130 | global $db,$conf; |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | |
163 | 163 | |
164 | 164 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
165 | - /** |
|
166 | - * Return next free ref |
|
167 | - * |
|
165 | + /** |
|
166 | + * Return next free ref |
|
167 | + * |
|
168 | 168 | * @param Societe $objsoc Object thirdparty |
169 | 169 | * @param Object $object Object livraison |
170 | 170 | * @return string Texte descriptif |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * \brief Fichier contenant la classe du modele de numerotation de reference de bon de livraison Jade |
25 | 25 | */ |
26 | 26 | |
27 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/modules_livraison.php'; |
|
27 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; |
|
28 | 28 | |
29 | 29 | |
30 | 30 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * Dolibarr version of the loaded document |
39 | 39 | * @public string |
40 | 40 | */ |
41 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
41 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @var string Error message |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * @deprecated |
51 | 51 | * @see name |
52 | 52 | */ |
53 | - public $nom='Jade'; |
|
53 | + public $nom = 'Jade'; |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @var string model name |
57 | 57 | */ |
58 | - public $name='Jade'; |
|
58 | + public $name = 'Jade'; |
|
59 | 59 | |
60 | - public $prefix='BL'; |
|
60 | + public $prefix = 'BL'; |
|
61 | 61 | |
62 | 62 | |
63 | 63 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | function info() |
69 | 69 | { |
70 | 70 | global $langs; |
71 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
71 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -89,29 +89,29 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function canBeActivated() |
91 | 91 | { |
92 | - global $langs,$conf,$db; |
|
92 | + global $langs, $conf, $db; |
|
93 | 93 | |
94 | 94 | $langs->load("bills"); |
95 | 95 | |
96 | 96 | // Check invoice num |
97 | - $fayymm=''; $max=''; |
|
97 | + $fayymm = ''; $max = ''; |
|
98 | 98 | |
99 | - $posindice=8; |
|
100 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL |
|
101 | - $sql.= " FROM ".MAIN_DB_PREFIX."livraison"; |
|
102 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
103 | - $sql.= " AND entity = ".$conf->entity; |
|
99 | + $posindice = 8; |
|
100 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL |
|
101 | + $sql .= " FROM ".MAIN_DB_PREFIX."livraison"; |
|
102 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
103 | + $sql .= " AND entity = ".$conf->entity; |
|
104 | 104 | |
105 | - $resql=$db->query($sql); |
|
105 | + $resql = $db->query($sql); |
|
106 | 106 | if ($resql) |
107 | 107 | { |
108 | 108 | $row = $db->fetch_row($resql); |
109 | - if ($row) { $fayymm = substr($row[0],0,6); $max=$row[0]; } |
|
109 | + if ($row) { $fayymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
110 | 110 | } |
111 | - if ($fayymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$fayymm)) |
|
111 | + if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) |
|
112 | 112 | { |
113 | 113 | $langs->load("errors"); |
114 | - $this->error=$langs->trans('ErrorNumRefModel',$max); |
|
114 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
115 | 115 | return false; |
116 | 116 | } |
117 | 117 | |
@@ -125,36 +125,36 @@ discard block |
||
125 | 125 | * @param Object $object Object we need next value for |
126 | 126 | * @return string Value if KO, <0 if KO |
127 | 127 | */ |
128 | - function getNextValue($objsoc,$object) |
|
128 | + function getNextValue($objsoc, $object) |
|
129 | 129 | { |
130 | - global $db,$conf; |
|
130 | + global $db, $conf; |
|
131 | 131 | |
132 | 132 | // D'abord on recupere la valeur max |
133 | - $posindice=8; |
|
134 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL |
|
135 | - $sql.= " FROM ".MAIN_DB_PREFIX."livraison"; |
|
136 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
137 | - $sql.= " AND entity = ".$conf->entity; |
|
133 | + $posindice = 8; |
|
134 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL |
|
135 | + $sql .= " FROM ".MAIN_DB_PREFIX."livraison"; |
|
136 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
137 | + $sql .= " AND entity = ".$conf->entity; |
|
138 | 138 | |
139 | - $resql=$db->query($sql); |
|
139 | + $resql = $db->query($sql); |
|
140 | 140 | dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG); |
141 | 141 | if ($resql) |
142 | 142 | { |
143 | 143 | $obj = $db->fetch_object($resql); |
144 | 144 | if ($obj) $max = intval($obj->max); |
145 | - else $max=0; |
|
145 | + else $max = 0; |
|
146 | 146 | } |
147 | 147 | else |
148 | 148 | { |
149 | 149 | return -1; |
150 | 150 | } |
151 | 151 | |
152 | - $date=$object->date_delivery; |
|
153 | - if (empty($date)) $date=dol_now(); |
|
154 | - $yymm = strftime("%y%m",$date); |
|
152 | + $date = $object->date_delivery; |
|
153 | + if (empty($date)) $date = dol_now(); |
|
154 | + $yymm = strftime("%y%m", $date); |
|
155 | 155 | |
156 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
157 | - else $num = sprintf("%04s",$max+1); |
|
156 | + if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
157 | + else $num = sprintf("%04s", $max + 1); |
|
158 | 158 | |
159 | 159 | dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num); |
160 | 160 | return $this->prefix.$yymm."-".$num; |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @param Object $object Object livraison |
170 | 170 | * @return string Texte descriptif |
171 | 171 | */ |
172 | - function livraison_get_num($objsoc=0,$object='') |
|
172 | + function livraison_get_num($objsoc = 0, $object = '') |
|
173 | 173 | { |
174 | 174 | // phpcs:enable |
175 | - return $this->getNextValue($objsoc,$object); |
|
175 | + return $this->getNextValue($objsoc, $object); |
|
176 | 176 | } |
177 | 177 | } |
@@ -141,20 +141,29 @@ |
||
141 | 141 | if ($resql) |
142 | 142 | { |
143 | 143 | $obj = $db->fetch_object($resql); |
144 | - if ($obj) $max = intval($obj->max); |
|
145 | - else $max=0; |
|
146 | - } |
|
147 | - else |
|
144 | + if ($obj) { |
|
145 | + $max = intval($obj->max); |
|
146 | + } else { |
|
147 | + $max=0; |
|
148 | + } |
|
149 | + } else |
|
148 | 150 | { |
149 | 151 | return -1; |
150 | 152 | } |
151 | 153 | |
152 | 154 | $date=$object->date_delivery; |
153 | - if (empty($date)) $date=dol_now(); |
|
155 | + if (empty($date)) { |
|
156 | + $date=dol_now(); |
|
157 | + } |
|
154 | 158 | $yymm = strftime("%y%m",$date); |
155 | 159 | |
156 | - if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
157 | - else $num = sprintf("%04s",$max+1); |
|
160 | + if ($max >= (pow(10, 4) - 1)) { |
|
161 | + $num=$max+1; |
|
162 | + } |
|
163 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
164 | + else { |
|
165 | + $num = sprintf("%04s",$max+1); |
|
166 | + } |
|
158 | 167 | |
159 | 168 | dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num); |
160 | 169 | return $this->prefix.$yymm."-".$num; |