Completed
Branch develop (d8116b)
by
unknown
20:02
created
htdocs/contact/consumption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -366,7 +366,7 @@
 block discarded – undo
366 366
 $param .= "&type_element=".urlencode($type_element);
367 367
 
368 368
 $total_qty = 0;
369
-$num=0;
369
+$num = 0;
370 370
 if ($sql_select) {
371 371
 	$resql = $db->query($sql);
372 372
 	if (!$resql) {
Please login to merge, or discard this patch.
htdocs/core/tpl/extrafields_list_search_sql.tpl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 				$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'";
34 34
 			} elseif (is_array($crit)) {
35 35
 				if ($crit['start'] !== '' && $crit['end'] !== '') {
36
-					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." BETWEEN '". $db->idate($crit['start']). "' AND '".$db->idate($crit['end']) . "')";
36
+					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." BETWEEN '".$db->idate($crit['start'])."' AND '".$db->idate($crit['end'])."')";
37 37
 				} elseif ($crit['start'] !== '') {
38
-					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." >= '". $db->idate($crit['start'])."')";
38
+					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." >= '".$db->idate($crit['start'])."')";
39 39
 				} elseif ($crit['end'] !== '') {
40
-					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." <= '". $db->idate($crit['end'])."')";
40
+					$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." <= '".$db->idate($crit['end'])."')";
41 41
 				}
42 42
 			}
43 43
 		} elseif (in_array($typ, array('boolean'))) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				$mode_search = 2; // Search on a foreign key int
58 58
 			}
59 59
 			if (in_array($typ, array('sellist')) && !is_numeric($crit)) {
60
-				$mode_search = 0;// Search on a foreign key string
60
+				$mode_search = 0; // Search on a foreign key string
61 61
 			}
62 62
 			if (in_array($typ, array('chkbxlst', 'checkbox', 'select'))) {
63 63
 				$mode_search = 4; // Search on a multiselect field with sql type = text
Please login to merge, or discard this patch.
htdocs/core/class/cgenericdic.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
 	/**
34 34
 	 * @var string Id to identify managed objects
35 35
 	 */
36
-	public $element = 'undefined';	// Will be defined into constructor
36
+	public $element = 'undefined'; // Will be defined into constructor
37 37
 
38 38
 	/**
39 39
 	 * @var string Name of table without prefix where object is stored
40 40
 	 */
41
-	public $table_element = 'undefined';	// Will be defined into constructor
41
+	public $table_element = 'undefined'; // Will be defined into constructor
42 42
 
43 43
 	/**
44 44
 	 * @var CtyperesourceLine[] Lines
Please login to merge, or discard this patch.
htdocs/core/class/dolreceiptprinter.class.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 							if ($line->fk_product) {
649 649
 								$spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
650 650
 								$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
651
-								$this->printer->text($line->ref . $spaces . $line->qty . str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT) . ' ' . str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT) . "\n");
651
+								$this->printer->text($line->ref.$spaces.$line->qty.str_pad(price($line->subprice), 10, ' ', STR_PAD_LEFT).' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
652 652
 								$this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n \n");
653 653
 							} else {
654 654
 								$spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - strlen($line->subprice) - 10 - 1;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 						$this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
718 718
 						break;
719 719
 					case 'DOL_PRINT_CURR_DATE':
720
-						if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n");
720
+						if (strlen($vals[$tplline]['value']) < 2) $this->printer->text(date('d/m/Y H:i:s')."\n");
721 721
 						else $this->printer->text(date($vals[$tplline]['value'])."\n");
722 722
 						break;
723 723
 					case 'DOL_LINE_FEED':
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 						$this->printer->getPrintConnector() -> write("\x1e");
804 804
 						break;
805 805
 					case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works
806
-						$this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1));
806
+						$this->printer->getPrintConnector() -> write(Printer::ESC."B".chr(4).chr(1));
807 807
 						break;
808 808
 					case 'DOL_PRINT_ORDER_LINES':
809 809
 						foreach ($object->lines as $line) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -717,8 +717,11 @@
 block discarded – undo
717 717
 						$this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
718 718
 						break;
719 719
 					case 'DOL_PRINT_CURR_DATE':
720
-						if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n");
721
-						else $this->printer->text(date($vals[$tplline]['value'])."\n");
720
+						if (strlen($vals[$tplline]['value'])<2) {
721
+							$this->printer->text(date('d/m/Y H:i:s')."\n");
722
+						} else {
723
+							$this->printer->text(date($vals[$tplline]['value'])."\n");
724
+						}
722 725
 						break;
723 726
 					case 'DOL_LINE_FEED':
724 727
 						$this->printer->feed();
Please login to merge, or discard this patch.
htdocs/recruitment/class/api_recruitment.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		// Clean data
367 367
 		// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
368 368
 
369
-		if ($this->jobposition->create(DolibarrApiAccess::$user)<0) {
369
+		if ($this->jobposition->create(DolibarrApiAccess::$user) < 0) {
370 370
 			throw new RestException(500, "Error creating jobposition", array_merge(array($this->jobposition->error), $this->jobposition->errors));
371 371
 		}
372 372
 		return $this->jobposition->id;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 		// Clean data
399 399
 		// $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml');
400 400
 
401
-		if ($this->candidature->create(DolibarrApiAccess::$user)<0) {
401
+		if ($this->candidature->create(DolibarrApiAccess::$user) < 0) {
402 402
 			throw new RestException(500, "Error creating candidature", array_merge(array($this->candidature->error), $this->candidature->errors));
403 403
 		}
404 404
 		return $this->candidature->id;
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -371,15 +371,15 @@
 block discarded – undo
371 371
 	}
372 372
 
373 373
 	/**
374
-	* Create candidature object
375
-	*
376
-	* @param array $request_data   Request datas
377
-	* @return int  ID of candidature
378
-	*
379
-	* @throws RestException
380
-	*
381
-	* @url	POST candidature/
382
-	*/
374
+	 * Create candidature object
375
+	 *
376
+	 * @param array $request_data   Request datas
377
+	 * @return int  ID of candidature
378
+	 *
379
+	 * @throws RestException
380
+	 *
381
+	 * @url	POST candidature/
382
+	 */
383 383
 	public function postCandidature($request_data = null)
384 384
 	{
385 385
 		if (!DolibarrApiAccess::$user->hasRight('recruitment', 'recruitmentjobposition', 'write')) {
Please login to merge, or discard this patch.
htdocs/core/modules/import/import_xlsx.modules.php 2 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -894,7 +894,10 @@
 block discarded – undo
894 894
 									if ($num_rows == 1) {
895 895
 										$res = $this->db->fetch_object($resql);
896 896
 										$lastinsertid = $res->rowid;
897
-										if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
897
+										if ($is_table_category_link) {
898
+											$lastinsertid = 'linktable';
899
+										}
900
+										// used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
898 901
 										$last_insert_id_array[$tablename] = $lastinsertid;
899 902
 									} elseif ($num_rows > 1) {
900 903
 										$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
30 30
 use PhpOffice\PhpSpreadsheet\Style\Alignment;
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/modules/import/modules_import.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php';
33 33
 
34 34
 
35 35
 /**
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 		// phpcs:enable
141 141
 		global $user, $conf, $langs, $file;
142 142
 		// create a temporary object, the final output will be generated in footer
143
-		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs) . ' - Dolibarr ' . DOL_VERSION);
144
-		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import") . ' - ' . $file);
145
-		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import") . ' - ' . $file);
146
-		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import") . ' - ' . $file);
143
+		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
144
+		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file);
145
+		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file);
146
+		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file);
147 147
 
148 148
 		$this->workbook->setActiveSheetIndex(0);
149 149
 		$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		global $langs;
237 237
 		$ret = 1;
238 238
 
239
-		dol_syslog(get_class($this) . "::open_file file=" . $file);
239
+		dol_syslog(get_class($this)."::open_file file=".$file);
240 240
 
241 241
 		$reader = new Xlsx();
242 242
 		$this->workbook = $reader->load($file);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 				// Define $tablewithentity_cache[$tablename] if not already defined
391 391
 				if (!isset($tablewithentity_cache[$tablename])) {	// keep this test with "isset"
392
-					dol_syslog("Check if table " . $tablename . " has an entity field");
392
+					dol_syslog("Check if table ".$tablename." has an entity field");
393 393
 					$resql = $this->db->DDLDescTable($tablename, 'entity');
394 394
 					if ($resql) {
395 395
 						$obj = $this->db->fetch_object($resql);
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 										$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
463 463
 										$class = $objimport->array_import_convertvalue[0][$val]['class'];
464 464
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
465
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] != '') {
466
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval];
465
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '') {
466
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval];
467 467
 										} else {
468 468
 											$resultload = dol_include_once($file);
469 469
 											if (empty($resultload)) {
470
-												dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
470
+												dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
471 471
 												break;
472 472
 											}
473 473
 											$classinstance = new $class($this->db);
@@ -509,12 +509,12 @@  discard block
 block discarded – undo
509 509
 												$param_array = array('', '', $newval);
510 510
 												call_user_func_array(array($classinstance, $method), $param_array);
511 511
 											}
512
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id;
512
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id;
513 513
 
514 514
 											//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
515 515
 											if ($classinstance->id != '') {	// id may be 0, it is a found value
516 516
 												$newval = $classinstance->id;
517
-											} elseif (! $error) {
517
+											} elseif (!$error) {
518 518
 												if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
519 519
 													$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
520 520
 												} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
@@ -541,19 +541,19 @@  discard block
 block discarded – undo
541 541
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
542 542
 										$codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield'];
543 543
 										$code = $arrayrecord[$arrayfield[$codefromfield]]['val'];
544
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') {
545
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval];
544
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] != '') {
545
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval];
546 546
 										} else {
547 547
 											$resultload = dol_include_once($file);
548 548
 											if (empty($resultload)) {
549
-												dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code);
549
+												dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', code='.$code);
550 550
 												break;
551 551
 											}
552 552
 											$classinstance = new $class($this->db);
553 553
 											// Try the fetch from code and ref
554 554
 											$param_array = array('', $newval, $code);
555 555
 											call_user_func_array(array($classinstance, $method), $param_array);
556
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id;
556
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] = $classinstance->id;
557 557
 											if ($classinstance->id > 0) {    // we found record
558 558
 												$newval = $classinstance->id;
559 559
 											} else {
@@ -577,19 +577,19 @@  discard block
 block discarded – undo
577 577
 									$class = $objimport->array_import_convertvalue[0][$val]['class'];
578 578
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
579 579
 									$units = $objimport->array_import_convertvalue[0][$val]['units'];
580
-									if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] != '') {
581
-										$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval];
580
+									if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '') {
581
+										$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
582 582
 									} else {
583 583
 										$resultload = dol_include_once($file);
584 584
 										if (empty($resultload)) {
585
-											dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', units=' . $units);
585
+											dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
586 586
 											break;
587 587
 										}
588 588
 										$classinstance = new $class($this->db);
589 589
 										// Try the fetch from code or ref
590 590
 										call_user_func_array(array($classinstance, $method), array('', '', $newval, $units));
591 591
 										$scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale);
592
-										$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] = $scaleorid;
592
+										$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] = $scaleorid;
593 593
 										//print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit;
594 594
 										if ($classinstance->id > 0) {	// we found record
595 595
 											$newval = $scaleorid ? $scaleorid : 0;
@@ -681,13 +681,13 @@  discard block
 block discarded – undo
681 681
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
682 682
 									$resultload = dol_include_once($file);
683 683
 									if (empty($resultload)) {
684
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
684
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
685 685
 										break;
686 686
 									}
687 687
 									$classinstance = new $class($this->db);
688 688
 									$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key));
689 689
 									if (empty($classinstance->error) && empty($classinstance->errors)) {
690
-										$newval = $res; 	// We get new value computed.
690
+										$newval = $res; // We get new value computed.
691 691
 									} else {
692 692
 										$this->errors[$error]['type'] = 'CLASSERROR';
693 693
 										$this->errors[$error]['lib'] = implode(
@@ -719,16 +719,16 @@  discard block
 block discarded – undo
719 719
 									$table = $reg[2];
720 720
 									$filter = !empty($reg[3]) ? substr($reg[3], 1) : '';
721 721
 
722
-									$cachekey = $field . '@' . $table;
722
+									$cachekey = $field.'@'.$table;
723 723
 									if (!empty($filter)) {
724
-										$cachekey .= ':' . $filter;
724
+										$cachekey .= ':'.$filter;
725 725
 									}
726 726
 
727 727
 									// Load content of field@table into cache array
728 728
 									if (!is_array($this->cachefieldtable[$cachekey])) { // If content of field@table not already loaded into cache
729
-										$sql = "SELECT " . $field . " as aliasfield FROM " . $table;
729
+										$sql = "SELECT ".$field." as aliasfield FROM ".$table;
730 730
 										if (!empty($filter)) {
731
-											$sql .= ' WHERE ' . $filter;
731
+											$sql .= ' WHERE '.$filter;
732 732
 										}
733 733
 
734 734
 										$resql = $this->db->query($sql);
@@ -751,14 +751,14 @@  discard block
 block discarded – undo
751 751
 									if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey])) {
752 752
 										$tableforerror = $table;
753 753
 										if (!empty($filter)) {
754
-											$tableforerror .= ':' . $filter;
754
+											$tableforerror .= ':'.$filter;
755 755
 										}
756 756
 										$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
757 757
 										$this->errors[$error]['type'] = 'FOREIGNKEY';
758 758
 										$errorforthistable++;
759 759
 										$error++;
760 760
 									}
761
-								} elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) {
761
+								} elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
762 762
 									// If test is just a static regex
763 763
 									//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
764 764
 									$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
@@ -785,11 +785,11 @@  discard block
 block discarded – undo
785 785
 						if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
786 786
 							if (!in_array("socialnetworks", $listfields)) {
787 787
 								$listfields[] = "socialnetworks";
788
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
788
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
789 789
 								$listvalues[$socialkey] = '';
790 790
 							}
791 791
 							if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) {
792
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
792
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
793 793
 								$socialnetwork = explode("_", $fieldname)[1];
794 794
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
795 795
 									$json = new stdClass();
@@ -828,18 +828,18 @@  discard block
 block discarded – undo
828 828
 							continue; // Not a field of current table
829 829
 						}
830 830
 						if ($val == 'user->id') {
831
-							$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
831
+							$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
832 832
 							$listvalues[] = ((int) $user->id);
833 833
 						} elseif (preg_match('/^lastrowid-/', $val)) {
834 834
 							$tmp = explode('-', $val);
835 835
 							$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
836
-							$keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
836
+							$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
837 837
 							$listfields[] = $keyfield;
838 838
 							$listvalues[] = $lastinsertid;
839 839
 							//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
840 840
 						} elseif (preg_match('/^const-/', $val)) {
841 841
 							$tmp = explode('-', $val, 2);
842
-							$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
842
+							$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
843 843
 							$listvalues[] = "'".$this->db->escape($tmp[1])."'";
844 844
 						} elseif (preg_match('/^rule-/', $val)) {
845 845
 							$fieldname = $key;
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 									$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
851 851
 									$resultload = dol_include_once($file);
852 852
 									if (empty($resultload)) {
853
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
853
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
854 854
 										break;
855 855
 									}
856 856
 									$classinstance = new $class($this->db);
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 								}
873 873
 							}
874 874
 						} else {
875
-							$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
875
+							$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
876 876
 							$this->errors[$error]['type'] = 'Import profile setup';
877 877
 							$error++;
878 878
 						}
@@ -892,19 +892,19 @@  discard block
 block discarded – undo
892 892
 						$fname = 'rowid';
893 893
 						if (strpos($tablename, '_categorie_') !== false) {
894 894
 							$is_table_category_link = true;
895
-							$fname='*';
895
+							$fname = '*';
896 896
 						}
897 897
 
898 898
 						if (!empty($updatekeys)) {
899 899
 							// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
900 900
 
901 901
 							if (empty($lastinsertid)) {	// No insert done yet for a parent table
902
-								$sqlSelect = "SELECT ".$fname." FROM " . $tablename;
902
+								$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
903 903
 
904 904
 								$data = array_combine($listfields, $listvalues);
905 905
 
906
-								$where = array();	// filters to forge SQL request
907
-								$filters = array();	// filters to forge output error message
906
+								$where = array(); // filters to forge SQL request
907
+								$filters = array(); // filters to forge output error message
908 908
 								foreach ($updatekeys as $key) {
909 909
 									$col = $objimport->array_import_updatekeys[0][$key];
910 910
 									$key = preg_replace('/^.*\./i', '', $key);
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 									$where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
930 930
 									$filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
931 931
 								}
932
-								$sqlSelect .= " WHERE " . implode(' AND ', $where);
932
+								$sqlSelect .= " WHERE ".implode(' AND ', $where);
933 933
 
934 934
 								$resql = $this->db->query($sqlSelect);
935 935
 								if ($resql) {
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 								// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
959 959
 								// may already exists. So we rescan the extrafield table to know if record exists or not for the rowid.
960 960
 								// Note: For extrafield tablename, we have in importfieldshidden_array an enty 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object'
961
-								$sqlSelect = "SELECT rowid FROM " . $tablename;
961
+								$sqlSelect = "SELECT rowid FROM ".$tablename;
962 962
 
963 963
 
964 964
 								if (empty($keyfield)) {
@@ -992,34 +992,34 @@  discard block
 block discarded – undo
992 992
 								// We db escape social network field because he isn't in field creation
993 993
 								if (in_array("socialnetworks", $listfields)) {
994 994
 									$socialkey = array_search("socialnetworks", $listfields);
995
-									$tmpsql =  $listvalues[$socialkey];
995
+									$tmpsql = $listvalues[$socialkey];
996 996
 									$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
997 997
 								}
998 998
 
999 999
 								// Build SQL UPDATE request
1000
-								$sqlstart = "UPDATE " . $tablename;
1000
+								$sqlstart = "UPDATE ".$tablename;
1001 1001
 
1002 1002
 								$data = array_combine($listfields, $listvalues);
1003 1003
 								$set = array();
1004 1004
 								foreach ($data as $key => $val) {
1005 1005
 									$set[] = $key." = ".$val;
1006 1006
 								}
1007
-								$sqlstart .= " SET " . implode(', ', $set);
1007
+								$sqlstart .= " SET ".implode(', ', $set);
1008 1008
 
1009 1009
 								if (empty($keyfield)) {
1010 1010
 									$keyfield = 'rowid';
1011 1011
 								}
1012
-								$sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid);
1012
+								$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
1013 1013
 
1014 1014
 								if ($is_table_category_link) {
1015
-									$sqlend = " WHERE " . implode(' AND ', $where);
1015
+									$sqlend = " WHERE ".implode(' AND ', $where);
1016 1016
 								}
1017 1017
 
1018 1018
 								if (!empty($tablewithentity_cache[$tablename])) {
1019 1019
 									$sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
1020 1020
 								}
1021 1021
 
1022
-								$sql = $sqlstart . $sqlend;
1022
+								$sql = $sqlstart.$sqlend;
1023 1023
 
1024 1024
 								// Run update request
1025 1025
 								$resql = $this->db->query($sql);
@@ -1040,22 +1040,22 @@  discard block
 block discarded – undo
1040 1040
 							// We db escape social network field because he isn't in field creation
1041 1041
 							if (in_array("socialnetworks", $listfields)) {
1042 1042
 								$socialkey = array_search("socialnetworks", $listfields);
1043
-								$tmpsql =  $listvalues[$socialkey];
1043
+								$tmpsql = $listvalues[$socialkey];
1044 1044
 								$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
1045 1045
 							}
1046 1046
 
1047 1047
 							// Build SQL INSERT request
1048
-							$sqlstart = "INSERT INTO " . $tablename . "(" . implode(", ", $listfields) . ", import_key";
1049
-							$sqlend = ") VALUES(" . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'";
1048
+							$sqlstart = "INSERT INTO ".$tablename."(".implode(", ", $listfields).", import_key";
1049
+							$sqlend = ") VALUES(".implode(', ', $listvalues).", '".$this->db->escape($importid)."'";
1050 1050
 							if (!empty($tablewithentity_cache[$tablename])) {
1051 1051
 								$sqlstart .= ", entity";
1052
-								$sqlend .= ", " . $conf->entity;
1052
+								$sqlend .= ", ".$conf->entity;
1053 1053
 							}
1054 1054
 							if (!empty($objimport->array_import_tables_creator[0][$alias])) {
1055
-								$sqlstart .= ", " . $objimport->array_import_tables_creator[0][$alias];
1056
-								$sqlend .= ", " . $user->id;
1055
+								$sqlstart .= ", ".$objimport->array_import_tables_creator[0][$alias];
1056
+								$sqlend .= ", ".$user->id;
1057 1057
 							}
1058
-							$sql = $sqlstart . $sqlend . ")";
1058
+							$sql = $sqlstart.$sqlend.")";
1059 1059
 							//dol_syslog("import_xlsx.modules", LOG_DEBUG);
1060 1060
 
1061 1061
 							// Run insert request
Please login to merge, or discard this patch.
htdocs/core/modules/import/import_csv.modules.php 2 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -894,7 +894,10 @@
 block discarded – undo
894 894
 									if ($num_rows == 1) {
895 895
 										$res = $this->db->fetch_object($resql);
896 896
 										$lastinsertid = $res->rowid;
897
-										if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
897
+										if ($is_table_category_link) {
898
+											$lastinsertid = 'linktable';
899
+										}
900
+										// used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
898 901
 										$last_insert_id_array[$tablename] = $lastinsertid;
899 902
 									} elseif ($num_rows > 1) {
900 903
 										$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 											//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
471 471
 											if ($classinstance->id != '') {	// id may be 0, it is a found value
472 472
 												$newval = $classinstance->id;
473
-											} elseif (! $error) {
473
+											} elseif (!$error) {
474 474
 												if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
475 475
 													$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
476 476
 												} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 									$classinstance = new $class($this->db);
644 644
 									$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1)));
645 645
 									if (empty($classinstance->error) && empty($classinstance->errors)) {
646
-										$newval = $res; 	// We get new value computed.
646
+										$newval = $res; // We get new value computed.
647 647
 									} else {
648 648
 										$this->errors[$error]['type'] = 'CLASSERROR';
649 649
 										$this->errors[$error]['lib'] = implode(
@@ -741,12 +741,12 @@  discard block
 block discarded – undo
741 741
 						if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
742 742
 							if (!in_array("socialnetworks", $listfields)) {
743 743
 								$listfields[] = "socialnetworks";
744
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array
744
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array
745 745
 								$listvalues[$socialkey] = '';
746 746
 							}
747 747
 							//var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']);
748 748
 							if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) {
749
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array
749
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array
750 750
 								//var_dump('sk='.$socialkey);	// socialkey=19
751 751
 								$socialnetwork = explode("_", $fieldname)[1];
752 752
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 									$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
808 808
 									$resultload = dol_include_once($file);
809 809
 									if (empty($resultload)) {
810
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
810
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
811 811
 										break;
812 812
 									}
813 813
 									$classinstance = new $class($this->db);
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 						$fname = 'rowid';
852 852
 						if (strpos($tablename, '_categorie_') !== false) {
853 853
 							$is_table_category_link = true;
854
-							$fname='*';
854
+							$fname = '*';
855 855
 						}
856 856
 
857 857
 						if (!empty($updatekeys)) {
@@ -860,8 +860,8 @@  discard block
 block discarded – undo
860 860
 							if (empty($lastinsertid)) {	// No insert done yet for a parent table
861 861
 								$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
862 862
 								$data = array_combine($listfields, $listvalues);
863
-								$where = array();	// filters to forge SQL request
864
-								$filters = array();	// filters to forge output error message
863
+								$where = array(); // filters to forge SQL request
864
+								$filters = array(); // filters to forge output error message
865 865
 								foreach ($updatekeys as $key) {
866 866
 									$col = $objimport->array_import_updatekeys[0][$key];
867 867
 									$key = preg_replace('/^.*\./i', '', $key);
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 								// We db escape social network field because he isn't in field creation
949 949
 								if (in_array("socialnetworks", $listfields)) {
950 950
 									$socialkey = array_search("socialnetworks", $listfields);
951
-									$tmpsql =  $listvalues[$socialkey];
951
+									$tmpsql = $listvalues[$socialkey];
952 952
 									$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
953 953
 								}
954 954
 
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 								$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
969 969
 
970 970
 								if ($is_table_category_link) {
971
-									$sqlend = " WHERE " . implode(' AND ', $where);
971
+									$sqlend = " WHERE ".implode(' AND ', $where);
972 972
 								}
973 973
 
974 974
 								if (!empty($tablewithentity_cache[$tablename])) {
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 							// We db escape social network field because he isn't in field creation
997 997
 							if (in_array("socialnetworks", $listfields)) {
998 998
 								$socialkey = array_search("socialnetworks", $listfields);
999
-								$tmpsql =  $listvalues[$socialkey];
999
+								$tmpsql = $listvalues[$socialkey];
1000 1000
 								$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
1001 1001
 							}
1002 1002
 
Please login to merge, or discard this patch.
htdocs/comm/propal/stats/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -335,7 +335,7 @@
 block discarded – undo
335 335
 	print '<tr class="oddeven" height="24">';
336 336
 	print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
337 337
 	print '<td class="right">'.$val['nb'].'</td>';
338
-	print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']): "0").'%</td>';
338
+	print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%</td>';
339 339
 	print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
340 340
 	print '<td class="right opacitylow" style="'.((!isset($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%</td>';
341 341
 	print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/lib/stocktransfer_stocktransfer.lib.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,18 +46,26 @@  discard block
 block discarded – undo
46 46
 		$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
47 47
 		$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_contact.php', 1).'?id='.$object->id;
48 48
 		$head[$h][1] = $langs->trans('ContactsAddresses');
49
-		if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
49
+		if ($nbContact > 0) {
50
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
51
+		}
50 52
 		$head[$h][2] = 'contact';
51 53
 		$h++;
52 54
 	}
53 55
 
54 56
 	if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
55 57
 		$nbNote = 0;
56
-		if (!empty($object->note_private)) $nbNote++;
57
-		if (!empty($object->note_public)) $nbNote++;
58
+		if (!empty($object->note_private)) {
59
+			$nbNote++;
60
+		}
61
+		if (!empty($object->note_public)) {
62
+			$nbNote++;
63
+		}
58 64
 		$head[$h][0] = dol_buildpath('/product/stock/stocktransfer/stocktransfer_note.php', 1).'?id='.$object->id;
59 65
 		$head[$h][1] = $langs->trans('Notes');
60
-		if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
66
+		if ($nbNote > 0) {
67
+			$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
68
+		}
61 69
 		$head[$h][2] = 'note';
62 70
 		$h++;
63 71
 	}
@@ -69,7 +77,9 @@  discard block
 block discarded – undo
69 77
 	$nbLinks = Link::count($db, $object->element, $object->id);
70 78
 	$head[$h][0] = dol_buildpath("/product/stock/stocktransfer/stocktransfer_document.php", 1).'?id='.$object->id;
71 79
 	$head[$h][1] = $langs->trans('Documents');
72
-	if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
80
+	if (($nbFiles + $nbLinks) > 0) {
81
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
82
+	}
73 83
 	$head[$h][2] = 'document';
74 84
 	$h++;
75 85
 
Please login to merge, or discard this patch.