@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | $langs->load("opensurvey"); |
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 | $hookmanager = new HookManager($db); |
37 | 39 | |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | { |
53 | 55 | $obj = $db->fetch_object($resql); |
54 | 56 | $nbsondages = $obj->nb; |
55 | -} else dol_print_error($db, ''); |
|
57 | +} else { |
|
58 | + dol_print_error($db, ''); |
|
59 | +} |
|
56 | 60 | |
57 | 61 | |
58 | 62 | $title = $langs->trans("OpenSurveyArea"); |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | require_once DOL_DOCUMENT_ROOT."/opensurvey/fonctions.php"; |
29 | 29 | |
30 | 30 | // Security check |
31 | -if (!$user->rights->opensurvey->write) accessforbidden(); |
|
31 | +if (!$user->rights->opensurvey->write) { |
|
32 | + accessforbidden(); |
|
33 | +} |
|
32 | 34 | |
33 | 35 | // Survey type is DATE |
34 | 36 | $_SESSION["formatsondage"] = "D"; |
@@ -220,9 +222,15 @@ discard block |
||
220 | 222 | $anneeAJ = date("Y"); |
221 | 223 | |
222 | 224 | // Initialisation des jour, mois et année |
223 | -if (!isset($_SESSION['jour'])) $_SESSION['jour'] = date('j'); |
|
224 | -if (!isset($_SESSION['mois'])) $_SESSION['mois'] = date('n'); |
|
225 | -if (!isset($_SESSION['annee'])) $_SESSION['annee'] = date('Y'); |
|
225 | +if (!isset($_SESSION['jour'])) { |
|
226 | + $_SESSION['jour'] = date('j'); |
|
227 | +} |
|
228 | +if (!isset($_SESSION['mois'])) { |
|
229 | + $_SESSION['mois'] = date('n'); |
|
230 | +} |
|
231 | +if (!isset($_SESSION['annee'])) { |
|
232 | + $_SESSION['annee'] = date('Y'); |
|
233 | +} |
|
226 | 234 | |
227 | 235 | //mise a jour des valeurs de session si bouton retour a aujourd'hui |
228 | 236 | if (!issetAndNoEmpty('choixjourajout') && !issetAndNoEmpty('choixjourretrait') && (issetAndNoEmpty('retourmois') || issetAndNoEmpty('retourmois_x'))) { |
@@ -37,7 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | $object = new Opensurveysondage($db); |
39 | 39 | $result = $object->fetch(0, $numsondage); |
40 | -if ($result <= 0) dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
40 | +if ($result <= 0) { |
|
41 | + dol_print_error('', 'Failed to get survey id '.$numsondage); |
|
42 | +} |
|
41 | 43 | |
42 | 44 | |
43 | 45 | /* |
@@ -120,7 +122,9 @@ discard block |
||
120 | 122 | $input .= "\r\n"; |
121 | 123 | $i++; |
122 | 124 | } |
123 | -} else dol_print_error($db); |
|
125 | +} else { |
|
126 | + dol_print_error($db); |
|
127 | +} |
|
124 | 128 | |
125 | 129 | |
126 | 130 | $filesize = strlen($input); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | |
46 | 46 | // Security check (for external users) |
47 | 47 | $socid = 0; |
48 | -if ($user->socid > 0) $socid = $user->socid; |
|
48 | +if ($user->socid > 0) { |
|
49 | + $socid = $user->socid; |
|
50 | +} |
|
49 | 51 | |
50 | 52 | $companystatic = new Societe($db); |
51 | 53 | $fuserstatic = new User($db); |
@@ -116,7 +118,9 @@ discard block |
||
116 | 118 | } else { |
117 | 119 | $sql .= " WHERE u.entity IN (".getEntity('user').")"; |
118 | 120 | } |
119 | -if (!empty($socid)) $sql .= " AND u.fk_soc = ".$socid; |
|
121 | +if (!empty($socid)) { |
|
122 | + $sql .= " AND u.fk_soc = ".$socid; |
|
123 | +} |
|
120 | 124 | $sql .= $db->order("u.datec", "DESC"); |
121 | 125 | $sql .= $db->plimit($max); |
122 | 126 | |
@@ -231,7 +235,9 @@ discard block |
||
231 | 235 | if ($resql) |
232 | 236 | { |
233 | 237 | $colspan = 1; |
234 | - if (!empty($conf->multicompany->enabled)) $colspan++; |
|
238 | + if (!empty($conf->multicompany->enabled)) { |
|
239 | + $colspan++; |
|
240 | + } |
|
235 | 241 | $num = $db->num_rows($resql); |
236 | 242 | |
237 | 243 | print '<div class="div-table-responsive-no-min">'; |
@@ -35,7 +35,9 @@ discard block |
||
35 | 35 | |
36 | 36 | // Security check |
37 | 37 | $socid = 0; |
38 | -if ($user->socid > 0) $socid = $user->socid; |
|
38 | +if ($user->socid > 0) { |
|
39 | + $socid = $user->socid; |
|
40 | +} |
|
39 | 41 | $feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); |
40 | 42 | |
41 | 43 | $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); |
@@ -55,7 +57,9 @@ discard block |
||
55 | 57 | |
56 | 58 | $parameters = array('id'=>$socid); |
57 | 59 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
58 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
60 | +if ($reshook < 0) { |
|
61 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
62 | +} |
|
59 | 63 | |
60 | 64 | if (empty($reshook)) |
61 | 65 | { |
@@ -162,7 +166,9 @@ discard block |
||
162 | 166 | |
163 | 167 | print "</div>\n"; |
164 | 168 | |
165 | -if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') print "<br>\n"; |
|
169 | +if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') { |
|
170 | + print "<br>\n"; |
|
171 | +} |
|
166 | 172 | |
167 | 173 | |
168 | 174 |
@@ -64,12 +64,16 @@ discard block |
||
64 | 64 | |
65 | 65 | // Security check |
66 | 66 | $socid = 0; |
67 | -if ($user->socid > 0) $socid = $user->socid; |
|
67 | +if ($user->socid > 0) { |
|
68 | + $socid = $user->socid; |
|
69 | +} |
|
68 | 70 | $feature2 = 'user'; |
69 | 71 | |
70 | 72 | $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); |
71 | 73 | |
72 | -if ($user->id <> $id && !$canreaduser) accessforbidden(); |
|
74 | +if ($user->id <> $id && !$canreaduser) { |
|
75 | + accessforbidden(); |
|
76 | +} |
|
73 | 77 | |
74 | 78 | // Get parameters |
75 | 79 | $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
@@ -80,8 +84,12 @@ discard block |
||
80 | 84 | $offset = $limit * $page; |
81 | 85 | $pageprev = $page - 1; |
82 | 86 | $pagenext = $page + 1; |
83 | -if (!$sortorder) $sortorder = "ASC"; |
|
84 | -if (!$sortfield) $sortfield = "position_name"; |
|
87 | +if (!$sortorder) { |
|
88 | + $sortorder = "ASC"; |
|
89 | +} |
|
90 | +if (!$sortfield) { |
|
91 | + $sortfield = "position_name"; |
|
92 | +} |
|
85 | 93 | |
86 | 94 | $object = new User($db); |
87 | 95 | if ($id > 0 || !empty($ref)) |
@@ -103,7 +111,9 @@ discard block |
||
103 | 111 | |
104 | 112 | $parameters = array('id'=>$socid); |
105 | 113 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
106 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
114 | +if ($reshook < 0) { |
|
115 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
116 | +} |
|
107 | 117 | |
108 | 118 | if (empty($reshook)) { |
109 | 119 | include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; |
@@ -123,7 +133,9 @@ discard block |
||
123 | 133 | /* |
124 | 134 | * Affichage onglets |
125 | 135 | */ |
126 | - if (!empty($conf->notification->enabled)) $langs->load("mails"); |
|
136 | + if (!empty($conf->notification->enabled)) { |
|
137 | + $langs->load("mails"); |
|
138 | + } |
|
127 | 139 | $head = user_prepare_head($object); |
128 | 140 | |
129 | 141 | $form = new Form($db); |
@@ -24,12 +24,25 @@ discard block |
||
24 | 24 | * \brief File to return Ajax response on third parties request |
25 | 25 | */ |
26 | 26 | |
27 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
28 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
29 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
30 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
31 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
32 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
27 | +if (!defined('NOTOKENRENEWAL')) { |
|
28 | + define('NOTOKENRENEWAL', 1); |
|
29 | +} |
|
30 | +// Disables token renewal |
|
31 | +if (!defined('NOREQUIREMENU')) { |
|
32 | + define('NOREQUIREMENU', '1'); |
|
33 | +} |
|
34 | +if (!defined('NOREQUIREHTML')) { |
|
35 | + define('NOREQUIREHTML', '1'); |
|
36 | +} |
|
37 | +if (!defined('NOREQUIREAJAX')) { |
|
38 | + define('NOREQUIREAJAX', '1'); |
|
39 | +} |
|
40 | +if (!defined('NOREQUIRESOC')) { |
|
41 | + define('NOREQUIRESOC', '1'); |
|
42 | +} |
|
43 | +if (!defined('NOCSRFCHECK')) { |
|
44 | + define('NOCSRFCHECK', '1'); |
|
45 | +} |
|
33 | 46 | |
34 | 47 | $res = 0; |
35 | 48 | require '../../main.inc.php'; |
@@ -59,7 +72,10 @@ discard block |
||
59 | 72 | $sql = "SELECT p.rowid, p.ref, p.title, s.nom"; |
60 | 73 | $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; |
61 | 74 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; |
62 | - if (!empty($_GET["fk_projet"])) $sql .= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'"; // Add other filters |
|
75 | + if (!empty($_GET["fk_projet"])) { |
|
76 | + $sql .= " WHERE p.ref LIKE '%".$db->escape($_GET["fk_projet"])."%' OR p.title LIKE '%".$db->escape($_GET["fk_projet"])."%' OR s.nom LIKE '%".$db->escape($_GET["fk_projet"])."%'"; |
|
77 | + } |
|
78 | + // Add other filters |
|
63 | 79 | $sql .= " ORDER BY p.ref ASC"; |
64 | 80 | |
65 | 81 | $resql = $db->query($sql); |
@@ -22,12 +22,25 @@ discard block |
||
22 | 22 | * \brief File to return Ajax response on third parties request |
23 | 23 | */ |
24 | 24 | |
25 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal |
|
26 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
27 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
28 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
29 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
30 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
25 | +if (!defined('NOTOKENRENEWAL')) { |
|
26 | + define('NOTOKENRENEWAL', 1); |
|
27 | +} |
|
28 | +// Disables token renewal |
|
29 | +if (!defined('NOREQUIREMENU')) { |
|
30 | + define('NOREQUIREMENU', '1'); |
|
31 | +} |
|
32 | +if (!defined('NOREQUIREHTML')) { |
|
33 | + define('NOREQUIREHTML', '1'); |
|
34 | +} |
|
35 | +if (!defined('NOREQUIREAJAX')) { |
|
36 | + define('NOREQUIREAJAX', '1'); |
|
37 | +} |
|
38 | +if (!defined('NOREQUIRESOC')) { |
|
39 | + define('NOREQUIRESOC', '1'); |
|
40 | +} |
|
41 | +if (!defined('NOCSRFCHECK')) { |
|
42 | + define('NOCSRFCHECK', '1'); |
|
43 | +} |
|
31 | 44 | |
32 | 45 | $res = 0; |
33 | 46 | require '../../main.inc.php'; |
@@ -50,20 +63,25 @@ discard block |
||
50 | 63 | $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); |
51 | 64 | |
52 | 65 | |
53 | -if (empty($fk_expense) || $fk_expense < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'))); |
|
54 | -elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'))); |
|
55 | -else { |
|
66 | +if (empty($fk_expense) || $fk_expense < 0) { |
|
67 | + echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'))); |
|
68 | +} elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) { |
|
69 | + echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'))); |
|
70 | +} else { |
|
56 | 71 | // @see ndfp.class.php:3576 (method: compute_total_km) |
57 | 72 | $expense = new ExpenseReport($db); |
58 | - if ($expense->fetch($fk_expense) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_expense' => $fk_expense)); |
|
59 | - else { |
|
73 | + if ($expense->fetch($fk_expense) <= 0) { |
|
74 | + echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_expense' => $fk_expense)); |
|
75 | + } else { |
|
60 | 76 | $userauthor = new User($db); |
61 | - if ($userauthor->fetch($expense->fk_user_author) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author)); |
|
62 | - else { |
|
77 | + if ($userauthor->fetch($expense->fk_user_author) <= 0) { |
|
78 | + echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author)); |
|
79 | + } else { |
|
63 | 80 | $range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat); |
64 | 81 | |
65 | - if (empty($range)) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range)); |
|
66 | - else { |
|
82 | + if (empty($range)) { |
|
83 | + echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range)); |
|
84 | + } else { |
|
67 | 85 | $ikoffset = price($range->ikoffset, 0, $langs, 1, -1, -1, $conf->currency); |
68 | 86 | echo json_encode(array('up' => $range->coef, 'ikoffset' => $range->ikoffset, 'title' => $langs->transnoentitiesnoconv('ExpenseRangeOffset', $offset), 'comment' => 'offset should be apply on addline or updateline')); |
69 | 87 | } |
@@ -182,8 +182,11 @@ |
||
182 | 182 | while ($obj = $db->fetch_object($resql)) |
183 | 183 | { |
184 | 184 | $rule = new ExpenseReportRule($db); |
185 | - if ($rule->fetch($obj->rowid) > 0) $rules[$rule->id] = $rule; |
|
186 | - else dol_print_error($db); |
|
185 | + if ($rule->fetch($obj->rowid) > 0) { |
|
186 | + $rules[$rule->id] = $rule; |
|
187 | + } else { |
|
188 | + dol_print_error($db); |
|
189 | + } |
|
187 | 190 | } |
188 | 191 | } else { |
189 | 192 | dol_print_error($db); |