Completed
Branch develop (94be5e)
by
unknown
18:56
created
htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php 1 patch
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 				break;
124 124
 			default:
125 125
 				throw new PrestaShopWebserviceException(
126
-					'This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $request['status_code']
126
+					'This call to PrestaShop Web Services returned an unexpected HTTP status of:'.$request['status_code']
127 127
 				);
128 128
 		}
129 129
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			$errors = $response->children()->children();
133 133
 			if ($errors && count($errors) > 0) {
134 134
 				foreach ($errors as $error) {
135
-					$error_message.= ' - (Code ' . $error->code . '): ' . $error->message;
135
+					$error_message .= ' - (Code '.$error->code.'): '.$error->message;
136 136
 				}
137 137
 			}
138 138
 			$error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 			CURLOPT_RETURNTRANSFER => true,
152 152
 			CURLINFO_HEADER_OUT => true,
153 153
 			CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
154
-			CURLOPT_USERPWD => $this->key . ':',
154
+			CURLOPT_USERPWD => $this->key.':',
155 155
 			CURLOPT_HTTPHEADER => array('Expect:'),
156 156
 			//CURLOPT_SSL_VERIFYPEER => false, // reminder, in dev environment sometimes self-signed certificates are used
157 157
 			//CURLOPT_CAINFO => "PATH2CAINFO", // ssl certificate chain checking
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$index = strpos($response, "\r\n\r\n");
199 199
 		if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD') {
200
-			throw new PrestaShopWebserviceException('Bad HTTP response ' . $response . curl_error($session));
200
+			throw new PrestaShopWebserviceException('Bad HTTP response '.$response.curl_error($session));
201 201
 		}
202 202
 
203 203
 		$header = substr($response, 0, $index);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 		$status_code = curl_getinfo($session, CURLINFO_HTTP_CODE);
234 234
 		if ($status_code === 0) {
235
-			throw new PrestaShopWebserviceException('CURL Error: ' . curl_error($session));
235
+			throw new PrestaShopWebserviceException('CURL Error: '.curl_error($session));
236 236
 		}
237 237
 		curl_close($session);
238 238
 		if ($this->debug) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	public function printDebug($title, $content)
257 257
 	{
258 258
 		if (php_sapi_name() == 'cli') {
259
-			echo $title . PHP_EOL . $content;
259
+			echo $title.PHP_EOL.$content;
260 260
 		} else {
261 261
 			echo '<div style="display:table;background:#CCC;font-size:8pt;padding:7px"><h6 style="font-size:9pt;margin:0">'
262 262
 				. $title
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 				libxml_disable_entity_loader(true);
296 296
 			}
297 297
 
298
-			$xml = simplexml_load_string(trim($response), 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
298
+			$xml = simplexml_load_string(trim($response), 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
299 299
 			if (libxml_get_errors()) {
300 300
 				$msg = var_export(libxml_get_errors(), true);
301 301
 				libxml_clear_errors();
302
-				throw new PrestaShopWebserviceException('HTTP XML response is not parsable: ' . $msg);
302
+				throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg);
303 303
 			}
304 304
 			return $xml;
305 305
 		} else {
@@ -324,13 +324,13 @@  discard block
 block discarded – undo
324 324
 		$xml = '';
325 325
 
326 326
 		if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml'])) {
327
-			$url = (isset($options['resource']) ? $this->url . '/api/' . $options['resource'] : $options['url']);
327
+			$url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']);
328 328
 			$xml = $options['postXml'];
329 329
 			if (isset($options['id_shop'])) {
330
-				$url .= '&id_shop=' . $options['id_shop'];
330
+				$url .= '&id_shop='.$options['id_shop'];
331 331
 			}
332 332
 			if (isset($options['id_group_shop'])) {
333
-				$url .= '&id_group_shop=' . $options['id_group_shop'];
333
+				$url .= '&id_group_shop='.$options['id_group_shop'];
334 334
 			}
335 335
 		} else {
336 336
 			throw new PrestaShopWebserviceException('Bad parameters given');
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 		if (isset($options['url'])) {
378 378
 			$url = $options['url'];
379 379
 		} elseif (isset($options['resource'])) {
380
-			$url = $this->url . '/api/' . $options['resource'];
380
+			$url = $this->url.'/api/'.$options['resource'];
381 381
 			$url_params = array();
382 382
 			if (isset($options['id'])) {
383
-				$url .= '/' . $options['id'];
383
+				$url .= '/'.$options['id'];
384 384
 			}
385 385
 
386 386
 			$params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop', 'schema', 'language', 'date', 'price');
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 				}
393 393
 			}
394 394
 			if (count($url_params) > 0) {
395
-				$url .= '?' . http_build_query($url_params);
395
+				$url .= '?'.http_build_query($url_params);
396 396
 			}
397 397
 		} else {
398 398
 			throw new PrestaShopWebserviceException('Bad parameters given');
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
 		$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
402 402
 
403
-		$this->checkStatusCode($request);// check the response validity
403
+		$this->checkStatusCode($request); // check the response validity
404 404
 
405 405
 		return $this->parseXML($request['response']);
406 406
 	}
@@ -418,10 +418,10 @@  discard block
 block discarded – undo
418 418
 		if (isset($options['url'])) {
419 419
 			$url = $options['url'];
420 420
 		} elseif (isset($options['resource'])) {
421
-			$url = $this->url . '/api/' . $options['resource'];
421
+			$url = $this->url.'/api/'.$options['resource'];
422 422
 			$url_params = array();
423 423
 			if (isset($options['id'])) {
424
-				$url .= '/' . $options['id'];
424
+				$url .= '/'.$options['id'];
425 425
 			}
426 426
 
427 427
 			$params = array('filter', 'display', 'sort', 'limit');
@@ -433,13 +433,13 @@  discard block
 block discarded – undo
433 433
 				}
434 434
 			}
435 435
 			if (count($url_params) > 0) {
436
-				$url .= '?' . http_build_query($url_params);
436
+				$url .= '?'.http_build_query($url_params);
437 437
 			}
438 438
 		} else {
439 439
 			throw new PrestaShopWebserviceException('Bad parameters given');
440 440
 		}
441 441
 		$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
442
-		$this->checkStatusCode($request);// check the response validity
442
+		$this->checkStatusCode($request); // check the response validity
443 443
 		return $request['header'];
444 444
 	}
445 445
 
@@ -462,21 +462,20 @@  discard block
 block discarded – undo
462 462
 		if (isset($options['url'])) {
463 463
 			$url = $options['url'];
464 464
 		} elseif ((isset($options['resource'], $options['id']) || isset($options['url'])) && $options['putXml']) {
465
-			$url = (isset($options['url']) ? $options['url'] :
466
-				$this->url . '/api/' . $options['resource'] . '/' . $options['id']);
465
+			$url = (isset($options['url']) ? $options['url'] : $this->url.'/api/'.$options['resource'].'/'.$options['id']);
467 466
 			$xml = $options['putXml'];
468 467
 			if (isset($options['id_shop'])) {
469
-				$url .= '&id_shop=' . $options['id_shop'];
468
+				$url .= '&id_shop='.$options['id_shop'];
470 469
 			}
471 470
 			if (isset($options['id_group_shop'])) {
472
-				$url .= '&id_group_shop=' . $options['id_group_shop'];
471
+				$url .= '&id_group_shop='.$options['id_group_shop'];
473 472
 			}
474 473
 		} else {
475 474
 			throw new PrestaShopWebserviceException('Bad parameters given');
476 475
 		}
477 476
 
478 477
 		$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
479
-		$this->checkStatusCode($request);// check the response validity
478
+		$this->checkStatusCode($request); // check the response validity
480 479
 		return $this->parseXML($request['response']);
481 480
 	}
482 481
 
@@ -513,21 +512,21 @@  discard block
 block discarded – undo
513 512
 			$url = $options['url'];
514 513
 		} elseif (isset($options['resource']) && isset($options['id'])) {
515 514
 			$url = (is_array($options['id']))
516
-				? $this->url . '/api/' . $options['resource'] . '/?id=[' . implode(',', $options['id']) . ']'
517
-				: $this->url . '/api/' . $options['resource'] . '/' . $options['id'];
515
+				? $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'
516
+				: $this->url.'/api/'.$options['resource'].'/'.$options['id'];
518 517
 		} else {
519 518
 			throw new PrestaShopWebserviceException('Bad parameters given');
520 519
 		}
521 520
 
522 521
 		if (isset($options['id_shop'])) {
523
-			$url .= '&id_shop=' . $options['id_shop'];
522
+			$url .= '&id_shop='.$options['id_shop'];
524 523
 		}
525 524
 		if (isset($options['id_group_shop'])) {
526
-			$url .= '&id_group_shop=' . $options['id_group_shop'];
525
+			$url .= '&id_group_shop='.$options['id_group_shop'];
527 526
 		}
528 527
 
529 528
 		$request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
530
-		$this->checkStatusCode($request);// check the response validity
529
+		$this->checkStatusCode($request); // check the response validity
531 530
 		return true;
532 531
 	}
533 532
 }
Please login to merge, or discard this patch.
htdocs/comm/action/class/actioncomm.class.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	/**
383 383
 	 * Properties to manage the recurring events
384 384
 	 */
385
-	public $recurid;		/* A string YYYYMMDDHHMMSS shared by allevent of same serie */
386
-	public $recurrule;		/* Rule of recurring */
387
-	public $recurdateend;	/* Repeat until this date */
385
+	public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same serie */
386
+	public $recurrule; /* Rule of recurring */
387
+	public $recurdateend; /* Repeat until this date */
388 388
 
389 389
 	public $calling_duration;
390 390
 
@@ -568,8 +568,8 @@  discard block
 block discarded – undo
568 568
 		$sql .= "ip";
569 569
 		$sql .= ") VALUES (";
570 570
 		$sql .= "'(PROV)', ";
571
-		$sql .= "'".$this->db->idate($now)."', ";	// date creation
572
-		$sql .= "'".$this->db->idate($this->datep)."', ";	// date start event
571
+		$sql .= "'".$this->db->idate($now)."', "; // date creation
572
+		$sql .= "'".$this->db->idate($this->datep)."', "; // date start event
573 573
 		$sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", ";
574 574
 		$sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated
575 575
 		$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 						$resql = $this->db->query($sql);
644 644
 						if (!$resql) {
645 645
 							$error++;
646
-							dol_syslog('Error to process userassigned: ' . $this->db->lasterror(), LOG_ERR);
646
+							dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR);
647 647
 							$this->errors[] = $this->db->lasterror();
648 648
 						} else {
649 649
 							$already_inserted[$val['id']] = true;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 						$resql = $this->db->query($sql);
669 669
 						if (!$resql) {
670 670
 							$error++;
671
-							dol_syslog('Error to process socpeopleassigned: ' . $this->db->lasterror(), LOG_ERR);
671
+							dol_syslog('Error to process socpeopleassigned: '.$this->db->lasterror(), LOG_ERR);
672 672
 							$this->errors[] = $this->db->lasterror();
673 673
 						} else {
674 674
 							$already_inserted[$id] = true;
@@ -903,14 +903,14 @@  discard block
 block discarded – undo
903 903
 				$this->status = $obj->status;
904 904
 
905 905
 				//email information
906
-				$this->email_msgid=$obj->email_msgid;
907
-				$this->email_from=$obj->email_from;
908
-				$this->email_sender=$obj->email_sender;
909
-				$this->email_to=$obj->email_to;
910
-				$this->email_tocc=$obj->email_tocc;
911
-				$this->email_tobcc=$obj->email_tobcc;
912
-				$this->email_subject=$obj->email_subject;
913
-				$this->errors_to=$obj->errors_to;
906
+				$this->email_msgid = $obj->email_msgid;
907
+				$this->email_from = $obj->email_from;
908
+				$this->email_sender = $obj->email_sender;
909
+				$this->email_to = $obj->email_to;
910
+				$this->email_tocc = $obj->email_tocc;
911
+				$this->email_tobcc = $obj->email_tobcc;
912
+				$this->email_subject = $obj->email_subject;
913
+				$this->errors_to = $obj->errors_to;
914 914
 
915 915
 				$this->fetch_optionals();
916 916
 
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 		$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm";
1194 1194
 		$sql .= " SET percent = '".$this->db->escape($this->percentage)."'";
1195 1195
 		$sql .= ", fk_action = ".(int) $this->type_id;
1196
-		$sql .= ", code = " . ($code ? "'".$this->db->escape($code)."'" : "null");
1196
+		$sql .= ", code = ".($code ? "'".$this->db->escape($code)."'" : "null");
1197 1197
 		$sql .= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "null");
1198 1198
 		$sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null');
1199 1199
 		$sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null');
@@ -1350,9 +1350,9 @@  discard block
 block discarded – undo
1350 1350
 		$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
1351 1351
 		// Fields from hook
1352 1352
 		$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
1353
-		$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters);    // Note that $action and $object may have been modified by hook
1353
+		$reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook
1354 1354
 		if (!empty($hookmanager->resPrint)) {
1355
-			$sql.= $hookmanager->resPrint;
1355
+			$sql .= $hookmanager->resPrint;
1356 1356
 		}
1357 1357
 		$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
1358 1358
 		if (!empty($socid)) {
@@ -1374,9 +1374,9 @@  discard block
 block discarded – undo
1374 1374
 		}
1375 1375
 		// Fields where hook
1376 1376
 		$parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
1377
-		$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters);    // Note that $action and $object may have been modified by hook
1377
+		$reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook
1378 1378
 		if (!empty($hookmanager->resPrint)) {
1379
-			$sql.= $hookmanager->resPrint;
1379
+			$sql .= $hookmanager->resPrint;
1380 1380
 		}
1381 1381
 		if ($sortorder && $sortfield) {
1382 1382
 			$sql .= $this->db->order($sortfield, $sortorder);
@@ -1657,9 +1657,9 @@  discard block
 block discarded – undo
1657 1657
 		}
1658 1658
 		// show categories for this record only in ajax to not overload lists
1659 1659
 		if (isModEnabled('categorie') && !$nofetch) {
1660
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
1660
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1661 1661
 			$form = new Form($this->db);
1662
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1);
1662
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1);
1663 1663
 		}
1664 1664
 
1665 1665
 		return $datas;
@@ -1752,8 +1752,8 @@  discard block
 block discarded – undo
1752 1752
 		}
1753 1753
 		if (!empty($this->note_private)) {
1754 1754
 			$tooltip .= '<br><br><b>'.$langs->trans('Description').':</b><br>';
1755
-			$texttoshow = dolGetFirstLineOfText($this->note_private, 8);	// Try to limit length of content
1756
-			$tooltip .= '<div class="tenlinesmax">';						// Restrict height of content into the tooltip
1755
+			$texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content
1756
+			$tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip
1757 1757
 			$tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
1758 1758
 			$tooltip .= '</div>';
1759 1759
 		}
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
 	 */
2402 2402
 	public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
2403 2403
 	{
2404
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
2404
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'actioncomm SET fk_element = '.((int) $dest_id).' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
2405 2405
 		// using $dbs, not $this->db because function is static
2406 2406
 		if (!$dbs->query($sql)) {
2407 2407
 			//$this->errors = $dbs->lasterror();
@@ -2526,7 +2526,7 @@  discard block
 block discarded – undo
2526 2526
 		//Select all action comm reminders
2527 2527
 		$sql = "SELECT rowid as id FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
2528 2528
 		$sql .= " WHERE typeremind = 'email'";
2529
-		$sql .= " AND status = 0";	// 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors.
2529
+		$sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors.
2530 2530
 		$sql .= " AND dateremind <= '".$this->db->idate($now)."'";
2531 2531
 		$sql .= " AND entity IN (".getEntity('actioncomm').")";
2532 2532
 		$sql .= $this->db->order("dateremind", "ASC");
Please login to merge, or discard this patch.
htdocs/comm/action/index.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	$conf->global->AGENDA_EXT_NB = 5;
50 50
 }
51 51
 $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
52
-$DELAYFORCACHE = 300;	// 300 seconds
52
+$DELAYFORCACHE = 300; // 300 seconds
53 53
 
54 54
 $disabledefaultvalues = GETPOST('disabledefaultvalues', 'int');
55 55
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 $mode = GETPOST('mode', 'aZ09');
107 107
 if (empty($mode) && preg_match('/show_/', $action)) {
108
-	$mode = $action;	// For backward compatibility
108
+	$mode = $action; // For backward compatibility
109 109
 }
110 110
 $resourceid = GETPOST("search_resourceid", "int");
111 111
 $year = GETPOST("year", "int") ? GETPOST("year", "int") : date("Y");
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 
530 530
 $viewmode .= '</div>';
531 531
 
532
-$viewmode .= '<span class="marginrightonly"></span>';	// To add a space before the navigation tools
532
+$viewmode .= '<span class="marginrightonly"></span>'; // To add a space before the navigation tools
533 533
 
534 534
 
535 535
 $newcardbutton = '';
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	$newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode);
541 541
 
542 542
 	//$param='month='.$monthshown.'&year='.$year;
543
-	$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000';	// Set $hourminsec to '100000' to auto set hour to 10:00 at creation
543
+	$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation
544 544
 
545 545
 	$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')));
546 546
 }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	$sql .= " WHERE bc.status = 1";
561 561
 	$sql .= " AND ba.status = 1";
562 562
 	if (!empty($filtert) && $filtert != -1) {
563
-		$sql .= " AND bc.visibility = ".(int) $filtert ;
563
+		$sql .= " AND bc.visibility = ".(int) $filtert;
564 564
 	}
565 565
 	$resql = $db->query($sql);
566 566
 	if ($resql) {
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
 		// Holiday calendar
614 614
 		$s .= '
615 615
             <div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"' . ($check_holiday
616
-					? ' checked' : '') . '>
616
+					? ' checked' : '').'>
617 617
                 <label for="check_holiday">
618
-                    <span class="check_holiday_text">' . $langs->trans("Holidays") . '</span>
618
+                    <span class="check_holiday_text">' . $langs->trans("Holidays").'</span>
619 619
                 </label> &nbsp;
620 620
             </div>';
621 621
 	}
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 		$s .= '</script>'."\n";
642 642
 
643 643
 		foreach ($showextcals as $val) {
644
-			$htmlname = md5($val['name']);	// not used for security purpose, only to get a string with no special char
644
+			$htmlname = md5($val['name']); // not used for security purpose, only to get a string with no special char
645 645
 
646 646
 			if (!empty($val['default']) || GETPOST('check_ext'.$htmlname, 'int')) {
647 647
 				$default = "checked";
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 		// event->datep and event->datef must be GMT date.
863 863
 		if ($event->fulldayevent) {
864 864
 			$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
865
-			$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver');	// If saved in $tzforfullday = gmt, we must invert date to be in user tz
865
+			$event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz
866 866
 			$event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver');
867 867
 		} else {
868 868
 			// Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1)
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 			// Loop on each day covered by action to prepare an index to show on calendar
941 941
 			$loop = true;
942 942
 			$j = 0;
943
-			$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');	// $mois, $jour, $annee has been set for user tz
944
-			$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt');	// $moisend, $jourend, $anneeend has been set for user tz
943
+			$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz
944
+			$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz
945 945
 			/*
946 946
 			 print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>';
947 947
 			 print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>';
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 
1062 1062
 	if ($mode == 'show_day') {
1063 1063
 		// Request only leaves for the current selected day
1064
-		$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin";	// date_debut and date_fin are date without time
1064
+		$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
1065 1065
 	} elseif ($mode == 'show_week') {
1066 1066
 		// Restrict on current month (we get more, but we will filter later)
1067 1067
 		$sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 	$theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
1454 1454
 }
1455 1455
 
1456
-$massactionbutton ='';
1456
+$massactionbutton = '';
1457 1457
 
1458 1458
 print_barre_liste($langs->trans("Agenda"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, -1, 'object_action', 0, $nav.'<span class="marginleftonly"></span>'.$newcardbutton, '', $limit, 1, 0, 1, $viewmode);
1459 1459
 
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 	for ($iter_day = 0; $iter_day < 7; $iter_day++) {
1601 1601
 		// Show days of the current week
1602
-		$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');		// $firstdaytoshow is in timezone of server
1602
+		$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server
1603 1603
 		$tmpday = dol_print_date($curtime, '%d', 'tzuserrel');
1604 1604
 		$tmpmonth = dol_print_date($curtime, '%m', 'tzuserrel');
1605 1605
 		$tmpyear = dol_print_date($curtime, '%Y', 'tzuserrel');
@@ -1821,9 +1821,9 @@  discard block
 block discarded – undo
1821 1821
 	$tmpholiday = new Holiday($db);
1822 1822
 
1823 1823
 	foreach ($eventarray as $daykey => $notused) {		// daykey is the 'YYYYMMDD' to show according to user
1824
-		$annee = dol_print_date($daykey, '%Y', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1825
-		$mois =  dol_print_date($daykey, '%m', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1826
-		$jour =  dol_print_date($daykey, '%d', 'gmt');	// We use gmt because we want the value represented by string 'YYYYMMDD'
1824
+		$annee = dol_print_date($daykey, '%Y', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1825
+		$mois = dol_print_date($daykey, '%m', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1826
+		$jour = dol_print_date($daykey, '%d', 'gmt'); // We use gmt because we want the value represented by string 'YYYYMMDD'
1827 1827
 
1828 1828
 		//print 'event daykey='.$daykey.' dol_print_date(daykey)='.dol_print_date($daykey, 'dayhour', 'gmt').' jour='.$jour.' mois='.$mois.' annee='.$annee."<br>\n";
1829 1829
 
@@ -2100,7 +2100,7 @@  discard block
 block discarded – undo
2100 2100
 						if ($event->type_code != 'ICALEVENT') {
2101 2101
 							$savlabel = $event->label ? $event->label : $event->libelle;
2102 2102
 							$event->label = $titletoshow;
2103
-							$event->libelle = $titletoshow;		// deprecatd
2103
+							$event->libelle = $titletoshow; // deprecatd
2104 2104
 							// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
2105 2105
 							$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
2106 2106
 							$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title', '', 0, 0);
Please login to merge, or discard this patch.
htdocs/fourn/class/fournisseur.facture-rec.class.php 1 patch
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		$now = dol_now();
271 271
 
272 272
 		// Clean parameters
273
-		$this->titre = empty($this->titre) ? '' : $this->titre;	// deprecated
273
+		$this->titre = empty($this->titre) ? '' : $this->titre; // deprecated
274 274
 		$this->title = empty($this->title) ? '' : $this->title;
275 275
 		$keyforref = $this->table_ref_field;
276 276
 		$this->ref = $this->$keyforref;
@@ -332,32 +332,32 @@  discard block
 block discarded – undo
332 332
 			$sql .= ", '".$this->db->idate($now)."'";
333 333
 			$sql .= ", ".((int) $this->suspended);
334 334
 			$sql .= ", '".$this->db->escape($this->libelle)."'";
335
-			$sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0');                              // amount
336
-			$sql .= ", " .((int) $user->id);
337
-			$sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
338
-			$sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
339
-			$sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
340
-			$sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
341
-			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL');      // date_lim_reglement
342
-			$sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
343
-			$sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
344
-			$sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
345
-			$sql .= ", " . (int) $facfourn_src->fk_multicurrency;
335
+			$sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount
336
+			$sql .= ", ".((int) $user->id);
337
+			$sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
338
+			$sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
339
+			$sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
340
+			$sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
341
+			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement
342
+			$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
343
+			$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
344
+			$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
345
+			$sql .= ", ".(int) $facfourn_src->fk_multicurrency;
346 346
 			$sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'";
347
-			$sql .= ", " . (float) $facfourn_src->multicurrency_tx;
348
-			$sql .= ", " . (int) $this->usenewprice;
349
-			$sql .= ", " . (int) $this->frequency;
347
+			$sql .= ", ".(float) $facfourn_src->multicurrency_tx;
348
+			$sql .= ", ".(int) $this->usenewprice;
349
+			$sql .= ", ".(int) $this->frequency;
350 350
 			$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
351
-			$sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
352
-			$sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
353
-			$sql .= ", " . (int) $this->nb_gen_done;
354
-			$sql .= ", " . (int) $this->nb_gen_max;
355
-			$sql .= ", " . (int) $this->auto_validate;
356
-			$sql .= ", " . (int) $this->generate_pdf;
351
+			$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
352
+			$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
353
+			$sql .= ", ".(int) $this->nb_gen_done;
354
+			$sql .= ", ".(int) $this->nb_gen_max;
355
+			$sql .= ", ".(int) $this->auto_validate;
356
+			$sql .= ", ".(int) $this->generate_pdf;
357 357
 			$sql .= ')';
358 358
 
359 359
 			if ($this->db->query($sql)) {
360
-				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec');
360
+				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec');
361 361
 
362 362
 				// Fields used into addline later
363 363
 				$this->fk_multicurrency = $facfourn_src->fk_multicurrency;
@@ -493,46 +493,46 @@  discard block
 block discarded – undo
493 493
 		$error = 0;
494 494
 
495 495
 		$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";
496
-		$sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;
497
-		$sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
498
-		$sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
496
+		$sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',";
497
+		$sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
498
+		$sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).',';
499 499
 		if (!empty($this->socid) && $this->socid > 0) {
500
-			$sql .= " fk_soc = ". ((int) $this->socid). ',';
500
+			$sql .= " fk_soc = ".((int) $this->socid).',';
501 501
 		} elseif (!empty($this->fk_soc) && $this->fk_soc > 0) {	// For backward compatibility
502
-			$sql .= " fk_soc = ". ((int) $this->fk_soc). ',';
502
+			$sql .= " fk_soc = ".((int) $this->fk_soc).',';
503 503
 		}
504
-		$sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';
505
-		$sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";
506
-		$sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';
507
-		$sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ',';
508
-		$sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ',';
509
-		$sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ',';
510
-		$sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ',';
511
-		$sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ',';
512
-		$sql .= " fk_user_modif = ". ((int) $user->id) . ',';
513
-		$sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ',';
514
-		$sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ',';
515
-		$sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ',';
516
-		$sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ',';
517
-		$sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ',';
518
-		$sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',";
519
-		$sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',";
520
-		$sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ",";
521
-		$sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ',';
522
-		$sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ",";
523
-		$sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ',';
524
-		$sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ',';
525
-		$sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ',';
526
-		$sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ',';
527
-		$sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ',';
528
-		$sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ',';
529
-		$sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',";
530
-		$sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ',';
531
-		$sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ',';
532
-		$sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ',';
533
-		$sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ',';
534
-		$sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
535
-		$sql .= " WHERE rowid = ". (int) $this->id;
504
+		$sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).',';
505
+		$sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').",";
506
+		$sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').',';
507
+		$sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).',';
508
+		$sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).',';
509
+		$sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).',';
510
+		$sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).',';
511
+		$sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).',';
512
+		$sql .= " fk_user_modif = ".((int) $user->id).',';
513
+		$sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').',';
514
+		$sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').',';
515
+		$sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').',';
516
+		$sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').',';
517
+		$sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').',';
518
+		$sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',";
519
+		$sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',";
520
+		$sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').",";
521
+		$sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').',';
522
+		$sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').",";
523
+		$sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).',';
524
+		$sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).',';
525
+		$sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).',';
526
+		$sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).',';
527
+		$sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).',';
528
+		$sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).',';
529
+		$sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',";
530
+		$sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').',';
531
+		$sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').',';
532
+		$sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).',';
533
+		$sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).',';
534
+		$sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
535
+		$sql .= " WHERE rowid = ".(int) $this->id;
536 536
 
537 537
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
538 538
 		$resql = $this->db->query($sql);
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
592 592
 		$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
593 593
 		if ($rowid) {
594
-			$sql .= ' AND f.rowid='. (int) $rowid;
594
+			$sql .= ' AND f.rowid='.(int) $rowid;
595 595
 		} elseif ($ref) {
596 596
 			$sql .= " AND f.titre='".$this->db->escape($ref)."'";
597 597
 		} else {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
725 725
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
726 726
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
727
-		$sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id;
727
+		$sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id;
728 728
 		$sql .= ' ORDER BY l.rang';
729 729
 
730 730
 		dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG);
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 				$line->product_type             = $objp->product_type;
765 765
 				$line->date_start               = $objp->date_start;
766 766
 				$line->date_end                 = $objp->date_end;
767
-				$line->info_bits                = $objp->info_bits	;
767
+				$line->info_bits                = $objp->info_bits;
768 768
 				$line->special_code             = $objp->special_code;
769 769
 				$line->rang                     = $objp->rang;
770 770
 				$line->fk_unit                  = $objp->fk_unit;
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
 		$main = MAIN_DB_PREFIX.'facture_fourn_det_rec';
815 815
 		$ef = $main."_extrafields";
816 816
 
817
-		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")";
818
-		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid;
817
+		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")";
818
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid;
819 819
 
820 820
 		if ($this->db->query($sqlef) && $this->db->query($sql)) {
821
-			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid;
821
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid;
822 822
 			dol_syslog($sql);
823 823
 			if ($this->db->query($sql)) {
824 824
 				// Delete linked object
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 			}
848 848
 			// End call triggers
849 849
 		}
850
-		if (! $error) {
850
+		if (!$error) {
851 851
 			$this->db->commit();
852 852
 			return 1;
853 853
 		} else {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 				}
960 960
 			}
961 961
 
962
-			$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec (';
962
+			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec (';
963 963
 			$sql .= 'fk_facture_fourn';
964 964
 			$sql .= ', fk_product';
965 965
 			$sql .= ', ref';
@@ -991,46 +991,46 @@  discard block
 block discarded – undo
991 991
 			$sql .= ', fk_user_author';
992 992
 			$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
993 993
 			$sql .= ') VALUES (';
994
-			$sql .= ' ' . (int) $facid;   // source supplier invoie id
995
-			$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
996
-			$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
997
-			$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
998
-			$sql .= ", '" . $this->db->escape($desc) . "'";
999
-			$sql .= ', ' . price2num($pu_ht);
1000
-			$sql .= ', ' . price2num($pu_ttc);
1001
-			$sql .= ', ' . price2num($qty);
1002
-			$sql .= ', ' . price2num($remise_percent);
994
+			$sql .= ' '.(int) $facid; // source supplier invoie id
995
+			$sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null');
996
+			$sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null');
997
+			$sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null');
998
+			$sql .= ", '".$this->db->escape($desc)."'";
999
+			$sql .= ', '.price2num($pu_ht);
1000
+			$sql .= ', '.price2num($pu_ttc);
1001
+			$sql .= ', '.price2num($qty);
1002
+			$sql .= ', '.price2num($remise_percent);
1003 1003
 			$sql .= ', null';
1004
-			$sql .= ", '" . $this->db->escape($vat_src_code) . "'";
1005
-			$sql .= ', ' . price2num($txtva);
1006
-			$sql .= ', ' . price2num($txlocaltax1);
1007
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'";
1008
-			$sql .= ', ' . price2num($txlocaltax2);
1009
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'";
1010
-			$sql .= ', ' . price2num($total_ht);
1011
-			$sql .= ', ' . price2num($total_tva);
1012
-			$sql .= ', ' . price2num($total_localtax1);
1013
-			$sql .= ', ' . price2num($total_localtax2);
1014
-			$sql .= ', ' . price2num($total_ttc);
1015
-			$sql .= ', ' . (int) $product_type;
1016
-			$sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL');
1017
-			$sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL');
1018
-			$sql .= ', ' . (int) $info_bits;
1019
-			$sql .= ', ' . (int) $special_code;
1020
-			$sql .= ', ' . (int) $rang;
1021
-			$sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL');
1022
-			$sql .= ', ' . (int) $user->id;
1023
-			$sql .= ', ' . (int) $this->fk_multicurrency;
1024
-			$sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
1025
-			$sql .= ', ' . price2num($pu_ht_devise, 'CU');
1026
-			$sql .= ', ' . price2num($multicurrency_total_ht, 'CT');
1027
-			$sql .= ', ' . price2num($multicurrency_total_tva, 'CT');
1028
-			$sql .= ', ' . price2num($multicurrency_total_ttc, 'CT');
1004
+			$sql .= ", '".$this->db->escape($vat_src_code)."'";
1005
+			$sql .= ', '.price2num($txtva);
1006
+			$sql .= ', '.price2num($txlocaltax1);
1007
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'";
1008
+			$sql .= ', '.price2num($txlocaltax2);
1009
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
1010
+			$sql .= ', '.price2num($total_ht);
1011
+			$sql .= ', '.price2num($total_tva);
1012
+			$sql .= ', '.price2num($total_localtax1);
1013
+			$sql .= ', '.price2num($total_localtax2);
1014
+			$sql .= ', '.price2num($total_ttc);
1015
+			$sql .= ', '.(int) $product_type;
1016
+			$sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL');
1017
+			$sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL');
1018
+			$sql .= ', '.(int) $info_bits;
1019
+			$sql .= ', '.(int) $special_code;
1020
+			$sql .= ', '.(int) $rang;
1021
+			$sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL');
1022
+			$sql .= ', '.(int) $user->id;
1023
+			$sql .= ', '.(int) $this->fk_multicurrency;
1024
+			$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1025
+			$sql .= ', '.price2num($pu_ht_devise, 'CU');
1026
+			$sql .= ', '.price2num($multicurrency_total_ht, 'CT');
1027
+			$sql .= ', '.price2num($multicurrency_total_tva, 'CT');
1028
+			$sql .= ', '.price2num($multicurrency_total_ttc, 'CT');
1029 1029
 			$sql .= ')';
1030 1030
 
1031
-			dol_syslog(get_class($this). '::addline', LOG_DEBUG);
1031
+			dol_syslog(get_class($this).'::addline', LOG_DEBUG);
1032 1032
 			if ($this->db->query($sql)) {
1033
-				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec');
1033
+				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec');
1034 1034
 				$this->update_price();
1035 1035
 				$this->id = $facid;
1036 1036
 				$this->db->commit();
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
 		$facid = $this->id;
1083 1083
 
1084
-		dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1084
+		dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1085 1085
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
1086 1086
 
1087 1087
 		// Check parameters
@@ -1151,41 +1151,41 @@  discard block
 block discarded – undo
1151 1151
 				$product_type = $product->type;
1152 1152
 			}
1153 1153
 
1154
-			$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
1155
-			$sql .= ' fk_facture_fourn = ' . ((int) $facid);
1156
-			$sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');
1157
-			$sql .= ", ref = '" . $this->db->escape($ref) . "'";
1158
-			$sql .= ", label = '" . $this->db->escape($label) . "'";
1159
-			$sql .= ", description = '" . $this->db->escape($desc) . "'";
1160
-			$sql .= ', pu_ht = ' . price2num($pu_ht);
1161
-			$sql .= ', qty = ' . price2num($qty);
1162
-			$sql .= ", remise_percent = '" . price2num($remise_percent) . "'";
1163
-			$sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";
1164
-			$sql .= ', tva_tx = ' . price2num($txtva);
1165
-			$sql .= ', localtax1_tx = ' . (float) $txlocaltax1;
1166
-			$sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";
1167
-			$sql .= ', localtax2_tx = ' . (float) $txlocaltax2;
1168
-			$sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";
1169
-			$sql .= ", total_ht = '" . price2num($total_ht) . "'";
1170
-			$sql .= ", total_tva = '" . price2num($total_tva) . "'";
1171
-			$sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";
1172
-			$sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";
1173
-			$sql .= ", total_ttc = '" . price2num($total_ttc) . "'";
1174
-			$sql .= ', product_type = ' . (int) $product_type;
1175
-			$sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);
1176
-			$sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);
1177
-			$sql .= ', info_bits = ' . (int) $info_bits;
1178
-			$sql .= ', special_code = ' . (int) $special_code;
1179
-			$sql .= ', rang = ' . (int) $rang;
1180
-			$sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
1181
-			$sql .= ', fk_user_modif = ' . (int) $user;
1154
+			$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
1155
+			$sql .= ' fk_facture_fourn = '.((int) $facid);
1156
+			$sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null');
1157
+			$sql .= ", ref = '".$this->db->escape($ref)."'";
1158
+			$sql .= ", label = '".$this->db->escape($label)."'";
1159
+			$sql .= ", description = '".$this->db->escape($desc)."'";
1160
+			$sql .= ', pu_ht = '.price2num($pu_ht);
1161
+			$sql .= ', qty = '.price2num($qty);
1162
+			$sql .= ", remise_percent = '".price2num($remise_percent)."'";
1163
+			$sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'";
1164
+			$sql .= ', tva_tx = '.price2num($txtva);
1165
+			$sql .= ', localtax1_tx = '.(float) $txlocaltax1;
1166
+			$sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'";
1167
+			$sql .= ', localtax2_tx = '.(float) $txlocaltax2;
1168
+			$sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'";
1169
+			$sql .= ", total_ht = '".price2num($total_ht)."'";
1170
+			$sql .= ", total_tva = '".price2num($total_tva)."'";
1171
+			$sql .= ", total_localtax1 = '".price2num($total_localtax1)."'";
1172
+			$sql .= ", total_localtax2 = '".price2num($total_localtax2)."'";
1173
+			$sql .= ", total_ttc = '".price2num($total_ttc)."'";
1174
+			$sql .= ', product_type = '.(int) $product_type;
1175
+			$sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start);
1176
+			$sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end);
1177
+			$sql .= ', info_bits = '.(int) $info_bits;
1178
+			$sql .= ', special_code = '.(int) $special_code;
1179
+			$sql .= ', rang = '.(int) $rang;
1180
+			$sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null');
1181
+			$sql .= ', fk_user_modif = '.(int) $user;
1182 1182
 			$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
1183 1183
 			$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
1184 1184
 			$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
1185 1185
 			$sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc);
1186
-			$sql .= ' WHERE rowid = ' . (int) $rowid;
1186
+			$sql .= ' WHERE rowid = '.(int) $rowid;
1187 1187
 
1188
-			dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
1188
+			dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
1189 1189
 			if ($this->db->query($sql)) {
1190 1190
 				$this->id = $facid;
1191 1191
 				$this->update_price();
@@ -1275,16 +1275,16 @@  discard block
 block discarded – undo
1275 1275
 		$tmparray = dol_getdate($now);
1276 1276
 		$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
1277 1277
 
1278
-		dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation);
1278
+		dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation);
1279 1279
 
1280 1280
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec';
1281 1281
 		$sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency
1282 1282
 		$sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')";
1283 1283
 		$sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
1284 1284
 		$sql .= ' AND suspended = 0';
1285
-		$sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here
1285
+		$sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here
1286 1286
 		if ($restrictioninvoiceid > 0) {
1287
-			$sql .= ' AND rowid = '. (int) $restrictioninvoiceid;
1287
+			$sql .= ' AND rowid = '.(int) $restrictioninvoiceid;
1288 1288
 		}
1289 1289
 		$sql .= $this->db->order('entity', 'ASC');
1290 1290
 		//print $sql;exit;
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 			}
1307 1307
 
1308 1308
 			$saventity = $conf->entity;
1309
-			$laststep="None";
1309
+			$laststep = "None";
1310 1310
 
1311 1311
 			while ($i < $num) {     // Loop on each template invoice. If $num = 0, test is false at first pass.
1312 1312
 				$line = $this->db->fetch_object($resql);
@@ -1317,21 +1317,21 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 				$new_fac_fourn = null;
1319 1319
 				$facturerec = new FactureFournisseurRec($this->db);
1320
-				$laststep="Fetch {$line->rowid}";
1320
+				$laststep = "Fetch {$line->rowid}";
1321 1321
 				$facturerec->fetch($line->rowid);
1322 1322
 
1323 1323
 				if ($facturerec->id > 0) {
1324 1324
 					// Set entity context
1325 1325
 					$conf->entity = $facturerec->entity;
1326 1326
 
1327
-					dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity);
1327
+					dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity);
1328 1328
 
1329 1329
 					$new_fac_fourn = new FactureFournisseur($this->db);
1330 1330
 					$new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
1331 1331
 					$new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
1332 1332
 
1333 1333
 					$new_fac_fourn->type = self::TYPE_STANDARD;
1334
-					$new_fac_fourn->statut = self::STATUS_DRAFT;	// deprecated
1334
+					$new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated
1335 1335
 					$new_fac_fourn->status = self::STATUS_DRAFT;
1336 1336
 					$new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
1337 1337
 					$new_fac_fourn->socid = $facturerec->socid;
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 					$new_fac_fourn->model_pdf = $facturerec->model_pdf;
1341 1341
 					$new_fac_fourn->fk_project = $facturerec->fk_project;
1342 1342
 					$new_fac_fourn->label = $facturerec->label;
1343
-					$new_fac_fourn->libelle = $facturerec->label;	// deprecated
1343
+					$new_fac_fourn->libelle = $facturerec->label; // deprecated
1344 1344
 
1345 1345
 					$invoiceidgenerated = $new_fac_fourn->create($user);
1346
-					$laststep="Create invoiceidgenerated $invoiceidgenerated";
1346
+					$laststep = "Create invoiceidgenerated $invoiceidgenerated";
1347 1347
 					if ($invoiceidgenerated <= 0) {
1348 1348
 						$this->errors = $new_fac_fourn->errors;
1349 1349
 						$this->error = $new_fac_fourn->error;
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 					}
1352 1352
 					if (!$error && ($facturerec->auto_validate || $forcevalidation)) {
1353 1353
 						$result = $new_fac_fourn->validate($user);
1354
-						$laststep="Validate by user {$user->id}";
1354
+						$laststep = "Validate by user {$user->id}";
1355 1355
 						if ($result <= 0) {
1356 1356
 							$this->errors = $new_fac_fourn->errors;
1357 1357
 							$this->error = $new_fac_fourn->error;
@@ -1361,9 +1361,9 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 					if (!$error && $facturerec->generate_pdf) {
1363 1363
 						// We refresh the object in order to have all necessary data (like date_lim_reglement)
1364
-						$laststep="Refresh ".$new_fac_fourn->id;
1364
+						$laststep = "Refresh ".$new_fac_fourn->id;
1365 1365
 						$new_fac_fourn->fetch($new_fac_fourn->id);
1366
-						$laststep="GenerateDocument ".$new_fac_fourn->id;
1366
+						$laststep = "GenerateDocument ".$new_fac_fourn->id;
1367 1367
 						$result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs);
1368 1368
 						if ($result < 0) {
1369 1369
 							$this->errors = $new_fac_fourn->errors;
@@ -1373,22 +1373,22 @@  discard block
 block discarded – undo
1373 1373
 					}
1374 1374
 				} else {
1375 1375
 					$error++;
1376
-					$this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n";
1377
-					$this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity;
1378
-					dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity);
1376
+					$this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n";
1377
+					$this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity;
1378
+					dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity);
1379 1379
 				}
1380 1380
 
1381 1381
 				if (!$error && $invoiceidgenerated >= 0) {
1382 1382
 					$facturerec->nb_gen_done++;
1383 1383
 					$facturerec->date_last_gen = dol_now();
1384
-					$facturerec->date_when= $facturerec->getNextDate();
1384
+					$facturerec->date_when = $facturerec->getNextDate();
1385 1385
 					$facturerec->update($user);
1386
-					$this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title);
1387
-					dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation');
1386
+					$this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title);
1387
+					dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation');
1388 1388
 					$nb_create++;
1389 1389
 					$this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n";
1390 1390
 				} else {
1391
-					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title);
1391
+					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title);
1392 1392
 				}
1393 1393
 
1394 1394
 				$parameters = array(
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 		}
1482 1482
 		$result .= $linkend;
1483 1483
 		global $action;
1484
-		$hookmanager->initHooks(array($this->element . 'dao'));
1484
+		$hookmanager->initHooks(array($this->element.'dao'));
1485 1485
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
1486 1486
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1487 1487
 		if ($reshook > 0) {
@@ -1660,8 +1660,8 @@  discard block
 block discarded – undo
1660 1660
 		$prodids = array();
1661 1661
 
1662 1662
 		$sql = 'SELECT rowid';
1663
-		$sql .= ' FROM ' .MAIN_DB_PREFIX. 'product';
1664
-		$sql .= ' WHERE entity IN (' .getEntity('product'). ')';
1663
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'product';
1664
+		$sql .= ' WHERE entity IN ('.getEntity('product').')';
1665 1665
 		$sql .= $this->db->plimit(100);
1666 1666
 
1667 1667
 		$resql = $this->db->query($sql);
@@ -1700,7 +1700,7 @@  discard block
 block discarded – undo
1700 1700
 			$xnbp = 0;
1701 1701
 			while ($xnbp < $nbp) {
1702 1702
 				$line = new FactureLigne($this->db);
1703
-				$line->desc = $langs->trans('Description'). ' ' .$xnbp;
1703
+				$line->desc = $langs->trans('Description').' '.$xnbp;
1704 1704
 				$line->qty = 1;
1705 1705
 				$line->subprice = 100;
1706 1706
 				$line->tva_tx = 19.6;
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 
1748 1748
 			// Add a line "offered"
1749 1749
 			$line = new FactureLigne($this->db);
1750
-			$line->desc = $langs->trans('Description'). ' (offered line)';
1750
+			$line->desc = $langs->trans('Description').' (offered line)';
1751 1751
 			$line->qty = 1;
1752 1752
 			$line->subprice = 100;
1753 1753
 			$line->tva_tx = 19.6;
@@ -1794,12 +1794,12 @@  discard block
 block discarded – undo
1794 1794
 	public function setFrequencyAndUnit($frequency, $unit)
1795 1795
 	{
1796 1796
 		if (!$this->table_element) {
1797
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1797
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1798 1798
 			return -1;
1799 1799
 		}
1800 1800
 
1801 1801
 		if (!empty($frequency) && empty($unit)) {
1802
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1802
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1803 1803
 			return -2;
1804 1804
 		}
1805 1805
 
@@ -1838,11 +1838,11 @@  discard block
 block discarded – undo
1838 1838
 			return -1;
1839 1839
 		}
1840 1840
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1841
-		$sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");
1841
+		$sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL");
1842 1842
 		if ($increment_nb_gen_done > 0) {
1843 1843
 			$sql .= ", nb_gen_done = nb_gen_done + 1";
1844 1844
 		}
1845
-		$sql .= " WHERE rowid = " . (int) $this->id;
1845
+		$sql .= " WHERE rowid = ".(int) $this->id;
1846 1846
 
1847 1847
 		dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);
1848 1848
 
@@ -1876,8 +1876,8 @@  discard block
 block discarded – undo
1876 1876
 		}
1877 1877
 
1878 1878
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1879
-		$sql .= " SET nb_gen_max = ". (int) $nb;
1880
-		$sql .= " WHERE rowid = " . (int) $this->id;
1879
+		$sql .= " SET nb_gen_max = ".(int) $nb;
1880
+		$sql .= " WHERE rowid = ".(int) $this->id;
1881 1881
 
1882 1882
 		dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);
1883 1883
 
@@ -1905,7 +1905,7 @@  discard block
 block discarded – undo
1905 1905
 
1906 1906
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1907 1907
 		$sql .= " SET auto_validate = ".((int) $validate);
1908
-		$sql .= " WHERE rowid = " . (int) $this->id;
1908
+		$sql .= " WHERE rowid = ".(int) $this->id;
1909 1909
 
1910 1910
 		dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);
1911 1911
 
@@ -1932,8 +1932,8 @@  discard block
 block discarded – undo
1932 1932
 		}
1933 1933
 
1934 1934
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1935
-		$sql .= " SET generate_pdf = ". (int) $validate;
1936
-		$sql .= " WHERE rowid = " . (int) $this->id;
1935
+		$sql .= " SET generate_pdf = ".(int) $validate;
1936
+		$sql .= " WHERE rowid = ".(int) $this->id;
1937 1937
 
1938 1938
 		dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);
1939 1939
 
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 
1962 1962
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1963 1963
 		$sql .= " SET modelpdf = '".$this->db->escape($model)."'";
1964
-		$sql .= " WHERE rowid = " . (int) $this->id;
1964
+		$sql .= " WHERE rowid = ".(int) $this->id;
1965 1965
 
1966 1966
 		dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);
1967 1967
 
@@ -2034,8 +2034,8 @@  discard block
 block discarded – undo
2034 2034
 		$error = 0;
2035 2035
 		$this->db->begin();
2036 2036
 
2037
-		if (! $error) {
2038
-			if (! $notrigger) {
2037
+		if (!$error) {
2038
+			if (!$notrigger) {
2039 2039
 				// Call triggers
2040 2040
 				$result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user);
2041 2041
 				if ($result < 0) {
@@ -2045,15 +2045,15 @@  discard block
 block discarded – undo
2045 2045
 			}
2046 2046
 		}
2047 2047
 
2048
-		if (! $error) {
2048
+		if (!$error) {
2049 2049
 			$result = $this->deleteExtraFields();
2050 2050
 			if ($result < 0) {
2051 2051
 				$error++;
2052 2052
 			}
2053 2053
 		}
2054 2054
 
2055
-		if (! $error) {
2056
-			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id;
2055
+		if (!$error) {
2056
+			$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id;
2057 2057
 
2058 2058
 			$res = $this->db->query($sql);
2059 2059
 			if ($res === false) {
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
2094 2094
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
2095 2095
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
2096
-		$sql .= ' WHERE l.rowid = '. (int) $rowid;
2096
+		$sql .= ' WHERE l.rowid = '.(int) $rowid;
2097 2097
 		$sql .= ' ORDER BY l.rang';
2098 2098
 
2099 2099
 		dol_syslog('FactureRec::fetch', LOG_DEBUG);
@@ -2165,44 +2165,44 @@  discard block
 block discarded – undo
2165 2165
 
2166 2166
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
2167 2167
 
2168
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
2169
-		$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
2170
-		$sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
2171
-		$sql .= ', fk_product = ' . (int) $this->fk_product;
2172
-		$sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');
2173
-		$sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');
2174
-		$sql .= ", description = '" . $this->db->escape($this->description) . "'";
2175
-		$sql .= ', pu_ht = ' . price2num($this->pu_ht);
2176
-		$sql .= ', pu_ttc = ' . price2num($this->pu_ttc);
2177
-		$sql .= ', qty = ' . price2num($this->qty);
2178
-		$sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";
2179
-		$sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;
2180
-		$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
2181
-		$sql .= ', tva_tx = ' . price2num($this->tva_tx);
2182
-		$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
2183
-		$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
2184
-		$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
2185
-		$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
2168
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
2169
+		$sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn;
2170
+		$sql .= ', fk_parent_line = '.(int) $this->fk_parent;
2171
+		$sql .= ', fk_product = '.(int) $this->fk_product;
2172
+		$sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL');
2173
+		$sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL');
2174
+		$sql .= ", description = '".$this->db->escape($this->description)."'";
2175
+		$sql .= ', pu_ht = '.price2num($this->pu_ht);
2176
+		$sql .= ', pu_ttc = '.price2num($this->pu_ttc);
2177
+		$sql .= ', qty = '.price2num($this->qty);
2178
+		$sql .= ", remise_percent = '".price2num($this->remise_percent)."'";
2179
+		$sql .= ', fk_remise_except = '.(int) $this->fk_remise_except;
2180
+		$sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'";
2181
+		$sql .= ', tva_tx = '.price2num($this->tva_tx);
2182
+		$sql .= ', localtax1_tx = '.price2num($this->localtax1_tx);
2183
+		$sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";
2184
+		$sql .= ', localtax2_tx = '.price2num($this->localtax2_tx);
2185
+		$sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";
2186 2186
 		if (empty($this->skip_update_total)) {
2187
-			$sql .= ', total_ht = ' . price2num($this->total_ht);
2188
-			$sql .= ', total_tva = ' . price2num($this->total_tva);
2189
-			$sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);
2190
-			$sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);
2191
-			$sql .= ', total_ttc = ' . price2num($this->total_ttc);
2187
+			$sql .= ', total_ht = '.price2num($this->total_ht);
2188
+			$sql .= ', total_tva = '.price2num($this->total_tva);
2189
+			$sql .= ', total_localtax1 = '.price2num($this->total_localtax1);
2190
+			$sql .= ', total_localtax2 = '.price2num($this->total_localtax2);
2191
+			$sql .= ', total_ttc = '.price2num($this->total_ttc);
2192 2192
 		}
2193
-		$sql .= ', product_type = ' . (int) $this->product_type;
2194
-		$sql .= ', date_start = ' . (int) $this->date_start;
2195
-		$sql .= ', date_end = ' . (int) $this->date_end;
2196
-		$sql .= ", info_bits = " . ((int) $this->info_bits);
2197
-		$sql .= ', special_code =' . (int) $this->special_code;
2198
-		$sql .= ', rang = ' . (int) $this->rang;
2199
-		$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2200
-		$sql .= ', fk_user_modif = ' . (int) $user;
2201
-		$sql .= ' WHERE rowid = ' . (int) $this->id;
2193
+		$sql .= ', product_type = '.(int) $this->product_type;
2194
+		$sql .= ', date_start = '.(int) $this->date_start;
2195
+		$sql .= ', date_end = '.(int) $this->date_end;
2196
+		$sql .= ", info_bits = ".((int) $this->info_bits);
2197
+		$sql .= ', special_code ='.(int) $this->special_code;
2198
+		$sql .= ', rang = '.(int) $this->rang;
2199
+		$sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2200
+		$sql .= ', fk_user_modif = '.(int) $user;
2201
+		$sql .= ' WHERE rowid = '.(int) $this->id;
2202 2202
 
2203 2203
 		$this->db->begin();
2204 2204
 
2205
-		dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
2205
+		dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
2206 2206
 		$resql = $this->db->query($sql);
2207 2207
 		if ($resql) {
2208 2208
 			if (!$error) {
Please login to merge, or discard this patch.
htdocs/core/ajax/check_notifications.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
 	$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'actioncomm_reminder as ar ON a.id = ar.fk_actioncomm AND ar.fk_user = '.((int) $user->id);
131 131
 	$sql .= " AND ar.typeremind = 'browser' AND ar.dateremind < '".$db->idate(dol_now())."'";
132 132
 	$sql .= " AND ar.status = 0";
133
-	$sql .= " AND ar.entity = ".((int) $conf->entity);	// No sharing of entity for alerts
133
+	$sql .= " AND ar.entity = ".((int) $conf->entity); // No sharing of entity for alerts
134 134
 	$sql .= $db->order('datep', 'ASC');
135 135
 	$sql .= $db->plimit(10); // Avoid too many notification at once
136 136
 
Please login to merge, or discard this patch.