@@ -129,7 +129,9 @@ |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $object->fields['fk_member']['visible'] = 0; |
132 | -if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1; |
|
132 | +if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) { |
|
133 | + $object->fields['reason_decline_or_cancel']['visible'] = 1; |
|
134 | +} |
|
133 | 135 | $object->fields['note_public']['visible'] = 1; |
134 | 136 | |
135 | 137 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; |
34 | 34 | |
35 | 35 | // Load translation files required by the page |
36 | -$langs->loadLangs(array("companies","members","partnership", "other")); |
|
36 | +$langs->loadLangs(array("companies", "members", "partnership", "other")); |
|
37 | 37 | |
38 | 38 | // Get parameters |
39 | 39 | $id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int'); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | // Initialize technical objects |
55 | -$object = new Partnership($db); |
|
56 | -$extrafields = new ExtraFields($db); |
|
57 | -$adht = new AdherentType($db); |
|
55 | +$object = new Partnership($db); |
|
56 | +$extrafields = new ExtraFields($db); |
|
57 | +$adht = new AdherentType($db); |
|
58 | 58 | $diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id; |
59 | 59 | $hookmanager->initHooks(array('partnershipthirdparty', 'globalcard')); // Note that conf->hooks_modules contains array |
60 | 60 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | if ($backupold) { |
158 | 158 | dol_delete_file($filetpl.'.old'); |
159 | 159 | $result = dol_move($filetpl, $filetpl.'.old', 0, 1, 0, 0); |
160 | - if (! $result) { |
|
160 | + if (!$result) { |
|
161 | 161 | return false; |
162 | 162 | } |
163 | 163 | } else { |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | $indexcontent .= " require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; |
347 | 347 | $indexcontent .= ' redirectToContainer($_GET[\'pageref\'], $_GET[\'pagealiasalt\'], $_GET[\'pageid\']);'."\n"; |
348 | 348 | $indexcontent .= "}\n"; |
349 | - $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
349 | + $indexcontent .= "include_once '".$relpath."/".basename($filetpl)."'\n"; // use .. instead of . |
|
350 | 350 | $indexcontent .= '// END PHP ?>'."\n"; |
351 | 351 | $result = file_put_contents($fileindexsub, $indexcontent); |
352 | 352 | if ($result === false) { |
@@ -109,7 +109,9 @@ discard block |
||
109 | 109 | $filename = basename($filealias); |
110 | 110 | foreach (explode(',', $object->otherlang) as $sublang) { |
111 | 111 | // Avoid to erase main alias file if $sublang is empty string |
112 | - if (empty(trim($sublang))) continue; |
|
112 | + if (empty(trim($sublang))) { |
|
113 | + continue; |
|
114 | + } |
|
113 | 115 | $filealiassub = $dirname.'/'.$sublang.'/'.$filename; |
114 | 116 | |
115 | 117 | $aliascontent = '<?php'."\n"; |
@@ -332,7 +334,9 @@ discard block |
||
332 | 334 | $dirname = dirname($fileindex); |
333 | 335 | foreach (explode(',', $object->otherlang) as $sublang) { |
334 | 336 | // Avoid to erase main alias file if $sublang is empty string |
335 | - if (empty(trim($sublang))) continue; |
|
337 | + if (empty(trim($sublang))) { |
|
338 | + continue; |
|
339 | + } |
|
336 | 340 | $fileindexsub = $dirname.'/'.$sublang.'/index.php'; |
337 | 341 | |
338 | 342 | // Same indexcontent than previously but with ../ instead of ./ for master and tpl file include/require_once. |
@@ -254,7 +254,7 @@ |
||
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; |
@@ -220,7 +220,7 @@ |
||
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; |
@@ -366,7 +366,7 @@ |
||
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) { |
@@ -33,11 +33,11 @@ discard block |
||
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 |
||
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 |
@@ -33,12 +33,12 @@ |
||
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 |
@@ -717,8 +717,11 @@ |
||
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(); |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | if ($line->fk_product) { |
712 | 712 | $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - strlen($line->subprice) - 10 - 1; |
713 | 713 | $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); |
714 | - $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"); |
|
714 | + $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"); |
|
715 | 715 | $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n \n"); |
716 | 716 | } else { |
717 | 717 | $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - strlen($line->subprice) - 10 - 1; |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | $this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); |
781 | 781 | break; |
782 | 782 | case 'DOL_PRINT_CURR_DATE': |
783 | - if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n"); |
|
783 | + if (strlen($vals[$tplline]['value']) < 2) $this->printer->text(date('d/m/Y H:i:s')."\n"); |
|
784 | 784 | else $this->printer->text(date($vals[$tplline]['value'])."\n"); |
785 | 785 | break; |
786 | 786 | case 'DOL_LINE_FEED': |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $this->printer->getPrintConnector() -> write("\x1e"); |
871 | 871 | break; |
872 | 872 | case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works |
873 | - $this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1)); |
|
873 | + $this->printer->getPrintConnector() -> write(Printer::ESC."B".chr(4).chr(1)); |
|
874 | 874 | break; |
875 | 875 | case 'DOL_PRINT_ORDER_LINES': |
876 | 876 | foreach ($object->lines as $line) { |
@@ -920,11 +920,11 @@ discard block |
||
920 | 920 | } |
921 | 921 | break; |
922 | 922 | default: |
923 | - $parameters = array('vals' => $vals[$tplline],'object' => $object,'nbcharactbyline' => $nbcharactbyline); |
|
923 | + $parameters = array('vals' => $vals[$tplline], 'object' => $object, 'nbcharactbyline' => $nbcharactbyline); |
|
924 | 924 | $action = ''; |
925 | 925 | $reshook = $hookmanager->executeHooks('sendToPrinterAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
926 | 926 | |
927 | - if (!$reshook || $reshook < 0 ) { |
|
927 | + if (!$reshook || $reshook < 0) { |
|
928 | 928 | $this->printer->text($vals[$tplline]['tag']); |
929 | 929 | $this->printer->text($vals[$tplline]['value']); |
930 | 930 | $this->errors[] = 'UnknowTag: <'.strtolower($vals[$tplline]['tag']).'>'; |
@@ -894,7 +894,10 @@ |
||
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)); |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |