Passed
Push — master ( 8f7a8e...7e4a07 )
by Alxarafe
20:11
created
dolibarr/htdocs/core/modules/modExpedition.class.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modWorkflow.class.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/cheque/doc/pdf_blochet.class.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/cheque/mod_chequereceipt_mint.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
77
+		$texte .= '<td align="left" rowspan="2">&nbsp; <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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/cheque/modules_chequereceipts.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modPrinting.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modMailing.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modDeplacement.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.