@@ -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 | } |
@@ -75,10 +75,14 @@ |
||
75 | 75 | $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php |
76 | 76 | |
77 | 77 | // Security check (enable the most restrictive one) |
78 | -if ($user->socid > 0) accessforbidden(); |
|
78 | +if ($user->socid > 0) { |
|
79 | + accessforbidden(); |
|
80 | +} |
|
79 | 81 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
80 | 82 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
81 | -if (!isModEnabled('asset')) accessforbidden(); |
|
83 | +if (!isModEnabled('asset')) { |
|
84 | + accessforbidden(); |
|
85 | +} |
|
82 | 86 | |
83 | 87 | |
84 | 88 | /* |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | // Object card |
119 | 119 | // ------------------------------------------------------------ |
120 | - $linkback = '<a href="' . dol_buildpath('/asset/asset_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
120 | + $linkback = '<a href="'.dol_buildpath('/asset/asset_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
121 | 121 | |
122 | 122 | $morehtmlref = '<div class="refidno">'; |
123 | 123 | $morehtmlref .= '</div>'; |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | print '<table class="border centpercent tableforfield">'; |
131 | 131 | |
132 | 132 | // Number of files |
133 | - print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>'; |
|
133 | + print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; |
|
134 | 134 | |
135 | 135 | // Total size |
136 | - print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>'; |
|
136 | + print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; |
|
137 | 137 | |
138 | 138 | print '</table>'; |
139 | 139 | |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | // $permissiontoadd = 1; |
147 | 147 | $permtoedit = $user->hasRight('asset', 'write'); |
148 | 148 | // $permtoedit = 1; |
149 | - $param = '&id=' . $object->id; |
|
149 | + $param = '&id='.$object->id; |
|
150 | 150 | |
151 | 151 | //$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/'; |
152 | - $relativepathwithnofile = dol_sanitizeFileName($object->ref) . '/'; |
|
152 | + $relativepathwithnofile = dol_sanitizeFileName($object->ref).'/'; |
|
153 | 153 | |
154 | - include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; |
|
154 | + include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; |
|
155 | 155 | } else { |
156 | 156 | accessforbidden('', 0, 1); |
157 | 157 | } |
@@ -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 = ""; |
@@ -89,10 +89,10 @@ |
||
89 | 89 | */ |
90 | 90 | |
91 | 91 | $parameters = array(); |
92 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
92 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
93 | 93 | // Delete Link |
94 | 94 | $permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php |
95 | -include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
95 | +include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
|
96 | 96 | |
97 | 97 | if ($action == 'add') { |
98 | 98 | $db->begin(); |
@@ -222,7 +222,7 @@ |
||
222 | 222 | $num = $this->db->num_rows($resql); |
223 | 223 | |
224 | 224 | if (empty($conf->partnership->enabled)) { |
225 | - $num = 0; // Force empty list if category module is not enabled |
|
225 | + $num = 0; // Force empty list if category module is not enabled |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | if ($num) { |
@@ -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) { |