Test Failed
Branch develop (86e751)
by Laurent
34:11
created
htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
275 275
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
276 276
 				{
277
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
278
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
277
+					$format=$conf->global->MAIN_DOC_USE_TIMING;
278
+					if ($format == '1') $format='%Y%m%d%H%M%S';
279 279
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
280 280
 				}
281 281
 				else
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 					// On peut utiliser le nom de la societe du contact
307 307
 					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
308 308
 					else {
309
-                        			$socobject = $object->client;
310
-                        			// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
311
-                        			$contactobject = $object->contact;
312
-                    			}
309
+									$socobject = $object->client;
310
+									// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
311
+									$contactobject = $object->contact;
312
+								}
313 313
 				}
314 314
 				else
315 315
 				{
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
377 377
 				$array_objet=$this->get_substitutionarray_each_var_object($object,$outputlangs);
378 378
 				$array_other=$this->get_substitutionarray_other($outputlangs);
379
-		                // retrieve contact information for use in user as contact_xxx tags
380
-                		$array_thirdparty_contact = array();
381
-                		if ($usecontact)
382
-                    			$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
379
+						// retrieve contact information for use in user as contact_xxx tags
380
+						$array_thirdparty_contact = array();
381
+						if ($usecontact)
382
+								$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
383 383
 
384 384
 				$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
385 385
 				complete_substitutions_array($tmparray, $outputlangs, $object);
Please login to merge, or discard this patch.
Spacing   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 class doc_generic_usergroup_odt extends ModelePDFUserGroup
39 39
 {
40
-	var $emetteur;	// Objet societe qui emet
40
+	var $emetteur; // Objet societe qui emet
41 41
 
42
-	var $phpmin = array(5,2,0);	// Minimum version of PHP required by module
42
+	var $phpmin = array(5, 2, 0); // Minimum version of PHP required by module
43 43
 	var $version = 'dolibarr';
44 44
 
45 45
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	function __construct($db)
52 52
 	{
53
-		global $conf,$langs,$mysoc;
53
+		global $conf, $langs, $mysoc;
54 54
 
55 55
 		$langs->load("main");
56 56
 		$langs->load("companies");
@@ -58,32 +58,32 @@  discard block
 block discarded – undo
58 58
 		$this->db = $db;
59 59
 		$this->name = "ODT templates";
60 60
 		$this->description = $langs->trans("DocumentModelOdt");
61
-		$this->scandir = 'USERGROUP_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
61
+		$this->scandir = 'USERGROUP_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
62 62
 
63 63
 		// Dimension page pour format A4
64 64
 		$this->type = 'odt';
65 65
 		$this->page_largeur = 0;
66 66
 		$this->page_hauteur = 0;
67
-		$this->format = array($this->page_largeur,$this->page_hauteur);
68
-		$this->marge_gauche=0;
69
-		$this->marge_droite=0;
70
-		$this->marge_haute=0;
71
-		$this->marge_basse=0;
72
-
73
-		$this->option_logo = 1;                    // Affiche logo
74
-		$this->option_tva = 0;                     // Gere option tva USERGROUP_TVAOPTION
75
-		$this->option_modereg = 0;                 // Affiche mode reglement
76
-		$this->option_condreg = 0;                 // Affiche conditions reglement
77
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
78
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
79
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
80
-		$this->option_credit_note = 0;             // Support credit notes
81
-		$this->option_freetext = 1;				   // Support add of a personalised text
82
-		$this->option_draft_watermark = 0;		   // Support add of a watermark on drafts
67
+		$this->format = array($this->page_largeur, $this->page_hauteur);
68
+		$this->marge_gauche = 0;
69
+		$this->marge_droite = 0;
70
+		$this->marge_haute = 0;
71
+		$this->marge_basse = 0;
72
+
73
+		$this->option_logo = 1; // Affiche logo
74
+		$this->option_tva = 0; // Gere option tva USERGROUP_TVAOPTION
75
+		$this->option_modereg = 0; // Affiche mode reglement
76
+		$this->option_condreg = 0; // Affiche conditions reglement
77
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
78
+		$this->option_multilang = 1; // Dispo en plusieurs langues
79
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
80
+		$this->option_credit_note = 0; // Support credit notes
81
+		$this->option_freetext = 1; // Support add of a personalised text
82
+		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
83 83
 
84 84
 		// Recupere emetteur
85
-		$this->emetteur=$mysoc;
86
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
85
+		$this->emetteur = $mysoc;
86
+		if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined
87 87
 	}
88 88
 
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function info($langs)
97 97
 	{
98
-		global $conf,$langs;
98
+		global $conf, $langs;
99 99
 
100 100
 		$langs->load("companies");
101 101
 		$langs->load("errors");
@@ -103,91 +103,91 @@  discard block
 block discarded – undo
103 103
 		$form = new Form($this->db);
104 104
 
105 105
 		$texte = $this->description.".<br>\n";
106
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
107
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
-		$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
109
-		$texte.= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
106
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
107
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
108
+		$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
109
+		$texte .= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
110 110
 		if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
111 111
 		{
112
-			$texte.= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
113
-			$texte.= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
114
-			$texte.= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
112
+			$texte .= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
113
+			$texte .= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
114
+			$texte .= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
115 115
 		}
116
-		$texte.= '<table class="nobordernopadding" width="100%">';
116
+		$texte .= '<table class="nobordernopadding" width="100%">';
117 117
 
118 118
 		// List of directories area
119
-		$texte.= '<tr><td>';
120
-		$texttitle=$langs->trans("ListOfDirectories");
121
-		$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH)));
122
-		$listoffiles=array();
123
-		foreach($listofdir as $key=>$tmpdir)
119
+		$texte .= '<tr><td>';
120
+		$texttitle = $langs->trans("ListOfDirectories");
121
+		$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH)));
122
+		$listoffiles = array();
123
+		foreach ($listofdir as $key=>$tmpdir)
124 124
 		{
125
-			$tmpdir=trim($tmpdir);
126
-			$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
127
-			if (! $tmpdir) {
125
+			$tmpdir = trim($tmpdir);
126
+			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
127
+			if (!$tmpdir) {
128 128
 				unset($listofdir[$key]); continue;
129 129
 			}
130
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
130
+			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
131 131
 			else
132 132
 			{
133
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
134
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
133
+				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
134
+				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
135 135
 			}
136 136
 		}
137
-		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
137
+		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
138 138
 		// Add list of substitution keys
139
-		$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
140
-		$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");    // This contains an url, we don't modify it
141
-
142
-		$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
143
-		$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
144
-		$texte.= '<textarea class="flat" cols="60" name="value1">';
145
-		$texte.=$conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
146
-		$texte.= '</textarea>';
147
-		$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
148
-		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
149
-		$texte.= '<br></div></div>';
139
+		$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
140
+		$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
141
+
142
+		$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
143
+		$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
144
+		$texte .= '<textarea class="flat" cols="60" name="value1">';
145
+		$texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH;
146
+		$texte .= '</textarea>';
147
+		$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
148
+		$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
149
+		$texte .= '<br></div></div>';
150 150
 
151 151
 		// Scan directories
152 152
 		if (count($listofdir))
153 153
 		{
154
-			$texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
154
+			$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
155 155
 
156 156
 			if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
157 157
 			{
158 158
 				// Model for creation
159
-				$liste=ModelePDFUserGroup::liste_modeles($this->db);
160
-				$texte.= '<table width="50%;">';
161
-				$texte.= '<tr>';
162
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
163
-				$texte.= '<td colspan="">';
164
-				$texte.= $form->selectarray('value2',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT);
165
-				$texte.= "</td></tr>";
166
-
167
-				$texte.= '<tr>';
168
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
169
-				$texte.= '<td colspan="">';
170
-				$texte.= $form->selectarray('value3',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL);
171
-				$texte.= "</td></tr>";
172
-				$texte.= '<tr>';
173
-
174
-				$texte.= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
175
-				$texte.= '<td colspan="">';
176
-				$texte.= $form->selectarray('value4',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED);
177
-				$texte.= "</td></tr>";
178
-				$texte.= '</table>';
159
+				$liste = ModelePDFUserGroup::liste_modeles($this->db);
160
+				$texte .= '<table width="50%;">';
161
+				$texte .= '<tr>';
162
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalCreate").'</td>';
163
+				$texte .= '<td colspan="">';
164
+				$texte .= $form->selectarray('value2', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT);
165
+				$texte .= "</td></tr>";
166
+
167
+				$texte .= '<tr>';
168
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalToBill").'</td>';
169
+				$texte .= '<td colspan="">';
170
+				$texte .= $form->selectarray('value3', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL);
171
+				$texte .= "</td></tr>";
172
+				$texte .= '<tr>';
173
+
174
+				$texte .= '<td width="60%;">'.$langs->trans("DefaultModelPropalClosed").'</td>';
175
+				$texte .= '<td colspan="">';
176
+				$texte .= $form->selectarray('value4', $liste, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED);
177
+				$texte .= "</td></tr>";
178
+				$texte .= '</table>';
179 179
 			}
180 180
 		}
181 181
 
182
-		$texte.= '</td>';
182
+		$texte .= '</td>';
183 183
 
184
-		$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
185
-		$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
186
-		$texte.= '</td>';
187
-		$texte.= '</tr>';
184
+		$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
185
+		$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
186
+		$texte .= '</td>';
187
+		$texte .= '</tr>';
188 188
 
189
-		$texte.= '</table>';
190
-		$texte.= '</form>';
189
+		$texte .= '</table>';
190
+		$texte .= '</form>';
191 191
 
192 192
 		return $texte;
193 193
 	}
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 	 *  @param		int			$hideref			Do not show ref
204 204
 	 *	@return		int         					1 if OK, <=0 if KO
205 205
 	 */
206
-	function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
206
+	function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
207 207
 	{
208
-		global $user,$langs,$conf,$mysoc,$hookmanager;
208
+		global $user, $langs, $conf, $mysoc, $hookmanager;
209 209
 
210 210
 		if (empty($srctemplatepath))
211 211
 		{
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
 		}
215 215
 
216 216
 		// Add odtgeneration hook
217
-		if (! is_object($hookmanager))
217
+		if (!is_object($hookmanager))
218 218
 		{
219 219
 			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
220
-			$hookmanager=new HookManager($this->db);
220
+			$hookmanager = new HookManager($this->db);
221 221
 		}
222 222
 		$hookmanager->initHooks(array('odtgeneration'));
223 223
 		global $action;
224 224
 
225
-		if (! is_object($outputlangs)) $outputlangs=$langs;
226
-		$sav_charset_output=$outputlangs->charset_output;
227
-		$outputlangs->charset_output='UTF-8';
225
+		if (!is_object($outputlangs)) $outputlangs = $langs;
226
+		$sav_charset_output = $outputlangs->charset_output;
227
+		$outputlangs->charset_output = 'UTF-8';
228 228
 
229 229
 		$outputlangs->load("main");
230 230
 		$outputlangs->load("dict");
@@ -234,28 +234,28 @@  discard block
 block discarded – undo
234 234
 		if ($conf->user->dir_output)
235 235
 		{
236 236
 			// If $object is id instead of object
237
-			if (! is_object($object))
237
+			if (!is_object($object))
238 238
 			{
239 239
 				$id = $object;
240 240
 				$object = new UserGroup($this->db);
241
-				$result=$object->fetch($id);
241
+				$result = $object->fetch($id);
242 242
 				if ($result < 0)
243 243
 				{
244
-					dol_print_error($this->db,$object->error);
244
+					dol_print_error($this->db, $object->error);
245 245
 					return -1;
246 246
 				}
247 247
 			}
248 248
 
249 249
 			$dir = $conf->usergroup->dir_output;
250 250
 			$objectref = dol_sanitizeFileName($object->ref);
251
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
252
-			$file = $dir . "/" . $objectref . ".odt";
251
+			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
252
+			$file = $dir."/".$objectref.".odt";
253 253
 
254
-			if (! file_exists($dir))
254
+			if (!file_exists($dir))
255 255
 			{
256 256
 				if (dol_mkdir($dir) < 0)
257 257
 				{
258
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
258
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
259 259
 					return -1;
260 260
 				}
261 261
 			}
@@ -263,26 +263,26 @@  discard block
 block discarded – undo
263 263
 			if (file_exists($dir))
264 264
 			{
265 265
 				//print "srctemplatepath=".$srctemplatepath;	// Src filename
266
-				$newfile=basename($srctemplatepath);
267
-				$newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
268
-				$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
269
-				$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
266
+				$newfile = basename($srctemplatepath);
267
+				$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
268
+				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
269
+				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
270 270
 
271
-				$newfiletmp=$objectref.'_'.$newfiletmp;
271
+				$newfiletmp = $objectref.'_'.$newfiletmp;
272 272
 
273 273
 				// Get extension (ods or odt)
274
-				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
275
-				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
274
+				$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
275
+				if (!empty($conf->global->MAIN_DOC_USE_TIMING))
276 276
 				{
277
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
278
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
279
-					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
277
+				    $format = $conf->global->MAIN_DOC_USE_TIMING;
278
+				    if ($format == '1') $format = '%Y%m%d%H%M%S';
279
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
280 280
 				}
281 281
 				else
282 282
 				{
283
-					$filename=$newfiletmp.'.'.$newfileformat;
283
+					$filename = $newfiletmp.'.'.$newfileformat;
284 284
 				}
285
-				$file=$dir.'/'.$filename;
285
+				$file = $dir.'/'.$filename;
286 286
 				//print "newdir=".$dir;
287 287
 				//print "newfile=".$newfile;
288 288
 				//print "file=".$file;
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
 
293 293
 
294 294
 				// If CUSTOMER contact defined on user, we use it
295
-				$usecontact=false;
296
-				$arrayidcontact=$object->getIdContact('external','CUSTOMER');
295
+				$usecontact = false;
296
+				$arrayidcontact = $object->getIdContact('external', 'CUSTOMER');
297 297
 				if (count($arrayidcontact) > 0)
298 298
 				{
299
-					$usecontact=true;
300
-					$result=$object->fetch_contact($arrayidcontact[0]);
299
+					$usecontact = true;
300
+					$result = $object->fetch_contact($arrayidcontact[0]);
301 301
 				}
302 302
 
303 303
 				// Recipient name
304
-				if (! empty($usecontact))
304
+				if (!empty($usecontact))
305 305
 				{
306 306
 					// On peut utiliser le nom de la societe du contact
307
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
307
+					if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
308 308
 					else {
309 309
                         			$socobject = $object->client;
310 310
                         			// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 				}
314 314
 				else
315 315
 				{
316
-					$socobject=$object->client;
316
+					$socobject = $object->client;
317 317
 				}
318 318
 				// Make substitution
319
-				$substitutionarray=array(
319
+				$substitutionarray = array(
320 320
 				'__FROM_NAME__' => $this->emetteur->name,
321 321
 				'__FROM_EMAIL__' => $this->emetteur->email,
322 322
 				'__TOTAL_TTC__' => $object->total_ttc,
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 				);
326 326
 				complete_substitutions_array($substitutionarray, $langs, $object);
327 327
 				// Call the ODTSubstitution hook
328
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
329
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
328
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
329
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
330 330
 
331 331
 				// Line of free text
332
-				$newfreetext='';
333
-				$paramfreetext='user_FREE_TEXT';
334
-				if (! empty($conf->global->$paramfreetext))
332
+				$newfreetext = '';
333
+				$paramfreetext = 'user_FREE_TEXT';
334
+				if (!empty($conf->global->$paramfreetext))
335 335
 				{
336
-					$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
336
+					$newfreetext = make_substitutions($conf->global->$paramfreetext, $substitutionarray);
337 337
 				}
338 338
 
339 339
 				// Open and load template
@@ -343,15 +343,15 @@  discard block
 block discarded – undo
343 343
 						$srctemplatepath,
344 344
 						array(
345 345
 						'PATH_TO_TMP'	  => $conf->user->dir_temp,
346
-						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
346
+						'ZIP_PROXY'		  => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
347 347
 						'DELIMITER_LEFT'  => '{',
348 348
 						'DELIMITER_RIGHT' => '}'
349 349
 						)
350 350
 					);
351 351
 				}
352
-				catch(Exception $e)
352
+				catch (Exception $e)
353 353
 				{
354
-					$this->error=$e->getMessage();
354
+					$this->error = $e->getMessage();
355 355
 					return -1;
356 356
 				}
357 357
 				// After construction $odfHandler->contentXml contains content and
@@ -365,33 +365,33 @@  discard block
 block discarded – undo
365 365
 				try {
366 366
 					$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
367 367
 				}
368
-				catch(OdfException $e)
368
+				catch (OdfException $e)
369 369
 				{
370 370
 				}
371 371
 
372 372
 				// Make substitutions into odt
373
-				$array_user=$this->get_substitutionarray_user($user,$outputlangs);
374
-				$array_global=$this->get_substitutionarray_each_var_object($object,$outputlangs);
375
-				$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
376
-				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
377
-				$array_objet=$this->get_substitutionarray_each_var_object($object,$outputlangs);
378
-				$array_other=$this->get_substitutionarray_other($outputlangs);
373
+				$array_user = $this->get_substitutionarray_user($user, $outputlangs);
374
+				$array_global = $this->get_substitutionarray_each_var_object($object, $outputlangs);
375
+				$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
376
+				$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
377
+				$array_objet = $this->get_substitutionarray_each_var_object($object, $outputlangs);
378
+				$array_other = $this->get_substitutionarray_other($outputlangs);
379 379
 		                // retrieve contact information for use in user as contact_xxx tags
380 380
                 		$array_thirdparty_contact = array();
381 381
                 		if ($usecontact)
382
-                    			$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
382
+                    			$array_thirdparty_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
383 383
 
384
-				$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
384
+				$tmparray = array_merge($array_global, $array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_thirdparty_contact);
385 385
 				complete_substitutions_array($tmparray, $outputlangs, $object);
386 386
 				$object->fetch_optionals();
387 387
 				// Call the ODTSubstitution hook
388
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
389
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
390
-				foreach($tmparray as $key=>$value)
388
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
389
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
390
+				foreach ($tmparray as $key=>$value)
391 391
 				{
392 392
 					try 
393 393
 					{
394
-						if (preg_match('/logo$/',$key)) // Image
394
+						if (preg_match('/logo$/', $key)) // Image
395 395
 						{
396 396
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
397 397
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
402 402
 						}
403 403
 					}
404
-					catch(OdfException $e)
404
+					catch (OdfException $e)
405 405
 					{
406 406
 					}
407 407
 				}
@@ -411,25 +411,25 @@  discard block
 block discarded – undo
411 411
 					$listlines = $odfHandler->setSegment('lines');
412 412
 					foreach ($object->members as $u)
413 413
 					{
414
-						$tmparray=$this->get_substitutionarray_each_var_object($u,$outputlangs);
414
+						$tmparray = $this->get_substitutionarray_each_var_object($u, $outputlangs);
415 415
 						unset($tmparray['object_pass']);
416 416
 						unset($tmparray['object_pass_indatabase']);
417 417
 						complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users");
418 418
 						// Call the ODTSubstitutionLine hook
419
-						$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$u);
420
-						$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
421
-						foreach($tmparray as $key => $val)
419
+						$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$u);
420
+						$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
421
+						foreach ($tmparray as $key => $val)
422 422
 						{
423 423
 							try
424 424
 							{
425
-								if(!is_array($val)) {
425
+								if (!is_array($val)) {
426 426
 									$listlines->setVars($key, $val, true, 'UTF-8');
427 427
 								}
428 428
 							}
429
-							catch(OdfException $e)
429
+							catch (OdfException $e)
430 430
 							{
431 431
 							}
432
-							catch(SegmentException $e)
432
+							catch (SegmentException $e)
433 433
 							{
434 434
 							}
435 435
 						}
@@ -437,61 +437,61 @@  discard block
 block discarded – undo
437 437
 					}
438 438
 					$odfHandler->mergeSegment($listlines);
439 439
 				}
440
-				catch(OdfException $e)
440
+				catch (OdfException $e)
441 441
 				{
442
-					$this->error=$e->getMessage();
442
+					$this->error = $e->getMessage();
443 443
 					dol_syslog($this->error, LOG_WARNING);
444 444
 					return -1;
445 445
 				}
446 446
 				
447 447
 				// Replace labels translated
448
-				$tmparray=$outputlangs->get_translations_for_substitutions();
449
-				foreach($tmparray as $key=>$value)
448
+				$tmparray = $outputlangs->get_translations_for_substitutions();
449
+				foreach ($tmparray as $key=>$value)
450 450
 				{
451 451
 					try {
452 452
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
453 453
 					}
454
-					catch(OdfException $e)
454
+					catch (OdfException $e)
455 455
 					{
456 456
 					}
457 457
 				}
458 458
 
459 459
 				// Call the beforeODTSave hook
460
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
461
-				$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
460
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
461
+				$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
462 462
 
463 463
 				// Write new file
464 464
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
465 465
 					try {
466 466
 						$odfHandler->exportAsAttachedPDF($file);
467
-					}catch (Exception $e){
468
-						$this->error=$e->getMessage();
467
+					} catch (Exception $e) {
468
+						$this->error = $e->getMessage();
469 469
 						return -1;
470 470
 					}
471 471
 				}
472 472
 				else {
473 473
 					try {
474 474
 					$odfHandler->saveToDisk($file);
475
-					}catch (Exception $e){
476
-						$this->error=$e->getMessage();
475
+					} catch (Exception $e) {
476
+						$this->error = $e->getMessage();
477 477
 						return -1;
478 478
 					}
479 479
 				}
480 480
 
481
-				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
481
+				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
482 482
 
483
-				if (! empty($conf->global->MAIN_UMASK))
483
+				if (!empty($conf->global->MAIN_UMASK))
484 484
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
485 485
 
486
-				$odfHandler=null;	// Destroy object
486
+				$odfHandler = null; // Destroy object
487 487
 
488 488
 				$this->result = array('fullpath'=>$file);
489 489
 				
490
-				return 1;   // Success
490
+				return 1; // Success
491 491
 			}
492 492
 			else
493 493
 			{
494
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
494
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
495 495
 				return -1;
496 496
 			}
497 497
 		}
Please login to merge, or discard this patch.
Braces   +47 added lines, -41 removed lines patch added patch discarded remove patch
@@ -83,7 +83,10 @@  discard block
 block discarded – undo
83 83
 
84 84
 		// Recupere emetteur
85 85
 		$this->emetteur=$mysoc;
86
-		if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2);    // By default if not defined
86
+		if (! $this->emetteur->country_code) {
87
+			$this->emetteur->country_code=substr($langs->defaultlang,-2);
88
+		}
89
+		// By default if not defined
87 90
 	}
88 91
 
89 92
 
@@ -127,11 +130,14 @@  discard block
 block discarded – undo
127 130
 			if (! $tmpdir) {
128 131
 				unset($listofdir[$key]); continue;
129 132
 			}
130
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
131
-			else
133
+			if (! is_dir($tmpdir)) {
134
+				$texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
135
+			} else
132 136
 			{
133 137
 				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
134
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
138
+				if (count($tmpfiles)) {
139
+					$listoffiles=array_merge($listoffiles,$tmpfiles);
140
+				}
135 141
 			}
136 142
 		}
137 143
 		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
@@ -222,7 +228,9 @@  discard block
 block discarded – undo
222 228
 		$hookmanager->initHooks(array('odtgeneration'));
223 229
 		global $action;
224 230
 
225
-		if (! is_object($outputlangs)) $outputlangs=$langs;
231
+		if (! is_object($outputlangs)) {
232
+			$outputlangs=$langs;
233
+		}
226 234
 		$sav_charset_output=$outputlangs->charset_output;
227 235
 		$outputlangs->charset_output='UTF-8';
228 236
 
@@ -248,7 +256,9 @@  discard block
 block discarded – undo
248 256
 
249 257
 			$dir = $conf->usergroup->dir_output;
250 258
 			$objectref = dol_sanitizeFileName($object->ref);
251
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
259
+			if (! preg_match('/specimen/i',$objectref)) {
260
+				$dir.= "/" . $objectref;
261
+			}
252 262
 			$file = $dir . "/" . $objectref . ".odt";
253 263
 
254 264
 			if (! file_exists($dir))
@@ -275,10 +285,11 @@  discard block
 block discarded – undo
275 285
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
276 286
 				{
277 287
 				    $format=$conf->global->MAIN_DOC_USE_TIMING;
278
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
288
+				    if ($format == '1') {
289
+				    	$format='%Y%m%d%H%M%S';
290
+				    }
279 291
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
280
-				}
281
-				else
292
+				} else
282 293
 				{
283 294
 					$filename=$newfiletmp.'.'.$newfileformat;
284 295
 				}
@@ -304,14 +315,14 @@  discard block
 block discarded – undo
304 315
 				if (! empty($usecontact))
305 316
 				{
306 317
 					// On peut utiliser le nom de la societe du contact
307
-					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
308
-					else {
318
+					if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
319
+						$socobject = $object->contact;
320
+					} else {
309 321
                         			$socobject = $object->client;
310 322
                         			// if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use
311 323
                         			$contactobject = $object->contact;
312 324
                     			}
313
-				}
314
-				else
325
+				} else
315 326
 				{
316 327
 					$socobject=$object->client;
317 328
 				}
@@ -348,8 +359,7 @@  discard block
 block discarded – undo
348 359
 						'DELIMITER_RIGHT' => '}'
349 360
 						)
350 361
 					);
351
-				}
352
-				catch(Exception $e)
362
+				} catch(Exception $e)
353 363
 				{
354 364
 					$this->error=$e->getMessage();
355 365
 					return -1;
@@ -364,8 +374,7 @@  discard block
 block discarded – undo
364 374
 				// Make substitutions into odt of freetext
365 375
 				try {
366 376
 					$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
367
-				}
368
-				catch(OdfException $e)
377
+				} catch(OdfException $e)
369 378
 				{
370 379
 				}
371 380
 
@@ -378,8 +387,9 @@  discard block
 block discarded – undo
378 387
 				$array_other=$this->get_substitutionarray_other($outputlangs);
379 388
 		                // retrieve contact information for use in user as contact_xxx tags
380 389
                 		$array_thirdparty_contact = array();
381
-                		if ($usecontact)
382
-                    			$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
390
+                		if ($usecontact) {
391
+                		                    			$array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
392
+                		}
383 393
 
384 394
 				$tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact);
385 395
 				complete_substitutions_array($tmparray, $outputlangs, $object);
@@ -391,17 +401,18 @@  discard block
 block discarded – undo
391 401
 				{
392 402
 					try 
393 403
 					{
394
-						if (preg_match('/logo$/',$key)) // Image
404
+						if (preg_match('/logo$/',$key)) {
405
+							// Image
395 406
 						{
396 407
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
397
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
398
-						}
399
-						else    // Text
408
+						} else {
409
+								$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
410
+							}
411
+						} else    // Text
400 412
 						{
401 413
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
402 414
 						}
403
-					}
404
-					catch(OdfException $e)
415
+					} catch(OdfException $e)
405 416
 					{
406 417
 					}
407 418
 				}
@@ -425,19 +436,16 @@  discard block
 block discarded – undo
425 436
 								if(!is_array($val)) {
426 437
 									$listlines->setVars($key, $val, true, 'UTF-8');
427 438
 								}
428
-							}
429
-							catch(OdfException $e)
439
+							} catch(OdfException $e)
430 440
 							{
431
-							}
432
-							catch(SegmentException $e)
441
+							} catch(SegmentException $e)
433 442
 							{
434 443
 							}
435 444
 						}
436 445
 						$listlines->merge();
437 446
 					}
438 447
 					$odfHandler->mergeSegment($listlines);
439
-				}
440
-				catch(OdfException $e)
448
+				} catch(OdfException $e)
441 449
 				{
442 450
 					$this->error=$e->getMessage();
443 451
 					dol_syslog($this->error, LOG_WARNING);
@@ -450,8 +458,7 @@  discard block
 block discarded – undo
450 458
 				{
451 459
 					try {
452 460
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
453
-					}
454
-					catch(OdfException $e)
461
+					} catch(OdfException $e)
455 462
 					{
456 463
 					}
457 464
 				}
@@ -464,15 +471,14 @@  discard block
 block discarded – undo
464 471
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
465 472
 					try {
466 473
 						$odfHandler->exportAsAttachedPDF($file);
467
-					}catch (Exception $e){
474
+					} catch (Exception $e){
468 475
 						$this->error=$e->getMessage();
469 476
 						return -1;
470 477
 					}
471
-				}
472
-				else {
478
+				} else {
473 479
 					try {
474 480
 					$odfHandler->saveToDisk($file);
475
-					}catch (Exception $e){
481
+					} catch (Exception $e){
476 482
 						$this->error=$e->getMessage();
477 483
 						return -1;
478 484
 					}
@@ -480,16 +486,16 @@  discard block
 block discarded – undo
480 486
 
481 487
 				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
482 488
 
483
-				if (! empty($conf->global->MAIN_UMASK))
484
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
489
+				if (! empty($conf->global->MAIN_UMASK)) {
490
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
491
+				}
485 492
 
486 493
 				$odfHandler=null;	// Destroy object
487 494
 
488 495
 				$this->result = array('fullpath'=>$file);
489 496
 				
490 497
 				return 1;   // Success
491
-			}
492
-			else
498
+			} else
493 499
 			{
494 500
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
495 501
 				return -1;
Please login to merge, or discard this patch.
htdocs/core/modules/usergroup/modules_usergroup.class.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
 	/**
45 45
 	 *	Return list of active generation modules
46 46
 	 *
47
-     *  @param	DoliDB	$db     			Database handler
48
-     *  @param  integer	$maxfilenamelength  Max length of value to show
49
-     *  @return	array						List of templates
47
+	 *  @param	DoliDB	$db     			Database handler
48
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
49
+	 *  @return	array						List of templates
50 50
 	 */
51 51
 	static function liste_modeles($db,$maxfilenamelength=0)
52 52
 	{
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 abstract class ModelePDFUserGroup extends CommonDocGenerator
40 40
 {
41
-	var $error='';
41
+	var $error = '';
42 42
 
43 43
 
44 44
 	/**
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
      *  @param  integer	$maxfilenamelength  Max length of value to show
49 49
      *  @return	array						List of templates
50 50
 	 */
51
-	static function liste_modeles($db,$maxfilenamelength=0)
51
+	static function liste_modeles($db, $maxfilenamelength = 0)
52 52
 	{
53 53
 		global $conf;
54 54
 
55
-		$type='group';
56
-		$liste=array();
55
+		$type = 'group';
56
+		$liste = array();
57 57
 
58 58
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
59
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
59
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
60 60
 		return $liste;
61 61
 	}
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
htdocs/core/modules/project/modules_project.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  */
32 32
 abstract class ModelePDFProjects extends CommonDocGenerator
33 33
 {
34
-	var $error='';
34
+	var $error = '';
35 35
 
36 36
 
37 37
 	/**
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
      *  @param  integer	$maxfilenamelength  Max length of value to show
42 42
      *  @return	array						List of templates
43 43
 	 */
44
-	static function liste_modeles($db,$maxfilenamelength=0)
44
+	static function liste_modeles($db, $maxfilenamelength = 0)
45 45
 	{
46 46
 		global $conf;
47 47
 
48
-		$type='project';
49
-		$liste=array();
48
+		$type = 'project';
49
+		$liste = array();
50 50
 
51 51
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
52
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
52
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
53 53
 
54 54
 		return $liste;
55 55
 	}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  */
63 63
 abstract class ModeleNumRefProjects
64 64
 {
65
-	var $error='';
65
+	var $error = '';
66 66
 
67 67
 	/**
68 68
 	 *  Return if a module can be used or not
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
 	/**
38 38
 	 *  Return list of active generation modules
39 39
 	 *
40
-     *  @param	DoliDB	$db     			Database handler
41
-     *  @param  integer	$maxfilenamelength  Max length of value to show
42
-     *  @return	array						List of templates
40
+	 *  @param	DoliDB	$db     			Database handler
41
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
42
+	 *  @return	array						List of templates
43 43
 	 */
44 44
 	static function liste_modeles($db,$maxfilenamelength=0)
45 45
 	{
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,10 +92,18 @@
 block discarded – undo
92 92
 		global $langs;
93 93
 		$langs->load("admin");
94 94
 
95
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
96
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
97
-		if ($this->version == 'dolibarr') return DOL_VERSION;
98
-		if ($this->version) return $this->version;
95
+		if ($this->version == 'development') {
96
+			return $langs->trans("VersionDevelopment");
97
+		}
98
+		if ($this->version == 'experimental') {
99
+			return $langs->trans("VersionExperimental");
100
+		}
101
+		if ($this->version == 'dolibarr') {
102
+			return DOL_VERSION;
103
+		}
104
+		if ($this->version) {
105
+			return $this->version;
106
+		}
99 107
 		return $langs->trans("NotAvailable");
100 108
 	}
101 109
 }
Please login to merge, or discard this patch.
htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param   Project			$object             Main object to use as data source
110 110
 	 * @param   Translate		$outputlangs        Lang object to use for output
111
-     * @param   string		    $array_key	        Name of the key for return array
111
+	 * @param   string		    $array_key	        Name of the key for return array
112 112
 	 * @return	array								Array of substitution
113 113
 	 */
114 114
 	function get_substitutionarray_object($object,$outputlangs,$array_key='object')
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 		global $conf;
117 117
 
118 118
 		$resarray=array(
119
-		    $array_key.'_id'=>$object->id,
120
-            $array_key.'_ref'=>$object->ref,
121
-            $array_key.'_title'=>$object->title,
122
-            $array_key.'_description'=>$object->description,
123
-            $array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
124
-            $array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
125
-            $array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
126
-            $array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
127
-            $array_key.'_note_private'=>$object->note_private,
128
-            $array_key.'_note_public'=>$object->note_public,
129
-            $array_key.'_public'=>$object->public,
130
-            $array_key.'_statut'=>$object->getLibStatut()
119
+			$array_key.'_id'=>$object->id,
120
+			$array_key.'_ref'=>$object->ref,
121
+			$array_key.'_title'=>$object->title,
122
+			$array_key.'_description'=>$object->description,
123
+			$array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
124
+			$array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
125
+			$array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
126
+			$array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
127
+			$array_key.'_note_private'=>$object->note_private,
128
+			$array_key.'_note_public'=>$object->note_public,
129
+			$array_key.'_public'=>$object->public,
130
+			$array_key.'_statut'=>$object->getLibStatut()
131 131
 		);
132 132
 
133 133
 		// Retrieve extrafields
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
    			$texte.='<div id="div_'.get_class($this).'" class="hidden">';
405 405
    			foreach($listoffiles as $file)
406 406
    			{
407
-                $texte.=$file['name'].'<br>';
407
+				$texte.=$file['name'].'<br>';
408 408
    			}
409 409
    			$texte.='<div id="div_'.get_class($this).'">';
410 410
 		}
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
501 501
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
502 502
 				{
503
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
504
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
503
+					$format=$conf->global->MAIN_DOC_USE_TIMING;
504
+					if ($format == '1') $format='%Y%m%d%H%M%S';
505 505
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
506 506
 				}
507 507
 				else
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 				// Recipient name
529 529
 				if (! empty($usecontact))
530 530
 				{
531
-        			// if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use
532
-        			$contactobject = $object->contact;
531
+					// if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use
532
+					$contactobject = $object->contact;
533 533
 				}
534 534
 
535 535
 				$socobject=$object->thirdparty;
@@ -577,10 +577,10 @@  discard block
 block discarded – undo
577 577
 				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
578 578
 				$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
579 579
 				$array_other=$this->get_substitutionarray_other($outputlangs);
580
-                // retrieve contact information for use in project as contact_xxx tags
581
-        		$array_project_contact = array();
582
-        		if ($usecontact)
583
-            			$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
580
+				// retrieve contact information for use in project as contact_xxx tags
581
+				$array_project_contact = array();
582
+				if ($usecontact)
583
+						$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
584 584
 
585 585
 				$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
586 586
 				complete_substitutions_array($tmparray, $outputlangs, $object);
Please login to merge, or discard this patch.
Spacing   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
37 37
 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
39
-if (! empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
40
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
41
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
42
-if (! empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
43
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
44
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
45
-if (! empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
46
-if (! empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
47
-if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
48
-if (! empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
39
+if (!empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
40
+if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
41
+if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
42
+if (!empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
43
+if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
44
+if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
45
+if (!empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
46
+if (!empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
47
+if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
48
+if (!empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
49 49
 
50 50
 
51 51
 /**
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
  */
54 54
 class doc_generic_project_odt extends ModelePDFProjects
55 55
 {
56
-	var $emetteur;	// Objet societe qui emet
56
+	var $emetteur; // Objet societe qui emet
57 57
 
58
-	var $phpmin = array(5,2,0);	// Minimum version of PHP required by module
58
+	var $phpmin = array(5, 2, 0); // Minimum version of PHP required by module
59 59
 	var $version = 'dolibarr';
60 60
 
61 61
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	function __construct($db)
68 68
 	{
69
-		global $conf,$langs,$mysoc;
69
+		global $conf, $langs, $mysoc;
70 70
 
71 71
 		$langs->load("main");
72 72
 		$langs->load("companies");
@@ -74,32 +74,32 @@  discard block
 block discarded – undo
74 74
 		$this->db = $db;
75 75
 		$this->name = "ODT templates";
76 76
 		$this->description = $langs->trans("DocumentModelOdt");
77
-		$this->scandir = 'PROJECT_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
77
+		$this->scandir = 'PROJECT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
78 78
 
79 79
 		// Dimension page pour format A4
80 80
 		$this->type = 'odt';
81 81
 		$this->page_largeur = 0;
82 82
 		$this->page_hauteur = 0;
83
-		$this->format = array($this->page_largeur,$this->page_hauteur);
84
-		$this->marge_gauche=0;
85
-		$this->marge_droite=0;
86
-		$this->marge_haute=0;
87
-		$this->marge_basse=0;
88
-
89
-		$this->option_logo = 1;                    // Affiche logo
90
-		$this->option_tva = 0;                     // Gere option tva COMMANDE_TVAOPTION
91
-		$this->option_modereg = 0;                 // Affiche mode reglement
92
-		$this->option_condreg = 0;                 // Affiche conditions reglement
93
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
94
-		$this->option_multilang = 1;               // Dispo en plusieurs langues
95
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
96
-		$this->option_credit_note = 0;             // Support credit notes
97
-		$this->option_freetext = 1;				   // Support add of a personalised text
98
-		$this->option_draft_watermark = 0;		   // Support add of a watermark on drafts
83
+		$this->format = array($this->page_largeur, $this->page_hauteur);
84
+		$this->marge_gauche = 0;
85
+		$this->marge_droite = 0;
86
+		$this->marge_haute = 0;
87
+		$this->marge_basse = 0;
88
+
89
+		$this->option_logo = 1; // Affiche logo
90
+		$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
91
+		$this->option_modereg = 0; // Affiche mode reglement
92
+		$this->option_condreg = 0; // Affiche conditions reglement
93
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
94
+		$this->option_multilang = 1; // Dispo en plusieurs langues
95
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
96
+		$this->option_credit_note = 0; // Support credit notes
97
+		$this->option_freetext = 1; // Support add of a personalised text
98
+		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
99 99
 
100 100
 		// Recupere emetteur
101
-		$this->emetteur=$mysoc;
102
-		if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2);    // Par defaut, si n'etait pas defini
101
+		$this->emetteur = $mysoc;
102
+		if (!$this->emetteur->pays_code) $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini
103 103
 	}
104 104
 
105 105
 
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
      * @param   string		    $array_key	        Name of the key for return array
112 112
 	 * @return	array								Array of substitution
113 113
 	 */
114
-	function get_substitutionarray_object($object,$outputlangs,$array_key='object')
114
+	function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
115 115
 	{
116 116
 		global $conf;
117 117
 
118
-		$resarray=array(
118
+		$resarray = array(
119 119
 		    $array_key.'_id'=>$object->id,
120 120
             $array_key.'_ref'=>$object->ref,
121 121
             $array_key.'_title'=>$object->title,
122 122
             $array_key.'_description'=>$object->description,
123
-            $array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
124
-            $array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
125
-            $array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
126
-            $array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
123
+            $array_key.'_date_creation'=>dol_print_date($object->date_c, 'day'),
124
+            $array_key.'_date_modification'=>dol_print_date($object->date_m, 'day'),
125
+            $array_key.'_date_start'=>dol_print_date($object->date_start, 'day'),
126
+            $array_key.'_date_end'=>dol_print_date($object->date_end, 'day'),
127 127
             $array_key.'_note_private'=>$object->note_private,
128 128
             $array_key.'_note_public'=>$object->note_public,
129 129
             $array_key.'_public'=>$object->public,
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 		);
132 132
 
133 133
 		// Retrieve extrafields
134
-		$extrafieldkey=$object->element;
134
+		$extrafieldkey = $object->element;
135 135
 
136 136
 		require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
137 137
 		$extrafields = new ExtraFields($this->db);
138
-		$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
139
-		$object->fetch_optionals($object->id,$extralabels);
138
+		$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey, true);
139
+		$object->fetch_optionals($object->id, $extralabels);
140 140
 
141
-		$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
141
+		$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
142 142
 		
143 143
 		return $resarray;
144 144
 	}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 *	@param  Translate		$outputlangs        Lang object to use for output
151 151
 	 *  @return	array								Return a substitution array
152 152
 	 */
153
-	function get_substitutionarray_tasks($task,$outputlangs)
153
+	function get_substitutionarray_tasks($task, $outputlangs)
154 154
 	{
155 155
 		global $conf;
156 156
 
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 		'task_duration'=>$task->duration,
166 166
 		'task_progress'=>$task->progress,
167 167
 		'task_public'=>$task->public,
168
-		'task_date_start'=>dol_print_date($task->date_start,'day'),
169
-		'task_date_end'=>dol_print_date($task->date_end,'day'),
168
+		'task_date_start'=>dol_print_date($task->date_start, 'day'),
169
+		'task_date_end'=>dol_print_date($task->date_end, 'day'),
170 170
 		'task_note_private'=>$task->note_private,
171 171
 		'task_note_public'=>$task->note_public
172 172
 		);
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 	 *	@param  Translate		$outputlangs        Lang object to use for output
180 180
 	 *  @return	array								Return a substitution array
181 181
 	 */
182
-	function get_substitutionarray_project_contacts($contact,$outputlangs)
182
+	function get_substitutionarray_project_contacts($contact, $outputlangs)
183 183
 	{
184 184
 		global $conf;
185
-		$pc='projcontacts_'; // prefix to avoid typos
185
+		$pc = 'projcontacts_'; // prefix to avoid typos
186 186
 
187 187
 		$ret = array(
188 188
 			$pc.'id'=>$contact['id'],
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 			$pc.'email'=>$contact['email']
197 197
 			);
198 198
 
199
-		if ($contact['source']=='external') {
199
+		if ($contact['source'] == 'external') {
200 200
 			$ret[$pc.'isInternal'] = ''; // not internal
201 201
 			
202 202
 			$ct = new Contact($this->db);
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
 			
208 208
 			// fetch external user extrafields
209 209
 			require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
210
-			$extrafields=new ExtraFields($this->db);
211
-			$extralabels=$extrafields->fetch_name_optionals_label($ct->table_element, true);
210
+			$extrafields = new ExtraFields($this->db);
211
+			$extralabels = $extrafields->fetch_name_optionals_label($ct->table_element, true);
212 212
 			$extrafields_num = $ct->fetch_optionals($ct->id, $extralabels);
213 213
 			//dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: ===== Number of Extrafields found: ".$extrafields_num, LOG_DEBUG);
214
-			foreach($ct->array_options as $efkey => $efval) {
214
+			foreach ($ct->array_options as $efkey => $efval) {
215 215
 				dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: +++++ Extrafield ".$efkey." => ".$efval, LOG_DEBUG);
216 216
 				$ret[$pc.$efkey] = $efval; // add nothing else because it already comes as 'options_XX'
217 217
 			}
218
-		} elseif ($contact['source']=='internal') {
218
+		} elseif ($contact['source'] == 'internal') {
219 219
 			$ret[$pc.'isInternal'] = '1'; // this is an internal user
220 220
 		
221 221
 			$ct = new User($this->db);
@@ -235,13 +235,13 @@  discard block
 block discarded – undo
235 235
 	 *	@param  Translate		$outputlangs        Lang object to use for output
236 236
 	 *  @return	array								Return a substitution array
237 237
 	 */
238
-	function get_substitutionarray_project_file($file,$outputlangs)
238
+	function get_substitutionarray_project_file($file, $outputlangs)
239 239
 	{
240 240
 		global $conf;
241 241
 
242 242
 		return array(
243 243
 		'projfile_name'=>$file['name'],
244
-		'projfile_date'=>dol_print_date($file['date'],'day'),
244
+		'projfile_date'=>dol_print_date($file['date'], 'day'),
245 245
 		'projfile_size'=>$file['size']
246 246
 		);
247 247
 	}
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 	 *	@param  Translate		$outputlangs        Lang object to use for output
254 254
 	 *  @return	array								Return a substitution array
255 255
 	 */
256
-	function get_substitutionarray_project_reference($refdetail,$outputlangs)
256
+	function get_substitutionarray_project_reference($refdetail, $outputlangs)
257 257
 	{
258 258
 		global $conf;
259 259
 
260 260
 		return array(
261 261
 		'projref_type'=>$refdetail['type'],
262 262
 		'projref_ref'=>$refdetail['ref'],
263
-		'projref_date'=>dol_print_date($refdetail['date'],'day'),
263
+		'projref_date'=>dol_print_date($refdetail['date'], 'day'),
264 264
 		'projref_socname'=>$refdetail['socname'],
265
-		'projref_amountht'=>price($refdetail['amountht'],0,$outputlangs),
266
-		'projref_amountttc'=>price($refdetail['amountttc'],0,$outputlangs),
265
+		'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs),
266
+		'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs),
267 267
 		'projref_status'=>$refdetail['status']
268 268
 		);
269 269
 	}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 *	@param  Translate		$outputlangs        Lang object to use for output
276 276
 	 *  @return	array								Return a substitution array
277 277
 	 */
278
-	function get_substitutionarray_tasksressource($taskressource,$outputlangs)
278
+	function get_substitutionarray_tasksressource($taskressource, $outputlangs)
279 279
 	{
280 280
 		global $conf;
281 281
 		//dol_syslog(get_class($this).'::get_substitutionarray_tasksressource taskressource='.var_export($taskressource,true),LOG_DEBUG);
@@ -297,15 +297,15 @@  discard block
 block discarded – undo
297 297
 	 *	@param  Translate		$outputlangs        Lang object to use for output
298 298
 	 *  @return	array								Return a substitution array
299 299
 	 */
300
-	function get_substitutionarray_taskstime($tasktime,$outputlangs)
300
+	function get_substitutionarray_taskstime($tasktime, $outputlangs)
301 301
 	{
302 302
 		global $conf;
303 303
 
304 304
 		return array(
305 305
 		'tasktime_rowid'=>$tasktime['rowid'],
306
-		'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'),
306
+		'tasktime_task_date'=>dol_print_date($tasktime['task_date'], 'day'),
307 307
 		'tasktime_task_duration_sec'=>$tasktime['task_duration'],
308
-		'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'),
308
+		'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'], 'all'),
309 309
 		'tasktime_note'=>$tasktime['note'],
310 310
 		'tasktime_fk_user'=>$tasktime['fk_user'],
311 311
 		'tasktime_user_name'=>$tasktime['name'],
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 	 *	@param  Translate		$outputlangs        Lang object to use for output
322 322
 	 *  @return	array								Return a substitution array
323 323
 	 */
324
-	function get_substitutionarray_task_file($file,$outputlangs)
324
+	function get_substitutionarray_task_file($file, $outputlangs)
325 325
 	{
326 326
 		global $conf;
327 327
 
328 328
 		return array(
329 329
 		'tasksfile_name'=>$file['name'],
330
-		'tasksfile_date'=>dol_print_date($file['date'],'day'),
330
+		'tasksfile_date'=>dol_print_date($file['date'], 'day'),
331 331
 		'tasksfile_size'=>$file['size']
332 332
 		);
333 333
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	function info($langs)
343 343
 	{
344
-		global $conf,$langs;
344
+		global $conf, $langs;
345 345
 
346 346
 		$langs->load("companies");
347 347
 		$langs->load("errors");
@@ -349,75 +349,75 @@  discard block
 block discarded – undo
349 349
 		$form = new Form($this->db);
350 350
 
351 351
 		$texte = $this->description.".<br>\n";
352
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
353
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
354
-		$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
355
-		$texte.= '<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">';
356
-		$texte.= '<table class="nobordernopadding" width="100%">';
352
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
353
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
354
+		$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
355
+		$texte .= '<input type="hidden" name="param1" value="PROJECT_ADDON_PDF_ODT_PATH">';
356
+		$texte .= '<table class="nobordernopadding" width="100%">';
357 357
 
358 358
 		// List of directories area
359
-		$texte.= '<tr><td>';
360
-		$texttitle=$langs->trans("ListOfDirectories");
361
-		$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH)));
362
-		$listoffiles=array();
363
-		foreach($listofdir as $key=>$tmpdir)
359
+		$texte .= '<tr><td>';
360
+		$texttitle = $langs->trans("ListOfDirectories");
361
+		$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROJECT_ADDON_PDF_ODT_PATH)));
362
+		$listoffiles = array();
363
+		foreach ($listofdir as $key=>$tmpdir)
364 364
 		{
365
-			$tmpdir=trim($tmpdir);
366
-			$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
367
-			if (! $tmpdir) {
365
+			$tmpdir = trim($tmpdir);
366
+			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
367
+			if (!$tmpdir) {
368 368
 				unset($listofdir[$key]); continue;
369 369
 			}
370
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
370
+			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
371 371
 			else
372 372
 			{
373
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
374
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
373
+				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
374
+				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
375 375
 			}
376 376
 		}
377
-		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
377
+		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
378 378
 		// Add list of substitution keys
379
-		$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
380
-		$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");    // This contains an url, we don't modify it
381
-
382
-		$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
383
-		$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
384
-		$texte.= '<textarea class="flat" cols="60" name="value1">';
385
-		$texte.=$conf->global->PROJECT_ADDON_PDF_ODT_PATH;
386
-		$texte.= '</textarea>';
387
-		$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
388
-		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
389
-		$texte.= '<br></div></div>';
379
+		$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
380
+		$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
381
+
382
+		$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
383
+		$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
384
+		$texte .= '<textarea class="flat" cols="60" name="value1">';
385
+		$texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH;
386
+		$texte .= '</textarea>';
387
+		$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
388
+		$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
389
+		$texte .= '<br></div></div>';
390 390
 
391 391
 		// Scan directories
392
-		$nbofiles=count($listoffiles);
393
-		if (! empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH))
392
+		$nbofiles = count($listoffiles);
393
+		if (!empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH))
394 394
 		{
395
-			$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
395
+			$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
396 396
 			//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
397
-			$texte.=$nbofiles;
397
+			$texte .= $nbofiles;
398 398
 			//$texte.=$nbofiles?'</a>':'';
399
-			$texte.='</b>';
399
+			$texte .= '</b>';
400 400
 		}
401 401
 
402 402
 		if ($nbofiles)
403 403
 		{
404
-   			$texte.='<div id="div_'.get_class($this).'" class="hidden">';
405
-   			foreach($listoffiles as $file)
404
+   			$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
405
+   			foreach ($listoffiles as $file)
406 406
    			{
407
-                $texte.=$file['name'].'<br>';
407
+                $texte .= $file['name'].'<br>';
408 408
    			}
409
-   			$texte.='<div id="div_'.get_class($this).'">';
409
+   			$texte .= '<div id="div_'.get_class($this).'">';
410 410
 		}
411 411
 
412
-		$texte.= '</td>';
412
+		$texte .= '</td>';
413 413
 
414
-		$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
415
-		$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
416
-		$texte.= '</td>';
417
-		$texte.= '</tr>';
414
+		$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
415
+		$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
416
+		$texte .= '</td>';
417
+		$texte .= '</tr>';
418 418
 
419
-		$texte.= '</table>';
420
-		$texte.= '</form>';
419
+		$texte .= '</table>';
420
+		$texte .= '</form>';
421 421
 
422 422
 		return $texte;
423 423
 	}
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 	 * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
431 431
 	 *	@return	int         						1 if OK, <=0 if KO
432 432
 	 */
433
-	function write_file($object,$outputlangs,$srctemplatepath)
433
+	function write_file($object, $outputlangs, $srctemplatepath)
434 434
 	{
435
-		global $user,$langs,$conf,$mysoc,$hookmanager;
435
+		global $user, $langs, $conf, $mysoc, $hookmanager;
436 436
 
437 437
 		if (empty($srctemplatepath))
438 438
 		{
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 		}
442 442
 
443 443
 		// Add odtgeneration hook
444
-		if (! is_object($hookmanager))
444
+		if (!is_object($hookmanager))
445 445
 		{
446 446
 			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
447
-			$hookmanager=new HookManager($this->db);
447
+			$hookmanager = new HookManager($this->db);
448 448
 		}
449 449
 		$hookmanager->initHooks(array('odtgeneration'));
450 450
 		global $action;
451 451
 
452
-		if (! is_object($outputlangs)) $outputlangs=$langs;
453
-		$sav_charset_output=$outputlangs->charset_output;
454
-		$outputlangs->charset_output='UTF-8';
452
+		if (!is_object($outputlangs)) $outputlangs = $langs;
453
+		$sav_charset_output = $outputlangs->charset_output;
454
+		$outputlangs->charset_output = 'UTF-8';
455 455
 
456 456
 		$outputlangs->load("main");
457 457
 		$outputlangs->load("dict");
@@ -461,28 +461,28 @@  discard block
 block discarded – undo
461 461
 		if ($conf->projet->dir_output)
462 462
 		{
463 463
 			// If $object is id instead of object
464
-			if (! is_object($object))
464
+			if (!is_object($object))
465 465
 			{
466 466
 				$id = $object;
467 467
 				$object = new Project($this->db);
468
-				$result=$object->fetch($id);
468
+				$result = $object->fetch($id);
469 469
 				if ($result < 0)
470 470
 				{
471
-					dol_print_error($this->db,$object->error);
471
+					dol_print_error($this->db, $object->error);
472 472
 					return -1;
473 473
 				}
474 474
 			}
475 475
 
476 476
 			$dir = $conf->projet->dir_output;
477 477
 			$objectref = dol_sanitizeFileName($object->ref);
478
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
479
-			$file = $dir . "/" . $objectref . ".odt";
478
+			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
479
+			$file = $dir."/".$objectref.".odt";
480 480
 
481
-			if (! file_exists($dir))
481
+			if (!file_exists($dir))
482 482
 			{
483 483
 				if (dol_mkdir($dir) < 0)
484 484
 				{
485
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
485
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
486 486
 					return -1;
487 487
 				}
488 488
 			}
@@ -490,25 +490,25 @@  discard block
 block discarded – undo
490 490
 			if (file_exists($dir))
491 491
 			{
492 492
 				//print "srctemplatepath=".$srctemplatepath;	// Src filename
493
-				$newfile=basename($srctemplatepath);
494
-				$newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
495
-				$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
496
-				$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
497
-				$newfiletmp=$objectref.'_'.$newfiletmp;
493
+				$newfile = basename($srctemplatepath);
494
+				$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
495
+				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
496
+				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
497
+				$newfiletmp = $objectref.'_'.$newfiletmp;
498 498
 				//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
499 499
 				// Get extension (ods or odt)
500
-				$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
501
-				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
500
+				$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
501
+				if (!empty($conf->global->MAIN_DOC_USE_TIMING))
502 502
 				{
503
-				    $format=$conf->global->MAIN_DOC_USE_TIMING;
504
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
505
-					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
503
+				    $format = $conf->global->MAIN_DOC_USE_TIMING;
504
+				    if ($format == '1') $format = '%Y%m%d%H%M%S';
505
+					$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
506 506
 				}
507 507
 				else
508 508
 				{
509
-					$filename=$newfiletmp.'.'.$newfileformat;
509
+					$filename = $newfiletmp.'.'.$newfileformat;
510 510
 				}
511
-				$file=$dir.'/'.$filename;
511
+				$file = $dir.'/'.$filename;
512 512
 				//print "newdir=".$dir;
513 513
 				//print "newfile=".$newfile;
514 514
 				//print "file=".$file;
@@ -517,32 +517,32 @@  discard block
 block discarded – undo
517 517
 				dol_mkdir($conf->projet->dir_temp);
518 518
 
519 519
 				// If PROJECTLEADER contact defined on project, we use it
520
-				$usecontact=false;
521
-				$arrayidcontact=$object->getIdContact('external','PROJECTLEADER');
520
+				$usecontact = false;
521
+				$arrayidcontact = $object->getIdContact('external', 'PROJECTLEADER');
522 522
 				if (count($arrayidcontact) > 0)
523 523
 				{
524
-					$usecontact=true;
525
-					$result=$object->fetch_contact($arrayidcontact[0]);
524
+					$usecontact = true;
525
+					$result = $object->fetch_contact($arrayidcontact[0]);
526 526
 				}
527 527
 
528 528
 				// Recipient name
529
-				if (! empty($usecontact))
529
+				if (!empty($usecontact))
530 530
 				{
531 531
         			// if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use
532 532
         			$contactobject = $object->contact;
533 533
 				}
534 534
 
535
-				$socobject=$object->thirdparty;
535
+				$socobject = $object->thirdparty;
536 536
 
537 537
 				// Make substitution
538
-				$substitutionarray=array(
538
+				$substitutionarray = array(
539 539
 				'__FROM_NAME__' => $this->emetteur->name,
540 540
 				'__FROM_EMAIL__' => $this->emetteur->email,
541 541
 				);
542 542
 				complete_substitutions_array($substitutionarray, $langs, $object);
543 543
 				// Call the ODTSubstitution hook
544
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
545
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
544
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
545
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
546 546
 
547 547
 				// Open and load template
548 548
 				require_once ODTPHP_PATH.'odf.php';
@@ -551,15 +551,15 @@  discard block
 block discarded – undo
551 551
 						$srctemplatepath,
552 552
 						array(
553 553
 						'PATH_TO_TMP'	  => $conf->projet->dir_temp,
554
-						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
554
+						'ZIP_PROXY'		  => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
555 555
 						'DELIMITER_LEFT'  => '{',
556 556
 						'DELIMITER_RIGHT' => '}'
557 557
 						)
558 558
 					);
559 559
 				}
560
-				catch(Exception $e)
560
+				catch (Exception $e)
561 561
 				{
562
-					$this->error=$e->getMessage();
562
+					$this->error = $e->getMessage();
563 563
 					return -1;
564 564
 				}
565 565
 				// After construction $odfHandler->contentXml contains content and
@@ -572,25 +572,25 @@  discard block
 block discarded – undo
572 572
 
573 573
 
574 574
 				// Make substitutions into odt of user info
575
-				$array_user=$this->get_substitutionarray_user($user,$outputlangs);
576
-				$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
577
-				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
578
-				$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
579
-				$array_other=$this->get_substitutionarray_other($outputlangs);
575
+				$array_user = $this->get_substitutionarray_user($user, $outputlangs);
576
+				$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
577
+				$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
578
+				$array_objet = $this->get_substitutionarray_object($object, $outputlangs);
579
+				$array_other = $this->get_substitutionarray_other($outputlangs);
580 580
                 // retrieve contact information for use in project as contact_xxx tags
581 581
         		$array_project_contact = array();
582 582
         		if ($usecontact)
583
-            			$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
583
+            			$array_project_contact = $this->get_substitutionarray_contact($contactobject, $outputlangs, 'contact');
584 584
 
585
-				$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
585
+				$tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_objet, $array_other, $array_project_contact);
586 586
 				complete_substitutions_array($tmparray, $outputlangs, $object);
587 587
 				// Call the ODTSubstitution hook
588
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
589
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
590
-				foreach($tmparray as $key=>$value)
588
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
589
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
590
+				foreach ($tmparray as $key=>$value)
591 591
 				{
592 592
 					try {
593
-						if (preg_match('/logo$/',$key)) // Image
593
+						if (preg_match('/logo$/', $key)) // Image
594 594
 						{
595 595
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
596 596
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
601 601
 						}
602 602
 					}
603
-					catch(OdfException $e)
603
+					catch (OdfException $e)
604 604
 					{
605 605
 					}
606 606
 				}
@@ -613,41 +613,41 @@  discard block
 block discarded – undo
613 613
 					$taskstatic = new Task($this->db);
614 614
 
615 615
 					// Security check
616
-					$socid=0;
616
+					$socid = 0;
617 617
 					if (!empty($object->fk_soc)) $socid = $object->fk_soc;
618 618
 
619
-					$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
619
+					$tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
620 620
 
621 621
 
622 622
 					foreach ($tasksarray as $task)
623 623
 					{
624
-						$tmparray=$this->get_substitutionarray_tasks($task,$outputlangs);
624
+						$tmparray = $this->get_substitutionarray_tasks($task, $outputlangs);
625 625
 						//complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines");
626
-						foreach($tmparray as $key => $val)
626
+						foreach ($tmparray as $key => $val)
627 627
 						{
628 628
 							try
629 629
 							{
630 630
 								$listlines->setVars($key, $val, true, 'UTF-8');
631 631
 							}
632
-							catch(OdfException $e)
632
+							catch (OdfException $e)
633 633
 							{
634 634
 							}
635
-							catch(SegmentException $e)
635
+							catch (SegmentException $e)
636 636
 							{
637 637
 							}
638 638
 						}
639 639
 
640
-						$taskobj=new Task($this->db);
640
+						$taskobj = new Task($this->db);
641 641
 						$taskobj->fetch($task->id);
642 642
 
643 643
 						// Replace tags of lines for contacts task
644
-						$sourcearray=array('internal','external');
645
-						$contact_arrray=array();
644
+						$sourcearray = array('internal', 'external');
645
+						$contact_arrray = array();
646 646
 						foreach ($sourcearray as $source) {
647
-							$contact_temp=$taskobj->liste_contact(-1,$source);
647
+							$contact_temp = $taskobj->liste_contact(-1, $source);
648 648
 							if ((is_array($contact_temp) && count($contact_temp) > 0))
649 649
 							{
650
-								$contact_arrray=array_merge($contact_arrray,$contact_temp);
650
+								$contact_arrray = array_merge($contact_arrray, $contact_temp);
651 651
 							}
652 652
 						}
653 653
 						if ((is_array($contact_arrray) && count($contact_arrray) > 0))
@@ -656,32 +656,32 @@  discard block
 block discarded – undo
656 656
 
657 657
 							foreach ($contact_arrray as $contact)
658 658
 							{
659
-								if ($contact['source']=='internal') {
660
-									$objectdetail=new User($this->db);
659
+								if ($contact['source'] == 'internal') {
660
+									$objectdetail = new User($this->db);
661 661
 									$objectdetail->fetch($contact['id']);
662
-									$contact['socname']=$mysoc->name;
663
-								} elseif ($contact['source']=='external') {
664
-									$objectdetail=new Contact($this->db);
662
+									$contact['socname'] = $mysoc->name;
663
+								} elseif ($contact['source'] == 'external') {
664
+									$objectdetail = new Contact($this->db);
665 665
 									$objectdetail->fetch($contact['id']);
666 666
 
667
-									$soc=new Societe($this->db);
667
+									$soc = new Societe($this->db);
668 668
 									$soc->fetch($contact['socid']);
669
-									$contact['socname']=$soc->name;
669
+									$contact['socname'] = $soc->name;
670 670
 								}
671
-								$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
671
+								$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
672 672
 
673
-								$tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs);
673
+								$tmparray = $this->get_substitutionarray_tasksressource($contact, $outputlangs);
674 674
 
675
-								foreach($tmparray as $key => $val)
675
+								foreach ($tmparray as $key => $val)
676 676
 								{
677 677
 									try
678 678
 									{
679 679
 										$listlinestaskres->setVars($key, $val, true, 'UTF-8');
680 680
 									}
681
-									catch(OdfException $e)
681
+									catch (OdfException $e)
682 682
 									{
683 683
 									}
684
-									catch(SegmentException $e)
684
+									catch (SegmentException $e)
685 685
 									{
686 686
 									}
687 687
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 
692 692
 						//Time ressources
693 693
 						$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
694
-						$sql.= ", u.lastname, u.firstname";
694
+						$sql .= ", u.lastname, u.firstname";
695 695
 						$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
696 696
 						$sql .= " , ".MAIN_DB_PREFIX."user as u";
697 697
 						$sql .= " WHERE t.fk_task =".$task->id;
@@ -709,25 +709,25 @@  discard block
 block discarded – undo
709 709
 							{
710 710
 								$row = $this->db->fetch_array($resql);
711 711
 								if (!empty($row['fk_user'])) {
712
-									$objectdetail=new User($this->db);
712
+									$objectdetail = new User($this->db);
713 713
 									$objectdetail->fetch($row['fk_user']);
714
-									$row['fullcivname']=$objectdetail->getFullName($outputlangs,1);
714
+									$row['fullcivname'] = $objectdetail->getFullName($outputlangs, 1);
715 715
 								} else {
716
-									$row['fullcivname']='';
716
+									$row['fullcivname'] = '';
717 717
 								}
718 718
 
719
-								$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);
719
+								$tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs);
720 720
 
721
-								foreach($tmparray as $key => $val)
721
+								foreach ($tmparray as $key => $val)
722 722
 								{
723 723
 									try
724 724
 									{
725 725
 										$listlinestasktime->setVars($key, $val, true, 'UTF-8');
726 726
 									}
727
-									catch(OdfException $e)
727
+									catch (OdfException $e)
728 728
 									{
729 729
 									}
730
-									catch(SegmentException $e)
730
+									catch (SegmentException $e)
731 731
 									{
732 732
 									}
733 733
 								}
@@ -742,23 +742,23 @@  discard block
 block discarded – undo
742 742
 						$listtasksfiles = $listlines->__get('tasksfiles');
743 743
 
744 744
 						$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref);
745
-						$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1);
745
+						$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
746 746
 
747 747
 
748 748
 						foreach ($filearray as $filedetail)
749 749
 						{
750
-							$tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs);
750
+							$tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs);
751 751
 							//dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true));
752
-							foreach($tmparray as $key => $val)
752
+							foreach ($tmparray as $key => $val)
753 753
 							{
754 754
 								try
755 755
 								{
756 756
 									$listtasksfiles->setVars($key, $val, true, 'UTF-8');
757 757
 								}
758
-								catch(OdfException $e)
758
+								catch (OdfException $e)
759 759
 								{
760 760
 								}
761
-								catch(SegmentException $e)
761
+								catch (SegmentException $e)
762 762
 								{
763 763
 								}
764 764
 							}
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
 					}
769 769
 					$odfHandler->mergeSegment($listlines);
770 770
 				}
771
-				catch(OdfException $e)
771
+				catch (OdfException $e)
772 772
 				{
773
-					$ExceptionTrace=$e->getTrace();
773
+					$ExceptionTrace = $e->getTrace();
774 774
 					// no segment defined on ODT is not an error
775
-					if($ExceptionTrace[0]['function'] != 'setSegment')
775
+					if ($ExceptionTrace[0]['function'] != 'setSegment')
776 776
 					{
777
-						$this->error=$e->getMessage();
777
+						$this->error = $e->getMessage();
778 778
 						dol_syslog($this->error, LOG_WARNING);
779 779
 						return -1;
780 780
 					}
@@ -786,23 +786,23 @@  discard block
 block discarded – undo
786 786
 					$listlines = $odfHandler->setSegment('projectfiles');
787 787
 
788 788
 					$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
789
-					$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1);
789
+					$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
790 790
 
791 791
 					foreach ($filearray as $filedetail)
792 792
 					{
793 793
 						//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
794
-						$tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs);
794
+						$tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs);
795 795
 
796
-						foreach($tmparray as $key => $val)
796
+						foreach ($tmparray as $key => $val)
797 797
 						{
798 798
 							try
799 799
 							{
800 800
 								$listlines->setVars($key, $val, true, 'UTF-8');
801 801
 							}
802
-							catch(OdfException $e)
802
+							catch (OdfException $e)
803 803
 							{
804 804
 							}
805
-							catch(SegmentException $e)
805
+							catch (SegmentException $e)
806 806
 							{
807 807
 							}
808 808
 						}
@@ -810,21 +810,21 @@  discard block
 block discarded – undo
810 810
 					}
811 811
 					$odfHandler->mergeSegment($listlines);
812 812
 				}
813
-				catch(OdfException $e)
813
+				catch (OdfException $e)
814 814
 				{
815
-					$this->error=$e->getMessage();
815
+					$this->error = $e->getMessage();
816 816
 					dol_syslog($this->error, LOG_WARNING);
817 817
 					return -1;
818 818
 				}
819 819
 
820 820
 				// Replace tags of lines for contacts
821
-				$sourcearray=array('internal','external');
822
-				$contact_arrray=array();
821
+				$sourcearray = array('internal', 'external');
822
+				$contact_arrray = array();
823 823
 				foreach ($sourcearray as $source) {
824
-					$contact_temp=$object->liste_contact(-1,$source);
824
+					$contact_temp = $object->liste_contact(-1, $source);
825 825
 					if ((is_array($contact_temp) && count($contact_temp) > 0))
826 826
 					{
827
-						$contact_arrray=array_merge($contact_arrray,$contact_temp);
827
+						$contact_arrray = array_merge($contact_arrray, $contact_temp);
828 828
 					}
829 829
 				}
830 830
 				if ((is_array($contact_arrray) && count($contact_arrray) > 0))
@@ -835,31 +835,31 @@  discard block
 block discarded – undo
835 835
 
836 836
 						foreach ($contact_arrray as $contact)
837 837
 						{
838
-							if ($contact['source']=='internal') {
839
-								$objectdetail=new User($this->db);
838
+							if ($contact['source'] == 'internal') {
839
+								$objectdetail = new User($this->db);
840 840
 								$objectdetail->fetch($contact['id']);
841
-								$contact['socname']=$mysoc->name;
842
-							} elseif ($contact['source']=='external') {
843
-								$objectdetail=new Contact($this->db);
841
+								$contact['socname'] = $mysoc->name;
842
+							} elseif ($contact['source'] == 'external') {
843
+								$objectdetail = new Contact($this->db);
844 844
 								$objectdetail->fetch($contact['id']);
845 845
 
846
-								$soc=new Societe($this->db);
846
+								$soc = new Societe($this->db);
847 847
 								$soc->fetch($contact['socid']);
848
-								$contact['socname']=$soc->name;
848
+								$contact['socname'] = $soc->name;
849 849
 							}
850
-							$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
850
+							$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
851 851
 
852
-							$tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs);
853
-							foreach($tmparray as $key => $val)
852
+							$tmparray = $this->get_substitutionarray_project_contacts($contact, $outputlangs);
853
+							foreach ($tmparray as $key => $val)
854 854
 							{
855 855
 								try
856 856
 								{
857 857
 									$listlines->setVars($key, $val, true, 'UTF-8');
858 858
 								}
859
-								catch(OdfException $e)
859
+								catch (OdfException $e)
860 860
 								{
861 861
 								}
862
-								catch(SegmentException $e)
862
+								catch (SegmentException $e)
863 863
 								{
864 864
 								}
865 865
 							}
@@ -867,9 +867,9 @@  discard block
 block discarded – undo
867 867
 						}
868 868
 						$odfHandler->mergeSegment($listlines);
869 869
 					}
870
-					catch(OdfException $e)
870
+					catch (OdfException $e)
871 871
 					{
872
-						$this->error=$e->getMessage();
872
+						$this->error = $e->getMessage();
873 873
 						dol_syslog($this->error, LOG_WARNING);
874 874
 						return -1;
875 875
 					}
@@ -877,17 +877,17 @@  discard block
 block discarded – undo
877 877
 
878 878
 				//List of referent
879 879
 
880
-				$listofreferent=array(
880
+				$listofreferent = array(
881 881
 				'propal'=>array(
882 882
 				'title'=>"ListProposalsAssociatedProject",
883 883
 				'class'=>'Propal',
884 884
 				'table'=>'propal',
885
-				'test'=>$conf->propal->enabled  && $user->rights->propale->lire),
885
+				'test'=>$conf->propal->enabled && $user->rights->propale->lire),
886 886
 				'order'=>array(
887 887
 				'title'=>"ListOrdersAssociatedProject",
888 888
 				'class'=>'Commande',
889 889
 				'table'=>'commande',
890
-				'test'=>$conf->commande->enabled  && $user->rights->commande->lire),
890
+				'test'=>$conf->commande->enabled && $user->rights->commande->lire),
891 891
 				'invoice'=>array(
892 892
 				'title'=>"ListInvoicesAssociatedProject",
893 893
 				'class'=>'Facture',
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 				'title'=>"ListPredefinedInvoicesAssociatedProject",
898 898
 				'class'=>'FactureRec',
899 899
 				'table'=>'facture_rec',
900
-				'test'=>$conf->facture->enabled  && $user->rights->facture->lire),
900
+				'test'=>$conf->facture->enabled && $user->rights->facture->lire),
901 901
 				'order_supplier'=>array(
902 902
 				'title'=>"ListSupplierOrdersAssociatedProject",
903 903
 				'table'=>'commande_fournisseur',
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 				'title'=>"ListSupplierInvoicesAssociatedProject",
908 908
 				'table'=>'facture_fourn',
909 909
 				'class'=>'FactureFournisseur',
910
-				'test'=>$conf->fournisseur->enabled  && $user->rights->fournisseur->facture->lire),
910
+				'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
911 911
 				'contract'=>array(
912 912
 				'title'=>"ListContractAssociatedProject",
913 913
 				'class'=>'Contrat',
@@ -940,72 +940,72 @@  discard block
 block discarded – undo
940 940
 
941 941
 					foreach ($listofreferent as $keyref => $valueref)
942 942
 					{
943
-						$title=$valueref['title'];
944
-						$tablename=$valueref['table'];
945
-						$classname=$valueref['class'];
946
-						$qualified=$valueref['test'];
943
+						$title = $valueref['title'];
944
+						$tablename = $valueref['table'];
945
+						$classname = $valueref['class'];
946
+						$qualified = $valueref['test'];
947 947
 						if ($qualified)
948 948
 						{
949 949
 							$elementarray = $object->get_element_list($keyref, $tablename);
950
-							if (count($elementarray)>0 && is_array($elementarray))
950
+							if (count($elementarray) > 0 && is_array($elementarray))
951 951
 							{
952
-								$var=true;
952
+								$var = true;
953 953
 								$total_ht = 0;
954 954
 								$total_ttc = 0;
955
-								$num=count($elementarray);
955
+								$num = count($elementarray);
956 956
 								for ($i = 0; $i < $num; $i++)
957 957
 								{
958
-									$ref_array=array();
959
-									$ref_array['type']=$langs->trans($classname);
958
+									$ref_array = array();
959
+									$ref_array['type'] = $langs->trans($classname);
960 960
 
961 961
 									$element = new $classname($this->db);
962 962
 									$element->fetch($elementarray[$i]);
963 963
 									$element->fetch_thirdparty();
964 964
 
965 965
 									//Ref object
966
-									$ref_array['ref']=$element->ref;
966
+									$ref_array['ref'] = $element->ref;
967 967
 
968 968
 									//Date object
969
-									$dateref=$element->date;
970
-									if (empty($dateref)) $dateref=$element->datep;
971
-									if (empty($dateref)) $dateref=$element->date_contrat;
972
-									$ref_array['date']=$dateref;
969
+									$dateref = $element->date;
970
+									if (empty($dateref)) $dateref = $element->datep;
971
+									if (empty($dateref)) $dateref = $element->date_contrat;
972
+									$ref_array['date'] = $dateref;
973 973
 
974 974
 									//Soc object
975 975
 									if (is_object($element->thirdparty)) {
976
-										$ref_array['socname']=$element->thirdparty->name;
976
+										$ref_array['socname'] = $element->thirdparty->name;
977 977
 									} else {
978
-										$ref_array['socname']='';
978
+										$ref_array['socname'] = '';
979 979
 									}
980 980
 
981 981
 									//Amount object
982 982
 									if (empty($valueref['disableamount'])) {
983 983
 										if (!empty($element->total_ht)) {
984
-											$ref_array['amountht']=$element->total_ht;
985
-											$ref_array['amountttc']=$element->total_ttc;
986
-										}else {
987
-											$ref_array['amountht']=0;
988
-											$ref_array['amountttc']=0;
984
+											$ref_array['amountht'] = $element->total_ht;
985
+											$ref_array['amountttc'] = $element->total_ttc;
986
+										} else {
987
+											$ref_array['amountht'] = 0;
988
+											$ref_array['amountttc'] = 0;
989 989
 										}
990
-									}else {
991
-										$ref_array['amountht']='';
992
-										$ref_array['amountttc']='';
990
+									} else {
991
+										$ref_array['amountht'] = '';
992
+										$ref_array['amountttc'] = '';
993 993
 									}
994 994
 
995
-									$ref_array['status']=$element->getLibStatut(0);
995
+									$ref_array['status'] = $element->getLibStatut(0);
996 996
 
997
-									$tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs);
997
+									$tmparray = $this->get_substitutionarray_project_reference($ref_array, $outputlangs);
998 998
 
999
-									foreach($tmparray as $key => $val)
999
+									foreach ($tmparray as $key => $val)
1000 1000
 									{
1001 1001
 										try
1002 1002
 										{
1003 1003
 											$listlines->setVars($key, $val, true, 'UTF-8');
1004 1004
 										}
1005
-										catch(OdfException $e)
1005
+										catch (OdfException $e)
1006 1006
 										{
1007 1007
 										}
1008
-										catch(SegmentException $e)
1008
+										catch (SegmentException $e)
1009 1009
 										{
1010 1010
 										}
1011 1011
 									}
@@ -1017,62 +1017,62 @@  discard block
 block discarded – undo
1017 1017
 						$odfHandler->mergeSegment($listlines);
1018 1018
 					}
1019 1019
 				}
1020
-				catch(OdfException $e)
1020
+				catch (OdfException $e)
1021 1021
 				{
1022
-					$this->error=$e->getMessage();
1022
+					$this->error = $e->getMessage();
1023 1023
 					dol_syslog($this->error, LOG_WARNING);
1024 1024
 					return -1;
1025 1025
 				}
1026 1026
 
1027 1027
 				// Replace labels translated
1028
-				$tmparray=$outputlangs->get_translations_for_substitutions();
1029
-				foreach($tmparray as $key=>$value)
1028
+				$tmparray = $outputlangs->get_translations_for_substitutions();
1029
+				foreach ($tmparray as $key=>$value)
1030 1030
 				{
1031 1031
 					try {
1032 1032
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
1033 1033
 					}
1034
-					catch(OdfException $e)
1034
+					catch (OdfException $e)
1035 1035
 					{
1036 1036
 					}
1037 1037
 				}
1038 1038
 
1039 1039
 				// Call the beforeODTSave hook
1040
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
1041
-				$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
1040
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
1041
+				$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1042 1042
 
1043 1043
 
1044 1044
 				// Write new file
1045 1045
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
1046 1046
 					try {
1047 1047
 						$odfHandler->exportAsAttachedPDF($file);
1048
-					}catch (Exception $e){
1049
-						$this->error=$e->getMessage();
1048
+					} catch (Exception $e) {
1049
+						$this->error = $e->getMessage();
1050 1050
 						return -1;
1051 1051
 					}
1052 1052
 				}
1053 1053
 				else {
1054 1054
 					try {
1055 1055
 					$odfHandler->saveToDisk($file);
1056
-					}catch (Exception $e){
1057
-						$this->error=$e->getMessage();
1056
+					} catch (Exception $e) {
1057
+						$this->error = $e->getMessage();
1058 1058
 						return -1;
1059 1059
 					}
1060 1060
 				}
1061
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
1062
-				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
1061
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
1062
+				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1063 1063
 
1064
-				if (! empty($conf->global->MAIN_UMASK))
1064
+				if (!empty($conf->global->MAIN_UMASK))
1065 1065
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
1066 1066
 
1067
-				$odfHandler=null;	// Destroy object
1067
+				$odfHandler = null; // Destroy object
1068 1068
 
1069 1069
 				$this->result = array('fullpath'=>$file);
1070 1070
 				
1071
-				return 1;   // Success
1071
+				return 1; // Success
1072 1072
 			}
1073 1073
 			else
1074 1074
 			{
1075
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
1075
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
1076 1076
 				return -1;
1077 1077
 			}
1078 1078
 		}
Please login to merge, or discard this patch.
Braces   +98 added lines, -80 removed lines patch added patch discarded remove patch
@@ -36,16 +36,36 @@  discard block
 block discarded – undo
36 36
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
37 37
 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
39
-if (! empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
40
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
41
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
42
-if (! empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
43
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
44
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
45
-if (! empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
46
-if (! empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
47
-if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
48
-if (! empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
39
+if (! empty($conf->propal->enabled)) {
40
+	require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
41
+}
42
+if (! empty($conf->facture->enabled)) {
43
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
44
+}
45
+if (! empty($conf->facture->enabled)) {
46
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
47
+}
48
+if (! empty($conf->commande->enabled)) {
49
+	require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
50
+}
51
+if (! empty($conf->fournisseur->enabled)) {
52
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
53
+}
54
+if (! empty($conf->fournisseur->enabled)) {
55
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
56
+}
57
+if (! empty($conf->contrat->enabled)) {
58
+	require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
59
+}
60
+if (! empty($conf->ficheinter->enabled)) {
61
+	require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
62
+}
63
+if (! empty($conf->deplacement->enabled)) {
64
+	require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
65
+}
66
+if (! empty($conf->agenda->enabled)) {
67
+	require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
68
+}
49 69
 
50 70
 
51 71
 /**
@@ -99,7 +119,10 @@  discard block
 block discarded – undo
99 119
 
100 120
 		// Recupere emetteur
101 121
 		$this->emetteur=$mysoc;
102
-		if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2);    // Par defaut, si n'etait pas defini
122
+		if (! $this->emetteur->pays_code) {
123
+			$this->emetteur->pays_code=substr($langs->defaultlang,-2);
124
+		}
125
+		// Par defaut, si n'etait pas defini
103 126
 	}
104 127
 
105 128
 
@@ -367,11 +390,14 @@  discard block
 block discarded – undo
367 390
 			if (! $tmpdir) {
368 391
 				unset($listofdir[$key]); continue;
369 392
 			}
370
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
371
-			else
393
+			if (! is_dir($tmpdir)) {
394
+				$texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
395
+			} else
372 396
 			{
373 397
 				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
374
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
398
+				if (count($tmpfiles)) {
399
+					$listoffiles=array_merge($listoffiles,$tmpfiles);
400
+				}
375 401
 			}
376 402
 		}
377 403
 		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
@@ -449,7 +475,9 @@  discard block
 block discarded – undo
449 475
 		$hookmanager->initHooks(array('odtgeneration'));
450 476
 		global $action;
451 477
 
452
-		if (! is_object($outputlangs)) $outputlangs=$langs;
478
+		if (! is_object($outputlangs)) {
479
+			$outputlangs=$langs;
480
+		}
453 481
 		$sav_charset_output=$outputlangs->charset_output;
454 482
 		$outputlangs->charset_output='UTF-8';
455 483
 
@@ -475,7 +503,9 @@  discard block
 block discarded – undo
475 503
 
476 504
 			$dir = $conf->projet->dir_output;
477 505
 			$objectref = dol_sanitizeFileName($object->ref);
478
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
506
+			if (! preg_match('/specimen/i',$objectref)) {
507
+				$dir.= "/" . $objectref;
508
+			}
479 509
 			$file = $dir . "/" . $objectref . ".odt";
480 510
 
481 511
 			if (! file_exists($dir))
@@ -501,10 +531,11 @@  discard block
 block discarded – undo
501 531
 				if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
502 532
 				{
503 533
 				    $format=$conf->global->MAIN_DOC_USE_TIMING;
504
-				    if ($format == '1') $format='%Y%m%d%H%M%S';
534
+				    if ($format == '1') {
535
+				    	$format='%Y%m%d%H%M%S';
536
+				    }
505 537
 					$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
506
-				}
507
-				else
538
+				} else
508 539
 				{
509 540
 					$filename=$newfiletmp.'.'.$newfileformat;
510 541
 				}
@@ -556,8 +587,7 @@  discard block
 block discarded – undo
556 587
 						'DELIMITER_RIGHT' => '}'
557 588
 						)
558 589
 					);
559
-				}
560
-				catch(Exception $e)
590
+				} catch(Exception $e)
561 591
 				{
562 592
 					$this->error=$e->getMessage();
563 593
 					return -1;
@@ -579,8 +609,9 @@  discard block
 block discarded – undo
579 609
 				$array_other=$this->get_substitutionarray_other($outputlangs);
580 610
                 // retrieve contact information for use in project as contact_xxx tags
581 611
         		$array_project_contact = array();
582
-        		if ($usecontact)
583
-            			$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
612
+        		if ($usecontact) {
613
+        		            			$array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact');
614
+        		}
584 615
 
585 616
 				$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact);
586 617
 				complete_substitutions_array($tmparray, $outputlangs, $object);
@@ -590,17 +621,18 @@  discard block
 block discarded – undo
590 621
 				foreach($tmparray as $key=>$value)
591 622
 				{
592 623
 					try {
593
-						if (preg_match('/logo$/',$key)) // Image
624
+						if (preg_match('/logo$/',$key)) {
625
+							// Image
594 626
 						{
595 627
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
596
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
597
-						}
598
-						else    // Text
628
+						} else {
629
+								$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
630
+							}
631
+						} else    // Text
599 632
 						{
600 633
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
601 634
 						}
602
-					}
603
-					catch(OdfException $e)
635
+					} catch(OdfException $e)
604 636
 					{
605 637
 					}
606 638
 				}
@@ -614,7 +646,9 @@  discard block
 block discarded – undo
614 646
 
615 647
 					// Security check
616 648
 					$socid=0;
617
-					if (!empty($object->fk_soc)) $socid = $object->fk_soc;
649
+					if (!empty($object->fk_soc)) {
650
+						$socid = $object->fk_soc;
651
+					}
618 652
 
619 653
 					$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
620 654
 
@@ -628,11 +662,9 @@  discard block
 block discarded – undo
628 662
 							try
629 663
 							{
630 664
 								$listlines->setVars($key, $val, true, 'UTF-8');
631
-							}
632
-							catch(OdfException $e)
665
+							} catch(OdfException $e)
633 666
 							{
634
-							}
635
-							catch(SegmentException $e)
667
+							} catch(SegmentException $e)
636 668
 							{
637 669
 							}
638 670
 						}
@@ -677,11 +709,9 @@  discard block
 block discarded – undo
677 709
 									try
678 710
 									{
679 711
 										$listlinestaskres->setVars($key, $val, true, 'UTF-8');
680
-									}
681
-									catch(OdfException $e)
712
+									} catch(OdfException $e)
682 713
 									{
683
-									}
684
-									catch(SegmentException $e)
714
+									} catch(SegmentException $e)
685 715
 									{
686 716
 									}
687 717
 								}
@@ -723,11 +753,9 @@  discard block
 block discarded – undo
723 753
 									try
724 754
 									{
725 755
 										$listlinestasktime->setVars($key, $val, true, 'UTF-8');
726
-									}
727
-									catch(OdfException $e)
756
+									} catch(OdfException $e)
728 757
 									{
729
-									}
730
-									catch(SegmentException $e)
758
+									} catch(SegmentException $e)
731 759
 									{
732 760
 									}
733 761
 								}
@@ -754,11 +782,9 @@  discard block
 block discarded – undo
754 782
 								try
755 783
 								{
756 784
 									$listtasksfiles->setVars($key, $val, true, 'UTF-8');
757
-								}
758
-								catch(OdfException $e)
785
+								} catch(OdfException $e)
759 786
 								{
760
-								}
761
-								catch(SegmentException $e)
787
+								} catch(SegmentException $e)
762 788
 								{
763 789
 								}
764 790
 							}
@@ -767,8 +793,7 @@  discard block
 block discarded – undo
767 793
 						$listlines->merge();
768 794
 					}
769 795
 					$odfHandler->mergeSegment($listlines);
770
-				}
771
-				catch(OdfException $e)
796
+				} catch(OdfException $e)
772 797
 				{
773 798
 					$ExceptionTrace=$e->getTrace();
774 799
 					// no segment defined on ODT is not an error
@@ -798,19 +823,16 @@  discard block
 block discarded – undo
798 823
 							try
799 824
 							{
800 825
 								$listlines->setVars($key, $val, true, 'UTF-8');
801
-							}
802
-							catch(OdfException $e)
826
+							} catch(OdfException $e)
803 827
 							{
804
-							}
805
-							catch(SegmentException $e)
828
+							} catch(SegmentException $e)
806 829
 							{
807 830
 							}
808 831
 						}
809 832
 						$listlines->merge();
810 833
 					}
811 834
 					$odfHandler->mergeSegment($listlines);
812
-				}
813
-				catch(OdfException $e)
835
+				} catch(OdfException $e)
814 836
 				{
815 837
 					$this->error=$e->getMessage();
816 838
 					dol_syslog($this->error, LOG_WARNING);
@@ -855,19 +877,16 @@  discard block
 block discarded – undo
855 877
 								try
856 878
 								{
857 879
 									$listlines->setVars($key, $val, true, 'UTF-8');
858
-								}
859
-								catch(OdfException $e)
880
+								} catch(OdfException $e)
860 881
 								{
861
-								}
862
-								catch(SegmentException $e)
882
+								} catch(SegmentException $e)
863 883
 								{
864 884
 								}
865 885
 							}
866 886
 							$listlines->merge();
867 887
 						}
868 888
 						$odfHandler->mergeSegment($listlines);
869
-					}
870
-					catch(OdfException $e)
889
+					} catch(OdfException $e)
871 890
 					{
872 891
 						$this->error=$e->getMessage();
873 892
 						dol_syslog($this->error, LOG_WARNING);
@@ -967,8 +986,12 @@  discard block
 block discarded – undo
967 986
 
968 987
 									//Date object
969 988
 									$dateref=$element->date;
970
-									if (empty($dateref)) $dateref=$element->datep;
971
-									if (empty($dateref)) $dateref=$element->date_contrat;
989
+									if (empty($dateref)) {
990
+										$dateref=$element->datep;
991
+									}
992
+									if (empty($dateref)) {
993
+										$dateref=$element->date_contrat;
994
+									}
972 995
 									$ref_array['date']=$dateref;
973 996
 
974 997
 									//Soc object
@@ -983,11 +1006,11 @@  discard block
 block discarded – undo
983 1006
 										if (!empty($element->total_ht)) {
984 1007
 											$ref_array['amountht']=$element->total_ht;
985 1008
 											$ref_array['amountttc']=$element->total_ttc;
986
-										}else {
1009
+										} else {
987 1010
 											$ref_array['amountht']=0;
988 1011
 											$ref_array['amountttc']=0;
989 1012
 										}
990
-									}else {
1013
+									} else {
991 1014
 										$ref_array['amountht']='';
992 1015
 										$ref_array['amountttc']='';
993 1016
 									}
@@ -1001,11 +1024,9 @@  discard block
 block discarded – undo
1001 1024
 										try
1002 1025
 										{
1003 1026
 											$listlines->setVars($key, $val, true, 'UTF-8');
1004
-										}
1005
-										catch(OdfException $e)
1027
+										} catch(OdfException $e)
1006 1028
 										{
1007
-										}
1008
-										catch(SegmentException $e)
1029
+										} catch(SegmentException $e)
1009 1030
 										{
1010 1031
 										}
1011 1032
 									}
@@ -1016,8 +1037,7 @@  discard block
 block discarded – undo
1016 1037
 						}
1017 1038
 						$odfHandler->mergeSegment($listlines);
1018 1039
 					}
1019
-				}
1020
-				catch(OdfException $e)
1040
+				} catch(OdfException $e)
1021 1041
 				{
1022 1042
 					$this->error=$e->getMessage();
1023 1043
 					dol_syslog($this->error, LOG_WARNING);
@@ -1030,8 +1050,7 @@  discard block
 block discarded – undo
1030 1050
 				{
1031 1051
 					try {
1032 1052
 						$odfHandler->setVars($key, $value, true, 'UTF-8');
1033
-					}
1034
-					catch(OdfException $e)
1053
+					} catch(OdfException $e)
1035 1054
 					{
1036 1055
 					}
1037 1056
 				}
@@ -1045,15 +1064,14 @@  discard block
 block discarded – undo
1045 1064
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
1046 1065
 					try {
1047 1066
 						$odfHandler->exportAsAttachedPDF($file);
1048
-					}catch (Exception $e){
1067
+					} catch (Exception $e){
1049 1068
 						$this->error=$e->getMessage();
1050 1069
 						return -1;
1051 1070
 					}
1052
-				}
1053
-				else {
1071
+				} else {
1054 1072
 					try {
1055 1073
 					$odfHandler->saveToDisk($file);
1056
-					}catch (Exception $e){
1074
+					} catch (Exception $e){
1057 1075
 						$this->error=$e->getMessage();
1058 1076
 						return -1;
1059 1077
 					}
@@ -1061,16 +1079,16 @@  discard block
 block discarded – undo
1061 1079
 				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
1062 1080
 				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
1063 1081
 
1064
-				if (! empty($conf->global->MAIN_UMASK))
1065
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
1082
+				if (! empty($conf->global->MAIN_UMASK)) {
1083
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
1084
+				}
1066 1085
 
1067 1086
 				$odfHandler=null;	// Destroy object
1068 1087
 
1069 1088
 				$this->result = array('fullpath'=>$file);
1070 1089
 				
1071 1090
 				return 1;   // Success
1072
-			}
1073
-			else
1091
+			} else
1074 1092
 			{
1075 1093
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
1076 1094
 				return -1;
Please login to merge, or discard this patch.
htdocs/core/modules/project/task/modules_task.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  */
33 33
 abstract class ModelePDFTask extends CommonDocGenerator
34 34
 {
35
-	var $error='';
35
+	var $error = '';
36 36
 
37 37
 
38 38
 	/**
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
      *  @param  integer	$maxfilenamelength  Max length of value to show
43 43
      *  @return	array						List of templates
44 44
 	 */
45
-	static function liste_modeles($db,$maxfilenamelength=0)
45
+	static function liste_modeles($db, $maxfilenamelength = 0)
46 46
 	{
47 47
 		global $conf;
48 48
 
49
-		$type='project_task';
50
-		$liste=array();
49
+		$type = 'project_task';
50
+		$liste = array();
51 51
 
52 52
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
53
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
53
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
54 54
 
55 55
 		return $liste;
56 56
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
  */
64 64
 abstract class ModeleNumRefTask
65 65
 {
66
-	var $error='';
66
+	var $error = '';
67 67
 
68 68
 	/**
69 69
 	 *  Return if a module can be used or not
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,9 +133,15 @@
 block discarded – undo
133 133
 		global $langs;
134 134
 		$langs->load("admin");
135 135
 
136
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
137
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
138
-		if ($this->version == 'dolibarr') return DOL_VERSION;
136
+		if ($this->version == 'development') {
137
+			return $langs->trans("VersionDevelopment");
138
+		}
139
+		if ($this->version == 'experimental') {
140
+			return $langs->trans("VersionExperimental");
141
+		}
142
+		if ($this->version == 'dolibarr') {
143
+			return DOL_VERSION;
144
+		}
139 145
 		return $langs->trans("NotAvailable");
140 146
 	}
141 147
 }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@
 block discarded – undo
37 37
 	/**
38 38
 	 *  Return list of active generation modules
39 39
 	 *
40
-     *  @param	DoliDB	$db     			Database handler
41
-     *  @param  integer	$maxfilenamelength  Max length of value to show
42
-     *  @return	array						List of templates
40
+	 *  @param	DoliDB	$db     			Database handler
41
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
42
+	 *  @return	array						List of templates
43 43
 	 */
44 44
 	static function liste_modeles($db,$maxfilenamelength=0)
45 45
 	{
Please login to merge, or discard this patch.
htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param   Project			$object             Main object to use as data source
111 111
 	 * @param   Translate		$outputlangs        Lang object to use for output
112
-     * @param   string		    $array_key	        Name of the key for return array
112
+	 * @param   string		    $array_key	        Name of the key for return array
113 113
 	 * @return	array								Array of substitution
114 114
 	 */
115 115
 	function get_substitutionarray_object($object,$outputlangs,$array_key='object')
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
 		global $conf;
118 118
 
119 119
 		$resarray=array(
120
-            $array_key.'_id'=>$object->id,
121
-            $array_key.'_ref'=>$object->ref,
122
-            $array_key.'_title'=>$object->title,
123
-            $array_key.'_description'=>$object->description,
124
-            $array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
125
-            $array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
126
-            $array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
127
-            $array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
128
-            $array_key.'_note_private'=>$object->note_private,
129
-            $array_key.'_note_public'=>$object->note_public,
130
-            $array_key.'_public'=>$object->public,
131
-            $array_key.'_statut'=>$object->getLibStatut()
120
+			$array_key.'_id'=>$object->id,
121
+			$array_key.'_ref'=>$object->ref,
122
+			$array_key.'_title'=>$object->title,
123
+			$array_key.'_description'=>$object->description,
124
+			$array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
125
+			$array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
126
+			$array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
127
+			$array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
128
+			$array_key.'_note_private'=>$object->note_private,
129
+			$array_key.'_note_public'=>$object->note_public,
130
+			$array_key.'_public'=>$object->public,
131
+			$array_key.'_statut'=>$object->getLibStatut()
132 132
 		);
133 133
 
134 134
 		// Retrieve extrafields
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
    			$texte.='<div id="div_'.get_class($this).'" class="hidden">';
375 375
    			foreach($listoffiles as $file)
376 376
    			{
377
-                $texte.=$file['name'].'<br>';
377
+				$texte.=$file['name'].'<br>';
378 378
    			}
379 379
    			$texte.='<div id="div_'.get_class($this).'">';
380 380
 		}
Please login to merge, or discard this patch.
Spacing   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40
-if (! empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
41
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
42
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
43
-if (! empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
44
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
45
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
46
-if (! empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
47
-if (! empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
48
-if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
49
-if (! empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
40
+if (!empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
41
+if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
42
+if (!empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
43
+if (!empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
44
+if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
45
+if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
46
+if (!empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
47
+if (!empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
48
+if (!empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
49
+if (!empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
50 50
 
51 51
 
52 52
 /**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
  */
55 55
 class doc_generic_task_odt extends ModelePDFTask
56 56
 {
57
-	var $emetteur;	// Objet societe qui emet
57
+	var $emetteur; // Objet societe qui emet
58 58
 
59
-	var $phpmin = array(5,2,0);	// Minimum version of PHP required by module
59
+	var $phpmin = array(5, 2, 0); // Minimum version of PHP required by module
60 60
 	var $version = 'dolibarr';
61 61
 
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	function __construct($db)
69 69
 	{
70
-		global $conf,$langs,$mysoc;
70
+		global $conf, $langs, $mysoc;
71 71
 
72 72
 		$langs->load("main");
73 73
 		$langs->load("companies");
@@ -75,32 +75,32 @@  discard block
 block discarded – undo
75 75
 		$this->db = $db;
76 76
 		$this->name = "ODT templates";
77 77
 		$this->description = $langs->trans("DocumentModelOdt");
78
-		$this->scandir = 'PROJECT_TASK_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
78
+		$this->scandir = 'PROJECT_TASK_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
79 79
 
80 80
 		// Dimension page pour format A4
81 81
 		$this->type = 'odt';
82 82
 		$this->page_largeur = 0;
83 83
 		$this->page_hauteur = 0;
84
-		$this->format = array($this->page_largeur,$this->page_hauteur);
85
-		$this->marge_gauche=0;
86
-		$this->marge_droite=0;
87
-		$this->marge_haute=0;
88
-		$this->marge_basse=0;
89
-
90
-		$this->option_logo = 1;                    // Affiche logo
91
-		$this->option_tva = 0;                     // Gere option tva COMMANDE_TVAOPTION
92
-		$this->option_modereg = 0;                 // Affiche mode reglement
93
-		$this->option_condreg = 0;                 // Affiche conditions reglement
94
-		$this->option_codeproduitservice = 0;      // Affiche code produit-service
95
-		$this->option_multilang = 0;               // Dispo en plusieurs langues
96
-		$this->option_escompte = 0;                // Affiche si il y a eu escompte
97
-		$this->option_credit_note = 0;             // Support credit notes
98
-		$this->option_freetext = 1;				   // Support add of a personalised text
99
-		$this->option_draft_watermark = 0;		   // Support add of a watermark on drafts
84
+		$this->format = array($this->page_largeur, $this->page_hauteur);
85
+		$this->marge_gauche = 0;
86
+		$this->marge_droite = 0;
87
+		$this->marge_haute = 0;
88
+		$this->marge_basse = 0;
89
+
90
+		$this->option_logo = 1; // Affiche logo
91
+		$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
92
+		$this->option_modereg = 0; // Affiche mode reglement
93
+		$this->option_condreg = 0; // Affiche conditions reglement
94
+		$this->option_codeproduitservice = 0; // Affiche code produit-service
95
+		$this->option_multilang = 0; // Dispo en plusieurs langues
96
+		$this->option_escompte = 0; // Affiche si il y a eu escompte
97
+		$this->option_credit_note = 0; // Support credit notes
98
+		$this->option_freetext = 1; // Support add of a personalised text
99
+		$this->option_draft_watermark = 0; // Support add of a watermark on drafts
100 100
 
101 101
 		// Recupere emetteur
102
-		$this->emetteur=$mysoc;
103
-		if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2);    // Par defaut, si n'etait pas defini
102
+		$this->emetteur = $mysoc;
103
+		if (!$this->emetteur->pays_code) $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini
104 104
 	}
105 105
 
106 106
 
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
      * @param   string		    $array_key	        Name of the key for return array
113 113
 	 * @return	array								Array of substitution
114 114
 	 */
115
-	function get_substitutionarray_object($object,$outputlangs,$array_key='object')
115
+	function get_substitutionarray_object($object, $outputlangs, $array_key = 'object')
116 116
 	{
117 117
 		global $conf;
118 118
 
119
-		$resarray=array(
119
+		$resarray = array(
120 120
             $array_key.'_id'=>$object->id,
121 121
             $array_key.'_ref'=>$object->ref,
122 122
             $array_key.'_title'=>$object->title,
123 123
             $array_key.'_description'=>$object->description,
124
-            $array_key.'_date_creation'=>dol_print_date($object->date_c,'day'),
125
-            $array_key.'_date_modification'=>dol_print_date($object->date_m,'day'),
126
-            $array_key.'_date_start'=>dol_print_date($object->date_start,'day'),
127
-            $array_key.'_date_end'=>dol_print_date($object->date_end,'day'),
124
+            $array_key.'_date_creation'=>dol_print_date($object->date_c, 'day'),
125
+            $array_key.'_date_modification'=>dol_print_date($object->date_m, 'day'),
126
+            $array_key.'_date_start'=>dol_print_date($object->date_start, 'day'),
127
+            $array_key.'_date_end'=>dol_print_date($object->date_end, 'day'),
128 128
             $array_key.'_note_private'=>$object->note_private,
129 129
             $array_key.'_note_public'=>$object->note_public,
130 130
             $array_key.'_public'=>$object->public,
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 		// Retrieve extrafields
135 135
 		if (is_array($object->array_options) && count($object->array_options))
136 136
 		{
137
-			$extrafieldkey=$object->element;
137
+			$extrafieldkey = $object->element;
138 138
 
139 139
 			require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
140 140
 			$extrafields = new ExtraFields($this->db);
141
-			$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
142
-			$object->fetch_optionals($object->id,$extralabels);
141
+			$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey, true);
142
+			$object->fetch_optionals($object->id, $extralabels);
143 143
 
144
-			$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
144
+			$resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs);
145 145
 		}
146 146
 
147 147
 		return $resarray;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 *	@param  Translate		$outputlangs        Lang object to use for output
155 155
 	 *  @return	array								Return a substitution array
156 156
 	 */
157
-	function get_substitutionarray_tasks($task,$outputlangs)
157
+	function get_substitutionarray_tasks($task, $outputlangs)
158 158
 	{
159 159
 		global $conf;
160 160
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 		'task_duration'=>$task->duration,
170 170
 		'task_progress'=>$task->progress,
171 171
 		'task_public'=>$task->public,
172
-		'task_date_start'=>dol_print_date($task->date_start,'day'),
173
-		'task_date_end'=>dol_print_date($task->date_end,'day'),
172
+		'task_date_start'=>dol_print_date($task->date_start, 'day'),
173
+		'task_date_end'=>dol_print_date($task->date_end, 'day'),
174 174
 		'task_note_private'=>$task->note_private,
175 175
 		'task_note_public'=>$task->note_public
176 176
 		);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 *	@param  Translate		$outputlangs        Lang object to use for output
184 184
 	 *  @return	array								Return a substitution array
185 185
 	 */
186
-	function get_substitutionarray_project_contacts($contact,$outputlangs)
186
+	function get_substitutionarray_project_contacts($contact, $outputlangs)
187 187
 	{
188 188
 		global $conf;
189 189
 
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
 	 *	@param  Translate		$outputlangs        Lang object to use for output
207 207
 	 *  @return	array								Return a substitution array
208 208
 	 */
209
-	function get_substitutionarray_project_file($file,$outputlangs)
209
+	function get_substitutionarray_project_file($file, $outputlangs)
210 210
 	{
211 211
 		global $conf;
212 212
 
213 213
 		return array(
214 214
 		'projfile_name'=>$file['name'],
215
-		'projfile_date'=>dol_print_date($file['date'],'day'),
215
+		'projfile_date'=>dol_print_date($file['date'], 'day'),
216 216
 		'projfile_size'=>$file['size']
217 217
 		);
218 218
 	}
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 	 *	@param  Translate		$outputlangs        Lang object to use for output
225 225
 	 *  @return	array								Return a substitution array
226 226
 	 */
227
-	function get_substitutionarray_project_reference($refdetail,$outputlangs)
227
+	function get_substitutionarray_project_reference($refdetail, $outputlangs)
228 228
 	{
229 229
 		global $conf;
230 230
 
231 231
 		return array(
232 232
 		'projref_type'=>$refdetail['type'],
233 233
 		'projref_ref'=>$refdetail['ref'],
234
-		'projref_date'=>dol_print_date($refdetail['date'],'day'),
234
+		'projref_date'=>dol_print_date($refdetail['date'], 'day'),
235 235
 		'projref_socname'=>$refdetail['socname'],
236
-		'projref_amountht'=>price($refdetail['amountht'],0,$outputlangs),
237
-		'projref_amountttc'=>price($refdetail['amountttc'],0,$outputlangs),
236
+		'projref_amountht'=>price($refdetail['amountht'], 0, $outputlangs),
237
+		'projref_amountttc'=>price($refdetail['amountttc'], 0, $outputlangs),
238 238
 		'projref_status'=>$refdetail['status']
239 239
 		);
240 240
 	}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 *	@param  Translate		$outputlangs        Lang object to use for output
247 247
 	 *  @return	array								Return a substitution array
248 248
 	 */
249
-	function get_substitutionarray_tasksressource($taskressource,$outputlangs)
249
+	function get_substitutionarray_tasksressource($taskressource, $outputlangs)
250 250
 	{
251 251
 		global $conf;
252 252
 		//dol_syslog(get_class($this).'::get_substitutionarray_tasksressource taskressource='.var_export($taskressource,true),LOG_DEBUG);
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
 	 *	@param  Translate		$outputlangs        Lang object to use for output
269 269
 	 *  @return	array								Return a substitution array
270 270
 	 */
271
-	function get_substitutionarray_taskstime($tasktime,$outputlangs)
271
+	function get_substitutionarray_taskstime($tasktime, $outputlangs)
272 272
 	{
273 273
 		global $conf;
274 274
 
275 275
 		return array(
276 276
 		'tasktime_rowid'=>$tasktime['rowid'],
277
-		'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'),
278
-		'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'),
277
+		'tasktime_task_date'=>dol_print_date($tasktime['task_date'], 'day'),
278
+		'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'], 'all'),
279 279
 		'tasktime_note'=>$tasktime['note'],
280 280
 		'tasktime_fk_user'=>$tasktime['fk_user'],
281 281
 		'tasktime_user_name'=>$tasktime['name'],
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 	 *	@param  Translate		$outputlangs        Lang object to use for output
292 292
 	 *  @return	array								Return a substitution array
293 293
 	 */
294
-	function get_substitutionarray_task_file($file,$outputlangs)
294
+	function get_substitutionarray_task_file($file, $outputlangs)
295 295
 	{
296 296
 		global $conf;
297 297
 
298 298
 		return array(
299 299
 		'tasksfile_name'=>$file['name'],
300
-		'tasksfile_date'=>dol_print_date($file['date'],'day'),
300
+		'tasksfile_date'=>dol_print_date($file['date'], 'day'),
301 301
 		'tasksfile_size'=>$file['size']
302 302
 		);
303 303
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	function info($langs)
313 313
 	{
314
-		global $conf,$langs;
314
+		global $conf, $langs;
315 315
 
316 316
 		$langs->load("companies");
317 317
 		$langs->load("errors");
@@ -319,75 +319,75 @@  discard block
 block discarded – undo
319 319
 		$form = new Form($this->db);
320 320
 
321 321
 		$texte = $this->description.".<br>\n";
322
-		$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
323
-		$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
324
-		$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
325
-		$texte.= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
326
-		$texte.= '<table class="nobordernopadding" width="100%">';
322
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
323
+		$texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
324
+		$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
325
+		$texte .= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
326
+		$texte .= '<table class="nobordernopadding" width="100%">';
327 327
 
328 328
 		// List of directories area
329
-		$texte.= '<tr><td>';
330
-		$texttitle=$langs->trans("ListOfDirectories");
331
-		$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH)));
332
-		$listoffiles=array();
333
-		foreach($listofdir as $key=>$tmpdir)
329
+		$texte .= '<tr><td>';
330
+		$texttitle = $langs->trans("ListOfDirectories");
331
+		$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH)));
332
+		$listoffiles = array();
333
+		foreach ($listofdir as $key=>$tmpdir)
334 334
 		{
335
-			$tmpdir=trim($tmpdir);
336
-			$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
337
-			if (! $tmpdir) {
335
+			$tmpdir = trim($tmpdir);
336
+			$tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir);
337
+			if (!$tmpdir) {
338 338
 				unset($listofdir[$key]); continue;
339 339
 			}
340
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
340
+			if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
341 341
 			else
342 342
 			{
343
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
344
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
343
+				$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
344
+				if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
345 345
 			}
346 346
 		}
347
-		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
347
+		$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
348 348
 		// Add list of substitution keys
349
-		$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
350
-		$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation");    // This contains an url, we don't modify it
351
-
352
-		$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
353
-		$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
354
-		$texte.= '<textarea class="flat" cols="60" name="value1">';
355
-		$texte.=$conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH;
356
-		$texte.= '</textarea>';
357
-		$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
358
-		$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
359
-		$texte.= '<br></div></div>';
349
+		$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
350
+		$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
351
+
352
+		$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
353
+		$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
354
+		$texte .= '<textarea class="flat" cols="60" name="value1">';
355
+		$texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH;
356
+		$texte .= '</textarea>';
357
+		$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
358
+		$texte .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
359
+		$texte .= '<br></div></div>';
360 360
 
361 361
 		// Scan directories
362
-		$nbofiles=count($listoffiles);
363
-		if (! empty($conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH))
362
+		$nbofiles = count($listoffiles);
363
+		if (!empty($conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH))
364 364
 		{
365
-			$texte.=$langs->trans("NumberOfModelFilesFound").': <b>';
365
+			$texte .= $langs->trans("NumberOfModelFilesFound").': <b>';
366 366
 			//$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':'';
367
-			$texte.=$nbofiles;
367
+			$texte .= $nbofiles;
368 368
 			//$texte.=$nbofiles?'</a>':'';
369
-			$texte.='</b>';
369
+			$texte .= '</b>';
370 370
 		}
371 371
 
372 372
 		if ($nbofiles)
373 373
 		{
374
-   			$texte.='<div id="div_'.get_class($this).'" class="hidden">';
375
-   			foreach($listoffiles as $file)
374
+   			$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
375
+   			foreach ($listoffiles as $file)
376 376
    			{
377
-                $texte.=$file['name'].'<br>';
377
+                $texte .= $file['name'].'<br>';
378 378
    			}
379
-   			$texte.='<div id="div_'.get_class($this).'">';
379
+   			$texte .= '<div id="div_'.get_class($this).'">';
380 380
 		}
381 381
 
382
-		$texte.= '</td>';
382
+		$texte .= '</td>';
383 383
 
384
-		$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
385
-		$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
386
-		$texte.= '</td>';
387
-		$texte.= '</tr>';
384
+		$texte .= '<td valign="top" rowspan="2" class="hideonsmartphone">';
385
+		$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
386
+		$texte .= '</td>';
387
+		$texte .= '</tr>';
388 388
 
389
-		$texte.= '</table>';
390
-		$texte.= '</form>';
389
+		$texte .= '</table>';
390
+		$texte .= '</form>';
391 391
 
392 392
 		return $texte;
393 393
 	}
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 	 * 	@param	string		$srctemplatepath	    Full path of source filename for generator using a template file
401 401
 	 *	@return	int         						1 if OK, <=0 if KO
402 402
 	 */
403
-	function write_file($object,$outputlangs,$srctemplatepath)
403
+	function write_file($object, $outputlangs, $srctemplatepath)
404 404
 	{
405
-		global $user,$langs,$conf,$mysoc,$hookmanager;
405
+		global $user, $langs, $conf, $mysoc, $hookmanager;
406 406
 
407 407
 		if (empty($srctemplatepath))
408 408
 		{
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 			return -1;
411 411
 		}
412 412
 
413
-		if (! is_object($outputlangs)) $outputlangs=$langs;
414
-		$sav_charset_output=$outputlangs->charset_output;
415
-		$outputlangs->charset_output='UTF-8';
413
+		if (!is_object($outputlangs)) $outputlangs = $langs;
414
+		$sav_charset_output = $outputlangs->charset_output;
415
+		$outputlangs->charset_output = 'UTF-8';
416 416
 
417 417
 		$outputlangs->load("main");
418 418
 		$outputlangs->load("dict");
@@ -422,32 +422,32 @@  discard block
 block discarded – undo
422 422
 		if ($conf->projet->dir_output)
423 423
 		{
424 424
 			// If $object is id instead of object
425
-			if (! is_object($object))
425
+			if (!is_object($object))
426 426
 			{
427 427
 				$id = $object;
428 428
 				$object = new Task($this->db);
429
-				$result=$object->fetch($id);
429
+				$result = $object->fetch($id);
430 430
 				if ($result < 0)
431 431
 				{
432
-					dol_print_error($this->db,$object->error);
432
+					dol_print_error($this->db, $object->error);
433 433
 					return -1;
434 434
 				}
435 435
 			}
436
-			$project= new Project($this->db);
436
+			$project = new Project($this->db);
437 437
 			$project->fetch($object->fk_project);
438 438
 			$project->fetch_thirdparty();
439 439
 
440
-			$dir = $conf->projet->dir_output. "/" . $project->ref. "/";
440
+			$dir = $conf->projet->dir_output."/".$project->ref."/";
441 441
 			$objectref = dol_sanitizeFileName($object->ref);
442
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
443
-			$file = $dir . "/" . $objectref . ".odt";
442
+			if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
443
+			$file = $dir."/".$objectref.".odt";
444 444
 
445
-			if (! file_exists($dir))
445
+			if (!file_exists($dir))
446 446
 			{
447 447
 				print '$dir'.$dir;
448 448
 				if (dol_mkdir($dir) < 0)
449 449
 				{
450
-					$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
450
+					$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
451 451
 					return -1;
452 452
 				}
453 453
 			}
@@ -456,13 +456,13 @@  discard block
 block discarded – undo
456 456
 			if (file_exists($dir))
457 457
 			{
458 458
 				//print "srctemplatepath=".$srctemplatepath;	// Src filename
459
-				$newfile=basename($srctemplatepath);
460
-				$newfiletmp=preg_replace('/\.(ods|odt)/i','',$newfile);
461
-				$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
462
-				$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
463
-				$newfiletmp=$objectref.'_'.$newfiletmp;
459
+				$newfile = basename($srctemplatepath);
460
+				$newfiletmp = preg_replace('/\.(ods|odt)/i', '', $newfile);
461
+				$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
462
+				$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
463
+				$newfiletmp = $objectref.'_'.$newfiletmp;
464 464
 				//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
465
-				$file=$dir.'/'.$newfiletmp.'.odt';
465
+				$file = $dir.'/'.$newfiletmp.'.odt';
466 466
 				//print "newdir=".$dir;
467 467
 				//print "newfile=".$newfile;
468 468
 				//print "file=".$file;
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 
471 471
 				dol_mkdir($conf->projet->dir_temp);
472 472
 
473
-				$socobject=$project->thirdparty;
473
+				$socobject = $project->thirdparty;
474 474
 
475 475
 				// Make substitution
476
-				$substitutionarray=array(
476
+				$substitutionarray = array(
477 477
 				'__FROM_NAME__' => $this->emetteur->name,
478 478
 				'__FROM_EMAIL__' => $this->emetteur->email,
479 479
 				);
480 480
 				complete_substitutions_array($substitutionarray, $langs, $object);
481 481
 				// Call the ODTSubstitution hook
482
-				$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
483
-				$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
482
+				$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
483
+				$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
484 484
 
485 485
 				// Open and load template
486 486
 				require_once ODTPHP_PATH.'odf.php';
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 						$srctemplatepath,
490 490
 						array(
491 491
 						'PATH_TO_TMP'	  => $conf->projet->dir_temp,
492
-						'ZIP_PROXY'		  => 'PclZipProxy',	// PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
492
+						'ZIP_PROXY'		  => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
493 493
 						'DELIMITER_LEFT'  => '{',
494 494
 						'DELIMITER_RIGHT' => '}'
495 495
 						)
496 496
 					);
497 497
 				}
498
-				catch(Exception $e)
498
+				catch (Exception $e)
499 499
 				{
500
-					$this->error=$e->getMessage();
500
+					$this->error = $e->getMessage();
501 501
 					return -1;
502 502
 				}
503 503
 				// After construction $odfHandler->contentXml contains content and
@@ -510,18 +510,18 @@  discard block
 block discarded – undo
510 510
 
511 511
 
512 512
 				// Make substitutions into odt of user info
513
-				$array_user=$this->get_substitutionarray_user($user,$outputlangs);
514
-				$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
515
-				$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
516
-				$array_objet=$this->get_substitutionarray_object($project,$outputlangs);
517
-				$array_other=$this->get_substitutionarray_other($outputlangs);
513
+				$array_user = $this->get_substitutionarray_user($user, $outputlangs);
514
+				$array_soc = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
515
+				$array_thirdparty = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
516
+				$array_objet = $this->get_substitutionarray_object($project, $outputlangs);
517
+				$array_other = $this->get_substitutionarray_other($outputlangs);
518 518
 
519
-				$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
519
+				$tmparray = array_merge($array_user, $array_soc, $array_thirdparty, $array_objet, $array_other);
520 520
 				complete_substitutions_array($tmparray, $outputlangs, $object);
521
-				foreach($tmparray as $key=>$value)
521
+				foreach ($tmparray as $key=>$value)
522 522
 				{
523 523
 					try {
524
-						if (preg_match('/logo$/',$key)) // Image
524
+						if (preg_match('/logo$/', $key)) // Image
525 525
 						{
526 526
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
527 527
 							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
532 532
 						}
533 533
 					}
534
-					catch(OdfException $e)
534
+					catch (OdfException $e)
535 535
 					{
536 536
 					}
537 537
 				}
@@ -540,33 +540,33 @@  discard block
 block discarded – undo
540 540
 				try
541 541
 				{
542 542
 					// Security check
543
-					$socid=0;
543
+					$socid = 0;
544 544
 					if (!empty($project->fk_soc)) $socid = $project->fk_soc;
545 545
 
546
-					$tmparray=$this->get_substitutionarray_tasks($object,$outputlangs);
546
+					$tmparray = $this->get_substitutionarray_tasks($object, $outputlangs);
547 547
 					complete_substitutions_array($tmparray, $outputlangs, $object);
548
-					foreach($tmparray as $key => $val)
548
+					foreach ($tmparray as $key => $val)
549 549
 					{
550 550
 						try
551 551
 						{
552 552
 							$odfHandler->setVars($key, $val, true, 'UTF-8');
553 553
 						}
554
-						catch(OdfException $e)
554
+						catch (OdfException $e)
555 555
 						{
556 556
 						}
557
-						catch(SegmentException $e)
557
+						catch (SegmentException $e)
558 558
 						{
559 559
 						}
560 560
 					}
561 561
 
562 562
 					// Replace tags of lines for contacts task
563
-					$sourcearray=array('internal','external');
564
-					$contact_arrray=array();
563
+					$sourcearray = array('internal', 'external');
564
+					$contact_arrray = array();
565 565
 					foreach ($sourcearray as $source) {
566
-						$contact_temp=$object->liste_contact(-1,$source);
566
+						$contact_temp = $object->liste_contact(-1, $source);
567 567
 						if ((is_array($contact_temp) && count($contact_temp) > 0))
568 568
 						{
569
-							$contact_arrray=array_merge($contact_arrray,$contact_temp);
569
+							$contact_arrray = array_merge($contact_arrray, $contact_temp);
570 570
 						}
571 571
 					}
572 572
 					if ((is_array($contact_arrray) && count($contact_arrray) > 0))
@@ -575,32 +575,32 @@  discard block
 block discarded – undo
575 575
 
576 576
 						foreach ($contact_arrray as $contact)
577 577
 						{
578
-							if ($contact['source']=='internal') {
579
-								$objectdetail=new User($this->db);
578
+							if ($contact['source'] == 'internal') {
579
+								$objectdetail = new User($this->db);
580 580
 								$objectdetail->fetch($contact['id']);
581
-								$contact['socname']=$mysoc->name;
582
-							} elseif ($contact['source']=='external') {
583
-								$objectdetail=new Contact($this->db);
581
+								$contact['socname'] = $mysoc->name;
582
+							} elseif ($contact['source'] == 'external') {
583
+								$objectdetail = new Contact($this->db);
584 584
 								$objectdetail->fetch($contact['id']);
585 585
 
586
-								$soc=new Societe($this->db);
586
+								$soc = new Societe($this->db);
587 587
 								$soc->fetch($contact['socid']);
588
-								$contact['socname']=$soc->name;
588
+								$contact['socname'] = $soc->name;
589 589
 							}
590
-							$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
590
+							$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
591 591
 
592
-							$tmparray=$this->get_substitutionarray_tasksressource($contact,$outputlangs);
592
+							$tmparray = $this->get_substitutionarray_tasksressource($contact, $outputlangs);
593 593
 
594
-							foreach($tmparray as $key => $val)
594
+							foreach ($tmparray as $key => $val)
595 595
 							{
596 596
 								try
597 597
 								{
598 598
 									$listlinestaskres->setVars($key, $val, true, 'UTF-8');
599 599
 								}
600
-								catch(OdfException $e)
600
+								catch (OdfException $e)
601 601
 								{
602 602
 								}
603
-								catch(SegmentException $e)
603
+								catch (SegmentException $e)
604 604
 								{
605 605
 								}
606 606
 							}
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 
612 612
 					// Time ressources
613 613
 					$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
614
-					$sql.= ", u.lastname, u.firstname";
614
+					$sql .= ", u.lastname, u.firstname";
615 615
 					$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
616 616
 					$sql .= " , ".MAIN_DB_PREFIX."user as u";
617 617
 					$sql .= " WHERE t.fk_task =".$object->id;
@@ -629,26 +629,26 @@  discard block
 block discarded – undo
629 629
 						{
630 630
 							$row = $this->db->fetch_array($resql);
631 631
 							if (!empty($row['fk_user'])) {
632
-								$objectdetail=new User($this->db);
632
+								$objectdetail = new User($this->db);
633 633
 								$objectdetail->fetch($row['fk_user']);
634 634
 								// TODO Use a cache to aoid fetch for same user
635
-								$row['fullcivname']=$objectdetail->getFullName($outputlangs,1);
635
+								$row['fullcivname'] = $objectdetail->getFullName($outputlangs, 1);
636 636
 							} else {
637
-								$row['fullcivname']='';
637
+								$row['fullcivname'] = '';
638 638
 							}
639 639
 
640
-							$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);
640
+							$tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs);
641 641
 
642
-							foreach($tmparray as $key => $val)
642
+							foreach ($tmparray as $key => $val)
643 643
 							{
644 644
 								try
645 645
 								{
646 646
 									$listlinestasktime->setVars($key, $val, true, 'UTF-8');
647 647
 								}
648
-								catch(OdfException $e)
648
+								catch (OdfException $e)
649 649
 								{
650 650
 								}
651
-								catch(SegmentException $e)
651
+								catch (SegmentException $e)
652 652
 								{
653 653
 								}
654 654
 							}
@@ -665,23 +665,23 @@  discard block
 block discarded – undo
665 665
 					$listtasksfiles = $odfHandler->setSegment('tasksfiles');
666 666
 
667 667
 					$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref);
668
-					$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1);
668
+					$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
669 669
 
670 670
 
671 671
 					foreach ($filearray as $filedetail)
672 672
 					{
673
-						$tmparray=$this->get_substitutionarray_task_file($filedetail,$outputlangs);
673
+						$tmparray = $this->get_substitutionarray_task_file($filedetail, $outputlangs);
674 674
 						//dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true));
675
-						foreach($tmparray as $key => $val)
675
+						foreach ($tmparray as $key => $val)
676 676
 						{
677 677
 							try
678 678
 							{
679 679
 								$listtasksfiles->setVars($key, $val, true, 'UTF-8');
680 680
 							}
681
-							catch(OdfException $e)
681
+							catch (OdfException $e)
682 682
 							{
683 683
 							}
684
-							catch(SegmentException $e)
684
+							catch (SegmentException $e)
685 685
 							{
686 686
 							}
687 687
 						}
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 					$odfHandler->mergeSegment($listtasksfiles);
693 693
 
694 694
 				}
695
-				catch(OdfException $e)
695
+				catch (OdfException $e)
696 696
 				{
697
-					$this->error=$e->getMessage();
697
+					$this->error = $e->getMessage();
698 698
 					dol_syslog($this->error, LOG_WARNING);
699 699
 					return -1;
700 700
 				}
@@ -707,24 +707,24 @@  discard block
 block discarded – undo
707 707
 					$listlines = $odfHandler->setSegment('projectfiles');
708 708
 
709 709
 					$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
710
-					$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1);
710
+					$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', 'name', SORT_ASC, 1);
711 711
 
712 712
 
713 713
 					foreach ($filearray as $filedetail)
714 714
 					{
715 715
 						//dol_syslog(get_class($this).'::main $filedetail'.var_export($filedetail,true));
716
-						$tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs);
716
+						$tmparray = $this->get_substitutionarray_project_file($filedetail, $outputlangs);
717 717
 
718
-						foreach($tmparray as $key => $val)
718
+						foreach ($tmparray as $key => $val)
719 719
 						{
720 720
 							try
721 721
 							{
722 722
 								$listlines->setVars($key, $val, true, 'UTF-8');
723 723
 							}
724
-							catch(OdfException $e)
724
+							catch (OdfException $e)
725 725
 							{
726 726
 							}
727
-							catch(SegmentException $e)
727
+							catch (SegmentException $e)
728 728
 							{
729 729
 							}
730 730
 						}
@@ -732,21 +732,21 @@  discard block
 block discarded – undo
732 732
 					}
733 733
 					$odfHandler->mergeSegment($listlines);
734 734
 				}
735
-				catch(OdfException $e)
735
+				catch (OdfException $e)
736 736
 				{
737
-					$this->error=$e->getMessage();
737
+					$this->error = $e->getMessage();
738 738
 					dol_syslog($this->error, LOG_WARNING);
739 739
 					return -1;
740 740
 				}
741 741
 
742 742
 				// Replace tags of lines for contacts
743
-				$sourcearray=array('internal','external');
744
-				$contact_arrray=array();
743
+				$sourcearray = array('internal', 'external');
744
+				$contact_arrray = array();
745 745
 				foreach ($sourcearray as $source) {
746
-					$contact_temp=$project->liste_contact(-1,$source);
746
+					$contact_temp = $project->liste_contact(-1, $source);
747 747
 					if ((is_array($contact_temp) && count($contact_temp) > 0))
748 748
 					{
749
-						$contact_arrray=array_merge($contact_arrray,$contact_temp);
749
+						$contact_arrray = array_merge($contact_arrray, $contact_temp);
750 750
 					}
751 751
 				}
752 752
 				if ((is_array($contact_arrray) && count($contact_arrray) > 0))
@@ -757,32 +757,32 @@  discard block
 block discarded – undo
757 757
 
758 758
 						foreach ($contact_arrray as $contact)
759 759
 						{
760
-							if ($contact['source']=='internal') {
761
-								$objectdetail=new User($this->db);
760
+							if ($contact['source'] == 'internal') {
761
+								$objectdetail = new User($this->db);
762 762
 								$objectdetail->fetch($contact['id']);
763
-								$contact['socname']=$mysoc->name;
764
-							} elseif ($contact['source']=='external') {
765
-								$objectdetail=new Contact($this->db);
763
+								$contact['socname'] = $mysoc->name;
764
+							} elseif ($contact['source'] == 'external') {
765
+								$objectdetail = new Contact($this->db);
766 766
 								$objectdetail->fetch($contact['id']);
767 767
 
768
-								$soc=new Societe($this->db);
768
+								$soc = new Societe($this->db);
769 769
 								$soc->fetch($contact['socid']);
770
-								$contact['socname']=$soc->name;
770
+								$contact['socname'] = $soc->name;
771 771
 							}
772
-							$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
772
+							$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);
773 773
 
774
-							$tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs);
774
+							$tmparray = $this->get_substitutionarray_project_contacts($contact, $outputlangs);
775 775
 
776
-							foreach($tmparray as $key => $val)
776
+							foreach ($tmparray as $key => $val)
777 777
 							{
778 778
 								try
779 779
 								{
780 780
 									$listlines->setVars($key, $val, true, 'UTF-8');
781 781
 								}
782
-								catch(OdfException $e)
782
+								catch (OdfException $e)
783 783
 								{
784 784
 								}
785
-								catch(SegmentException $e)
785
+								catch (SegmentException $e)
786 786
 								{
787 787
 								}
788 788
 							}
@@ -790,9 +790,9 @@  discard block
 block discarded – undo
790 790
 						}
791 791
 						$odfHandler->mergeSegment($listlines);
792 792
 					}
793
-					catch(OdfException $e)
793
+					catch (OdfException $e)
794 794
 					{
795
-						$this->error=$e->getMessage();
795
+						$this->error = $e->getMessage();
796 796
 						dol_syslog($this->error, LOG_WARNING);
797 797
 						return -1;
798 798
 					}
@@ -800,42 +800,42 @@  discard block
 block discarded – undo
800 800
 
801 801
 
802 802
 				// Call the beforeODTSave hook
803
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
804
-				$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
803
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
804
+				$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
805 805
 
806 806
 
807 807
 				// Write new file
808 808
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
809 809
 					try {
810 810
 						$odfHandler->exportAsAttachedPDF($file);
811
-					}catch (Exception $e){
812
-						$this->error=$e->getMessage();
811
+					} catch (Exception $e) {
812
+						$this->error = $e->getMessage();
813 813
 						return -1;
814 814
 					}
815 815
 				}
816 816
 				else {
817 817
 					try {
818 818
 						$odfHandler->saveToDisk($file);
819
-					}catch (Exception $e){
820
-						$this->error=$e->getMessage();
819
+					} catch (Exception $e) {
820
+						$this->error = $e->getMessage();
821 821
 						return -1;
822 822
 					}
823 823
 				}
824
-				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
825
-				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
824
+				$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
825
+				$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
826 826
 
827
-				if (! empty($conf->global->MAIN_UMASK))
827
+				if (!empty($conf->global->MAIN_UMASK))
828 828
 					@chmod($file, octdec($conf->global->MAIN_UMASK));
829 829
 
830
-				$odfHandler=null;	// Destroy object
830
+				$odfHandler = null; // Destroy object
831 831
 
832 832
 				$this->result = array('fullpath'=>$file);
833 833
 				
834
-				return 1;   // Success
834
+				return 1; // Success
835 835
 			}
836 836
 			else
837 837
 			{
838
-				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
838
+				$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
839 839
 				return -1;
840 840
 			}
841 841
 		}
Please login to merge, or discard this patch.
Braces   +79 added lines, -63 removed lines patch added patch discarded remove patch
@@ -37,16 +37,36 @@  discard block
 block discarded – undo
37 37
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38 38
 require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
39 39
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40
-if (! empty($conf->propal->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
41
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
42
-if (! empty($conf->facture->enabled))     require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
43
-if (! empty($conf->commande->enabled))    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
44
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
45
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
46
-if (! empty($conf->contrat->enabled))     require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
47
-if (! empty($conf->ficheinter->enabled))  require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
48
-if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
49
-if (! empty($conf->agenda->enabled))      require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
40
+if (! empty($conf->propal->enabled)) {
41
+	require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
42
+}
43
+if (! empty($conf->facture->enabled)) {
44
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
45
+}
46
+if (! empty($conf->facture->enabled)) {
47
+	require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
48
+}
49
+if (! empty($conf->commande->enabled)) {
50
+	require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
51
+}
52
+if (! empty($conf->fournisseur->enabled)) {
53
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
54
+}
55
+if (! empty($conf->fournisseur->enabled)) {
56
+	require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
57
+}
58
+if (! empty($conf->contrat->enabled)) {
59
+	require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
60
+}
61
+if (! empty($conf->ficheinter->enabled)) {
62
+	require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
63
+}
64
+if (! empty($conf->deplacement->enabled)) {
65
+	require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
66
+}
67
+if (! empty($conf->agenda->enabled)) {
68
+	require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
69
+}
50 70
 
51 71
 
52 72
 /**
@@ -100,7 +120,10 @@  discard block
 block discarded – undo
100 120
 
101 121
 		// Recupere emetteur
102 122
 		$this->emetteur=$mysoc;
103
-		if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2);    // Par defaut, si n'etait pas defini
123
+		if (! $this->emetteur->pays_code) {
124
+			$this->emetteur->pays_code=substr($langs->defaultlang,-2);
125
+		}
126
+		// Par defaut, si n'etait pas defini
104 127
 	}
105 128
 
106 129
 
@@ -337,11 +360,14 @@  discard block
 block discarded – undo
337 360
 			if (! $tmpdir) {
338 361
 				unset($listofdir[$key]); continue;
339 362
 			}
340
-			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
341
-			else
363
+			if (! is_dir($tmpdir)) {
364
+				$texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
365
+			} else
342 366
 			{
343 367
 				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
344
-				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
368
+				if (count($tmpfiles)) {
369
+					$listoffiles=array_merge($listoffiles,$tmpfiles);
370
+				}
345 371
 			}
346 372
 		}
347 373
 		$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
@@ -410,7 +436,9 @@  discard block
 block discarded – undo
410 436
 			return -1;
411 437
 		}
412 438
 
413
-		if (! is_object($outputlangs)) $outputlangs=$langs;
439
+		if (! is_object($outputlangs)) {
440
+			$outputlangs=$langs;
441
+		}
414 442
 		$sav_charset_output=$outputlangs->charset_output;
415 443
 		$outputlangs->charset_output='UTF-8';
416 444
 
@@ -439,7 +467,9 @@  discard block
 block discarded – undo
439 467
 
440 468
 			$dir = $conf->projet->dir_output. "/" . $project->ref. "/";
441 469
 			$objectref = dol_sanitizeFileName($object->ref);
442
-			if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
470
+			if (! preg_match('/specimen/i',$objectref)) {
471
+				$dir.= "/" . $objectref;
472
+			}
443 473
 			$file = $dir . "/" . $objectref . ".odt";
444 474
 
445 475
 			if (! file_exists($dir))
@@ -494,8 +524,7 @@  discard block
 block discarded – undo
494 524
 						'DELIMITER_RIGHT' => '}'
495 525
 						)
496 526
 					);
497
-				}
498
-				catch(Exception $e)
527
+				} catch(Exception $e)
499 528
 				{
500 529
 					$this->error=$e->getMessage();
501 530
 					return -1;
@@ -521,17 +550,18 @@  discard block
 block discarded – undo
521 550
 				foreach($tmparray as $key=>$value)
522 551
 				{
523 552
 					try {
524
-						if (preg_match('/logo$/',$key)) // Image
553
+						if (preg_match('/logo$/',$key)) {
554
+							// Image
525 555
 						{
526 556
 							if (file_exists($value)) $odfHandler->setImage($key, $value);
527
-							else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
528
-						}
529
-						else    // Text
557
+						} else {
558
+								$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
559
+							}
560
+						} else    // Text
530 561
 						{
531 562
 							$odfHandler->setVars($key, $value, true, 'UTF-8');
532 563
 						}
533
-					}
534
-					catch(OdfException $e)
564
+					} catch(OdfException $e)
535 565
 					{
536 566
 					}
537 567
 				}
@@ -541,7 +571,9 @@  discard block
 block discarded – undo
541 571
 				{
542 572
 					// Security check
543 573
 					$socid=0;
544
-					if (!empty($project->fk_soc)) $socid = $project->fk_soc;
574
+					if (!empty($project->fk_soc)) {
575
+						$socid = $project->fk_soc;
576
+					}
545 577
 
546 578
 					$tmparray=$this->get_substitutionarray_tasks($object,$outputlangs);
547 579
 					complete_substitutions_array($tmparray, $outputlangs, $object);
@@ -550,11 +582,9 @@  discard block
 block discarded – undo
550 582
 						try
551 583
 						{
552 584
 							$odfHandler->setVars($key, $val, true, 'UTF-8');
553
-						}
554
-						catch(OdfException $e)
585
+						} catch(OdfException $e)
555 586
 						{
556
-						}
557
-						catch(SegmentException $e)
587
+						} catch(SegmentException $e)
558 588
 						{
559 589
 						}
560 590
 					}
@@ -596,11 +626,9 @@  discard block
 block discarded – undo
596 626
 								try
597 627
 								{
598 628
 									$listlinestaskres->setVars($key, $val, true, 'UTF-8');
599
-								}
600
-								catch(OdfException $e)
629
+								} catch(OdfException $e)
601 630
 								{
602
-								}
603
-								catch(SegmentException $e)
631
+								} catch(SegmentException $e)
604 632
 								{
605 633
 								}
606 634
 							}
@@ -644,11 +672,9 @@  discard block
 block discarded – undo
644 672
 								try
645 673
 								{
646 674
 									$listlinestasktime->setVars($key, $val, true, 'UTF-8');
647
-								}
648
-								catch(OdfException $e)
675
+								} catch(OdfException $e)
649 676
 								{
650
-								}
651
-								catch(SegmentException $e)
677
+								} catch(SegmentException $e)
652 678
 								{
653 679
 								}
654 680
 							}
@@ -677,11 +703,9 @@  discard block
 block discarded – undo
677 703
 							try
678 704
 							{
679 705
 								$listtasksfiles->setVars($key, $val, true, 'UTF-8');
680
-							}
681
-							catch(OdfException $e)
706
+							} catch(OdfException $e)
682 707
 							{
683
-							}
684
-							catch(SegmentException $e)
708
+							} catch(SegmentException $e)
685 709
 							{
686 710
 							}
687 711
 						}
@@ -691,8 +715,7 @@  discard block
 block discarded – undo
691 715
 
692 716
 					$odfHandler->mergeSegment($listtasksfiles);
693 717
 
694
-				}
695
-				catch(OdfException $e)
718
+				} catch(OdfException $e)
696 719
 				{
697 720
 					$this->error=$e->getMessage();
698 721
 					dol_syslog($this->error, LOG_WARNING);
@@ -720,19 +743,16 @@  discard block
 block discarded – undo
720 743
 							try
721 744
 							{
722 745
 								$listlines->setVars($key, $val, true, 'UTF-8');
723
-							}
724
-							catch(OdfException $e)
746
+							} catch(OdfException $e)
725 747
 							{
726
-							}
727
-							catch(SegmentException $e)
748
+							} catch(SegmentException $e)
728 749
 							{
729 750
 							}
730 751
 						}
731 752
 						$listlines->merge();
732 753
 					}
733 754
 					$odfHandler->mergeSegment($listlines);
734
-				}
735
-				catch(OdfException $e)
755
+				} catch(OdfException $e)
736 756
 				{
737 757
 					$this->error=$e->getMessage();
738 758
 					dol_syslog($this->error, LOG_WARNING);
@@ -778,19 +798,16 @@  discard block
 block discarded – undo
778 798
 								try
779 799
 								{
780 800
 									$listlines->setVars($key, $val, true, 'UTF-8');
781
-								}
782
-								catch(OdfException $e)
801
+								} catch(OdfException $e)
783 802
 								{
784
-								}
785
-								catch(SegmentException $e)
803
+								} catch(SegmentException $e)
786 804
 								{
787 805
 								}
788 806
 							}
789 807
 							$listlines->merge();
790 808
 						}
791 809
 						$odfHandler->mergeSegment($listlines);
792
-					}
793
-					catch(OdfException $e)
810
+					} catch(OdfException $e)
794 811
 					{
795 812
 						$this->error=$e->getMessage();
796 813
 						dol_syslog($this->error, LOG_WARNING);
@@ -808,15 +825,14 @@  discard block
 block discarded – undo
808 825
 				if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
809 826
 					try {
810 827
 						$odfHandler->exportAsAttachedPDF($file);
811
-					}catch (Exception $e){
828
+					} catch (Exception $e){
812 829
 						$this->error=$e->getMessage();
813 830
 						return -1;
814 831
 					}
815
-				}
816
-				else {
832
+				} else {
817 833
 					try {
818 834
 						$odfHandler->saveToDisk($file);
819
-					}catch (Exception $e){
835
+					} catch (Exception $e){
820 836
 						$this->error=$e->getMessage();
821 837
 						return -1;
822 838
 					}
@@ -824,16 +840,16 @@  discard block
 block discarded – undo
824 840
 				$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
825 841
 				$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action);    // Note that $action and $object may have been modified by some hooks
826 842
 
827
-				if (! empty($conf->global->MAIN_UMASK))
828
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
843
+				if (! empty($conf->global->MAIN_UMASK)) {
844
+									@chmod($file, octdec($conf->global->MAIN_UMASK));
845
+				}
829 846
 
830 847
 				$odfHandler=null;	// Destroy object
831 848
 
832 849
 				$this->result = array('fullpath'=>$file);
833 850
 				
834 851
 				return 1;   // Success
835
-			}
836
-			else
852
+			} else
837 853
 			{
838 854
 				$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
839 855
 				return -1;
Please login to merge, or discard this patch.
htdocs/core/modules/modCategorie.class.php 3 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	function __construct($db)
41 41
 	{
42
-	    global $conf;
42
+		global $conf;
43 43
 
44 44
 		$this->db = $db;
45 45
 		$this->numero = 1780;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->export_code[$r]='category_'.$r;
137 137
 		$this->export_label[$r]='CatCusList';
138 138
 		$this->export_icon[$r]='category';
139
-        $this->export_enabled[$r]='$conf->societe->enabled';
139
+		$this->export_enabled[$r]='$conf->societe->enabled';
140 140
 		$this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
141 141
 		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus');
142 142
 		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code');
@@ -147,43 +147,43 @@  discard block
 block discarded – undo
147 147
 		$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
148 148
 		$this->export_sql_end[$r] .=' AND u.type = 2';	// Customer/Prospect categories
149 149
 
150
-        // Add extra fields
151
-        $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152
-        $resql=$this->db->query($sql);
153
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
154
-        {
155
-            while ($obj=$this->db->fetch_object($resql))
156
-            {
157
-                $fieldname='extra.'.$obj->name;
158
-                $fieldlabel=ucfirst($obj->label);
159
-                $typeFilter="Text";
160
-                switch($obj->type)
161
-                {
162
-                    case 'int':
163
-                    case 'double':
164
-                    case 'price':
165
-                        $typeFilter="Numeric";
166
-                        break;
167
-                    case 'date':
168
-                    case 'datetime':
169
-                        $typeFilter="Date";
170
-                        break;
171
-                    case 'boolean':
172
-                        $typeFilter="Boolean";
173
-                        break;
174
-                    case 'sellist':
175
-                        $typeFilter="List:".$obj->param;
176
-                        break;
177
-                    case 'select':
178
-                        $typeFilter="Select:".$obj->param;
179
-                        break;
180
-                }
181
-                $this->export_fields_array[$r][$fieldname]=$fieldlabel;
182
-                $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
183
-                $this->export_entities_array[$r][$fieldname]='company';
184
-            }
185
-        }
186
-        // End add axtra fields
150
+		// Add extra fields
151
+		$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152
+		$resql=$this->db->query($sql);
153
+		if ($resql)    // This can fail when class is used on old database (during migration for example)
154
+		{
155
+			while ($obj=$this->db->fetch_object($resql))
156
+			{
157
+				$fieldname='extra.'.$obj->name;
158
+				$fieldlabel=ucfirst($obj->label);
159
+				$typeFilter="Text";
160
+				switch($obj->type)
161
+				{
162
+					case 'int':
163
+					case 'double':
164
+					case 'price':
165
+						$typeFilter="Numeric";
166
+						break;
167
+					case 'date':
168
+					case 'datetime':
169
+						$typeFilter="Date";
170
+						break;
171
+					case 'boolean':
172
+						$typeFilter="Boolean";
173
+						break;
174
+					case 'sellist':
175
+						$typeFilter="List:".$obj->param;
176
+						break;
177
+					case 'select':
178
+						$typeFilter="Select:".$obj->param;
179
+						break;
180
+				}
181
+				$this->export_fields_array[$r][$fieldname]=$fieldlabel;
182
+				$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
183
+				$this->export_entities_array[$r][$fieldname]='company';
184
+			}
185
+		}
186
+		// End add axtra fields
187 187
 
188 188
 
189 189
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$this->export_code[$r]='category_'.$r;
194 194
 		$this->export_label[$r]='CatProdList';
195 195
 		$this->export_icon[$r]='category';
196
-        $this->export_enabled[$r]='$conf->produit->enabled';
196
+		$this->export_enabled[$r]='$conf->produit->enabled';
197 197
 		$this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
198 198
 		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
199 199
 		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text');
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$this->export_code[$r]='category_'.$r;
209 209
 		$this->export_label[$r]='CatMemberList';
210 210
 		$this->export_icon[$r]='category';
211
-        $this->export_enabled[$r]='$conf->adherent->enabled';
211
+		$this->export_enabled[$r]='$conf->adherent->enabled';
212 212
 		$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
213 213
 		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
214 214
 		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
@@ -309,49 +309,49 @@  discard block
 block discarded – undo
309 309
 			's.email'=>"company"
310 310
 		); // We define here only fields that use another picto
311 311
 		
312
-        // Add extra fields
313
-        $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314
-        $resql=$this->db->query($sql);
315
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
316
-        {
317
-        	while ($obj=$this->db->fetch_object($resql))
318
-        	{
319
-        		$fieldname='extra.'.$obj->name;
320
-        		$fieldlabel=ucfirst($obj->label);
321
-        		$typeFilter="Text";
322
-        		switch($obj->type)
323
-        		{
324
-        			case 'int':
325
-        			case 'double':
326
-        			case 'price':
327
-        				$typeFilter="Numeric";
328
-        				break;
329
-        			case 'date':
330
-        			case 'datetime':
331
-        				$typeFilter="Date";
332
-        				break;
333
-        			case 'boolean':
334
-        				$typeFilter="Boolean";
335
-        				break;
336
-        			case 'sellist':
337
-        				$typeFilter="List:".$obj->param;
338
-        				break;
312
+		// Add extra fields
313
+		$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314
+		$resql=$this->db->query($sql);
315
+		if ($resql)    // This can fail when class is used on old database (during migration for example)
316
+		{
317
+			while ($obj=$this->db->fetch_object($resql))
318
+			{
319
+				$fieldname='extra.'.$obj->name;
320
+				$fieldlabel=ucfirst($obj->label);
321
+				$typeFilter="Text";
322
+				switch($obj->type)
323
+				{
324
+					case 'int':
325
+					case 'double':
326
+					case 'price':
327
+						$typeFilter="Numeric";
328
+						break;
329
+					case 'date':
330
+					case 'datetime':
331
+						$typeFilter="Date";
332
+						break;
333
+					case 'boolean':
334
+						$typeFilter="Boolean";
335
+						break;
336
+					case 'sellist':
337
+						$typeFilter="List:".$obj->param;
338
+						break;
339 339
 					case 'select':
340 340
 						$typeFilter="Select:".$obj->param;
341 341
 						break;
342
-        		}
343
-        		$this->export_fields_array[$r][$fieldname]=$fieldlabel;
344
-        		$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
345
-        		$this->export_entities_array[$r][$fieldname]='contact';
346
-        	}
347
-        }
348
-        // End add axtra fields
342
+				}
343
+				$this->export_fields_array[$r][$fieldname]=$fieldlabel;
344
+				$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
345
+				$this->export_entities_array[$r][$fieldname]='contact';
346
+			}
347
+		}
348
+		// End add axtra fields
349 349
         
350 350
 		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
351 351
 		$this->export_sql_end[$r]  = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
352 352
 		$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
353 353
 		$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
354
-        $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
354
+		$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
355 355
 		$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
356 356
 		$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
357 357
 
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
 	}
436 436
 
437 437
 
438
-    /**
438
+	/**
439 439
 	 *		Function called when module is enabled.
440 440
 	 *		The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
441 441
 	 *		It also creates data directories
442 442
 	 *
443
-     *      @param      string	$options    Options when enabling module ('', 'noboxes')
443
+	 *      @param      string	$options    Options when enabling module ('', 'noboxes')
444 444
 	 *      @return     int             	1 if OK, 0 if KO
445
-     */
445
+	 */
446 446
 	function init($options='')
447 447
 	{
448 448
 		// Permissions
Please login to merge, or discard this patch.
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \ingroup    category
25 25
  *      \brief      Fichier de description et activation du module Categorie
26 26
  */
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 
30 30
 /**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$this->family = "technic";
48 48
 		$this->module_position = 20;
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));
50
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
51 51
 		$this->description = "Gestion des categories (produits, clients, fournisseurs...)";
52 52
 
53 53
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
 		// Config pages
67 67
 		$this->config_page_url = array('categorie.php@categories');
68
-		$this->langfiles = array("products","companies","categories","members");
68
+		$this->langfiles = array("products", "companies", "categories", "members");
69 69
 
70 70
 		// Constants
71 71
 		$this->const = array();
72
-		$r=0;
72
+		$r = 0;
73 73
 		$this->const[$r][0] = "CATEGORIE_RECURSIV_ADD";
74 74
 		$this->const[$r][1] = "yesno";
75 75
 		$this->const[$r][2] = "0";
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		$this->rights = array();
85 85
 		$this->rights_class = 'categorie';
86 86
 
87
-		$r=0;
87
+		$r = 0;
88 88
 
89 89
 		$this->rights[$r][0] = 241; // id de la permission
90 90
 		$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
@@ -110,77 +110,77 @@  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 117
 		//--------
118
-		$r=0;
118
+		$r = 0;
119 119
 
120 120
 		$r++;
121
-		$this->export_code[$r]='category_'.$r;
122
-		$this->export_label[$r]='CatSupList';
123
-		$this->export_icon[$r]='category';
124
-		$this->export_enabled[$r]='$conf->fournisseur->enabled';
125
-		$this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire"));
126
-		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_public'=>"NotePublic");
127
-		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text");
128
-		$this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company");	// We define here only fields that use another picto
129
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
130
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_fournisseur as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
131
-		$this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
132
-		$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
133
-		$this->export_sql_end[$r] .=' AND u.type = 1';	// Supplier categories
121
+		$this->export_code[$r] = 'category_'.$r;
122
+		$this->export_label[$r] = 'CatSupList';
123
+		$this->export_icon[$r] = 'category';
124
+		$this->export_enabled[$r] = '$conf->fournisseur->enabled';
125
+		$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire"));
126
+		$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_public'=>"NotePublic");
127
+		$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text");
128
+		$this->export_entities_array[$r] = array('s.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company"); // We define here only fields that use another picto
129
+		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
130
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_fournisseur as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
131
+		$this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
132
+		$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
133
+		$this->export_sql_end[$r] .= ' AND u.type = 1'; // Supplier categories
134 134
 
135 135
 		$r++;
136
-		$this->export_code[$r]='category_'.$r;
137
-		$this->export_label[$r]='CatCusList';
138
-		$this->export_icon[$r]='category';
139
-        $this->export_enabled[$r]='$conf->societe->enabled';
140
-		$this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire"));
141
-		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix",'s.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email",'s.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital",'s.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus');
142
-		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code');
143
-		$this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company');	// We define here only fields that use another picto
144
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
145
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
146
-		$this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
147
-		$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
148
-		$this->export_sql_end[$r] .=' AND u.type = 2';	// Customer/Prospect categories
136
+		$this->export_code[$r] = 'category_'.$r;
137
+		$this->export_label[$r] = 'CatCusList';
138
+		$this->export_icon[$r] = 'category';
139
+        $this->export_enabled[$r] = '$conf->societe->enabled';
140
+		$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire"));
141
+		$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_public'=>"NotePublic", 's.fk_prospectlevel'=>'ProspectLevel', 's.fk_stcomm'=>'ProspectStatus');
142
+		$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', 's.fk_stcomm'=>'List:c_stcomm:libelle:code');
143
+		$this->export_entities_array[$r] = array('s.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company', 's.fk_stcomm'=>'company'); // We define here only fields that use another picto
144
+		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
145
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
146
+		$this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
147
+		$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
148
+		$this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories
149 149
 
150 150
         // Add extra fields
151
-        $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152
-        $resql=$this->db->query($sql);
151
+        $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152
+        $resql = $this->db->query($sql);
153 153
         if ($resql)    // This can fail when class is used on old database (during migration for example)
154 154
         {
155
-            while ($obj=$this->db->fetch_object($resql))
155
+            while ($obj = $this->db->fetch_object($resql))
156 156
             {
157
-                $fieldname='extra.'.$obj->name;
158
-                $fieldlabel=ucfirst($obj->label);
159
-                $typeFilter="Text";
160
-                switch($obj->type)
157
+                $fieldname = 'extra.'.$obj->name;
158
+                $fieldlabel = ucfirst($obj->label);
159
+                $typeFilter = "Text";
160
+                switch ($obj->type)
161 161
                 {
162 162
                     case 'int':
163 163
                     case 'double':
164 164
                     case 'price':
165
-                        $typeFilter="Numeric";
165
+                        $typeFilter = "Numeric";
166 166
                         break;
167 167
                     case 'date':
168 168
                     case 'datetime':
169
-                        $typeFilter="Date";
169
+                        $typeFilter = "Date";
170 170
                         break;
171 171
                     case 'boolean':
172
-                        $typeFilter="Boolean";
172
+                        $typeFilter = "Boolean";
173 173
                         break;
174 174
                     case 'sellist':
175
-                        $typeFilter="List:".$obj->param;
175
+                        $typeFilter = "List:".$obj->param;
176 176
                         break;
177 177
                     case 'select':
178
-                        $typeFilter="Select:".$obj->param;
178
+                        $typeFilter = "Select:".$obj->param;
179 179
                         break;
180 180
                 }
181
-                $this->export_fields_array[$r][$fieldname]=$fieldlabel;
182
-                $this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
183
-                $this->export_entities_array[$r][$fieldname]='company';
181
+                $this->export_fields_array[$r][$fieldname] = $fieldlabel;
182
+                $this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
183
+                $this->export_entities_array[$r][$fieldname] = 'company';
184 184
             }
185 185
         }
186 186
         // End add axtra fields
@@ -190,42 +190,42 @@  discard block
 block discarded – undo
190 190
 
191 191
 
192 192
 		$r++;
193
-		$this->export_code[$r]='category_'.$r;
194
-		$this->export_label[$r]='CatProdList';
195
-		$this->export_icon[$r]='category';
196
-        $this->export_enabled[$r]='$conf->produit->enabled';
197
-		$this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire"));
198
-		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref');
199
-		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text');
200
-		$this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product');	// We define here only fields that use another picto
201
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
202
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
203
-		$this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
204
-		$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
205
-		$this->export_sql_end[$r] .=' AND u.type = 0';	// Supplier categories
193
+		$this->export_code[$r] = 'category_'.$r;
194
+		$this->export_label[$r] = 'CatProdList';
195
+		$this->export_icon[$r] = 'category';
196
+        $this->export_enabled[$r] = '$conf->produit->enabled';
197
+		$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "lire"));
198
+		$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref');
199
+		$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.ref'=>'Text');
200
+		$this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product'); // We define here only fields that use another picto
201
+		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
202
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p';
203
+		$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid';
204
+		$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
205
+		$this->export_sql_end[$r] .= ' AND u.type = 0'; // Supplier categories
206 206
 
207 207
 		$r++;
208
-		$this->export_code[$r]='category_'.$r;
209
-		$this->export_label[$r]='CatMemberList';
210
-		$this->export_icon[$r]='category';
211
-        $this->export_enabled[$r]='$conf->adherent->enabled';
212
-		$this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire"));
213
-		$this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname');
214
-		$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text');
215
-		$this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member');	// We define here only fields that use another picto
216
-		$this->export_sql_start[$r]='SELECT DISTINCT ';
217
-		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
218
-		$this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
219
-		$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')';
220
-		$this->export_sql_end[$r] .=' AND u.type = 3';	// Member categories
208
+		$this->export_code[$r] = 'category_'.$r;
209
+		$this->export_label[$r] = 'CatMemberList';
210
+		$this->export_icon[$r] = 'category';
211
+        $this->export_enabled[$r] = '$conf->adherent->enabled';
212
+		$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "lire"));
213
+		$this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
214
+		$this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.lastname'=>'Text', 'p.firstname'=>'Text');
215
+		$this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto
216
+		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
217
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p';
218
+		$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid';
219
+		$this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')';
220
+		$this->export_sql_end[$r] .= ' AND u.type = 3'; // Member categories
221 221
 
222 222
 		$r++;
223
-		$this->export_code[$r]='category_'.$r;
224
-		$this->export_label[$r]='CatContactList';
225
-		$this->export_icon[$r]='category';
226
-		$this->export_enabled[$r]='$conf->societe->enabled';
227
-		$this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire"));
228
-		$this->export_fields_array[$r]=array (
223
+		$this->export_code[$r] = 'category_'.$r;
224
+		$this->export_label[$r] = 'CatContactList';
225
+		$this->export_icon[$r] = 'category';
226
+		$this->export_enabled[$r] = '$conf->societe->enabled';
227
+		$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire"));
228
+		$this->export_fields_array[$r] = array(
229 229
 			'u.rowid' => "CategId",
230 230
 			'u.label' => "Label",
231 231
 			'u.description' => "Description",
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 			's.url'=>"Url",
260 260
 			's.email'=>"Email"
261 261
 		);
262
-		$this->export_TypeFields_array[$r] = array (
262
+		$this->export_TypeFields_array[$r] = array(
263 263
 			'u.label' => "Text",
264 264
 			'u.description' => "Text",
265 265
 			'p.lastname' => 'Text',
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 			's.url'=>"Text",
275 275
 			's.email'=>"Text"
276 276
 		);
277
-		$this->export_entities_array[$r] = array (
277
+		$this->export_entities_array[$r] = array(
278 278
 			'u.rowid' => "category",
279 279
 			'u.label' => "category",
280 280
 			'u.description' => "category",
@@ -310,127 +310,127 @@  discard block
 block discarded – undo
310 310
 		); // We define here only fields that use another picto
311 311
 		
312 312
         // Add extra fields
313
-        $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314
-        $resql=$this->db->query($sql);
313
+        $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314
+        $resql = $this->db->query($sql);
315 315
         if ($resql)    // This can fail when class is used on old database (during migration for example)
316 316
         {
317
-        	while ($obj=$this->db->fetch_object($resql))
317
+        	while ($obj = $this->db->fetch_object($resql))
318 318
         	{
319
-        		$fieldname='extra.'.$obj->name;
320
-        		$fieldlabel=ucfirst($obj->label);
321
-        		$typeFilter="Text";
322
-        		switch($obj->type)
319
+        		$fieldname = 'extra.'.$obj->name;
320
+        		$fieldlabel = ucfirst($obj->label);
321
+        		$typeFilter = "Text";
322
+        		switch ($obj->type)
323 323
         		{
324 324
         			case 'int':
325 325
         			case 'double':
326 326
         			case 'price':
327
-        				$typeFilter="Numeric";
327
+        				$typeFilter = "Numeric";
328 328
         				break;
329 329
         			case 'date':
330 330
         			case 'datetime':
331
-        				$typeFilter="Date";
331
+        				$typeFilter = "Date";
332 332
         				break;
333 333
         			case 'boolean':
334
-        				$typeFilter="Boolean";
334
+        				$typeFilter = "Boolean";
335 335
         				break;
336 336
         			case 'sellist':
337
-        				$typeFilter="List:".$obj->param;
337
+        				$typeFilter = "List:".$obj->param;
338 338
         				break;
339 339
 					case 'select':
340
-						$typeFilter="Select:".$obj->param;
340
+						$typeFilter = "Select:".$obj->param;
341 341
 						break;
342 342
         		}
343
-        		$this->export_fields_array[$r][$fieldname]=$fieldlabel;
344
-        		$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
345
-        		$this->export_entities_array[$r][$fieldname]='contact';
343
+        		$this->export_fields_array[$r][$fieldname] = $fieldlabel;
344
+        		$this->export_TypeFields_array[$r][$fieldname] = $typeFilter;
345
+        		$this->export_entities_array[$r][$fieldname] = 'contact';
346 346
         	}
347 347
         }
348 348
         // End add axtra fields
349 349
         
350 350
 		$this->export_sql_start[$r] = 'SELECT DISTINCT ';
351
-		$this->export_sql_end[$r]  = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
352
-		$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
353
-		$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
354
-        $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
351
+		$this->export_sql_end[$r]  = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_contact as cp, '.MAIN_DB_PREFIX.'socpeople as p';
352
+		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country ON p.fk_pays = country.rowid';
353
+		$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
354
+        $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
355 355
 		$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')';
356 356
 		$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories
357 357
 
358 358
 		// Imports
359 359
 		//--------
360 360
 
361
-		$r=0;
361
+		$r = 0;
362 362
 
363 363
 		$r++;
364
-		$this->import_code[$r]=$this->rights_class.'_'.$r;
365
-		$this->import_label[$r]="CatList";	// Translation key
366
-		$this->import_icon[$r]=$this->picto;
367
-		$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
368
-		$this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie');
369
-		$this->import_fields_array[$r]=array('ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description");
370
-
371
-		$this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]');
372
-		$typeexample="";
373
-		if ($conf->product->enabled)     { $typeexample.=($typeexample?"/":"")."0=Product"; }
374
-		if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; }
375
-		if ($conf->societe->enabled)     { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; }
376
-		if ($conf->adherent->enabled)    { $typeexample.=($typeexample?"/":"")."3=Member"; }
377
-		$this->import_examplevalues_array[$r]=array('ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"Imported category");
378
-
379
-		if (! empty($conf->product->enabled))
364
+		$this->import_code[$r] = $this->rights_class.'_'.$r;
365
+		$this->import_label[$r] = "CatList"; // Translation key
366
+		$this->import_icon[$r] = $this->picto;
367
+		$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
368
+		$this->import_tables_array[$r] = array('ca'=>MAIN_DB_PREFIX.'categorie');
369
+		$this->import_fields_array[$r] = array('ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description");
370
+
371
+		$this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]');
372
+		$typeexample = "";
373
+		if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; }
374
+		if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; }
375
+		if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; }
376
+		if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; }
377
+		$this->import_examplevalues_array[$r] = array('ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"Imported category");
378
+
379
+		if (!empty($conf->product->enabled))
380 380
 		{
381 381
 			//Products
382 382
 			$r++;
383
-			$this->import_code[$r]=$this->rights_class.'_'.$r;
384
-			$this->import_label[$r]="CatProdLinks";	// Translation key
385
-			$this->import_icon[$r]=$this->picto;
386
-			$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
387
-			$this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
388
-			$this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"
383
+			$this->import_code[$r] = $this->rights_class.'_'.$r;
384
+			$this->import_label[$r] = "CatProdLinks"; // Translation key
385
+			$this->import_icon[$r] = $this->picto;
386
+			$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
387
+			$this->import_tables_array[$r] = array('cp'=>MAIN_DB_PREFIX.'categorie_product');
388
+			$this->import_fields_array[$r] = array('cp.fk_categorie'=>"Category*", 'cp.fk_product'=>"Product*"
389 389
 			);
390 390
 
391
-			$this->import_convertvalue_array[$r]=array(
392
-					'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
393
-					'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product')
391
+			$this->import_convertvalue_array[$r] = array(
392
+					'cp.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
393
+					'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product')
394 394
 			);
395
-			$this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456");
395
+			$this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"Imported category", 'cp.fk_product'=>"PREF123456");
396 396
 		}
397 397
 
398
-		if (! empty($conf->societe->enabled))
398
+		if (!empty($conf->societe->enabled))
399 399
 		{
400 400
 			//Customers
401 401
 			$r++;
402
-			$this->import_code[$r]=$this->rights_class.'_'.$r;
403
-			$this->import_label[$r]="CatCusLinks";	// Translation key
404
-			$this->import_icon[$r]=$this->picto;
405
-			$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
406
-			$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
407
-			$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"
402
+			$this->import_code[$r] = $this->rights_class.'_'.$r;
403
+			$this->import_label[$r] = "CatCusLinks"; // Translation key
404
+			$this->import_icon[$r] = $this->picto;
405
+			$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
406
+			$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
407
+			$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"ThirdParty*"
408 408
 			);
409 409
 
410
-			$this->import_convertvalue_array[$r]=array(
411
-					'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
412
-					'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
410
+			$this->import_convertvalue_array[$r] = array(
411
+					'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
412
+					'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty')
413 413
 			);
414
-			$this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
414
+			$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany");
415 415
 		}
416 416
 
417
-		if (! empty($conf->fournisseur->enabled))
417
+		if (!empty($conf->fournisseur->enabled))
418 418
 		{
419 419
 			// Suppliers
420 420
 			$r++;
421
-			$this->import_code[$r]=$this->rights_class.'_'.$r;
422
-			$this->import_label[$r]="CatSupLinks";	// Translation key
423
-			$this->import_icon[$r]=$this->picto;
424
-			$this->import_entities_array[$r]=array();		// We define here only fields that use another icon that the one defined into import_icon
425
-			$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
426
-			$this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"
421
+			$this->import_code[$r] = $this->rights_class.'_'.$r;
422
+			$this->import_label[$r] = "CatSupLinks"; // Translation key
423
+			$this->import_icon[$r] = $this->picto;
424
+			$this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
425
+			$this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
426
+			$this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"Supplier*"
427 427
 			);
428 428
 
429
-			$this->import_convertvalue_array[$r]=array(
430
-					'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
431
-					'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty')
429
+			$this->import_convertvalue_array[$r] = array(
430
+					'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'),
431
+					'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty')
432 432
 			);
433
-			$this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany");
433
+			$this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany");
434 434
 		}
435 435
 	}
436 436
 
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
      *      @param      string	$options    Options when enabling module ('', 'noboxes')
444 444
 	 *      @return     int             	1 if OK, 0 if KO
445 445
      */
446
-	function init($options='')
446
+	function init($options = '')
447 447
 	{
448 448
 		// Permissions
449 449
 		$this->remove($options);
450 450
 
451 451
 		$sql = array();
452 452
 
453
-		return $this->_init($sql,$options);
453
+		return $this->_init($sql, $options);
454 454
 	}
455 455
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,11 +150,13 @@  discard block
 block discarded – undo
150 150
         // Add extra fields
151 151
         $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
152 152
         $resql=$this->db->query($sql);
153
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
153
+        if ($resql) {
154
+        	// This can fail when class is used on old database (during migration for example)
154 155
         {
155 156
             while ($obj=$this->db->fetch_object($resql))
156 157
             {
157 158
                 $fieldname='extra.'.$obj->name;
159
+        }
158 160
                 $fieldlabel=ucfirst($obj->label);
159 161
                 $typeFilter="Text";
160 162
                 switch($obj->type)
@@ -312,11 +314,13 @@  discard block
 block discarded – undo
312 314
         // Add extra fields
313 315
         $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople'";
314 316
         $resql=$this->db->query($sql);
315
-        if ($resql)    // This can fail when class is used on old database (during migration for example)
317
+        if ($resql) {
318
+        	// This can fail when class is used on old database (during migration for example)
316 319
         {
317 320
         	while ($obj=$this->db->fetch_object($resql))
318 321
         	{
319 322
         		$fieldname='extra.'.$obj->name;
323
+        }
320 324
         		$fieldlabel=ucfirst($obj->label);
321 325
         		$typeFilter="Text";
322 326
         		switch($obj->type)
Please login to merge, or discard this patch.
htdocs/core/modules/modFTP.class.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 {
35 35
 
36 36
    /**
37
-	 *   Constructor. Define names, constants, directories, boxes, permissions
38
-	 *
39
-	 *   @param      DoliDB		$db      Database handler
37
+    *   Constructor. Define names, constants, directories, boxes, permissions
38
+    *
39
+    *   @param      DoliDB		$db      Database handler
40 40
     */
41 41
 	function __construct($db)
42 42
 	{
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 
78 78
 		// Constants
79 79
 		$this->const = array(
80
-		    1=>array('FTP_CONNECT_WITH_SSL','chaine','0','Use FTPS for FTP module', 1, 'current', 1),
81
-		    2=>array('FTP_CONNECT_WITH_SFTP','chaine','0','Use SFTP for FTP module', 1, 'current', 1)
80
+			1=>array('FTP_CONNECT_WITH_SSL','chaine','0','Use FTPS for FTP module', 1, 'current', 1),
81
+			2=>array('FTP_CONNECT_WITH_SFTP','chaine','0','Use SFTP for FTP module', 1, 'current', 1)
82 82
 		);			// List of parameters
83 83
 
84 84
 		// Boxes
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
89 89
 		// Example:
90
-        //$this->boxes[$r][1] = "myboxa.php";
91
-    	//$r++;
92
-        //$this->boxes[$r][1] = "myboxb.php";
93
-    	//$r++;
90
+		//$this->boxes[$r][1] = "myboxa.php";
91
+		//$r++;
92
+		//$this->boxes[$r][1] = "myboxb.php";
93
+		//$r++;
94 94
 
95 95
 		// Permissions
96 96
 		$this->rights_class = 'ftp';	// Permission key
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 							  'url'=>'/ftp/index.php',
121 121
 							  'langs'=>'ftp',
122 122
 							  'position'=>100,
123
-                              'enabled'=>'$conf->ftp->enabled',
124
-		                      'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
123
+							  'enabled'=>'$conf->ftp->enabled',
124
+							  'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
125 125
 							  'target'=>'',
126 126
 							  'user'=>2);			// 0=Menu for internal users, 1=external users, 2=both
127 127
 		$r++;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *      \brief      Description and activation file for module FTP
25 25
  */
26 26
 
27
-include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
27
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
28 28
 
29 29
 
30 30
 /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		// It is used to sort modules in module setup page
51 51
 		$this->family = "other";
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 (XXX is id value)
55 55
 		$this->description = "FTP Client";
56 56
 		// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
61 61
 		$this->special = 1;
62 62
 		// Name of png file (without png) used for this module
63
-		$this->picto='dir';
63
+		$this->picto = 'dir';
64 64
 
65 65
 		// Data directories to create when module is enabled
66 66
 		$this->dirs = array("/ftp/temp");
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 		$this->config_page_url = array('ftpclient.php@ftp');
73 73
 
74 74
 		// Dependencies
75
-		$this->depends = array();		// List of modules id that must be enabled if this module is enabled
76
-		$this->requiredby = array();	// List of modules id to disable if this one is disabled
75
+		$this->depends = array(); // List of modules id that must be enabled if this module is enabled
76
+		$this->requiredby = array(); // List of modules id to disable if this one is disabled
77 77
 
78 78
 		// Constants
79 79
 		$this->const = array(
80
-		    1=>array('FTP_CONNECT_WITH_SSL','chaine','0','Use FTPS for FTP module', 1, 'current', 1),
81
-		    2=>array('FTP_CONNECT_WITH_SFTP','chaine','0','Use SFTP for FTP module', 1, 'current', 1)
82
-		);			// List of parameters
80
+		    1=>array('FTP_CONNECT_WITH_SSL', 'chaine', '0', 'Use FTPS for FTP module', 1, 'current', 1),
81
+		    2=>array('FTP_CONNECT_WITH_SFTP', 'chaine', '0', 'Use SFTP for FTP module', 1, 'current', 1)
82
+		); // List of parameters
83 83
 
84 84
 		// Boxes
85
-		$this->boxes = array();			// List of boxes
86
-		$r=0;
85
+		$this->boxes = array(); // List of boxes
86
+		$r = 0;
87 87
 
88 88
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
89 89
 		// Example:
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     	//$r++;
94 94
 
95 95
 		// Permissions
96
-		$this->rights_class = 'ftp';	// Permission key
97
-		$this->rights = array();		// Permission array used by this module
96
+		$this->rights_class = 'ftp'; // Permission key
97
+		$this->rights = array(); // Permission array used by this module
98 98
 
99 99
 		$r++;
100 100
 		$this->rights[$r][0] = 2801;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		
114 114
 		// Menus
115 115
 		//-------
116
-		$this->menu[$r]=array('fk_menu'=>0,
116
+		$this->menu[$r] = array('fk_menu'=>0,
117 117
 							  'type'=>'top',
118 118
 							  'titre'=>'FTP',
119 119
 							  'mainmenu'=>'ftp',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                               'enabled'=>'$conf->ftp->enabled',
124 124
 		                      'perms'=>'$user->rights->ftp->read || $user->rights->ftp->write || $user->rights->ftp->setup',
125 125
 							  'target'=>'',
126
-							  'user'=>2);			// 0=Menu for internal users, 1=external users, 2=both
126
+							  'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
127 127
 		$r++;
128 128
 	}
129 129
 }
Please login to merge, or discard this patch.
htdocs/core/modules/supplier_payment/modules_supplier_payment.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 	/**
29 29
 	 *  Return list of active generation models
30 30
 	 *
31
-     *  @param	DoliDB	$db     			Database handler
32
-     *  @param  integer	$maxfilenamelength  Max length of value to show
33
-     *  @return	array						List of numbers
31
+	 *  @param	DoliDB	$db     			Database handler
32
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
33
+	 *  @return	array						List of numbers
34 34
 	 */
35 35
 	static function liste_modeles($db,$maxfilenamelength=0)
36 36
 	{
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 abstract class ModelePDFSuppliersPayments extends CommonDocGenerator
24 24
 {
25
-	var $error='';
25
+	var $error = '';
26 26
 
27 27
 
28 28
 	/**
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
      *  @param  integer	$maxfilenamelength  Max length of value to show
33 33
      *  @return	array						List of numbers
34 34
 	 */
35
-	static function liste_modeles($db,$maxfilenamelength=0)
35
+	static function liste_modeles($db, $maxfilenamelength = 0)
36 36
 	{
37 37
 		global $conf;
38 38
 
39
-		$type='supplier_payment';
40
-		$liste=array();
39
+		$type = 'supplier_payment';
40
+		$liste = array();
41 41
 
42 42
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
43
-		$liste=getListOfModels($db,$type,$maxfilenamelength);
43
+		$liste = getListOfModels($db, $type, $maxfilenamelength);
44 44
 
45 45
 		return $liste;
46 46
 	}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 abstract class ModeleNumRefSupplierPayments
56 56
 {
57
-	var $error='';
57
+	var $error = '';
58 58
 
59 59
 	/**
60 60
 	 *	Return if a module can be used or not
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *	@param	Object		$object		Object we need next value for
108 108
 	 *	@return	string      Valeur
109 109
 	 */
110
-	function getNextValue($objsoc,$object)
110
+	function getNextValue($objsoc, $object)
111 111
 	{
112 112
 		global $langs;
113 113
 		return $langs->trans("NotAvailable");
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,10 +92,18 @@
 block discarded – undo
92 92
 		global $langs;
93 93
 		$langs->load("admin");
94 94
 
95
-		if ($this->version == 'development') return $langs->trans("VersionDevelopment");
96
-		if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
97
-		if ($this->version == 'dolibarr') return DOL_VERSION;
98
-		if ($this->version) return $this->version;
95
+		if ($this->version == 'development') {
96
+			return $langs->trans("VersionDevelopment");
97
+		}
98
+		if ($this->version == 'experimental') {
99
+			return $langs->trans("VersionExperimental");
100
+		}
101
+		if ($this->version == 'dolibarr') {
102
+			return DOL_VERSION;
103
+		}
104
+		if ($this->version) {
105
+			return $this->version;
106
+		}
99 107
 		return $langs->trans("NotAvailable");
100 108
 	}
101 109
 }
Please login to merge, or discard this patch.