@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | $socid = $user->socid; |
40 | 40 | } |
41 | 41 | |
42 | -if (!$user->rights->facture->creer) |
|
43 | -accessforbidden(); |
|
42 | +if (!$user->rights->facture->creer) { |
|
43 | + accessforbidden(); |
|
44 | +} |
|
44 | 45 | |
45 | 46 | // Load translation files required by the page |
46 | 47 | $langs->loadLangs(array("companies", "orders")); |
@@ -53,8 +54,12 @@ discard block |
||
53 | 54 | $offset = $limit * $page; |
54 | 55 | $pageprev = $page - 1; |
55 | 56 | $pagenext = $page + 1; |
56 | -if (!$sortorder) $sortorder = "ASC"; |
|
57 | -if (!$sortfield) $sortfield = "nom"; |
|
57 | +if (!$sortorder) { |
|
58 | + $sortorder = "ASC"; |
|
59 | +} |
|
60 | +if (!$sortfield) { |
|
61 | + $sortfield = "nom"; |
|
62 | +} |
|
58 | 63 | |
59 | 64 | |
60 | 65 | /* |
@@ -71,19 +76,31 @@ discard block |
||
71 | 76 | |
72 | 77 | $sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea"; |
73 | 78 | $sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; |
74 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; |
|
79 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
80 | + $sql .= ", sc.fk_soc, sc.fk_user "; |
|
81 | +} |
|
75 | 82 | $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c"; |
76 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
83 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
84 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
85 | +} |
|
77 | 86 | $sql .= " WHERE s.fk_stcomm = st.id AND c.fk_soc = s.rowid"; |
78 | 87 | $sql .= " AND s.entity IN (".getEntity('societe').")"; |
79 | -if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
88 | +if (!$user->rights->societe->client->voir && !$socid) { |
|
89 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; |
|
90 | +} |
|
80 | 91 | if (dol_strlen($stcomm)) |
81 | 92 | { |
82 | 93 | $sql .= " AND s.fk_stcomm=".$stcomm; |
83 | 94 | } |
84 | -if (GETPOST("search_nom")) $sql .= natural_search("s.nom", GETPOST("search_nom")); |
|
85 | -if (GETPOST("search_compta")) $sql .= natural_search("s.code_compta", GETPOST("search_compta")); |
|
86 | -if (GETPOST("search_code_client")) $sql .= natural_search("s.code_client", GETPOST("search_code_client")); |
|
95 | +if (GETPOST("search_nom")) { |
|
96 | + $sql .= natural_search("s.nom", GETPOST("search_nom")); |
|
97 | +} |
|
98 | +if (GETPOST("search_compta")) { |
|
99 | + $sql .= natural_search("s.code_compta", GETPOST("search_compta")); |
|
100 | +} |
|
101 | +if (GETPOST("search_code_client")) { |
|
102 | + $sql .= natural_search("s.code_client", GETPOST("search_code_client")); |
|
103 | +} |
|
87 | 104 | if (dol_strlen($begin)) |
88 | 105 | { |
89 | 106 | $sql .= " AND s.nom like '".$db->escape($begin)."'"; |
@@ -103,9 +120,11 @@ discard block |
||
103 | 120 | $result = $db->query($sql); |
104 | 121 | $nbtotalofrecords = $db->num_rows($result); |
105 | 122 | |
106 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
123 | + if (($page * $limit) > $nbtotalofrecords) { |
|
124 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
107 | 125 | { |
108 | 126 | $page = 0; |
127 | + } |
|
109 | 128 | $offset = 0; |
110 | 129 | } |
111 | 130 | } |
@@ -64,8 +64,12 @@ |
||
64 | 64 | if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; } |
65 | 65 | if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder = $conf->global->MAIN_DOC_SORT_ORDER; } |
66 | 66 | |
67 | -if (!$sortorder) $sortorder = "ASC"; |
|
68 | -if (!$sortfield) $sortfield = "name"; |
|
67 | +if (!$sortorder) { |
|
68 | + $sortorder = "ASC"; |
|
69 | +} |
|
70 | +if (!$sortfield) { |
|
71 | + $sortfield = "name"; |
|
72 | +} |
|
69 | 73 | |
70 | 74 | $object = new Commande($db); |
71 | 75 |
@@ -85,7 +85,10 @@ discard block |
||
85 | 85 | <div class="contenu"> |
86 | 86 | <div class="inline-block" style="vertical-align: top"> |
87 | 87 | <div class="principal_login"> |
88 | -<?php if ($err) print dol_escape_htmltag($err)."<br><br>\n"; ?> |
|
88 | +<?php if ($err) { |
|
89 | + print dol_escape_htmltag($err)."<br><br>\n"; |
|
90 | +} |
|
91 | +?> |
|
89 | 92 | <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend> |
90 | 93 | <form id="frmLogin" method="POST" action="index_verif.php"> |
91 | 94 | <input type="hidden" name="token" value="<?php echo newToken(); ?>" /> |
@@ -130,7 +133,10 @@ discard block |
||
130 | 133 | print '<td>'; |
131 | 134 | $disabled = 0; |
132 | 135 | $langs->load("companies"); |
133 | -if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled = 1; // If a particular third party is defined, we disable choice |
|
136 | +if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) { |
|
137 | + $disabled = 1; |
|
138 | +} |
|
139 | +// If a particular third party is defined, we disable choice |
|
134 | 140 | print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 0, array(), 0, 'maxwidth300'); |
135 | 141 | //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />'; |
136 | 142 | print '</td>'; |
@@ -143,7 +149,10 @@ discard block |
||
143 | 149 | print '<td class="label1">'.$langs->trans("Warehouse").'</td>'; |
144 | 150 | print '<td>'; |
145 | 151 | $disabled = 0; |
146 | - if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) $disabled = 1; // If a particular stock is defined, we disable choice |
|
152 | + if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) { |
|
153 | + $disabled = 1; |
|
154 | + } |
|
155 | + // If a particular stock is defined, we disable choice |
|
147 | 156 | print $formproduct->selectWarehouses((GETPOST('warehouseid') ?GETPOST('warehouseid', 'int') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE)), 'warehouseid', '', !$disabled, $disabled); |
148 | 157 | print '</td>'; |
149 | 158 | print "</tr>\n"; |
@@ -153,7 +162,10 @@ discard block |
||
153 | 162 | print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>'; |
154 | 163 | print '<td>'; |
155 | 164 | $defaultknown = 0; |
156 | -if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice |
|
165 | +if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) { |
|
166 | + $defaultknown = 1; |
|
167 | +} |
|
168 | +// If a particular stock is defined, we disable choice |
|
157 | 169 | $form->select_comptes(((GETPOST('bankid_cash') > 0) ?GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH), 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", ($defaultknown ? 0 : 2)); |
158 | 170 | print '</td>'; |
159 | 171 | print "</tr>\n"; |
@@ -162,7 +174,10 @@ discard block |
||
162 | 174 | print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>'; |
163 | 175 | print '<td>'; |
164 | 176 | $defaultknown = 0; |
165 | -if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice |
|
177 | +if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) { |
|
178 | + $defaultknown = 1; |
|
179 | +} |
|
180 | +// If a particular stock is defined, we disable choice |
|
166 | 181 | $form->select_comptes(((GETPOST('bankid_cheque') > 0) ?GETPOST('bankid_cheque') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE), 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", ($defaultknown ? 0 : 2)); |
167 | 182 | print '</td>'; |
168 | 183 | print "</tr>\n"; |
@@ -171,7 +186,10 @@ discard block |
||
171 | 186 | print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>'; |
172 | 187 | print '<td>'; |
173 | 188 | $defaultknown = 0; |
174 | -if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) $defaultknown = 1; // If a particular stock is defined, we disable choice |
|
189 | +if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) { |
|
190 | + $defaultknown = 1; |
|
191 | +} |
|
192 | +// If a particular stock is defined, we disable choice |
|
175 | 193 | $form->select_comptes(((GETPOST('bankid_cb') > 0) ?GETPOST('bankid_cb') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB), 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", ($defaultknown ? 0 : 2)); |
176 | 194 | print '</td>'; |
177 | 195 | print "</tr>\n"; |
@@ -58,7 +58,9 @@ |
||
58 | 58 | print '<div class="principal">'; |
59 | 59 | |
60 | 60 | $page = GETPOST('menutpl', 'alpha'); |
61 | -if (empty($page)) $page = 'facturation'; |
|
61 | +if (empty($page)) { |
|
62 | + $page = 'facturation'; |
|
63 | +} |
|
62 | 64 | |
63 | 65 | if (in_array( |
64 | 66 | $page, |
@@ -52,20 +52,23 @@ |
||
52 | 52 | case 'ESP': |
53 | 53 | echo $langs->trans("Cash"); |
54 | 54 | $filtre = 'courant=2'; |
55 | - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) |
|
56 | - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]; |
|
55 | + if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) { |
|
56 | + $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]; |
|
57 | + } |
|
57 | 58 | break; |
58 | 59 | case 'CB': |
59 | 60 | echo $langs->trans("CreditCard"); |
60 | 61 | $filtre = 'courant=1'; |
61 | - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) |
|
62 | - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]; |
|
62 | + if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) { |
|
63 | + $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]; |
|
64 | + } |
|
63 | 65 | break; |
64 | 66 | case 'CHQ': |
65 | 67 | echo $langs->trans("Cheque"); |
66 | 68 | $filtre = 'courant=1'; |
67 | - if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) |
|
68 | - $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]; |
|
69 | + if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) { |
|
70 | + $selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]; |
|
71 | + } |
|
69 | 72 | break; |
70 | 73 | case 'DIF': |
71 | 74 | echo $langs->trans("Reported"); |
@@ -27,8 +27,12 @@ discard block |
||
27 | 27 | require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; |
28 | 28 | require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; |
29 | 29 | require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
30 | -if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; |
|
31 | -if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; |
|
30 | +if (!empty($conf->accounting->enabled)) { |
|
31 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; |
|
32 | +} |
|
33 | +if (!empty($conf->accounting->enabled)) { |
|
34 | + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; |
|
35 | +} |
|
32 | 36 | require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
33 | 37 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
34 | 38 | |
@@ -44,7 +48,9 @@ discard block |
||
44 | 48 | |
45 | 49 | // Security check |
46 | 50 | $socid = GETPOST('socid', 'int'); |
47 | -if ($user->socid) $socid = $user->socid; |
|
51 | +if ($user->socid) { |
|
52 | + $socid = $user->socid; |
|
53 | +} |
|
48 | 54 | $result = restrictedArea($user, 'loan', $id, '', ''); |
49 | 55 | |
50 | 56 | $object = new Loan($db); |
@@ -57,7 +63,9 @@ discard block |
||
57 | 63 | */ |
58 | 64 | |
59 | 65 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
60 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
66 | +if ($reshook < 0) { |
|
67 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
68 | +} |
|
61 | 69 | if (empty($reshook)) |
62 | 70 | { |
63 | 71 | // Classify paid |
@@ -208,16 +216,18 @@ discard block |
||
208 | 216 | { |
209 | 217 | $object->fetch($id); |
210 | 218 | $result = $object->setProject($projectid); |
211 | - if ($result < 0) |
|
212 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
219 | + if ($result < 0) { |
|
220 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
221 | + } |
|
213 | 222 | } |
214 | 223 | |
215 | 224 | if ($action == 'setlabel' && $user->rights->loan->write) |
216 | 225 | { |
217 | 226 | $object->fetch($id); |
218 | 227 | $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY'); |
219 | - if ($result < 0) |
|
220 | - setEventMessages($object->error, $object->errors, 'errors'); |
|
228 | + if ($result < 0) { |
|
229 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
230 | + } |
|
221 | 231 | } |
222 | 232 | } |
223 | 233 | |
@@ -228,7 +238,9 @@ discard block |
||
228 | 238 | |
229 | 239 | $form = new Form($db); |
230 | 240 | $formproject = new FormProjets($db); |
231 | -if (!empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db); |
|
241 | +if (!empty($conf->accounting->enabled)) { |
|
242 | + $formaccounting = new FormAccounting($db); |
|
243 | +} |
|
232 | 244 | |
233 | 245 | $title = $langs->trans("Loan").' - '.$langs->trans("Card"); |
234 | 246 | $help_url = 'EN:Module_Loan|FR:Module_Emprunt'; |
@@ -425,8 +437,9 @@ discard block |
||
425 | 437 | $morehtmlref .= '<br>'.$langs->trans('Project').' '; |
426 | 438 | if ($user->rights->loan->write) |
427 | 439 | { |
428 | - if ($action != 'classify') |
|
429 | - $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
440 | + if ($action != 'classify') { |
|
441 | + $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; |
|
442 | + } |
|
430 | 443 | if ($action == 'classify') { |
431 | 444 | //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); |
432 | 445 | $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; |
@@ -24,7 +24,9 @@ discard block |
||
24 | 24 | require '../../main.inc.php'; |
25 | 25 | require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; |
26 | 26 | require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; |
27 | -if (!empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
27 | +if (!empty($conf->banque->enabled)) { |
|
28 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
29 | +} |
|
28 | 30 | |
29 | 31 | // Load translation files required by the page |
30 | 32 | $langs->loadLangs(array("bills", "banks", "companies", "loan")); |
@@ -33,7 +35,9 @@ discard block |
||
33 | 35 | $id = GETPOST("id", 'int'); |
34 | 36 | $action = GETPOST('action', 'aZ09'); |
35 | 37 | $confirm = GETPOST('confirm'); |
36 | -if ($user->socid) $socid = $user->socid; |
|
38 | +if ($user->socid) { |
|
39 | + $socid = $user->socid; |
|
40 | +} |
|
37 | 41 | // TODO ajouter regle pour restreindre acces paiement |
38 | 42 | //$result = restrictedArea($user, 'facture', $id,''); |
39 | 43 | |
@@ -41,8 +45,10 @@ discard block |
||
41 | 45 | if ($id > 0) |
42 | 46 | { |
43 | 47 | $result = $payment->fetch($id); |
44 | - if (!$result) dol_print_error($db, 'Failed to get payment id '.$id); |
|
45 | -} |
|
48 | + if (!$result) { |
|
49 | + dol_print_error($db, 'Failed to get payment id '.$id); |
|
50 | + } |
|
51 | + } |
|
46 | 52 | |
47 | 53 | |
48 | 54 | /* |
@@ -238,10 +244,12 @@ discard block |
||
238 | 244 | |
239 | 245 | print '<td class="right">'.price($amount_payed).'</td>'; |
240 | 246 | print "</tr>\n"; |
241 | - if ($objp->paid == 1) // If at least one invoice is paid, disable delete |
|
247 | + if ($objp->paid == 1) { |
|
248 | + // If at least one invoice is paid, disable delete |
|
242 | 249 | { |
243 | 250 | $disable_delete = 1; |
244 | 251 | } |
252 | + } |
|
245 | 253 | $total = $total + $objp->amount_capital; |
246 | 254 | $i++; |
247 | 255 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | $confirm = GETPOST('confirm', 'alpha'); |
41 | 41 | |
42 | 42 | // Security check |
43 | -if ($user->socid) $socid = $user->socid; |
|
43 | +if ($user->socid) { |
|
44 | + $socid = $user->socid; |
|
45 | +} |
|
44 | 46 | $result = restrictedArea($user, 'loan', $id, '', ''); |
45 | 47 | |
46 | 48 | // Get parameters |
@@ -54,11 +56,17 @@ discard block |
||
54 | 56 | $offset = $limit * $page; |
55 | 57 | $pageprev = $page - 1; |
56 | 58 | $pagenext = $page + 1; |
57 | -if (!$sortorder) $sortorder = "ASC"; |
|
58 | -if (!$sortfield) $sortfield = "name"; |
|
59 | +if (!$sortorder) { |
|
60 | + $sortorder = "ASC"; |
|
61 | +} |
|
62 | +if (!$sortfield) { |
|
63 | + $sortfield = "name"; |
|
64 | +} |
|
59 | 65 | |
60 | 66 | $object = new Loan($db); |
61 | -if ($id > 0) $object->fetch($id); |
|
67 | +if ($id > 0) { |
|
68 | + $object->fetch($id); |
|
69 | +} |
|
62 | 70 | |
63 | 71 | $upload_dir = $conf->loan->dir_output.'/'.dol_sanitizeFileName($object->ref); |
64 | 72 | $modulepart = 'loan'; |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | * \brief File that is entry point to call Dolibarr WebServices |
21 | 21 | */ |
22 | 22 | |
23 | -if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", '1'); |
|
23 | +if (!defined("NOCSRFCHECK")) { |
|
24 | + define("NOCSRFCHECK", '1'); |
|
25 | +} |
|
24 | 26 | |
25 | 27 | require '../master.inc.php'; |
26 | 28 | require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP |
@@ -149,7 +151,9 @@ discard block |
||
149 | 151 | |
150 | 152 | dol_syslog("Function: getVersions login=".$authentication['login']); |
151 | 153 | |
152 | - if ($authentication['entity']) $conf->entity = $authentication['entity']; |
|
154 | + if ($authentication['entity']) { |
|
155 | + $conf->entity = $authentication['entity']; |
|
156 | + } |
|
153 | 157 | |
154 | 158 | // Init and check authentication |
155 | 159 | $objectresp = array(); |
@@ -192,7 +196,9 @@ discard block |
||
192 | 196 | |
193 | 197 | dol_syslog("Function: getDocument login=".$authentication['login'].' - modulepart='.$modulepart.' - file='.$file); |
194 | 198 | |
195 | - if ($authentication['entity']) $conf->entity = $authentication['entity']; |
|
199 | + if ($authentication['entity']) { |
|
200 | + $conf->entity = $authentication['entity']; |
|
201 | + } |
|
196 | 202 | |
197 | 203 | $objectresp = array(); |
198 | 204 | $errorcode = ''; $errorlabel = ''; |
@@ -208,7 +214,9 @@ discard block |
||
208 | 214 | |
209 | 215 | $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); |
210 | 216 | |
211 | - if ($fuser->societe_id) $socid = $fuser->societe_id; |
|
217 | + if ($fuser->societe_id) { |
|
218 | + $socid = $fuser->societe_id; |
|
219 | + } |
|
212 | 220 | |
213 | 221 | // Check parameters |
214 | 222 | if (!$error && (!$file || !$modulepart)) |
@@ -225,7 +233,9 @@ discard block |
||
225 | 233 | $original_file = str_replace("../", "/", $original_file); |
226 | 234 | |
227 | 235 | // find the subdirectory name as the reference |
228 | - if (empty($refname)) $refname = basename(dirname($original_file)."/"); |
|
236 | + if (empty($refname)) { |
|
237 | + $refname = basename(dirname($original_file)."/"); |
|
238 | + } |
|
229 | 239 | |
230 | 240 | // Security check |
231 | 241 | $check_access = dol_check_secure_access_document($modulepart, $original_file, $conf->entity, $fuser, $refname); |
@@ -303,8 +313,7 @@ discard block |
||
303 | 313 | 'result'=>array('result_code'=>'OK', 'result_label'=>''), |
304 | 314 | 'document'=>$objectret |
305 | 315 | ); |
306 | - } |
|
307 | - else { |
|
316 | + } else { |
|
308 | 317 | dol_syslog("File doesn't exist ".$original_file); |
309 | 318 | $errorcode = 'NOT_FOUND'; |
310 | 319 | $errorlabel = ''; |