Passed
Push — master ( 8f7a8e...7e4a07 )
by Alxarafe
20:11
created
dolibarr/htdocs/core/modules/livraison/modules_livraison.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -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
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
45 45
 	/**
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
      *  @param  integer	$maxfilenamelength  Max length of value to show
50 50
      *  @return	array						List of templates
51 51
 	 */
52
-	static function liste_modeles($db,$maxfilenamelength=0)
52
+	static function liste_modeles($db, $maxfilenamelength = 0)
53 53
 	{
54 54
         // phpcs:enable
55 55
 		global $conf;
56 56
 
57
-		$type='delivery';
58
-		$liste=array();
57
+		$type = 'delivery';
58
+		$liste = array();
59 59
 
60 60
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
61
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
61
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
62 62
 
63 63
 		return $liste;
64 64
 	}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	/**
76 76
 	 * @var string Error code (or message)
77 77
 	 */
78
-	public $error='';
78
+	public $error = '';
79 79
 
80 80
 	/**
81 81
 	 * Return if a module can be used or not
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/livraison/mod_livraison_saphir.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *	\ingroup    expedition
24 24
  *	\brief      Fichier contenant la classe du modele de numerotation de reference de livraison Saphir
25 25
  */
26
-require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/modules_livraison.php';
26
+require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php';
27 27
 
28 28
 /**
29 29
  *	\class      mod_livraison_saphir
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * Dolibarr version of the loaded document
36 36
      * @public string
37 37
      */
38
-	public $version = 'dolibarr';		// 'development', 'experimental', 'dolibarr'
38
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
39 39
 
40 40
 	/**
41 41
 	 * @var string Error message
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 * @deprecated
48 48
 	 * @see name
49 49
 	 */
50
-	public $nom='Saphir';
50
+	public $nom = 'Saphir';
51 51
 
52 52
 	/**
53 53
 	 * @var string model name
54 54
 	 */
55
-	public $name='Saphir';
55
+	public $name = 'Saphir';
56 56
 
57 57
 
58 58
     /**
@@ -69,28 +69,28 @@  discard block
 block discarded – undo
69 69
 		$form = new Form($this->db);
70 70
 
71 71
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
72
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
-		$texte.= '<input type="hidden" name="action" value="updateMask">';
75
-		$texte.= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
-		$texte.= '<table class="nobordernopadding" width="100%">';
77
-
78
-		$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
79
-		$tooltip.=$langs->trans("GenericMaskCodes2");
80
-		$tooltip.=$langs->trans("GenericMaskCodes3");
81
-		$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Delivery"),$langs->transnoentities("Delivery"));
82
-		$tooltip.=$langs->trans("GenericMaskCodes5");
72
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
73
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
74
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
75
+		$texte .= '<input type="hidden" name="maskconstdelivery" value="LIVRAISON_SAPHIR_MASK">';
76
+		$texte .= '<table class="nobordernopadding" width="100%">';
77
+
78
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Delivery"), $langs->transnoentities("Delivery"));
79
+		$tooltip .= $langs->trans("GenericMaskCodes2");
80
+		$tooltip .= $langs->trans("GenericMaskCodes3");
81
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Delivery"), $langs->transnoentities("Delivery"));
82
+		$tooltip .= $langs->trans("GenericMaskCodes5");
83 83
 
84 84
 		// Parametrage du prefix
85
-		$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
86
-		$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
85
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
86
+		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskdelivery" value="'.$conf->global->LIVRAISON_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
87 87
 
88
-		$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
88
+		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
89 89
 
90
-		$texte.= '</tr>';
90
+		$texte .= '</tr>';
91 91
 
92
-		$texte.= '</table>';
93
-		$texte.= '</form>';
92
+		$texte .= '</table>';
93
+		$texte .= '</form>';
94 94
 
95 95
 		return $texte;
96 96
     }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
      */
103 103
     function getExample()
104 104
     {
105
-     	global $conf,$langs,$mysoc;
105
+     	global $conf, $langs, $mysoc;
106 106
 
107
-    	$old_code_client=$mysoc->code_client;
108
-    	$mysoc->code_client='CCCCCCCCCC';
109
-		$numExample = $this->getNextValue($mysoc,'');
110
-    	$mysoc->code_client=$old_code_client;
107
+    	$old_code_client = $mysoc->code_client;
108
+    	$mysoc->code_client = 'CCCCCCCCCC';
109
+		$numExample = $this->getNextValue($mysoc, '');
110
+    	$mysoc->code_client = $old_code_client;
111 111
 
112
-		if (! $numExample)
112
+		if (!$numExample)
113 113
 		{
114 114
 			$numExample = $langs->trans('NotConfigured');
115 115
 		}
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
 	 *  @param  Object		$object			Object delivery
125 125
 	 *  @return string      				Value if OK, 0 if KO
126 126
 	 */
127
-    function getNextValue($objsoc,$object)
127
+    function getNextValue($objsoc, $object)
128 128
     {
129
-		global $db,$conf;
129
+		global $db, $conf;
130 130
 
131
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
131
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
132 132
 
133 133
 		// On defini critere recherche compteur
134
-		$mask=$conf->global->LIVRAISON_SAPHIR_MASK;
134
+		$mask = $conf->global->LIVRAISON_SAPHIR_MASK;
135 135
 
136
-		if (! $mask)
136
+		if (!$mask)
137 137
 		{
138
-			$this->error='NotConfigured';
138
+			$this->error = 'NotConfigured';
139 139
 			return 0;
140 140
 		}
141 141
 
142
-		$numFinal=get_next_value($db,$mask,'livraison','ref','',$objsoc,$object->date_livraison);
142
+		$numFinal = get_next_value($db, $mask, 'livraison', 'ref', '', $objsoc, $object->date_livraison);
143 143
 
144 144
 		return  $numFinal;
145 145
     }
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * 	@param	string		$objforref	Object for number to search
153 153
      *  @return string      			Next free value
154 154
      */
155
-    function getNumRef($objsoc,$objforref)
155
+    function getNumRef($objsoc, $objforref)
156 156
     {
157
-        return $this->getNextValue($objsoc,$objforref);
157
+        return $this->getNextValue($objsoc, $objforref);
158 158
     }
159 159
 
160 160
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
      *  @param  Object		$object			Objet livraison
167 167
      *  @return string      				Texte descripif
168 168
      */
169
-    function livraison_get_num($objsoc=0,$object='')
169
+    function livraison_get_num($objsoc = 0, $object = '')
170 170
     {
171 171
         // phpcs:enable
172
-        return $this->getNextValue($objsoc,$object);
172
+        return $this->getNextValue($objsoc, $object);
173 173
     }
174 174
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modStripe.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *  \ingroup    stripe
24 24
  *  \brief      Description and activation file for module Stripe
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
 /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         // It is used to group modules in module setup page
51 51
         $this->family = "interface";
52 52
         // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-        $this->name = preg_replace('/^mod/i','',get_class($this));
53
+        $this->name = preg_replace('/^mod/i', '', get_class($this));
54 54
         // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
55 55
         $this->description = "Module to offer an online payment page by credit card with Stripe";
56 56
         // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         // Name of image file used for this module.
61 61
         // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
62 62
         // If file is in module/img directory, use this->picto=DOL_URL_ROOT.'/module/img/file.png'
63
-        $this->picto='stripe';
63
+        $this->picto = 'stripe';
64 64
 
65 65
         // Data directories to create when module is enabled.
66 66
         $this->dirs = array();
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
         $this->config_page_url = array("stripe.php@stripe");
70 70
 
71 71
         // Dependencies
72
-        $this->hidden = false;			// A condition to hide module
73
-        $this->depends = array();		// List of modules id that must be enabled if this module is enabled
74
-        $this->requiredby = array();	// List of modules id to disable if this one is disabled
75
-        $this->phpmin = array(5,4);					// Minimum version of PHP required by module
76
-        $this->need_dolibarr_version = array(5,0);	// Minimum version of Dolibarr required by module
72
+        $this->hidden = false; // A condition to hide module
73
+        $this->depends = array(); // List of modules id that must be enabled if this module is enabled
74
+        $this->requiredby = array(); // List of modules id to disable if this one is disabled
75
+        $this->phpmin = array(5, 4); // Minimum version of PHP required by module
76
+        $this->need_dolibarr_version = array(5, 0); // Minimum version of Dolibarr required by module
77 77
         $this->langfiles = array("stripe");
78 78
 
79 79
         // Constants
80
-        $this->const = array();			// List of particular constants to add when module is enabled
80
+        $this->const = array(); // List of particular constants to add when module is enabled
81 81
 
82 82
         // New pages on tabs
83 83
         $this->tabs = array();
84 84
 
85 85
         // Boxes
86
-        $this->boxes = array();			// List of boxes
87
-        $r=0;
86
+        $this->boxes = array(); // List of boxes
87
+        $r = 0;
88 88
 
89 89
         // Permissions
90
-        $this->rights = array();		// Permission array used by this module
91
-        $r=0;
90
+        $this->rights = array(); // Permission array used by this module
91
+        $r = 0;
92 92
 
93 93
         // Main menu entries
94
-        $r=0;
94
+        $r = 0;
95 95
        /* $this->menu[$r]=array(
96 96
         	'fk_menu'=>'fk_mainmenu=billing,fk_leftmenu=customers_bills_payment',		    // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
97 97
 	        'mainmenu'=>'billing',
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		);
153 153
 
154 154
         // Exports
155
-        $r=1;
155
+        $r = 1;
156 156
     }
157 157
 }
158 158
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modReceiptPrinter.class.php 1 patch
Spacing   +14 added lines, -14 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 Receipt Printer
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,14 +42,14 @@  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 = 67000;
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 = '53';
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 = "ReceiptPrinterDesc";
55 55
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
         $this->config_page_url = array("receiptprinter.php");
68 68
 
69 69
         // Dependencies
70
-        $this->hidden = false;			// A condition to hide module
71
-		$this->depends = array();		// List of module class names as string that must be enabled if this module is enabled
72
-		$this->requiredby = array();	// List of module ids to disable if this one is disabled
73
-		$this->conflictwith = array();	// List of module class names as string this module is in conflict with
74
-		$this->phpmin = array(5,4);		// Minimum version of PHP required by module
75
-        $this->need_dolibarr_version = array(3,9,-2);   // Minimum version of Dolibarr required by module
70
+        $this->hidden = false; // A condition to hide module
71
+		$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
72
+		$this->requiredby = array(); // List of module ids to disable if this one is disabled
73
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with
74
+		$this->phpmin = array(5, 4); // Minimum version of PHP required by module
75
+        $this->need_dolibarr_version = array(3, 9, -2); // Minimum version of Dolibarr required by module
76 76
         $this->conflictwith = array();
77 77
         $this->langfiles = array("receiptprinter");
78 78
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $this->rights = array();
87 87
         $this->rights_class = 'receiptprinter';
88 88
 
89
-        $r=0;
89
+        $r = 0;
90 90
         // $this->rights[$r][0]     Id permission (unique tous modules confondus)
91 91
         // $this->rights[$r][1]     Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
92 92
         // $this->rights[$r][2]     Non utilise
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
         $this->rights[$r][4] = 'read';
103 103
 
104 104
         // Main menu entries
105
-        $this->menus = array();         // List of menus to add
106
-        $r=0;
105
+        $this->menus = array(); // List of menus to add
106
+        $r = 0;
107 107
 
108 108
         // This is to declare the Top Menu entry:
109 109
         //$this->menu[$r]=array(  'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools',               // Put 0 if this is a top menu
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *      @param      string  $options    Options when enabling module ('', 'noboxes')
131 131
      *      @return     int                 1 if OK, 0 if KO
132 132
      */
133
-    function init($options='')
133
+    function init($options = '')
134 134
     {
135 135
         global $conf;
136 136
         // Clean before activation
@@ -139,6 +139,6 @@  discard block
 block discarded – undo
139 139
             "CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
140 140
             "CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
141 141
             );
142
-        return $this->_init($sql,$options);
142
+        return $this->_init($sql, $options);
143 143
     }
144 144
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/modComptabilite.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * \brief      Fichier de description et activation du module Comptabilite
27 27
  */
28 28
 
29
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30 30
 
31 31
 
32 32
 /**
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 		$this->family = "financial";
51 51
 		$this->module_position = '60';
52 52
 		// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
53
-		$this->name = preg_replace('/^mod/i','',get_class($this));
53
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
54 54
 		$this->description = "Gestion sommaire de comptabilite";
55 55
 
56 56
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
57 57
 		$this->version = 'dolibarr';
58 58
 
59 59
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
60
-        $this->picto='accounting';
60
+        $this->picto = 'accounting';
61 61
 
62 62
 		// Config pages
63 63
 		$this->config_page_url = array("compta.php");
64 64
 
65 65
 		// Dependencies
66
-		$this->depends = array("modFacture","modBanque");
66
+		$this->depends = array("modFacture", "modBanque");
67 67
 		$this->requiredby = array();
68 68
 		$this->conflictwith = array("modAccounting");
69 69
 		$this->langfiles = array("compta");
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		// Permissions
85 85
 		$this->rights = array();
86 86
 		$this->rights_class = 'compta';
87
-		$r=0;
87
+		$r = 0;
88 88
 
89 89
 		$r++;
90 90
 		$this->rights[$r][0] = 95;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 		// Menus
99 99
 		//-------
100
-		$this->menu = 1;        // This module add menu entries. They are coded into menu manager.
100
+		$this->menu = 1; // This module add menu entries. They are coded into menu manager.
101 101
 	}
102 102
 
103 103
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
110 110
 	 *      @return     int             	1 if OK, 0 if KO
111 111
     */
112
-	function init($options='')
112
+	function init($options = '')
113 113
 	{
114 114
 		global $conf;
115 115
 
@@ -118,6 +118,6 @@  discard block
 block discarded – undo
118 118
 
119 119
 		$sql = array();
120 120
 
121
-		return $this->_init($sql,$options);
121
+		return $this->_init($sql, $options);
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php 1 patch
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -67,37 +67,37 @@  discard block
 block discarded – undo
67 67
 		global $conf, $langs, $mysoc;
68 68
 
69 69
 		// Load translation files required by the page
70
-    $langs->loadLangs(array("main","companies"));
70
+    $langs->loadLangs(array("main", "companies"));
71 71
 
72 72
 		$this->db = $db;
73 73
 		$this->name = "ODT templates";
74 74
 		$this->description = $langs->trans("DocumentModelOdt");
75
-		$this->scandir = 'USERGROUP_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
75
+		$this->scandir = 'USERGROUP_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
76 76
 
77 77
 		// Dimension page pour format A4
78 78
 		$this->type = 'odt';
79 79
 		$this->page_largeur = 0;
80 80
 		$this->page_hauteur = 0;
81
-		$this->format = array($this->page_largeur,$this->page_hauteur);
82
-		$this->marge_gauche=0;
83
-		$this->marge_droite=0;
84
-		$this->marge_haute=0;
85
-		$this->marge_basse=0;
86
-
87
-		$this->option_logo = 1;                    // Affiche logo
88
-		$this->option_tva = 0;                     // Gere option tva USERGROUP_TVAOPTION
89
-		$this->option_modereg = 0;                 // Affiche mode reglement
90
-		$this->option_condreg = 0;                 // Affiche conditions reglement
91
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
92
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
93
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
94
-		$this->option_credit_note = 0;             // Support credit notes
95
-		$this->option_freetext = 1;				   // Support add of a personalised text
96
-		$this->option_draft_watermark = 0;		   // Support add of a watermark on drafts
81
+		$this->format = array($this->page_largeur, $this->page_hauteur);
82
+		$this->marge_gauche = 0;
83
+		$this->marge_droite = 0;
84
+		$this->marge_haute = 0;
85
+		$this->marge_basse = 0;
86
+
87
+		$this->option_logo = 1; // Affiche logo
88
+		$this->option_tva = 0; // Gere option tva USERGROUP_TVAOPTION
89
+		$this->option_modereg = 0; // Affiche mode reglement
90
+		$this->option_condreg = 0; // Affiche conditions reglement
91
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
92
+		$this->option_multilang = 1; // Dispo en plusieurs langues
93
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
94
+		$this->option_credit_note = 0; // Support credit notes
95
+		$this->option_freetext = 1; // Support add of a personalised text
96
+		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
97 97
 
98 98
 		// Recupere emetteur
99
-		$this->emetteur=$mysoc;
100
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
99
+		$this->emetteur = $mysoc;
100
+		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
101 101
 	}
102 102
 
103 103
 
@@ -109,99 +109,99 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	function info($langs)
111 111
 	{
112
-		global $conf,$langs;
112
+		global $conf, $langs;
113 113
 
114 114
 		// Load translation files required by the page
115
-        $langs->loadLangs(array("errors","companies"));
115
+        $langs->loadLangs(array("errors", "companies"));
116 116
 
117 117
 		$form = new Form($this->db);
118 118
 
119 119
 		$texte = $this->description.".<br>\n";
120
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
121
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
122
-		$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
123
-		$texte.= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
120
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
121
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
122
+		$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
123
+		$texte .= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
124 124
 		if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
125 125
 		{
126
-			$texte.= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
127
-			$texte.= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
128
-			$texte.= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
126
+			$texte .= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
127
+			$texte .= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
128
+			$texte .= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
129 129
 		}
130
-		$texte.= '<table class="nobordernopadding" width="100%">';
130
+		$texte .= '<table class="nobordernopadding" width="100%">';
131 131
 
132 132
 		// List of directories area
133
-		$texte.= '<tr><td>';
134
-		$texttitle=$langs->trans("ListOfDirectories");
135
-		$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH)));
136
-		$listoffiles=array();
137
-		foreach($listofdir as $key=>$tmpdir)
133
+		$texte .= '<tr><td>';
134
+		$texttitle = $langs->trans("ListOfDirectories");
135
+		$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH)));
136
+		$listoffiles = array();
137
+		foreach ($listofdir as $key=>$tmpdir)
138 138
 		{
139
-			$tmpdir=trim($tmpdir);
140
-			$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
141
-			if (! $tmpdir) {
139
+			$tmpdir = trim($tmpdir);
140
+			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
141
+			if (!$tmpdir) {
142 142
 				unset($listofdir[$key]); continue;
143 143
 			}
144
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
144
+			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
145 145
 			else
146 146
 			{
147
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
148
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
147
+				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
148
+				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
149 149
 			}
150 150
 		}
151
-		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
151
+		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
152 152
 		// Add list of substitution keys
153
-		$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
154
-		$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");    // This contains an url, we don't modify it
155
-
156
-		$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
157
-		$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
158
-		$texte.= '<textarea class="flat" cols="60" name="value1">';
159
-		$texte.=$conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
160
-		$texte.= '</textarea>';
161
-		$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
162
-		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
163
-		$texte.= '<br></div></div>';
153
+		$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
154
+		$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
155
+
156
+		$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
157
+		$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
158
+		$texte .= '<textarea class="flat" cols="60" name="value1">';
159
+		$texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
160
+		$texte .= '</textarea>';
161
+		$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
162
+		$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
163
+		$texte .= '<br></div></div>';
164 164
 
165 165
 		// Scan directories
166 166
 		if (count($listofdir))
167 167
 		{
168
-			$texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
168
+			$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
169 169
 
170 170
 			if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
171 171
 			{
172 172
 				// Model for creation
173
-				$liste=ModelePDFUserGroup::liste_modeles($this->db);
174
-				$texte.= '<table width="50%;">';
175
-				$texte.= '<tr>';
176
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
177
-				$texte.= '<td colspan="">';
178
-				$texte.= $form->selectarray('value2',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT);
179
-				$texte.= "</td></tr>";
180
-
181
-				$texte.= '<tr>';
182
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
183
-				$texte.= '<td colspan="">';
184
-				$texte.= $form->selectarray('value3',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL);
185
-				$texte.= "</td></tr>";
186
-				$texte.= '<tr>';
187
-
188
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
189
-				$texte.= '<td colspan="">';
190
-				$texte.= $form->selectarray('value4',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED);
191
-				$texte.= "</td></tr>";
192
-				$texte.= '</table>';
173
+				$liste = ModelePDFUserGroup::liste_modeles($this->db);
174
+				$texte .= '<table width="50%;">';
175
+				$texte .= '<tr>';
176
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
177
+				$texte .= '<td colspan="">';
178
+				$texte .= $form->selectarray('value2', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT);
179
+				$texte .= "</td></tr>";
180
+
181
+				$texte .= '<tr>';
182
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
183
+				$texte .= '<td colspan="">';
184
+				$texte .= $form->selectarray('value3', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL);
185
+				$texte .= "</td></tr>";
186
+				$texte .= '<tr>';
187
+
188
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
189
+				$texte .= '<td colspan="">';
190
+				$texte .= $form->selectarray('value4', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED);
191
+				$texte .= "</td></tr>";
192
+				$texte .= '</table>';
193 193
 			}
194 194
 		}
195 195
 
196
-		$texte.= '</td>';
196
+		$texte .= '</td>';
197 197
 
198
-		$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
199
-		$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
200
-		$texte.= '</td>';
201
-		$texte.= '</tr>';
198
+		$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
199
+		$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
200
+		$texte .= '</td>';
201
+		$texte .= '</tr>';
202 202
 
203
-		$texte.= '</table>';
204
-		$texte.= '</form>';
203
+		$texte .= '</table>';
204
+		$texte .= '</form>';
205 205
 
206 206
 		return $texte;
207 207
 	}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 *  @param		int			$hideref			Do not show ref
219 219
 	 *	@return		int         					1 if OK, <=0 if KO
220 220
 	 */
221
-	function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
221
+	function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
222 222
 	{
223 223
         // phpcs:enable
224 224
 		global $user, $langs, $conf, $mysoc, $hookmanager;
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 
232 232
 		// Add odtgeneration hook
233
-		if (! is_object($hookmanager))
233
+		if (!is_object($hookmanager))
234 234
 		{
235 235
 			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
236
-			$hookmanager=new HookManager($this->db);
236
+			$hookmanager = new HookManager($this->db);
237 237
 		}
238 238
 		$hookmanager->initHooks(array('odtgeneration'));
239 239
 		global $action;
240 240
 
241
-		if (! is_object($outputlangs)) $outputlangs=$langs;
242
-		$sav_charset_output=$outputlangs->charset_output;
243
-		$outputlangs->charset_output='UTF-8';
241
+		if (!is_object($outputlangs)) $outputlangs = $langs;
242
+		$sav_charset_output = $outputlangs->charset_output;
243
+		$outputlangs->charset_output = 'UTF-8';
244 244
 
245 245
 		// Load translation files required by the page
246 246
 		$outputlangs->loadLangs(array("main", "companies", "bills", "dict"));
@@ -248,28 +248,28 @@  discard block
 block discarded – undo
248 248
 		if ($conf->user->dir_output)
249 249
 		{
250 250
 			// If $object is id instead of object
251
-			if (! is_object($object))
251
+			if (!is_object($object))
252 252
 			{
253 253
 				$id = $object;
254 254
 				$object = new UserGroup($this->db);
255
-				$result=$object->fetch($id);
255
+				$result = $object->fetch($id);
256 256
 				if ($result < 0)
257 257
 				{
258
-					dol_print_error($this->db,$object->error);
258
+					dol_print_error($this->db, $object->error);
259 259
 					return -1;
260 260
 				}
261 261
 			}
262 262
 
263 263
 			$dir = $conf->usergroup->dir_output;
264 264
 			$objectref = dol_sanitizeFileName($object->ref);
265
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
266
-			$file = $dir . "/" . $objectref . ".odt";
265
+			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
266
+			$file = $dir."/".$objectref.".odt";
267 267
 
268
-			if (! file_exists($dir))
268
+			if (!file_exists($dir))
269 269
 			{
270 270
 				if (dol_mkdir($dir) < 0)
271 271
 				{
272
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
272
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
273 273
 					return -1;
274 274
 				}
275 275
 			}
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
 			if (file_exists($dir))
278 278
 			{
279 279
 				//print "srctemplatepath=".$srctemplatepath;	// Src filename
280
-				$newfile=basename($srctemplatepath);
281
-				$newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
282
-				$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
283
-				$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
280
+				$newfile = basename($srctemplatepath);
281
+				$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
282
+				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
283
+				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
284 284
 
285
-				$newfiletmp=$objectref.'_'.$newfiletmp;
285
+				$newfiletmp = $objectref.'_'.$newfiletmp;
286 286
 
287 287
 				// Get extension (ods or odt)
288
-				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
289
-				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
288
+				$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
289
+				if (!empty($conf->global->MAIN_DOC_USE_TIMING))
290 290
 				{
291
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
292
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
293
-					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
291
+				    $format = $conf->global->MAIN_DOC_USE_TIMING;
292
+				    if ($format == '1') $format = '%Y%m%d%H%M%S';
293
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
294 294
 				}
295 295
 				else
296 296
 				{
297
-					$filename=$newfiletmp.'.'.$newfileformat;
297
+					$filename = $newfiletmp.'.'.$newfileformat;
298 298
 				}
299
-				$file=$dir.'/'.$filename;
299
+				$file = $dir.'/'.$filename;
300 300
 				//print "newdir=".$dir;
301 301
 				//print "newfile=".$newfile;
302 302
 				//print "file=".$file;
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
 
307 307
 
308 308
 				// If CUSTOMER contact defined on user, we use it
309
-				$usecontact=false;
310
-				$arrayidcontact=$object->getIdContact('external','CUSTOMER');
309
+				$usecontact = false;
310
+				$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
311 311
 				if (count($arrayidcontact) > 0)
312 312
 				{
313
-					$usecontact=true;
314
-					$result=$object->fetch_contact($arrayidcontact[0]);
313
+					$usecontact = true;
314
+					$result = $object->fetch_contact($arrayidcontact[0]);
315 315
 				}
316 316
 
317 317
 				// Recipient name
318
-				if (! empty($usecontact))
318
+				if (!empty($usecontact))
319 319
 				{
320 320
 					// On peut utiliser le nom de la societe du contact
321
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
321
+					if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
322 322
 					else {
323 323
                         			$socobject = $object->thirdparty;
324 324
                         			// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 				}
328 328
 				else
329 329
 				{
330
-					$socobject=$object->thirdparty;
330
+					$socobject = $object->thirdparty;
331 331
 				}
332 332
 				// Make substitution
333
-				$substitutionarray=array(
333
+				$substitutionarray = array(
334 334
 				'__FROM_NAME__' => $this->emetteur->name,
335 335
 				'__FROM_EMAIL__' => $this->emetteur->email,
336 336
 				'__TOTAL_TTC__' => $object->total_ttc,
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
 				);
340 340
 				complete_substitutions_array($substitutionarray, $langs, $object);
341 341
 				// Call the ODTSubstitution hook
342
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
343
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
342
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
343
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
344 344
 
345 345
 				// Line of free text
346
-				$newfreetext='';
347
-				$paramfreetext='user_FREE_TEXT';
348
-				if (! empty($conf->global->$paramfreetext))
346
+				$newfreetext = '';
347
+				$paramfreetext = 'user_FREE_TEXT';
348
+				if (!empty($conf->global->$paramfreetext))
349 349
 				{
350
-					$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
350
+					$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
351 351
 				}
352 352
 
353 353
 				// Open and load template
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
 						$srctemplatepath,
358 358
 						array(
359 359
 							'PATH_TO_TMP'	  => $conf->user->dir_temp,
360
-							'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
360
+							'ZIP_PROXY'		  => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
361 361
 							'DELIMITER_LEFT'  => '{',
362 362
 							'DELIMITER_RIGHT' => '}'
363 363
 						)
364 364
 					);
365 365
 				} catch (Exception $e) {
366
-					$this->error=$e->getMessage();
366
+					$this->error = $e->getMessage();
367 367
 					dol_syslog($e->getMessage(), LOG_WARNING);
368 368
 					return -1;
369 369
 				}
@@ -384,27 +384,27 @@  discard block
 block discarded – undo
384 384
 				}
385 385
 
386 386
 				// Make substitutions into odt
387
-				$array_user=$this->get_substitutionarray_user($user,$outputlangs);
388
-				$array_global=$this->get_substitutionarray_each_var_object($object,$outputlangs);
389
-				$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
390
-				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
391
-				$array_objet=$this->get_substitutionarray_each_var_object($object,$outputlangs);
392
-				$array_other=$this->get_substitutionarray_other($outputlangs);
387
+				$array_user = $this->get_substitutionarray_user($user, $outputlangs);
388
+				$array_global = $this->get_substitutionarray_each_var_object($object, $outputlangs);
389
+				$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
390
+				$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
391
+				$array_objet = $this->get_substitutionarray_each_var_object($object, $outputlangs);
392
+				$array_other = $this->get_substitutionarray_other($outputlangs);
393 393
 				// retrieve contact information for use in object as contact_xxx tags
394 394
 				$array_thirdparty_contact = array();
395
-				if ($usecontact && is_object($contactobject)) $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
395
+				if ($usecontact && is_object($contactobject)) $array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
396 396
 
397
-				$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
397
+				$tmparray = array_merge($array_global, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
398 398
 				complete_substitutions_array($tmparray, $outputlangs, $object);
399 399
 				$object->fetch_optionals();
400 400
 				// Call the ODTSubstitution hook
401
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
402
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
403
-				foreach($tmparray as $key=>$value)
401
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
402
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
403
+				foreach ($tmparray as $key=>$value)
404 404
 				{
405 405
 					try
406 406
 					{
407
-						if (preg_match('/logo$/',$key)) // Image
407
+						if (preg_match('/logo$/', $key)) // Image
408 408
 						{
409 409
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
410 410
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -436,14 +436,14 @@  discard block
 block discarded – undo
436 436
 					{
437 437
 						foreach ($object->members as $u)
438 438
 						{
439
-							$tmparray=$this->get_substitutionarray_each_var_object($u,$outputlangs);
439
+							$tmparray = $this->get_substitutionarray_each_var_object($u, $outputlangs);
440 440
 							unset($tmparray['object_pass']);
441 441
 							unset($tmparray['object_pass_indatabase']);
442 442
 							complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users");
443 443
 							// Call the ODTSubstitutionLine hook
444
-							$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$u);
445
-							$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
446
-							foreach($tmparray as $key => $val)
444
+							$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$u);
445
+							$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
446
+							foreach ($tmparray as $key => $val)
447 447
 							{
448 448
 								try
449 449
 								{
@@ -465,16 +465,16 @@  discard block
 block discarded – undo
465 465
 						$odfHandler->mergeSegment($listlines);
466 466
 					}
467 467
 				}
468
-				catch(OdfException $e)
468
+				catch (OdfException $e)
469 469
 				{
470
-					$this->error=$e->getMessage();
470
+					$this->error = $e->getMessage();
471 471
 					dol_syslog($this->error, LOG_WARNING);
472 472
 					return -1;
473 473
 				}
474 474
 
475 475
 				// Replace labels translated
476
-				$tmparray=$outputlangs->get_translations_for_substitutions();
477
-				foreach($tmparray as $key => $value)
476
+				$tmparray = $outputlangs->get_translations_for_substitutions();
477
+				foreach ($tmparray as $key => $value)
478 478
 				{
479 479
 					try {
480 480
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 				}
487 487
 
488 488
 				// Call the beforeODTSave hook
489
-				$parameters=array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
490
-				$reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
489
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
490
+				$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
491 491
 
492 492
 				// Write new file
493 493
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
494 494
 					try {
495 495
 						$odfHandler->exportAsAttachedPDF($file);
496 496
 					} catch (Exception $e) {
497
-						$this->error=$e->getMessage();
497
+						$this->error = $e->getMessage();
498 498
 						dol_syslog($e->getMessage(), LOG_WARNING);
499 499
 						return -1;
500 500
 					}
@@ -503,26 +503,26 @@  discard block
 block discarded – undo
503 503
 					try {
504 504
 						$odfHandler->saveToDisk($file);
505 505
 					} catch (Exception $e) {
506
-						$this->error=$e->getMessage();
506
+						$this->error = $e->getMessage();
507 507
 						dol_syslog($e->getMessage(), LOG_WARNING);
508 508
 						return -1;
509 509
 					}
510 510
 				}
511 511
 
512
-				$reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
512
+				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
513 513
 
514
-				if (! empty($conf->global->MAIN_UMASK))
514
+				if (!empty($conf->global->MAIN_UMASK))
515 515
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
516 516
 
517
-				$odfHandler=null;	// Destroy object
517
+				$odfHandler = null; // Destroy object
518 518
 
519 519
 				$this->result = array('fullpath'=>$file);
520 520
 
521
-				return 1;   // Success
521
+				return 1; // Success
522 522
 			}
523 523
 			else
524 524
 			{
525
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
525
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
526 526
 				return -1;
527 527
 			}
528 528
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/usergroup/modules_usergroup.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @var string Error code (or message)
43 43
 	 */
44
-	public $error='';
44
+	public $error = '';
45 45
 
46 46
 
47 47
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      *  @param  integer	$maxfilenamelength  Max length of value to show
53 53
      *  @return	array						List of templates
54 54
 	 */
55
-	static function liste_modeles($db,$maxfilenamelength=0)
55
+	static function liste_modeles($db, $maxfilenamelength = 0)
56 56
 	{
57 57
         // phpcs:enable
58 58
 		global $conf;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/ticket/mod_ticket_universal.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 	 * @deprecated
46 46
 	 * @see name
47 47
 	 */
48
-	public $nom='Universal';
48
+	public $nom = 'Universal';
49 49
 
50 50
 	/**
51 51
 	 * @var string model name
52 52
 	 */
53
-	public $name='Universal';
53
+	public $name = 'Universal';
54 54
 
55 55
     /**
56 56
      *  Renvoi la description du modele de numerotation
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
         global $conf, $langs;
63 63
 
64 64
         // Load translation files required by the page
65
-        $langs->loadLangs(array("ticket","admin"));
65
+        $langs->loadLangs(array("ticket", "admin"));
66 66
 
67 67
         $form = new Form($this->db);
68 68
 
69
-        $texte = $langs->trans('GenericNumRefModelDesc') . "<br>\n";
70
-        $texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
71
-        $texte .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
69
+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
70
+        $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
71
+        $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
72 72
         $texte .= '<input type="hidden" name="action" value="updateMask">';
73 73
         $texte .= '<input type="hidden" name="maskconstticket" value="TICKET_UNIVERSAL_MASK">';
74 74
         $texte .= '<table class="nobordernopadding" width="100%">';
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
         $tooltip .= $langs->trans("GenericMaskCodes5");
81 81
 
82 82
         // Parametrage du prefix
83
-        $texte .= '<tr><td>' . $langs->trans("Mask") . ':</td>';
84
-        $texte .= '<td align="right">' . $form->textwithpicto('<input type="text" class="flat" size="24" name="maskticket" value="' . $conf->global->TICKET_UNIVERSAL_MASK . '">', $tooltip, 1, 1) . '</td>';
83
+        $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
84
+        $texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskticket" value="'.$conf->global->TICKET_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
85 85
 
86
-        $texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="Button"></td>';
86
+        $texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
87 87
 
88 88
         $texte .= '</tr>';
89 89
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         global $db, $conf;
126 126
 
127
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
127
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
128 128
 
129 129
         // On defini critere recherche compteur
130 130
         $mask = $conf->global->TICKET_UNIVERSAL_MASK;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/ticket/mod_ticket_simple.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 	 * @deprecated
49 49
 	 * @see name
50 50
 	 */
51
-	public $nom='Simple';
51
+	public $nom = 'Simple';
52 52
 
53 53
 	/**
54 54
 	 * @var string model name
55 55
 	 */
56
-	public $name='Simple';
56
+	public $name = 'Simple';
57 57
 
58 58
     /**
59 59
      *  Return description of numbering module
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function getExample()
75 75
     {
76
-        return $this->prefix . "0501-0001";
76
+        return $this->prefix."0501-0001";
77 77
     }
78 78
 
79 79
     /**
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
         $max = '';
91 91
 
92 92
         $posindice = 8;
93
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
94
-        $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
95
-        $search = $this->prefix . "____-%";
96
-        $sql .= " WHERE ref LIKE '" . $search ."'";
97
-        $sql .= " AND entity = " . $conf->entity;
93
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
94
+        $sql .= " FROM ".MAIN_DB_PREFIX."ticket";
95
+        $search = $this->prefix."____-%";
96
+        $sql .= " WHERE ref LIKE '".$search."'";
97
+        $sql .= " AND entity = ".$conf->entity;
98 98
         $resql = $db->query($sql);
99 99
         if ($resql) {
100 100
             $row = $db->fetch_row($resql);
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 $max = $row[0];
104 104
             }
105 105
         }
106
-        if (!$coyymm || preg_match('/' . $this->prefix . '[0-9][0-9][0-9][0-9]/i', $coyymm)) {
106
+        if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
107 107
             return true;
108 108
         } else {
109 109
             $langs->load("errors");
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 
126 126
         // D'abord on recupere la valeur max
127 127
         $posindice = 8;
128
-        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
129
-        $sql .= " FROM " . MAIN_DB_PREFIX . "ticket";
130
-        $search = $this->prefix . "____-%";
131
-        $sql .= " WHERE ref LIKE '" . $search ."'";
132
-        $sql .= " AND entity = " . $conf->entity;
128
+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
129
+        $sql .= " FROM ".MAIN_DB_PREFIX."ticket";
130
+        $search = $this->prefix."____-%";
131
+        $sql .= " WHERE ref LIKE '".$search."'";
132
+        $sql .= " AND entity = ".$conf->entity;
133 133
 
134 134
         $resql = $db->query($sql);
135 135
         if ($resql) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $num = sprintf("%04s", $max + 1);
157 157
         }
158 158
 
159
-        dol_syslog("mod_ticket_simple::getNextValue return " . $this->prefix . $yymm . "-" . $num);
160
-        return $this->prefix . $yymm . "-" . $num;
159
+        dol_syslog("mod_ticket_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
160
+        return $this->prefix.$yymm."-".$num;
161 161
     }
162 162
 }
Please login to merge, or discard this patch.