Completed
Branch develop (4d02ec)
by
unknown
24:02
created
htdocs/includes/odtphp/zip/PclZipProxy.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined('ODTPHP_PATHTOPCLZIP')) {
2
+if (!defined('ODTPHP_PATHTOPCLZIP')) {
3 3
 	define('ODTPHP_PATHTOPCLZIP', DOL_DOCUMENT_ROOT.'/includes/odtphp/zip/pclzip/');
4 4
 }
5 5
 require_once ODTPHP_PATHTOPCLZIP.'pclzip.lib.php';
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @throws PclZipProxyException
30 30
      */
31
-	public function __construct($forcedir='')
31
+	public function __construct($forcedir = '')
32 32
 	{
33
-		if (! class_exists('PclZip')) {
33
+		if (!class_exists('PclZip')) {
34 34
 			throw new PclZipProxyException('PclZip class not loaded - PclZip library
35 35
 			 is required for using PclZipProxy'); ;
36 36
 		}
37
-		if ($forcedir) $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir);	// $this->tmpdir must not contains / at the end
37
+		if ($forcedir) $this->tmpdir = preg_replace('|[//\/]$|', '', $forcedir); // $this->tmpdir must not contains / at the end
38 38
 	}
39 39
 
40 40
 	/**
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 		$localname = preg_replace("/(?:\.|\/)*(.*)/", "\\1", $localname);
93 93
 		$localpath = dirname($localname);
94
-		$tmpfilename = $this->tmpdir . '/' . basename($localname);
94
+		$tmpfilename = $this->tmpdir.'/'.basename($localname);
95 95
 		if (false !== file_put_contents($tmpfilename, $contents)) {
96 96
 			//print "tmpfilename=".$tmpfilename;
97 97
 			//print "localname=".$localname;
98
-			$res=$this->pclzip->delete(PCLZIP_OPT_BY_NAME, $localname);
98
+			$res = $this->pclzip->delete(PCLZIP_OPT_BY_NAME, $localname);
99 99
 			$add = $this->pclzip->add($tmpfilename,
100 100
 				PCLZIP_OPT_REMOVE_PATH, $this->tmpdir,
101 101
 				PCLZIP_OPT_ADD_PATH, $localpath);
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
 		if (isSet($localname)) {
127 127
 			$localname = preg_replace("/(?:\.|\/)*(.*)/", "\\1", $localname);
128 128
 			$localpath = dirname($localname);
129
-			$tmpfilename = $this->tmpdir . '/' . basename($localname);
129
+			$tmpfilename = $this->tmpdir.'/'.basename($localname);
130 130
 		} else {
131 131
 			$localname = basename($filename);
132
-			$tmpfilename = $this->tmpdir . '/' . $localname;
132
+			$tmpfilename = $this->tmpdir.'/'.$localname;
133 133
 			$localpath = '';
134 134
 		}
135 135
 		if (file_exists($filename)) {
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,10 @@
 block discarded – undo
34 34
 			throw new PclZipProxyException('PclZip class not loaded - PclZip library
35 35
 			 is required for using PclZipProxy'); ;
36 36
 		}
37
-		if ($forcedir) $this->tmpdir=preg_replace('|[//\/]$|','',$forcedir);	// $this->tmpdir must not contains / at the end
37
+		if ($forcedir) {
38
+			$this->tmpdir=preg_replace('|[//\/]$|','',$forcedir);
39
+		}
40
+		// $this->tmpdir must not contains / at the end
38 41
 	}
39 42
 
40 43
 	/**
Please login to merge, or discard this patch.
htdocs/variants/class/ProductCombination.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			 * @param mixed $v Feature information of a product.
651 651
 			 * @return bool
652 652
 			 */
653
-			static function ($v) {
653
+			static function($v) {
654 654
 				return !empty($v);
655 655
 			}
656 656
 		);
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 
855 855
 			if ($forced_refvar === false) {
856 856
 				if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
857
-					$newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR') . $prodattrval->ref;
857
+					$newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR').$prodattrval->ref;
858 858
 				} else {
859 859
 					$newproduct->ref .= '_'.$prodattrval->ref;
860 860
 				}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 				$productCombinationLevel->variation_price = $price_impact[$i];
883 883
 
884 884
 				if (is_array($price_var_percent)) {
885
-					$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ;
885
+					$productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i];
886 886
 				} else {
887 887
 					$productCombinationLevel->variation_price_percentage = $price_var_percent;
888 888
 				}
Please login to merge, or discard this patch.
htdocs/variants/class/ProductAttribute.class.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -229,32 +229,32 @@  discard block
 block discarded – undo
229 229
 			$error++;
230 230
 		}
231 231
 		if ($error) {
232
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
232
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
233 233
 			return -1;
234 234
 		}
235 235
 
236 236
 		$this->db->begin();
237 237
 
238
-		$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
238
+		$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." (";
239 239
 		$sql .= " ref, ref_ext, label, entity, position";
240 240
 		$sql .= ")";
241 241
 		$sql .= " VALUES (";
242
-		$sql .= "  '" . $this->db->escape($this->ref) . "'";
243
-		$sql .= ", '" . $this->db->escape($this->ref_ext) . "'";
244
-		$sql .= ", '" . $this->db->escape($this->label) . "'";
245
-		$sql .= ", " . ((int) $this->entity);
246
-		$sql .= ", " . ((int) $this->position);
242
+		$sql .= "  '".$this->db->escape($this->ref)."'";
243
+		$sql .= ", '".$this->db->escape($this->ref_ext)."'";
244
+		$sql .= ", '".$this->db->escape($this->label)."'";
245
+		$sql .= ", ".((int) $this->entity);
246
+		$sql .= ", ".((int) $this->position);
247 247
 		$sql .= ")";
248 248
 
249 249
 		dol_syslog(__METHOD__, LOG_DEBUG);
250 250
 		$resql = $this->db->query($sql);
251 251
 		if (!$resql) {
252
-			$this->errors[] = "Error " . $this->db->lasterror();
252
+			$this->errors[] = "Error ".$this->db->lasterror();
253 253
 			$error++;
254 254
 		}
255 255
 
256 256
 		if (!$error) {
257
-			$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
257
+			$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
258 258
 			$result = $this->insertExtraFields();
259 259
 			if ($result < 0) {
260 260
 				$error++;
@@ -299,20 +299,20 @@  discard block
 block discarded – undo
299 299
 			$error++;
300 300
 		}
301 301
 		if ($error) {
302
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
302
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
303 303
 			return -1;
304 304
 		}
305 305
 
306 306
 		$sql = "SELECT rowid, ref, ref_ext, label, position";
307
-		$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
308
-		$sql .= " WHERE rowid = " . ((int) $id);
309
-		$sql .= " AND entity IN (" . getEntity('product') . ")";
307
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
308
+		$sql .= " WHERE rowid = ".((int) $id);
309
+		$sql .= " AND entity IN (".getEntity('product').")";
310 310
 
311 311
 		dol_syslog(__METHOD__, LOG_DEBUG);
312 312
 		$resql = $this->db->query($sql);
313 313
 		if (!$resql) {
314
-			$this->errors[] = "Error " . $this->db->lasterror();
315
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
314
+			$this->errors[] = "Error ".$this->db->lasterror();
315
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
316 316
 			return -1;
317 317
 		}
318 318
 
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 		$return = array();
344 344
 
345 345
 		$sql = "SELECT rowid, ref, ref_ext, label, position";
346
-		$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
347
-		$sql .= " WHERE entity IN (" . getEntity('product') . ")";
346
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
347
+		$sql .= " WHERE entity IN (".getEntity('product').")";
348 348
 		$sql .= $this->db->order("position", "asc");
349 349
 
350 350
 		dol_syslog(__METHOD__, LOG_DEBUG);
351 351
 		$resql = $this->db->query($sql);
352 352
 		if (!$resql) {
353
-			$this->errors[] = "Error " . $this->db->lasterror();
353
+			$this->errors[] = "Error ".$this->db->lasterror();
354 354
 			dol_print_error($this->db);
355 355
 			return $return;
356 356
 		}
@@ -402,25 +402,25 @@  discard block
 block discarded – undo
402 402
 			$error++;
403 403
 		}
404 404
 		if ($error) {
405
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
405
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
406 406
 			return -1;
407 407
 		}
408 408
 
409 409
 		$this->db->begin();
410 410
 
411
-		$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET";
411
+		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
412 412
 
413
-		$sql .= "  ref = '" . $this->db->escape($this->ref) . "'";
414
-		$sql .= ", ref_ext = '" . $this->db->escape($this->ref_ext) . "'";
415
-		$sql .= ", label = '" . $this->db->escape($this->label) . "'";
416
-		$sql .= ", position = " . ((int) $this->position);
413
+		$sql .= "  ref = '".$this->db->escape($this->ref)."'";
414
+		$sql .= ", ref_ext = '".$this->db->escape($this->ref_ext)."'";
415
+		$sql .= ", label = '".$this->db->escape($this->label)."'";
416
+		$sql .= ", position = ".((int) $this->position);
417 417
 
418
-		$sql .= " WHERE rowid = " . ((int) $this->id);
418
+		$sql .= " WHERE rowid = ".((int) $this->id);
419 419
 
420 420
 		dol_syslog(__METHOD__, LOG_DEBUG);
421 421
 		$resql = $this->db->query($sql);
422 422
 		if (!$resql) {
423
-			$this->errors[] = "Error " . $this->db->lasterror();
423
+			$this->errors[] = "Error ".$this->db->lasterror();
424 424
 			$error++;
425 425
 		}
426 426
 		if (!$error) {
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 			$error++;
469 469
 		}
470 470
 		if ($error) {
471
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
471
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
472 472
 			return -1;
473 473
 		}
474 474
 
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 
494 494
 		if (!$error) {
495 495
 			// Delete values
496
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element_line;
497
-			$sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id);
496
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line;
497
+			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
498 498
 
499
-			dol_syslog(__METHOD__ . ' - Delete values', LOG_DEBUG);
499
+			dol_syslog(__METHOD__.' - Delete values', LOG_DEBUG);
500 500
 			$resql = $this->db->query($sql);
501 501
 			if (!$resql) {
502
-				$this->errors[] = "Error " . $this->db->lasterror();
502
+				$this->errors[] = "Error ".$this->db->lasterror();
503 503
 				$error++;
504 504
 			}
505 505
 		}
506 506
 
507 507
 		if (!$error) {
508
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element;
509
-			$sql .= " WHERE rowid = " . ((int) $this->id);
508
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
509
+			$sql .= " WHERE rowid = ".((int) $this->id);
510 510
 
511
-			dol_syslog(__METHOD__ . ' - Delete attribute', LOG_DEBUG);
511
+			dol_syslog(__METHOD__.' - Delete attribute', LOG_DEBUG);
512 512
 			$resql = $this->db->query($sql);
513 513
 			if (!$resql) {
514
-				$this->errors[] = "Error " . $this->db->lasterror();
514
+				$this->errors[] = "Error ".$this->db->lasterror();
515 515
 				$error++;
516 516
 			}
517 517
 		}
@@ -550,15 +550,15 @@  discard block
 block discarded – undo
550 550
 			$error++;
551 551
 		}
552 552
 		if ($error) {
553
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
553
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
554 554
 			return -1;
555 555
 		}
556 556
 
557 557
 		$sql = "SELECT td.rowid, td.fk_product_attribute, td.ref, td.value, td.position";
558
-		$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line . " AS td";
559
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->table_element . " AS t ON t.rowid = td." . $this->fk_element;
560
-		$sql .= " WHERE t.rowid = " . ((int) $this->id);
561
-		$sql .= " AND t.entity IN (" . getEntity('product') . ")";
558
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS td";
559
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element." AS t ON t.rowid = td.".$this->fk_element;
560
+		$sql .= " WHERE t.rowid = ".((int) $this->id);
561
+		$sql .= " AND t.entity IN (".getEntity('product').")";
562 562
 		if ($filters) {
563 563
 			$sql .= $filters;
564 564
 		}
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 		dol_syslog(__METHOD__, LOG_DEBUG);
568 568
 		$resql = $this->db->query($sql);
569 569
 		if (!$resql) {
570
-			$this->errors[] = "Error " . $this->db->lasterror();
571
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
570
+			$this->errors[] = "Error ".$this->db->lasterror();
571
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
572 572
 			return -3;
573 573
 		}
574 574
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	public function addLine($ref, $value, $position = -1, $notrigger = 0)
624 624
 	{
625 625
 		global $langs, $user;
626
-		dol_syslog(__METHOD__ . " id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger);
626
+		dol_syslog(__METHOD__." id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger);
627 627
 		$error = 0;
628 628
 
629 629
 		// Clean parameters
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			$error++;
636 636
 		}
637 637
 		if ($error) {
638
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
638
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
639 639
 			return -1;
640 640
 		}
641 641
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	{
685 685
 		global $user;
686 686
 
687
-		dol_syslog(__METHOD__ . " lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger");
687
+		dol_syslog(__METHOD__." lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger");
688 688
 
689 689
 		// Clean parameters
690 690
 		$lineid = $lineid > 0 ? $lineid : 0;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 	 */
726 726
 	public function deleteLine(User $user, $lineid, $notrigger = 0)
727 727
 	{
728
-		dol_syslog(__METHOD__ . " lineid=$lineid, notrigger=$notrigger");
728
+		dol_syslog(__METHOD__." lineid=$lineid, notrigger=$notrigger");
729 729
 
730 730
 		// Clean parameters
731 731
 		$lineid = $lineid > 0 ? $lineid : 0;
@@ -772,19 +772,19 @@  discard block
 block discarded – undo
772 772
 			$error++;
773 773
 		}
774 774
 		if ($error) {
775
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
775
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
776 776
 			return -1;
777 777
 		}
778 778
 
779 779
 		$sql = "SELECT COUNT(*) AS count";
780
-		$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line;
781
-		$sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id);
780
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line;
781
+		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
782 782
 
783 783
 		dol_syslog(__METHOD__, LOG_DEBUG);
784 784
 		$resql = $this->db->query($sql);
785 785
 		if (!$resql) {
786
-			$this->errors[] = "Error " . $this->db->lasterror();
787
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
786
+			$this->errors[] = "Error ".$this->db->lasterror();
787
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
788 788
 			return -1;
789 789
 		}
790 790
 
@@ -815,21 +815,21 @@  discard block
 block discarded – undo
815 815
 			$error++;
816 816
 		}
817 817
 		if ($error) {
818
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
818
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
819 819
 			return -1;
820 820
 		}
821 821
 
822 822
 		$sql = "SELECT COUNT(*) AS count";
823
-		$sql .= " FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val AS pac2v";
824
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid";
825
-		$sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $this->id);
826
-		$sql .= " AND pac.entity IN (" . getEntity('product') . ")";
823
+		$sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v";
824
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid";
825
+		$sql .= " WHERE pac2v.fk_prod_attr = ".((int) $this->id);
826
+		$sql .= " AND pac.entity IN (".getEntity('product').")";
827 827
 
828 828
 		dol_syslog(__METHOD__, LOG_DEBUG);
829 829
 		$resql = $this->db->query($sql);
830 830
 		if (!$resql) {
831
-			$this->errors[] = "Error " . $this->db->lasterror();
832
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
831
+			$this->errors[] = "Error ".$this->db->lasterror();
832
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
833 833
 			return -1;
834 834
 		}
835 835
 
@@ -859,16 +859,16 @@  discard block
 block discarded – undo
859 859
 			$error++;
860 860
 		}
861 861
 		if ($error) {
862
-			dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR);
862
+			dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR);
863 863
 			return -1;
864 864
 		}
865 865
 
866
-		$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr = " . ((int) $this->id);
866
+		$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr = ".((int) $this->id);
867 867
 
868 868
 		dol_syslog(__METHOD__, LOG_DEBUG);
869 869
 		$resql = $this->db->query($sql);
870 870
 		if (!$resql) {
871
-			$this->errors[] = "Error " . $this->db->lasterror();
871
+			$this->errors[] = "Error ".$this->db->lasterror();
872 872
 			return -1;
873 873
 		}
874 874
 
@@ -892,8 +892,8 @@  discard block
 block discarded – undo
892 892
 	{
893 893
 		// Count number of attributes to reorder (according to choice $renum)
894 894
 		$nl = 0;
895
-		$sql = "SELECT count(rowid) FROM " . MAIN_DB_PREFIX . $this->table_element;
896
-		$sql .= " WHERE entity IN (" . getEntity('product') . ")";
895
+		$sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element;
896
+		$sql .= " WHERE entity IN (".getEntity('product').")";
897 897
 		if (!$renum) {
898 898
 			$sql .= " AND position = 0";
899 899
 		} else {
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
 			$rows = array();
914 914
 
915 915
 			// We first search all attributes
916
-			$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element;
917
-			$sql .= " WHERE entity IN (" . getEntity('product') . ")";
918
-			$sql .= " ORDER BY position ASC, rowid " . $rowidorder;
916
+			$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element;
917
+			$sql .= " WHERE entity IN (".getEntity('product').")";
918
+			$sql .= " ORDER BY position ASC, rowid ".$rowidorder;
919 919
 
920
-			dol_syslog(__METHOD__ . " search all attributes", LOG_DEBUG);
920
+			dol_syslog(__METHOD__." search all attributes", LOG_DEBUG);
921 921
 			$resql = $this->db->query($sql);
922 922
 			if ($resql) {
923 923
 				$i = 0;
@@ -952,8 +952,8 @@  discard block
 block discarded – undo
952 952
 	{
953 953
 		global $hookmanager;
954 954
 
955
-		$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position);
956
-		$sql .= " WHERE rowid = " . ((int) $rowid);
955
+		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position);
956
+		$sql .= " WHERE rowid = ".((int) $rowid);
957 957
 
958 958
 		dol_syslog(__METHOD__, LOG_DEBUG);
959 959
 		if (!$this->db->query($sql)) {
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
 	 */
976 976
 	public function getPositionOfAttribute($rowid)
977 977
 	{
978
-		$sql = "SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element;
979
-		$sql .= " WHERE rowid=".(int) $rowid." AND entity IN (" . getEntity('product') . ")";
978
+		$sql = "SELECT position FROM ".MAIN_DB_PREFIX.$this->table_element;
979
+		$sql .= " WHERE rowid=".(int) $rowid." AND entity IN (".getEntity('product').")";
980 980
 
981 981
 		dol_syslog(__METHOD__, LOG_DEBUG);
982 982
 		$resql = $this->db->query($sql);
@@ -1039,12 +1039,12 @@  discard block
 block discarded – undo
1039 1039
 	public function updateAttributePositionUp($rowid, $position)
1040 1040
 	{
1041 1041
 		if ($position > 1) {
1042
-			$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position);
1043
-			$sql .= " WHERE entity IN (" . getEntity('product') . ")";
1044
-			$sql .= " AND position = " . ((int) ($position - 1));
1042
+			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position);
1043
+			$sql .= " WHERE entity IN (".getEntity('product').")";
1044
+			$sql .= " AND position = ".((int) ($position - 1));
1045 1045
 			if ($this->db->query($sql)) {
1046
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position - 1));
1047
-				$sql .= " WHERE rowid = " . ((int) $rowid);
1046
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position - 1));
1047
+				$sql .= " WHERE rowid = ".((int) $rowid);
1048 1048
 				if (!$this->db->query($sql)) {
1049 1049
 					dol_print_error($this->db);
1050 1050
 				}
@@ -1065,12 +1065,12 @@  discard block
 block discarded – undo
1065 1065
 	public function updateAttributePositionDown($rowid, $position, $max)
1066 1066
 	{
1067 1067
 		if ($position < $max) {
1068
-			$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position);
1069
-			$sql .= " WHERE entity IN (" . getEntity('product') . ")";
1070
-			$sql .= " AND position = " . ((int) ($position + 1));
1068
+			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position);
1069
+			$sql .= " WHERE entity IN (".getEntity('product').")";
1070
+			$sql .= " AND position = ".((int) ($position + 1));
1071 1071
 			if ($this->db->query($sql)) {
1072
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position + 1));
1073
-				$sql .= " WHERE rowid = " . ((int) $rowid);
1072
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position + 1));
1073
+				$sql .= " WHERE rowid = ".((int) $rowid);
1074 1074
 				if (!$this->db->query($sql)) {
1075 1075
 					dol_print_error($this->db);
1076 1076
 				}
@@ -1088,8 +1088,8 @@  discard block
 block discarded – undo
1088 1088
 	public function getMaxAttributesPosition()
1089 1089
 	{
1090 1090
 		// Search the last position of attributes
1091
-		$sql = "SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element;
1092
-		$sql .= " WHERE entity IN (" . getEntity('product') . ")";
1091
+		$sql = "SELECT max(position) FROM ".MAIN_DB_PREFIX.$this->table_element;
1092
+		$sql .= " WHERE entity IN (".getEntity('product').")";
1093 1093
 
1094 1094
 		dol_syslog(__METHOD__, LOG_DEBUG);
1095 1095
 		$resql = $this->db->query($sql);
@@ -1135,17 +1135,17 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 		$result = '';
1137 1137
 
1138
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans("ProductAttribute") . '</u>';
1138
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans("ProductAttribute").'</u>';
1139 1139
 		if (isset($this->status)) {
1140
-			$label .= ' ' . $this->getLibStatut(5);
1140
+			$label .= ' '.$this->getLibStatut(5);
1141 1141
 		}
1142 1142
 		$label .= '<br>';
1143
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1143
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1144 1144
 		if (!empty($this->label)) {
1145
-			$label .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label;
1145
+			$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
1146 1146
 		}
1147 1147
 
1148
-		$url = dol_buildpath('/variants/card.php', 1) . '?id=' . $this->id;
1148
+		$url = dol_buildpath('/variants/card.php', 1).'?id='.$this->id;
1149 1149
 
1150 1150
 		if ($option != 'nolink') {
1151 1151
 			// Add param to save lastsearch_values or not
@@ -1162,20 +1162,20 @@  discard block
 block discarded – undo
1162 1162
 		if (empty($notooltip)) {
1163 1163
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1164 1164
 				$label = $langs->trans("ShowProductAttribute");
1165
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1165
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1166 1166
 			}
1167
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1168
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1167
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1168
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1169 1169
 		} else {
1170
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1170
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1171 1171
 		}
1172 1172
 
1173 1173
 		if ($option == 'nolink' || empty($url)) {
1174 1174
 			$linkstart = '<span';
1175 1175
 		} else {
1176
-			$linkstart = '<a href="' . $url . '"';
1176
+			$linkstart = '<a href="'.$url.'"';
1177 1177
 		}
1178
-		$linkstart .= $linkclose . '>';
1178
+		$linkstart .= $linkclose.'>';
1179 1179
 		if ($option == 'nolink' || empty($url)) {
1180 1180
 			$linkend = '</span>';
1181 1181
 		} else {
@@ -1186,29 +1186,29 @@  discard block
 block discarded – undo
1186 1186
 
1187 1187
 		if (empty($this->showphoto_on_popup)) {
1188 1188
 			if ($withpicto) {
1189
-				$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1189
+				$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1190 1190
 			}
1191 1191
 		} else {
1192 1192
 			if ($withpicto) {
1193
-				require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
1193
+				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
1194 1194
 
1195 1195
 				list($class, $module) = explode('@', $this->picto);
1196
-				$upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref);
1196
+				$upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
1197 1197
 				$filearray = dol_dir_list($upload_dir, "files");
1198 1198
 				$filename = $filearray[0]['name'];
1199 1199
 				if (!empty($filename)) {
1200 1200
 					$pospoint = strpos($filearray[0]['name'], '.');
1201 1201
 
1202
-					$pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint);
1203
-					if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) {
1204
-						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>';
1202
+					$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
1203
+					if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) {
1204
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
1205 1205
 					} else {
1206
-						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>';
1206
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
1207 1207
 					}
1208 1208
 
1209 1209
 					$result .= '</div>';
1210 1210
 				} else {
1211
-					$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1211
+					$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1212 1212
 				}
1213 1213
 			}
1214 1214
 		}
@@ -1332,9 +1332,9 @@  discard block
 block discarded – undo
1332 1332
 		$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
1333 1333
 		foreach ($dirtpls as $module => $reldir) {
1334 1334
 			if (!empty($module)) {
1335
-				$tpl = dol_buildpath($reldir . '/productattributevalueline_create.tpl.php');
1335
+				$tpl = dol_buildpath($reldir.'/productattributevalueline_create.tpl.php');
1336 1336
 			} else {
1337
-				$tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_create.tpl.php';
1337
+				$tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_create.tpl.php';
1338 1338
 			}
1339 1339
 
1340 1340
 			if (empty($conf->file->strict_mode)) {
@@ -1383,9 +1383,9 @@  discard block
 block discarded – undo
1383 1383
 			$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
1384 1384
 			foreach ($dirtpls as $module => $reldir) {
1385 1385
 				if (!empty($module)) {
1386
-					$tpl = dol_buildpath($reldir . '/productattributevalueline_title.tpl.php');
1386
+					$tpl = dol_buildpath($reldir.'/productattributevalueline_title.tpl.php');
1387 1387
 				} else {
1388
-					$tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_title.tpl.php';
1388
+					$tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_title.tpl.php';
1389 1389
 				}
1390 1390
 				if (empty($conf->file->strict_mode)) {
1391 1391
 					$res = @include $tpl;
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
 			$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
1466 1466
 			foreach ($dirtpls as $module => $reldir) {
1467 1467
 				if (!empty($module)) {
1468
-					$tpl = dol_buildpath($reldir . '/productattributevalueline_view.tpl.php');
1468
+					$tpl = dol_buildpath($reldir.'/productattributevalueline_view.tpl.php');
1469 1469
 				} else {
1470
-					$tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_view.tpl.php';
1470
+					$tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_view.tpl.php';
1471 1471
 				}
1472 1472
 
1473 1473
 				if (empty($conf->file->strict_mode)) {
@@ -1489,9 +1489,9 @@  discard block
 block discarded – undo
1489 1489
 			$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
1490 1490
 			foreach ($dirtpls as $module => $reldir) {
1491 1491
 				if (!empty($module)) {
1492
-					$tpl = dol_buildpath($reldir . '/productattributevalueline_edit.tpl.php');
1492
+					$tpl = dol_buildpath($reldir.'/productattributevalueline_edit.tpl.php');
1493 1493
 				} else {
1494
-					$tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_edit.tpl.php';
1494
+					$tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_edit.tpl.php';
1495 1495
 				}
1496 1496
 
1497 1497
 				if (empty($conf->file->strict_mode)) {
Please login to merge, or discard this patch.
htdocs/admin/agenda_other.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 $action = GETPOST('action', 'aZ09');
55 55
 $value = GETPOST('value', 'alpha');
56 56
 $label = GETPOST('label', 'alpha');
57
-$modulepart = GETPOST('modulepart', 'aZ09');	// Used by actions_setmoduleoptions.inc.php
57
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
58 58
 
59 59
 $param = GETPOST('param', 'alpha');
60 60
 $cancel = GETPOST('cancel', 'alpha');
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 						$module = new $classname($db, $specimenthirdparty);
282 282
 						'@phan-var-force ModeleAction $module';
283 283
 						if (method_exists($module, 'info')) {
284
-							print $module->info($langs);  // @phan-suppress-current-line PhanUndeclaredMethod
284
+							print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
285 285
 						} else {
286 286
 							print $module->description;
287 287
 						}
Please login to merge, or discard this patch.
htdocs/admin/agenda_reminder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 $action = GETPOST('action', 'aZ09');
50 50
 $value = GETPOST('value', 'alpha');
51 51
 $label = GETPOST('label', 'alpha');
52
-$modulepart = GETPOST('modulepart', 'aZ09');	// Used by actions_setmoduleoptions.inc.php
52
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
53 53
 
54 54
 $param = GETPOST('param', 'alpha');
55 55
 $cancel = GETPOST('cancel', 'alpha');
Please login to merge, or discard this patch.
htdocs/compta/facture/class/facture-rec.class.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		$sql .= " localtax2 = ".((float) $this->total_localtax2).",";
572 572
 		$sql .= " total_ht = ".((float) $this->total_ht).",";
573 573
 		$sql .= " total_ttc = ".((float) $this->total_ttc).",";
574
-		$sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');;
574
+		$sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL'); ;
575 575
 		// TODO Add missing fields
576 576
 		$sql .= " WHERE rowid = ".((int) $this->id);
577 577
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 				$this->titre                  = $obj->title; // deprecated
659 659
 				$this->title                  = $obj->title;
660 660
 				$this->ref                    = $obj->title;
661
-				$this->subtype				  = $obj->subtype;
661
+				$this->subtype = $obj->subtype;
662 662
 				$this->suspended              = $obj->suspended;
663 663
 				$this->total_ht               = $obj->total_ht;
664 664
 				$this->total_tva              = $obj->total_tva;
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 				$this->fk_societe_rib         = $obj->fk_societe_rib;
680 680
 				$this->note_private           = $obj->note_private;
681 681
 				$this->note_public            = $obj->note_public;
682
-				$this->user_author            = $obj->fk_user_author;	// deprecated
682
+				$this->user_author            = $obj->fk_user_author; // deprecated
683 683
 				$this->user_creation_id       = $obj->fk_user_author;
684 684
 				$this->model_pdf              = $obj->model_pdf;
685 685
 				//$this->special_code = $obj->special_code;
@@ -778,35 +778,35 @@  discard block
 block discarded – undo
778 778
 				$objp = $this->db->fetch_object($result);
779 779
 				$line = new FactureLigneRec($this->db);
780 780
 
781
-				$line->id				= $objp->rowid;
781
+				$line->id = $objp->rowid;
782 782
 				$line->rowid			= $objp->rowid;
783
-				$line->fk_facture		= $objp->fk_facture;
784
-				$line->fk_parent_line	= $objp->fk_parent_line;
783
+				$line->fk_facture = $objp->fk_facture;
784
+				$line->fk_parent_line = $objp->fk_parent_line;
785 785
 				$line->desc				= $objp->description; // Description line
786 786
 				$line->description		= $objp->description; // Description line
787
-				$line->ref				= $objp->product_ref; // Ref product
787
+				$line->ref = $objp->product_ref; // Ref product
788 788
 				$line->product_ref		= $objp->product_ref; // Ref product
789
-				$line->libelle			= $objp->product_label; // deprecated
789
+				$line->libelle = $objp->product_label; // deprecated
790 790
 				$line->product_label	= $objp->product_label; // Label product
791 791
 				$line->product_desc		= $objp->product_desc; // Description product
792 792
 				$line->product_type		= $objp->product_type; // Type of line
793
-				$line->fk_product_type	= $objp->fk_product_type; // Type of product
793
+				$line->fk_product_type = $objp->fk_product_type; // Type of product
794 794
 				$line->qty 				= $objp->qty;
795
-				$line->subprice			= $objp->subprice;
795
+				$line->subprice = $objp->subprice;
796 796
 
797 797
 				$line->label			= $objp->custom_label; // @deprecated
798 798
 
799 799
 				$line->vat_src_code		= $objp->vat_src_code;
800
-				$line->tva_tx			= $objp->tva_tx;
800
+				$line->tva_tx = $objp->tva_tx;
801 801
 				$line->localtax1_tx		= $objp->localtax1_tx;
802 802
 				$line->localtax2_tx		= $objp->localtax2_tx;
803 803
 				$line->localtax1_type	= $objp->localtax1_type;
804 804
 				$line->localtax2_type	= $objp->localtax2_type;
805 805
 				$line->remise_percent	= $objp->remise_percent;
806 806
 				//$line->fk_remise_except = $objp->fk_remise_except;
807
-				$line->fk_product		= $objp->fk_product;
808
-				$line->date_start_fill	= $objp->date_start_fill;
809
-				$line->date_end_fill	= $objp->date_end_fill;
807
+				$line->fk_product = $objp->fk_product;
808
+				$line->date_start_fill = $objp->date_start_fill;
809
+				$line->date_end_fill = $objp->date_end_fill;
810 810
 				$line->info_bits		= $objp->info_bits;
811 811
 				$line->total_ht			= $objp->total_ht;
812 812
 				$line->total_tva		= $objp->total_tva;
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
 				$line->marge_tx			= (string) $marginInfos[1];
823 823
 				$line->marque_tx		= (string) $marginInfos[2];
824 824
 				$line->rang				= $objp->rang;
825
-				$line->special_code		= $objp->special_code;
826
-				$line->fk_unit			= $objp->fk_unit;
827
-				$line->fk_contract_line	= $objp->fk_contract_line;
825
+				$line->special_code = $objp->special_code;
826
+				$line->fk_unit = $objp->fk_unit;
827
+				$line->fk_contract_line = $objp->fk_contract_line;
828 828
 
829 829
 				// Ne plus utiliser
830
-				$line->price			= $objp->price;
831
-				$line->remise			= $objp->remise;
830
+				$line->price = $objp->price;
831
+				$line->remise = $objp->remise;
832 832
 
833 833
 				$line->fetch_optionals();
834 834
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 
1422 1422
 					$facture->type = self::TYPE_STANDARD;
1423 1423
 					$facture->subtype = $facturerec->subtype;
1424
-					$facture->statut = self::STATUS_DRAFT;	// deprecated
1424
+					$facture->statut = self::STATUS_DRAFT; // deprecated
1425 1425
 					$facture->status = self::STATUS_DRAFT;
1426 1426
 					$facture->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.
1427 1427
 					$facture->socid = $facturerec->socid;
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
 		}
1573 1573
 		$result .= $linkend;
1574 1574
 		global $action;
1575
-		$hookmanager->initHooks(array($this->element . 'dao'));
1575
+		$hookmanager->initHooks(array($this->element.'dao'));
1576 1576
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1577 1577
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1578 1578
 		if ($reshook > 0) {
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
 
1832 1832
 		if (empty($option) || $option != 'nolines') {
1833 1833
 			// Lines
1834
-			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
1834
+			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
1835 1835
 			$xnbp = 0;
1836 1836
 			while ($xnbp < $nbp) {
1837 1837
 				$line = new FactureLigne($this->db);
@@ -2023,7 +2023,7 @@  discard block
 block discarded – undo
2023 2023
 					$resSuspend = $this->setValueFrom('suspended', 1);
2024 2024
 
2025 2025
 					if ($resSuspend <= 0) {
2026
-						dol_syslog(__METHOD__ . '::setValueFrom Error : ' . $this->error, LOG_ERR);
2026
+						dol_syslog(__METHOD__.'::setValueFrom Error : '.$this->error, LOG_ERR);
2027 2027
 						return -1;
2028 2028
 					}
2029 2029
 				}
@@ -2363,9 +2363,9 @@  discard block
 block discarded – undo
2363 2363
 		if ($result) {
2364 2364
 			$objp = $this->db->fetch_object($result);
2365 2365
 
2366
-			$this->id				= $objp->rowid;
2367
-			$this->fk_facture		= $objp->fk_facture;
2368
-			$this->fk_parent_line	= $objp->fk_parent_line;
2366
+			$this->id = $objp->rowid;
2367
+			$this->fk_facture = $objp->fk_facture;
2368
+			$this->fk_parent_line = $objp->fk_parent_line;
2369 2369
 			$this->label            = $objp->custom_label; // Label line
2370 2370
 			$this->desc             = $objp->description; // Description line
2371 2371
 			$this->description      = $objp->description; // Description line
Please login to merge, or discard this patch.
htdocs/accountancy/class/lettering.class.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 
312 312
 		// Check partial / normal lettering case
313 313
 		$sql = "SELECT ab.lettering_code, GROUP_CONCAT(DISTINCT ab.rowid SEPARATOR ',') AS bookkeeping_ids";
314
-		$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
315
-		$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
314
+		$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab";
315
+		$sql .= " WHERE ab.rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
316 316
 		$sql .= " GROUP BY ab.lettering_code";
317 317
 		$sql .= " ORDER BY ab.lettering_code DESC";
318 318
 
319
-		dol_syslog(__METHOD__ . " - Check partial / normal lettering case", LOG_DEBUG);
319
+		dol_syslog(__METHOD__." - Check partial / normal lettering case", LOG_DEBUG);
320 320
 		$resql = $this->db->query($sql);
321 321
 		if ($resql) {
322 322
 			while ($obj = $this->db->fetch_object($resql)) {
@@ -331,16 +331,16 @@  discard block
 block discarded – undo
331 331
 					}
332 332
 				} elseif (!$partial && preg_match('/^[a-z]+$/', $obj->lettering_code)) {
333 333
 					// Delete partial lettering code if set normal lettering
334
-					$sql2 = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
334
+					$sql2 = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
335 335
 					$sql2 .= " lettering_code = NULL";
336 336
 					$sql2 .= ", date_lettering = NULL";
337
-					$sql2 .= " WHERE entity IN (" . getEntity('accountancy') . ")";
338
-					$sql2 .= " AND lettering_code = '" . $this->db->escape($obj->lettering_code) . "'";
337
+					$sql2 .= " WHERE entity IN (".getEntity('accountancy').")";
338
+					$sql2 .= " AND lettering_code = '".$this->db->escape($obj->lettering_code)."'";
339 339
 
340
-					dol_syslog(__METHOD__ . " - Remove partial lettering", LOG_DEBUG);
340
+					dol_syslog(__METHOD__." - Remove partial lettering", LOG_DEBUG);
341 341
 					$resql2 = $this->db->query($sql2);
342 342
 					if (!$resql2) {
343
-						$this->errors[] = 'Error' . $this->db->lasterror();
343
+						$this->errors[] = 'Error'.$this->db->lasterror();
344 344
 						$error++;
345 345
 						break;
346 346
 					}
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 			}
349 349
 			$this->db->free($resql);
350 350
 		} else {
351
-			$this->errors[] = 'Error' . $this->db->lasterror();
351
+			$this->errors[] = 'Error'.$this->db->lasterror();
352 352
 			$error++;
353 353
 		}
354 354
 
355 355
 		if (!$error && !empty($ids)) {
356 356
 			// Get next code
357 357
 			$sql = "SELECT DISTINCT ab2.lettering_code";
358
-			$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
359
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
360
-			$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
358
+			$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab";
359
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
360
+			$sql .= " WHERE ab.rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
361 361
 			$sql .= " AND ab2.lettering_code != ''";
362 362
 			$sql .= " ORDER BY ab2.lettering_code DESC";
363 363
 
364
-			dol_syslog(__METHOD__ . " - Get next code", LOG_DEBUG);
364
+			dol_syslog(__METHOD__." - Get next code", LOG_DEBUG);
365 365
 			$resql = $this->db->query($sql);
366 366
 			if ($resql) {
367 367
 				while ($obj = $this->db->fetch_object($resql)) {
@@ -376,43 +376,43 @@  discard block
 block discarded – undo
376 376
 				}
377 377
 				$this->db->free($resql);
378 378
 			} else {
379
-				$this->errors[] = 'Error' . $this->db->lasterror();
379
+				$this->errors[] = 'Error'.$this->db->lasterror();
380 380
 				$error++;
381 381
 			}
382 382
 
383 383
 			// Test amount integrity
384 384
 			if (!$error && !$partial) {
385
-				$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
386
-				$sql .= " rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''";
385
+				$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
386
+				$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
387 387
 
388
-				dol_syslog(__METHOD__ . " - Test amount integrity", LOG_DEBUG);
388
+				dol_syslog(__METHOD__." - Test amount integrity", LOG_DEBUG);
389 389
 				$resql = $this->db->query($sql);
390 390
 				if ($resql) {
391 391
 					if ($obj = $this->db->fetch_object($resql)) {
392 392
 						if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
393
-							$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
393
+							$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
394 394
 							$error++;
395 395
 						}
396 396
 					}
397 397
 					$this->db->free($resql);
398 398
 				} else {
399
-					$this->errors[] = 'Erreur sql' . $this->db->lasterror();
399
+					$this->errors[] = 'Erreur sql'.$this->db->lasterror();
400 400
 					$error++;
401 401
 				}
402 402
 			}
403 403
 
404 404
 			// Update lettering code
405 405
 			if (!$error) {
406
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
407
-				$sql .= " lettering_code='" . $this->db->escape($letter) . "'";
408
-				$sql .= ", date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
409
-				$sql .= "  WHERE rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''";
406
+				$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
407
+				$sql .= " lettering_code='".$this->db->escape($letter)."'";
408
+				$sql .= ", date_lettering = '".$this->db->idate($now)."'"; // todo correct date it's false
409
+				$sql .= "  WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
410 410
 
411
-				dol_syslog(__METHOD__ . " - Update lettering code", LOG_DEBUG);
411
+				dol_syslog(__METHOD__." - Update lettering code", LOG_DEBUG);
412 412
 				$resql = $this->db->query($sql);
413 413
 				if (!$resql) {
414 414
 					$error++;
415
-					$this->errors[] = "Error " . $this->db->lasterror();
415
+					$this->errors[] = "Error ".$this->db->lasterror();
416 416
 				} else {
417 417
 					$affected_rows = $this->db->affected_rows($resql);
418 418
 				}
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 		if ($error) {
424 424
 			$this->db->rollback();
425 425
 			foreach ($this->errors as $errmsg) {
426
-				dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
427
-				$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
426
+				dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
427
+				$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
428 428
 			}
429 429
 			return -1 * $error;
430 430
 		} else {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	public function bookkeepingLetteringAll($bookkeeping_ids, $unlettering = false)
479 479
 	{
480
-		dol_syslog(__METHOD__ . " - ", LOG_DEBUG);
480
+		dol_syslog(__METHOD__." - ", LOG_DEBUG);
481 481
 
482 482
 		$error = 0;
483 483
 		$errors = array();
@@ -603,16 +603,16 @@  discard block
 block discarded – undo
603 603
 
604 604
 		// Get all bookkeeping lines
605 605
 		$sql = "SELECT DISTINCT ab.doc_type, ab.fk_doc";
606
-		$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
607
-		$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
606
+		$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab";
607
+		$sql .= " WHERE ab.entity IN (".getEntity('accountancy').")";
608 608
 		$sql .= " AND ab.fk_doc > 0";
609 609
 		if (!empty($bookkeeping_ids)) {
610 610
 			// Get all bookkeeping lines of piece number
611 611
 			$sql .= " AND EXISTS (";
612 612
 			$sql .= "  SELECT rowid";
613
-			$sql .= "  FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS pn";
614
-			$sql .= "  WHERE pn.entity IN (" . getEntity('accountancy') . ")";
615
-			$sql .= "  AND pn.rowid IN (" . $this->db->sanitize(implode(',', $bookkeeping_ids)) . ")";
613
+			$sql .= "  FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS pn";
614
+			$sql .= "  WHERE pn.entity IN (".getEntity('accountancy').")";
615
+			$sql .= "  AND pn.rowid IN (".$this->db->sanitize(implode(',', $bookkeeping_ids)).")";
616 616
 			$sql .= "  AND pn.piece_num = ab.piece_num";
617 617
 			$sql .= " )";
618 618
 		}
@@ -620,10 +620,10 @@  discard block
 block discarded – undo
620 620
 			$sql .= " AND ab.subledger_account != ''";
621 621
 		}
622 622
 
623
-		dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG);
623
+		dol_syslog(__METHOD__." - Get all bookkeeping lines", LOG_DEBUG);
624 624
 		$resql = $this->db->query($sql);
625 625
 		if (!$resql) {
626
-			$this->errors[] = "Error " . $this->db->lasterror();
626
+			$this->errors[] = "Error ".$this->db->lasterror();
627 627
 			return -1;
628 628
 		}
629 629
 
@@ -670,25 +670,25 @@  discard block
 block discarded – undo
670 670
 
671 671
 				// Get all bookkeeping lines linked
672 672
 				$sql = "SELECT DISTINCT ab.rowid, ab.piece_num, ab.debit, ab.credit, ab.lettering_code";
673
-				$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
674
-				$sql .= " WHERE ab.entity IN (" . getEntity('accountancy') . ")";
673
+				$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS ab";
674
+				$sql .= " WHERE ab.entity IN (".getEntity('accountancy').")";
675 675
 				$sql .= " AND (";
676 676
 				if (!empty($bank_ids)) {
677 677
 					$sql .= " EXISTS (";
678 678
 					$sql .= "  SELECT bpn.rowid";
679
-					$sql .= "  FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS bpn";
680
-					$sql .= "  WHERE bpn.entity IN (" . getEntity('accountancy') . ")";
679
+					$sql .= "  FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS bpn";
680
+					$sql .= "  WHERE bpn.entity IN (".getEntity('accountancy').")";
681 681
 					$sql .= "  AND bpn.doc_type = 'bank'";
682
-					$sql .= "  AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
682
+					$sql .= "  AND bpn.fk_doc IN (".$this->db->sanitize(implode(',', $bank_ids)).")";
683 683
 					$sql .= "  AND bpn.piece_num = ab.piece_num";
684 684
 					$sql .= " ) OR ";
685 685
 				}
686 686
 				$sql .= " EXISTS (";
687 687
 				$sql .= "  SELECT dpn.rowid";
688
-				$sql .= "  FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS dpn";
689
-				$sql .= "  WHERE dpn.entity IN (" . getEntity('accountancy') . ")";
690
-				$sql .= "  AND dpn.doc_type = '" . $this->db->escape($doc_type) . "'";
691
-				$sql .= "  AND dpn.fk_doc IN (" . $this->db->sanitize(implode(',', $doc_ids)) . ")";
688
+				$sql .= "  FROM ".MAIN_DB_PREFIX."accounting_bookkeeping AS dpn";
689
+				$sql .= "  WHERE dpn.entity IN (".getEntity('accountancy').")";
690
+				$sql .= "  AND dpn.doc_type = '".$this->db->escape($doc_type)."'";
691
+				$sql .= "  AND dpn.fk_doc IN (".$this->db->sanitize(implode(',', $doc_ids)).")";
692 692
 				$sql .= "  AND dpn.piece_num = ab.piece_num";
693 693
 				$sql .= " )";
694 694
 				$sql .= ")";
@@ -696,10 +696,10 @@  discard block
 block discarded – undo
696 696
 					$sql .= " AND ab.subledger_account != ''";
697 697
 				}
698 698
 
699
-				dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG);
699
+				dol_syslog(__METHOD__." - Get all bookkeeping lines linked", LOG_DEBUG);
700 700
 				$resql = $this->db->query($sql);
701 701
 				if (!$resql) {
702
-					$this->errors[] = "Error " . $this->db->lasterror();
702
+					$this->errors[] = "Error ".$this->db->lasterror();
703 703
 					return -1;
704 704
 				}
705 705
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	 */
733 733
 	public function getDocTypeAndFkDocFromBankLines($bank_ids)
734 734
 	{
735
-		dol_syslog(__METHOD__ . " - bank_ids=".json_encode($bank_ids), LOG_DEBUG);
735
+		dol_syslog(__METHOD__." - bank_ids=".json_encode($bank_ids), LOG_DEBUG);
736 736
 
737 737
 		// Clean parameters
738 738
 		$bank_ids = is_array($bank_ids) ? $bank_ids : array();
@@ -744,16 +744,16 @@  discard block
 block discarded – undo
744 744
 		$bookkeeping_lines_by_type = array();
745 745
 		foreach (self::$doc_type_infos as $doc_type => $doc_type_info) {
746 746
 			// Get all fk_doc by doc_type from bank ids
747
-			$sql = "SELECT DISTINCT dp." . $this->db->sanitize($doc_type_info['doc_payment_table_fk_doc']) . " AS fk_doc";
748
-			$sql .= " FROM " . MAIN_DB_PREFIX . $this->db->sanitize($doc_type_info['payment_table']) . " AS p";
749
-			$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($doc_type_info['doc_payment_table']) . " AS dp ON dp." . $this->db->sanitize($doc_type_info['doc_payment_table_fk_payment']) . " = p.rowid";
750
-			$sql .= " WHERE p." . $this->db->sanitize($doc_type_info['payment_table_fk_bank']) . " IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
751
-			$sql .= " AND dp." . $this->db->sanitize($doc_type_info['doc_payment_table_fk_doc']) . " > 0";
747
+			$sql = "SELECT DISTINCT dp.".$this->db->sanitize($doc_type_info['doc_payment_table_fk_doc'])." AS fk_doc";
748
+			$sql .= " FROM ".MAIN_DB_PREFIX.$this->db->sanitize($doc_type_info['payment_table'])." AS p";
749
+			$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->db->sanitize($doc_type_info['doc_payment_table'])." AS dp ON dp.".$this->db->sanitize($doc_type_info['doc_payment_table_fk_payment'])." = p.rowid";
750
+			$sql .= " WHERE p.".$this->db->sanitize($doc_type_info['payment_table_fk_bank'])." IN (".$this->db->sanitize(implode(',', $bank_ids)).")";
751
+			$sql .= " AND dp.".$this->db->sanitize($doc_type_info['doc_payment_table_fk_doc'])." > 0";
752 752
 
753
-			dol_syslog(__METHOD__ . " - Get all fk_doc by doc_type from list of bank ids for '" . $doc_type . "'", LOG_DEBUG);
753
+			dol_syslog(__METHOD__." - Get all fk_doc by doc_type from list of bank ids for '".$doc_type."'", LOG_DEBUG);
754 754
 			$resql = $this->db->query($sql);
755 755
 			if (!$resql) {
756
-				$this->errors[] = "Error " . $this->db->lasterror();
756
+				$this->errors[] = "Error ".$this->db->lasterror();
757 757
 				return -1;
758 758
 			}
759 759
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	{
778 778
 		global $langs;
779 779
 
780
-		dol_syslog(__METHOD__ . " - bank_ids=".json_encode($document_ids) . ", doc_type=$doc_type", LOG_DEBUG);
780
+		dol_syslog(__METHOD__." - bank_ids=".json_encode($document_ids).", doc_type=$doc_type", LOG_DEBUG);
781 781
 
782 782
 		// Clean parameters
783 783
 		$document_ids = is_array($document_ids) ? $document_ids : array();
@@ -799,17 +799,17 @@  discard block
 block discarded – undo
799 799
 		$bank_ids = array();
800 800
 
801 801
 		// Get all fk_doc by doc_type from bank ids
802
-		$sql = "SELECT DISTINCT p." . $this->db->sanitize($doc_type_info['payment_table_fk_bank']) . " AS fk_doc";
803
-		$sql .= " FROM " . MAIN_DB_PREFIX . $this->db->sanitize($doc_type_info['payment_table']) . " AS p";
804
-		$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($doc_type_info['doc_payment_table']) . " AS dp ON dp." . $this->db->sanitize($doc_type_info['doc_payment_table_fk_payment']) . " = p.rowid";
802
+		$sql = "SELECT DISTINCT p.".$this->db->sanitize($doc_type_info['payment_table_fk_bank'])." AS fk_doc";
803
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->db->sanitize($doc_type_info['payment_table'])." AS p";
804
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->db->sanitize($doc_type_info['doc_payment_table'])." AS dp ON dp.".$this->db->sanitize($doc_type_info['doc_payment_table_fk_payment'])." = p.rowid";
805 805
 		// Implode used on array of int @phan-suppress-next-line PhanTypeMismatchArgumentInternal
806
-		$sql .= " WHERE dp." . $this->db->sanitize($doc_type_info['doc_payment_table_fk_doc']) . " IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
807
-		$sql .= " AND p." . $this->db->sanitize($doc_type_info['payment_table_fk_bank']) . " > 0";
806
+		$sql .= " WHERE dp.".$this->db->sanitize($doc_type_info['doc_payment_table_fk_doc'])." IN (".$this->db->sanitize(implode(',', $document_ids)).")";
807
+		$sql .= " AND p.".$this->db->sanitize($doc_type_info['payment_table_fk_bank'])." > 0";
808 808
 
809
-		dol_syslog(__METHOD__ . " - Get all bank ids from list of document ids of a type '" . $doc_type . "'", LOG_DEBUG);
809
+		dol_syslog(__METHOD__." - Get all bank ids from list of document ids of a type '".$doc_type."'", LOG_DEBUG);
810 810
 		$resql = $this->db->query($sql);
811 811
 		if (!$resql) {
812
-			$this->errors[] = "Error " . $this->db->lasterror();
812
+			$this->errors[] = "Error ".$this->db->lasterror();
813 813
 			return -1;
814 814
 		}
815 815
 
@@ -864,26 +864,26 @@  discard block
 block discarded – undo
864 864
 				$sql = "SELECT DISTINCT tl2.fk_link, tl2.fk_doc";
865 865
 				$sql .= " FROM (";
866 866
 				// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
867
-				$sql .= "   SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
868
-				$sql .= "   FROM " . MAIN_DB_PREFIX .$this->db->sanitize($linked_info['table'])." AS tl";
867
+				$sql .= "   SELECT DISTINCT ".$this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
868
+				$sql .= "   FROM ".MAIN_DB_PREFIX.$this->db->sanitize($linked_info['table'])." AS tl";
869 869
 				// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
870
-				$sql .= "   LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($linked_info['table_link_line']) . " AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line']) . " = tl.".$this->db->sanitize($linked_info['fk_line_link']);
870
+				$sql .= "   LEFT JOIN ".MAIN_DB_PREFIX.$this->db->sanitize($linked_info['table_link_line'])." AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line'])." = tl.".$this->db->sanitize($linked_info['fk_line_link']);
871 871
 				$sql .= ") AS tl";
872 872
 				$sql .= " LEFT JOIN (";
873 873
 				// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
874
-				$sql .= "   SELECT DISTINCT " . $this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
875
-				$sql .= "   FROM " . MAIN_DB_PREFIX .$this->db->sanitize($linked_info['table'])." AS tl";
874
+				$sql .= "   SELECT DISTINCT ".$this->db->ifsql("tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent'])." IS NOT NULL", "tll.".$this->db->sanitize($linked_info['fk_table_link_line_parent']), "tl.".$this->db->sanitize($linked_info['fk_link']))." AS fk_link, tl.".$this->db->sanitize($linked_info['fk_doc'])." AS fk_doc";
875
+				$sql .= "   FROM ".MAIN_DB_PREFIX.$this->db->sanitize($linked_info['table'])." AS tl";
876 876
 				// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
877
-				$sql .= "   LEFT JOIN " . MAIN_DB_PREFIX . $this->db->sanitize($linked_info['table_link_line']) . " AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line']) . " = tl.".$this->db->sanitize($linked_info['fk_line_link']);
877
+				$sql .= "   LEFT JOIN ".MAIN_DB_PREFIX.$this->db->sanitize($linked_info['table_link_line'])." AS tll ON tll.".$this->db->sanitize($linked_info['fk_table_link_line'])." = tl.".$this->db->sanitize($linked_info['fk_line_link']);
878 878
 				$sql .= ") AS tl2 ON tl2.fk_link = tl.fk_link";
879
-				$sql .= " WHERE tl.fk_doc IN (" . $this->db->sanitize(implode(',', $document_ids)) . ")";
879
+				$sql .= " WHERE tl.fk_doc IN (".$this->db->sanitize(implode(',', $document_ids)).")";
880 880
 				$sql .= " AND tl2.fk_doc IS NOT NULL";
881 881
 			}
882 882
 
883
-			dol_syslog(__METHOD__ . " - Get document lines", LOG_DEBUG);
883
+			dol_syslog(__METHOD__." - Get document lines", LOG_DEBUG);
884 884
 			$resql = $this->db->query($sql);
885 885
 			if (!$resql) {
886
-				$this->errors[] = "Error " . $this->db->lasterror();
886
+				$this->errors[] = "Error ".$this->db->lasterror();
887 887
 				return -1;
888 888
 			}
889 889
 
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 			while ($obj = $this->db->fetch_object($resql)) {
892 892
 				$current_document_ids[$obj->fk_doc] = $obj->fk_doc;
893 893
 
894
-				$link_key = $linked_info['prefix'] . $obj->fk_link;
894
+				$link_key = $linked_info['prefix'].$obj->fk_link;
895 895
 				$element_by_link[$link_key][$obj->fk_doc] = $obj->fk_doc;
896 896
 				$link_by_element[$obj->fk_doc][$link_key] = $link_key;
897 897
 				if ($is_fk_link_is_also_fk_doc) {
@@ -967,8 +967,8 @@  discard block
 block discarded – undo
967 967
 
968 968
 		if (empty($link_key)) {
969 969
 			// Restore list when is the begin of recursive function
970
-			$link_by_element = $save_link_by_element;  // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
971
-			$element_by_link = $save_element_by_link;  // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
970
+			$link_by_element = $save_link_by_element; // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
971
+			$element_by_link = $save_element_by_link; // @phan-suppress-current-line PhanPossiblyUndeclaredVariable
972 972
 		}
973 973
 
974 974
 		return $grouped_elements;
Please login to merge, or discard this patch.
htdocs/core/lib/pdf.lib.php 1 patch
Spacing   +23 added lines, -25 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	//$metric=$arrayformat['unit'];
182 182
 
183 183
 	//$pdfa = false; // PDF default version
184
-	$pdfa = getDolGlobalInt('PDF_USE_A', 0); 	// PDF/A-1 ou PDF/A-3
184
+	$pdfa = getDolGlobalInt('PDF_USE_A', 0); // PDF/A-1 ou PDF/A-3
185 185
 
186 186
 	if (!getDolGlobalString('MAIN_DISABLE_TCPDI') && class_exists('TCPDI')) {
187 187
 		$pdf = new TCPDI($pagetype, $metric, $format, true, 'UTF-8', false, $pdfa);
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				$stringaddress .= ($stringaddress ? "\n" : '').$tmp.': '.$outputlangs->convToOutputCharset($sourcecompany->idprof6);
536 536
 			}
537 537
 			if (getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS')) {
538
-				$stringaddress .= ($stringaddress ? "\n" : '') . getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
538
+				$stringaddress .= ($stringaddress ? "\n" : '').getDolGlobalString('PDF_ADD_MORE_AFTER_SOURCE_ADDRESS');
539 539
 			}
540 540
 		}
541 541
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 				if ($usecontact && is_object($targetcontact) && getDolGlobalInt('MAIN_USE_COMPANY_NAME_OF_CONTACT')) {
646 646
 					$targetcontact->fetch_thirdparty();
647 647
 					if (!empty($targetcontact->thirdparty->id) && $targetcontact->thirdparty->tva_intra) {
648
-						$stringaddress .= ($stringaddress ? "\n" : '') . $outputlangs->transnoentities("VATIntraShort") . ': ' . $outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
648
+						$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcontact->thirdparty->tva_intra);
649 649
 					}
650 650
 				} elseif (!empty($targetcompany->tva_intra)) {
651 651
 					$stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($targetcompany->tva_intra);
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
 	// Add a background image on document only if good setup of const
734 734
 	if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') && (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF') != '-1')) {		// Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
735
-		$filepath = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF');
735
+		$filepath = $conf->mycompany->dir_output.'/logos/'.getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF');
736 736
 		if (file_exists($filepath)) {
737 737
 			$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
738 738
 			if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	$outputlangs->load("dict");
1032 1032
 	$line = '';
1033 1033
 	$reg = array();
1034
-	$marginwithfooter = 0;  // Return value
1034
+	$marginwithfooter = 0; // Return value
1035 1035
 
1036 1036
 	$dims = $pdf->getPageDimensions();
1037 1037
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
1165 1165
 	}
1166 1166
 	// Prof Id 6
1167
-	if (!empty($fromcompany->idprof6) &&  $fromcompany->idprof6) {
1167
+	if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
1168 1168
 		$field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code);
1169 1169
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1170 1170
 			$field = $reg[1];
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
1173 1173
 	}
1174 1174
 	// Prof Id 7
1175
-	if (!empty($fromcompany->idprof7) &&  $fromcompany->idprof7) {
1175
+	if (!empty($fromcompany->idprof7) && $fromcompany->idprof7) {
1176 1176
 		$field = $outputlangs->transcountrynoentities("ProfId7", $fromcompany->country_code);
1177 1177
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1178 1178
 			$field = $reg[1];
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof7);
1181 1181
 	}
1182 1182
 	// Prof Id 8
1183
-	if (!empty($fromcompany->idprof8) &&  $fromcompany->idprof8) {
1183
+	if (!empty($fromcompany->idprof8) && $fromcompany->idprof8) {
1184 1184
 		$field = $outputlangs->transcountrynoentities("ProfId8", $fromcompany->country_code);
1185 1185
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1186 1186
 			$field = $reg[1];
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof8);
1189 1189
 	}
1190 1190
 	// Prof Id 9
1191
-	if (!empty($fromcompany->idprof9) &&  $fromcompany->idprof9) {
1191
+	if (!empty($fromcompany->idprof9) && $fromcompany->idprof9) {
1192 1192
 		$field = $outputlangs->transcountrynoentities("ProfId9", $fromcompany->country_code);
1193 1193
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1194 1194
 			$field = $reg[1];
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof9);
1197 1197
 	}
1198 1198
 	// Prof Id 10
1199
-	if (!empty($fromcompany->idprof10) &&  $fromcompany->idprof10) {
1199
+	if (!empty($fromcompany->idprof10) && $fromcompany->idprof10) {
1200 1200
 		$field = $outputlangs->transcountrynoentities("ProfId10", $fromcompany->country_code);
1201 1201
 		if (preg_match('/\((.*)\)/i', $field, $reg)) {
1202 1202
 			$field = $reg[1];
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 		$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof10);
1205 1205
 	}
1206 1206
 	// IntraCommunautary VAT
1207
-	if (!empty($fromcompany->tva_intra)  && $fromcompany->tva_intra != '') {
1207
+	if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra != '') {
1208 1208
 		$line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
1209 1209
 	}
1210 1210
 
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 	$pagination = $pdf->PageNo().' / '.$pdf->getAliasNbPages();
1377 1377
 	$fontRenderCorrection = 0;
1378
-	if (in_array(pdf_getPDFFont($outputlangs), array('freemono',  'DejaVuSans'))) {
1378
+	if (in_array(pdf_getPDFFont($outputlangs), array('freemono', 'DejaVuSans'))) {
1379 1379
 		$fontRenderCorrection = 10;
1380 1380
 	}
1381 1381
 	$pdf->MultiCell(18 + $fontRenderCorrection, 2, $pagination, 0, 'R', 0);
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 
1473 1473
 		if (getDolGlobalString('MARGIN_TOP_ZERO_UL')) {
1474 1474
 			$pdf->setListIndentWidth(5);
1475
-			$TMarginList = ['ul' => [['h' => 0.1, ],['h' => 0.1, ]], 'li' => [['h' => 0.1, ],],];
1475
+			$TMarginList = ['ul' => [['h' => 0.1, ], ['h' => 0.1, ]], 'li' => [['h' => 0.1, ], ], ];
1476 1476
 			$pdf->setHtmlVSpace($TMarginList);
1477 1477
 		}
1478 1478
 
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 		$prodser = new Product($db);
1515 1515
 
1516 1516
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
1517
-			include_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
1517
+			include_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
1518 1518
 		}
1519 1519
 	}
1520 1520
 
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 		$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
1562 1562
 	}
1563 1563
 
1564
-	$libelleproduitservice = '';  // Default value
1564
+	$libelleproduitservice = ''; // Default value
1565 1565
 	if (!getDolGlobalString('PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES')) {
1566 1566
 		// Description short of product line
1567 1567
 		$libelleproduitservice = $label;
@@ -1595,8 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 					$libelleproduitservice = dol_concatdesc(
1596 1596
 						dol_concatdesc($libelleproduitservice, " * ".$subprodval[3]),
1597 1597
 						(!empty($qtyText) ?
1598
-							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
1599
-							$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1598
+							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1600 1599
 					);
1601 1600
 				}
1602 1601
 			} else {
@@ -1604,8 +1603,7 @@  discard block
 block discarded – undo
1604 1603
 					$libelleproduitservice = dol_concatdesc(
1605 1604
 						dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]),
1606 1605
 						(!empty($qtyText) ?
1607
-							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText :
1608
-							$outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1606
+							$outputlangs->trans('Qty').':'.$qtyText.' x '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1].'= '.$outputlangs->trans('QtyTot').':'.$subprodval[1] * $qtyText : $outputlangs->trans('Qty').' '.$outputlangs->trans('AssociatedProducts').':'.$subprodval[1])
1609 1607
 					);
1610 1608
 				}
1611 1609
 			}
@@ -1708,11 +1706,11 @@  discard block
 block discarded – undo
1708 1706
 								break;
1709 1707
 
1710 1708
 							case 2:
1711
-								$ref_prodserv = $productCustomerPrice->ref_customer . ' (' . $outputlangs->transnoentitiesnoconv('InternalRef') . ' ' . $ref_prodserv . ')';
1709
+								$ref_prodserv = $productCustomerPrice->ref_customer.' ('.$outputlangs->transnoentitiesnoconv('InternalRef').' '.$ref_prodserv.')';
1712 1710
 								break;
1713 1711
 
1714 1712
 							default:
1715
-								$ref_prodserv = $ref_prodserv . ' (' . $outputlangs->transnoentitiesnoconv('RefCustomer') . ' ' . $productCustomerPrice->ref_customer . ')';
1713
+								$ref_prodserv = $ref_prodserv.' ('.$outputlangs->transnoentitiesnoconv('RefCustomer').' '.$productCustomerPrice->ref_customer.')';
1716 1714
 						}
1717 1715
 					}
1718 1716
 				}
@@ -2575,7 +2573,7 @@  discard block
 block discarded – undo
2575 2573
 						}
2576 2574
 					}
2577 2575
 					$refListsTxt .= (!empty($refListsTxt) ? ' ' : '');
2578
-					if (! is_object($order)) {
2576
+					if (!is_object($order)) {
2579 2577
 						$refListsTxt .= $outputlangs->transnoentities($elementobject->ref);
2580 2578
 					} else {
2581 2579
 						$refListsTxt .= $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : '');
@@ -2602,7 +2600,7 @@  discard block
 block discarded – undo
2602 2600
 					}
2603 2601
 				}
2604 2602
 
2605
-				if (! is_object($order)) {
2603
+				if (!is_object($order)) {
2606 2604
 					$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
2607 2605
 					if (empty($linkedobjects[$objecttype]['ref_value'])) {
2608 2606
 						$linkedobjects[$objecttype]['ref_value'] = '';
@@ -2632,7 +2630,7 @@  discard block
 block discarded – undo
2632 2630
 		$reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
2633 2631
 		if (empty($reshook)) {
2634 2632
 			$linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys
2635
-		} elseif ($reshook>0) {
2633
+		} elseif ($reshook > 0) {
2636 2634
 			// The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook.
2637 2635
 			$linkedobjects = $hookmanager->resArray;
2638 2636
 		}
@@ -2709,7 +2707,7 @@  discard block
 block discarded – undo
2709 2707
 				if (isset($hookmanager->resArray['linetotalremise'])) {
2710 2708
 					return (float) $hookmanager->resArray['linetotalremise'];
2711 2709
 				} else {
2712
-					return (float) $hookmanager->resPrint;	// For backward compatibility
2710
+					return (float) $hookmanager->resPrint; // For backward compatibility
2713 2711
 				}
2714 2712
 			}
2715 2713
 		}
Please login to merge, or discard this patch.
build/phpstan/bootstrap_action.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
 }
28 28
 
29 29
 // Defined some constants and load Dolibarr env to reduce PHPStan bootstrap that fails to load a lot of things.
30
-$dolibarr_main_document_root = __DIR__ . '/../../htdocs';
31
-define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
32
-define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
30
+$dolibarr_main_document_root = __DIR__.'/../../htdocs';
31
+define('DOL_DOCUMENT_ROOT', __DIR__.'/../../htdocs');
32
+define('DOL_DATA_ROOT', __DIR__.'/../../documents');
33 33
 define('DOL_URL_ROOT', '/');
34 34
 define('DOL_MAIN_URL_ROOT', '/');
35 35
 define('MAIN_DB_PREFIX', 'llx_');
Please login to merge, or discard this patch.