Completed
Branch develop (d02c61)
by
unknown
18:56
created
htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -254,7 +254,7 @@
 block discarded – undo
254 254
 		// Clean data
255 255
 		// $this->knowledgerecord->abc = sanitizeVal($this->knowledgerecord->abc, 'alphanohtml');
256 256
 
257
-		if ($this->knowledgerecord->create(DolibarrApiAccess::$user)<0) {
257
+		if ($this->knowledgerecord->create(DolibarrApiAccess::$user) < 0) {
258 258
 			throw new RestException(500, "Error creating KnowledgeRecord", array_merge(array($this->knowledgerecord->error), $this->knowledgerecord->errors));
259 259
 		}
260 260
 		return $this->knowledgerecord->id;
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/class/api_mymodule.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
 		// Clean data
221 221
 		// $this->myobject->abc = sanitizeVal($this->myobject->abc, 'alphanohtml');
222 222
 
223
-		if ($this->myobject->create(DolibarrApiAccess::$user)<0) {
223
+		if ($this->myobject->create(DolibarrApiAccess::$user) < 0) {
224 224
 			throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
225 225
 		}
226 226
 		return $this->myobject->id;
Please login to merge, or discard this patch.
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
 /**
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 		// phpcs:enable
153 153
 		global $user, $conf, $langs, $file;
154 154
 		// create a temporary object, the final output will be generated in footer
155
-		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs) . ' - Dolibarr ' . DOL_VERSION);
156
-		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import") . ' - ' . $file);
157
-		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import") . ' - ' . $file);
158
-		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import") . ' - ' . $file);
155
+		$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
156
+		$this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file);
157
+		$this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file);
158
+		$this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file);
159 159
 
160 160
 		$this->workbook->setActiveSheetIndex(0);
161 161
 		$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 		global $langs;
249 249
 		$ret = 1;
250 250
 
251
-		dol_syslog(get_class($this) . "::open_file file=" . $file);
251
+		dol_syslog(get_class($this)."::open_file file=".$file);
252 252
 
253 253
 		$reader = new Xlsx();
254 254
 		$this->workbook = $reader->load($file);
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 				// Define $tablewithentity_cache[$tablename] if not already defined
403 403
 				if (!isset($tablewithentity_cache[$tablename])) {	// keep this test with "isset"
404
-					dol_syslog("Check if table " . $tablename . " has an entity field");
404
+					dol_syslog("Check if table ".$tablename." has an entity field");
405 405
 					$resql = $this->db->DDLDescTable($tablename, 'entity');
406 406
 					if ($resql) {
407 407
 						$obj = $this->db->fetch_object($resql);
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 										$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
475 475
 										$class = $objimport->array_import_convertvalue[0][$val]['class'];
476 476
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
477
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] != '') {
478
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval];
477
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '') {
478
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval];
479 479
 										} else {
480 480
 											$resultload = dol_include_once($file);
481 481
 											if (empty($resultload)) {
482
-												dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
482
+												dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
483 483
 												break;
484 484
 											}
485 485
 											$classinstance = new $class($this->db);
@@ -521,12 +521,12 @@  discard block
 block discarded – undo
521 521
 												$param_array = array('', '', $newval);
522 522
 												call_user_func_array(array($classinstance, $method), $param_array);
523 523
 											}
524
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id;
524
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id;
525 525
 
526 526
 											//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
527 527
 											if ($classinstance->id != '') {	// id may be 0, it is a found value
528 528
 												$newval = $classinstance->id;
529
-											} elseif (! $error) {
529
+											} elseif (!$error) {
530 530
 												if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
531 531
 													$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
532 532
 												} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
@@ -553,19 +553,19 @@  discard block
 block discarded – undo
553 553
 										$method = $objimport->array_import_convertvalue[0][$val]['method'];
554 554
 										$codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield'];
555 555
 										$code = $arrayrecord[$arrayfield[$codefromfield]]['val'];
556
-										if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') {
557
-											$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval];
556
+										if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] != '') {
557
+											$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval];
558 558
 										} else {
559 559
 											$resultload = dol_include_once($file);
560 560
 											if (empty($resultload)) {
561
-												dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code);
561
+												dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', code='.$code);
562 562
 												break;
563 563
 											}
564 564
 											$classinstance = new $class($this->db);
565 565
 											// Try the fetch from code and ref
566 566
 											$param_array = array('', $newval, $code);
567 567
 											call_user_func_array(array($classinstance, $method), $param_array);
568
-											$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id;
568
+											$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] = $classinstance->id;
569 569
 											if ($classinstance->id > 0) {    // we found record
570 570
 												$newval = $classinstance->id;
571 571
 											} else {
@@ -589,19 +589,19 @@  discard block
 block discarded – undo
589 589
 									$class = $objimport->array_import_convertvalue[0][$val]['class'];
590 590
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
591 591
 									$units = $objimport->array_import_convertvalue[0][$val]['units'];
592
-									if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] != '') {
593
-										$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval];
592
+									if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '') {
593
+										$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
594 594
 									} else {
595 595
 										$resultload = dol_include_once($file);
596 596
 										if (empty($resultload)) {
597
-											dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', units=' . $units);
597
+											dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
598 598
 											break;
599 599
 										}
600 600
 										$classinstance = new $class($this->db);
601 601
 										// Try the fetch from code or ref
602 602
 										call_user_func_array(array($classinstance, $method), array('', '', $newval, $units));
603 603
 										$scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale);
604
-										$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] = $scaleorid;
604
+										$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] = $scaleorid;
605 605
 										//print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit;
606 606
 										if ($classinstance->id > 0) {	// we found record
607 607
 											$newval = $scaleorid ? $scaleorid : 0;
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
 									$method = $objimport->array_import_convertvalue[0][$val]['method'];
694 694
 									$resultload = dol_include_once($file);
695 695
 									if (empty($resultload)) {
696
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
696
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
697 697
 										break;
698 698
 									}
699 699
 									$classinstance = new $class($this->db);
700 700
 									$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, $key));
701
-									$newval = $res; 	// We get new value computed.
701
+									$newval = $res; // We get new value computed.
702 702
 								} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
703 703
 									$newval = price2num($newval);
704 704
 								} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
@@ -721,16 +721,16 @@  discard block
 block discarded – undo
721 721
 									$table = $reg[2];
722 722
 									$filter = !empty($reg[3]) ? substr($reg[3], 1) : '';
723 723
 
724
-									$cachekey = $field . '@' . $table;
724
+									$cachekey = $field.'@'.$table;
725 725
 									if (!empty($filter)) {
726
-										$cachekey .= ':' . $filter;
726
+										$cachekey .= ':'.$filter;
727 727
 									}
728 728
 
729 729
 									// Load content of field@table into cache array
730 730
 									if (!is_array($this->cachefieldtable[$cachekey])) { // If content of field@table not already loaded into cache
731
-										$sql = "SELECT " . $field . " as aliasfield FROM " . $table;
731
+										$sql = "SELECT ".$field." as aliasfield FROM ".$table;
732 732
 										if (!empty($filter)) {
733
-											$sql .= ' WHERE ' . $filter;
733
+											$sql .= ' WHERE '.$filter;
734 734
 										}
735 735
 
736 736
 										$resql = $this->db->query($sql);
@@ -753,14 +753,14 @@  discard block
 block discarded – undo
753 753
 									if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey])) {
754 754
 										$tableforerror = $table;
755 755
 										if (!empty($filter)) {
756
-											$tableforerror .= ':' . $filter;
756
+											$tableforerror .= ':'.$filter;
757 757
 										}
758 758
 										$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
759 759
 										$this->errors[$error]['type'] = 'FOREIGNKEY';
760 760
 										$errorforthistable++;
761 761
 										$error++;
762 762
 									}
763
-								} elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) {
763
+								} elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
764 764
 									// If test is just a static regex
765 765
 									//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
766 766
 									$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
@@ -787,11 +787,11 @@  discard block
 block discarded – undo
787 787
 						if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
788 788
 							if (!in_array("socialnetworks", $listfields)) {
789 789
 								$listfields[] = "socialnetworks";
790
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
790
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
791 791
 								$listvalues[$socialkey] = '';
792 792
 							}
793 793
 							if (!empty($newval) && $arrayrecord[($key)]['type'] > 0) {
794
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array. Example socialkey=19
794
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array. Example socialkey=19
795 795
 								$socialnetwork = explode("_", $fieldname)[1];
796 796
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
797 797
 									$json = new stdClass();
@@ -830,18 +830,18 @@  discard block
 block discarded – undo
830 830
 							continue; // Not a field of current table
831 831
 						}
832 832
 						if ($val == 'user->id') {
833
-							$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
833
+							$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
834 834
 							$listvalues[] = ((int) $user->id);
835 835
 						} elseif (preg_match('/^lastrowid-/', $val)) {
836 836
 							$tmp = explode('-', $val);
837 837
 							$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
838
-							$keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
838
+							$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
839 839
 							$listfields[] = $keyfield;
840 840
 							$listvalues[] = $lastinsertid;
841 841
 							//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
842 842
 						} elseif (preg_match('/^const-/', $val)) {
843 843
 							$tmp = explode('-', $val, 2);
844
-							$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
844
+							$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
845 845
 							$listvalues[] = "'".$this->db->escape($tmp[1])."'";
846 846
 						} elseif (preg_match('/^rule-/', $val)) {
847 847
 							$fieldname = $key;
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 									$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
853 853
 									$resultload = dol_include_once($file);
854 854
 									if (empty($resultload)) {
855
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
855
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
856 856
 										break;
857 857
 									}
858 858
 									$classinstance = new $class($this->db);
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 								}
867 867
 							}
868 868
 						} else {
869
-							$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
869
+							$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
870 870
 							$this->errors[$error]['type'] = 'Import profile setup';
871 871
 							$error++;
872 872
 						}
@@ -886,19 +886,19 @@  discard block
 block discarded – undo
886 886
 						$fname = 'rowid';
887 887
 						if (strpos($tablename, '_categorie_') !== false) {
888 888
 							$is_table_category_link = true;
889
-							$fname='*';
889
+							$fname = '*';
890 890
 						}
891 891
 
892 892
 						if (!empty($updatekeys)) {
893 893
 							// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
894 894
 
895 895
 							if (empty($lastinsertid)) {	// No insert done yet for a parent table
896
-								$sqlSelect = "SELECT ".$fname." FROM " . $tablename;
896
+								$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
897 897
 
898 898
 								$data = array_combine($listfields, $listvalues);
899 899
 
900
-								$where = array();	// filters to forge SQL request
901
-								$filters = array();	// filters to forge output error message
900
+								$where = array(); // filters to forge SQL request
901
+								$filters = array(); // filters to forge output error message
902 902
 								foreach ($updatekeys as $key) {
903 903
 									$col = $objimport->array_import_updatekeys[0][$key];
904 904
 									$key = preg_replace('/^.*\./i', '', $key);
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 									$where[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
924 924
 									$filters[] = "entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
925 925
 								}
926
-								$sqlSelect .= " WHERE " . implode(' AND ', $where);
926
+								$sqlSelect .= " WHERE ".implode(' AND ', $where);
927 927
 
928 928
 								$resql = $this->db->query($sqlSelect);
929 929
 								if ($resql) {
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 								// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
953 953
 								// may already exists. So we rescan the extrafield table to know if record exists or not for the rowid.
954 954
 								// Note: For extrafield tablename, we have in importfieldshidden_array an enty 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object'
955
-								$sqlSelect = "SELECT rowid FROM " . $tablename;
955
+								$sqlSelect = "SELECT rowid FROM ".$tablename;
956 956
 
957 957
 
958 958
 								if (empty($keyfield)) {
@@ -986,34 +986,34 @@  discard block
 block discarded – undo
986 986
 								// We db escape social network field because he isn't in field creation
987 987
 								if (in_array("socialnetworks", $listfields)) {
988 988
 									$socialkey = array_search("socialnetworks", $listfields);
989
-									$tmpsql =  $listvalues[$socialkey];
989
+									$tmpsql = $listvalues[$socialkey];
990 990
 									$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
991 991
 								}
992 992
 
993 993
 								// Build SQL UPDATE request
994
-								$sqlstart = "UPDATE " . $tablename;
994
+								$sqlstart = "UPDATE ".$tablename;
995 995
 
996 996
 								$data = array_combine($listfields, $listvalues);
997 997
 								$set = array();
998 998
 								foreach ($data as $key => $val) {
999 999
 									$set[] = $key." = ".$val;
1000 1000
 								}
1001
-								$sqlstart .= " SET " . implode(', ', $set);
1001
+								$sqlstart .= " SET ".implode(', ', $set);
1002 1002
 
1003 1003
 								if (empty($keyfield)) {
1004 1004
 									$keyfield = 'rowid';
1005 1005
 								}
1006
-								$sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid);
1006
+								$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
1007 1007
 
1008 1008
 								if ($is_table_category_link) {
1009
-									$sqlend = " WHERE " . implode(' AND ', $where);
1009
+									$sqlend = " WHERE ".implode(' AND ', $where);
1010 1010
 								}
1011 1011
 
1012 1012
 								if (!empty($tablewithentity_cache[$tablename])) {
1013 1013
 									$sqlend .= " AND entity IN (".getEntity($this->getElementFromTableWithPrefix($tablename)).")";
1014 1014
 								}
1015 1015
 
1016
-								$sql = $sqlstart . $sqlend;
1016
+								$sql = $sqlstart.$sqlend;
1017 1017
 
1018 1018
 								// Run update request
1019 1019
 								$resql = $this->db->query($sql);
@@ -1034,22 +1034,22 @@  discard block
 block discarded – undo
1034 1034
 							// We db escape social network field because he isn't in field creation
1035 1035
 							if (in_array("socialnetworks", $listfields)) {
1036 1036
 								$socialkey = array_search("socialnetworks", $listfields);
1037
-								$tmpsql =  $listvalues[$socialkey];
1037
+								$tmpsql = $listvalues[$socialkey];
1038 1038
 								$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
1039 1039
 							}
1040 1040
 
1041 1041
 							// Build SQL INSERT request
1042
-							$sqlstart = "INSERT INTO " . $tablename . "(" . implode(", ", $listfields) . ", import_key";
1043
-							$sqlend = ") VALUES(" . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'";
1042
+							$sqlstart = "INSERT INTO ".$tablename."(".implode(", ", $listfields).", import_key";
1043
+							$sqlend = ") VALUES(".implode(', ', $listvalues).", '".$this->db->escape($importid)."'";
1044 1044
 							if (!empty($tablewithentity_cache[$tablename])) {
1045 1045
 								$sqlstart .= ", entity";
1046
-								$sqlend .= ", " . $conf->entity;
1046
+								$sqlend .= ", ".$conf->entity;
1047 1047
 							}
1048 1048
 							if (!empty($objimport->array_import_tables_creator[0][$alias])) {
1049
-								$sqlstart .= ", " . $objimport->array_import_tables_creator[0][$alias];
1050
-								$sqlend .= ", " . $user->id;
1049
+								$sqlstart .= ", ".$objimport->array_import_tables_creator[0][$alias];
1050
+								$sqlend .= ", ".$user->id;
1051 1051
 							}
1052
-							$sql = $sqlstart . $sqlend . ")";
1052
+							$sql = $sqlstart.$sqlend.")";
1053 1053
 							//dol_syslog("import_xlsx.modules", LOG_DEBUG);
1054 1054
 
1055 1055
 							// 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
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 											//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
483 483
 											if ($classinstance->id != '') {	// id may be 0, it is a found value
484 484
 												$newval = $classinstance->id;
485
-											} elseif (! $error) {
485
+											} elseif (!$error) {
486 486
 												if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
487 487
 													$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', num2Alpha($key - 1), $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
488 488
 												} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 									}
655 655
 									$classinstance = new $class($this->db);
656 656
 									$res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $arrayfield, ($key - 1)));
657
-									$newval = $res; 	// We get new value computed.
657
+									$newval = $res; // We get new value computed.
658 658
 								} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
659 659
 									$newval = price2num($newval);
660 660
 								} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') {
@@ -743,12 +743,12 @@  discard block
 block discarded – undo
743 743
 						if (isModEnabled("socialnetworks") && strpos($fieldname, "socialnetworks") !== false) {
744 744
 							if (!in_array("socialnetworks", $listfields)) {
745 745
 								$listfields[] = "socialnetworks";
746
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array
746
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array
747 747
 								$listvalues[$socialkey] = '';
748 748
 							}
749 749
 							//var_dump($newval); var_dump($arrayrecord[($key - 1)]['type']);
750 750
 							if (!empty($newval) && $arrayrecord[($key - 1)]['type'] > 0) {
751
-								$socialkey = array_search("socialnetworks", $listfields);	// Return position of 'socialnetworks' key in array
751
+								$socialkey = array_search("socialnetworks", $listfields); // Return position of 'socialnetworks' key in array
752 752
 								//var_dump('sk='.$socialkey);	// socialkey=19
753 753
 								$socialnetwork = explode("_", $fieldname)[1];
754 754
 								if (empty($listvalues[$socialkey]) || $listvalues[$socialkey] == "null") {
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 									$method = $objimport->array_import_convertvalue[0][$fieldname]['method'];
810 810
 									$resultload = dol_include_once($file);
811 811
 									if (empty($resultload)) {
812
-										dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
812
+										dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
813 813
 										break;
814 814
 									}
815 815
 									$classinstance = new $class($this->db);
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 						$fname = 'rowid';
844 844
 						if (strpos($tablename, '_categorie_') !== false) {
845 845
 							$is_table_category_link = true;
846
-							$fname='*';
846
+							$fname = '*';
847 847
 						}
848 848
 
849 849
 						if (!empty($updatekeys)) {
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 							if (empty($lastinsertid)) {	// No insert done yet for a parent table
853 853
 								$sqlSelect = "SELECT ".$fname." FROM ".$tablename;
854 854
 								$data = array_combine($listfields, $listvalues);
855
-								$where = array();	// filters to forge SQL request
856
-								$filters = array();	// filters to forge output error message
855
+								$where = array(); // filters to forge SQL request
856
+								$filters = array(); // filters to forge output error message
857 857
 								foreach ($updatekeys as $key) {
858 858
 									$col = $objimport->array_import_updatekeys[0][$key];
859 859
 									$key = preg_replace('/^.*\./i', '', $key);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 								// We db escape social network field because he isn't in field creation
941 941
 								if (in_array("socialnetworks", $listfields)) {
942 942
 									$socialkey = array_search("socialnetworks", $listfields);
943
-									$tmpsql =  $listvalues[$socialkey];
943
+									$tmpsql = $listvalues[$socialkey];
944 944
 									$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
945 945
 								}
946 946
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 								$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
961 961
 
962 962
 								if ($is_table_category_link) {
963
-									$sqlend = " WHERE " . implode(' AND ', $where);
963
+									$sqlend = " WHERE ".implode(' AND ', $where);
964 964
 								}
965 965
 
966 966
 								if (!empty($tablewithentity_cache[$tablename])) {
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 							// We db escape social network field because he isn't in field creation
989 989
 							if (in_array("socialnetworks", $listfields)) {
990 990
 								$socialkey = array_search("socialnetworks", $listfields);
991
-								$tmpsql =  $listvalues[$socialkey];
991
+								$tmpsql = $listvalues[$socialkey];
992 992
 								$listvalues[$socialkey] = "'".$this->db->escape($tmpsql)."'";
993 993
 							}
994 994
 
Please login to merge, or discard this patch.