@@ -24,13 +24,27 @@ discard block |
||
24 | 24 | * JQuery (providing object $) and JQuery-UI (providing $datepicker) libraries must be loaded before this file. |
25 | 25 | */ |
26 | 26 | |
27 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
28 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
29 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
30 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); |
|
31 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
32 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
33 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
27 | +if (!defined('NOREQUIRESOC')) { |
|
28 | + define('NOREQUIRESOC', '1'); |
|
29 | +} |
|
30 | +if (!defined('NOCSRFCHECK')) { |
|
31 | + define('NOCSRFCHECK', 1); |
|
32 | +} |
|
33 | +if (!defined('NOTOKENRENEWAL')) { |
|
34 | + define('NOTOKENRENEWAL', 1); |
|
35 | +} |
|
36 | +if (!defined('NOLOGIN')) { |
|
37 | + define('NOLOGIN', 1); |
|
38 | +} |
|
39 | +if (!defined('NOREQUIREMENU')) { |
|
40 | + define('NOREQUIREMENU', 1); |
|
41 | +} |
|
42 | +if (!defined('NOREQUIREHTML')) { |
|
43 | + define('NOREQUIREHTML', 1); |
|
44 | +} |
|
45 | +if (!defined('NOREQUIREAJAX')) { |
|
46 | + define('NOREQUIREAJAX', '1'); |
|
47 | +} |
|
34 | 48 | |
35 | 49 | session_cache_limiter('public'); |
36 | 50 | |
@@ -39,8 +53,11 @@ discard block |
||
39 | 53 | // Define javascript type |
40 | 54 | top_httphead('text/javascript; charset=UTF-8'); |
41 | 55 | // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. |
42 | -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
43 | -else header('Cache-Control: no-cache'); |
|
56 | +if (empty($dolibarr_nocache)) { |
|
57 | + header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
58 | +} else { |
|
59 | + header('Cache-Control: no-cache'); |
|
60 | +} |
|
44 | 61 | |
45 | 62 | |
46 | 63 | |
@@ -1060,7 +1077,9 @@ discard block |
||
1060 | 1077 | if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { |
1061 | 1078 | $thousand = $langs->transnoentitiesnoconv("SeparatorThousand"); |
1062 | 1079 | } |
1063 | - if ($thousand == 'Space') $thousand = ' '; |
|
1080 | + if ($thousand == 'Space') { |
|
1081 | + $thousand = ' '; |
|
1082 | + } |
|
1064 | 1083 | print "var dec='".dol_escape_js($dec)."'; var thousand='".dol_escape_js($thousand)."';\n"; // Set var in javascript |
1065 | 1084 | ?> |
1066 | 1085 |
@@ -21,13 +21,27 @@ discard block |
||
21 | 21 | * \brief File that include javascript functions (included if option use_javascript activated) |
22 | 22 | */ |
23 | 23 | |
24 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
25 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
26 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
27 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); |
|
28 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
29 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
30 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
24 | +if (!defined('NOREQUIRESOC')) { |
|
25 | + define('NOREQUIRESOC', '1'); |
|
26 | +} |
|
27 | +if (!defined('NOCSRFCHECK')) { |
|
28 | + define('NOCSRFCHECK', 1); |
|
29 | +} |
|
30 | +if (!defined('NOTOKENRENEWAL')) { |
|
31 | + define('NOTOKENRENEWAL', 1); |
|
32 | +} |
|
33 | +if (!defined('NOLOGIN')) { |
|
34 | + define('NOLOGIN', 1); |
|
35 | +} |
|
36 | +if (!defined('NOREQUIREMENU')) { |
|
37 | + define('NOREQUIREMENU', 1); |
|
38 | +} |
|
39 | +if (!defined('NOREQUIREHTML')) { |
|
40 | + define('NOREQUIREHTML', 1); |
|
41 | +} |
|
42 | +if (!defined('NOREQUIREAJAX')) { |
|
43 | + define('NOREQUIREAJAX', '1'); |
|
44 | +} |
|
31 | 45 | |
32 | 46 | session_cache_limiter('public'); |
33 | 47 | |
@@ -36,8 +50,11 @@ discard block |
||
36 | 50 | // Define javascript type |
37 | 51 | top_httphead('text/javascript; charset=UTF-8'); |
38 | 52 | // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. |
39 | -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
40 | -else header('Cache-Control: no-cache'); |
|
53 | +if (empty($dolibarr_nocache)) { |
|
54 | + header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
55 | +} else { |
|
56 | + header('Cache-Control: no-cache'); |
|
57 | +} |
|
41 | 58 | |
42 | 59 | //var_dump($conf); |
43 | 60 |
@@ -21,13 +21,27 @@ discard block |
||
21 | 21 | * \brief File that include javascript functions for timepicker |
22 | 22 | */ |
23 | 23 | |
24 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
25 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1); |
|
26 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); |
|
27 | -if (!defined('NOLOGIN')) define('NOLOGIN', 1); |
|
28 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); |
|
29 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); |
|
30 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
24 | +if (!defined('NOREQUIRESOC')) { |
|
25 | + define('NOREQUIRESOC', '1'); |
|
26 | +} |
|
27 | +if (!defined('NOCSRFCHECK')) { |
|
28 | + define('NOCSRFCHECK', 1); |
|
29 | +} |
|
30 | +if (!defined('NOTOKENRENEWAL')) { |
|
31 | + define('NOTOKENRENEWAL', 1); |
|
32 | +} |
|
33 | +if (!defined('NOLOGIN')) { |
|
34 | + define('NOLOGIN', 1); |
|
35 | +} |
|
36 | +if (!defined('NOREQUIREMENU')) { |
|
37 | + define('NOREQUIREMENU', 1); |
|
38 | +} |
|
39 | +if (!defined('NOREQUIREHTML')) { |
|
40 | + define('NOREQUIREHTML', 1); |
|
41 | +} |
|
42 | +if (!defined('NOREQUIREAJAX')) { |
|
43 | + define('NOREQUIREAJAX', '1'); |
|
44 | +} |
|
31 | 45 | |
32 | 46 | session_cache_limiter('public'); |
33 | 47 | |
@@ -36,8 +50,11 @@ discard block |
||
36 | 50 | // Define javascript type |
37 | 51 | top_httphead('text/javascript; charset=UTF-8'); |
38 | 52 | // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. |
39 | -if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
40 | -else header('Cache-Control: no-cache'); |
|
53 | +if (empty($dolibarr_nocache)) { |
|
54 | + header('Cache-Control: max-age=10800, public, must-revalidate'); |
|
55 | +} else { |
|
56 | + header('Cache-Control: no-cache'); |
|
57 | +} |
|
41 | 58 | ?> |
42 | 59 | |
43 | 60 | // For JQuery Timepicker |
@@ -61,4 +78,6 @@ discard block |
||
61 | 78 | }); |
62 | 79 | |
63 | 80 | <?php |
64 | -if (is_object($db)) $db->close(); |
|
81 | +if (is_object($db)) { |
|
82 | + $db->close(); |
|
83 | +} |
@@ -267,11 +267,13 @@ |
||
267 | 267 | // Add extra fields |
268 | 268 | $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")"; |
269 | 269 | $resql = $this->db->query($sql); |
270 | - if ($resql) // This can fail when class is used on old database (during migration for example) |
|
270 | + if ($resql) { |
|
271 | + // This can fail when class is used on old database (during migration for example) |
|
271 | 272 | { |
272 | 273 | while ($obj = $this->db->fetch_object($resql)) |
273 | 274 | { |
274 | 275 | $fieldname = 'extra.'.$obj->name; |
276 | + } |
|
275 | 277 | $fieldlabel = ucfirst($obj->label); |
276 | 278 | $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); |
277 | 279 | } |
@@ -91,8 +91,11 @@ |
||
91 | 91 | $this->code = ''; |
92 | 92 | |
93 | 93 | if (is_object($societe)) { |
94 | - if ($type == 'supplier') $this->code = (($societe->code_compta_fournisseur != "") ? $societe->code_compta_fournisseur : ''); |
|
95 | - else $this->code = (($societe->code_compta != "") ? $societe->code_compta : ''); |
|
94 | + if ($type == 'supplier') { |
|
95 | + $this->code = (($societe->code_compta_fournisseur != "") ? $societe->code_compta_fournisseur : ''); |
|
96 | + } else { |
|
97 | + $this->code = (($societe->code_compta != "") ? $societe->code_compta : ''); |
|
98 | + } |
|
96 | 99 | } |
97 | 100 | |
98 | 101 | return 0; // return ok |
@@ -110,7 +110,9 @@ discard block |
||
110 | 110 | global $_GET; |
111 | 111 | |
112 | 112 | $tcpdfEncoding = $this->getTcpdfEncodingType($encoding); |
113 | - if (empty($tcpdfEncoding)) return -1; |
|
113 | + if (empty($tcpdfEncoding)) { |
|
114 | + return -1; |
|
115 | + } |
|
114 | 116 | |
115 | 117 | $color = array(0, 0, 0); |
116 | 118 | |
@@ -159,7 +161,9 @@ discard block |
||
159 | 161 | $file = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; |
160 | 162 | |
161 | 163 | $tcpdfEncoding = $this->getTcpdfEncodingType($encoding); |
162 | - if (empty($tcpdfEncoding)) return -1; |
|
164 | + if (empty($tcpdfEncoding)) { |
|
165 | + return -1; |
|
166 | + } |
|
163 | 167 | |
164 | 168 | $color = array(0, 0, 0); |
165 | 169 |
@@ -274,7 +274,9 @@ discard block |
||
274 | 274 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
275 | 275 | $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
276 | 276 | $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; |
277 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
277 | + if (empty($user->rights->societe->client->voir)) { |
|
278 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
279 | + } |
|
278 | 280 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid'; |
279 | 281 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,'; |
280 | 282 | $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f'; |
@@ -288,7 +290,9 @@ discard block |
||
288 | 290 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; |
289 | 291 | $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; |
290 | 292 | $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')'; |
291 | - if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
293 | + if (isset($user) && empty($user->rights->societe->client->voir)) { |
|
294 | + $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
295 | + } |
|
292 | 296 | $r++; |
293 | 297 | |
294 | 298 | |
@@ -353,7 +357,9 @@ discard block |
||
353 | 357 | include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; |
354 | 358 | $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
355 | 359 | $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; |
356 | - if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
360 | + if (empty($user->rights->societe->client->voir)) { |
|
361 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; |
|
362 | + } |
|
357 | 363 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid'; |
358 | 364 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,'; |
359 | 365 | $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f'; |
@@ -368,7 +374,9 @@ discard block |
||
368 | 374 | $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account'; |
369 | 375 | $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid'; |
370 | 376 | $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')'; |
371 | - if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
377 | + if (isset($user) && empty($user->rights->societe->client->voir)) { |
|
378 | + $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; |
|
379 | + } |
|
372 | 380 | $r++; |
373 | 381 | } |
374 | 382 |
@@ -41,5 +41,7 @@ |
||
41 | 41 | if ($action == 'dellink' && !empty($permissiondellink) && !GETPOST('cancel', 'alpha') && $dellinkid > 0) |
42 | 42 | { |
43 | 43 | $result = $object->deleteObjectLinked(0, '', 0, '', $dellinkid); |
44 | - if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); |
|
45 | -} |
|
44 | + if ($result < 0) { |
|
45 | + setEventMessages($object->error, $object->errors, 'errors'); |
|
46 | + } |
|
47 | + } |
@@ -172,9 +172,13 @@ |
||
172 | 172 | |
173 | 173 | |
174 | 174 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
175 | - if ($id) $sql .= " WHERE t.id = ".$id; |
|
176 | - elseif ($code) $sql .= " WHERE t.code = '".$this->db->escape($code)."'"; |
|
177 | - elseif ($label) $sql .= " WHERE t.label = '".$this->db->escape($label)."'"; |
|
175 | + if ($id) { |
|
176 | + $sql .= " WHERE t.id = ".$id; |
|
177 | + } elseif ($code) { |
|
178 | + $sql .= " WHERE t.code = '".$this->db->escape($code)."'"; |
|
179 | + } elseif ($label) { |
|
180 | + $sql .= " WHERE t.label = '".$this->db->escape($label)."'"; |
|
181 | + } |
|
178 | 182 | |
179 | 183 | |
180 | 184 | $resql = $this->db->query($sql); |