@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $backurlforlist = dol_buildpath('/product/stock/productlot_list.php', 1); |
154 | 154 | |
155 | - if ($action == 'seteatby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
155 | + if ($action == 'seteatby' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
156 | 156 | $newvalue = dol_mktime(12, 0, 0, GETPOST('eatbymonth', 'int'), GETPOST('eatbyday', 'int'), GETPOST('eatbyyear', 'int')); |
157 | 157 | $result = $object->setValueFrom('eatby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); |
158 | 158 | if ($result < 0) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if ($action == 'setsellby' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
166 | + if ($action == 'setsellby' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
167 | 167 | $newvalue = dol_mktime(12, 0, 0, GETPOST('sellbymonth', 'int'), GETPOST('sellbyday', 'int'), GETPOST('sellbyyear', 'int')); |
168 | 168 | $result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); |
169 | 169 | if ($result < 0) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - if ($action == 'seteol_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
177 | + if ($action == 'seteol_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
178 | 178 | $newvalue = dol_mktime(12, 0, 0, GETPOST('eol_datemonth', 'int'), GETPOST('eol_dateday', 'int'), GETPOST('eol_dateyear', 'int')); |
179 | 179 | $result = $object->setValueFrom('eol_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); |
180 | 180 | if ($result < 0) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if ($action == 'setmanufacturing_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
188 | + if ($action == 'setmanufacturing_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
189 | 189 | $newvalue = dol_mktime(12, 0, 0, GETPOST('manufacturing_datemonth', 'int'), GETPOST('manufacturing_dateday', 'int'), GETPOST('manufacturing_dateyear', 'int')); |
190 | 190 | $result = $object->setValueFrom('manufacturing_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); |
191 | 191 | if ($result < 0) { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if ($action == 'setscrapping_date' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
199 | + if ($action == 'setscrapping_date' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
200 | 200 | $newvalue = dol_mktime(12, 0, 0, GETPOST('scrapping_datemonth', 'int'), GETPOST('scrapping_dateday', 'int'), GETPOST('scrapping_dateyear', 'int')); |
201 | 201 | $result = $object->setValueFrom('scrapping_date', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); |
202 | 202 | if ($result < 0) { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | } */ |
220 | 220 | |
221 | - if ($action == 'setqc_frequency' && $user->hasRight('stock', 'creer') && ! GETPOST('cancel', 'alpha')) { |
|
221 | + if ($action == 'setqc_frequency' && $user->hasRight('stock', 'creer') && !GETPOST('cancel', 'alpha')) { |
|
222 | 222 | $result = $object->setValueFrom('qc_frequency', GETPOST('qc_frequency'), '', null, 'int', '', $user, 'PRODUCT_MODIFY'); |
223 | 223 | if ($result < 0) { // Prévoir un test de format de durée |
224 | 224 | setEventMessages($object->error, null, 'errors'); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | $action = GETPOST('action', 'aZ09'); |
44 | 44 | $confirm = GETPOST('confirm', 'alpha'); |
45 | 45 | $cancel = GETPOST('cancel', 'aZ09'); |
46 | -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search |
|
46 | +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search |
|
47 | 47 | $backtopage = GETPOST('backtopage', 'alpha'); |
48 | 48 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
49 | 49 | |
50 | -$groups = GETPOST('groups', 'array:int'); |
|
51 | -$resources = GETPOST('resources', 'array:int'); |
|
50 | +$groups = GETPOST('groups', 'array:int'); |
|
51 | +$resources = GETPOST('resources', 'array:int'); |
|
52 | 52 | //$lineid = GETPOST('lineid', 'int'); |
53 | 53 | |
54 | 54 | // Initialize technical objects |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | // Permissions |
83 | 83 | $permissiontoread = $user->hasRight('workstation', 'workstation', 'read'); |
84 | -$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
|
84 | +$permissiontoadd = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
|
85 | 85 | $permissiontodelete = $user->hasRight('workstation', 'workstation', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DISABLED); |
86 | -$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php |
|
87 | -$permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php |
|
86 | +$permissionnote = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_setnotes.inc.php |
|
87 | +$permissiondellink = $user->hasRight('workstation', 'workstation', 'write'); // Used by the include of actions_dellink.inc.php |
|
88 | 88 | |
89 | 89 | $upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1]; |
90 | 90 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | |
100 | 100 | $parameters = array(); |
101 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
101 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
102 | 102 | if ($reshook < 0) { |
103 | 103 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
104 | 104 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
121 | - $triggermodname = 'WORKSTATION_WORKSTATION_MODIFY'; // Name of trigger action code to execute when we modify record |
|
121 | + $triggermodname = 'WORKSTATION_WORKSTATION_MODIFY'; // Name of trigger action code to execute when we modify record |
|
122 | 122 | |
123 | 123 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen |
124 | 124 | include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
@@ -400,11 +400,11 @@ discard block |
||
400 | 400 | $g = new UserGroup($db); |
401 | 401 | foreach ($object->usergroups as $id_group) { |
402 | 402 | $g->fetch($id_group); |
403 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '</li>'; |
|
403 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$g->getNomUrl(1, '', 0, 'categtextwhite').'</li>'; |
|
404 | 404 | } |
405 | 405 | |
406 | - print '<tr><td>' . $langs->trans('Groups') . '</td><td>'; |
|
407 | - print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
406 | + print '<tr><td>'.$langs->trans('Groups').'</td><td>'; |
|
407 | + print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
408 | 408 | print '</td></tr>'; |
409 | 409 | } |
410 | 410 | |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | $r = new Dolresource($db); |
415 | 415 | foreach ($object->resources as $id_resource) { |
416 | 416 | $r->fetch($id_resource); |
417 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '</li>'; |
|
417 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$r->getNomUrl(1, '', '', 0, 'categtextwhite').'</li>'; |
|
418 | 418 | } |
419 | 419 | |
420 | - print '<tr><td>' . $langs->trans('Machines') . '</td><td>'; |
|
421 | - print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
420 | + print '<tr><td>'.$langs->trans('Machines').'</td><td>'; |
|
421 | + print '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
422 | 422 | print '</td></tr>'; |
423 | 423 | } |
424 | 424 |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | // Edit .sql file |
271 | 271 | if ($moduletype == 'internal') { |
272 | 272 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
273 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
273 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
274 | 274 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
275 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
275 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
276 | 276 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
277 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
277 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
278 | 278 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql'; |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } else { |
283 | 283 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
284 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
284 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
285 | 285 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
286 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
286 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
287 | 287 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
288 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
288 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
289 | 289 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql'; |
290 | 290 | } |
291 | 291 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $objects[$fileobj['fullname']] = $objectnameloop; |
443 | 443 | } |
444 | 444 | } |
445 | - if (count($objects)>0) { |
|
445 | + if (count($objects) > 0) { |
|
446 | 446 | return $objects; |
447 | 447 | } |
448 | 448 | |
@@ -525,12 +525,12 @@ discard block |
||
525 | 525 | } |
526 | 526 | } |
527 | 527 | } elseif ($action == -2 && !empty($objectname) && !empty($module)) { |
528 | - $key= null; |
|
528 | + $key = null; |
|
529 | 529 | $right = null; |
530 | 530 | $objectOfRights = array(); |
531 | 531 | //check if object already declared in rights file |
532 | 532 | foreach ($permissions as $right) { |
533 | - $objectOfRights[]= $right[4]; |
|
533 | + $objectOfRights[] = $right[4]; |
|
534 | 534 | } |
535 | 535 | if (in_array(strtolower($objectname), $objectOfRights)) { |
536 | 536 | $error++; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | if (!$error) { |
558 | 558 | // prepare permissions array |
559 | 559 | $count_perms = count($permissions); |
560 | - for ($i = 0;$i<$count_perms;$i++) { |
|
560 | + for ($i = 0; $i < $count_perms; $i++) { |
|
561 | 561 | $permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)"; |
562 | 562 | $permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'"; |
563 | 563 | $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | |
578 | 578 | |
579 | 579 | // parcourir les objets |
580 | - $o=0; |
|
580 | + $o = 0; |
|
581 | 581 | foreach ($permissions as &$object) { |
582 | 582 | // récupérer la permission de l'objet |
583 | 583 | $p = 1; |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | { |
673 | 673 | |
674 | 674 | // stock all properties in array |
675 | - $attributesUnique = array ('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); |
|
675 | + $attributesUnique = array('type', 'label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default', 'foreignkey', 'arrayofkeyval', 'alwayseditable', 'validate', 'searchall', 'comment', 'isameasure', 'css', 'cssview', 'csslist', 'help', 'showoncombobox', 'picto'); |
|
676 | 676 | |
677 | 677 | $start = "public \$fields=array("; |
678 | 678 | $end = ");"; |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | foreach ($attributesUnique as $attUnique) { |
703 | 703 | $table .= "|".$attUnique; |
704 | 704 | } |
705 | - $table .="\n"; |
|
705 | + $table .= "\n"; |
|
706 | 706 | $valuesModif = array(); |
707 | 707 | foreach ($keys as $string) { |
708 | 708 | $string = trim($string, "'"); |
@@ -742,8 +742,8 @@ discard block |
||
742 | 742 | $valuesModif[$attUnique] = $values[$attUnique]; |
743 | 743 | } |
744 | 744 | } |
745 | - $table .= "|*" . $field[0] . "*|"; |
|
746 | - $table .= implode("|", $valuesModif) . "\n"; |
|
745 | + $table .= "|*".$field[0]."*|"; |
|
746 | + $table .= implode("|", $valuesModif)."\n"; |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | // end table |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | |
753 | 753 | //write in file |
754 | 754 | $writeInFile = dolReplaceInFile($destfile, array('== DATA SPECIFICATIONS' => $table)); |
755 | - if ($writeInFile<0) { |
|
755 | + if ($writeInFile < 0) { |
|
756 | 756 | return -1; |
757 | 757 | } |
758 | 758 | return 1; |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | $start = "== Table of fields and their properties for object *".ucfirst($objectname)."* : "; |
772 | 772 | $end = "__ end table for object ".ucfirst($objectname); |
773 | 773 | $str = file_get_contents($file); |
774 | - $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; |
|
774 | + $search = '/'.preg_quote($start, '/').'(.*?)'.preg_quote($end, '/').'/s'; |
|
775 | 775 | $new_contents = preg_replace($search, '', $str); |
776 | 776 | file_put_contents($file, $new_contents); |
777 | 777 | |
778 | 778 | //perms If Exist |
779 | 779 | $perms = "|*".strtolower($objectname)."*|"; |
780 | - $search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/'; |
|
780 | + $search_pattern_perms = '/'.preg_quote($perms, '/').'.*?\n/'; |
|
781 | 781 | $new_contents = preg_replace($search_pattern_perms, '', $new_contents); |
782 | 782 | file_put_contents($file, $new_contents); |
783 | 783 | } |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | $string = "[options='header',grid=rows,width=60%,caption=Organisation]\n"; |
834 | 834 | $string .= "|===\n"; |
835 | 835 | // header for table |
836 | - $header = array($langs->trans('Objects'),$langs->trans('Permission')); |
|
836 | + $header = array($langs->trans('Objects'), $langs->trans('Permission')); |
|
837 | 837 | foreach ($header as $h) { |
838 | 838 | $string .= "|".$h; |
839 | 839 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | foreach ($permissions as $key => $element) { |
861 | 861 | $element = str_replace(" '", '', $element); |
862 | 862 | $element = trim($element, "'"); |
863 | - $permsN[] = substr($element, strpos($element, "=")+1); |
|
863 | + $permsN[] = substr($element, strpos($element, "=") + 1); |
|
864 | 864 | } |
865 | 865 | array_pop($permsN); |
866 | 866 | |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | // end table |
891 | 891 | $string .= "\n|===\n"; |
892 | 892 | $write = dolReplaceInFile($destfile, array('__DATA_PERMISSIONS__'=> $string)); |
893 | - if ($write<0) { |
|
893 | + if ($write < 0) { |
|
894 | 894 | return -1; |
895 | 895 | } |
896 | 896 | return 1; |
@@ -919,26 +919,26 @@ discard block |
||
919 | 919 | if (strpos($lineContent, $varcomented) !== false) { |
920 | 920 | $lineContent = ''; |
921 | 921 | foreach ($objects as $object) { |
922 | - $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL; |
|
922 | + $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}".PHP_EOL; |
|
923 | 923 | } |
924 | 924 | //var_dump($lineContent);exit; |
925 | 925 | } |
926 | 926 | if (strpos($lineContent, $props) !== false) { |
927 | 927 | $lineContent = ''; |
928 | 928 | foreach ($objects as $object) { |
929 | - $lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL; |
|
929 | + $lineContent .= "\tpublic \$".strtolower($object).";".PHP_EOL; |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | if (strpos($lineContent, $constructObj) !== false) { |
933 | 933 | $lineContent = ''; |
934 | 934 | foreach ($objects as $object) { |
935 | - $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);". PHP_EOL; |
|
935 | + $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);".PHP_EOL; |
|
936 | 936 | } |
937 | 937 | } |
938 | 938 | if (strpos($lineContent, $includeClass) !== false) { |
939 | 939 | $lineContent = ''; |
940 | 940 | foreach ($objects as $object) { |
941 | - $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');". PHP_EOL; |
|
941 | + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');".PHP_EOL; |
|
942 | 942 | } |
943 | 943 | } |
944 | 944 | } |
@@ -948,10 +948,10 @@ discard block |
||
948 | 948 | //add methods for each object |
949 | 949 | $allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/'); |
950 | 950 | foreach ($objects as $object) { |
951 | - $contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); |
|
951 | + $contentReplaced = str_replace(["myobject", "MyObject"], [strtolower($object), $object], $allContent); |
|
952 | 952 | dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/')); |
953 | 953 | } |
954 | - dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename))); |
|
954 | + dolReplaceInFile($file, array($allContent => '', 'MyModule' => ucfirst($modulename))); |
|
955 | 955 | return 1; |
956 | 956 | } |
957 | 957 | |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | */ |
1013 | 1013 | function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) |
1014 | 1014 | { |
1015 | - $errors =0; |
|
1015 | + $errors = 0; |
|
1016 | 1016 | $counter = 0; |
1017 | 1017 | if (!file_exists($file)) { |
1018 | 1018 | return -1; |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | array_push($menus, $menuWantTo); |
1026 | 1026 | } elseif ($action == 2 && !empty($key) && !empty($menuWantTo)) { |
1027 | 1027 | // update right from permissions array |
1028 | - $urlCounter=0; |
|
1028 | + $urlCounter = 0; |
|
1029 | 1029 | // check if the values already exists |
1030 | 1030 | foreach ($menus as $index => $menu) { |
1031 | 1031 | if ($index !== $key) { |
@@ -1071,20 +1071,20 @@ discard block |
||
1071 | 1071 | $val_actuel = $menu; |
1072 | 1072 | $next_val = $menus[$index + 1]; |
1073 | 1073 | $str_menu .= $start."\n"; |
1074 | - $str_menu.= "\t\t\$this->menu[\$r++]=array(\n"; |
|
1075 | - $str_menu.= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n"; |
|
1076 | - $str_menu.= "\t\t\t 'type' =>'".$menu['type']."',\n"; |
|
1077 | - $str_menu.= "\t\t\t 'titre' =>'".$menu['titre']."',\n"; |
|
1078 | - $str_menu.= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n"; |
|
1079 | - $str_menu.= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n"; |
|
1080 | - $str_menu.= "\t\t\t 'url' =>'".$menu['url']."',\n"; |
|
1081 | - $str_menu.= "\t\t\t 'langs' =>'".$menu['langs']."',\n"; |
|
1082 | - $str_menu.= "\t\t\t 'position' =>".$menu['position'].",\n"; |
|
1083 | - $str_menu.= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n"; |
|
1084 | - $str_menu.= "\t\t\t 'perms' =>'".$menu['perms']."',\n"; |
|
1085 | - $str_menu.= "\t\t\t 'target' =>'".$menu['target']."',\n"; |
|
1086 | - $str_menu.= "\t\t\t 'user' =>".$menu['user'].",\n"; |
|
1087 | - $str_menu.= "\t\t);\n"; |
|
1074 | + $str_menu .= "\t\t\$this->menu[\$r++]=array(\n"; |
|
1075 | + $str_menu .= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n"; |
|
1076 | + $str_menu .= "\t\t\t 'type' =>'".$menu['type']."',\n"; |
|
1077 | + $str_menu .= "\t\t\t 'titre' =>'".$menu['titre']."',\n"; |
|
1078 | + $str_menu .= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n"; |
|
1079 | + $str_menu .= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n"; |
|
1080 | + $str_menu .= "\t\t\t 'url' =>'".$menu['url']."',\n"; |
|
1081 | + $str_menu .= "\t\t\t 'langs' =>'".$menu['langs']."',\n"; |
|
1082 | + $str_menu .= "\t\t\t 'position' =>".$menu['position'].",\n"; |
|
1083 | + $str_menu .= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n"; |
|
1084 | + $str_menu .= "\t\t\t 'perms' =>'".$menu['perms']."',\n"; |
|
1085 | + $str_menu .= "\t\t\t 'target' =>'".$menu['target']."',\n"; |
|
1086 | + $str_menu .= "\t\t\t 'user' =>".$menu['user'].",\n"; |
|
1087 | + $str_menu .= "\t\t);\n"; |
|
1088 | 1088 | |
1089 | 1089 | if ($val_actuel['leftmenu'] !== $next_val['leftmenu']) { |
1090 | 1090 | $str_menu .= $end."\n"; |
@@ -1121,21 +1121,21 @@ discard block |
||
1121 | 1121 | $dicData .= "\t\t\t'$key'=>"; |
1122 | 1122 | |
1123 | 1123 | if ($key === 'tabcond') { |
1124 | - $conditions = array_map(function ($val) use ($module) { |
|
1124 | + $conditions = array_map(function($val) use ($module) { |
|
1125 | 1125 | return ($val === true || $val === false) ? "isModEnabled('$module')" : $val; |
1126 | 1126 | }, $value); |
1127 | - $dicData .= "array(" . implode(",", $conditions) . ")"; |
|
1127 | + $dicData .= "array(".implode(",", $conditions).")"; |
|
1128 | 1128 | } elseif ($key === 'tabhelp') { |
1129 | 1129 | $helpItems = array(); |
1130 | 1130 | foreach ($value as $key => $helpValue) { |
1131 | 1131 | $helpItems[] = "array('code'=>\$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; |
1132 | 1132 | } |
1133 | - $dicData .= "array(" . implode(",", $helpItems) . ")"; |
|
1133 | + $dicData .= "array(".implode(",", $helpItems).")"; |
|
1134 | 1134 | } else { |
1135 | 1135 | if (is_array($value)) { |
1136 | - $dicData .= "array(" . implode(",", array_map(function ($val) { |
|
1136 | + $dicData .= "array(".implode(",", array_map(function($val) { |
|
1137 | 1137 | return "'$val'"; |
1138 | - }, $value)) . ")"; |
|
1138 | + }, $value)).")"; |
|
1139 | 1139 | } else { |
1140 | 1140 | $dicData .= "'$value'"; |
1141 | 1141 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | // check if tablename exist in Database and create it if not |
1204 | - $query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($namedic) . "'"; |
|
1204 | + $query = "SHOW TABLES LIKE '".MAIN_DB_PREFIX.strtolower($namedic)."'"; |
|
1205 | 1205 | $checkTable = $db->query($query); |
1206 | 1206 | if ($checkTable && $db->num_rows($checkTable) > 0) { |
1207 | 1207 | setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors'); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $maxfilesizearray = getMaxFileSizeArray(); |
210 | 210 | $maxmin = $maxfilesizearray['maxmin']; |
211 | 211 | if ($maxmin > 0) { |
212 | - $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
212 | + $texte .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file |
|
213 | 213 | } |
214 | 214 | $texte .= ' <input type="file" name="uploadfile">'; |
215 | 215 | $texte .= '<input type="hidden" value="PROPALE_ADDON_PDF_ODT_PATH" name="keyforuploaddir">'; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $newfiletmp = preg_replace('/template_/i', '', $newfiletmp); |
300 | 300 | $newfiletmp = preg_replace('/modele_/i', '', $newfiletmp); |
301 | 301 | |
302 | - $newfiletmp = $objectref . '_' . $newfiletmp; |
|
302 | + $newfiletmp = $objectref.'_'.$newfiletmp; |
|
303 | 303 | |
304 | 304 | // Get extension (ods or odt) |
305 | 305 | $newfileformat = substr($newfile, strrpos($newfile, '.') + 1); |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | if ($format == '1') { |
309 | 309 | $format = '%Y%m%d%H%M%S'; |
310 | 310 | } |
311 | - $filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat; |
|
311 | + $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; |
|
312 | 312 | } else { |
313 | - $filename = $newfiletmp . '.' . $newfileformat; |
|
313 | + $filename = $newfiletmp.'.'.$newfileformat; |
|
314 | 314 | } |
315 | - $file = $dir . '/' . $filename; |
|
315 | + $file = $dir.'/'.$filename; |
|
316 | 316 | //print "newdir=".$dir; |
317 | 317 | //print "newfile=".$newfile; |
318 | 318 | //print "file=".$file; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | dol_mkdir($conf->propal->multidir_temp[$object->entity]); |
322 | 322 | if (!is_writable($conf->propal->dir_temp)) { |
323 | 323 | $this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->propal->dir_temp); |
324 | - dol_syslog('Error in write_file: ' . $this->error, LOG_ERR); |
|
324 | + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); |
|
325 | 325 | return -1; |
326 | 326 | } |
327 | 327 | |
@@ -413,8 +413,8 @@ discard block |
||
413 | 413 | include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
414 | 414 | $companybankaccount = new CompanyBankAccount($this->db); |
415 | 415 | $companybankaccount->fetch(0, $object->thirdparty->id); |
416 | - $array_objet['company_default_bank_iban']=$companybankaccount->iban; |
|
417 | - $array_objet['company_default_bank_bic']=$companybankaccount->bic; |
|
416 | + $array_objet['company_default_bank_iban'] = $companybankaccount->iban; |
|
417 | + $array_objet['company_default_bank_bic'] = $companybankaccount->bic; |
|
418 | 418 | |
419 | 419 | // retrieve contact information for use in object as contact_xxx tags |
420 | 420 | $array_thirdparty_contact = array(); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? |
40 | 40 | $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
41 | 41 | $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button |
42 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
42 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
43 | 43 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search |
44 | 44 | $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page |
45 | -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
|
46 | -$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common) |
|
45 | +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
|
46 | +$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common) |
|
47 | 47 | $id = GETPOST('id', 'int'); |
48 | 48 | |
49 | 49 | // Load variable for pagination |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | // Default sort order (if not yet defined by previous GETPOST) |
74 | 74 | if (!$sortfield) { |
75 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
75 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
76 | 76 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
77 | 77 | } |
78 | 78 | if (!$sortorder) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; |
257 | 257 | } |
258 | 258 | if (preg_match('/_dtend$/', $key)) { |
259 | - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; |
|
259 | + $sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'"; |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | $langs->loadLangs(array('other')); |
38 | 38 | |
39 | 39 | // Get Parameters |
40 | -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
41 | -$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) |
|
42 | -$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? |
|
43 | -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
|
44 | -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button |
|
45 | -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
46 | -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search |
|
47 | -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page |
|
48 | -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
|
40 | +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
41 | +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) |
|
42 | +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? |
|
43 | +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation |
|
44 | +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button |
|
45 | +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list |
|
46 | +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'targetlist'; // To manage different context of search |
|
47 | +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page |
|
48 | +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
|
49 | 49 | $mode = GETPOST('mode', 'aZ'); |
50 | 50 | if (empty($mode)) { |
51 | 51 | $mode = 'modulesetup'; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | // Default sort order (if not yet defined by previous GETPOST) |
82 | 82 | if (!$sortfield) { |
83 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
83 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
84 | 84 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
85 | 85 | } |
86 | 86 | if (!$sortorder) { |
@@ -146,13 +146,19 @@ |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | // Security check (enable the most restrictive one) |
149 | -if ($user->socid > 0) accessforbidden(); |
|
149 | +if ($user->socid > 0) { |
|
150 | + accessforbidden(); |
|
151 | +} |
|
150 | 152 | //if ($user->socid > 0) accessforbidden(); |
151 | 153 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
152 | 154 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
153 | 155 | //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
154 | -if (!isModEnabled('webhook')) accessforbidden('Module not enabled'); |
|
155 | -if (!$permissiontoread) accessforbidden(); |
|
156 | +if (!isModEnabled('webhook')) { |
|
157 | + accessforbidden('Module not enabled'); |
|
158 | +} |
|
159 | +if (!$permissiontoread) { |
|
160 | + accessforbidden(); |
|
161 | +} |
|
156 | 162 | |
157 | 163 | |
158 | 164 | /* |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // Load object |
62 | 62 | include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
63 | 63 | |
64 | -$result = restrictedArea($user, $object->element, $object->id, 'paiement'); // This also test permission on read invoice |
|
64 | +$result = restrictedArea($user, $object->element, $object->id, 'paiement'); // This also test permission on read invoice |
|
65 | 65 | |
66 | 66 | // Security check |
67 | 67 | if ($user->socid) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | - if (! $error) { |
|
193 | + if (!$error) { |
|
194 | 194 | header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); |
195 | 195 | exit; |
196 | 196 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | if (isModEnabled('stripe') && in_array($object->ext_payment_site, array('Stripe', 'StripeLive'))) { |
426 | 426 | $tmp1 = explode('@', $object->ext_payment_id); |
427 | 427 | if (!empty($tmp1[1])) { |
428 | - $site_account_payment = $tmp1[1]; // pk_live_... |
|
428 | + $site_account_payment = $tmp1[1]; // pk_live_... |
|
429 | 429 | } |
430 | 430 | $tmp2 = explode(':', $tmp1[0]); |
431 | 431 | if (!empty($tmp2[1])) { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | } |
594 | 594 | |
595 | 595 | $params = array(); |
596 | -if (! empty($title_button)) { |
|
596 | +if (!empty($title_button)) { |
|
597 | 597 | $params['attr'] = array('title' => $title_button); |
598 | 598 | } |
599 | 599 |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
103 | 103 | */ |
104 | - public $fields=array( |
|
104 | + public $fields = array( |
|
105 | 105 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
106 | 106 | 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',), |
107 | 107 | 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | $this->date_creation = $this->db->jdate($obj->datec); |
888 | 888 | $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); |
889 | 889 | if (!empty($obj->datev)) { |
890 | - $this->date_validation = empty($obj->datev) ? '' : $this->db->jdate($obj->datev); |
|
890 | + $this->date_validation = empty($obj->datev) ? '' : $this->db->jdate($obj->datev); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 |