Completed
Branch develop (5bcd5d)
by
unknown
20:54
created
htdocs/core/class/commoninvoice.class.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -723,7 +723,7 @@
 block discarded – undo
723 723
 
724 724
 		// If not a draft invoice and not temporary invoice
725 725
 		if ($tmppart !== 'PROV') {
726
-			if ($this instanceOf Facture) {
726
+			if ($this instanceof Facture) {
727 727
 				/* @var Facture $this */
728 728
 				// If sent by email, we refuse
729 729
 				if ((int) $this->email_sent_counter > 0) {
Please login to merge, or discard this patch.
htdocs/core/modules/modEventOrganization.class.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -232,82 +232,82 @@  discard block
 block discarded – undo
232 232
 		/* END MODULEBUILDER TOPMENU */
233 233
 		/* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/
234 234
 		$this->menu[$r++] = array(
235
-			'fk_menu' => 'fk_mainmenu=project',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
236
-			'type' => 'left',			                // This is a Left menu entry
235
+			'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
236
+			'type' => 'left', // This is a Left menu entry
237 237
 			'titre' => 'EventOrganizationMenuLeft',
238 238
 			'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'),
239 239
 			'mainmenu' => 'project',
240 240
 			'leftmenu' => 'eventorganization',
241 241
 			'url' => '',
242
-			'langs' => 'eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
242
+			'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
243 243
 			'position' => 1000 + $r,
244
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
245
-			'perms' => '$user->hasRight("project", "read")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
244
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
245
+			'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
246 246
 			'target' => '',
247
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
247
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
248 248
 		);
249 249
 		$this->menu[$r++] = array(
250
-			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
251
-			'type' => 'left',			                // This is a Left menu entry
250
+			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
251
+			'type' => 'left', // This is a Left menu entry
252 252
 			'titre' => 'New',
253 253
 			'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0',
254
-			'langs' => 'eventorganization@eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
254
+			'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
255 255
 			'position' => 1000 + $r,
256
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
257
-			'perms' => '$user->hasRight("project", "write")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
256
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
257
+			'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
258 258
 			'target' => '',
259
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
259
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
260 260
 		);
261 261
 		$this->menu[$r++] = array(
262
-			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
263
-			'type' => 'left',			                // This is a Left menu entry
262
+			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
263
+			'type' => 'left', // This is a Left menu entry
264 264
 			'titre' => 'List',
265 265
 			'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents',
266
-			'langs' => 'eventorganization@eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
266
+			'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
267 267
 			'position' => 1000 + $r,
268
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
269
-			'perms' => '$user->hasRight("project", "write")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
268
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
269
+			'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
270 270
 			'target' => '',
271
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
271
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
272 272
 		);
273 273
 		$this->menu[$r++] = array(
274
-			'fk_menu' => 'fk_mainmenu=project',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
275
-			'type' => 'left',			                // This is a Left menu entry
274
+			'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
275
+			'type' => 'left', // This is a Left menu entry
276 276
 			'titre' => 'ConferenceOrBooth',
277 277
 			'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'),
278 278
 			'mainmenu' => 'project',
279 279
 			'leftmenu' => 'eventorganizationconforbooth',
280 280
 			'url' => '',
281
-			'langs' => 'eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
281
+			'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
282 282
 			'position' => 1000 + $r,
283
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
284
-			'perms' => '$user->hasRight("project", "read")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
283
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
284
+			'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
285 285
 			'target' => '',
286
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
286
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
287 287
 		);
288 288
 		$this->menu[$r++] = array(
289
-			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
290
-			'type' => 'left',			                // This is a Left menu entry
289
+			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
290
+			'type' => 'left', // This is a Left menu entry
291 291
 			'titre' => 'New',
292 292
 			'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create',
293
-			'langs' => 'eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
293
+			'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
294 294
 			'position' => 1000 + $r,
295
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
296
-			'perms' => '$user->hasRight("project", "write")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
295
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
296
+			'perms' => '$user->hasRight("project", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
297 297
 			'target' => '',
298
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
298
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
299 299
 		);
300 300
 		$this->menu[$r++] = array(
301
-			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
302
-			'type' => 'left',			                // This is a Left menu entry
301
+			'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
302
+			'type' => 'left', // This is a Left menu entry
303 303
 			'titre' => 'List',
304 304
 			'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project',
305
-			'langs' => 'eventorganization',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
305
+			'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
306 306
 			'position' => 1000 + $r,
307
-			'enabled' => 'isModEnabled("eventorganization")',  // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
308
-			'perms' => '$user->hasRight("project", "read")',			                // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
307
+			'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
308
+			'perms' => '$user->hasRight("project", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules
309 309
 			'target' => '',
310
-			'user' => 2,				                // 0=Menu for internal users, 1=external users, 2=both
310
+			'user' => 2, // 0=Menu for internal users, 1=external users, 2=both
311 311
 		);
312 312
 		/* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */
313 313
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		/* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */
318 318
 		$langs->load("eventorganization");
319 319
 		$this->export_code[$r] = $this->rights_class.'_'.$r;
320
-		$this->export_label[$r] = 'ListOfAttendeesOfEvent';	// Translation key (used only if key ExportDataset_xxx_z not found)
320
+		$this->export_label[$r] = 'ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
321 321
 		$this->export_icon[$r] = $this->picto;
322 322
 		// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
323 323
 		$keyforclass = 'ConferenceOrBoothAttendee';
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 		$keyforelement = 'conferenceorboothattendee';
326 326
 		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
327 327
 		$this->export_entities_array[$r]['t.fk_invoice'] = 'invoice';
328
-		unset($this->export_fields_array[$r]['t.fk_project']);	// Remove field so we can add it at end just after
329
-		unset($this->export_fields_array[$r]['t.fk_soc']);	// Remove field so we can add it at end just after
328
+		unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after
329
+		unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
330 330
 		$this->export_fields_array[$r]['t.fk_invoice'] = 'InvoiceId';
331 331
 		$this->export_fields_array[$r]['t.fk_project'] = 'ProjectId';
332 332
 		$this->export_fields_array[$r]['p.ref'] = 'ProjectRef';
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 		$this->export_TypeFields_array[$r]['t.fk_soc'] = 'Numeric';
341 341
 		//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
342 342
 		//unset($this->export_fields_array[$r]['t.fieldtoremove']);
343
-		$keyforselect = 'eventorganization_conferenceorboothattendee';		// The value in column elementtype of llx_extrafields table
343
+		$keyforselect = 'eventorganization_conferenceorboothattendee'; // The value in column elementtype of llx_extrafields table
344 344
 		$keyforaliasextra = 'extra';
345
-		$keyforelement = 'conferenceorboothattendee';						// The value of key for icon and class
345
+		$keyforelement = 'conferenceorboothattendee'; // The value of key for icon and class
346 346
 		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
347 347
 		//$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
348 348
 		//$this->export_special_array[$r] = array('t.field'=>'...');
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 		/* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */
359 359
 		$langs->load("eventorganization");
360 360
 		$this->export_code[$r] = $this->rights_class.'_'.$r;
361
-		$this->export_label[$r] = 'ListOfConfOrBoothOfEvent';	// Translation key (used only if key ExportDataset_xxx_z not found)
361
+		$this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found)
362 362
 		$this->export_icon[$r] = 'conferenceorbooth';
363 363
 		// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
364 364
 		$keyforclass = 'ConferenceOrBooth';
365 365
 		$keyforclassfile = '/eventorganization/class/conferenceorbooth.class.php';
366 366
 		$keyforelement = 'conferenceorbooth';
367 367
 		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
368
-		unset($this->export_fields_array[$r]['t.fk_action']);	// Remove field so we can add it at end just after
369
-		unset($this->export_fields_array[$r]['t.fk_project']);	// Remove field so we can add it at end just after
370
-		unset($this->export_fields_array[$r]['t.fk_soc']);	// Remove field so we can add it at end just after
368
+		unset($this->export_fields_array[$r]['t.fk_action']); // Remove field so we can add it at end just after
369
+		unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after
370
+		unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after
371 371
 		$this->export_fields_array[$r]['t.fk_action'] = 'ConferenceOrBoothFormatID';
372 372
 		$this->export_fields_array[$r]['ca.code'] = 'ConferenceOrBoothFormatCode';
373 373
 		$this->export_fields_array[$r]['ca.libelle'] = 'ConferenceOrBoothFormatLabel';
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		$this->export_TypeFields_array[$r]['s.nom'] = 'Text';
390 390
 		//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
391 391
 		//unset($this->export_fields_array[$r]['t.fieldtoremove']);
392
-		$keyforselect = 'actioncomm';		// The value in column elementtype of llx_extrafields table
392
+		$keyforselect = 'actioncomm'; // The value in column elementtype of llx_extrafields table
393 393
 		$keyforaliasextra = 'extra';
394 394
 		$keyforelement = 'conferenceorbooth';
395 395
 		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
Please login to merge, or discard this patch.
htdocs/projet/class/api_tasks.class.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		}
81 81
 
82 82
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
83
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
83
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
84 84
 		}
85 85
 
86 86
 		if ($includetimespent == 1) {
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 		}
131 131
 
132 132
 		$sql = "SELECT t.rowid";
133
-		$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task AS t";
134
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
135
-		$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "projet AS p ON p.rowid = t.fk_projet";
136
-		$sql .= ' WHERE t.entity IN (' . getEntity('project') . ')';
133
+		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task AS t";
134
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
135
+		$sql .= " INNER JOIN ".MAIN_DB_PREFIX."projet AS p ON p.rowid = t.fk_projet";
136
+		$sql .= ' WHERE t.entity IN ('.getEntity('project').')';
137 137
 		if ($socids) {
138
-			$sql .= " AND t.fk_soc IN (" . $this->db->sanitize((string) $socids) . ")";
138
+			$sql .= " AND t.fk_soc IN (".$this->db->sanitize((string) $socids).")";
139 139
 		}
140 140
 		// Search on sale representative
141 141
 		if ($search_sale && $search_sale != '-1') {
142 142
 			if ($search_sale == -2) {
143
-				$sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
143
+				$sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)";
144 144
 			} elseif ($search_sale > 0) {
145
-				$sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")";
145
+				$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
146 146
 			}
147 147
 		}
148 148
 		// Add sql filters
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			$errormessage = '';
151 151
 			$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
152 152
 			if ($errormessage) {
153
-				throw new RestException(400, 'Error when validating parameter sqlfilters -> ' . $errormessage);
153
+				throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
154 154
 			}
155 155
 		}
156 156
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 				$i++;
181 181
 			}
182 182
 		} else {
183
-			throw new RestException(503, 'Error when retrieve task list : ' . $this->db->lasterror());
183
+			throw new RestException(503, 'Error when retrieve task list : '.$this->db->lasterror());
184 184
 		}
185 185
 
186 186
 		return $obj_ret;
@@ -239,16 +239,16 @@  discard block
 block discarded – undo
239 239
 				}
240 240
 			}
241 241
 			if ($filefound && !empty($classname)) {
242
-				$result = dol_include_once($reldir . "core/modules/project/task/" . $modele . '.php');
242
+				$result = dol_include_once($reldir."core/modules/project/task/".$modele.'.php');
243 243
 				if ($result !== false && class_exists($classname)) {
244 244
 					$modTask = new $classname();
245 245
 					'@phan-var-force ModeleNumRefTask $modTask';
246 246
 					$defaultref = $modTask->getNextValue(null, $this->task);
247 247
 				} else {
248
-					dol_syslog("Failed to include module file or invalid classname: " . $reldir . "core/modules/project/task/" . $modele . '.php', LOG_ERR);
248
+					dol_syslog("Failed to include module file or invalid classname: ".$reldir."core/modules/project/task/".$modele.'.php', LOG_ERR);
249 249
 				}
250 250
 			} else {
251
-				dol_syslog("Module file not found or classname is empty: " . $modele, LOG_ERR);
251
+				dol_syslog("Module file not found or classname is empty: ".$modele, LOG_ERR);
252 252
 			}
253 253
 
254 254
 			if (is_numeric($defaultref) && $defaultref <= 0) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 			}
257 257
 
258 258
 			if (empty($defaultref)) {
259
-				$defaultref = 'TK' . dol_print_date(dol_now(), 'dayrfc');
259
+				$defaultref = 'TK'.dol_print_date(dol_now(), 'dayrfc');
260 260
 			}
261 261
 
262 262
 			$this->task->ref = $defaultref;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		}
290 290
 
291 291
 		if (!DolibarrApi::_checkAccessToResource('tasks', $this->task->id)) {
292
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
292
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
293 293
 		}
294 294
 
295 295
 		$this->task->fetchTimeSpentOnTask();
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 		}
328 328
 
329 329
 		if (!DolibarrApi::_checkAccessToResource('tasks', $this->task->id)) {
330
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
330
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
331 331
 		}
332 332
 
333 333
 		$usert = DolibarrApiAccess::$user;
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		}
501 501
 
502 502
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
503
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
503
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
504 504
 		}
505 505
 		foreach ($request_data as $field => $value) {
506 506
 			if ($field == 'id') {
@@ -549,11 +549,11 @@  discard block
 block discarded – undo
549 549
 		}
550 550
 
551 551
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
552
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
552
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
553 553
 		}
554 554
 
555 555
 		if ($this->task->delete(DolibarrApiAccess::$user) <= 0) {
556
-			throw new RestException(500, 'Error when delete task : ' . $this->task->error);
556
+			throw new RestException(500, 'Error when delete task : '.$this->task->error);
557 557
 		}
558 558
 
559 559
 		return array(
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	public function getTimeSpentByID($id, $timespent_id)
580 580
 	{
581 581
 		dol_syslog("API Rest request::getTimeSpent", LOG_DEBUG);
582
-		if (! DolibarrApiAccess::$user->hasRight('projet', 'lire')) {
582
+		if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) {
583 583
 			throw new RestException(403);
584 584
 		}
585 585
 
586 586
 		$taskresult = $this->task->fetch($id);
587
-		if (!$taskresult ) {
587
+		if (!$taskresult) {
588 588
 			throw new RestException(404, 'Task with id='.$id.' not found');
589 589
 		}
590 590
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
 		$timespent = new TimeSpent($this->db);
595 595
 		$timeresult = $timespent->fetch($timespent_id);
596
-		if (!$timeresult ) {
596
+		if (!$timeresult) {
597 597
 			throw new RestException(404, 'Timespent with id='.$timespent_id.' not found');
598 598
 		}
599 599
 		if (!DolibarrApi::_checkAccessToResource('time', $timespent->id)) {
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 		}
635 635
 
636 636
 		if (!DolibarrApi::_checkAccessToResource('project', $this->task->fk_project)) {
637
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
637
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
638 638
 		}
639 639
 
640 640
 		$uid = $user_id;
@@ -648,18 +648,18 @@  discard block
 block discarded – undo
648 648
 		$this->task->timespent_datehour = $newdate;
649 649
 		$this->task->timespent_withhour = 1;
650 650
 		$this->task->timespent_duration = $duration;
651
-		$this->task->timespent_fk_product  = $product_id;
651
+		$this->task->timespent_fk_product = $product_id;
652 652
 		$this->task->timespent_fk_user  = $uid;
653 653
 		$this->task->timespent_note     = $note;
654 654
 		if (!empty($this->task->progress))
655
-			$this->task->progress  		= $progress;
655
+			$this->task->progress = $progress;
656 656
 
657 657
 		$result = $this->task->addTimeSpent(DolibarrApiAccess::$user, 0);
658 658
 		if ($result == 0) {
659 659
 			throw new RestException(304, 'Error nothing done. May be object is already validated');
660 660
 		}
661 661
 		if ($result < 0) {
662
-			throw new RestException(500, 'Error when adding time: ' . $this->task->error);
662
+			throw new RestException(500, 'Error when adding time: '.$this->task->error);
663 663
 		}
664 664
 
665 665
 		return array(
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 		$this->timespentRecordChecks($id, $timespent_id);
699 699
 
700 700
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
701
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
701
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
702 702
 		}
703 703
 
704 704
 		$newdate = dol_stringtotime($date, 1);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		$this->task->timespent_datehour = $newdate;
707 707
 		$this->task->timespent_withhour = 1;
708 708
 		$this->task->timespent_duration = $duration;
709
-		$this->task->timespent_fk_product  = $product_id;
709
+		$this->task->timespent_fk_product = $product_id;
710 710
 		$this->task->timespent_fk_user  = $user_id ?? DolibarrApiAccess::$user->id;
711 711
 		$this->task->timespent_note     = $note;
712 712
 
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 			throw new RestException(304, 'Error nothing done.');
716 716
 		}
717 717
 		if ($result < 0) {
718
-			throw new RestException(500, 'Error when updating time spent: ' . $this->task->error);
718
+			throw new RestException(500, 'Error when updating time spent: '.$this->task->error);
719 719
 		}
720 720
 
721 721
 		return array(
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 		$this->timespentRecordChecks($id, $timespent_id);
747 747
 
748 748
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
749
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
749
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
750 750
 		}
751 751
 
752 752
 		if ($this->task->delTimeSpent(DolibarrApiAccess::$user, 0) < 0) {
753
-			throw new RestException(500, 'Error when deleting time spent: ' . $this->task->error);
753
+			throw new RestException(500, 'Error when deleting time spent: '.$this->task->error);
754 754
 		}
755 755
 
756 756
 		return array(
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 		}
1011 1011
 
1012 1012
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
1013
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
1013
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
1014 1014
 		}
1015 1015
 
1016 1016
 		$contacts = $this->task->liste_contact(-1, 'external', 0, $type);
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
 		$contacts = array_merge($contacts, $socpeoples);
1020 1020
 
1021
-		return $contacts;	// Return array
1021
+		return $contacts; // Return array
1022 1022
 	}
1023 1023
 
1024 1024
 	/**
@@ -1051,12 +1051,12 @@  discard block
 block discarded – undo
1051 1051
 		}
1052 1052
 
1053 1053
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
1054
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
1054
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
1055 1055
 		}
1056 1056
 
1057 1057
 		$result = $this->task->add_contact($fk_socpeople, $type_contact, $source, $notrigger);
1058 1058
 		if ($result <= 0) {
1059
-			throw new RestException(500, 'Error : ' . $this->task->error);
1059
+			throw new RestException(500, 'Error : '.$this->task->error);
1060 1060
 		}
1061 1061
 
1062 1062
 		$result = $this->task->fetch($id);
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 		}
1095 1095
 
1096 1096
 		if (!DolibarrApi::_checkAccessToResource('task', $this->task->id)) {
1097
-			throw new RestException(403, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
1097
+			throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
1098 1098
 		}
1099 1099
 
1100 1100
 		foreach (array('internal', 'external') as $source) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -651,8 +651,9 @@
 block discarded – undo
651 651
 		$this->task->timespent_fk_product  = $product_id;
652 652
 		$this->task->timespent_fk_user  = $uid;
653 653
 		$this->task->timespent_note     = $note;
654
-		if (!empty($this->task->progress))
655
-			$this->task->progress  		= $progress;
654
+		if (!empty($this->task->progress)) {
655
+					$this->task->progress  		= $progress;
656
+		}
656 657
 
657 658
 		$result = $this->task->addTimeSpent(DolibarrApiAccess::$user, 0);
658 659
 		if ($result == 0) {
Please login to merge, or discard this patch.
htdocs/projet/class/task.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 				$this->date_end = $this->db->jdate($obj->date_end);
590 590
 				$this->fk_user_creat		= $obj->fk_user_creat;
591 591
 				$this->fk_user_valid		= $obj->fk_user_valid;
592
-				$this->status			    = $obj->status;
592
+				$this->status = $obj->status;
593 593
 				$this->progress				= $obj->progress;
594 594
 				$this->budget_amount		= $obj->budget_amount;
595 595
 				$this->priority				= $obj->priority;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 						 * @param Task $task
726 726
 						 * @return bool
727 727
 						 */
728
-						static function ($allTasksCompleted, $task) {
728
+						static function($allTasksCompleted, $task) {
729 729
 							return $allTasksCompleted && $task->progress >= 100;
730 730
 						},
731 731
 						1
@@ -1359,14 +1359,14 @@  discard block
 block discarded – undo
1359 1359
 						$tasks[$i]->billed = $obj->billed;
1360 1360
 					}
1361 1361
 
1362
-					$tasks[$i]->progress		= $obj->progress;
1362
+					$tasks[$i]->progress = $obj->progress;
1363 1363
 					$tasks[$i]->fk_statut		= $obj->status;
1364
-					$tasks[$i]->status 		    = $obj->status;
1364
+					$tasks[$i]->status = $obj->status;
1365 1365
 					$tasks[$i]->public = $obj->public;
1366 1366
 					$tasks[$i]->date_start = $this->db->jdate($obj->date_start);
1367 1367
 					$tasks[$i]->date_end		= $this->db->jdate($obj->date_end);
1368 1368
 					$tasks[$i]->rang	   		= $obj->rang;
1369
-					$tasks[$i]->priority   		= $obj->priority;
1369
+					$tasks[$i]->priority = $obj->priority;
1370 1370
 
1371 1371
 					$tasks[$i]->socid           = $obj->thirdparty_id; // For backward compatibility
1372 1372
 					$tasks[$i]->thirdparty_id = $obj->thirdparty_id;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 			}
1711 1711
 
1712 1712
 			// Update hourly rate of this time spent entry
1713
-			$resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user));
1713
+			$resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user));
1714 1714
 			if (!empty($resql_thm_user)) {
1715 1715
 				$obj_thm_user = $this->db->fetch_object($resql_thm_user);
1716 1716
 				$timespent->thm = $obj_thm_user->thm;
@@ -1792,8 +1792,8 @@  discard block
 block discarded – undo
1792 1792
 				$newobj->fk_project			= $obj->project_id;
1793 1793
 				$newobj->project_ref		= $obj->project_ref;
1794 1794
 				$newobj->project_label = $obj->project_label;
1795
-				$newobj->project_public		= $obj->project_public;
1796
-				$newobj->public				= $obj->project_public;		// deprecated
1795
+				$newobj->project_public = $obj->project_public;
1796
+				$newobj->public				= $obj->project_public; // deprecated
1797 1797
 
1798 1798
 				$newobj->fk_task			= $obj->task_id;
1799 1799
 				$newobj->task_ref = $obj->task_ref;
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 				$newobj->timespent_line_duration = $obj->task_duration;
1808 1808
 				$newobj->timespent_line_fk_user = $obj->fk_user;
1809 1809
 				$newobj->timespent_line_fk_product = $obj->fk_product;
1810
-				$newobj->timespent_line_thm = $obj->thm;	// hourly rate
1810
+				$newobj->timespent_line_thm = $obj->thm; // hourly rate
1811 1811
 				$newobj->timespent_line_note = $obj->note;
1812 1812
 
1813 1813
 				$arrayres[] = $newobj;
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 				$newobj->timespent_withhour = $obj->task_date_withhour;
2047 2047
 				$newobj->timespent_duration = $obj->task_duration;
2048 2048
 				$newobj->timespent_fk_user = $obj->fk_user;
2049
-				$newobj->timespent_thm = $obj->thm;	// hourly rate
2049
+				$newobj->timespent_thm = $obj->thm; // hourly rate
2050 2050
 				$newobj->timespent_note = $obj->note;
2051 2051
 
2052 2052
 				$arrayres[] = $newobj;
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 		$timespent->element_date = $this->timespent_date;
2111 2111
 		$timespent->element_datehour = $this->timespent_datehour;
2112 2112
 
2113
-		$timespent->element_date_withhour = $this->timespent_withhour;		// 0 or 1
2113
+		$timespent->element_date_withhour = $this->timespent_withhour; // 0 or 1
2114 2114
 		$timespent->element_duration = $this->timespent_duration;
2115 2115
 		if ($this->timespent_fk_user > 0) {
2116 2116
 			$timespent->fk_user = $this->timespent_fk_user;
@@ -2146,14 +2146,14 @@  discard block
 block discarded – undo
2146 2146
 		if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM'))) {
2147 2147
 			if ($this->timespent_old_duration != $this->timespent_duration) {
2148 2148
 				// Recalculate amount of time spent for task and update denormalized field
2149
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task";
2150
-				$sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM " . MAIN_DB_PREFIX . "element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = " . ((int) $this->id) . ")";
2149
+				$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
2150
+				$sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM ".MAIN_DB_PREFIX."element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = ".((int) $this->id).")";
2151 2151
 				if (isset($this->progress)) {
2152
-					$sql .= ", progress = " . ((float) $this->progress); // Do not overwrite value if not provided
2152
+					$sql .= ", progress = ".((float) $this->progress); // Do not overwrite value if not provided
2153 2153
 				}
2154
-				$sql .= " WHERE rowid = " . ((int) $this->id);
2154
+				$sql .= " WHERE rowid = ".((int) $this->id);
2155 2155
 
2156
-				dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG);
2156
+				dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG);
2157 2157
 				if (!$this->db->query($sql)) {
2158 2158
 					$this->error = $this->db->lasterror();
2159 2159
 					$this->db->rollback();
@@ -2164,7 +2164,7 @@  discard block
 block discarded – undo
2164 2164
 			// Update hourly rate of this time spent entry, but only if it was not set initially
2165 2165
 			$res_update = 1;
2166 2166
 			if (empty($timespent->thm) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM')) {
2167
-				$resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user));
2167
+				$resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user));
2168 2168
 				if (!empty($resql_thm_user)) {
2169 2169
 					$obj_thm_user = $this->db->fetch_object($resql_thm_user);
2170 2170
 					$timespent->thm = $obj_thm_user->thm;
@@ -2301,8 +2301,8 @@  discard block
 block discarded – undo
2301 2301
 
2302 2302
 		$defaultref = '';
2303 2303
 		$obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
2304
-		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) {
2305
-			require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php';
2304
+		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) {
2305
+			require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php';
2306 2306
 			$modTask = new $obj();
2307 2307
 			'@phan-var-force ModeleNumRefTask $modTask';
2308 2308
 			$defaultref = $modTask->getNextValue(null, $clone_task);
@@ -2352,7 +2352,7 @@  discard block
 block discarded – undo
2352 2352
 		}
2353 2353
 		// End
2354 2354
 		if ($error) {
2355
-			$clone_task_id = 0;  // For static tool check
2355
+			$clone_task_id = 0; // For static tool check
2356 2356
 		} else {
2357 2357
 			$clone_task_id = $clone_task->id;
2358 2358
 			$clone_task_ref = $clone_task->ref;
@@ -2792,7 +2792,7 @@  discard block
 block discarded – undo
2792 2792
 		global $langs, $hookmanager, $user, $action;
2793 2793
 
2794 2794
 		$error = 0;
2795
-		$task_origin = new Task($this->db);		// The thirdparty that we will delete
2795
+		$task_origin = new Task($this->db); // The thirdparty that we will delete
2796 2796
 
2797 2797
 		dol_syslog("mergeTask merge task id=".$task_origin_id." (will be deleted) into the task id=".$this->id);
2798 2798
 
Please login to merge, or discard this patch.