@@ -161,21 +161,21 @@ |
||
161 | 161 | if (isModEnabled('societe')) { |
162 | 162 | print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnContactActive").'</td><td>'; |
163 | 163 | print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_CONTACT_ACTIVE'), 'activecontact', array(Ldap::SYNCHRO_LDAP_TO_DOLIBARR)); |
164 | - print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnContactActiveExample") . '</span></td></tr>'; |
|
164 | + print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnContactActiveExample").'</span></td></tr>'; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // Synchro member active |
168 | 168 | if (isModEnabled('adherent')) { |
169 | - print '<tr class="oddeven"><td>' . $langs->trans("LDAPDnMemberActive") . '</td><td>'; |
|
169 | + print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberActive").'</td><td>'; |
|
170 | 170 | print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_ACTIVE'), 'activemembers', array(), 2); |
171 | - print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnMemberActiveExample") . '</span></td></tr>'; |
|
171 | + print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberActiveExample").'</span></td></tr>'; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Synchro member type active |
175 | 175 | if (isModEnabled('adherent')) { |
176 | - print '<tr class="oddeven"><td>' . $langs->trans("LDAPDnMemberTypeActive") . '</td><td>'; |
|
176 | + print '<tr class="oddeven"><td>'.$langs->trans("LDAPDnMemberTypeActive").'</td><td>'; |
|
177 | 177 | print $formldap->selectLdapDnSynchroActive(getDolGlobalInt('LDAP_MEMBER_TYPE_ACTIVE'), 'activememberstypes', array(), 2); |
178 | - print '</td><td><span class="opacitymedium">' . $langs->trans("LDAPDnMemberTypeActiveExample") . '</span></td></tr>'; |
|
178 | + print '</td><td><span class="opacitymedium">'.$langs->trans("LDAPDnMemberTypeActiveExample").'</span></td></tr>'; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Fields from hook |
@@ -100,14 +100,14 @@ |
||
100 | 100 | |
101 | 101 | // Param |
102 | 102 | $label = $langs->trans($key); |
103 | - print '<td><label for="' . $key . '">' . $label . '</label></td>'; |
|
103 | + print '<td><label for="'.$key.'">'.$label.'</label></td>'; |
|
104 | 104 | |
105 | 105 | // Value |
106 | 106 | print '<td>'; |
107 | 107 | if (isModEnabled('accounting')) { |
108 | 108 | print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1); |
109 | 109 | } else { |
110 | - print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . getDolGlobalString($key) . '">'; |
|
110 | + print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">'; |
|
111 | 111 | } |
112 | 112 | print '</td></tr>'; |
113 | 113 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | accessforbidden(); |
74 | 74 | } |
75 | 75 | |
76 | -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); |
|
76 | +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
|
77 | 77 | $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); |
78 | 78 | |
79 | 79 | $permissiontoread = $user->rights->eventorganization->read; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($user->socid > 0) { |
88 | 88 | accessforbidden(); |
89 | 89 | } |
90 | -$isdraft = (($object->status== $object::STATUS_DRAFT) ? 1 : 0); |
|
90 | +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
|
91 | 91 | $result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); |
92 | 92 | |
93 | 93 | if (!$permissiontoread) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); |
112 | 112 | |
113 | 113 | if ($result >= 0) { |
114 | - header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject)?'&withproject=1':'')); |
|
114 | + header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject) ? '&withproject=1' : '')); |
|
115 | 115 | exit; |
116 | 116 | } else { |
117 | 117 | if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $result = $object->delete_contact($lineid); |
130 | 130 | |
131 | 131 | if ($result >= 0) { |
132 | - header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject)?'&withproject=1':'')); |
|
132 | + header("Location: ".$_SERVER['PHP_SELF']."?id=".((int) $object->id).(!empty($withproject) ? '&withproject=1' : '')); |
|
133 | 133 | exit; |
134 | 134 | } else { |
135 | 135 | dol_print_error($db); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if (!empty($projectstatic->socid)) { |
166 | 166 | $projectstatic->fetch_thirdparty(); |
167 | 167 | } |
168 | -$withProjectUrl=''; |
|
168 | +$withProjectUrl = ''; |
|
169 | 169 | $object->project = clone $projectstatic; |
170 | 170 | |
171 | 171 | if (!empty($withproject)) { |
@@ -53,11 +53,17 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Security check (enable the most restrictive one) |
56 | -if ($user->socid > 0) accessforbidden(); |
|
56 | +if ($user->socid > 0) { |
|
57 | + accessforbidden(); |
|
58 | +} |
|
57 | 59 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
58 | 60 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
59 | -if (!isModEnabled('asset')) accessforbidden(); |
|
60 | -if (!empty($object->not_depreciated)) accessforbidden(); |
|
61 | +if (!isModEnabled('asset')) { |
|
62 | + accessforbidden(); |
|
63 | +} |
|
64 | +if (!empty($object->not_depreciated)) { |
|
65 | + accessforbidden(); |
|
66 | +} |
|
61 | 67 | |
62 | 68 | $object->asset_depreciation_options = &$assetdepreciationoptions; |
63 | 69 | $result = $assetdepreciationoptions->fetchDeprecationOptions($object->id); |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | |
25 | 25 | // Load Dolibarr environment |
26 | 26 | require '../main.inc.php'; |
27 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; |
|
28 | -require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
|
29 | -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
27 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php'; |
|
28 | +require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; |
|
29 | +require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
30 | 30 | |
31 | 31 | // Load translation files required by the page |
32 | 32 | $langs->loadLangs(array("assets", "companies")); |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $extrafields->fetch_name_optionals_label($object->table_element); |
49 | 49 | |
50 | 50 | // Load object |
51 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
51 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
|
52 | 52 | if ($id > 0 || !empty($ref)) { |
53 | - $upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id; |
|
53 | + $upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Security check (enable the most restrictive one) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | // Object card |
100 | 100 | // ------------------------------------------------------------ |
101 | - $linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
101 | + $linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
102 | 102 | |
103 | 103 | $morehtmlref = '<div class="refidno">'; |
104 | 104 | $morehtmlref .= '</div>'; |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | print '<div class="fichecenter">'; |
135 | 135 | print '<div class="fichehalfleft">'; |
136 | 136 | print '<div class="underbanner clearboth"></div>'; |
137 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
138 | - print '<tr><td class="titlefield">' . $langs->trans('AssetBaseDepreciationHT') . '</td><td>' . price($depreciation_info['base_depreciation_ht']) . '</td></tr>'; |
|
139 | - print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationBeginDate') . '</td><td>' . dol_print_date($object->date_start > $object->date_acquisition ? $object->date_start : $object->date_acquisition, 'day') . '</td></tr>'; |
|
137 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
138 | + print '<tr><td class="titlefield">'.$langs->trans('AssetBaseDepreciationHT').'</td><td>'.price($depreciation_info['base_depreciation_ht']).'</td></tr>'; |
|
139 | + print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationBeginDate').'</td><td>'.dol_print_date($object->date_start > $object->date_acquisition ? $object->date_start : $object->date_acquisition, 'day').'</td></tr>'; |
|
140 | 140 | print '</table>'; |
141 | 141 | |
142 | 142 | // We close div and reopen for second column |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | |
146 | 146 | print '<div class="underbanner clearboth"></div>'; |
147 | 147 | print '<table class="border centpercent tableforfield">'; |
148 | - print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationDuration') . '</td><td>' . $depreciation_info['duration'] . ' ( ' . $depreciation_info['duration_type'] . ' )</td></tr>'; |
|
149 | - print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationRate') . '</td><td>' . $depreciation_info['rate'] . '</td></tr>'; |
|
148 | + print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationDuration').'</td><td>'.$depreciation_info['duration'].' ( '.$depreciation_info['duration_type'].' )</td></tr>'; |
|
149 | + print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationRate').'</td><td>'.$depreciation_info['rate'].'</td></tr>'; |
|
150 | 150 | print '</table>'; |
151 | 151 | print '</div>'; |
152 | 152 | print '</div>'; |
@@ -160,21 +160,21 @@ discard block |
||
160 | 160 | |
161 | 161 | print '<tr class="liste_titre">'; |
162 | 162 | print '<td class="width20"></td>'; |
163 | - print '<td>' . $langs->trans("Ref") . '</td>'; |
|
164 | - print '<td class="center">' . $langs->trans("AssetDepreciationDate") . '</td>'; |
|
165 | - print '<td class="right">' . $langs->trans("AssetDepreciationHT") . '</td>'; |
|
166 | - print '<td class="right">' . $langs->trans("AssetCumulativeDepreciationHT") . '</td>'; |
|
167 | - print '<td class="right">' . $langs->trans("AssetResidualHT") . '</td>'; |
|
163 | + print '<td>'.$langs->trans("Ref").'</td>'; |
|
164 | + print '<td class="center">'.$langs->trans("AssetDepreciationDate").'</td>'; |
|
165 | + print '<td class="right">'.$langs->trans("AssetDepreciationHT").'</td>'; |
|
166 | + print '<td class="right">'.$langs->trans("AssetCumulativeDepreciationHT").'</td>'; |
|
167 | + print '<td class="right">'.$langs->trans("AssetResidualHT").'</td>'; |
|
168 | 168 | print '</tr>'; |
169 | 169 | |
170 | 170 | if (empty($lines)) { |
171 | - print '<tr><td class="impair center" colspan="6"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; |
|
171 | + print '<tr><td class="impair center" colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; |
|
172 | 172 | } else { |
173 | 173 | foreach ($lines as $line) { |
174 | 174 | print '<tr class="oddeven">'; |
175 | - print '<td>' . ($line['bookkeeping'] ? $bookkeeping_icon : ($line['depreciation_date'] > $now ? $future_icon : '')) . '</td>'; |
|
176 | - print '<td >' . (empty($line['ref']) ? $langs->trans('AssetDepreciationReversal') : $line['ref']) . '</td>'; |
|
177 | - print '<td class="center">' . dol_print_date($line['depreciation_date'], 'day') . '</td>'; |
|
175 | + print '<td>'.($line['bookkeeping'] ? $bookkeeping_icon : ($line['depreciation_date'] > $now ? $future_icon : '')).'</td>'; |
|
176 | + print '<td >'.(empty($line['ref']) ? $langs->trans('AssetDepreciationReversal') : $line['ref']).'</td>'; |
|
177 | + print '<td class="center">'.dol_print_date($line['depreciation_date'], 'day').'</td>'; |
|
178 | 178 | print '<td class="right">'; |
179 | 179 | print price($line['depreciation_ht']); |
180 | 180 | print '</td>'; |
@@ -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 | /* |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | if (GETPOSTISSET('supplier_invoice_id')) { |
183 | 183 | $object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => '1', 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',); |
184 | - print '<input type="hidden" name="supplier_invoice_id" value="' . GETPOST('supplier_invoice_id', 'int') . '">'; |
|
184 | + print '<input type="hidden" name="supplier_invoice_id" value="'.GETPOST('supplier_invoice_id', 'int').'">'; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | print dol_get_fiche_head(array(), ''); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array('type' => 'checkbox', 'name' => 'disposal_depreciated', 'label' => $langs->trans("AssetDisposalDepreciated"), 'value' => $disposal_depreciated), |
285 | 285 | array('type' => 'checkbox', 'name' => 'disposal_subject_to_vat', 'label' => $langs->trans("AssetDisposalSubjectToVat"), 'value' => $disposal_subject_to_vat), |
286 | 286 | ); |
287 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref . ' - ' . $object->label), 'confirm_disposal', $formquestion, 'yes', 1); |
|
287 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref.' - '.$object->label), 'confirm_disposal', $formquestion, 'yes', 1); |
|
288 | 288 | } elseif ($action == 'reopen') { |
289 | 289 | // Re-open |
290 | 290 | // Create an array for form |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | print '<table class="border centpercent tableforfield">'."\n"; |
329 | 329 | |
330 | 330 | // Common attributes |
331 | - $keyforbreak='date_acquisition'; // We change column just before this field |
|
331 | + $keyforbreak = 'date_acquisition'; // We change column just before this field |
|
332 | 332 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
333 | 333 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
334 | 334 | include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | // Buttons for actions |
348 | 348 | if ($action != 'presend' && $action != 'editline') { |
349 | - print '<div class="tabsAction">' . "\n"; |
|
349 | + print '<div class="tabsAction">'."\n"; |
|
350 | 350 | $parameters = array(); |
351 | 351 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
352 | 352 | if ($reshook < 0) { |
@@ -356,26 +356,26 @@ discard block |
||
356 | 356 | if (empty($reshook)) { |
357 | 357 | // Send |
358 | 358 | if (empty($user->socid)) { |
359 | - print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle'); |
|
359 | + print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | if ($object->status == $object::STATUS_DRAFT) { |
363 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
363 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | // Clone |
367 | 367 | //print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', false && $permissiontoadd); |
368 | 368 | |
369 | 369 | if ($object->status == $object::STATUS_DRAFT) { |
370 | - print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disposal&token=' . newToken(), '', $permissiontoadd); |
|
370 | + print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disposal&token='.newToken(), '', $permissiontoadd); |
|
371 | 371 | } else { |
372 | - print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen&token=' . newToken(), '', $permissiontoadd); |
|
372 | + print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | // Delete (need delete permission, or if draft, just need create/modify permission) |
376 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
376 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
377 | 377 | } |
378 | - print '</div>' . "\n"; |
|
378 | + print '</div>'."\n"; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | // Select mail models is same action as presend |
@@ -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 | /* |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | |
25 | 25 | // Load Dolibarr environment |
26 | 26 | require '../../main.inc.php'; |
27 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php'; |
|
28 | -require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php'; |
|
29 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
30 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
27 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php'; |
|
28 | +require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php'; |
|
29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
30 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
31 | 31 | |
32 | 32 | // Load translation files required by the page |
33 | 33 | $langs->loadLangs(array("assets", "other")); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // Initialize technical objects |
46 | 46 | $object = new AssetModel($db); |
47 | 47 | $extrafields = new ExtraFields($db); |
48 | -$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id; |
|
48 | +$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; |
|
49 | 49 | $hookmanager->initHooks(array('assetmodelcard', 'globalcard')); // Note that conf->hooks_modules contains array |
50 | 50 | |
51 | 51 | // Fetch optionals attributes and labels |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $search_all = GETPOST("search_all", 'alpha'); |
58 | 58 | $search = array(); |
59 | 59 | foreach ($object->fields as $key => $val) { |
60 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
61 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
60 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
61 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // Load object |
70 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
70 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
71 | 71 | |
72 | 72 | $permissiontoread = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read'))); |
73 | 73 | $permissiontoadd = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | if (empty($reshook)) { |
99 | 99 | $error = 0; |
100 | 100 | |
101 | - $backurlforlist = DOL_URL_ROOT . '/asset/model/list.php'; |
|
101 | + $backurlforlist = DOL_URL_ROOT.'/asset/model/list.php'; |
|
102 | 102 | |
103 | 103 | if (empty($backtopage) || ($cancel && empty($id))) { |
104 | 104 | if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { |
105 | 105 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
106 | 106 | $backtopage = $backurlforlist; |
107 | 107 | } else { |
108 | - $backtopage = DOL_URL_ROOT . '/asset/model/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__'); |
|
108 | + $backtopage = DOL_URL_ROOT.'/asset/model/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
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 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
124 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | $form = new Form($db); |
135 | 135 | $formfile = new FormFile($db); |
136 | 136 | |
137 | -$title = $langs->trans("AssetModel") . ' - ' . $langs->trans("Card"); |
|
137 | +$title = $langs->trans("AssetModel").' - '.$langs->trans("Card"); |
|
138 | 138 | $help_url = ''; |
139 | 139 | llxHeader('', $title, $help_url); |
140 | 140 | |
141 | 141 | // Part to create |
142 | 142 | if ($action == 'create') { |
143 | - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_' . $object->picto); |
|
143 | + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_'.$object->picto); |
|
144 | 144 | |
145 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
146 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
145 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
146 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
147 | 147 | print '<input type="hidden" name="action" value="add">'; |
148 | 148 | if ($backtopage) { |
149 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
149 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
150 | 150 | } |
151 | 151 | if ($backtopageforcancel) { |
152 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
152 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | print dol_get_fiche_head(array(), ''); |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | // Set some default values |
158 | 158 | //if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue'; |
159 | 159 | |
160 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
160 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
161 | 161 | |
162 | 162 | // Common attributes |
163 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
163 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
164 | 164 | |
165 | 165 | // Other attributes |
166 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; |
|
166 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
|
167 | 167 | |
168 | - print '</table>' . "\n"; |
|
168 | + print '</table>'."\n"; |
|
169 | 169 | |
170 | 170 | print dol_get_fiche_end(); |
171 | 171 | |
@@ -178,28 +178,28 @@ discard block |
||
178 | 178 | |
179 | 179 | // Part to edit record |
180 | 180 | if (($id || $ref) && $action == 'edit') { |
181 | - print load_fiche_titre($langs->trans("AssetModel"), '', 'object_' . $object->picto); |
|
181 | + print load_fiche_titre($langs->trans("AssetModel"), '', 'object_'.$object->picto); |
|
182 | 182 | |
183 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
184 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
183 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
184 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
185 | 185 | print '<input type="hidden" name="action" value="update">'; |
186 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
186 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
187 | 187 | if ($backtopage) { |
188 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
188 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
189 | 189 | } |
190 | 190 | if ($backtopageforcancel) { |
191 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
191 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | print dol_get_fiche_head(); |
195 | 195 | |
196 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
196 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
197 | 197 | |
198 | 198 | // Common attributes |
199 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
199 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
200 | 200 | |
201 | 201 | // Other attributes |
202 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
202 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
203 | 203 | |
204 | 204 | print '</table>'; |
205 | 205 | |
@@ -221,12 +221,12 @@ discard block |
||
221 | 221 | |
222 | 222 | // Confirmation to delete |
223 | 223 | if ($action == 'delete') { |
224 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
224 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
225 | 225 | } elseif ($action == 'clone') { |
226 | 226 | // Clone confirmation |
227 | 227 | // Create an array for form |
228 | 228 | $formquestion = array(); |
229 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); |
|
229 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Call Hook formConfirm |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | // Object card |
246 | 246 | // ------------------------------------------------------------ |
247 | - $linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
247 | + $linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
248 | 248 | |
249 | 249 | $morehtmlref = '<div class="refidno">'; |
250 | 250 | $morehtmlref .= '</div>'; |
@@ -256,13 +256,13 @@ discard block |
||
256 | 256 | print '<div class="fichecenter">'; |
257 | 257 | print '<div class="fichehalfleft">'; |
258 | 258 | print '<div class="underbanner clearboth"></div>'; |
259 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
259 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
260 | 260 | |
261 | 261 | // Common attributes |
262 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
262 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
263 | 263 | |
264 | 264 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
265 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
265 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
266 | 266 | |
267 | 267 | print '</table>'; |
268 | 268 | print '</div>'; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | |
276 | 276 | // Buttons for actions |
277 | 277 | if ($action != 'editline') { |
278 | - print '<div class="tabsAction">' . "\n"; |
|
278 | + print '<div class="tabsAction">'."\n"; |
|
279 | 279 | $parameters = array(); |
280 | 280 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
281 | 281 | if ($reshook < 0) { |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | |
285 | 285 | if (empty($reshook)) { |
286 | 286 | if ($object->status == $object::STATUS_DRAFT) { |
287 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
287 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Back to draft |
291 | 291 | if ($object->status != $object::STATUS_DRAFT) { |
292 | - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
292 | + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | if ($object->status != $object::STATUS_VALIDATED) { |
296 | - print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=confirm_validate&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
296 | + print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | if ($object->status != $object::STATUS_CANCELED) { |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | // Clone |
304 | - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($socid) ? '&socid=' . $socid : '') . '&action=clone&token=' . newToken(), '', $permissiontoadd); |
|
304 | + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($socid) ? '&socid='.$socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd); |
|
305 | 305 | |
306 | 306 | // Delete (need delete permission, or if draft, just need create/modify permission) |
307 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
307 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); |
|
308 | 308 | } |
309 | - print '</div>' . "\n"; |
|
309 | + print '</div>'."\n"; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
@@ -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 | } |
@@ -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 |