@@ -58,12 +58,15 @@ discard block |
||
58 | 58 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
59 | 59 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
60 | 60 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
61 | -if (empty($page) || $page < 0) $page = 0; |
|
61 | +if (empty($page) || $page < 0) { |
|
62 | + $page = 0; |
|
63 | +} |
|
62 | 64 | $pageprev = $page - 1; |
63 | 65 | $pagenext = $page + 1; |
64 | 66 | $offset = $limit * $page; |
65 | -if (!$sortfield) |
|
67 | +if (!$sortfield) { |
|
66 | 68 | $sortfield = "erd.date, erd.rowid"; |
69 | +} |
|
67 | 70 | if (!$sortorder) { |
68 | 71 | if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { |
69 | 72 | $sortorder = "DESC"; |
@@ -71,10 +74,12 @@ discard block |
||
71 | 74 | } |
72 | 75 | |
73 | 76 | // Security check |
74 | -if ($user->socid > 0) |
|
77 | +if ($user->socid > 0) { |
|
75 | 78 | accessforbidden(); |
76 | -if (!$user->rights->accounting->bind->write) |
|
79 | +} |
|
80 | +if (!$user->rights->accounting->bind->write) { |
|
77 | 81 | accessforbidden(); |
82 | +} |
|
78 | 83 | |
79 | 84 | $formaccounting = new FormAccounting($db); |
80 | 85 | |
@@ -84,9 +89,11 @@ discard block |
||
84 | 89 | */ |
85 | 90 | |
86 | 91 | // Purge search criteria |
87 | -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers |
|
92 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
93 | + // Both test are required to be compatible with all browsers |
|
88 | 94 | { |
89 | 95 | $search_login = ''; |
96 | +} |
|
90 | 97 | $search_expensereport = ''; |
91 | 98 | $search_label = ''; |
92 | 99 | $search_desc = ''; |
@@ -209,9 +216,11 @@ discard block |
||
209 | 216 | { |
210 | 217 | $result = $db->query($sql); |
211 | 218 | $nbtotalofrecords = $db->num_rows($result); |
212 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
219 | + if (($page * $limit) > $nbtotalofrecords) { |
|
220 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
213 | 221 | { |
214 | 222 | $page = 0; |
223 | + } |
|
215 | 224 | $offset = 0; |
216 | 225 | } |
217 | 226 | } |
@@ -226,21 +235,45 @@ discard block |
||
226 | 235 | $i = 0; |
227 | 236 | |
228 | 237 | $param = ''; |
229 | - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
230 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
231 | - if ($search_login) $param .= '&search_login='.urlencode($search_login); |
|
232 | - if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport); |
|
233 | - if ($search_label) $param .= "&search_label=".urlencode($search_label); |
|
234 | - if ($search_desc) $param .= "&search_desc=".urlencode($search_desc); |
|
235 | - if ($search_account) $param .= "&search_account=".urlencode($search_account); |
|
236 | - if ($search_vat) $param .= "&search_vat=".urlencode($search_vat); |
|
237 | - if ($search_day) $param .= '&search_day='.urlencode($search_day); |
|
238 | - if ($search_month) $param .= '&search_month='.urlencode($search_month); |
|
239 | - if ($search_year) $param .= '&search_year='.urlencode($search_year); |
|
238 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
239 | + $param .= '&contextpage='.urlencode($contextpage); |
|
240 | + } |
|
241 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
242 | + $param .= '&limit='.urlencode($limit); |
|
243 | + } |
|
244 | + if ($search_login) { |
|
245 | + $param .= '&search_login='.urlencode($search_login); |
|
246 | + } |
|
247 | + if ($search_expensereport) { |
|
248 | + $param .= "&search_expensereport=".urlencode($search_expensereport); |
|
249 | + } |
|
250 | + if ($search_label) { |
|
251 | + $param .= "&search_label=".urlencode($search_label); |
|
252 | + } |
|
253 | + if ($search_desc) { |
|
254 | + $param .= "&search_desc=".urlencode($search_desc); |
|
255 | + } |
|
256 | + if ($search_account) { |
|
257 | + $param .= "&search_account=".urlencode($search_account); |
|
258 | + } |
|
259 | + if ($search_vat) { |
|
260 | + $param .= "&search_vat=".urlencode($search_vat); |
|
261 | + } |
|
262 | + if ($search_day) { |
|
263 | + $param .= '&search_day='.urlencode($search_day); |
|
264 | + } |
|
265 | + if ($search_month) { |
|
266 | + $param .= '&search_month='.urlencode($search_month); |
|
267 | + } |
|
268 | + if ($search_year) { |
|
269 | + $param .= '&search_year='.urlencode($search_year); |
|
270 | + } |
|
240 | 271 | |
241 | 272 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n"; |
242 | 273 | print '<input type="hidden" name="action" value="ventil">'; |
243 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
274 | + if ($optioncss != '') { |
|
275 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
276 | + } |
|
244 | 277 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
245 | 278 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
246 | 279 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
@@ -268,7 +301,9 @@ discard block |
||
268 | 301 | print '<td class="liste_titre"></td>'; |
269 | 302 | } |
270 | 303 | print '<td class="liste_titre center">'; |
271 | - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
304 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { |
|
305 | + print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
306 | + } |
|
272 | 307 | print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; |
273 | 308 | $formother->select_year($search_year, 'search_year', 1, 20, 5); |
274 | 309 | print '</td>'; |
@@ -64,12 +64,15 @@ discard block |
||
64 | 64 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
65 | 65 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
66 | 66 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
67 | -if (empty($page) || $page < 0) $page = 0; |
|
67 | +if (empty($page) || $page < 0) { |
|
68 | + $page = 0; |
|
69 | +} |
|
68 | 70 | $offset = $limit * $page; |
69 | 71 | $pageprev = $page - 1; |
70 | 72 | $pagenext = $page + 1; |
71 | -if (!$sortfield) |
|
73 | +if (!$sortfield) { |
|
72 | 74 | $sortfield = "f.datef, f.ref, fd.rowid"; |
75 | +} |
|
73 | 76 | if (!$sortorder) { |
74 | 77 | if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { |
75 | 78 | $sortorder = "DESC"; |
@@ -77,10 +80,12 @@ discard block |
||
77 | 80 | } |
78 | 81 | |
79 | 82 | // Security check |
80 | -if ($user->socid > 0) |
|
83 | +if ($user->socid > 0) { |
|
81 | 84 | accessforbidden(); |
82 | -if (!$user->rights->accounting->bind->write) |
|
85 | +} |
|
86 | +if (!$user->rights->accounting->bind->write) { |
|
83 | 87 | accessforbidden(); |
88 | +} |
|
84 | 89 | |
85 | 90 | $formaccounting = new FormAccounting($db); |
86 | 91 | |
@@ -90,9 +95,11 @@ discard block |
||
90 | 95 | */ |
91 | 96 | |
92 | 97 | // Purge search criteria |
93 | -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 |
|
98 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
99 | + // All tests are required to be compatible with all browsers |
|
94 | 100 | { |
95 | 101 | $search_societe = ''; |
102 | +} |
|
96 | 103 | $search_lineid = ''; |
97 | 104 | $search_ref = ''; |
98 | 105 | $search_invoice = ''; |
@@ -233,14 +240,22 @@ discard block |
||
233 | 240 | foreach ($arrayofcode as $key => $value) |
234 | 241 | { |
235 | 242 | $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'"; |
236 | - if ($value != $mysoc->country_code) $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; |
|
243 | + if ($value != $mysoc->country_code) { |
|
244 | + $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; |
|
245 | + } |
|
246 | + } |
|
247 | + if ($search_country == 'special_allnotme') { |
|
248 | + $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; |
|
249 | + } elseif ($search_country == 'special_eec') { |
|
250 | + $sql .= " AND co.code IN (".$country_code_in_EEC.")"; |
|
251 | + } elseif ($search_country == 'special_eecnotme') { |
|
252 | + $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; |
|
253 | + } elseif ($search_country == 'special_noteec') { |
|
254 | + $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; |
|
255 | + } else { |
|
256 | + $sql .= natural_search("co.code", $search_country); |
|
257 | + } |
|
237 | 258 | } |
238 | - if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; |
|
239 | - elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; |
|
240 | - elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; |
|
241 | - elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; |
|
242 | - else $sql .= natural_search("co.code", $search_country); |
|
243 | -} |
|
244 | 259 | if (strlen(trim($search_tvaintra))) { |
245 | 260 | $sql .= natural_search("s.tva_intra", $search_tvaintra); |
246 | 261 | } |
@@ -253,9 +268,11 @@ discard block |
||
253 | 268 | { |
254 | 269 | $result = $db->query($sql); |
255 | 270 | $nbtotalofrecords = $db->num_rows($result); |
256 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
271 | + if (($page * $limit) > $nbtotalofrecords) { |
|
272 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
257 | 273 | { |
258 | 274 | $page = 0; |
275 | + } |
|
259 | 276 | $offset = 0; |
260 | 277 | } |
261 | 278 | } |
@@ -269,24 +286,54 @@ discard block |
||
269 | 286 | $i = 0; |
270 | 287 | |
271 | 288 | $param = ''; |
272 | - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
273 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
274 | - if ($search_societe) $param .= "&search_societe=".urlencode($search_societe); |
|
275 | - if ($search_invoice) $param .= "&search_invoice=".urlencode($search_invoice); |
|
276 | - if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); |
|
277 | - if ($search_label) $param .= "&search_label=".urlencode($search_label); |
|
278 | - if ($search_desc) $param .= "&search_desc=".urlencode($search_desc); |
|
279 | - if ($search_account) $param .= "&search_account=".urlencode($search_account); |
|
280 | - if ($search_vat) $param .= "&search_vat=".urlencode($search_vat); |
|
281 | - if ($search_day) $param .= '&search_day='.urlencode($search_day); |
|
282 | - if ($search_month) $param .= '&search_month='.urlencode($search_month); |
|
283 | - if ($search_year) $param .= '&search_year='.urlencode($search_year); |
|
284 | - if ($search_country) $param .= "&search_country=".urlencode($search_country); |
|
285 | - if ($search_tvaintra) $param .= "&search_tvaintra=".urlencode($search_tvaintra); |
|
289 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
290 | + $param .= '&contextpage='.urlencode($contextpage); |
|
291 | + } |
|
292 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
293 | + $param .= '&limit='.urlencode($limit); |
|
294 | + } |
|
295 | + if ($search_societe) { |
|
296 | + $param .= "&search_societe=".urlencode($search_societe); |
|
297 | + } |
|
298 | + if ($search_invoice) { |
|
299 | + $param .= "&search_invoice=".urlencode($search_invoice); |
|
300 | + } |
|
301 | + if ($search_ref) { |
|
302 | + $param .= "&search_ref=".urlencode($search_ref); |
|
303 | + } |
|
304 | + if ($search_label) { |
|
305 | + $param .= "&search_label=".urlencode($search_label); |
|
306 | + } |
|
307 | + if ($search_desc) { |
|
308 | + $param .= "&search_desc=".urlencode($search_desc); |
|
309 | + } |
|
310 | + if ($search_account) { |
|
311 | + $param .= "&search_account=".urlencode($search_account); |
|
312 | + } |
|
313 | + if ($search_vat) { |
|
314 | + $param .= "&search_vat=".urlencode($search_vat); |
|
315 | + } |
|
316 | + if ($search_day) { |
|
317 | + $param .= '&search_day='.urlencode($search_day); |
|
318 | + } |
|
319 | + if ($search_month) { |
|
320 | + $param .= '&search_month='.urlencode($search_month); |
|
321 | + } |
|
322 | + if ($search_year) { |
|
323 | + $param .= '&search_year='.urlencode($search_year); |
|
324 | + } |
|
325 | + if ($search_country) { |
|
326 | + $param .= "&search_country=".urlencode($search_country); |
|
327 | + } |
|
328 | + if ($search_tvaintra) { |
|
329 | + $param .= "&search_tvaintra=".urlencode($search_tvaintra); |
|
330 | + } |
|
286 | 331 | |
287 | 332 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n"; |
288 | 333 | print '<input type="hidden" name="action" value="ventil">'; |
289 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
334 | + if ($optioncss != '') { |
|
335 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
336 | + } |
|
290 | 337 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
291 | 338 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
292 | 339 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
@@ -396,9 +443,15 @@ discard block |
||
396 | 443 | |
397 | 444 | // Ref Product |
398 | 445 | print '<td class="tdoverflowmax100">'; |
399 | - if ($productstatic->id > 0) print $productstatic->getNomUrl(1); |
|
400 | - if ($productstatic->id > 0 && $objp->product_label) print '<br>'; |
|
401 | - if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>'; |
|
446 | + if ($productstatic->id > 0) { |
|
447 | + print $productstatic->getNomUrl(1); |
|
448 | + } |
|
449 | + if ($productstatic->id > 0 && $objp->product_label) { |
|
450 | + print '<br>'; |
|
451 | + } |
|
452 | + if ($objp->product_label) { |
|
453 | + print '<span class="opacitymedium">'.$objp->product_label.'</span>'; |
|
454 | + } |
|
402 | 455 | print '</td>'; |
403 | 456 | |
404 | 457 | print '<td class="tdoverflowonsmartphone">'; |
@@ -65,12 +65,15 @@ discard block |
||
65 | 65 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
66 | 66 | $sortorder = GETPOST('sortorder', 'aZ09comma'); |
67 | 67 | $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); |
68 | -if (empty($page) || $page < 0) $page = 0; |
|
68 | +if (empty($page) || $page < 0) { |
|
69 | + $page = 0; |
|
70 | +} |
|
69 | 71 | $offset = $limit * $page; |
70 | 72 | $pageprev = $page - 1; |
71 | 73 | $pagenext = $page + 1; |
72 | -if (!$sortfield) |
|
74 | +if (!$sortfield) { |
|
73 | 75 | $sortfield = "f.datef, f.ref, l.rowid"; |
76 | +} |
|
74 | 77 | if (!$sortorder) { |
75 | 78 | if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { |
76 | 79 | $sortorder = "DESC"; |
@@ -78,10 +81,12 @@ discard block |
||
78 | 81 | } |
79 | 82 | |
80 | 83 | // Security check |
81 | -if ($user->socid > 0) |
|
84 | +if ($user->socid > 0) { |
|
82 | 85 | accessforbidden(); |
83 | -if (!$user->rights->accounting->bind->write) |
|
86 | +} |
|
87 | +if (!$user->rights->accounting->bind->write) { |
|
84 | 88 | accessforbidden(); |
89 | +} |
|
85 | 90 | |
86 | 91 | $formaccounting = new FormAccounting($db); |
87 | 92 | |
@@ -91,9 +96,11 @@ discard block |
||
91 | 96 | */ |
92 | 97 | |
93 | 98 | // Purge search criteria |
94 | -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 |
|
99 | +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { |
|
100 | + // All tests are required to be compatible with all browsers |
|
95 | 101 | { |
96 | 102 | $search_societe = ''; |
103 | +} |
|
97 | 104 | $search_lineid = ''; |
98 | 105 | $search_ref = ''; |
99 | 106 | $search_invoice = ''; |
@@ -226,14 +233,22 @@ discard block |
||
226 | 233 | foreach ($arrayofcode as $key => $value) |
227 | 234 | { |
228 | 235 | $country_code_in_EEC .= ($country_code_in_EEC ? "," : "")."'".$value."'"; |
229 | - if ($value != $mysoc->country_code) $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; |
|
236 | + if ($value != $mysoc->country_code) { |
|
237 | + $country_code_in_EEC_without_me .= ($country_code_in_EEC_without_me ? "," : "")."'".$value."'"; |
|
238 | + } |
|
239 | + } |
|
240 | + if ($search_country == 'special_allnotme') { |
|
241 | + $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; |
|
242 | + } elseif ($search_country == 'special_eec') { |
|
243 | + $sql .= " AND co.code IN (".$country_code_in_EEC.")"; |
|
244 | + } elseif ($search_country == 'special_eecnotme') { |
|
245 | + $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; |
|
246 | + } elseif ($search_country == 'special_noteec') { |
|
247 | + $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; |
|
248 | + } else { |
|
249 | + $sql .= natural_search("co.code", $search_country); |
|
250 | + } |
|
230 | 251 | } |
231 | - if ($search_country == 'special_allnotme') $sql .= " AND co.code <> '".$db->escape($mysoc->country_code)."'"; |
|
232 | - elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")"; |
|
233 | - elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")"; |
|
234 | - elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")"; |
|
235 | - else $sql .= natural_search("co.code", $search_country); |
|
236 | -} |
|
237 | 252 | if (strlen(trim($search_tvaintra))) { |
238 | 253 | $sql .= natural_search("s.tva_intra", $search_tvaintra); |
239 | 254 | } |
@@ -252,9 +267,11 @@ discard block |
||
252 | 267 | { |
253 | 268 | $result = $db->query($sql); |
254 | 269 | $nbtotalofrecords = $db->num_rows($result); |
255 | - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
270 | + if (($page * $limit) > $nbtotalofrecords) { |
|
271 | + // if total resultset is smaller then paging size (filtering), goto and load page 0 |
|
256 | 272 | { |
257 | 273 | $page = 0; |
274 | + } |
|
258 | 275 | $offset = 0; |
259 | 276 | } |
260 | 277 | } |
@@ -268,24 +285,54 @@ discard block |
||
268 | 285 | $i = 0; |
269 | 286 | |
270 | 287 | $param = ''; |
271 | - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); |
|
272 | - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); |
|
273 | - if ($search_societe) $param .= "&search_societe=".urlencode($search_societe); |
|
274 | - if ($search_invoice) $param .= "&search_invoice=".urlencode($search_invoice); |
|
275 | - if ($search_ref) $param .= "&search_ref=".urlencode($search_ref); |
|
276 | - if ($search_label) $param .= "&search_label=".urlencode($search_label); |
|
277 | - if ($search_desc) $param .= "&search_desc=".urlencode($search_desc); |
|
278 | - if ($search_account) $param .= "&search_account=".urlencode($search_account); |
|
279 | - if ($search_vat) $param .= "&search_vat=".urlencode($search_vat); |
|
280 | - if ($search_day) $param .= '&search_day='.urlencode($search_day); |
|
281 | - if ($search_month) $param .= '&search_month='.urlencode($search_month); |
|
282 | - if ($search_year) $param .= '&search_year='.urlencode($search_year); |
|
283 | - if ($search_country) $param .= "&search_country=".urlencode($search_country); |
|
284 | - if ($search_tvaintra) $param .= "&search_tvaintra=".urlencode($search_tvaintra); |
|
288 | + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
|
289 | + $param .= '&contextpage='.urlencode($contextpage); |
|
290 | + } |
|
291 | + if ($limit > 0 && $limit != $conf->liste_limit) { |
|
292 | + $param .= '&limit='.urlencode($limit); |
|
293 | + } |
|
294 | + if ($search_societe) { |
|
295 | + $param .= "&search_societe=".urlencode($search_societe); |
|
296 | + } |
|
297 | + if ($search_invoice) { |
|
298 | + $param .= "&search_invoice=".urlencode($search_invoice); |
|
299 | + } |
|
300 | + if ($search_ref) { |
|
301 | + $param .= "&search_ref=".urlencode($search_ref); |
|
302 | + } |
|
303 | + if ($search_label) { |
|
304 | + $param .= "&search_label=".urlencode($search_label); |
|
305 | + } |
|
306 | + if ($search_desc) { |
|
307 | + $param .= "&search_desc=".urlencode($search_desc); |
|
308 | + } |
|
309 | + if ($search_account) { |
|
310 | + $param .= "&search_account=".urlencode($search_account); |
|
311 | + } |
|
312 | + if ($search_vat) { |
|
313 | + $param .= "&search_vat=".urlencode($search_vat); |
|
314 | + } |
|
315 | + if ($search_day) { |
|
316 | + $param .= '&search_day='.urlencode($search_day); |
|
317 | + } |
|
318 | + if ($search_month) { |
|
319 | + $param .= '&search_month='.urlencode($search_month); |
|
320 | + } |
|
321 | + if ($search_year) { |
|
322 | + $param .= '&search_year='.urlencode($search_year); |
|
323 | + } |
|
324 | + if ($search_country) { |
|
325 | + $param .= "&search_country=".urlencode($search_country); |
|
326 | + } |
|
327 | + if ($search_tvaintra) { |
|
328 | + $param .= "&search_tvaintra=".urlencode($search_tvaintra); |
|
329 | + } |
|
285 | 330 | |
286 | 331 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'."\n"; |
287 | 332 | print '<input type="hidden" name="action" value="ventil">'; |
288 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
333 | + if ($optioncss != '') { |
|
334 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
335 | + } |
|
289 | 336 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
290 | 337 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
291 | 338 | print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
@@ -310,7 +357,9 @@ discard block |
||
310 | 357 | print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>'; |
311 | 358 | print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; |
312 | 359 | print '<td class="liste_titre center nowraponall">'; |
313 | - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
360 | + if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { |
|
361 | + print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; |
|
362 | + } |
|
314 | 363 | print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; |
315 | 364 | $formother->select_year($search_year, 'search_year', 1, 20, 5); |
316 | 365 | print '</td>'; |
@@ -399,9 +448,15 @@ discard block |
||
399 | 448 | |
400 | 449 | // Ref Product |
401 | 450 | print '<td class="tdoverflowmax100">'; |
402 | - if ($productstatic->id > 0) print $productstatic->getNomUrl(1); |
|
403 | - if ($productstatic->id > 0 && $objp->product_label) print '<br>'; |
|
404 | - if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>'; |
|
451 | + if ($productstatic->id > 0) { |
|
452 | + print $productstatic->getNomUrl(1); |
|
453 | + } |
|
454 | + if ($productstatic->id > 0 && $objp->product_label) { |
|
455 | + print '<br>'; |
|
456 | + } |
|
457 | + if ($objp->product_label) { |
|
458 | + print '<span class="opacitymedium">'.$objp->product_label.'</span>'; |
|
459 | + } |
|
405 | 460 | print '</td>'; |
406 | 461 | |
407 | 462 | print '<td class="tdoverflowonsmartphone">'; |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | $childids = $user->getAllChildIds(1); |
46 | 46 | |
47 | 47 | // Security check |
48 | -if ($user->socid) $socid = $user->socid; |
|
48 | +if ($user->socid) { |
|
49 | + $socid = $user->socid; |
|
50 | +} |
|
49 | 51 | $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); |
50 | 52 | |
51 | 53 | |
@@ -58,8 +60,12 @@ discard block |
||
58 | 60 | $offset = $limit * $page; |
59 | 61 | $pageprev = $page - 1; |
60 | 62 | $pagenext = $page + 1; |
61 | -if (!$sortorder) $sortorder = "ASC"; |
|
62 | -if (!$sortfield) $sortfield = "position_name"; |
|
63 | +if (!$sortorder) { |
|
64 | + $sortorder = "ASC"; |
|
65 | +} |
|
66 | +if (!$sortfield) { |
|
67 | + $sortfield = "position_name"; |
|
68 | +} |
|
63 | 69 | |
64 | 70 | |
65 | 71 | $object = new ExpenseReport($db); |
@@ -78,8 +84,12 @@ discard block |
||
78 | 84 | { |
79 | 85 | // Check current user can read this expense report |
80 | 86 | $canread = 0; |
81 | - if (!empty($user->rights->expensereport->readall)) $canread = 1; |
|
82 | - if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1; |
|
87 | + if (!empty($user->rights->expensereport->readall)) { |
|
88 | + $canread = 1; |
|
89 | + } |
|
90 | + if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) { |
|
91 | + $canread = 1; |
|
92 | + } |
|
83 | 93 | if (!$canread) |
84 | 94 | { |
85 | 95 | accessforbidden(); |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | $childids = $user->getAllChildIds(1); |
38 | 38 | |
39 | 39 | // Security check |
40 | -if ($user->socid) $socid = $user->socid; |
|
40 | +if ($user->socid) { |
|
41 | + $socid = $user->socid; |
|
42 | +} |
|
41 | 43 | $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); |
42 | 44 | |
43 | 45 | $object = new ExpenseReport($db); |
@@ -50,8 +52,12 @@ discard block |
||
50 | 52 | { |
51 | 53 | // Check current user can read this expense report |
52 | 54 | $canread = 0; |
53 | - if (!empty($user->rights->expensereport->readall)) $canread = 1; |
|
54 | - if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1; |
|
55 | + if (!empty($user->rights->expensereport->readall)) { |
|
56 | + $canread = 1; |
|
57 | + } |
|
58 | + if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) { |
|
59 | + $canread = 1; |
|
60 | + } |
|
55 | 61 | if (!$canread) |
56 | 62 | { |
57 | 63 | accessforbidden(); |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | // Security check |
43 | 43 | $socid = 0; |
44 | -if ($user->socid) $socid = $user->socid; |
|
44 | +if ($user->socid) { |
|
45 | + $socid = $user->socid; |
|
46 | +} |
|
45 | 47 | $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); |
46 | 48 | |
47 | 49 | |
@@ -57,8 +59,12 @@ discard block |
||
57 | 59 | { |
58 | 60 | // Check current user can read this expense report |
59 | 61 | $canread = 0; |
60 | - if (!empty($user->rights->expensereport->readall)) $canread = 1; |
|
61 | - if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1; |
|
62 | + if (!empty($user->rights->expensereport->readall)) { |
|
63 | + $canread = 1; |
|
64 | + } |
|
65 | + if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) { |
|
66 | + $canread = 1; |
|
67 | + } |
|
62 | 68 | if (!$canread) |
63 | 69 | { |
64 | 70 | accessforbidden(); |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of file website/samples/wrapper.php |
3 | 3 | $websitekey = basename(__DIR__); |
4 | -if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) die("Sample file for website module. Can be called directly."); |
|
4 | +if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) { |
|
5 | + die("Sample file for website module. Can be called directly."); |
|
6 | +} |
|
5 | 7 | if (!defined('USEDOLIBARRSERVER') && !defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded |
6 | 8 | include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
7 | 9 | |
@@ -17,7 +19,9 @@ discard block |
||
17 | 19 | |
18 | 20 | // Parameters for RSS |
19 | 21 | $rss = GETPOST('rss', 'aZ09'); |
20 | -if ($rss) $original_file = 'blog.rss'; |
|
22 | +if ($rss) { |
|
23 | + $original_file = 'blog.rss'; |
|
24 | +} |
|
21 | 25 | |
22 | 26 | // If we have a hash public (hashp), we guess the original_file. |
23 | 27 | if (!empty($hashp)) |
@@ -29,30 +33,32 @@ discard block |
||
29 | 33 | { |
30 | 34 | $tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory |
31 | 35 | // filepath can be 'users/X' or 'X/propale/PR11111' |
32 | - if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part. |
|
36 | + if (is_numeric($tmp[0])) { |
|
37 | + // If first tmp is numeric, it is subdir of company for multicompany, we take next part. |
|
33 | 38 | { |
34 | 39 | $tmp = explode('/', $tmp[1], 2); |
35 | 40 | } |
41 | + } |
|
36 | 42 | $moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path |
37 | 43 | |
38 | - if ($modulepart) // Not required, so often not defined, for link using public hashp parameter. |
|
44 | + if ($modulepart) { |
|
45 | + // Not required, so often not defined, for link using public hashp parameter. |
|
39 | 46 | { |
40 | 47 | if ($moduleparttocheck == $modulepart) |
41 | 48 | { |
42 | 49 | // We remove first level of directory |
43 | - $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir |
|
50 | + $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); |
|
51 | + } |
|
52 | + // this is relative to module dir |
|
44 | 53 | //var_dump($original_file); exit; |
45 | - } |
|
46 | - else { |
|
54 | + } else { |
|
47 | 55 | print 'Bad link. File is from another module part.'; |
48 | 56 | } |
49 | - } |
|
50 | - else { |
|
57 | + } else { |
|
51 | 58 | $modulepart = $moduleparttocheck; |
52 | 59 | $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir |
53 | 60 | } |
54 | - } |
|
55 | - else { |
|
61 | + } else { |
|
56 | 62 | print "ErrorFileNotFoundWithSharedLink"; |
57 | 63 | exit; |
58 | 64 | } |
@@ -60,14 +66,23 @@ discard block |
||
60 | 66 | |
61 | 67 | // Define attachment (attachment=true to force choice popup 'open'/'save as') |
62 | 68 | $attachment = true; |
63 | -if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false; |
|
64 | -if (isset($_GET["attachment"])) $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
65 | -if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) $attachment = false; |
|
69 | +if (preg_match('/\.(html|htm)$/i', $original_file)) { |
|
70 | + $attachment = false; |
|
71 | +} |
|
72 | +if (isset($_GET["attachment"])) { |
|
73 | + $attachment = (GETPOST("attachment", 'alphanohtml') ? true : false); |
|
74 | +} |
|
75 | +if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS_WEBSITE)) { |
|
76 | + $attachment = false; |
|
77 | +} |
|
66 | 78 | |
67 | 79 | // Define mime type |
68 | 80 | $type = 'application/octet-stream'; |
69 | -if (GETPOSTISSET('type')) $type = GETPOST('type', 'alpha'); |
|
70 | -else $type = dol_mimetype($original_file); |
|
81 | +if (GETPOSTISSET('type')) { |
|
82 | + $type = GETPOST('type', 'alpha'); |
|
83 | +} else { |
|
84 | + $type = dol_mimetype($original_file); |
|
85 | +} |
|
71 | 86 | |
72 | 87 | // Security: Delete string ../ into $original_file |
73 | 88 | $original_file = str_replace("../", "/", $original_file); |
@@ -99,7 +114,9 @@ discard block |
||
99 | 114 | $website->fetch('', $websitekey); |
100 | 115 | |
101 | 116 | $filters = array('type_container'=>'blogpost'); |
102 | - if ($l) $filters['lang'] = $l; |
|
117 | + if ($l) { |
|
118 | + $filters['lang'] = $l; |
|
119 | + } |
|
103 | 120 | |
104 | 121 | $MAXNEWS = ($limit ? $limit : 20); |
105 | 122 | $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); |
@@ -157,16 +174,16 @@ discard block |
||
157 | 174 | |
158 | 175 | if ($result >= 0) |
159 | 176 | { |
160 | - if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result = 1; |
|
161 | - else { |
|
177 | + if (dol_move($outputfiletmp, $outputfile, 0, 1)) { |
|
178 | + $result = 1; |
|
179 | + } else { |
|
162 | 180 | $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; |
163 | 181 | dol_syslog("build_exportfile ".$error, LOG_ERR); |
164 | 182 | dol_delete_file($outputfiletmp, 0, 1); |
165 | 183 | print $error; |
166 | 184 | exit(-1); |
167 | 185 | } |
168 | - } |
|
169 | - else { |
|
186 | + } else { |
|
170 | 187 | dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); |
171 | 188 | dol_delete_file($outputfiletmp, 0, 1); |
172 | 189 | $langs->load("errors"); |
@@ -178,26 +195,39 @@ discard block |
||
178 | 195 | if ($result >= 0) |
179 | 196 | { |
180 | 197 | $attachment = false; |
181 | - if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; |
|
198 | + if (isset($_GET["attachment"])) { |
|
199 | + $attachment = $_GET["attachment"]; |
|
200 | + } |
|
182 | 201 | //$attachment = false; |
183 | 202 | $contenttype = 'application/rss+xml'; |
184 | - if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; |
|
203 | + if (isset($_GET["contenttype"])) { |
|
204 | + $contenttype = $_GET["contenttype"]; |
|
205 | + } |
|
185 | 206 | //$contenttype='text/plain'; |
186 | 207 | $outputencoding = 'UTF-8'; |
187 | 208 | |
188 | - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
189 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
209 | + if ($contenttype) { |
|
210 | + header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); |
|
211 | + } |
|
212 | + if ($attachment) { |
|
213 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
214 | + } |
|
190 | 215 | |
191 | 216 | // Ajout directives pour resoudre bug IE |
192 | 217 | //header('Cache-Control: Public, must-revalidate'); |
193 | 218 | //header('Pragma: public'); |
194 | - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
195 | - else header('Cache-Control: private, must-revalidate'); |
|
219 | + if ($cachedelay) { |
|
220 | + header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); |
|
221 | + } else { |
|
222 | + header('Cache-Control: private, must-revalidate'); |
|
223 | + } |
|
196 | 224 | |
197 | 225 | // Clean parameters |
198 | 226 | $outputfile = $dir_temp.'/'.$filename; |
199 | 227 | $result = readfile($outputfile); |
200 | - if (!$result) print 'File '.$outputfile.' was empty.'; |
|
228 | + if (!$result) { |
|
229 | + print 'File '.$outputfile.' was empty.'; |
|
230 | + } |
|
201 | 231 | |
202 | 232 | // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); |
203 | 233 | exit; |
@@ -207,8 +237,7 @@ discard block |
||
207 | 237 | elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file)) |
208 | 238 | { |
209 | 239 | readfile(dol_osencode($conf->mycompany->dir_output."/".$original_file)); |
210 | -} |
|
211 | -else { |
|
240 | +} else { |
|
212 | 241 | // Find the subdirectory name as the reference |
213 | 242 | include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
214 | 243 | $check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname); |
@@ -248,13 +277,20 @@ discard block |
||
248 | 277 | //top_httphead($type); |
249 | 278 | header('Content-Type: '.$type); |
250 | 279 | header('Content-Description: File Transfer'); |
251 | - if ($encoding) header('Content-Encoding: '.$encoding); |
|
280 | + if ($encoding) { |
|
281 | + header('Content-Encoding: '.$encoding); |
|
282 | + } |
|
252 | 283 | // Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open) |
253 | - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
254 | - else header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
284 | + if ($attachment) { |
|
285 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
286 | + } else { |
|
287 | + header('Content-Disposition: inline; filename="'.$filename.'"'); |
|
288 | + } |
|
255 | 289 | header('Content-Length: '.dol_filesize($fullpath_original_file)); |
256 | 290 | |
257 | 291 | readfile($fullpath_original_file_osencoded); |
258 | 292 | } |
259 | -if (is_object($db)) $db->close(); |
|
293 | +if (is_object($db)) { |
|
294 | + $db->close(); |
|
295 | +} |
|
260 | 296 | // END PHP |
@@ -35,13 +35,17 @@ |
||
35 | 35 | // List of supported format |
36 | 36 | $tmptype2label = ExtraFields::$type2label; |
37 | 37 | $type2label = array(''); |
38 | -foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
38 | +foreach ($tmptype2label as $key => $val) { |
|
39 | + $type2label[$key] = $langs->transnoentitiesnoconv($val); |
|
40 | +} |
|
39 | 41 | |
40 | 42 | $action = GETPOST('action', 'aZ09'); |
41 | 43 | $attrname = GETPOST('attrname', 'alpha'); |
42 | 44 | $elementtype = 'don'; //Must be the $table_element of the class that manage extrafield |
43 | 45 | |
44 | -if (!$user->admin) accessforbidden(); |
|
46 | +if (!$user->admin) { |
|
47 | + accessforbidden(); |
|
48 | +} |
|
45 | 49 | |
46 | 50 | |
47 | 51 | /* |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // Security check |
34 | -if (!$user->rights->opensurvey->read) accessforbidden(); |
|
34 | +if (!$user->rights->opensurvey->read) { |
|
35 | + accessforbidden(); |
|
36 | +} |
|
35 | 37 | |
36 | 38 | |
37 | 39 | // Init vars |
@@ -40,7 +42,9 @@ discard block |
||
40 | 42 | |
41 | 43 | $object = new Opensurveysondage($db); |
42 | 44 | $result = $object->fetch(0, $numsondage); |
43 | -if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
45 | +if ($result <= 0) { |
|
46 | + dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
47 | +} |
|
44 | 48 | |
45 | 49 | $nblines = $object->fetch_lines(); |
46 | 50 | |
@@ -58,11 +62,13 @@ discard block |
||
58 | 62 | $nbcolonnes = substr_count($object->sujet, ',') + 1; |
59 | 63 | |
60 | 64 | // Add vote |
61 | -if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // boutonp for chrome, boutonp.x for firefox |
|
65 | +if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { |
|
66 | + // boutonp for chrome, boutonp.x for firefox |
|
62 | 67 | { |
63 | 68 | if (GETPOST('nom')) |
64 | 69 | { |
65 | 70 | $erreur_prenom = false; |
71 | +} |
|
66 | 72 | |
67 | 73 | $nouveauchoix = ''; |
68 | 74 | for ($i = 0; $i < $nbcolonnes; $i++) |
@@ -95,7 +101,9 @@ discard block |
||
95 | 101 | $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; |
96 | 102 | $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; |
97 | 103 | $resql = $db->query($sql); |
98 | - if (!$resql) dol_print_error($db); |
|
104 | + if (!$resql) { |
|
105 | + dol_print_error($db); |
|
106 | + } |
|
99 | 107 | } |
100 | 108 | } |
101 | 109 | } |
@@ -122,7 +130,9 @@ discard block |
||
122 | 130 | if ($testmodifier) |
123 | 131 | { |
124 | 132 | // Security check |
125 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
133 | + if (!$user->rights->opensurvey->write) { |
|
134 | + accessforbidden(); |
|
135 | + } |
|
126 | 136 | |
127 | 137 | $nouveauchoix = ''; |
128 | 138 | for ($i = 0; $i < $nbcolonnes; $i++) |
@@ -145,14 +155,18 @@ discard block |
||
145 | 155 | $sql .= " WHERE id_users = '".$db->escape($idtomodify)."'"; |
146 | 156 | |
147 | 157 | $resql = $db->query($sql); |
148 | - if (!$resql) dol_print_error($db); |
|
149 | -} |
|
158 | + if (!$resql) { |
|
159 | + dol_print_error($db); |
|
160 | + } |
|
161 | + } |
|
150 | 162 | |
151 | 163 | // Add column (not for date) |
152 | 164 | if (GETPOST("ajoutercolonne") && GETPOST('nouvellecolonne') && $object->format == "A") |
153 | 165 | { |
154 | 166 | // Security check |
155 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
167 | + if (!$user->rights->opensurvey->write) { |
|
168 | + accessforbidden(); |
|
169 | + } |
|
156 | 170 | |
157 | 171 | $nouveauxsujets = $object->sujet; |
158 | 172 | |
@@ -165,8 +179,9 @@ discard block |
||
165 | 179 | $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."'"; |
166 | 180 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
167 | 181 | $resql = $db->query($sql); |
168 | - if (!$resql) dol_print_error($db); |
|
169 | - else { |
|
182 | + if (!$resql) { |
|
183 | + dol_print_error($db); |
|
184 | + } else { |
|
170 | 185 | header('Location: results.php?id='.$object->id_sondage); |
171 | 186 | } |
172 | 187 | } |
@@ -175,7 +190,9 @@ discard block |
||
175 | 190 | if (isset($_POST["ajoutercolonne"]) && $object->format == "D") |
176 | 191 | { |
177 | 192 | // Security check |
178 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
193 | + if (!$user->rights->opensurvey->write) { |
|
194 | + accessforbidden(); |
|
195 | + } |
|
179 | 196 | |
180 | 197 | $nouveauxsujets = $object->sujet; |
181 | 198 | |
@@ -248,8 +265,9 @@ discard block |
||
248 | 265 | $sql .= " SET sujet = '".$db->escape($dateinsertion)."'"; |
249 | 266 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
250 | 267 | $resql = $db->query($sql); |
251 | - if (!$resql) dol_print_error($db); |
|
252 | - else { |
|
268 | + if (!$resql) { |
|
269 | + dol_print_error($db); |
|
270 | + } else { |
|
253 | 271 | header('Location: results.php?id='.$object->id_sondage); |
254 | 272 | } |
255 | 273 | } |
@@ -263,10 +281,12 @@ discard block |
||
263 | 281 | // Delete line |
264 | 282 | for ($i = 0; $i < $nblines; $i++) |
265 | 283 | { |
266 | - if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) // effacelignei for chrome, effacelignei_x for firefox |
|
284 | + if (GETPOST("effaceligne".$i) || GETPOST("effaceligne".$i."_x") || GETPOST("effaceligne".$i.".x")) { |
|
285 | + // effacelignei for chrome, effacelignei_x for firefox |
|
267 | 286 | { |
268 | 287 | // Security check |
269 | 288 | if (!$user->rights->opensurvey->write) accessforbidden(); |
289 | + } |
|
270 | 290 | |
271 | 291 | $compteur = 0; |
272 | 292 | |
@@ -276,7 +296,9 @@ discard block |
||
276 | 296 | $sql .= " FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; |
277 | 297 | $sql .= " WHERE id_sondage = '".$db->escape($numsondage)."'"; |
278 | 298 | $resql = $db->query($sql); |
279 | - if (!$resql) dol_print_error($db); |
|
299 | + if (!$resql) { |
|
300 | + dol_print_error($db); |
|
301 | + } |
|
280 | 302 | $num = $db->num_rows($resql); |
281 | 303 | while ($compteur < $num) |
282 | 304 | { |
@@ -298,10 +320,12 @@ discard block |
||
298 | 320 | for ($i = 0; $i < $nbcolonnes; $i++) |
299 | 321 | { |
300 | 322 | if ((GETPOST("effacecolonne".$i) || GETPOST("effacecolonne".$i."_x") || GETPOST("effacecolonne".$i.".x")) |
301 | - && $nbcolonnes > 1) // effacecolonnei for chrome, effacecolonnei_x for firefox |
|
323 | + && $nbcolonnes > 1) { |
|
324 | + // effacecolonnei for chrome, effacecolonnei_x for firefox |
|
302 | 325 | { |
303 | 326 | // Security check |
304 | 327 | if (!$user->rights->opensurvey->write) accessforbidden(); |
328 | + } |
|
305 | 329 | |
306 | 330 | $db->begin(); |
307 | 331 | |
@@ -315,7 +339,9 @@ discard block |
||
315 | 339 | //si le sujet n'est pas celui qui a été effacé alors on concatene |
316 | 340 | if ($i != $j) |
317 | 341 | { |
318 | - if (!empty($nouveauxsujets)) $nouveauxsujets .= ','; |
|
342 | + if (!empty($nouveauxsujets)) { |
|
343 | + $nouveauxsujets .= ','; |
|
344 | + } |
|
319 | 345 | $nouveauxsujets .= $toutsujet[$j]; |
320 | 346 | } |
321 | 347 | |
@@ -326,7 +352,9 @@ discard block |
||
326 | 352 | $sql = 'UPDATE '.MAIN_DB_PREFIX."opensurvey_sondage"; |
327 | 353 | $sql .= " SET sujet = '".$db->escape($nouveauxsujets)."' WHERE id_sondage = '".$db->escape($numsondage)."'"; |
328 | 354 | $resql = $db->query($sql); |
329 | - if (!$resql) dol_print_error($db); |
|
355 | + if (!$resql) { |
|
356 | + dol_print_error($db); |
|
357 | + } |
|
330 | 358 | |
331 | 359 | // Clean current answer to remove deleted columns |
332 | 360 | $compteur = 0; |
@@ -450,11 +478,14 @@ discard block |
||
450 | 478 | |
451 | 479 | // Expire date |
452 | 480 | print '<tr><td>'.$langs->trans('ExpireDate').'</td><td colspan="2">'; |
453 | -if ($action == 'edit') print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
454 | -else { |
|
481 | +if ($action == 'edit') { |
|
482 | + print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); |
|
483 | +} else { |
|
455 | 484 | print dol_print_date($object->date_fin, 'day'); |
456 | - if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) print img_warning($langs->trans("Expired")); |
|
457 | -} |
|
485 | + if ($object->date_fin && $object->date_fin < dol_now() && $object->status == Opensurveysondage::STATUS_VALIDATED) { |
|
486 | + print img_warning($langs->trans("Expired")); |
|
487 | + } |
|
488 | + } |
|
458 | 489 | print '</td></tr>'; |
459 | 490 | |
460 | 491 | // Author |
@@ -512,7 +543,9 @@ discard block |
||
512 | 543 | if (GETPOST('ajoutsujet')) |
513 | 544 | { |
514 | 545 | // Security check |
515 | - if (!$user->rights->opensurvey->write) accessforbidden(); |
|
546 | + if (!$user->rights->opensurvey->write) { |
|
547 | + accessforbidden(); |
|
548 | + } |
|
516 | 549 | |
517 | 550 | print '<form name="formulaire" action="" method="POST">'."\n"; |
518 | 551 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
@@ -651,15 +684,21 @@ discard block |
||
651 | 684 | } |
652 | 685 | |
653 | 686 | $currenty = 0; |
654 | - if ($current) $currenty = strftime("%Y", $current); |
|
687 | + if ($current) { |
|
688 | + $currenty = strftime("%Y", $current); |
|
689 | + } |
|
655 | 690 | $next = 0; |
656 | - if ($next) $nexty = strftime("%Y", $next); |
|
691 | + if ($next) { |
|
692 | + $nexty = strftime("%Y", $next); |
|
693 | + } |
|
657 | 694 | if (isset($toutsujet[$i + 1]) && ($currenty == $nexty)) |
658 | 695 | { |
659 | 696 | $colspan++; |
660 | 697 | } else { |
661 | 698 | print '<td colspan='.$colspan.' class="annee">'; |
662 | - if ($current) print strftime("%Y", $current); |
|
699 | + if ($current) { |
|
700 | + print strftime("%Y", $current); |
|
701 | + } |
|
663 | 702 | print '</td>'."\n"; |
664 | 703 | $colspan = 1; |
665 | 704 | } |
@@ -805,33 +844,64 @@ discard block |
||
805 | 844 | |
806 | 845 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
807 | 846 | { |
808 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
809 | - else print '<td class="non">KO</td>'."\n"; |
|
847 | + if (((string) $car) == "1") { |
|
848 | + print '<td class="ok">OK</td>'."\n"; |
|
849 | + } else { |
|
850 | + print '<td class="non">KO</td>'."\n"; |
|
851 | + } |
|
810 | 852 | // Total |
811 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
812 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
853 | + if (!isset($sumfor[$i])) { |
|
854 | + $sumfor[$i] = 0; |
|
855 | + } |
|
856 | + if (((string) $car) == "1") { |
|
857 | + $sumfor[$i]++; |
|
858 | + } |
|
813 | 859 | } |
814 | 860 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
815 | 861 | { |
816 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
817 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
818 | - else print '<td class="vide"> </td>'."\n"; |
|
862 | + if (((string) $car) == "1") { |
|
863 | + print '<td class="ok">'.$langs->trans("Yes").'</td>'."\n"; |
|
864 | + } elseif (((string) $car) == "0") { |
|
865 | + print '<td class="non">'.$langs->trans("No").'</td>'."\n"; |
|
866 | + } else { |
|
867 | + print '<td class="vide"> </td>'."\n"; |
|
868 | + } |
|
819 | 869 | // Total |
820 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
821 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
822 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
823 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
870 | + if (!isset($sumfor[$i])) { |
|
871 | + $sumfor[$i] = 0; |
|
872 | + } |
|
873 | + if (!isset($sumagainst[$i])) { |
|
874 | + $sumagainst[$i] = 0; |
|
875 | + } |
|
876 | + if (((string) $car) == "1") { |
|
877 | + $sumfor[$i]++; |
|
878 | + } |
|
879 | + if (((string) $car) == "0") { |
|
880 | + $sumagainst[$i]++; |
|
881 | + } |
|
824 | 882 | } |
825 | 883 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
826 | 884 | { |
827 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
828 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
829 | - else print '<td class="vide"> </td>'."\n"; |
|
885 | + if (((string) $car) == "1") { |
|
886 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
887 | + } elseif (((string) $car) == "0") { |
|
888 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
889 | + } else { |
|
890 | + print '<td class="vide"> </td>'."\n"; |
|
891 | + } |
|
830 | 892 | // Total |
831 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
832 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
833 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
834 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
893 | + if (!isset($sumfor[$i])) { |
|
894 | + $sumfor[$i] = 0; |
|
895 | + } |
|
896 | + if (!isset($sumagainst[$i])) { |
|
897 | + $sumagainst[$i] = 0; |
|
898 | + } |
|
899 | + if (((string) $car) == "1") { |
|
900 | + $sumfor[$i]++; |
|
901 | + } |
|
902 | + if (((string) $car) == "0") { |
|
903 | + $sumagainst[$i]++; |
|
904 | + } |
|
835 | 905 | } |
836 | 906 | } |
837 | 907 | } else { |
@@ -845,7 +915,9 @@ discard block |
||
845 | 915 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
846 | 916 | { |
847 | 917 | print '<input type="checkbox" name="choix'.$i.'" value="1" '; |
848 | - if ($car == '1') print 'checked'; |
|
918 | + if ($car == '1') { |
|
919 | + print 'checked'; |
|
920 | + } |
|
849 | 921 | print '>'; |
850 | 922 | } |
851 | 923 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
@@ -866,33 +938,64 @@ discard block |
||
866 | 938 | $car = substr($ensemblereponses, $i, 1); |
867 | 939 | if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
868 | 940 | { |
869 | - if (((string) $car) == "1") print '<td class="ok">OK</td>'."\n"; |
|
870 | - else print '<td class="non">KO</td>'."\n"; |
|
941 | + if (((string) $car) == "1") { |
|
942 | + print '<td class="ok">OK</td>'."\n"; |
|
943 | + } else { |
|
944 | + print '<td class="non">KO</td>'."\n"; |
|
945 | + } |
|
871 | 946 | // Total |
872 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
873 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
947 | + if (!isset($sumfor[$i])) { |
|
948 | + $sumfor[$i] = 0; |
|
949 | + } |
|
950 | + if (((string) $car) == "1") { |
|
951 | + $sumfor[$i]++; |
|
952 | + } |
|
874 | 953 | } |
875 | 954 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') |
876 | 955 | { |
877 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
878 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
879 | - else print '<td class="vide"> </td>'."\n"; |
|
956 | + if (((string) $car) == "1") { |
|
957 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
958 | + } elseif (((string) $car) == "0") { |
|
959 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
960 | + } else { |
|
961 | + print '<td class="vide"> </td>'."\n"; |
|
962 | + } |
|
880 | 963 | // Total |
881 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
882 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
883 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
884 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
964 | + if (!isset($sumfor[$i])) { |
|
965 | + $sumfor[$i] = 0; |
|
966 | + } |
|
967 | + if (!isset($sumagainst[$i])) { |
|
968 | + $sumagainst[$i] = 0; |
|
969 | + } |
|
970 | + if (((string) $car) == "1") { |
|
971 | + $sumfor[$i]++; |
|
972 | + } |
|
973 | + if (((string) $car) == "0") { |
|
974 | + $sumagainst[$i]++; |
|
975 | + } |
|
885 | 976 | } |
886 | 977 | if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') |
887 | 978 | { |
888 | - if (((string) $car) == "1") print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
889 | - elseif (((string) $car) == "0") print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
890 | - else print '<td class="vide"> </td>'."\n"; |
|
979 | + if (((string) $car) == "1") { |
|
980 | + print '<td class="ok">'.$langs->trans("For").'</td>'."\n"; |
|
981 | + } elseif (((string) $car) == "0") { |
|
982 | + print '<td class="non">'.$langs->trans("Against").'</td>'."\n"; |
|
983 | + } else { |
|
984 | + print '<td class="vide"> </td>'."\n"; |
|
985 | + } |
|
891 | 986 | // Total |
892 | - if (!isset($sumfor[$i])) $sumfor[$i] = 0; |
|
893 | - if (!isset($sumagainst[$i])) $sumagainst[$i] = 0; |
|
894 | - if (((string) $car) == "1") $sumfor[$i]++; |
|
895 | - if (((string) $car) == "0") $sumagainst[$i]++; |
|
987 | + if (!isset($sumfor[$i])) { |
|
988 | + $sumfor[$i] = 0; |
|
989 | + } |
|
990 | + if (!isset($sumagainst[$i])) { |
|
991 | + $sumagainst[$i] = 0; |
|
992 | + } |
|
993 | + if (((string) $car) == "1") { |
|
994 | + $sumfor[$i]++; |
|
995 | + } |
|
996 | + if (((string) $car) == "0") { |
|
997 | + $sumagainst[$i]++; |
|
998 | + } |
|
896 | 999 | } |
897 | 1000 | } |
898 | 1001 | } |
@@ -966,8 +1069,9 @@ discard block |
||
966 | 1069 | $nbofcheckbox = 0; |
967 | 1070 | for ($i = 0; $i < $nbcolonnes + 1; $i++) |
968 | 1071 | { |
969 | - if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) |
|
970 | - $nbofcheckbox++; |
|
1072 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { |
|
1073 | + $nbofcheckbox++; |
|
1074 | + } |
|
971 | 1075 | if (isset($sumfor[$i])) |
972 | 1076 | { |
973 | 1077 | if ($i == 0) |
@@ -990,13 +1094,23 @@ discard block |
||
990 | 1094 | { |
991 | 1095 | $showsumfor = isset($sumfor[$i]) ? $sumfor[$i] : ''; |
992 | 1096 | $showsumagainst = isset($sumagainst[$i]) ? $sumagainst[$i] : ''; |
993 | - if (empty($showsumfor)) $showsumfor = 0; |
|
994 | - if (empty($showsumagainst)) $showsumagainst = 0; |
|
1097 | + if (empty($showsumfor)) { |
|
1098 | + $showsumfor = 0; |
|
1099 | + } |
|
1100 | + if (empty($showsumagainst)) { |
|
1101 | + $showsumagainst = 0; |
|
1102 | + } |
|
995 | 1103 | |
996 | 1104 | print '<td>'; |
997 | - if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) print $showsumfor; |
|
998 | - if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
999 | - if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
1105 | + if (empty($listofanswers[$i]['format']) || !in_array($listofanswers[$i]['format'], array('yesno', 'foragainst'))) { |
|
1106 | + print $showsumfor; |
|
1107 | + } |
|
1108 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'yesno') { |
|
1109 | + print $langs->trans("Yes").': '.$showsumfor.'<br>'.$langs->trans("No").': '.$showsumagainst; |
|
1110 | + } |
|
1111 | + if (!empty($listofanswers[$i]['format']) && $listofanswers[$i]['format'] == 'foragainst') { |
|
1112 | + print $langs->trans("For").': '.$showsumfor.'<br>'.$langs->trans("Against").': '.$showsumagainst; |
|
1113 | + } |
|
1000 | 1114 | print '</td>'."\n"; |
1001 | 1115 | } |
1002 | 1116 | print '</tr>'; |