@@ -36,319 +36,319 @@ |
||
36 | 36 | class modExpedition extends DolibarrModules |
37 | 37 | { |
38 | 38 | |
39 | - /** |
|
40 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
41 | - * |
|
42 | - * @param DoliDB $db Database handler |
|
43 | - */ |
|
44 | - function __construct($db) |
|
45 | - { |
|
46 | - global $conf, $user; |
|
47 | - |
|
48 | - $this->db = $db; |
|
49 | - $this->numero = 80; |
|
50 | - |
|
51 | - $this->family = "crm"; |
|
52 | - $this->module_position = '40'; |
|
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 | - $this->description = "Gestion des expeditions"; |
|
56 | - |
|
57 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | - $this->version = 'dolibarr'; |
|
59 | - |
|
60 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | - $this->picto = "sending"; |
|
62 | - |
|
63 | - // Data directories to create when module is enabled |
|
64 | - $this->dirs = array("/expedition/temp", |
|
65 | - "/expedition/sending", |
|
66 | - "/expedition/sending/temp", |
|
67 | - "/expedition/receipt", |
|
68 | - "/expedition/receipt/temp", |
|
69 | - "/doctemplates/shipment", |
|
70 | - "/doctemplates/delivery" |
|
71 | - ); |
|
72 | - |
|
73 | - // Config pages |
|
74 | - $this->config_page_url = array("confexped.php"); |
|
75 | - |
|
76 | - // Dependencies |
|
77 | - $this->depends = array("modCommande"); |
|
78 | - $this->requiredby = array(); |
|
79 | - $this->conflictwith = array(); |
|
80 | - $this->langfiles = array('deliveries','sendings'); |
|
81 | - |
|
82 | - // Constants |
|
83 | - $this->const = array(); |
|
84 | - $r=0; |
|
85 | - |
|
86 | - $this->const[$r][0] = "EXPEDITION_ADDON_PDF"; |
|
87 | - $this->const[$r][1] = "chaine"; |
|
88 | - $this->const[$r][2] = "rouget"; |
|
89 | - $this->const[$r][3] = 'Nom du gestionnaire de generation des bons expeditions en PDF'; |
|
90 | - $this->const[$r][4] = 0; |
|
91 | - $r++; |
|
92 | - |
|
93 | - $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; |
|
94 | - $this->const[$r][1] = "chaine"; |
|
95 | - $this->const[$r][2] = "mod_expedition_safor"; |
|
96 | - $this->const[$r][3] = 'Name for numbering manager for shipments'; |
|
97 | - $this->const[$r][4] = 0; |
|
98 | - $r++; |
|
99 | - |
|
100 | - $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; |
|
101 | - $this->const[$r][1] = "chaine"; |
|
102 | - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment"; |
|
103 | - $this->const[$r][3] = ""; |
|
104 | - $this->const[$r][4] = 0; |
|
105 | - $r++; |
|
106 | - |
|
107 | - $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; |
|
108 | - $this->const[$r][1] = "chaine"; |
|
109 | - $this->const[$r][2] = "typhon"; |
|
110 | - $this->const[$r][3] = 'Nom du gestionnaire de generation des bons de reception en PDF'; |
|
111 | - $this->const[$r][4] = 0; |
|
112 | - $r++; |
|
113 | - |
|
114 | - $this->const[$r][0] = "LIVRAISON_ADDON_NUMBER"; |
|
115 | - $this->const[$r][1] = "chaine"; |
|
116 | - $this->const[$r][2] = "mod_livraison_jade"; |
|
117 | - $this->const[$r][3] = 'Nom du gestionnaire de numerotation des bons de reception'; |
|
118 | - $this->const[$r][4] = 0; |
|
119 | - $r++; |
|
120 | - |
|
121 | - $this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH"; |
|
122 | - $this->const[$r][1] = "chaine"; |
|
123 | - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery"; |
|
124 | - $this->const[$r][3] = ""; |
|
125 | - $this->const[$r][4] = 0; |
|
126 | - $r++; |
|
127 | - |
|
128 | - $this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION"; |
|
129 | - $this->const[$r][1] = "chaine"; |
|
130 | - $this->const[$r][2] = "1"; |
|
131 | - $this->const[$r][3] = "Enable shipments"; |
|
132 | - $this->const[$r][4] = 0; |
|
133 | - $r++; |
|
134 | - |
|
135 | - // Boxes |
|
136 | - $this->boxes = array(); |
|
137 | - |
|
138 | - // Permissions |
|
139 | - $this->rights = array(); |
|
140 | - $this->rights_class = 'expedition'; |
|
141 | - $r=0; |
|
142 | - |
|
143 | - $r++; |
|
144 | - $this->rights[$r][0] = 101; |
|
145 | - $this->rights[$r][1] = 'Lire les expeditions'; |
|
146 | - $this->rights[$r][2] = 'r'; |
|
147 | - $this->rights[$r][3] = 0; |
|
148 | - $this->rights[$r][4] = 'lire'; |
|
149 | - |
|
150 | - $r++; |
|
151 | - $this->rights[$r][0] = 102; |
|
152 | - $this->rights[$r][1] = 'Creer modifier les expeditions'; |
|
153 | - $this->rights[$r][2] = 'w'; |
|
154 | - $this->rights[$r][3] = 0; |
|
155 | - $this->rights[$r][4] = 'creer'; |
|
156 | - |
|
157 | - $r++; |
|
158 | - $this->rights[$r][0] = 104; |
|
159 | - $this->rights[$r][1] = 'Valider les expeditions'; |
|
160 | - $this->rights[$r][2] = 'd'; |
|
161 | - $this->rights[$r][3] = 0; |
|
162 | - $this->rights[$r][4] = 'shipping_advance'; |
|
163 | - $this->rights[$r][5] = 'validate'; |
|
164 | - |
|
165 | - $r++; |
|
166 | - $this->rights[$r][0] = 105; // id de la permission |
|
167 | - $this->rights[$r][1] = 'Envoyer les expeditions aux clients'; // libelle de la permission |
|
168 | - $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
169 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
170 | - $this->rights[$r][4] = 'shipping_advance'; |
|
39 | + /** |
|
40 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
41 | + * |
|
42 | + * @param DoliDB $db Database handler |
|
43 | + */ |
|
44 | + function __construct($db) |
|
45 | + { |
|
46 | + global $conf, $user; |
|
47 | + |
|
48 | + $this->db = $db; |
|
49 | + $this->numero = 80; |
|
50 | + |
|
51 | + $this->family = "crm"; |
|
52 | + $this->module_position = '40'; |
|
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 | + $this->description = "Gestion des expeditions"; |
|
56 | + |
|
57 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
58 | + $this->version = 'dolibarr'; |
|
59 | + |
|
60 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
61 | + $this->picto = "sending"; |
|
62 | + |
|
63 | + // Data directories to create when module is enabled |
|
64 | + $this->dirs = array("/expedition/temp", |
|
65 | + "/expedition/sending", |
|
66 | + "/expedition/sending/temp", |
|
67 | + "/expedition/receipt", |
|
68 | + "/expedition/receipt/temp", |
|
69 | + "/doctemplates/shipment", |
|
70 | + "/doctemplates/delivery" |
|
71 | + ); |
|
72 | + |
|
73 | + // Config pages |
|
74 | + $this->config_page_url = array("confexped.php"); |
|
75 | + |
|
76 | + // Dependencies |
|
77 | + $this->depends = array("modCommande"); |
|
78 | + $this->requiredby = array(); |
|
79 | + $this->conflictwith = array(); |
|
80 | + $this->langfiles = array('deliveries','sendings'); |
|
81 | + |
|
82 | + // Constants |
|
83 | + $this->const = array(); |
|
84 | + $r=0; |
|
85 | + |
|
86 | + $this->const[$r][0] = "EXPEDITION_ADDON_PDF"; |
|
87 | + $this->const[$r][1] = "chaine"; |
|
88 | + $this->const[$r][2] = "rouget"; |
|
89 | + $this->const[$r][3] = 'Nom du gestionnaire de generation des bons expeditions en PDF'; |
|
90 | + $this->const[$r][4] = 0; |
|
91 | + $r++; |
|
92 | + |
|
93 | + $this->const[$r][0] = "EXPEDITION_ADDON_NUMBER"; |
|
94 | + $this->const[$r][1] = "chaine"; |
|
95 | + $this->const[$r][2] = "mod_expedition_safor"; |
|
96 | + $this->const[$r][3] = 'Name for numbering manager for shipments'; |
|
97 | + $this->const[$r][4] = 0; |
|
98 | + $r++; |
|
99 | + |
|
100 | + $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; |
|
101 | + $this->const[$r][1] = "chaine"; |
|
102 | + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment"; |
|
103 | + $this->const[$r][3] = ""; |
|
104 | + $this->const[$r][4] = 0; |
|
105 | + $r++; |
|
106 | + |
|
107 | + $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; |
|
108 | + $this->const[$r][1] = "chaine"; |
|
109 | + $this->const[$r][2] = "typhon"; |
|
110 | + $this->const[$r][3] = 'Nom du gestionnaire de generation des bons de reception en PDF'; |
|
111 | + $this->const[$r][4] = 0; |
|
112 | + $r++; |
|
113 | + |
|
114 | + $this->const[$r][0] = "LIVRAISON_ADDON_NUMBER"; |
|
115 | + $this->const[$r][1] = "chaine"; |
|
116 | + $this->const[$r][2] = "mod_livraison_jade"; |
|
117 | + $this->const[$r][3] = 'Nom du gestionnaire de numerotation des bons de reception'; |
|
118 | + $this->const[$r][4] = 0; |
|
119 | + $r++; |
|
120 | + |
|
121 | + $this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH"; |
|
122 | + $this->const[$r][1] = "chaine"; |
|
123 | + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery"; |
|
124 | + $this->const[$r][3] = ""; |
|
125 | + $this->const[$r][4] = 0; |
|
126 | + $r++; |
|
127 | + |
|
128 | + $this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION"; |
|
129 | + $this->const[$r][1] = "chaine"; |
|
130 | + $this->const[$r][2] = "1"; |
|
131 | + $this->const[$r][3] = "Enable shipments"; |
|
132 | + $this->const[$r][4] = 0; |
|
133 | + $r++; |
|
134 | + |
|
135 | + // Boxes |
|
136 | + $this->boxes = array(); |
|
137 | + |
|
138 | + // Permissions |
|
139 | + $this->rights = array(); |
|
140 | + $this->rights_class = 'expedition'; |
|
141 | + $r=0; |
|
142 | + |
|
143 | + $r++; |
|
144 | + $this->rights[$r][0] = 101; |
|
145 | + $this->rights[$r][1] = 'Lire les expeditions'; |
|
146 | + $this->rights[$r][2] = 'r'; |
|
147 | + $this->rights[$r][3] = 0; |
|
148 | + $this->rights[$r][4] = 'lire'; |
|
149 | + |
|
150 | + $r++; |
|
151 | + $this->rights[$r][0] = 102; |
|
152 | + $this->rights[$r][1] = 'Creer modifier les expeditions'; |
|
153 | + $this->rights[$r][2] = 'w'; |
|
154 | + $this->rights[$r][3] = 0; |
|
155 | + $this->rights[$r][4] = 'creer'; |
|
156 | + |
|
157 | + $r++; |
|
158 | + $this->rights[$r][0] = 104; |
|
159 | + $this->rights[$r][1] = 'Valider les expeditions'; |
|
160 | + $this->rights[$r][2] = 'd'; |
|
161 | + $this->rights[$r][3] = 0; |
|
162 | + $this->rights[$r][4] = 'shipping_advance'; |
|
163 | + $this->rights[$r][5] = 'validate'; |
|
164 | + |
|
165 | + $r++; |
|
166 | + $this->rights[$r][0] = 105; // id de la permission |
|
167 | + $this->rights[$r][1] = 'Envoyer les expeditions aux clients'; // libelle de la permission |
|
168 | + $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) |
|
169 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
170 | + $this->rights[$r][4] = 'shipping_advance'; |
|
171 | 171 | $this->rights[$r][5] = 'send'; |
172 | 172 | |
173 | - $r++; |
|
174 | - $this->rights[$r][0] = 106; |
|
175 | - $this->rights[$r][1] = 'Exporter les expeditions'; |
|
176 | - $this->rights[$r][2] = 'r'; |
|
177 | - $this->rights[$r][3] = 0; |
|
178 | - $this->rights[$r][4] = 'shipment'; |
|
179 | - $this->rights[$r][5] = 'export'; |
|
180 | - |
|
181 | - $r++; |
|
182 | - $this->rights[$r][0] = 109; |
|
183 | - $this->rights[$r][1] = 'Supprimer les expeditions'; |
|
184 | - $this->rights[$r][2] = 'd'; |
|
185 | - $this->rights[$r][3] = 0; |
|
186 | - $this->rights[$r][4] = 'supprimer'; |
|
187 | - |
|
188 | - $r++; |
|
189 | - $this->rights[$r][0] = 1101; |
|
190 | - $this->rights[$r][1] = 'Lire les bons de livraison'; |
|
191 | - $this->rights[$r][2] = 'r'; |
|
192 | - $this->rights[$r][3] = 0; |
|
193 | - $this->rights[$r][4] = 'livraison'; |
|
194 | - $this->rights[$r][5] = 'lire'; |
|
195 | - |
|
196 | - $r++; |
|
197 | - $this->rights[$r][0] = 1102; |
|
198 | - $this->rights[$r][1] = 'Creer modifier les bons de livraison'; |
|
199 | - $this->rights[$r][2] = 'w'; |
|
200 | - $this->rights[$r][3] = 0; |
|
201 | - $this->rights[$r][4] = 'livraison'; |
|
202 | - $this->rights[$r][5] = 'creer'; |
|
203 | - |
|
204 | - $r++; |
|
205 | - $this->rights[$r][0] = 1104; |
|
206 | - $this->rights[$r][1] = 'Valider les bons de livraison'; |
|
207 | - $this->rights[$r][2] = 'd'; |
|
208 | - $this->rights[$r][3] = 0; |
|
209 | - $this->rights[$r][4] = 'livraison_advance'; |
|
210 | - $this->rights[$r][5] = 'validate'; |
|
211 | - |
|
212 | - $r++; |
|
213 | - $this->rights[$r][0] = 1109; |
|
214 | - $this->rights[$r][1] = 'Supprimer les bons de livraison'; |
|
215 | - $this->rights[$r][2] = 'd'; |
|
216 | - $this->rights[$r][3] = 0; |
|
217 | - $this->rights[$r][4] = 'livraison'; |
|
218 | - $this->rights[$r][5] = 'supprimer'; |
|
219 | - |
|
220 | - |
|
221 | - // Menus |
|
222 | - //------- |
|
223 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
224 | - |
|
225 | - |
|
226 | - // Exports |
|
227 | - //-------- |
|
228 | - $r=0; |
|
229 | - |
|
230 | - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
231 | - $shipment=new Commande($this->db); |
|
232 | - $contact_arrays=$shipment->liste_type_contact('external','',0,0,''); |
|
233 | - if (is_array($contact_arrays) && count($contact_arrays)>0){ |
|
234 | - $idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,''))); |
|
235 | - } else { |
|
236 | - $idcontacts=0; |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - $r++; |
|
241 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
242 | - $this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
243 | - $this->export_permission[$r]=array(array("expedition","shipment","export")); |
|
244 | - $this->export_fields_array[$r]=array( |
|
245 | - 's.rowid'=>"IdCompany",'s.nom'=>'ThirdParty','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country', |
|
246 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5', |
|
247 | - 's.idprof6'=>'ProfId6','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_customer'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation", |
|
248 | - 'c.date_delivery'=>"DateDeliveryPlanned",'c.tracking_number'=>"TrackingNumber",'c.height'=>"Height",'c.width'=>"Width",'c.size'=>"Depth", |
|
249 | - 'c.size_units'=>'SizeUnits','c.weight'=>"Weight",'c.weight_units'=>"WeightUnits",'c.fk_statut'=>'Status','c.note_public'=>"NotePublic", |
|
250 | - 'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel', |
|
251 | - 'p.weight'=>'ProductWeight','p.weight_units'=>'WeightUnits','p.volume'=>'ProductVolume','p.volume_units'=>'VolumeUnits' |
|
252 | - ); |
|
253 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_fields_array[$r]+=array('sp.rowid'=>'IdContact','sp.lastname'=>'Lastname','sp.firstname'=>'Firstname','sp.note_public'=>'NotePublic'); |
|
254 | - //$this->export_TypeFields_array[$r]=array( |
|
255 | - // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', |
|
256 | - // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", |
|
257 | - // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric", |
|
258 | - // 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','ed.qty'=>"Text" |
|
259 | - //); |
|
260 | - $this->export_TypeFields_array[$r]=array( |
|
261 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text', |
|
262 | - 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_customer'=>"Text",'c.date_creation'=>"Date", |
|
263 | - 'c.date_delivery'=>"Date",'c.tracking_number'=>"Numeric",'c.height'=>"Numeric",'c.width'=>"Numeric",'c.weight'=>"Numeric",'c.fk_statut'=>'Status', |
|
264 | - 'c.note_public'=>"Text",'ed.qty'=>"Numeric",'d.nom'=>'Text' |
|
265 | - ); |
|
266 | - $this->export_entities_array[$r]=array( |
|
267 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company', |
|
268 | - 'co.code'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company', |
|
269 | - 's.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment", |
|
270 | - 'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment", |
|
271 | - 'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note_public'=>"shipment", |
|
272 | - 'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product', |
|
273 | - 'p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product' |
|
274 | - ); |
|
275 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); |
|
276 | - $this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
277 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
278 | - { |
|
279 | - $keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra3'; |
|
280 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
281 | - } |
|
282 | - $keyforselect='expedition'; $keyforelement='shipment'; $keyforaliasextra='extra'; |
|
283 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
284 | - $keyforselect='expeditiondet'; $keyforelement='shipment_line'; $keyforaliasextra='extra2'; |
|
285 | - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
286 | - |
|
287 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
288 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expedition as c'; |
|
289 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,'; |
|
290 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s'; |
|
291 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
292 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; |
|
293 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
294 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expeditiondet as ed'; |
|
295 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet_extrafields as extra2 ON ed.rowid = extra2.fk_object'; |
|
296 | - $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; |
|
297 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; |
|
298 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
299 | - { |
|
300 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; |
|
301 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; |
|
302 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; |
|
303 | - } |
|
304 | - $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; |
|
305 | - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition').')'; |
|
306 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
307 | - } |
|
308 | - |
|
309 | - |
|
310 | - /** |
|
311 | - * Function called when module is enabled. |
|
312 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
313 | - * It also creates data directories |
|
314 | - * |
|
173 | + $r++; |
|
174 | + $this->rights[$r][0] = 106; |
|
175 | + $this->rights[$r][1] = 'Exporter les expeditions'; |
|
176 | + $this->rights[$r][2] = 'r'; |
|
177 | + $this->rights[$r][3] = 0; |
|
178 | + $this->rights[$r][4] = 'shipment'; |
|
179 | + $this->rights[$r][5] = 'export'; |
|
180 | + |
|
181 | + $r++; |
|
182 | + $this->rights[$r][0] = 109; |
|
183 | + $this->rights[$r][1] = 'Supprimer les expeditions'; |
|
184 | + $this->rights[$r][2] = 'd'; |
|
185 | + $this->rights[$r][3] = 0; |
|
186 | + $this->rights[$r][4] = 'supprimer'; |
|
187 | + |
|
188 | + $r++; |
|
189 | + $this->rights[$r][0] = 1101; |
|
190 | + $this->rights[$r][1] = 'Lire les bons de livraison'; |
|
191 | + $this->rights[$r][2] = 'r'; |
|
192 | + $this->rights[$r][3] = 0; |
|
193 | + $this->rights[$r][4] = 'livraison'; |
|
194 | + $this->rights[$r][5] = 'lire'; |
|
195 | + |
|
196 | + $r++; |
|
197 | + $this->rights[$r][0] = 1102; |
|
198 | + $this->rights[$r][1] = 'Creer modifier les bons de livraison'; |
|
199 | + $this->rights[$r][2] = 'w'; |
|
200 | + $this->rights[$r][3] = 0; |
|
201 | + $this->rights[$r][4] = 'livraison'; |
|
202 | + $this->rights[$r][5] = 'creer'; |
|
203 | + |
|
204 | + $r++; |
|
205 | + $this->rights[$r][0] = 1104; |
|
206 | + $this->rights[$r][1] = 'Valider les bons de livraison'; |
|
207 | + $this->rights[$r][2] = 'd'; |
|
208 | + $this->rights[$r][3] = 0; |
|
209 | + $this->rights[$r][4] = 'livraison_advance'; |
|
210 | + $this->rights[$r][5] = 'validate'; |
|
211 | + |
|
212 | + $r++; |
|
213 | + $this->rights[$r][0] = 1109; |
|
214 | + $this->rights[$r][1] = 'Supprimer les bons de livraison'; |
|
215 | + $this->rights[$r][2] = 'd'; |
|
216 | + $this->rights[$r][3] = 0; |
|
217 | + $this->rights[$r][4] = 'livraison'; |
|
218 | + $this->rights[$r][5] = 'supprimer'; |
|
219 | + |
|
220 | + |
|
221 | + // Menus |
|
222 | + //------- |
|
223 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
224 | + |
|
225 | + |
|
226 | + // Exports |
|
227 | + //-------- |
|
228 | + $r=0; |
|
229 | + |
|
230 | + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
231 | + $shipment=new Commande($this->db); |
|
232 | + $contact_arrays=$shipment->liste_type_contact('external','',0,0,''); |
|
233 | + if (is_array($contact_arrays) && count($contact_arrays)>0){ |
|
234 | + $idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,''))); |
|
235 | + } else { |
|
236 | + $idcontacts=0; |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + $r++; |
|
241 | + $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
242 | + $this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
243 | + $this->export_permission[$r]=array(array("expedition","shipment","export")); |
|
244 | + $this->export_fields_array[$r]=array( |
|
245 | + 's.rowid'=>"IdCompany",'s.nom'=>'ThirdParty','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country', |
|
246 | + 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5', |
|
247 | + 's.idprof6'=>'ProfId6','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_customer'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation", |
|
248 | + 'c.date_delivery'=>"DateDeliveryPlanned",'c.tracking_number'=>"TrackingNumber",'c.height'=>"Height",'c.width'=>"Width",'c.size'=>"Depth", |
|
249 | + 'c.size_units'=>'SizeUnits','c.weight'=>"Weight",'c.weight_units'=>"WeightUnits",'c.fk_statut'=>'Status','c.note_public'=>"NotePublic", |
|
250 | + 'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel', |
|
251 | + 'p.weight'=>'ProductWeight','p.weight_units'=>'WeightUnits','p.volume'=>'ProductVolume','p.volume_units'=>'VolumeUnits' |
|
252 | + ); |
|
253 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_fields_array[$r]+=array('sp.rowid'=>'IdContact','sp.lastname'=>'Lastname','sp.firstname'=>'Firstname','sp.note_public'=>'NotePublic'); |
|
254 | + //$this->export_TypeFields_array[$r]=array( |
|
255 | + // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', |
|
256 | + // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", |
|
257 | + // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric", |
|
258 | + // 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','ed.qty'=>"Text" |
|
259 | + //); |
|
260 | + $this->export_TypeFields_array[$r]=array( |
|
261 | + 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text', |
|
262 | + 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_customer'=>"Text",'c.date_creation'=>"Date", |
|
263 | + 'c.date_delivery'=>"Date",'c.tracking_number'=>"Numeric",'c.height'=>"Numeric",'c.width'=>"Numeric",'c.weight'=>"Numeric",'c.fk_statut'=>'Status', |
|
264 | + 'c.note_public'=>"Text",'ed.qty'=>"Numeric",'d.nom'=>'Text' |
|
265 | + ); |
|
266 | + $this->export_entities_array[$r]=array( |
|
267 | + 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company', |
|
268 | + 'co.code'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company', |
|
269 | + 's.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment", |
|
270 | + 'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment", |
|
271 | + 'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note_public'=>"shipment", |
|
272 | + 'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product', |
|
273 | + 'p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product' |
|
274 | + ); |
|
275 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); |
|
276 | + $this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
277 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
278 | + { |
|
279 | + $keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra3'; |
|
280 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
281 | + } |
|
282 | + $keyforselect='expedition'; $keyforelement='shipment'; $keyforaliasextra='extra'; |
|
283 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
284 | + $keyforselect='expeditiondet'; $keyforelement='shipment_line'; $keyforaliasextra='extra2'; |
|
285 | + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
|
286 | + |
|
287 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
288 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expedition as c'; |
|
289 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,'; |
|
290 | + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s'; |
|
291 | + if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
292 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; |
|
293 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
294 | + $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expeditiondet as ed'; |
|
295 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet_extrafields as extra2 ON ed.rowid = extra2.fk_object'; |
|
296 | + $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; |
|
297 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; |
|
298 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
299 | + { |
|
300 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; |
|
301 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; |
|
302 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; |
|
303 | + } |
|
304 | + $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; |
|
305 | + $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition').')'; |
|
306 | + if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
307 | + } |
|
308 | + |
|
309 | + |
|
310 | + /** |
|
311 | + * Function called when module is enabled. |
|
312 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
313 | + * It also creates data directories |
|
314 | + * |
|
315 | 315 | * @param string $options Options when enabling module ('', 'noboxes') |
316 | - * @return int 1 if OK, 0 if KO |
|
317 | - */ |
|
318 | - function init($options='') |
|
319 | - { |
|
320 | - global $conf,$langs; |
|
321 | - |
|
322 | - // Permissions |
|
323 | - $this->remove($options); |
|
324 | - |
|
325 | - //ODT template |
|
326 | - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt'; |
|
327 | - $dirodt=DOL_DATA_ROOT.'/doctemplates/shipment'; |
|
328 | - $dest=$dirodt.'/template_shipment.odt'; |
|
329 | - |
|
330 | - if (file_exists($src) && ! file_exists($dest)) |
|
331 | - { |
|
332 | - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
333 | - dol_mkdir($dirodt); |
|
334 | - $result=dol_copy($src,$dest,0,0); |
|
335 | - if ($result < 0) |
|
336 | - { |
|
337 | - $langs->load("errors"); |
|
338 | - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
339 | - return 0; |
|
340 | - } |
|
341 | - } |
|
342 | - |
|
343 | - $sql = array(); |
|
344 | - |
|
345 | - $sql = array( |
|
346 | - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".$conf->entity, |
|
347 | - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','shipping',".$conf->entity.")", |
|
348 | - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'delivery' AND entity = ".$conf->entity, |
|
349 | - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','delivery',".$conf->entity.")", |
|
350 | - ); |
|
351 | - |
|
352 | - return $this->_init($sql,$options); |
|
353 | - } |
|
316 | + * @return int 1 if OK, 0 if KO |
|
317 | + */ |
|
318 | + function init($options='') |
|
319 | + { |
|
320 | + global $conf,$langs; |
|
321 | + |
|
322 | + // Permissions |
|
323 | + $this->remove($options); |
|
324 | + |
|
325 | + //ODT template |
|
326 | + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt'; |
|
327 | + $dirodt=DOL_DATA_ROOT.'/doctemplates/shipment'; |
|
328 | + $dest=$dirodt.'/template_shipment.odt'; |
|
329 | + |
|
330 | + if (file_exists($src) && ! file_exists($dest)) |
|
331 | + { |
|
332 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
333 | + dol_mkdir($dirodt); |
|
334 | + $result=dol_copy($src,$dest,0,0); |
|
335 | + if ($result < 0) |
|
336 | + { |
|
337 | + $langs->load("errors"); |
|
338 | + $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
339 | + return 0; |
|
340 | + } |
|
341 | + } |
|
342 | + |
|
343 | + $sql = array(); |
|
344 | + |
|
345 | + $sql = array( |
|
346 | + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'shipping' AND entity = ".$conf->entity, |
|
347 | + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','shipping',".$conf->entity.")", |
|
348 | + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'delivery' AND entity = ".$conf->entity, |
|
349 | + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','delivery',".$conf->entity.")", |
|
350 | + ); |
|
351 | + |
|
352 | + return $this->_init($sql,$options); |
|
353 | + } |
|
354 | 354 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * \brief Fichier de description et activation du module Expedition |
28 | 28 | */ |
29 | 29 | |
30 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
30 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->family = "crm"; |
52 | 52 | $this->module_position = '40'; |
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 | $this->description = "Gestion des expeditions"; |
56 | 56 | |
57 | 57 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | $this->depends = array("modCommande"); |
78 | 78 | $this->requiredby = array(); |
79 | 79 | $this->conflictwith = array(); |
80 | - $this->langfiles = array('deliveries','sendings'); |
|
80 | + $this->langfiles = array('deliveries', 'sendings'); |
|
81 | 81 | |
82 | 82 | // Constants |
83 | 83 | $this->const = array(); |
84 | - $r=0; |
|
84 | + $r = 0; |
|
85 | 85 | |
86 | 86 | $this->const[$r][0] = "EXPEDITION_ADDON_PDF"; |
87 | 87 | $this->const[$r][1] = "chaine"; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // Permissions |
139 | 139 | $this->rights = array(); |
140 | 140 | $this->rights_class = 'expedition'; |
141 | - $r=0; |
|
141 | + $r = 0; |
|
142 | 142 | |
143 | 143 | $r++; |
144 | 144 | $this->rights[$r][0] = 101; |
@@ -220,90 +220,90 @@ discard block |
||
220 | 220 | |
221 | 221 | // Menus |
222 | 222 | //------- |
223 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
223 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
224 | 224 | |
225 | 225 | |
226 | 226 | // Exports |
227 | 227 | //-------- |
228 | - $r=0; |
|
228 | + $r = 0; |
|
229 | 229 | |
230 | 230 | include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
231 | - $shipment=new Commande($this->db); |
|
232 | - $contact_arrays=$shipment->liste_type_contact('external','',0,0,''); |
|
233 | - if (is_array($contact_arrays) && count($contact_arrays)>0){ |
|
234 | - $idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,''))); |
|
231 | + $shipment = new Commande($this->db); |
|
232 | + $contact_arrays = $shipment->liste_type_contact('external', '', 0, 0, ''); |
|
233 | + if (is_array($contact_arrays) && count($contact_arrays) > 0) { |
|
234 | + $idcontacts = join(',', array_keys($shipment->liste_type_contact('external', '', 0, 0, ''))); |
|
235 | 235 | } else { |
236 | - $idcontacts=0; |
|
236 | + $idcontacts = 0; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
240 | 240 | $r++; |
241 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
242 | - $this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
243 | - $this->export_permission[$r]=array(array("expedition","shipment","export")); |
|
244 | - $this->export_fields_array[$r]=array( |
|
245 | - 's.rowid'=>"IdCompany",'s.nom'=>'ThirdParty','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country', |
|
246 | - 'co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5', |
|
247 | - 's.idprof6'=>'ProfId6','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_customer'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation", |
|
248 | - 'c.date_delivery'=>"DateDeliveryPlanned",'c.tracking_number'=>"TrackingNumber",'c.height'=>"Height",'c.width'=>"Width",'c.size'=>"Depth", |
|
249 | - 'c.size_units'=>'SizeUnits','c.weight'=>"Weight",'c.weight_units'=>"WeightUnits",'c.fk_statut'=>'Status','c.note_public'=>"NotePublic", |
|
250 | - 'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel', |
|
251 | - 'p.weight'=>'ProductWeight','p.weight_units'=>'WeightUnits','p.volume'=>'ProductVolume','p.volume_units'=>'VolumeUnits' |
|
241 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
242 | + $this->export_label[$r] = 'Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
243 | + $this->export_permission[$r] = array(array("expedition", "shipment", "export")); |
|
244 | + $this->export_fields_array[$r] = array( |
|
245 | + 's.rowid'=>"IdCompany", 's.nom'=>'ThirdParty', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', |
|
246 | + 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', |
|
247 | + 's.idprof6'=>'ProfId6', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_customer'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", |
|
248 | + 'c.date_delivery'=>"DateDeliveryPlanned", 'c.tracking_number'=>"TrackingNumber", 'c.height'=>"Height", 'c.width'=>"Width", 'c.size'=>"Depth", |
|
249 | + 'c.size_units'=>'SizeUnits', 'c.weight'=>"Weight", 'c.weight_units'=>"WeightUnits", 'c.fk_statut'=>'Status', 'c.note_public'=>"NotePublic", |
|
250 | + 'ed.rowid'=>'LineId', 'cd.description'=>'Description', 'ed.qty'=>"Qty", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', |
|
251 | + 'p.weight'=>'ProductWeight', 'p.weight_units'=>'WeightUnits', 'p.volume'=>'ProductVolume', 'p.volume_units'=>'VolumeUnits' |
|
252 | 252 | ); |
253 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_fields_array[$r]+=array('sp.rowid'=>'IdContact','sp.lastname'=>'Lastname','sp.firstname'=>'Firstname','sp.note_public'=>'NotePublic'); |
|
253 | + if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_fields_array[$r] += array('sp.rowid'=>'IdContact', 'sp.lastname'=>'Lastname', 'sp.firstname'=>'Firstname', 'sp.note_public'=>'NotePublic'); |
|
254 | 254 | //$this->export_TypeFields_array[$r]=array( |
255 | 255 | // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', |
256 | 256 | // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", |
257 | 257 | // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric", |
258 | 258 | // 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','ed.qty'=>"Text" |
259 | 259 | //); |
260 | - $this->export_TypeFields_array[$r]=array( |
|
261 | - 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text', |
|
262 | - 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_customer'=>"Text",'c.date_creation'=>"Date", |
|
263 | - 'c.date_delivery'=>"Date",'c.tracking_number'=>"Numeric",'c.height'=>"Numeric",'c.width'=>"Numeric",'c.weight'=>"Numeric",'c.fk_statut'=>'Status', |
|
264 | - 'c.note_public'=>"Text",'ed.qty'=>"Numeric",'d.nom'=>'Text' |
|
260 | + $this->export_TypeFields_array[$r] = array( |
|
261 | + 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', |
|
262 | + 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_customer'=>"Text", 'c.date_creation'=>"Date", |
|
263 | + 'c.date_delivery'=>"Date", 'c.tracking_number'=>"Numeric", 'c.height'=>"Numeric", 'c.width'=>"Numeric", 'c.weight'=>"Numeric", 'c.fk_statut'=>'Status', |
|
264 | + 'c.note_public'=>"Text", 'ed.qty'=>"Numeric", 'd.nom'=>'Text' |
|
265 | 265 | ); |
266 | - $this->export_entities_array[$r]=array( |
|
267 | - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company', |
|
268 | - 'co.code'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company', |
|
269 | - 's.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment", |
|
270 | - 'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment", |
|
271 | - 'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note_public'=>"shipment", |
|
272 | - 'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product', |
|
273 | - 'p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product' |
|
266 | + $this->export_entities_array[$r] = array( |
|
267 | + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', |
|
268 | + 'co.code'=>'company', 's.fk_pays'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.siret'=>'company', 's.idprof4'=>'company', |
|
269 | + 's.idprof5'=>'company', 's.idprof6'=>'company', 'c.rowid'=>"shipment", 'c.ref'=>"shipment", 'c.ref_customer'=>"shipment", 'c.fk_soc'=>"shipment", |
|
270 | + 'c.date_creation'=>"shipment", 'c.date_delivery'=>"shipment", 'c.tracking_number'=>'shipment', 'c.height'=>"shipment", 'c.width'=>"shipment", |
|
271 | + 'c.size'=>'shipment', 'c.size_units'=>'shipment', 'c.weight'=>"shipment", 'c.weight_units'=>'shipment', 'c.fk_statut'=>"shipment", 'c.note_public'=>"shipment", |
|
272 | + 'ed.rowid'=>'shipment_line', 'cd.description'=>'shipment_line', 'ed.qty'=>"shipment_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product', |
|
273 | + 'p.weight'=>'product', 'p.weight_units'=>'product', 'p.volume'=>'product', 'p.volume_units'=>'product' |
|
274 | 274 | ); |
275 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); |
|
276 | - $this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
277 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
275 | + if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r] += array('sp.rowid'=>'contact', 'sp.lastname'=>'contact', 'sp.firstname'=>'contact', 'sp.note_public'=>'contact'); |
|
276 | + $this->export_dependencies_array[$r] = array('shipment_line'=>'ed.rowid', 'product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
277 | + if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
278 | 278 | { |
279 | - $keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra3'; |
|
279 | + $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra3'; |
|
280 | 280 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
281 | 281 | } |
282 | - $keyforselect='expedition'; $keyforelement='shipment'; $keyforaliasextra='extra'; |
|
282 | + $keyforselect = 'expedition'; $keyforelement = 'shipment'; $keyforaliasextra = 'extra'; |
|
283 | 283 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
284 | - $keyforselect='expeditiondet'; $keyforelement='shipment_line'; $keyforaliasextra='extra2'; |
|
284 | + $keyforselect = 'expeditiondet'; $keyforelement = 'shipment_line'; $keyforaliasextra = 'extra2'; |
|
285 | 285 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
286 | 286 | |
287 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
288 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expedition as c'; |
|
289 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,'; |
|
290 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s'; |
|
291 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
292 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; |
|
293 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
294 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expeditiondet as ed'; |
|
295 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet_extrafields as extra2 ON ed.rowid = extra2.fk_object'; |
|
296 | - $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; |
|
297 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; |
|
298 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
287 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
288 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'expedition as c'; |
|
289 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,'; |
|
290 | + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'societe as s'; |
|
291 | + if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
292 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; |
|
293 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
|
294 | + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'expeditiondet as ed'; |
|
295 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet_extrafields as extra2 ON ed.rowid = extra2.fk_object'; |
|
296 | + $this->export_sql_end[$r] .= ' , '.MAIN_DB_PREFIX.'commandedet as cd'; |
|
297 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; |
|
298 | + if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
|
299 | 299 | { |
300 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; |
|
301 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; |
|
302 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; |
|
300 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; |
|
301 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp ON sp.rowid = ee.fk_socpeople'; |
|
302 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra3 ON sp.rowid = extra3.fk_object'; |
|
303 | 303 | } |
304 | - $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; |
|
305 | - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition').')'; |
|
306 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
304 | + $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; |
|
305 | + $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')'; |
|
306 | + if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | |
@@ -315,27 +315,27 @@ discard block |
||
315 | 315 | * @param string $options Options when enabling module ('', 'noboxes') |
316 | 316 | * @return int 1 if OK, 0 if KO |
317 | 317 | */ |
318 | - function init($options='') |
|
318 | + function init($options = '') |
|
319 | 319 | { |
320 | - global $conf,$langs; |
|
320 | + global $conf, $langs; |
|
321 | 321 | |
322 | 322 | // Permissions |
323 | 323 | $this->remove($options); |
324 | 324 | |
325 | 325 | //ODT template |
326 | - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt'; |
|
327 | - $dirodt=DOL_DATA_ROOT.'/doctemplates/shipment'; |
|
328 | - $dest=$dirodt.'/template_shipment.odt'; |
|
326 | + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt'; |
|
327 | + $dirodt = DOL_DATA_ROOT.'/doctemplates/shipment'; |
|
328 | + $dest = $dirodt.'/template_shipment.odt'; |
|
329 | 329 | |
330 | - if (file_exists($src) && ! file_exists($dest)) |
|
330 | + if (file_exists($src) && !file_exists($dest)) |
|
331 | 331 | { |
332 | 332 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
333 | 333 | dol_mkdir($dirodt); |
334 | - $result=dol_copy($src,$dest,0,0); |
|
334 | + $result = dol_copy($src, $dest, 0, 0); |
|
335 | 335 | if ($result < 0) |
336 | 336 | { |
337 | 337 | $langs->load("errors"); |
338 | - $this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest); |
|
338 | + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); |
|
339 | 339 | return 0; |
340 | 340 | } |
341 | 341 | } |
@@ -349,6 +349,6 @@ discard block |
||
349 | 349 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','delivery',".$conf->entity.")", |
350 | 350 | ); |
351 | 351 | |
352 | - return $this->_init($sql,$options); |
|
352 | + return $this->_init($sql, $options); |
|
353 | 353 | } |
354 | 354 | } |
@@ -250,7 +250,9 @@ discard block |
||
250 | 250 | 'ed.rowid'=>'LineId','cd.description'=>'Description','ed.qty'=>"Qty",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel', |
251 | 251 | 'p.weight'=>'ProductWeight','p.weight_units'=>'WeightUnits','p.volume'=>'ProductVolume','p.volume_units'=>'VolumeUnits' |
252 | 252 | ); |
253 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_fields_array[$r]+=array('sp.rowid'=>'IdContact','sp.lastname'=>'Lastname','sp.firstname'=>'Firstname','sp.note_public'=>'NotePublic'); |
|
253 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { |
|
254 | + $this->export_fields_array[$r]+=array('sp.rowid'=>'IdContact','sp.lastname'=>'Lastname','sp.firstname'=>'Firstname','sp.note_public'=>'NotePublic'); |
|
255 | + } |
|
254 | 256 | //$this->export_TypeFields_array[$r]=array( |
255 | 257 | // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', |
256 | 258 | // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", |
@@ -272,7 +274,9 @@ discard block |
||
272 | 274 | 'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product', |
273 | 275 | 'p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product' |
274 | 276 | ); |
275 | - if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); |
|
277 | + if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { |
|
278 | + $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact'); |
|
279 | + } |
|
276 | 280 | $this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
277 | 281 | if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) |
278 | 282 | { |
@@ -288,7 +292,9 @@ discard block |
||
288 | 292 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expedition as c'; |
289 | 293 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,'; |
290 | 294 | $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s'; |
291 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
295 | + if(!$user->rights->societe->client->voir) { |
|
296 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
297 | + } |
|
292 | 298 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; |
293 | 299 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; |
294 | 300 | $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expeditiondet as ed'; |
@@ -303,7 +309,9 @@ discard block |
||
303 | 309 | } |
304 | 310 | $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; |
305 | 311 | $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('expedition').')'; |
306 | - if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
312 | + if(!$user->rights->societe->client->voir) { |
|
313 | + $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; |
|
314 | + } |
|
307 | 315 | } |
308 | 316 | |
309 | 317 |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | { |
34 | 34 | |
35 | 35 | /** |
36 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | - * |
|
38 | - * @param DoliDB $db Database handler |
|
36 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | + * |
|
38 | + * @param DoliDB $db Database handler |
|
39 | 39 | */ |
40 | 40 | function __construct($db) |
41 | 41 | { |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | $this->config_page_url = array('workflow.php'); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | 76 | $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module |
77 | 77 | $this->langfiles = array("@workflow"); |
78 | 78 | |
@@ -132,19 +132,19 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | /** |
135 | - * Function called when module is enabled. |
|
136 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
137 | - * It also creates data directories |
|
138 | - * |
|
135 | + * Function called when module is enabled. |
|
136 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
137 | + * It also creates data directories |
|
138 | + * |
|
139 | 139 | * @param string $options Options when enabling module ('', 'noboxes') |
140 | - * @return int 1 if OK, 0 if KO |
|
140 | + * @return int 1 if OK, 0 if KO |
|
141 | 141 | */ |
142 | 142 | function init($options='') |
143 | 143 | { |
144 | - // Permissions |
|
145 | - $this->remove($options); |
|
144 | + // Permissions |
|
145 | + $this->remove($options); |
|
146 | 146 | |
147 | - $sql = array(); |
|
147 | + $sql = array(); |
|
148 | 148 | |
149 | 149 | return $this->_init($sql,$options); |
150 | 150 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup workflow |
24 | 24 | * \brief File to describe and activate module Workflow |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | // Id for module (must be unique). |
45 | 45 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
46 | - $this->numero = 6000 ; |
|
46 | + $this->numero = 6000; |
|
47 | 47 | // Key text used to identify module (for permissions, menus, etc...) |
48 | 48 | $this->rights_class = 'workflow'; |
49 | 49 | |
50 | 50 | $this->family = "technic"; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
54 | 54 | $this->description = "Workflow management"; |
55 | 55 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // Name of png file (without png) used for this module. |
60 | 60 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
61 | 61 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
62 | - $this->picto='technic'; |
|
62 | + $this->picto = 'technic'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | 65 | $this->dirs = array("/workflow/temp"); |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | $this->config_page_url = array('workflow.php'); |
69 | 69 | |
70 | 70 | // Dependencies |
71 | - $this->hidden = false; // A condition to hide module |
|
72 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
76 | - $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module |
|
71 | + $this->hidden = false; // A condition to hide module |
|
72 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
73 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
74 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
75 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
76 | + $this->need_dolibarr_version = array(2, 8); // Minimum version of Dolibarr required by module |
|
77 | 77 | $this->langfiles = array("@workflow"); |
78 | 78 | |
79 | 79 | // Constants |
80 | 80 | // List of particular constants to add when module is enabled |
81 | 81 | //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), |
82 | 82 | // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); |
83 | - $this->const=array(); |
|
83 | + $this->const = array(); |
|
84 | 84 | |
85 | 85 | // Boxes |
86 | 86 | $this->boxes = array(); |
87 | 87 | |
88 | 88 | // Permissions |
89 | 89 | $this->rights = array(); |
90 | - $r=0; |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | /* |
93 | 93 | $r++; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | |
101 | 101 | // Main menu entries |
102 | - $this->menus = array(); // List of menus to add |
|
103 | - $r=0; |
|
102 | + $this->menus = array(); // List of menus to add |
|
103 | + $r = 0; |
|
104 | 104 | /* |
105 | 105 | $this->menu[$r]=array('fk_menu'=>0, |
106 | 106 | 'type'=>'top', |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | * @param string $options Options when enabling module ('', 'noboxes') |
140 | 140 | * @return int 1 if OK, 0 if KO |
141 | 141 | */ |
142 | - function init($options='') |
|
142 | + function init($options = '') |
|
143 | 143 | { |
144 | 144 | // Permissions |
145 | 145 | $this->remove($options); |
146 | 146 | |
147 | 147 | $sql = array(); |
148 | 148 | |
149 | - return $this->_init($sql,$options); |
|
149 | + return $this->_init($sql, $options); |
|
150 | 150 | } |
151 | 151 | } |
@@ -34,39 +34,39 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class BordereauChequeBlochet extends ModeleChequeReceipts |
36 | 36 | { |
37 | - /** |
|
38 | - * Issuer |
|
39 | - * @var Societe |
|
40 | - */ |
|
41 | - public $emetteur; |
|
42 | - |
|
43 | - /** |
|
44 | - * Constructor |
|
45 | - * |
|
46 | - * @param DoliDB $db Database handler |
|
47 | - */ |
|
48 | - function __construct($db) |
|
49 | - { |
|
50 | - global $conf,$langs,$mysoc; |
|
51 | - |
|
52 | - // Load traductions files requiredby by page |
|
53 | - $langs->loadLangs(array("main", "bills")); |
|
54 | - |
|
55 | - $this->db = $db; |
|
56 | - $this->name = "blochet"; |
|
57 | - |
|
58 | - $this->tab_top = 60; |
|
59 | - |
|
60 | - // Dimension page pour format A4 |
|
61 | - $this->type = 'pdf'; |
|
62 | - $formatarray=pdf_getFormat(); |
|
63 | - $this->page_largeur = $formatarray['width']; |
|
64 | - $this->page_hauteur = $formatarray['height']; |
|
65 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
66 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
67 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
68 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
69 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
37 | + /** |
|
38 | + * Issuer |
|
39 | + * @var Societe |
|
40 | + */ |
|
41 | + public $emetteur; |
|
42 | + |
|
43 | + /** |
|
44 | + * Constructor |
|
45 | + * |
|
46 | + * @param DoliDB $db Database handler |
|
47 | + */ |
|
48 | + function __construct($db) |
|
49 | + { |
|
50 | + global $conf,$langs,$mysoc; |
|
51 | + |
|
52 | + // Load traductions files requiredby by page |
|
53 | + $langs->loadLangs(array("main", "bills")); |
|
54 | + |
|
55 | + $this->db = $db; |
|
56 | + $this->name = "blochet"; |
|
57 | + |
|
58 | + $this->tab_top = 60; |
|
59 | + |
|
60 | + // Dimension page pour format A4 |
|
61 | + $this->type = 'pdf'; |
|
62 | + $formatarray=pdf_getFormat(); |
|
63 | + $this->page_largeur = $formatarray['width']; |
|
64 | + $this->page_hauteur = $formatarray['height']; |
|
65 | + $this->format = array($this->page_largeur,$this->page_hauteur); |
|
66 | + $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
67 | + $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
68 | + $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
69 | + $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
70 | 70 | |
71 | 71 | // Recupere emmetteur |
72 | 72 | $this->emetteur=$mysoc; |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | |
75 | 75 | // Defini position des colonnes |
76 | 76 | $this->line_height = 5; |
77 | - $this->line_per_page = 40; |
|
78 | - $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
79 | - } |
|
77 | + $this->line_per_page = 40; |
|
78 | + $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
79 | + } |
|
80 | 80 | |
81 | 81 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
82 | - /** |
|
83 | - * Fonction to generate document on disk |
|
84 | - * |
|
85 | - * @param RemiseCheque $object Object RemiseCheque |
|
86 | - * @param string $_dir Directory |
|
87 | - * @param string $number Number |
|
88 | - * @param Translate $outputlangs Lang output object |
|
82 | + /** |
|
83 | + * Fonction to generate document on disk |
|
84 | + * |
|
85 | + * @param RemiseCheque $object Object RemiseCheque |
|
86 | + * @param string $_dir Directory |
|
87 | + * @param string $number Number |
|
88 | + * @param Translate $outputlangs Lang output object |
|
89 | 89 | * @return int 1=ok, 0=ko |
90 | - */ |
|
91 | - function write_file($object, $_dir, $number, $outputlangs) |
|
92 | - { |
|
90 | + */ |
|
91 | + function write_file($object, $_dir, $number, $outputlangs) |
|
92 | + { |
|
93 | 93 | // phpcs:enable |
94 | - global $user,$conf,$langs,$hookmanager; |
|
94 | + global $user,$conf,$langs,$hookmanager; |
|
95 | 95 | |
96 | 96 | if (! is_object($outputlangs)) $outputlangs=$langs; |
97 | 97 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
@@ -99,35 +99,35 @@ discard block |
||
99 | 99 | if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
100 | 100 | |
101 | 101 | // Load traductions files requiredby by page |
102 | - $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); |
|
103 | - |
|
104 | - $dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number; |
|
105 | - |
|
106 | - if (! is_dir($dir)) |
|
107 | - { |
|
108 | - $result=dol_mkdir($dir); |
|
109 | - |
|
110 | - if ($result < 0) |
|
111 | - { |
|
112 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
113 | - return -1; |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - $file = $dir . "/bordereau-".$number.".pdf"; |
|
118 | - |
|
119 | - // Add pdfgeneration hook |
|
120 | - if (! is_object($hookmanager)) |
|
121 | - { |
|
122 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
123 | - $hookmanager=new HookManager($this->db); |
|
124 | - } |
|
125 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
126 | - $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
127 | - global $action; |
|
128 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
129 | - |
|
130 | - // Create PDF instance |
|
102 | + $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); |
|
103 | + |
|
104 | + $dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number; |
|
105 | + |
|
106 | + if (! is_dir($dir)) |
|
107 | + { |
|
108 | + $result=dol_mkdir($dir); |
|
109 | + |
|
110 | + if ($result < 0) |
|
111 | + { |
|
112 | + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
113 | + return -1; |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + $file = $dir . "/bordereau-".$number.".pdf"; |
|
118 | + |
|
119 | + // Add pdfgeneration hook |
|
120 | + if (! is_object($hookmanager)) |
|
121 | + { |
|
122 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
123 | + $hookmanager=new HookManager($this->db); |
|
124 | + } |
|
125 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
126 | + $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
127 | + global $action; |
|
128 | + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
129 | + |
|
130 | + // Create PDF instance |
|
131 | 131 | $pdf=pdf_getInstance($this->format); |
132 | 132 | $heightforinfotot = 50; // Height reserved to output the info and total part |
133 | 133 | $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 |
@@ -142,121 +142,121 @@ discard block |
||
142 | 142 | } |
143 | 143 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
144 | 144 | |
145 | - $pdf->Open(); |
|
146 | - $pagenb=0; |
|
147 | - $pdf->SetDrawColor(128,128,128); |
|
148 | - |
|
149 | - $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); |
|
150 | - $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); |
|
151 | - $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
152 | - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
153 | - $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); |
|
154 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
155 | - |
|
156 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
157 | - |
|
158 | - $nboflines=count($this->lines); |
|
159 | - |
|
160 | - // Define nb of page |
|
161 | - $pages = intval($nboflines / $this->line_per_page); |
|
162 | - if (($nboflines % $this->line_per_page)>0) |
|
163 | - { |
|
164 | - $pages++; |
|
165 | - } |
|
166 | - if ($pages == 0) |
|
167 | - { |
|
168 | - // force to build at least one page if report has no lines |
|
169 | - $pages = 1; |
|
170 | - } |
|
171 | - |
|
172 | - $pdf->AddPage(); |
|
145 | + $pdf->Open(); |
|
146 | + $pagenb=0; |
|
147 | + $pdf->SetDrawColor(128,128,128); |
|
148 | + |
|
149 | + $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); |
|
150 | + $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); |
|
151 | + $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
|
152 | + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
|
153 | + $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); |
|
154 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
155 | + |
|
156 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
157 | + |
|
158 | + $nboflines=count($this->lines); |
|
159 | + |
|
160 | + // Define nb of page |
|
161 | + $pages = intval($nboflines / $this->line_per_page); |
|
162 | + if (($nboflines % $this->line_per_page)>0) |
|
163 | + { |
|
164 | + $pages++; |
|
165 | + } |
|
166 | + if ($pages == 0) |
|
167 | + { |
|
168 | + // force to build at least one page if report has no lines |
|
169 | + $pages = 1; |
|
170 | + } |
|
171 | + |
|
172 | + $pdf->AddPage(); |
|
173 | 173 | $pagenb++; |
174 | - $this->Header($pdf, $pagenb, $pages, $outputlangs); |
|
174 | + $this->Header($pdf, $pagenb, $pages, $outputlangs); |
|
175 | 175 | |
176 | - $this->Body($pdf, $pagenb, $pages, $outputlangs); |
|
176 | + $this->Body($pdf, $pagenb, $pages, $outputlangs); |
|
177 | 177 | |
178 | - // Pied de page |
|
179 | - $this->_pagefoot($pdf,'',$outputlangs); |
|
180 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
178 | + // Pied de page |
|
179 | + $this->_pagefoot($pdf,'',$outputlangs); |
|
180 | + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
181 | 181 | |
182 | - $pdf->Close(); |
|
182 | + $pdf->Close(); |
|
183 | 183 | |
184 | - $pdf->Output($file,'F'); |
|
184 | + $pdf->Output($file,'F'); |
|
185 | 185 | |
186 | - // Add pdfgeneration hook |
|
187 | - if (! is_object($hookmanager)) |
|
188 | - { |
|
189 | - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
190 | - $hookmanager=new HookManager($this->db); |
|
191 | - } |
|
192 | - $hookmanager->initHooks(array('pdfgeneration')); |
|
193 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
194 | - global $action; |
|
195 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
186 | + // Add pdfgeneration hook |
|
187 | + if (! is_object($hookmanager)) |
|
188 | + { |
|
189 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
|
190 | + $hookmanager=new HookManager($this->db); |
|
191 | + } |
|
192 | + $hookmanager->initHooks(array('pdfgeneration')); |
|
193 | + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
194 | + global $action; |
|
195 | + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
196 | 196 | |
197 | - if (! empty($conf->global->MAIN_UMASK)) |
|
198 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
197 | + if (! empty($conf->global->MAIN_UMASK)) |
|
198 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
199 | 199 | |
200 | - $this->result = array('fullpath'=>$file); |
|
200 | + $this->result = array('fullpath'=>$file); |
|
201 | 201 | |
202 | 202 | $outputlangs->charset_output=$sav_charset_output; |
203 | - return 1; // Pas d'erreur |
|
204 | - } |
|
203 | + return 1; // Pas d'erreur |
|
204 | + } |
|
205 | 205 | |
206 | 206 | |
207 | 207 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
208 | - /** |
|
209 | - * Generate Header |
|
210 | - * |
|
211 | - * @param PDF $pdf Pdf object |
|
212 | - * @param int $page Current page number |
|
213 | - * @param int $pages Total number of pages |
|
214 | - * @param Translate $outputlangs Object language for output |
|
215 | - * @return void |
|
216 | - */ |
|
217 | - function Header(&$pdf, $page, $pages, $outputlangs) |
|
218 | - { |
|
208 | + /** |
|
209 | + * Generate Header |
|
210 | + * |
|
211 | + * @param PDF $pdf Pdf object |
|
212 | + * @param int $page Current page number |
|
213 | + * @param int $pages Total number of pages |
|
214 | + * @param Translate $outputlangs Object language for output |
|
215 | + * @return void |
|
216 | + */ |
|
217 | + function Header(&$pdf, $page, $pages, $outputlangs) |
|
218 | + { |
|
219 | 219 | // phpcs:enable |
220 | - global $langs; |
|
221 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
220 | + global $langs; |
|
221 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
222 | 222 | |
223 | - // Load traductions files requiredby by page |
|
224 | - $outputlangs->loadLangs(array("compta", "banks")); |
|
223 | + // Load traductions files requiredby by page |
|
224 | + $outputlangs->loadLangs(array("compta", "banks")); |
|
225 | 225 | |
226 | - $title = $outputlangs->transnoentities("CheckReceipt"); |
|
227 | - $pdf->SetFont('','B', $default_font_size); |
|
226 | + $title = $outputlangs->transnoentities("CheckReceipt"); |
|
227 | + $pdf->SetFont('','B', $default_font_size); |
|
228 | 228 | $pdf->SetXY(10,8); |
229 | 229 | $pdf->MultiCell(0,2,$title,0,'L'); |
230 | 230 | |
231 | - $pdf->SetFont('','', $default_font_size); |
|
231 | + $pdf->SetFont('','', $default_font_size); |
|
232 | 232 | $pdf->SetXY(10,15); |
233 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Ref"),0,'L'); |
|
233 | + $pdf->MultiCell(22,2,$outputlangs->transnoentities("Ref"),0,'L'); |
|
234 | 234 | $pdf->SetXY(32,15); |
235 | - $pdf->SetFont('','', $default_font_size); |
|
235 | + $pdf->SetFont('','', $default_font_size); |
|
236 | 236 | $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext?" - ".$this->ref_ext:'')), 0, 'L'); |
237 | 237 | |
238 | - $pdf->SetFont('','', $default_font_size); |
|
238 | + $pdf->SetFont('','', $default_font_size); |
|
239 | 239 | $pdf->SetXY(10,20); |
240 | 240 | $pdf->MultiCell(22,2,$outputlangs->transnoentities("Date"),0,'L'); |
241 | 241 | $pdf->SetXY(32,20); |
242 | 242 | $pdf->SetFont('','', $default_font_size); |
243 | 243 | $pdf->MultiCell(60, 2, dol_print_date($this->date,"day",false,$outputlangs)); |
244 | 244 | |
245 | - $pdf->SetFont('','', $default_font_size); |
|
245 | + $pdf->SetFont('','', $default_font_size); |
|
246 | 246 | $pdf->SetXY(10,26); |
247 | 247 | $pdf->MultiCell(22,2,$outputlangs->transnoentities("Owner"),0,'L'); |
248 | - $pdf->SetFont('','', $default_font_size); |
|
248 | + $pdf->SetFont('','', $default_font_size); |
|
249 | 249 | $pdf->SetXY(32,26); |
250 | 250 | $pdf->MultiCell(60,2,$outputlangs->convToOutputCharset($this->account->proprio),0,'L'); |
251 | 251 | |
252 | - $pdf->SetFont('','', $default_font_size); |
|
252 | + $pdf->SetFont('','', $default_font_size); |
|
253 | 253 | $pdf->SetXY(10,32); |
254 | 254 | $pdf->MultiCell(0,2,$outputlangs->transnoentities("Account"),0,'L'); |
255 | 255 | pdf_bank($pdf,$outputlangs,32,32,$this->account,1); |
256 | 256 | |
257 | - $pdf->SetFont('','', $default_font_size); |
|
257 | + $pdf->SetFont('','', $default_font_size); |
|
258 | 258 | $pdf->SetXY(114,15); |
259 | - $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Signature"), 0, 'L'); |
|
259 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Signature"), 0, 'L'); |
|
260 | 260 | |
261 | 261 | $pdf->Rect(9, 14, 192, 35); |
262 | 262 | $pdf->line(9, 19, 112, 19); |
@@ -267,98 +267,98 @@ discard block |
||
267 | 267 | $pdf->line(30, 14, 30, 49); |
268 | 268 | $pdf->line(112, 14, 112, 49); |
269 | 269 | |
270 | - // Number of cheques |
|
271 | - $posy=51; |
|
272 | - $pdf->Rect(9, $posy, 192, 6); |
|
273 | - $pdf->line(55, $posy, 55, $posy+6); |
|
274 | - $pdf->line(140, $posy, 140, $posy+6); |
|
275 | - $pdf->line(170, $posy, 170, $posy+6); |
|
270 | + // Number of cheques |
|
271 | + $posy=51; |
|
272 | + $pdf->Rect(9, $posy, 192, 6); |
|
273 | + $pdf->line(55, $posy, 55, $posy+6); |
|
274 | + $pdf->line(140, $posy, 140, $posy+6); |
|
275 | + $pdf->line(170, $posy, 170, $posy+6); |
|
276 | 276 | |
277 | - $pdf->SetFont('','', $default_font_size); |
|
278 | - $pdf->SetXY(10,$posy+1); |
|
279 | - $pdf->MultiCell(40, 2, $outputlangs->transnoentities("NumberOfCheques"), 0, 'L'); |
|
277 | + $pdf->SetFont('','', $default_font_size); |
|
278 | + $pdf->SetXY(10,$posy+1); |
|
279 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("NumberOfCheques"), 0, 'L'); |
|
280 | 280 | |
281 | - $pdf->SetFont('','B', $default_font_size); |
|
281 | + $pdf->SetFont('','B', $default_font_size); |
|
282 | 282 | $pdf->SetXY(57,$posy+1); |
283 | 283 | $pdf->MultiCell(40, 2, $this->nbcheque, 0, 'L'); |
284 | 284 | |
285 | - $pdf->SetFont('','', $default_font_size); |
|
285 | + $pdf->SetFont('','', $default_font_size); |
|
286 | 286 | $pdf->SetXY(148,$posy+1); |
287 | - $pdf->MultiCell(40, 2, $langs->trans("Total")); |
|
287 | + $pdf->MultiCell(40, 2, $langs->trans("Total")); |
|
288 | 288 | |
289 | - $pdf->SetFont('','B', $default_font_size); |
|
290 | - $pdf->SetXY(170, $posy+1); |
|
291 | - $pdf->MultiCell(31, 2, price($this->amount), 0, 'C', 0); |
|
289 | + $pdf->SetFont('','B', $default_font_size); |
|
290 | + $pdf->SetXY(170, $posy+1); |
|
291 | + $pdf->MultiCell(31, 2, price($this->amount), 0, 'C', 0); |
|
292 | 292 | |
293 | - // Tableau |
|
294 | - $pdf->SetFont('','', $default_font_size - 2); |
|
295 | - $pdf->SetXY(11, $this->tab_top+2); |
|
296 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("Num"), 0, 'L'); |
|
297 | - $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); |
|
293 | + // Tableau |
|
294 | + $pdf->SetFont('','', $default_font_size - 2); |
|
295 | + $pdf->SetXY(11, $this->tab_top+2); |
|
296 | + $pdf->MultiCell(40,2,$outputlangs->transnoentities("Num"), 0, 'L'); |
|
297 | + $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); |
|
298 | 298 | |
299 | - $pdf->SetXY(41, $this->tab_top+2); |
|
299 | + $pdf->SetXY(41, $this->tab_top+2); |
|
300 | 300 | $pdf->MultiCell(40,2,$outputlangs->transnoentities("Bank"), 0, 'L'); |
301 | - $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10); |
|
301 | + $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10); |
|
302 | 302 | |
303 | 303 | $pdf->SetXY(101, $this->tab_top+2); |
304 | 304 | $pdf->MultiCell(40,2,$outputlangs->transnoentities("CheckTransmitter"), 0, 'L'); |
305 | - $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10); |
|
305 | + $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10); |
|
306 | 306 | |
307 | - $pdf->SetXY(180, $this->tab_top+2); |
|
308 | - $pdf->MultiCell(20,2,$outputlangs->transnoentities("Amount"), 0, 'R'); |
|
309 | - $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8); |
|
307 | + $pdf->SetXY(180, $this->tab_top+2); |
|
308 | + $pdf->MultiCell(20,2,$outputlangs->transnoentities("Amount"), 0, 'R'); |
|
309 | + $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8); |
|
310 | 310 | |
311 | - $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); |
|
312 | - } |
|
311 | + $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); |
|
312 | + } |
|
313 | 313 | |
314 | 314 | |
315 | 315 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
316 | - /** |
|
317 | - * Output array |
|
318 | - * |
|
319 | - * @param PDF $pdf PDF object |
|
320 | - * @param int $pagenb Page nb |
|
321 | - * @param int $pages Pages |
|
322 | - * @param Translate $outputlangs Object lang |
|
323 | - * @return void |
|
324 | - */ |
|
325 | - function Body(&$pdf, $pagenb, $pages, $outputlangs) |
|
326 | - { |
|
316 | + /** |
|
317 | + * Output array |
|
318 | + * |
|
319 | + * @param PDF $pdf PDF object |
|
320 | + * @param int $pagenb Page nb |
|
321 | + * @param int $pages Pages |
|
322 | + * @param Translate $outputlangs Object lang |
|
323 | + * @return void |
|
324 | + */ |
|
325 | + function Body(&$pdf, $pagenb, $pages, $outputlangs) |
|
326 | + { |
|
327 | 327 | // phpcs:enable |
328 | - // x=10 - Num |
|
329 | - // x=30 - Banque |
|
330 | - // x=100 - Emetteur |
|
331 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
332 | - $pdf->SetFont('','', $default_font_size - 1); |
|
333 | - $oldprowid = 0; |
|
334 | - $pdf->SetFillColor(220,220,220); |
|
335 | - $yp = 0; |
|
336 | - $lineinpage=0; |
|
337 | - $num=count($this->lines); |
|
338 | - for ($j = 0; $j < $num; $j++) |
|
339 | - { |
|
340 | - $lineinpage++; |
|
328 | + // x=10 - Num |
|
329 | + // x=30 - Banque |
|
330 | + // x=100 - Emetteur |
|
331 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
332 | + $pdf->SetFont('','', $default_font_size - 1); |
|
333 | + $oldprowid = 0; |
|
334 | + $pdf->SetFillColor(220,220,220); |
|
335 | + $yp = 0; |
|
336 | + $lineinpage=0; |
|
337 | + $num=count($this->lines); |
|
338 | + for ($j = 0; $j < $num; $j++) |
|
339 | + { |
|
340 | + $lineinpage++; |
|
341 | 341 | |
342 | - $pdf->SetXY(1, $this->tab_top + 10 + $yp); |
|
343 | - $pdf->MultiCell(8, $this->line_height, $j+1, 0, 'R', 0); |
|
342 | + $pdf->SetXY(1, $this->tab_top + 10 + $yp); |
|
343 | + $pdf->MultiCell(8, $this->line_height, $j+1, 0, 'R', 0); |
|
344 | 344 | |
345 | - $pdf->SetXY(10, $this->tab_top + 10 + $yp); |
|
346 | - $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq?$this->lines[$j]->num_chq:'', 0, 'L', 0); |
|
345 | + $pdf->SetXY(10, $this->tab_top + 10 + $yp); |
|
346 | + $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq?$this->lines[$j]->num_chq:'', 0, 'L', 0); |
|
347 | 347 | |
348 | - $pdf->SetXY(40, $this->tab_top + 10 + $yp); |
|
349 | - $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq),44), 0, 'L', 0); |
|
348 | + $pdf->SetXY(40, $this->tab_top + 10 + $yp); |
|
349 | + $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq),44), 0, 'L', 0); |
|
350 | 350 | |
351 | - $pdf->SetXY(100, $this->tab_top + 10 + $yp); |
|
352 | - $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq),50), 0, 'L', 0); |
|
351 | + $pdf->SetXY(100, $this->tab_top + 10 + $yp); |
|
352 | + $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq),50), 0, 'L', 0); |
|
353 | 353 | |
354 | - $pdf->SetXY(180, $this->tab_top + 10 + $yp); |
|
355 | - $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); |
|
354 | + $pdf->SetXY(180, $this->tab_top + 10 + $yp); |
|
355 | + $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); |
|
356 | 356 | |
357 | - $yp = $yp + $this->line_height; |
|
357 | + $yp = $yp + $this->line_height; |
|
358 | 358 | |
359 | - if ($lineinpage >= $this->line_per_page && $j < (count($this->lines)-1)) |
|
360 | - { |
|
361 | - $lineinpage=0; $yp=0; |
|
359 | + if ($lineinpage >= $this->line_per_page && $j < (count($this->lines)-1)) |
|
360 | + { |
|
361 | + $lineinpage=0; $yp=0; |
|
362 | 362 | |
363 | 363 | // New page |
364 | 364 | $pdf->AddPage(); |
@@ -367,35 +367,35 @@ discard block |
||
367 | 367 | $pdf->SetFont('','', $default_font_size - 1); |
368 | 368 | $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
369 | 369 | $pdf->SetTextColor(0,0,0); |
370 | - } |
|
371 | - } |
|
372 | - } |
|
370 | + } |
|
371 | + } |
|
372 | + } |
|
373 | 373 | |
374 | 374 | |
375 | - /** |
|
376 | - * Show footer of page. Need this->emetteur object |
|
375 | + /** |
|
376 | + * Show footer of page. Need this->emetteur object |
|
377 | 377 | * |
378 | - * @param PDF $pdf PDF |
|
379 | - * @param Object $object Object to show |
|
380 | - * @param Translate $outputlangs Object lang for output |
|
381 | - * @param int $hidefreetext 1=Hide free text |
|
382 | - * @return void |
|
383 | - */ |
|
384 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
385 | - { |
|
386 | - global $conf; |
|
387 | - $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
388 | - |
|
389 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
390 | - |
|
391 | - // Line of free text |
|
392 | - $newfreetext=''; |
|
393 | - $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | - if (! empty($conf->global->$paramfreetext)) |
|
395 | - { |
|
396 | - $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); |
|
397 | - } |
|
398 | - |
|
399 | - return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
400 | - } |
|
378 | + * @param PDF $pdf PDF |
|
379 | + * @param Object $object Object to show |
|
380 | + * @param Translate $outputlangs Object lang for output |
|
381 | + * @param int $hidefreetext 1=Hide free text |
|
382 | + * @return void |
|
383 | + */ |
|
384 | + function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
385 | + { |
|
386 | + global $conf; |
|
387 | + $default_font_size = pdf_getPDFFontSize($outputlangs); |
|
388 | + |
|
389 | + $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
390 | + |
|
391 | + // Line of free text |
|
392 | + $newfreetext=''; |
|
393 | + $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | + if (! empty($conf->global->$paramfreetext)) |
|
395 | + { |
|
396 | + $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); |
|
397 | + } |
|
398 | + |
|
399 | + return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
400 | + } |
|
401 | 401 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | function __construct($db) |
49 | 49 | { |
50 | - global $conf,$langs,$mysoc; |
|
50 | + global $conf, $langs, $mysoc; |
|
51 | 51 | |
52 | 52 | // Load traductions files requiredby by page |
53 | 53 | $langs->loadLangs(array("main", "bills")); |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | |
60 | 60 | // Dimension page pour format A4 |
61 | 61 | $this->type = 'pdf'; |
62 | - $formatarray=pdf_getFormat(); |
|
62 | + $formatarray = pdf_getFormat(); |
|
63 | 63 | $this->page_largeur = $formatarray['width']; |
64 | 64 | $this->page_hauteur = $formatarray['height']; |
65 | - $this->format = array($this->page_largeur,$this->page_hauteur); |
|
66 | - $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; |
|
67 | - $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; |
|
68 | - $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; |
|
69 | - $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; |
|
65 | + $this->format = array($this->page_largeur, $this->page_hauteur); |
|
66 | + $this->marge_gauche = isset($conf->global->MAIN_PDF_MARGIN_LEFT) ? $conf->global->MAIN_PDF_MARGIN_LEFT : 10; |
|
67 | + $this->marge_droite = isset($conf->global->MAIN_PDF_MARGIN_RIGHT) ? $conf->global->MAIN_PDF_MARGIN_RIGHT : 10; |
|
68 | + $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; |
|
69 | + $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; |
|
70 | 70 | |
71 | 71 | // Recupere emmetteur |
72 | - $this->emetteur=$mysoc; |
|
73 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
72 | + $this->emetteur = $mysoc; |
|
73 | + if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
74 | 74 | |
75 | 75 | // Defini position des colonnes |
76 | 76 | $this->line_height = 5; |
77 | 77 | $this->line_per_page = 40; |
78 | - $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
78 | + $this->tab_height = 200; //$this->line_height * $this->line_per_page; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
@@ -91,49 +91,49 @@ discard block |
||
91 | 91 | function write_file($object, $_dir, $number, $outputlangs) |
92 | 92 | { |
93 | 93 | // phpcs:enable |
94 | - global $user,$conf,$langs,$hookmanager; |
|
94 | + global $user, $conf, $langs, $hookmanager; |
|
95 | 95 | |
96 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
96 | + if (!is_object($outputlangs)) $outputlangs = $langs; |
|
97 | 97 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
98 | - $sav_charset_output=$outputlangs->charset_output; |
|
99 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
98 | + $sav_charset_output = $outputlangs->charset_output; |
|
99 | + if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
100 | 100 | |
101 | 101 | // Load traductions files requiredby by page |
102 | 102 | $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); |
103 | 103 | |
104 | - $dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number; |
|
104 | + $dir = $_dir."/".get_exdir($number, 0, 1, 0, $object, 'cheque').$number; |
|
105 | 105 | |
106 | - if (! is_dir($dir)) |
|
106 | + if (!is_dir($dir)) |
|
107 | 107 | { |
108 | - $result=dol_mkdir($dir); |
|
108 | + $result = dol_mkdir($dir); |
|
109 | 109 | |
110 | 110 | if ($result < 0) |
111 | 111 | { |
112 | - $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); |
|
112 | + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); |
|
113 | 113 | return -1; |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | - $file = $dir . "/bordereau-".$number.".pdf"; |
|
117 | + $file = $dir."/bordereau-".$number.".pdf"; |
|
118 | 118 | |
119 | 119 | // Add pdfgeneration hook |
120 | - if (! is_object($hookmanager)) |
|
120 | + if (!is_object($hookmanager)) |
|
121 | 121 | { |
122 | 122 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
123 | - $hookmanager=new HookManager($this->db); |
|
123 | + $hookmanager = new HookManager($this->db); |
|
124 | 124 | } |
125 | 125 | $hookmanager->initHooks(array('pdfgeneration')); |
126 | - $parameters=array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
126 | + $parameters = array('file'=>$file, 'outputlangs'=>$outputlangs); |
|
127 | 127 | global $action; |
128 | - $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks |
|
128 | + $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
129 | 129 | |
130 | 130 | // Create PDF instance |
131 | - $pdf=pdf_getInstance($this->format); |
|
132 | - $heightforinfotot = 50; // Height reserved to output the info and total part |
|
133 | - $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 |
|
134 | - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
135 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
136 | - $pdf->SetAutoPageBreak(1,0); |
|
131 | + $pdf = pdf_getInstance($this->format); |
|
132 | + $heightforinfotot = 50; // Height reserved to output the info and total part |
|
133 | + $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 |
|
134 | + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
|
135 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
136 | + $pdf->SetAutoPageBreak(1, 0); |
|
137 | 137 | |
138 | 138 | if (class_exists('TCPDF')) |
139 | 139 | { |
@@ -143,23 +143,23 @@ discard block |
||
143 | 143 | $pdf->SetFont(pdf_getPDFFont($outputlangs)); |
144 | 144 | |
145 | 145 | $pdf->Open(); |
146 | - $pagenb=0; |
|
147 | - $pdf->SetDrawColor(128,128,128); |
|
146 | + $pagenb = 0; |
|
147 | + $pdf->SetDrawColor(128, 128, 128); |
|
148 | 148 | |
149 | 149 | $pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number); |
150 | 150 | $pdf->SetSubject($outputlangs->transnoentities("CheckReceipt")); |
151 | 151 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
152 | 152 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
153 | 153 | $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); |
154 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
154 | + if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
155 | 155 | |
156 | - $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
156 | + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
|
157 | 157 | |
158 | - $nboflines=count($this->lines); |
|
158 | + $nboflines = count($this->lines); |
|
159 | 159 | |
160 | 160 | // Define nb of page |
161 | 161 | $pages = intval($nboflines / $this->line_per_page); |
162 | - if (($nboflines % $this->line_per_page)>0) |
|
162 | + if (($nboflines % $this->line_per_page) > 0) |
|
163 | 163 | { |
164 | 164 | $pages++; |
165 | 165 | } |
@@ -176,31 +176,31 @@ discard block |
||
176 | 176 | $this->Body($pdf, $pagenb, $pages, $outputlangs); |
177 | 177 | |
178 | 178 | // Pied de page |
179 | - $this->_pagefoot($pdf,'',$outputlangs); |
|
180 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
179 | + $this->_pagefoot($pdf, '', $outputlangs); |
|
180 | + if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
181 | 181 | |
182 | 182 | $pdf->Close(); |
183 | 183 | |
184 | - $pdf->Output($file,'F'); |
|
184 | + $pdf->Output($file, 'F'); |
|
185 | 185 | |
186 | 186 | // Add pdfgeneration hook |
187 | - if (! is_object($hookmanager)) |
|
187 | + if (!is_object($hookmanager)) |
|
188 | 188 | { |
189 | 189 | include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
190 | - $hookmanager=new HookManager($this->db); |
|
190 | + $hookmanager = new HookManager($this->db); |
|
191 | 191 | } |
192 | 192 | $hookmanager->initHooks(array('pdfgeneration')); |
193 | - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); |
|
193 | + $parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); |
|
194 | 194 | global $action; |
195 | - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
|
195 | + $reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
|
196 | 196 | |
197 | - if (! empty($conf->global->MAIN_UMASK)) |
|
197 | + if (!empty($conf->global->MAIN_UMASK)) |
|
198 | 198 | @chmod($file, octdec($conf->global->MAIN_UMASK)); |
199 | 199 | |
200 | 200 | $this->result = array('fullpath'=>$file); |
201 | 201 | |
202 | - $outputlangs->charset_output=$sav_charset_output; |
|
203 | - return 1; // Pas d'erreur |
|
202 | + $outputlangs->charset_output = $sav_charset_output; |
|
203 | + return 1; // Pas d'erreur |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -224,38 +224,38 @@ discard block |
||
224 | 224 | $outputlangs->loadLangs(array("compta", "banks")); |
225 | 225 | |
226 | 226 | $title = $outputlangs->transnoentities("CheckReceipt"); |
227 | - $pdf->SetFont('','B', $default_font_size); |
|
228 | - $pdf->SetXY(10,8); |
|
229 | - $pdf->MultiCell(0,2,$title,0,'L'); |
|
230 | - |
|
231 | - $pdf->SetFont('','', $default_font_size); |
|
232 | - $pdf->SetXY(10,15); |
|
233 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Ref"),0,'L'); |
|
234 | - $pdf->SetXY(32,15); |
|
235 | - $pdf->SetFont('','', $default_font_size); |
|
236 | - $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext?" - ".$this->ref_ext:'')), 0, 'L'); |
|
237 | - |
|
238 | - $pdf->SetFont('','', $default_font_size); |
|
239 | - $pdf->SetXY(10,20); |
|
240 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Date"),0,'L'); |
|
241 | - $pdf->SetXY(32,20); |
|
242 | - $pdf->SetFont('','', $default_font_size); |
|
243 | - $pdf->MultiCell(60, 2, dol_print_date($this->date,"day",false,$outputlangs)); |
|
244 | - |
|
245 | - $pdf->SetFont('','', $default_font_size); |
|
246 | - $pdf->SetXY(10,26); |
|
247 | - $pdf->MultiCell(22,2,$outputlangs->transnoentities("Owner"),0,'L'); |
|
248 | - $pdf->SetFont('','', $default_font_size); |
|
249 | - $pdf->SetXY(32,26); |
|
250 | - $pdf->MultiCell(60,2,$outputlangs->convToOutputCharset($this->account->proprio),0,'L'); |
|
251 | - |
|
252 | - $pdf->SetFont('','', $default_font_size); |
|
253 | - $pdf->SetXY(10,32); |
|
254 | - $pdf->MultiCell(0,2,$outputlangs->transnoentities("Account"),0,'L'); |
|
255 | - pdf_bank($pdf,$outputlangs,32,32,$this->account,1); |
|
256 | - |
|
257 | - $pdf->SetFont('','', $default_font_size); |
|
258 | - $pdf->SetXY(114,15); |
|
227 | + $pdf->SetFont('', 'B', $default_font_size); |
|
228 | + $pdf->SetXY(10, 8); |
|
229 | + $pdf->MultiCell(0, 2, $title, 0, 'L'); |
|
230 | + |
|
231 | + $pdf->SetFont('', '', $default_font_size); |
|
232 | + $pdf->SetXY(10, 15); |
|
233 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Ref"), 0, 'L'); |
|
234 | + $pdf->SetXY(32, 15); |
|
235 | + $pdf->SetFont('', '', $default_font_size); |
|
236 | + $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->ref.($this->ref_ext ? " - ".$this->ref_ext : '')), 0, 'L'); |
|
237 | + |
|
238 | + $pdf->SetFont('', '', $default_font_size); |
|
239 | + $pdf->SetXY(10, 20); |
|
240 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Date"), 0, 'L'); |
|
241 | + $pdf->SetXY(32, 20); |
|
242 | + $pdf->SetFont('', '', $default_font_size); |
|
243 | + $pdf->MultiCell(60, 2, dol_print_date($this->date, "day", false, $outputlangs)); |
|
244 | + |
|
245 | + $pdf->SetFont('', '', $default_font_size); |
|
246 | + $pdf->SetXY(10, 26); |
|
247 | + $pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L'); |
|
248 | + $pdf->SetFont('', '', $default_font_size); |
|
249 | + $pdf->SetXY(32, 26); |
|
250 | + $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L'); |
|
251 | + |
|
252 | + $pdf->SetFont('', '', $default_font_size); |
|
253 | + $pdf->SetXY(10, 32); |
|
254 | + $pdf->MultiCell(0, 2, $outputlangs->transnoentities("Account"), 0, 'L'); |
|
255 | + pdf_bank($pdf, $outputlangs, 32, 32, $this->account, 1); |
|
256 | + |
|
257 | + $pdf->SetFont('', '', $default_font_size); |
|
258 | + $pdf->SetXY(114, 15); |
|
259 | 259 | $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Signature"), 0, 'L'); |
260 | 260 | |
261 | 261 | $pdf->Rect(9, 14, 192, 35); |
@@ -268,44 +268,44 @@ discard block |
||
268 | 268 | $pdf->line(112, 14, 112, 49); |
269 | 269 | |
270 | 270 | // Number of cheques |
271 | - $posy=51; |
|
271 | + $posy = 51; |
|
272 | 272 | $pdf->Rect(9, $posy, 192, 6); |
273 | - $pdf->line(55, $posy, 55, $posy+6); |
|
274 | - $pdf->line(140, $posy, 140, $posy+6); |
|
275 | - $pdf->line(170, $posy, 170, $posy+6); |
|
273 | + $pdf->line(55, $posy, 55, $posy + 6); |
|
274 | + $pdf->line(140, $posy, 140, $posy + 6); |
|
275 | + $pdf->line(170, $posy, 170, $posy + 6); |
|
276 | 276 | |
277 | - $pdf->SetFont('','', $default_font_size); |
|
278 | - $pdf->SetXY(10,$posy+1); |
|
277 | + $pdf->SetFont('', '', $default_font_size); |
|
278 | + $pdf->SetXY(10, $posy + 1); |
|
279 | 279 | $pdf->MultiCell(40, 2, $outputlangs->transnoentities("NumberOfCheques"), 0, 'L'); |
280 | 280 | |
281 | - $pdf->SetFont('','B', $default_font_size); |
|
282 | - $pdf->SetXY(57,$posy+1); |
|
281 | + $pdf->SetFont('', 'B', $default_font_size); |
|
282 | + $pdf->SetXY(57, $posy + 1); |
|
283 | 283 | $pdf->MultiCell(40, 2, $this->nbcheque, 0, 'L'); |
284 | 284 | |
285 | - $pdf->SetFont('','', $default_font_size); |
|
286 | - $pdf->SetXY(148,$posy+1); |
|
285 | + $pdf->SetFont('', '', $default_font_size); |
|
286 | + $pdf->SetXY(148, $posy + 1); |
|
287 | 287 | $pdf->MultiCell(40, 2, $langs->trans("Total")); |
288 | 288 | |
289 | - $pdf->SetFont('','B', $default_font_size); |
|
290 | - $pdf->SetXY(170, $posy+1); |
|
289 | + $pdf->SetFont('', 'B', $default_font_size); |
|
290 | + $pdf->SetXY(170, $posy + 1); |
|
291 | 291 | $pdf->MultiCell(31, 2, price($this->amount), 0, 'C', 0); |
292 | 292 | |
293 | 293 | // Tableau |
294 | - $pdf->SetFont('','', $default_font_size - 2); |
|
295 | - $pdf->SetXY(11, $this->tab_top+2); |
|
296 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("Num"), 0, 'L'); |
|
294 | + $pdf->SetFont('', '', $default_font_size - 2); |
|
295 | + $pdf->SetXY(11, $this->tab_top + 2); |
|
296 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Num"), 0, 'L'); |
|
297 | 297 | $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); |
298 | 298 | |
299 | - $pdf->SetXY(41, $this->tab_top+2); |
|
300 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("Bank"), 0, 'L'); |
|
299 | + $pdf->SetXY(41, $this->tab_top + 2); |
|
300 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Bank"), 0, 'L'); |
|
301 | 301 | $pdf->line(100, $this->tab_top, 100, $this->tab_top + $this->tab_height + 10); |
302 | 302 | |
303 | - $pdf->SetXY(101, $this->tab_top+2); |
|
304 | - $pdf->MultiCell(40,2,$outputlangs->transnoentities("CheckTransmitter"), 0, 'L'); |
|
303 | + $pdf->SetXY(101, $this->tab_top + 2); |
|
304 | + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("CheckTransmitter"), 0, 'L'); |
|
305 | 305 | $pdf->line(180, $this->tab_top, 180, $this->tab_top + $this->tab_height + 10); |
306 | 306 | |
307 | - $pdf->SetXY(180, $this->tab_top+2); |
|
308 | - $pdf->MultiCell(20,2,$outputlangs->transnoentities("Amount"), 0, 'R'); |
|
307 | + $pdf->SetXY(180, $this->tab_top + 2); |
|
308 | + $pdf->MultiCell(20, 2, $outputlangs->transnoentities("Amount"), 0, 'R'); |
|
309 | 309 | $pdf->line(9, $this->tab_top + 8, 201, $this->tab_top + 8); |
310 | 310 | |
311 | 311 | $pdf->Rect(9, $this->tab_top, 192, $this->tab_height + 10); |
@@ -329,44 +329,44 @@ discard block |
||
329 | 329 | // x=30 - Banque |
330 | 330 | // x=100 - Emetteur |
331 | 331 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
332 | - $pdf->SetFont('','', $default_font_size - 1); |
|
332 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
333 | 333 | $oldprowid = 0; |
334 | - $pdf->SetFillColor(220,220,220); |
|
334 | + $pdf->SetFillColor(220, 220, 220); |
|
335 | 335 | $yp = 0; |
336 | - $lineinpage=0; |
|
337 | - $num=count($this->lines); |
|
336 | + $lineinpage = 0; |
|
337 | + $num = count($this->lines); |
|
338 | 338 | for ($j = 0; $j < $num; $j++) |
339 | 339 | { |
340 | 340 | $lineinpage++; |
341 | 341 | |
342 | 342 | $pdf->SetXY(1, $this->tab_top + 10 + $yp); |
343 | - $pdf->MultiCell(8, $this->line_height, $j+1, 0, 'R', 0); |
|
343 | + $pdf->MultiCell(8, $this->line_height, $j + 1, 0, 'R', 0); |
|
344 | 344 | |
345 | 345 | $pdf->SetXY(10, $this->tab_top + 10 + $yp); |
346 | - $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq?$this->lines[$j]->num_chq:'', 0, 'L', 0); |
|
346 | + $pdf->MultiCell(30, $this->line_height, $this->lines[$j]->num_chq ? $this->lines[$j]->num_chq : '', 0, 'L', 0); |
|
347 | 347 | |
348 | 348 | $pdf->SetXY(40, $this->tab_top + 10 + $yp); |
349 | - $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq),44), 0, 'L', 0); |
|
349 | + $pdf->MultiCell(70, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->bank_chq), 44), 0, 'L', 0); |
|
350 | 350 | |
351 | 351 | $pdf->SetXY(100, $this->tab_top + 10 + $yp); |
352 | - $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq),50), 0, 'L', 0); |
|
352 | + $pdf->MultiCell(80, $this->line_height, dol_trunc($outputlangs->convToOutputCharset($this->lines[$j]->emetteur_chq), 50), 0, 'L', 0); |
|
353 | 353 | |
354 | 354 | $pdf->SetXY(180, $this->tab_top + 10 + $yp); |
355 | 355 | $pdf->MultiCell(20, $this->line_height, price($this->lines[$j]->amount_chq), 0, 'R', 0); |
356 | 356 | |
357 | 357 | $yp = $yp + $this->line_height; |
358 | 358 | |
359 | - if ($lineinpage >= $this->line_per_page && $j < (count($this->lines)-1)) |
|
359 | + if ($lineinpage >= $this->line_per_page && $j < (count($this->lines) - 1)) |
|
360 | 360 | { |
361 | - $lineinpage=0; $yp=0; |
|
361 | + $lineinpage = 0; $yp = 0; |
|
362 | 362 | |
363 | 363 | // New page |
364 | 364 | $pdf->AddPage(); |
365 | 365 | $pagenb++; |
366 | 366 | $this->Header($pdf, $pagenb, $pages, $outputlangs); |
367 | - $pdf->SetFont('','', $default_font_size - 1); |
|
368 | - $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
369 | - $pdf->SetTextColor(0,0,0); |
|
367 | + $pdf->SetFont('', '', $default_font_size - 1); |
|
368 | + $pdf->MultiCell(0, 3, ''); // Set interline to 3 |
|
369 | + $pdf->SetTextColor(0, 0, 0); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | * @param int $hidefreetext 1=Hide free text |
382 | 382 | * @return void |
383 | 383 | */ |
384 | - function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) |
|
384 | + function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) |
|
385 | 385 | { |
386 | 386 | global $conf; |
387 | 387 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
388 | 388 | |
389 | - $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
389 | + $showdetails = $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; |
|
390 | 390 | |
391 | 391 | // Line of free text |
392 | - $newfreetext=''; |
|
393 | - $paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | - if (! empty($conf->global->$paramfreetext)) |
|
392 | + $newfreetext = ''; |
|
393 | + $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT'; |
|
394 | + if (!empty($conf->global->$paramfreetext)) |
|
395 | 395 | { |
396 | - $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); |
|
396 | + $newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray); |
|
397 | 397 | } |
398 | 398 | |
399 | - return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); |
|
399 | + return pdf_pagefoot($pdf, $outputlangs, $newfreetext, $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); |
|
400 | 400 | } |
401 | 401 | } |
@@ -70,7 +70,10 @@ discard block |
||
70 | 70 | |
71 | 71 | // Recupere emmetteur |
72 | 72 | $this->emetteur=$mysoc; |
73 | - if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined |
|
73 | + if (! $this->emetteur->country_code) { |
|
74 | + $this->emetteur->country_code=substr($langs->defaultlang,-2); |
|
75 | + } |
|
76 | + // By default if not defined |
|
74 | 77 | |
75 | 78 | // Defini position des colonnes |
76 | 79 | $this->line_height = 5; |
@@ -93,10 +96,14 @@ discard block |
||
93 | 96 | // phpcs:enable |
94 | 97 | global $user,$conf,$langs,$hookmanager; |
95 | 98 | |
96 | - if (! is_object($outputlangs)) $outputlangs=$langs; |
|
99 | + if (! is_object($outputlangs)) { |
|
100 | + $outputlangs=$langs; |
|
101 | + } |
|
97 | 102 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
98 | 103 | $sav_charset_output=$outputlangs->charset_output; |
99 | - if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; |
|
104 | + if (! empty($conf->global->MAIN_USE_FPDF)) { |
|
105 | + $outputlangs->charset_output='ISO-8859-1'; |
|
106 | + } |
|
100 | 107 | |
101 | 108 | // Load traductions files requiredby by page |
102 | 109 | $outputlangs->loadLangs(array("main", "companies", "bills", "products", "compta")); |
@@ -132,7 +139,9 @@ discard block |
||
132 | 139 | $heightforinfotot = 50; // Height reserved to output the info and total part |
133 | 140 | $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 |
134 | 141 | $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
135 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; |
|
142 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) { |
|
143 | + $heightforfooter+= 6; |
|
144 | + } |
|
136 | 145 | $pdf->SetAutoPageBreak(1,0); |
137 | 146 | |
138 | 147 | if (class_exists('TCPDF')) |
@@ -151,7 +160,9 @@ discard block |
||
151 | 160 | $pdf->SetCreator("Dolibarr ".DOL_VERSION); |
152 | 161 | $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); |
153 | 162 | $pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number); |
154 | - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); |
|
163 | + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { |
|
164 | + $pdf->SetCompression(false); |
|
165 | + } |
|
155 | 166 | |
156 | 167 | $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right |
157 | 168 | |
@@ -177,7 +188,9 @@ discard block |
||
177 | 188 | |
178 | 189 | // Pied de page |
179 | 190 | $this->_pagefoot($pdf,'',$outputlangs); |
180 | - if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); |
|
191 | + if (method_exists($pdf,'AliasNbPages')) { |
|
192 | + $pdf->AliasNbPages(); |
|
193 | + } |
|
181 | 194 | |
182 | 195 | $pdf->Close(); |
183 | 196 | |
@@ -194,8 +207,9 @@ discard block |
||
194 | 207 | global $action; |
195 | 208 | $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks |
196 | 209 | |
197 | - if (! empty($conf->global->MAIN_UMASK)) |
|
198 | - @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
210 | + if (! empty($conf->global->MAIN_UMASK)) { |
|
211 | + @chmod($file, octdec($conf->global->MAIN_UMASK)); |
|
212 | + } |
|
199 | 213 | |
200 | 214 | $this->result = array('fullpath'=>$file); |
201 | 215 |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts |
31 | 31 | { |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * Dolibarr version of the loaded document |
34 | 34 | * @public string |
35 | 35 | */ |
36 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
36 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | 37 | |
38 | - public $prefix='CHK'; |
|
38 | + public $prefix='CHK'; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @var string Error code (or message) |
|
42 | - */ |
|
43 | - public $error=''; |
|
40 | + /** |
|
41 | + * @var string Error code (or message) |
|
42 | + */ |
|
43 | + public $error=''; |
|
44 | 44 | |
45 | - public $name='Mint'; |
|
45 | + public $name='Mint'; |
|
46 | 46 | |
47 | 47 | |
48 | 48 | /** |
@@ -52,110 +52,110 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function info() |
54 | 54 | { |
55 | - global $langs; |
|
56 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
55 | + global $langs; |
|
56 | + return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * Renvoi un exemple de numerotation |
|
62 | - * |
|
63 | - * @return string Example |
|
64 | - */ |
|
65 | - function getExample() |
|
66 | - { |
|
67 | - return $this->prefix."0501-0001"; |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * Test si les numeros deje en vigueur dans la base ne provoquent pas de |
|
73 | - * de conflits qui empechera cette numerotation de fonctionner. |
|
74 | - * |
|
75 | - * @return boolean false si conflit, true si ok |
|
76 | - */ |
|
77 | - function canBeActivated() |
|
78 | - { |
|
79 | - global $conf,$langs,$db; |
|
80 | - |
|
81 | - $payyymm=''; $max=''; |
|
82 | - |
|
83 | - $posindice=9; |
|
84 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
85 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | - $sql.= " AND entity = ".$conf->entity; |
|
88 | - |
|
89 | - $resql=$db->query($sql); |
|
90 | - if ($resql) |
|
91 | - { |
|
92 | - $row = $db->fetch_row($resql); |
|
93 | - if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; } |
|
94 | - } |
|
95 | - if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm)) |
|
96 | - { |
|
97 | - $langs->load("errors"); |
|
98 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
99 | - return false; |
|
100 | - } |
|
101 | - |
|
102 | - return true; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Return next free value |
|
107 | - * |
|
108 | - * @param Societe $objsoc Object thirdparty |
|
109 | - * @param Object $object Object we need next value for |
|
110 | - * @return string Value if KO, <0 if KO |
|
111 | - */ |
|
112 | - function getNextValue($objsoc,$object) |
|
113 | - { |
|
114 | - global $db,$conf; |
|
115 | - |
|
116 | - // D'abord on recupere la valeur max |
|
117 | - $posindice=9; |
|
118 | - $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
119 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | - $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | - $sql.= " AND entity = ".$conf->entity; |
|
122 | - |
|
123 | - $resql=$db->query($sql); |
|
124 | - if ($resql) |
|
125 | - { |
|
126 | - $obj = $db->fetch_object($resql); |
|
127 | - if ($obj) $max = intval($obj->max); |
|
128 | - else $max=0; |
|
129 | - } |
|
130 | - else |
|
131 | - { |
|
132 | - dol_syslog(__METHOD__, LOG_DEBUG); |
|
133 | - return -1; |
|
134 | - } |
|
135 | - |
|
136 | - //$date=time(); |
|
137 | - $date=$object->date_bordereau; |
|
138 | - $yymm = strftime("%y%m",$date); |
|
139 | - |
|
140 | - 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 |
|
141 | - else $num = sprintf("%04s",$max+1); |
|
142 | - |
|
143 | - dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
|
144 | - return $this->prefix.$yymm."-".$num; |
|
145 | - } |
|
60 | + /** |
|
61 | + * Renvoi un exemple de numerotation |
|
62 | + * |
|
63 | + * @return string Example |
|
64 | + */ |
|
65 | + function getExample() |
|
66 | + { |
|
67 | + return $this->prefix."0501-0001"; |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * Test si les numeros deje en vigueur dans la base ne provoquent pas de |
|
73 | + * de conflits qui empechera cette numerotation de fonctionner. |
|
74 | + * |
|
75 | + * @return boolean false si conflit, true si ok |
|
76 | + */ |
|
77 | + function canBeActivated() |
|
78 | + { |
|
79 | + global $conf,$langs,$db; |
|
80 | + |
|
81 | + $payyymm=''; $max=''; |
|
82 | + |
|
83 | + $posindice=9; |
|
84 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
85 | + $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | + $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | + $sql.= " AND entity = ".$conf->entity; |
|
88 | + |
|
89 | + $resql=$db->query($sql); |
|
90 | + if ($resql) |
|
91 | + { |
|
92 | + $row = $db->fetch_row($resql); |
|
93 | + if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; } |
|
94 | + } |
|
95 | + if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm)) |
|
96 | + { |
|
97 | + $langs->load("errors"); |
|
98 | + $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
99 | + return false; |
|
100 | + } |
|
101 | + |
|
102 | + return true; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Return next free value |
|
107 | + * |
|
108 | + * @param Societe $objsoc Object thirdparty |
|
109 | + * @param Object $object Object we need next value for |
|
110 | + * @return string Value if KO, <0 if KO |
|
111 | + */ |
|
112 | + function getNextValue($objsoc,$object) |
|
113 | + { |
|
114 | + global $db,$conf; |
|
115 | + |
|
116 | + // D'abord on recupere la valeur max |
|
117 | + $posindice=9; |
|
118 | + $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
|
119 | + $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | + $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | + $sql.= " AND entity = ".$conf->entity; |
|
122 | + |
|
123 | + $resql=$db->query($sql); |
|
124 | + if ($resql) |
|
125 | + { |
|
126 | + $obj = $db->fetch_object($resql); |
|
127 | + if ($obj) $max = intval($obj->max); |
|
128 | + else $max=0; |
|
129 | + } |
|
130 | + else |
|
131 | + { |
|
132 | + dol_syslog(__METHOD__, LOG_DEBUG); |
|
133 | + return -1; |
|
134 | + } |
|
135 | + |
|
136 | + //$date=time(); |
|
137 | + $date=$object->date_bordereau; |
|
138 | + $yymm = strftime("%y%m",$date); |
|
139 | + |
|
140 | + 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 |
|
141 | + else $num = sprintf("%04s",$max+1); |
|
142 | + |
|
143 | + dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
|
144 | + return $this->prefix.$yymm."-".$num; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
149 | - /** |
|
150 | - * Return next free value |
|
151 | - * |
|
152 | - * @param Societe $objsoc Object third party |
|
153 | - * @param string $objforref Object for number to search |
|
154 | - * @return string Next free value |
|
155 | - */ |
|
156 | - function chequereceipt_get_num($objsoc,$objforref) |
|
157 | - { |
|
149 | + /** |
|
150 | + * Return next free value |
|
151 | + * |
|
152 | + * @param Societe $objsoc Object third party |
|
153 | + * @param string $objforref Object for number to search |
|
154 | + * @return string Next free value |
|
155 | + */ |
|
156 | + function chequereceipt_get_num($objsoc,$objforref) |
|
157 | + { |
|
158 | 158 | // phpcs:enable |
159 | - return $this->getNextValue($objsoc,$objforref); |
|
160 | - } |
|
159 | + return $this->getNextValue($objsoc,$objforref); |
|
160 | + } |
|
161 | 161 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File containing class for numbering module Mint |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/cheque/modules_chequereceipts.php'; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Class to manage cheque receipts numbering rules Mint |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | * Dolibarr version of the loaded document |
34 | 34 | * @public string |
35 | 35 | */ |
36 | - public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
36 | + public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' |
|
37 | 37 | |
38 | - public $prefix='CHK'; |
|
38 | + public $prefix = 'CHK'; |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * @var string Error code (or message) |
42 | 42 | */ |
43 | - public $error=''; |
|
43 | + public $error = ''; |
|
44 | 44 | |
45 | - public $name='Mint'; |
|
45 | + public $name = 'Mint'; |
|
46 | 46 | |
47 | 47 | |
48 | 48 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function info() |
54 | 54 | { |
55 | 55 | global $langs; |
56 | - return $langs->trans("SimpleNumRefModelDesc",$this->prefix); |
|
56 | + return $langs->trans("SimpleNumRefModelDesc", $this->prefix); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -76,26 +76,26 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function canBeActivated() |
78 | 78 | { |
79 | - global $conf,$langs,$db; |
|
79 | + global $conf, $langs, $db; |
|
80 | 80 | |
81 | - $payyymm=''; $max=''; |
|
81 | + $payyymm = ''; $max = ''; |
|
82 | 82 | |
83 | - $posindice=9; |
|
83 | + $posindice = 9; |
|
84 | 84 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
85 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | - $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | - $sql.= " AND entity = ".$conf->entity; |
|
85 | + $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
86 | + $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; |
|
87 | + $sql .= " AND entity = ".$conf->entity; |
|
88 | 88 | |
89 | - $resql=$db->query($sql); |
|
89 | + $resql = $db->query($sql); |
|
90 | 90 | if ($resql) |
91 | 91 | { |
92 | 92 | $row = $db->fetch_row($resql); |
93 | - if ($row) { $payyymm = substr($row[0],0,6); $max=$row[0]; } |
|
93 | + if ($row) { $payyymm = substr($row[0], 0, 6); $max = $row[0]; } |
|
94 | 94 | } |
95 | - if ($payyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$payyymm)) |
|
95 | + if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) |
|
96 | 96 | { |
97 | 97 | $langs->load("errors"); |
98 | - $this->error=$langs->trans('ErrorNumRefModel', $max); |
|
98 | + $this->error = $langs->trans('ErrorNumRefModel', $max); |
|
99 | 99 | return false; |
100 | 100 | } |
101 | 101 | |
@@ -109,23 +109,23 @@ discard block |
||
109 | 109 | * @param Object $object Object we need next value for |
110 | 110 | * @return string Value if KO, <0 if KO |
111 | 111 | */ |
112 | - function getNextValue($objsoc,$object) |
|
112 | + function getNextValue($objsoc, $object) |
|
113 | 113 | { |
114 | - global $db,$conf; |
|
114 | + global $db, $conf; |
|
115 | 115 | |
116 | 116 | // D'abord on recupere la valeur max |
117 | - $posindice=9; |
|
117 | + $posindice = 9; |
|
118 | 118 | $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; |
119 | - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | - $sql.= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | - $sql.= " AND entity = ".$conf->entity; |
|
119 | + $sql .= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; |
|
120 | + $sql .= " WHERE ref like '".$db->escape($this->prefix)."____-%'"; |
|
121 | + $sql .= " AND entity = ".$conf->entity; |
|
122 | 122 | |
123 | - $resql=$db->query($sql); |
|
123 | + $resql = $db->query($sql); |
|
124 | 124 | if ($resql) |
125 | 125 | { |
126 | 126 | $obj = $db->fetch_object($resql); |
127 | 127 | if ($obj) $max = intval($obj->max); |
128 | - else $max=0; |
|
128 | + else $max = 0; |
|
129 | 129 | } |
130 | 130 | else |
131 | 131 | { |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | //$date=time(); |
137 | - $date=$object->date_bordereau; |
|
138 | - $yymm = strftime("%y%m",$date); |
|
137 | + $date = $object->date_bordereau; |
|
138 | + $yymm = strftime("%y%m", $date); |
|
139 | 139 | |
140 | - 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 |
|
141 | - else $num = sprintf("%04s",$max+1); |
|
140 | + 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 |
|
141 | + else $num = sprintf("%04s", $max + 1); |
|
142 | 142 | |
143 | 143 | dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
144 | 144 | return $this->prefix.$yymm."-".$num; |
@@ -153,9 +153,9 @@ discard block |
||
153 | 153 | * @param string $objforref Object for number to search |
154 | 154 | * @return string Next free value |
155 | 155 | */ |
156 | - function chequereceipt_get_num($objsoc,$objforref) |
|
156 | + function chequereceipt_get_num($objsoc, $objforref) |
|
157 | 157 | { |
158 | 158 | // phpcs:enable |
159 | - return $this->getNextValue($objsoc,$objforref); |
|
159 | + return $this->getNextValue($objsoc, $objforref); |
|
160 | 160 | } |
161 | 161 | } |
@@ -124,10 +124,12 @@ discard block |
||
124 | 124 | if ($resql) |
125 | 125 | { |
126 | 126 | $obj = $db->fetch_object($resql); |
127 | - if ($obj) $max = intval($obj->max); |
|
128 | - else $max=0; |
|
129 | - } |
|
130 | - else |
|
127 | + if ($obj) { |
|
128 | + $max = intval($obj->max); |
|
129 | + } else { |
|
130 | + $max=0; |
|
131 | + } |
|
132 | + } else |
|
131 | 133 | { |
132 | 134 | dol_syslog(__METHOD__, LOG_DEBUG); |
133 | 135 | return -1; |
@@ -137,8 +139,13 @@ discard block |
||
137 | 139 | $date=$object->date_bordereau; |
138 | 140 | $yymm = strftime("%y%m",$date); |
139 | 141 | |
140 | - 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 |
|
141 | - else $num = sprintf("%04s",$max+1); |
|
142 | + if ($max >= (pow(10, 4) - 1)) { |
|
143 | + $num=$max+1; |
|
144 | + } |
|
145 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
146 | + else { |
|
147 | + $num = sprintf("%04s",$max+1); |
|
148 | + } |
|
142 | 149 | |
143 | 150 | dol_syslog(__METHOD__." return ".$this->prefix.$yymm."-".$num); |
144 | 151 | return $this->prefix.$yymm."-".$num; |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | */ |
31 | 31 | class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts |
32 | 32 | { |
33 | - /** |
|
33 | + /** |
|
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 | - /** |
|
40 | - * @var string Error message |
|
41 | - */ |
|
42 | - public $error = ''; |
|
39 | + /** |
|
40 | + * @var string Error message |
|
41 | + */ |
|
42 | + public $error = ''; |
|
43 | 43 | |
44 | - public $name = 'Thyme'; |
|
44 | + public $name = 'Thyme'; |
|
45 | 45 | |
46 | 46 | |
47 | 47 | /** |
@@ -49,39 +49,39 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @return string Texte descripif |
51 | 51 | */ |
52 | - function info() |
|
52 | + function info() |
|
53 | 53 | { |
54 | - global $conf, $langs; |
|
54 | + global $conf, $langs; |
|
55 | 55 | |
56 | - $langs->load("bills"); |
|
56 | + $langs->load("bills"); |
|
57 | 57 | |
58 | - $form = new Form($this->db); |
|
58 | + $form = new Form($this->db); |
|
59 | 59 | |
60 | - $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
61 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | - $texte.= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
60 | + $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
|
61 | + $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | + $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | + $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | + $texte.= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | + $texte.= '<table class="nobordernopadding" width="100%">'; |
|
66 | 66 | |
67 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
68 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
69 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
70 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
71 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
67 | + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
68 | + $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
69 | + $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
70 | + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
71 | + $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
72 | 72 | |
73 | - // Parametrage du prefix |
|
74 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">',$tooltip,1,1).'</td>'; |
|
73 | + // Parametrage du prefix |
|
74 | + $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | + $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">',$tooltip,1,1).'</td>'; |
|
76 | 76 | |
77 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
77 | + $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
78 | 78 | |
79 | - $texte.= '</tr>'; |
|
79 | + $texte.= '</tr>'; |
|
80 | 80 | |
81 | - $texte.= '</table>'; |
|
82 | - $texte.= '</form>'; |
|
81 | + $texte.= '</table>'; |
|
82 | + $texte.= '</form>'; |
|
83 | 83 | |
84 | - return $texte; |
|
84 | + return $texte; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -91,55 +91,55 @@ discard block |
||
91 | 91 | */ |
92 | 92 | function getExample() |
93 | 93 | { |
94 | - global $conf,$langs,$mysoc; |
|
95 | - |
|
96 | - $old_code_client=$mysoc->code_client; |
|
97 | - $mysoc->code_client='CCCCCCCCCC'; |
|
98 | - $numExample = $this->getNextValue($mysoc,''); |
|
99 | - $mysoc->code_client=$old_code_client; |
|
100 | - |
|
101 | - if (! $numExample) |
|
102 | - { |
|
103 | - $numExample = $langs->trans('NotConfigured'); |
|
104 | - } |
|
105 | - return $numExample; |
|
94 | + global $conf,$langs,$mysoc; |
|
95 | + |
|
96 | + $old_code_client=$mysoc->code_client; |
|
97 | + $mysoc->code_client='CCCCCCCCCC'; |
|
98 | + $numExample = $this->getNextValue($mysoc,''); |
|
99 | + $mysoc->code_client=$old_code_client; |
|
100 | + |
|
101 | + if (! $numExample) |
|
102 | + { |
|
103 | + $numExample = $langs->trans('NotConfigured'); |
|
104 | + } |
|
105 | + return $numExample; |
|
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Return next free value |
|
110 | - * |
|
111 | - * @param Societe $objsoc Object thirdparty |
|
112 | - * @param Object $object Object we need next value for |
|
113 | - * @return string Value if KO, <0 if KO |
|
114 | - */ |
|
108 | + /** |
|
109 | + * Return next free value |
|
110 | + * |
|
111 | + * @param Societe $objsoc Object thirdparty |
|
112 | + * @param Object $object Object we need next value for |
|
113 | + * @return string Value if KO, <0 if KO |
|
114 | + */ |
|
115 | 115 | function getNextValue($objsoc,$object) |
116 | 116 | { |
117 | - global $db,$conf; |
|
117 | + global $db,$conf; |
|
118 | 118 | |
119 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
119 | + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
120 | 120 | |
121 | - // We get cursor rule |
|
122 | - $mask=$conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
121 | + // We get cursor rule |
|
122 | + $mask=$conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
123 | 123 | |
124 | - if (! $mask) |
|
125 | - { |
|
126 | - $this->error='NotConfigured'; |
|
127 | - return 0; |
|
128 | - } |
|
124 | + if (! $mask) |
|
125 | + { |
|
126 | + $this->error='NotConfigured'; |
|
127 | + return 0; |
|
128 | + } |
|
129 | 129 | |
130 | - $numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau); |
|
130 | + $numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau); |
|
131 | 131 | |
132 | - return $numFinal; |
|
133 | - } |
|
132 | + return $numFinal; |
|
133 | + } |
|
134 | 134 | |
135 | 135 | |
136 | 136 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
137 | - /** |
|
138 | - * Return next free value |
|
139 | - * |
|
140 | - * @param Societe $objsoc Object third party |
|
141 | - * @param string $objforref Object for number to search |
|
142 | - * @return string Next free value |
|
137 | + /** |
|
138 | + * Return next free value |
|
139 | + * |
|
140 | + * @param Societe $objsoc Object third party |
|
141 | + * @param string $objforref Object for number to search |
|
142 | + * @return string Next free value |
|
143 | 143 | */ |
144 | 144 | function chequereceipt_get_num($objsoc,$objforref) |
145 | 145 | { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * \brief File containing class for numbering module Thyme |
23 | 23 | */ |
24 | 24 | |
25 | -require_once DOL_DOCUMENT_ROOT .'/core/modules/cheque/modules_chequereceipts.php'; |
|
25 | +require_once DOL_DOCUMENT_ROOT.'/core/modules/cheque/modules_chequereceipts.php'; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
@@ -34,7 +34,7 @@ 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 | 39 | /** |
40 | 40 | * @var string Error message |
@@ -58,28 +58,28 @@ discard block |
||
58 | 58 | $form = new Form($this->db); |
59 | 59 | |
60 | 60 | $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n"; |
61 | - $texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | - $texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | - $texte.= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | - $texte.= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | - $texte.= '<table class="nobordernopadding" width="100%">'; |
|
66 | - |
|
67 | - $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
68 | - $tooltip.=$langs->trans("GenericMaskCodes2"); |
|
69 | - $tooltip.=$langs->trans("GenericMaskCodes3"); |
|
70 | - $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); |
|
71 | - $tooltip.=$langs->trans("GenericMaskCodes5"); |
|
61 | + $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
62 | + $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
63 | + $texte .= '<input type="hidden" name="action" value="updateMask">'; |
|
64 | + $texte .= '<input type="hidden" name="maskconstchequereceipts" value="CHEQUERECEIPTS_THYME_MASK">'; |
|
65 | + $texte .= '<table class="nobordernopadding" width="100%">'; |
|
66 | + |
|
67 | + $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("CheckReceiptShort"), $langs->transnoentities("CheckReceiptShort")); |
|
68 | + $tooltip .= $langs->trans("GenericMaskCodes2"); |
|
69 | + $tooltip .= $langs->trans("GenericMaskCodes3"); |
|
70 | + $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CheckReceiptShort"), $langs->transnoentities("CheckReceiptShort")); |
|
71 | + $tooltip .= $langs->trans("GenericMaskCodes5"); |
|
72 | 72 | |
73 | 73 | // Parametrage du prefix |
74 | - $texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | - $texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">',$tooltip,1,1).'</td>'; |
|
74 | + $texte .= '<tr><td>'.$langs->trans("Mask").':</td>'; |
|
75 | + $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskchequereceipts" value="'.$conf->global->CHEQUERECEIPTS_THYME_MASK.'">', $tooltip, 1, 1).'</td>'; |
|
76 | 76 | |
77 | - $texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
77 | + $texte .= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; |
|
78 | 78 | |
79 | - $texte.= '</tr>'; |
|
79 | + $texte .= '</tr>'; |
|
80 | 80 | |
81 | - $texte.= '</table>'; |
|
82 | - $texte.= '</form>'; |
|
81 | + $texte .= '</table>'; |
|
82 | + $texte .= '</form>'; |
|
83 | 83 | |
84 | 84 | return $texte; |
85 | 85 | } |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | */ |
92 | 92 | function getExample() |
93 | 93 | { |
94 | - global $conf,$langs,$mysoc; |
|
94 | + global $conf, $langs, $mysoc; |
|
95 | 95 | |
96 | - $old_code_client=$mysoc->code_client; |
|
97 | - $mysoc->code_client='CCCCCCCCCC'; |
|
98 | - $numExample = $this->getNextValue($mysoc,''); |
|
99 | - $mysoc->code_client=$old_code_client; |
|
96 | + $old_code_client = $mysoc->code_client; |
|
97 | + $mysoc->code_client = 'CCCCCCCCCC'; |
|
98 | + $numExample = $this->getNextValue($mysoc, ''); |
|
99 | + $mysoc->code_client = $old_code_client; |
|
100 | 100 | |
101 | - if (! $numExample) |
|
101 | + if (!$numExample) |
|
102 | 102 | { |
103 | 103 | $numExample = $langs->trans('NotConfigured'); |
104 | 104 | } |
@@ -112,22 +112,22 @@ discard block |
||
112 | 112 | * @param Object $object Object we need next value for |
113 | 113 | * @return string Value if KO, <0 if KO |
114 | 114 | */ |
115 | - function getNextValue($objsoc,$object) |
|
115 | + function getNextValue($objsoc, $object) |
|
116 | 116 | { |
117 | - global $db,$conf; |
|
117 | + global $db, $conf; |
|
118 | 118 | |
119 | - require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; |
|
119 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
120 | 120 | |
121 | 121 | // We get cursor rule |
122 | - $mask=$conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
122 | + $mask = $conf->global->CHEQUERECEIPTS_THYME_MASK; |
|
123 | 123 | |
124 | - if (! $mask) |
|
124 | + if (!$mask) |
|
125 | 125 | { |
126 | - $this->error='NotConfigured'; |
|
126 | + $this->error = 'NotConfigured'; |
|
127 | 127 | return 0; |
128 | 128 | } |
129 | 129 | |
130 | - $numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau); |
|
130 | + $numFinal = get_next_value($db, $mask, 'bordereau_cheque', 'ref', '', $objsoc, $object->date_bordereau); |
|
131 | 131 | |
132 | 132 | return $numFinal; |
133 | 133 | } |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | * @param string $objforref Object for number to search |
142 | 142 | * @return string Next free value |
143 | 143 | */ |
144 | - function chequereceipt_get_num($objsoc,$objforref) |
|
144 | + function chequereceipt_get_num($objsoc, $objforref) |
|
145 | 145 | { |
146 | 146 | // phpcs:enable |
147 | - return $this->getNextValue($objsoc,$objforref); |
|
147 | + return $this->getNextValue($objsoc, $objforref); |
|
148 | 148 | } |
149 | 149 | } |
@@ -36,84 +36,84 @@ discard block |
||
36 | 36 | */ |
37 | 37 | abstract class ModeleNumRefChequeReceipts |
38 | 38 | { |
39 | - /** |
|
40 | - * @var string Error code (or message) |
|
41 | - */ |
|
42 | - public $error=''; |
|
43 | - |
|
44 | - /** |
|
45 | - * Return if a module can be used or not |
|
46 | - * |
|
47 | - * @return boolean true if module can be used |
|
48 | - */ |
|
49 | - function isEnabled() |
|
50 | - { |
|
51 | - return true; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Return the default description of numbering module |
|
56 | - * |
|
57 | - * @return string Texte descripif |
|
58 | - */ |
|
59 | - function info() |
|
60 | - { |
|
61 | - global $langs; |
|
62 | - $langs->load("bills"); |
|
63 | - return $langs->trans("NoDescription"); |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Return numbering example |
|
68 | - * |
|
69 | - * @return string Example |
|
70 | - */ |
|
71 | - function getExample() |
|
72 | - { |
|
73 | - global $langs; |
|
74 | - $langs->load("bills"); |
|
75 | - return $langs->trans("NoExample"); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run. |
|
80 | - * |
|
81 | - * @return boolean false si conflit, true si ok |
|
82 | - */ |
|
83 | - function canBeActivated() |
|
84 | - { |
|
85 | - return true; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Returns the next value |
|
90 | - * |
|
91 | - * @param Societe $objsoc Object thirdparty |
|
92 | - * @param Object $object Object we need next value for |
|
93 | - * @return string Valeur |
|
94 | - */ |
|
95 | - function getNextValue($objsoc,$object) |
|
96 | - { |
|
97 | - global $langs; |
|
98 | - return $langs->trans("NotAvailable"); |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Returns the module numbering version |
|
103 | - * |
|
104 | - * @return string Value |
|
105 | - */ |
|
106 | - function getVersion() |
|
107 | - { |
|
108 | - global $langs; |
|
109 | - $langs->load("admin"); |
|
110 | - |
|
111 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
112 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
113 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
114 | - if ($this->version) return $this->version; |
|
115 | - return $langs->trans("NotAvailable"); |
|
116 | - } |
|
39 | + /** |
|
40 | + * @var string Error code (or message) |
|
41 | + */ |
|
42 | + public $error=''; |
|
43 | + |
|
44 | + /** |
|
45 | + * Return if a module can be used or not |
|
46 | + * |
|
47 | + * @return boolean true if module can be used |
|
48 | + */ |
|
49 | + function isEnabled() |
|
50 | + { |
|
51 | + return true; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Return the default description of numbering module |
|
56 | + * |
|
57 | + * @return string Texte descripif |
|
58 | + */ |
|
59 | + function info() |
|
60 | + { |
|
61 | + global $langs; |
|
62 | + $langs->load("bills"); |
|
63 | + return $langs->trans("NoDescription"); |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Return numbering example |
|
68 | + * |
|
69 | + * @return string Example |
|
70 | + */ |
|
71 | + function getExample() |
|
72 | + { |
|
73 | + global $langs; |
|
74 | + $langs->load("bills"); |
|
75 | + return $langs->trans("NoExample"); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run. |
|
80 | + * |
|
81 | + * @return boolean false si conflit, true si ok |
|
82 | + */ |
|
83 | + function canBeActivated() |
|
84 | + { |
|
85 | + return true; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Returns the next value |
|
90 | + * |
|
91 | + * @param Societe $objsoc Object thirdparty |
|
92 | + * @param Object $object Object we need next value for |
|
93 | + * @return string Valeur |
|
94 | + */ |
|
95 | + function getNextValue($objsoc,$object) |
|
96 | + { |
|
97 | + global $langs; |
|
98 | + return $langs->trans("NotAvailable"); |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Returns the module numbering version |
|
103 | + * |
|
104 | + * @return string Value |
|
105 | + */ |
|
106 | + function getVersion() |
|
107 | + { |
|
108 | + global $langs; |
|
109 | + $langs->load("admin"); |
|
110 | + |
|
111 | + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
112 | + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
113 | + if ($this->version == 'dolibarr') return DOL_VERSION; |
|
114 | + if ($this->version) return $this->version; |
|
115 | + return $langs->trans("NotAvailable"); |
|
116 | + } |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,34 +122,34 @@ discard block |
||
122 | 122 | */ |
123 | 123 | abstract class ModeleChequeReceipts extends CommonDocGenerator |
124 | 124 | { |
125 | - /** |
|
126 | - * @var string Error code (or message) |
|
127 | - */ |
|
128 | - public $error=''; |
|
125 | + /** |
|
126 | + * @var string Error code (or message) |
|
127 | + */ |
|
128 | + public $error=''; |
|
129 | 129 | |
130 | 130 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
131 | - /** |
|
132 | - * Return list of active generation modules |
|
133 | - * |
|
131 | + /** |
|
132 | + * Return list of active generation modules |
|
133 | + * |
|
134 | 134 | * @param DoliDB $db Database handler |
135 | 135 | * @param integer $maxfilenamelength Max length of value to show |
136 | 136 | * @return array List of templates |
137 | - */ |
|
138 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
139 | - { |
|
137 | + */ |
|
138 | + static function liste_modeles($db,$maxfilenamelength=0) |
|
139 | + { |
|
140 | 140 | // phpcs:enable |
141 | - global $conf; |
|
141 | + global $conf; |
|
142 | 142 | |
143 | - $type='chequereceipt'; |
|
144 | - $liste=array(); |
|
143 | + $type='chequereceipt'; |
|
144 | + $liste=array(); |
|
145 | 145 | |
146 | - include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
147 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
148 | - // TODO Remove this to use getListOfModels only |
|
149 | - $liste = array('blochet'=>'blochet'); |
|
146 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
147 | + $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
148 | + // TODO Remove this to use getListOfModels only |
|
149 | + $liste = array('blochet'=>'blochet'); |
|
150 | 150 | |
151 | - return $liste; |
|
152 | - } |
|
151 | + return $liste; |
|
152 | + } |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -166,53 +166,53 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) |
168 | 168 | { |
169 | - global $conf,$langs; |
|
170 | - $langs->load("bills"); |
|
171 | - |
|
172 | - $dir = DOL_DOCUMENT_ROOT . "/core/modules/cheque/doc/"; |
|
173 | - |
|
174 | - // Positionne modele sur le nom du modele a utiliser |
|
175 | - if (! dol_strlen($modele)) |
|
176 | - { |
|
177 | - if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
178 | - { |
|
179 | - $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; |
|
180 | - } |
|
181 | - else |
|
182 | - { |
|
183 | - //print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); |
|
184 | - //return 0; |
|
185 | - $modele = 'blochet'; |
|
186 | - } |
|
187 | - } |
|
188 | - |
|
189 | - // Charge le modele |
|
190 | - $file = "pdf_".$modele.".modules.php"; |
|
191 | - if (file_exists($dir.$file)) |
|
192 | - { |
|
193 | - $classname = "pdf_".$modele; |
|
194 | - require_once $dir.$file; |
|
195 | - |
|
196 | - $obj = new $classname($db); |
|
197 | - |
|
198 | - // We save charset_output to restore it because write_file can change it if needed for |
|
199 | - // output format that does not support UTF8. |
|
200 | - $sav_charset_output=$outputlangs->charset_output; |
|
201 | - if ($obj->write_file($id, $outputlangs) > 0) |
|
202 | - { |
|
203 | - $outputlangs->charset_output=$sav_charset_output; |
|
204 | - return 1; |
|
205 | - } |
|
206 | - else |
|
207 | - { |
|
208 | - $outputlangs->charset_output=$sav_charset_output; |
|
209 | - dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); |
|
210 | - return -1; |
|
211 | - } |
|
212 | - } |
|
213 | - else |
|
214 | - { |
|
215 | - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); |
|
216 | - return -1; |
|
217 | - } |
|
169 | + global $conf,$langs; |
|
170 | + $langs->load("bills"); |
|
171 | + |
|
172 | + $dir = DOL_DOCUMENT_ROOT . "/core/modules/cheque/doc/"; |
|
173 | + |
|
174 | + // Positionne modele sur le nom du modele a utiliser |
|
175 | + if (! dol_strlen($modele)) |
|
176 | + { |
|
177 | + if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
178 | + { |
|
179 | + $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; |
|
180 | + } |
|
181 | + else |
|
182 | + { |
|
183 | + //print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); |
|
184 | + //return 0; |
|
185 | + $modele = 'blochet'; |
|
186 | + } |
|
187 | + } |
|
188 | + |
|
189 | + // Charge le modele |
|
190 | + $file = "pdf_".$modele.".modules.php"; |
|
191 | + if (file_exists($dir.$file)) |
|
192 | + { |
|
193 | + $classname = "pdf_".$modele; |
|
194 | + require_once $dir.$file; |
|
195 | + |
|
196 | + $obj = new $classname($db); |
|
197 | + |
|
198 | + // We save charset_output to restore it because write_file can change it if needed for |
|
199 | + // output format that does not support UTF8. |
|
200 | + $sav_charset_output=$outputlangs->charset_output; |
|
201 | + if ($obj->write_file($id, $outputlangs) > 0) |
|
202 | + { |
|
203 | + $outputlangs->charset_output=$sav_charset_output; |
|
204 | + return 1; |
|
205 | + } |
|
206 | + else |
|
207 | + { |
|
208 | + $outputlangs->charset_output=$sav_charset_output; |
|
209 | + dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); |
|
210 | + return -1; |
|
211 | + } |
|
212 | + } |
|
213 | + else |
|
214 | + { |
|
215 | + dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); |
|
216 | + return -1; |
|
217 | + } |
|
218 | 218 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
30 | 30 | require_once DOL_DOCUMENT_ROOT.'/product/class/product.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 | * \class ModeleNumRefChequeReceipts |
@@ -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 | * Return if a module can be used or not |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param Object $object Object we need next value for |
93 | 93 | * @return string Valeur |
94 | 94 | */ |
95 | - function getNextValue($objsoc,$object) |
|
95 | + function getNextValue($objsoc, $object) |
|
96 | 96 | { |
97 | 97 | global $langs; |
98 | 98 | return $langs->trans("NotAvailable"); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @var string Error code (or message) |
127 | 127 | */ |
128 | - public $error=''; |
|
128 | + public $error = ''; |
|
129 | 129 | |
130 | 130 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps |
131 | 131 | /** |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | * @param integer $maxfilenamelength Max length of value to show |
136 | 136 | * @return array List of templates |
137 | 137 | */ |
138 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
138 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
139 | 139 | { |
140 | 140 | // phpcs:enable |
141 | 141 | global $conf; |
142 | 142 | |
143 | - $type='chequereceipt'; |
|
144 | - $liste=array(); |
|
143 | + $type = 'chequereceipt'; |
|
144 | + $liste = array(); |
|
145 | 145 | |
146 | 146 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
147 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
147 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
148 | 148 | // TODO Remove this to use getListOfModels only |
149 | 149 | $liste = array('blochet'=>'blochet'); |
150 | 150 | |
@@ -166,15 +166,15 @@ discard block |
||
166 | 166 | */ |
167 | 167 | function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) |
168 | 168 | { |
169 | - global $conf,$langs; |
|
169 | + global $conf, $langs; |
|
170 | 170 | $langs->load("bills"); |
171 | 171 | |
172 | - $dir = DOL_DOCUMENT_ROOT . "/core/modules/cheque/doc/"; |
|
172 | + $dir = DOL_DOCUMENT_ROOT."/core/modules/cheque/doc/"; |
|
173 | 173 | |
174 | 174 | // Positionne modele sur le nom du modele a utiliser |
175 | - if (! dol_strlen($modele)) |
|
175 | + if (!dol_strlen($modele)) |
|
176 | 176 | { |
177 | - if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
177 | + if (!empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
|
178 | 178 | { |
179 | 179 | $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; |
180 | 180 | } |
@@ -197,22 +197,22 @@ discard block |
||
197 | 197 | |
198 | 198 | // We save charset_output to restore it because write_file can change it if needed for |
199 | 199 | // output format that does not support UTF8. |
200 | - $sav_charset_output=$outputlangs->charset_output; |
|
200 | + $sav_charset_output = $outputlangs->charset_output; |
|
201 | 201 | if ($obj->write_file($id, $outputlangs) > 0) |
202 | 202 | { |
203 | - $outputlangs->charset_output=$sav_charset_output; |
|
203 | + $outputlangs->charset_output = $sav_charset_output; |
|
204 | 204 | return 1; |
205 | 205 | } |
206 | 206 | else |
207 | 207 | { |
208 | - $outputlangs->charset_output=$sav_charset_output; |
|
209 | - dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); |
|
208 | + $outputlangs->charset_output = $sav_charset_output; |
|
209 | + dol_print_error($db, "chequereceipt_pdf_create Error: ".$obj->error); |
|
210 | 210 | return -1; |
211 | 211 | } |
212 | 212 | } |
213 | 213 | else |
214 | 214 | { |
215 | - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); |
|
215 | + dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $dir.$file)); |
|
216 | 216 | return -1; |
217 | 217 | } |
218 | 218 | } |
@@ -108,10 +108,18 @@ discard block |
||
108 | 108 | global $langs; |
109 | 109 | $langs->load("admin"); |
110 | 110 | |
111 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
112 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
113 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
114 | - if ($this->version) return $this->version; |
|
111 | + if ($this->version == 'development') { |
|
112 | + return $langs->trans("VersionDevelopment"); |
|
113 | + } |
|
114 | + if ($this->version == 'experimental') { |
|
115 | + return $langs->trans("VersionExperimental"); |
|
116 | + } |
|
117 | + if ($this->version == 'dolibarr') { |
|
118 | + return DOL_VERSION; |
|
119 | + } |
|
120 | + if ($this->version) { |
|
121 | + return $this->version; |
|
122 | + } |
|
115 | 123 | return $langs->trans("NotAvailable"); |
116 | 124 | } |
117 | 125 | } |
@@ -177,8 +185,7 @@ discard block |
||
177 | 185 | if (! empty($conf->global->CHEQUERECEIPT_ADDON_PDF)) |
178 | 186 | { |
179 | 187 | $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; |
180 | - } |
|
181 | - else |
|
188 | + } else |
|
182 | 189 | { |
183 | 190 | //print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); |
184 | 191 | //return 0; |
@@ -202,15 +209,13 @@ discard block |
||
202 | 209 | { |
203 | 210 | $outputlangs->charset_output=$sav_charset_output; |
204 | 211 | return 1; |
205 | - } |
|
206 | - else |
|
212 | + } else |
|
207 | 213 | { |
208 | 214 | $outputlangs->charset_output=$sav_charset_output; |
209 | 215 | dol_print_error($db,"chequereceipt_pdf_create Error: ".$obj->error); |
210 | 216 | return -1; |
211 | 217 | } |
212 | - } |
|
213 | - else |
|
218 | + } else |
|
214 | 219 | { |
215 | 220 | dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); |
216 | 221 | return -1; |
@@ -67,10 +67,10 @@ |
||
67 | 67 | |
68 | 68 | // Dependencies |
69 | 69 | $this->hidden = false; // A condition to hide module |
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | 74 | $this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module |
75 | 75 | $this->conflictwith = array(); |
76 | 76 | $this->langfiles = array("printing"); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup printing |
26 | 26 | * \brief File of class to describe and activate module Direct Printing |
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 | |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function __construct($db) |
44 | 44 | { |
45 | - $this->db = $db ; |
|
45 | + $this->db = $db; |
|
46 | 46 | $this->numero = 64000; |
47 | 47 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
48 | 48 | // It is used to group modules in module setup page |
49 | 49 | $this->family = "interface"; |
50 | 50 | $this->module_position = '52'; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
54 | 54 | $this->description = "Enable Direct Printing System."; |
55 | - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
55 | + $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version |
|
56 | 56 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
57 | 57 | // Name of image file used for this module. |
58 | 58 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | $this->config_page_url = array("printing.php@printing"); |
67 | 67 | |
68 | 68 | // Dependencies |
69 | - $this->hidden = false; // A condition to hide module |
|
70 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
74 | - $this->need_dolibarr_version = array(3,7,-2); // Minimum version of Dolibarr required by module |
|
69 | + $this->hidden = false; // A condition to hide module |
|
70 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
72 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
73 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
74 | + $this->need_dolibarr_version = array(3, 7, -2); // Minimum version of Dolibarr required by module |
|
75 | 75 | $this->conflictwith = array(); |
76 | 76 | $this->langfiles = array("printing"); |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->rights = array(); |
86 | 86 | $this->rights_class = 'printing'; |
87 | 87 | |
88 | - $r=0; |
|
88 | + $r = 0; |
|
89 | 89 | // $this->rights[$r][0] Id permission (unique tous modules confondus) |
90 | 90 | // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) |
91 | 91 | // $this->rights[$r][2] Non utilise |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | $this->rights[$r][4] = 'read'; |
102 | 102 | |
103 | 103 | // Main menu entries |
104 | - $this->menus = array(); // List of menus to add |
|
105 | - $r=0; |
|
104 | + $this->menus = array(); // List of menus to add |
|
105 | + $r = 0; |
|
106 | 106 | |
107 | 107 | // This is to declare the Top Menu entry: |
108 | - $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu |
|
109 | - 'type'=>'left', // This is a Top menu entry |
|
108 | + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu |
|
109 | + 'type'=>'left', // This is a Top menu entry |
|
110 | 110 | 'titre'=>'MenuDirectPrinting', |
111 | 111 | 'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools', |
112 | - 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
112 | + 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
113 | 113 | 'position'=>300, |
114 | 114 | 'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', |
115 | - 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules |
|
115 | + 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules |
|
116 | 116 | 'target'=>'', |
117 | - 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both |
|
117 | + 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both |
|
118 | 118 | |
119 | 119 | $r++; |
120 | 120 | } |
@@ -34,128 +34,128 @@ |
||
34 | 34 | class modMailing extends DolibarrModules |
35 | 35 | { |
36 | 36 | |
37 | - /** |
|
38 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | - * |
|
40 | - * @param DoliDB $db Database handler |
|
41 | - */ |
|
42 | - function __construct($db) |
|
43 | - { |
|
44 | - $this->db = $db; |
|
45 | - $this->numero = 22; |
|
46 | - |
|
47 | - // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
48 | - // It is used to group modules by family in module setup page |
|
49 | - $this->family = "interface"; |
|
50 | - // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
51 | - $this->module_position = '11'; |
|
52 | - |
|
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 | - $this->description = "Gestion des EMailings"; |
|
56 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | - $this->version = 'dolibarr'; |
|
58 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | - $this->picto='email'; |
|
60 | - |
|
61 | - // Data directories to create when module is enabled |
|
62 | - $this->dirs = array("/mailing/temp"); |
|
63 | - |
|
64 | - // Dependencies |
|
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | - $this->langfiles = array("mails"); |
|
71 | - |
|
72 | - // Config pages |
|
73 | - $this->config_page_url = array("mailing.php"); |
|
74 | - |
|
75 | - // Constants |
|
76 | - $this->const = array(); |
|
77 | - |
|
78 | - // Boxes |
|
79 | - $this->boxes = array(); |
|
80 | - |
|
81 | - // Permissions |
|
82 | - $this->rights = array(); |
|
83 | - $this->rights_class = 'mailing'; |
|
84 | - $r=0; |
|
85 | - |
|
86 | - $r++; |
|
87 | - $this->rights[$r][0] = 221; // id de la permission |
|
88 | - $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission |
|
89 | - $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
90 | - $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
91 | - $this->rights[$r][4] = 'lire'; |
|
92 | - |
|
93 | - $r++; |
|
94 | - $this->rights[$r][0] = 222; |
|
95 | - $this->rights[$r][1] = 'Creer/modifier les mailings (sujet, destinataires...)'; |
|
96 | - $this->rights[$r][2] = 'w'; |
|
97 | - $this->rights[$r][3] = 0; |
|
98 | - $this->rights[$r][4] = 'creer'; |
|
99 | - |
|
100 | - $r++; |
|
101 | - $this->rights[$r][0] = 223; |
|
102 | - $this->rights[$r][1] = 'Valider les mailings (permet leur envoi)'; |
|
103 | - $this->rights[$r][2] = 'w'; |
|
104 | - $this->rights[$r][3] = 0; |
|
105 | - $this->rights[$r][4] = 'valider'; |
|
106 | - |
|
107 | - $r++; |
|
108 | - $this->rights[$r][0] = 229; |
|
109 | - $this->rights[$r][1] = 'Supprimer les mailings'; |
|
110 | - $this->rights[$r][2] = 'd'; |
|
111 | - $this->rights[$r][3] = 0; |
|
112 | - $this->rights[$r][4] = 'supprimer'; |
|
113 | - |
|
114 | - $r++; |
|
115 | - $this->rights[$r][0] = 237; |
|
116 | - $this->rights[$r][1] = 'View recipients and info'; |
|
117 | - $this->rights[$r][2] = 'r'; |
|
118 | - $this->rights[$r][3] = 0; |
|
119 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
120 | - $this->rights[$r][5] = 'recipient'; |
|
121 | - |
|
122 | - $r++; |
|
123 | - $this->rights[$r][0] = 238; |
|
124 | - $this->rights[$r][1] = 'Manually send mailings'; |
|
125 | - $this->rights[$r][2] = 'w'; |
|
126 | - $this->rights[$r][3] = 0; |
|
127 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
128 | - $this->rights[$r][5] = 'send'; |
|
129 | - |
|
130 | - $r++; |
|
131 | - $this->rights[$r][0] = 239; |
|
132 | - $this->rights[$r][1] = 'Delete mailings after validation and/or sent'; |
|
133 | - $this->rights[$r][2] = 'd'; |
|
134 | - $this->rights[$r][3] = 0; |
|
135 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
136 | - $this->rights[$r][5] = 'delete'; |
|
137 | - |
|
138 | - // Menus |
|
139 | - //------- |
|
140 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * Function called when module is enabled. |
|
146 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
147 | - * It also creates data directories |
|
148 | - * |
|
37 | + /** |
|
38 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
39 | + * |
|
40 | + * @param DoliDB $db Database handler |
|
41 | + */ |
|
42 | + function __construct($db) |
|
43 | + { |
|
44 | + $this->db = $db; |
|
45 | + $this->numero = 22; |
|
46 | + |
|
47 | + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' |
|
48 | + // It is used to group modules by family in module setup page |
|
49 | + $this->family = "interface"; |
|
50 | + // Module position in the family on 2 digits ('01', '10', '20', ...) |
|
51 | + $this->module_position = '11'; |
|
52 | + |
|
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 | + $this->description = "Gestion des EMailings"; |
|
56 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
57 | + $this->version = 'dolibarr'; |
|
58 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | + $this->picto='email'; |
|
60 | + |
|
61 | + // Data directories to create when module is enabled |
|
62 | + $this->dirs = array("/mailing/temp"); |
|
63 | + |
|
64 | + // Dependencies |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
70 | + $this->langfiles = array("mails"); |
|
71 | + |
|
72 | + // Config pages |
|
73 | + $this->config_page_url = array("mailing.php"); |
|
74 | + |
|
75 | + // Constants |
|
76 | + $this->const = array(); |
|
77 | + |
|
78 | + // Boxes |
|
79 | + $this->boxes = array(); |
|
80 | + |
|
81 | + // Permissions |
|
82 | + $this->rights = array(); |
|
83 | + $this->rights_class = 'mailing'; |
|
84 | + $r=0; |
|
85 | + |
|
86 | + $r++; |
|
87 | + $this->rights[$r][0] = 221; // id de la permission |
|
88 | + $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission |
|
89 | + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) |
|
90 | + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut |
|
91 | + $this->rights[$r][4] = 'lire'; |
|
92 | + |
|
93 | + $r++; |
|
94 | + $this->rights[$r][0] = 222; |
|
95 | + $this->rights[$r][1] = 'Creer/modifier les mailings (sujet, destinataires...)'; |
|
96 | + $this->rights[$r][2] = 'w'; |
|
97 | + $this->rights[$r][3] = 0; |
|
98 | + $this->rights[$r][4] = 'creer'; |
|
99 | + |
|
100 | + $r++; |
|
101 | + $this->rights[$r][0] = 223; |
|
102 | + $this->rights[$r][1] = 'Valider les mailings (permet leur envoi)'; |
|
103 | + $this->rights[$r][2] = 'w'; |
|
104 | + $this->rights[$r][3] = 0; |
|
105 | + $this->rights[$r][4] = 'valider'; |
|
106 | + |
|
107 | + $r++; |
|
108 | + $this->rights[$r][0] = 229; |
|
109 | + $this->rights[$r][1] = 'Supprimer les mailings'; |
|
110 | + $this->rights[$r][2] = 'd'; |
|
111 | + $this->rights[$r][3] = 0; |
|
112 | + $this->rights[$r][4] = 'supprimer'; |
|
113 | + |
|
114 | + $r++; |
|
115 | + $this->rights[$r][0] = 237; |
|
116 | + $this->rights[$r][1] = 'View recipients and info'; |
|
117 | + $this->rights[$r][2] = 'r'; |
|
118 | + $this->rights[$r][3] = 0; |
|
119 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
120 | + $this->rights[$r][5] = 'recipient'; |
|
121 | + |
|
122 | + $r++; |
|
123 | + $this->rights[$r][0] = 238; |
|
124 | + $this->rights[$r][1] = 'Manually send mailings'; |
|
125 | + $this->rights[$r][2] = 'w'; |
|
126 | + $this->rights[$r][3] = 0; |
|
127 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
128 | + $this->rights[$r][5] = 'send'; |
|
129 | + |
|
130 | + $r++; |
|
131 | + $this->rights[$r][0] = 239; |
|
132 | + $this->rights[$r][1] = 'Delete mailings after validation and/or sent'; |
|
133 | + $this->rights[$r][2] = 'd'; |
|
134 | + $this->rights[$r][3] = 0; |
|
135 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
136 | + $this->rights[$r][5] = 'delete'; |
|
137 | + |
|
138 | + // Menus |
|
139 | + //------- |
|
140 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * Function called when module is enabled. |
|
146 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
147 | + * It also creates data directories |
|
148 | + * |
|
149 | 149 | * @param string $options Options when enabling module ('', 'noboxes') |
150 | - * @return int 1 if OK, 0 if KO |
|
151 | - */ |
|
152 | - function init($options='') |
|
153 | - { |
|
154 | - // Permissions |
|
155 | - $this->remove($options); |
|
150 | + * @return int 1 if OK, 0 if KO |
|
151 | + */ |
|
152 | + function init($options='') |
|
153 | + { |
|
154 | + // Permissions |
|
155 | + $this->remove($options); |
|
156 | 156 | |
157 | - $sql = array(); |
|
157 | + $sql = array(); |
|
158 | 158 | |
159 | - return $this->_init($sql,$options); |
|
160 | - } |
|
159 | + return $this->_init($sql,$options); |
|
160 | + } |
|
161 | 161 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \brief Fichier de description et activation du module Mailing |
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,22 +51,22 @@ discard block |
||
51 | 51 | $this->module_position = '11'; |
52 | 52 | |
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 | $this->description = "Gestion des EMailings"; |
56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
57 | 57 | $this->version = 'dolibarr'; |
58 | 58 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
59 | - $this->picto='email'; |
|
59 | + $this->picto = 'email'; |
|
60 | 60 | |
61 | 61 | // Data directories to create when module is enabled |
62 | 62 | $this->dirs = array("/mailing/temp"); |
63 | 63 | |
64 | 64 | // Dependencies |
65 | - $this->hidden = false; // A condition to hide module |
|
66 | - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | - $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | - $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | - $this->phpmin = array(5,4); // Minimum version of PHP required by module |
|
65 | + $this->hidden = false; // A condition to hide module |
|
66 | + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
67 | + $this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
68 | + $this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
69 | + $this->phpmin = array(5, 4); // Minimum version of PHP required by module |
|
70 | 70 | $this->langfiles = array("mails"); |
71 | 71 | |
72 | 72 | // Config pages |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // Permissions |
82 | 82 | $this->rights = array(); |
83 | 83 | $this->rights_class = 'mailing'; |
84 | - $r=0; |
|
84 | + $r = 0; |
|
85 | 85 | |
86 | 86 | $r++; |
87 | 87 | $this->rights[$r][0] = 221; // id de la permission |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->rights[$r][1] = 'View recipients and info'; |
117 | 117 | $this->rights[$r][2] = 'r'; |
118 | 118 | $this->rights[$r][3] = 0; |
119 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
119 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
120 | 120 | $this->rights[$r][5] = 'recipient'; |
121 | 121 | |
122 | 122 | $r++; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->rights[$r][1] = 'Manually send mailings'; |
125 | 125 | $this->rights[$r][2] = 'w'; |
126 | 126 | $this->rights[$r][3] = 0; |
127 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
127 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
128 | 128 | $this->rights[$r][5] = 'send'; |
129 | 129 | |
130 | 130 | $r++; |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | $this->rights[$r][1] = 'Delete mailings after validation and/or sent'; |
133 | 133 | $this->rights[$r][2] = 'd'; |
134 | 134 | $this->rights[$r][3] = 0; |
135 | - $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
135 | + $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on |
|
136 | 136 | $this->rights[$r][5] = 'delete'; |
137 | 137 | |
138 | 138 | // Menus |
139 | 139 | //------- |
140 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
140 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | * @param string $options Options when enabling module ('', 'noboxes') |
150 | 150 | * @return int 1 if OK, 0 if KO |
151 | 151 | */ |
152 | - function init($options='') |
|
152 | + function init($options = '') |
|
153 | 153 | { |
154 | 154 | // Permissions |
155 | 155 | $this->remove($options); |
156 | 156 | |
157 | 157 | $sql = array(); |
158 | 158 | |
159 | - return $this->_init($sql,$options); |
|
159 | + return $this->_init($sql, $options); |
|
160 | 160 | } |
161 | 161 | } |
@@ -32,133 +32,133 @@ |
||
32 | 32 | class modDeplacement 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 | - global $conf, $user; |
|
43 | - |
|
44 | - $this->db = $db; |
|
45 | - $this->numero = 75 ; |
|
46 | - |
|
47 | - $this->family = "hr"; |
|
48 | - $this->module_position = '41'; |
|
49 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
52 | - |
|
53 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
54 | - $this->version = 'dolibarr_deprecated'; |
|
55 | - |
|
56 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
57 | - $this->picto = "trip"; |
|
58 | - |
|
59 | - // Data directories to create when module is enabled |
|
60 | - $this->dirs = array(); |
|
61 | - |
|
62 | - // Config pages |
|
63 | - $this->config_page_url = array(); |
|
64 | - $this->langfiles = array("companies","trips"); |
|
65 | - |
|
66 | - // Dependancies |
|
67 | - $this->depends = array(); |
|
68 | - $this->requiredby = array(); |
|
69 | - |
|
70 | - // Constants |
|
71 | - $this->const = array(); |
|
72 | - |
|
73 | - // Boxes |
|
74 | - $this->boxes = array(); |
|
75 | - |
|
76 | - // Permissions |
|
77 | - $this->rights = array(); |
|
78 | - $this->rights_class = 'deplacement'; |
|
79 | - |
|
80 | - $this->rights[1][0] = 171; |
|
81 | - $this->rights[1][1] = 'Lire ses notes de frais et deplacements et celles de sa hierarchy'; |
|
82 | - $this->rights[1][2] = 'r'; |
|
83 | - $this->rights[1][3] = 1; |
|
84 | - $this->rights[1][4] = 'lire'; |
|
85 | - |
|
86 | - $this->rights[2][0] = 172; |
|
87 | - $this->rights[2][1] = 'Creer/modifier une note de frais et deplacements'; |
|
88 | - $this->rights[2][2] = 'w'; |
|
89 | - $this->rights[2][3] = 0; |
|
90 | - $this->rights[2][4] = 'creer'; |
|
91 | - |
|
92 | - $this->rights[3][0] = 173; |
|
93 | - $this->rights[3][1] = 'Supprimer les notes de frais et deplacements'; |
|
94 | - $this->rights[3][2] = 'd'; |
|
95 | - $this->rights[3][3] = 0; |
|
96 | - $this->rights[3][4] = 'supprimer'; |
|
97 | - |
|
98 | - $this->rights[4][0] = 174; |
|
99 | - $this->rights[4][1] = 'Lire toutes les notes de frais'; |
|
100 | - $this->rights[4][2] = 'd'; |
|
101 | - $this->rights[4][3] = 0; |
|
102 | - $this->rights[4][4] = 'readall'; |
|
103 | - |
|
104 | - $this->rights[5][0] = 178; |
|
105 | - $this->rights[5][1] = 'Exporter les notes de frais et deplacements'; |
|
106 | - $this->rights[5][2] = 'd'; |
|
107 | - $this->rights[5][3] = 0; |
|
108 | - $this->rights[5][4] = 'export'; |
|
109 | - |
|
110 | - |
|
111 | - // Menus |
|
112 | - //------- |
|
113 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
114 | - |
|
115 | - |
|
116 | - // Exports |
|
117 | - $r=0; |
|
118 | - |
|
119 | - $r++; |
|
120 | - $this->export_code[$r]='trips_'.$r; |
|
121 | - $this->export_label[$r]='ListTripsAndExpenses'; |
|
122 | - $this->export_permission[$r]=array(array("deplacement","export")); |
|
35 | + /** |
|
36 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
37 | + * |
|
38 | + * @param DoliDB $db Database handler |
|
39 | + */ |
|
40 | + function __construct($db) |
|
41 | + { |
|
42 | + global $conf, $user; |
|
43 | + |
|
44 | + $this->db = $db; |
|
45 | + $this->numero = 75 ; |
|
46 | + |
|
47 | + $this->family = "hr"; |
|
48 | + $this->module_position = '41'; |
|
49 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
50 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | + $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
52 | + |
|
53 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
|
54 | + $this->version = 'dolibarr_deprecated'; |
|
55 | + |
|
56 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
57 | + $this->picto = "trip"; |
|
58 | + |
|
59 | + // Data directories to create when module is enabled |
|
60 | + $this->dirs = array(); |
|
61 | + |
|
62 | + // Config pages |
|
63 | + $this->config_page_url = array(); |
|
64 | + $this->langfiles = array("companies","trips"); |
|
65 | + |
|
66 | + // Dependancies |
|
67 | + $this->depends = array(); |
|
68 | + $this->requiredby = array(); |
|
69 | + |
|
70 | + // Constants |
|
71 | + $this->const = array(); |
|
72 | + |
|
73 | + // Boxes |
|
74 | + $this->boxes = array(); |
|
75 | + |
|
76 | + // Permissions |
|
77 | + $this->rights = array(); |
|
78 | + $this->rights_class = 'deplacement'; |
|
79 | + |
|
80 | + $this->rights[1][0] = 171; |
|
81 | + $this->rights[1][1] = 'Lire ses notes de frais et deplacements et celles de sa hierarchy'; |
|
82 | + $this->rights[1][2] = 'r'; |
|
83 | + $this->rights[1][3] = 1; |
|
84 | + $this->rights[1][4] = 'lire'; |
|
85 | + |
|
86 | + $this->rights[2][0] = 172; |
|
87 | + $this->rights[2][1] = 'Creer/modifier une note de frais et deplacements'; |
|
88 | + $this->rights[2][2] = 'w'; |
|
89 | + $this->rights[2][3] = 0; |
|
90 | + $this->rights[2][4] = 'creer'; |
|
91 | + |
|
92 | + $this->rights[3][0] = 173; |
|
93 | + $this->rights[3][1] = 'Supprimer les notes de frais et deplacements'; |
|
94 | + $this->rights[3][2] = 'd'; |
|
95 | + $this->rights[3][3] = 0; |
|
96 | + $this->rights[3][4] = 'supprimer'; |
|
97 | + |
|
98 | + $this->rights[4][0] = 174; |
|
99 | + $this->rights[4][1] = 'Lire toutes les notes de frais'; |
|
100 | + $this->rights[4][2] = 'd'; |
|
101 | + $this->rights[4][3] = 0; |
|
102 | + $this->rights[4][4] = 'readall'; |
|
103 | + |
|
104 | + $this->rights[5][0] = 178; |
|
105 | + $this->rights[5][1] = 'Exporter les notes de frais et deplacements'; |
|
106 | + $this->rights[5][2] = 'd'; |
|
107 | + $this->rights[5][3] = 0; |
|
108 | + $this->rights[5][4] = 'export'; |
|
109 | + |
|
110 | + |
|
111 | + // Menus |
|
112 | + //------- |
|
113 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
114 | + |
|
115 | + |
|
116 | + // Exports |
|
117 | + $r=0; |
|
118 | + |
|
119 | + $r++; |
|
120 | + $this->export_code[$r]='trips_'.$r; |
|
121 | + $this->export_label[$r]='ListTripsAndExpenses'; |
|
122 | + $this->export_permission[$r]=array(array("deplacement","export")); |
|
123 | 123 | $this->export_fields_array[$r]=array('u.login'=>'Login','u.lastname'=>'Lastname','u.firstname'=>'Firstname','d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.dated'=>"Date",'d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty'); |
124 | 124 | $this->export_TypeFields_array[$r]=array('u.rowid'=>'List:user:name','u.login'=>'Text','u.lastname'=>'Text','u.firstname'=>'Text','d.type'=>"Text",'d.km'=>"Numeric",'d.dated'=>"Date",'d.note_private'=>'Text','d.note_public'=>'Text','s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text'); |
125 | 125 | $this->export_entities_array[$r]=array('u.login'=>'user','u.lastname'=>'user','u.firstname'=>'user','d.rowid'=>"trip",'d.type'=>"trip",'d.km'=>"trip",'d.dated'=>"trip",'d.note_private'=>'trip','d.note_public'=>'trip','s.nom'=>'company'); |
126 | 126 | $this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
127 | 127 | |
128 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
129 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
133 | - $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; |
|
134 | - $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
136 | - |
|
137 | - if (! empty($user)) // Not defined during migration process |
|
138 | - { |
|
139 | - $childids = $user->getAllChildIds(); |
|
140 | - $childids[]=$user->id; |
|
141 | - |
|
142 | - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
143 | - } |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * Function called when module is enabled. |
|
149 | - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
150 | - * It also creates data directories |
|
151 | - * |
|
128 | + $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
129 | + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | + $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
133 | + $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; |
|
134 | + $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
136 | + |
|
137 | + if (! empty($user)) // Not defined during migration process |
|
138 | + { |
|
139 | + $childids = $user->getAllChildIds(); |
|
140 | + $childids[]=$user->id; |
|
141 | + |
|
142 | + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
143 | + } |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * Function called when module is enabled. |
|
149 | + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
150 | + * It also creates data directories |
|
151 | + * |
|
152 | 152 | * @param string $options Options when enabling module ('', 'noboxes') |
153 | - * @return int 1 if OK, 0 if KO |
|
154 | - */ |
|
155 | - function init($options='') |
|
156 | - { |
|
157 | - // Permissions |
|
158 | - $this->remove($options); |
|
153 | + * @return int 1 if OK, 0 if KO |
|
154 | + */ |
|
155 | + function init($options='') |
|
156 | + { |
|
157 | + // Permissions |
|
158 | + $this->remove($options); |
|
159 | 159 | |
160 | - $sql = array(); |
|
160 | + $sql = array(); |
|
161 | 161 | |
162 | - return $this->_init($sql,$options); |
|
163 | - } |
|
162 | + return $this->_init($sql,$options); |
|
163 | + } |
|
164 | 164 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup deplacement |
24 | 24 | * \brief Fichier de description et activation du module Deplacement et notes de frais |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | global $conf, $user; |
43 | 43 | |
44 | 44 | $this->db = $db; |
45 | - $this->numero = 75 ; |
|
45 | + $this->numero = 75; |
|
46 | 46 | |
47 | 47 | $this->family = "hr"; |
48 | 48 | $this->module_position = '41'; |
49 | 49 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
50 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
51 | - $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
50 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
51 | + $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee |
|
52 | 52 | |
53 | 53 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version |
54 | 54 | $this->version = 'dolibarr_deprecated'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | // Config pages |
63 | 63 | $this->config_page_url = array(); |
64 | - $this->langfiles = array("companies","trips"); |
|
64 | + $this->langfiles = array("companies", "trips"); |
|
65 | 65 | |
66 | 66 | // Dependancies |
67 | 67 | $this->depends = array(); |
@@ -110,36 +110,36 @@ discard block |
||
110 | 110 | |
111 | 111 | // Menus |
112 | 112 | //------- |
113 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
113 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
114 | 114 | |
115 | 115 | |
116 | 116 | // Exports |
117 | - $r=0; |
|
117 | + $r = 0; |
|
118 | 118 | |
119 | 119 | $r++; |
120 | - $this->export_code[$r]='trips_'.$r; |
|
121 | - $this->export_label[$r]='ListTripsAndExpenses'; |
|
122 | - $this->export_permission[$r]=array(array("deplacement","export")); |
|
123 | - $this->export_fields_array[$r]=array('u.login'=>'Login','u.lastname'=>'Lastname','u.firstname'=>'Firstname','d.rowid'=>"TripId",'d.type'=>"Type",'d.km'=>"FeesKilometersOrAmout",'d.dated'=>"Date",'d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','s.nom'=>'ThirdParty'); |
|
124 | - $this->export_TypeFields_array[$r]=array('u.rowid'=>'List:user:name','u.login'=>'Text','u.lastname'=>'Text','u.firstname'=>'Text','d.type'=>"Text",'d.km'=>"Numeric",'d.dated'=>"Date",'d.note_private'=>'Text','d.note_public'=>'Text','s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text'); |
|
125 | - $this->export_entities_array[$r]=array('u.login'=>'user','u.lastname'=>'user','u.firstname'=>'user','d.rowid'=>"trip",'d.type'=>"trip",'d.km'=>"trip",'d.dated'=>"trip",'d.note_private'=>'trip','d.note_public'=>'trip','s.nom'=>'company'); |
|
126 | - $this->export_dependencies_array[$r]=array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
127 | - |
|
128 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
129 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
133 | - $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; |
|
134 | - $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
136 | - |
|
137 | - if (! empty($user)) // Not defined during migration process |
|
120 | + $this->export_code[$r] = 'trips_'.$r; |
|
121 | + $this->export_label[$r] = 'ListTripsAndExpenses'; |
|
122 | + $this->export_permission[$r] = array(array("deplacement", "export")); |
|
123 | + $this->export_fields_array[$r] = array('u.login'=>'Login', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'd.rowid'=>"TripId", 'd.type'=>"Type", 'd.km'=>"FeesKilometersOrAmout", 'd.dated'=>"Date", 'd.note_private'=>'NotePrivate', 'd.note_public'=>'NotePublic', 's.nom'=>'ThirdParty'); |
|
124 | + $this->export_TypeFields_array[$r] = array('u.rowid'=>'List:user:name', 'u.login'=>'Text', 'u.lastname'=>'Text', 'u.firstname'=>'Text', 'd.type'=>"Text", 'd.km'=>"Numeric", 'd.dated'=>"Date", 'd.note_private'=>'Text', 'd.note_public'=>'Text', 's.rowid'=>"List:societe:CompanyName", 's.nom'=>'Text'); |
|
125 | + $this->export_entities_array[$r] = array('u.login'=>'user', 'u.lastname'=>'user', 'u.firstname'=>'user', 'd.rowid'=>"trip", 'd.type'=>"trip", 'd.km'=>"trip", 'd.dated'=>"trip", 'd.note_private'=>'trip', 'd.note_public'=>'trip', 's.nom'=>'company'); |
|
126 | + $this->export_dependencies_array[$r] = array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
127 | + |
|
128 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
129 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; |
|
130 | + $this->export_sql_end[$r] .= ', '.MAIN_DB_PREFIX.'deplacement as d'; |
|
131 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
|
132 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
133 | + $this->export_sql_end[$r] .= ' WHERE d.fk_user = u.rowid'; |
|
134 | + $this->export_sql_end[$r] .= ' AND d.entity IN ('.getEntity('deplacement').')'; |
|
135 | + if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR d.fk_soc IS NULL)'; |
|
136 | + |
|
137 | + if (!empty($user)) // Not defined during migration process |
|
138 | 138 | { |
139 | 139 | $childids = $user->getAllChildIds(); |
140 | - $childids[]=$user->id; |
|
140 | + $childids[] = $user->id; |
|
141 | 141 | |
142 | - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
142 | + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql .= ' AND d.fk_user IN ('.join(',', $childids).')'; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | * @param string $options Options when enabling module ('', 'noboxes') |
153 | 153 | * @return int 1 if OK, 0 if KO |
154 | 154 | */ |
155 | - function init($options='') |
|
155 | + function init($options = '') |
|
156 | 156 | { |
157 | 157 | // Permissions |
158 | 158 | $this->remove($options); |
159 | 159 | |
160 | 160 | $sql = array(); |
161 | 161 | |
162 | - return $this->_init($sql,$options); |
|
162 | + return $this->_init($sql, $options); |
|
163 | 163 | } |
164 | 164 | } |
@@ -129,17 +129,25 @@ |
||
129 | 129 | $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; |
130 | 130 | $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'deplacement as d'; |
131 | 131 | $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; |
132 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
132 | + if (empty($user->rights->societe->client->voir)) { |
|
133 | + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
134 | + } |
|
133 | 135 | $this->export_sql_end[$r] .=' WHERE d.fk_user = u.rowid'; |
134 | 136 | $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('deplacement').')'; |
135 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
137 | + if (empty($user->rights->societe->client->voir)) { |
|
138 | + $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR d.fk_soc IS NULL)'; |
|
139 | + } |
|
136 | 140 | |
137 | - if (! empty($user)) // Not defined during migration process |
|
141 | + if (! empty($user)) { |
|
142 | + // Not defined during migration process |
|
138 | 143 | { |
139 | 144 | $childids = $user->getAllChildIds(); |
145 | + } |
|
140 | 146 | $childids[]=$user->id; |
141 | 147 | |
142 | - if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
148 | + if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) { |
|
149 | + $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; |
|
150 | + } |
|
143 | 151 | } |
144 | 152 | } |
145 | 153 |