@@ -76,12 +76,20 @@ |
||
76 | 76 | $upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1]; |
77 | 77 | |
78 | 78 | // Security check (enable the most restrictive one) |
79 | -if ($user->socid > 0) accessforbidden(); |
|
80 | -if ($user->socid > 0) $socid = $user->socid; |
|
79 | +if ($user->socid > 0) { |
|
80 | + accessforbidden(); |
|
81 | +} |
|
82 | +if ($user->socid > 0) { |
|
83 | + $socid = $user->socid; |
|
84 | +} |
|
81 | 85 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
82 | 86 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
83 | -if (!isModEnabled('asset')) accessforbidden(); |
|
84 | -if (!$permissiontoread) accessforbidden(); |
|
87 | +if (!isModEnabled('asset')) { |
|
88 | + accessforbidden(); |
|
89 | +} |
|
90 | +if (!$permissiontoread) { |
|
91 | + accessforbidden(); |
|
92 | +} |
|
85 | 93 | |
86 | 94 | |
87 | 95 | /* |
@@ -83,10 +83,14 @@ |
||
83 | 83 | $permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php |
84 | 84 | |
85 | 85 | // Security check (enable the most restrictive one) |
86 | -if ($user->socid > 0) accessforbidden(); |
|
86 | +if ($user->socid > 0) { |
|
87 | + accessforbidden(); |
|
88 | +} |
|
87 | 89 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
88 | 90 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
89 | -if (!isModEnabled('asset')) accessforbidden(); |
|
91 | +if (!isModEnabled('asset')) { |
|
92 | + accessforbidden(); |
|
93 | +} |
|
90 | 94 | |
91 | 95 | |
92 | 96 | /* |
@@ -76,12 +76,20 @@ |
||
76 | 76 | $upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1]; |
77 | 77 | |
78 | 78 | // Security check (enable the most restrictive one) |
79 | -if ($user->socid > 0) accessforbidden(); |
|
80 | -if ($user->socid > 0) $socid = $user->socid; |
|
79 | +if ($user->socid > 0) { |
|
80 | + accessforbidden(); |
|
81 | +} |
|
82 | +if ($user->socid > 0) { |
|
83 | + $socid = $user->socid; |
|
84 | +} |
|
81 | 85 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
82 | 86 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
83 | -if (!isModEnabled('asset')) accessforbidden(); |
|
84 | -if (!$permissiontoread) accessforbidden(); |
|
87 | +if (!isModEnabled('asset')) { |
|
88 | + accessforbidden(); |
|
89 | +} |
|
90 | +if (!$permissiontoread) { |
|
91 | + accessforbidden(); |
|
92 | +} |
|
85 | 93 | |
86 | 94 | |
87 | 95 | /* |
@@ -84,12 +84,20 @@ |
||
84 | 84 | $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php |
85 | 85 | |
86 | 86 | // Security check (enable the most restrictive one) |
87 | -if ($user->socid > 0) accessforbidden(); |
|
88 | -if ($user->socid > 0) $socid = $user->socid; |
|
87 | +if ($user->socid > 0) { |
|
88 | + accessforbidden(); |
|
89 | +} |
|
90 | +if ($user->socid > 0) { |
|
91 | + $socid = $user->socid; |
|
92 | +} |
|
89 | 93 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
90 | 94 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
91 | -if (!isModEnabled('asset')) accessforbidden(); |
|
92 | -if (!$permissiontoread) accessforbidden(); |
|
95 | +if (!isModEnabled('asset')) { |
|
96 | + accessforbidden(); |
|
97 | +} |
|
98 | +if (!$permissiontoread) { |
|
99 | + accessforbidden(); |
|
100 | +} |
|
93 | 101 | |
94 | 102 | |
95 | 103 | /* |
@@ -140,8 +140,12 @@ discard block |
||
140 | 140 | } |
141 | 141 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
142 | 142 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
143 | -if (!isModEnabled('asset')) accessforbidden(); |
|
144 | -if (!$permissiontoread) accessforbidden(); |
|
143 | +if (!isModEnabled('asset')) { |
|
144 | + accessforbidden(); |
|
145 | +} |
|
146 | +if (!$permissiontoread) { |
|
147 | + accessforbidden(); |
|
148 | +} |
|
145 | 149 | |
146 | 150 | /* |
147 | 151 | * Actions |
@@ -169,7 +173,9 @@ discard block |
||
169 | 173 | if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers |
170 | 174 | foreach ($object->fields as $key => $val) { |
171 | 175 | $search[$key] = ''; |
172 | - if ($key == 'fk_pays') $search[$key] = $mysoc->country_id; |
|
176 | + if ($key == 'fk_pays') { |
|
177 | + $search[$key] = $mysoc->country_id; |
|
178 | + } |
|
173 | 179 | if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { |
174 | 180 | $search[$key.'_dtstart'] = ''; |
175 | 181 | $search[$key.'_dtend'] = ''; |
@@ -56,11 +56,17 @@ discard block |
||
56 | 56 | $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php |
57 | 57 | |
58 | 58 | // Security check (enable the most restrictive one) |
59 | -if ($user->socid > 0) accessforbidden(); |
|
59 | +if ($user->socid > 0) { |
|
60 | + accessforbidden(); |
|
61 | +} |
|
60 | 62 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
61 | 63 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
62 | -if (!isModEnabled('asset')) accessforbidden(); |
|
63 | -if (!$permissiontoread) accessforbidden(); |
|
64 | +if (!isModEnabled('asset')) { |
|
65 | + accessforbidden(); |
|
66 | +} |
|
67 | +if (!$permissiontoread) { |
|
68 | + accessforbidden(); |
|
69 | +} |
|
64 | 70 | |
65 | 71 | $object->asset_depreciation_options = &$assetdepreciationoptions; |
66 | 72 | $result = $assetdepreciationoptions->fetchDeprecationOptions(0, $object->id); |
@@ -104,7 +110,9 @@ discard block |
||
104 | 110 | |
105 | 111 | if ($action == "update") { |
106 | 112 | $result = $assetdepreciationoptions->setDeprecationOptionsFromPost(1); |
107 | - if ($result > 0) $result = $assetdepreciationoptions->updateDeprecationOptions($user, 0, $object->id); |
|
113 | + if ($result > 0) { |
|
114 | + $result = $assetdepreciationoptions->updateDeprecationOptions($user, 0, $object->id); |
|
115 | + } |
|
108 | 116 | if ($result < 0) { |
109 | 117 | setEventMessages($assetdepreciationoptions->error, $assetdepreciationoptions->errors, 'errors'); |
110 | 118 | $action = 'edit'; |
@@ -56,11 +56,17 @@ |
||
56 | 56 | $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); // Used by the include of actions_addupdatedelete.inc.php |
57 | 57 | |
58 | 58 | // Security check (enable the most restrictive one) |
59 | -if ($user->socid > 0) accessforbidden(); |
|
59 | +if ($user->socid > 0) { |
|
60 | + accessforbidden(); |
|
61 | +} |
|
60 | 62 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
61 | 63 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
62 | -if (!isModEnabled('asset')) accessforbidden(); |
|
63 | -if (!$permissiontoread) accessforbidden(); |
|
64 | +if (!isModEnabled('asset')) { |
|
65 | + accessforbidden(); |
|
66 | +} |
|
67 | +if (!$permissiontoread) { |
|
68 | + accessforbidden(); |
|
69 | +} |
|
64 | 70 | |
65 | 71 | $result = $assetaccountancycodes->fetchAccountancyCodes(0, $object->id); |
66 | 72 | if ($result < 0) { |
@@ -54,11 +54,17 @@ |
||
54 | 54 | $permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php |
55 | 55 | |
56 | 56 | // Security check (enable the most restrictive one) |
57 | -if ($user->socid > 0) accessforbidden(); |
|
57 | +if ($user->socid > 0) { |
|
58 | + accessforbidden(); |
|
59 | +} |
|
58 | 60 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
59 | 61 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
60 | -if (!isModEnabled('asset')) accessforbidden(); |
|
61 | -if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden(); |
|
62 | +if (!isModEnabled('asset')) { |
|
63 | + accessforbidden(); |
|
64 | +} |
|
65 | +if (!isset($object->disposal_date) || $object->disposal_date === "") { |
|
66 | + accessforbidden(); |
|
67 | +} |
|
62 | 68 | |
63 | 69 | |
64 | 70 | /* |
@@ -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 |