@@ -130,12 +130,20 @@ |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | // Security check (enable the most restrictive one) |
| 133 | -if ($user->socid > 0) accessforbidden(); |
|
| 134 | -$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
|
| 133 | +if ($user->socid > 0) { |
|
| 134 | + accessforbidden(); |
|
| 135 | +} |
|
| 136 | +$socid = 0; if ($user->socid > 0) { |
|
| 137 | + $socid = $user->socid; |
|
| 138 | +} |
|
| 135 | 139 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 136 | 140 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 137 | -if (!isModEnabled('asset')) accessforbidden(); |
|
| 138 | -if (!$permissiontoread) accessforbidden(); |
|
| 141 | +if (!isModEnabled('asset')) { |
|
| 142 | + accessforbidden(); |
|
| 143 | +} |
|
| 144 | +if (!$permissiontoread) { |
|
| 145 | + accessforbidden(); |
|
| 146 | +} |
|
| 139 | 147 | |
| 140 | 148 | |
| 141 | 149 | |
@@ -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 | } |
@@ -100,7 +100,9 @@ |
||
| 100 | 100 | * View |
| 101 | 101 | */ |
| 102 | 102 | |
| 103 | -if (isModEnabled('project')) $formproject = new FormProjets($db); |
|
| 103 | +if (isModEnabled('project')) { |
|
| 104 | + $formproject = new FormProjets($db); |
|
| 105 | +} |
|
| 104 | 106 | |
| 105 | 107 | $title = $langs->trans('Salary')." - ".$langs->trans('Info'); |
| 106 | 108 | $help_url = ""; |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | $arraykeyvalue = array(); |
| 126 | 126 | foreach ($accountingcategory->lines_cptbk as $key => $val) { |
| 127 | 127 | $doc_ref = !empty($val->doc_ref) ? $val->doc_ref : ''; |
| 128 | - $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . ($doc_ref ? ' '.$doc_ref : ''); |
|
| 128 | + $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte).' - '.$val->label_compte.($doc_ref ? ' '.$doc_ref : ''); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | $type = $object->type; |
| 58 | 58 | if (is_numeric($type)) { |
| 59 | - $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
| 59 | + $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | // Get parameters |
| 49 | 49 | $action = GETPOST('action', 'aZ09'); |
| 50 | -$search_prod = GETPOST('search_prod', 'alpha'); |
|
| 50 | +$search_prod = GETPOST('search_prod', 'alpha'); |
|
| 51 | 51 | $cancel = GETPOST('cancel', 'alpha'); |
| 52 | 52 | $search_label = GETPOST('search_label', 'alpha'); |
| 53 | 53 | $search_price = GETPOST('search_price'); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); |
| 68 | 68 | $cancel = GETPOST('cancel', 'alpha'); |
| 69 | 69 | $backtopage = GETPOST('backtopage', 'alpha'); |
| 70 | -$confirm = GETPOST('confirm'); |
|
| 70 | +$confirm = GETPOST('confirm'); |
|
| 71 | 71 | $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); |
| 72 | 72 | |
| 73 | 73 | if ($user->socid) { |
@@ -52,10 +52,10 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // Sort & Order fields |
| 55 | -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 55 | +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 56 | 56 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
| 57 | 57 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
| 58 | -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
| 58 | +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
| 59 | 59 | $optioncss = GETPOST('optioncss', 'alpha'); |
| 60 | 60 | |
| 61 | 61 | if (empty($page) || $page == -1) { |
@@ -39,21 +39,21 @@ |
||
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | // Get parameters |
| 42 | -$action = GETPOST('action', 'aZ09'); |
|
| 43 | -$confirm = GETPOST('confirm'); |
|
| 44 | -$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); |
|
| 45 | -$ref = GETPOST('ref', 'alpha'); |
|
| 42 | +$action = GETPOST('action', 'aZ09'); |
|
| 43 | +$confirm = GETPOST('confirm'); |
|
| 44 | +$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); |
|
| 45 | +$ref = GETPOST('ref', 'alpha'); |
|
| 46 | 46 | |
| 47 | -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 47 | +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
|
| 48 | 48 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
| 49 | 49 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
| 50 | -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
| 50 | +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
|
| 51 | 51 | |
| 52 | 52 | if (empty($page) || $page == -1) { |
| 53 | 53 | $page = 0; |
| 54 | 54 | } // If $page is not defined, or '' or -1 |
| 55 | 55 | |
| 56 | -$offset = $limit * $page; |
|
| 56 | +$offset = $limit * $page; |
|
| 57 | 57 | $pageprev = $page - 1; |
| 58 | 58 | $pagenext = $page + 1; |
| 59 | 59 | |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | */ |
| 96 | 96 | |
| 97 | 97 | $parameters = array('id'=>$id); |
| 98 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 98 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 99 | 99 | if ($reshook < 0) { |
| 100 | 100 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 101 | 101 | } |