@@ -226,18 +226,25 @@ discard block |
||
226 | 226 | { |
227 | 227 | global $langs, $conf, $user; |
228 | 228 | |
229 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
229 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
230 | + $notooltip = 1; |
|
231 | + } |
|
232 | + // Force disable tooltips |
|
230 | 233 | |
231 | 234 | $result = ''; |
232 | 235 | |
233 | 236 | $url = DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35'; |
234 | 237 | |
235 | 238 | $label = '<u>'.$langs->trans("ShowAccountingJournal").'</u>'; |
236 | - if (!empty($this->code)) |
|
237 | - $label .= '<br><b>'.$langs->trans('Code').':</b> '.$this->code; |
|
238 | - if (!empty($this->label)) |
|
239 | - $label .= '<br><b>'.$langs->trans('Label').':</b> '.$langs->transnoentities($this->label); |
|
240 | - if ($moretitle) $label .= ' - '.$moretitle; |
|
239 | + if (!empty($this->code)) { |
|
240 | + $label .= '<br><b>'.$langs->trans('Code').':</b> '.$this->code; |
|
241 | + } |
|
242 | + if (!empty($this->label)) { |
|
243 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$langs->transnoentities($this->label); |
|
244 | + } |
|
245 | + if ($moretitle) { |
|
246 | + $label .= ' - '.$moretitle; |
|
247 | + } |
|
241 | 248 | |
242 | 249 | $linkclose = ''; |
243 | 250 | if (empty($notooltip)) |
@@ -263,11 +270,17 @@ discard block |
||
263 | 270 | } |
264 | 271 | |
265 | 272 | $label_link = $this->code; |
266 | - if ($withlabel) $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : ''); |
|
273 | + if ($withlabel) { |
|
274 | + $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : ''); |
|
275 | + } |
|
267 | 276 | |
268 | 277 | $result .= $linkstart; |
269 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
270 | - if ($withpicto != 2) $result .= $label_link; |
|
278 | + if ($withpicto) { |
|
279 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
280 | + } |
|
281 | + if ($withpicto != 2) { |
|
282 | + $result .= $label_link; |
|
283 | + } |
|
271 | 284 | $result .= $linkend; |
272 | 285 | |
273 | 286 | return $result; |
@@ -302,20 +315,34 @@ discard block |
||
302 | 315 | if ($mode == 0) |
303 | 316 | { |
304 | 317 | $prefix = ''; |
305 | - if ($nature == 9) return $langs->trans('AccountingJournalType9'); |
|
306 | - elseif ($nature == 5) return $langs->trans('AccountingJournalType5'); |
|
307 | - elseif ($nature == 4) return $langs->trans('AccountingJournalType4'); |
|
308 | - elseif ($nature == 3) return $langs->trans('AccountingJournalType3'); |
|
309 | - elseif ($nature == 2) return $langs->trans('AccountingJournalType2'); |
|
310 | - elseif ($nature == 1) return $langs->trans('AccountingJournalType1'); |
|
318 | + if ($nature == 9) { |
|
319 | + return $langs->trans('AccountingJournalType9'); |
|
320 | + } elseif ($nature == 5) { |
|
321 | + return $langs->trans('AccountingJournalType5'); |
|
322 | + } elseif ($nature == 4) { |
|
323 | + return $langs->trans('AccountingJournalType4'); |
|
324 | + } elseif ($nature == 3) { |
|
325 | + return $langs->trans('AccountingJournalType3'); |
|
326 | + } elseif ($nature == 2) { |
|
327 | + return $langs->trans('AccountingJournalType2'); |
|
328 | + } elseif ($nature == 1) { |
|
329 | + return $langs->trans('AccountingJournalType1'); |
|
330 | + } |
|
311 | 331 | } elseif ($mode == 1) |
312 | 332 | { |
313 | - if ($nature == 9) return $langs->trans('AccountingJournalType9'); |
|
314 | - elseif ($nature == 5) return $langs->trans('AccountingJournalType5'); |
|
315 | - elseif ($nature == 4) return $langs->trans('AccountingJournalType4'); |
|
316 | - elseif ($nature == 3) return $langs->trans('AccountingJournalType3'); |
|
317 | - elseif ($nature == 2) return $langs->trans('AccountingJournalType2'); |
|
318 | - elseif ($nature == 1) return $langs->trans('AccountingJournalType1'); |
|
333 | + if ($nature == 9) { |
|
334 | + return $langs->trans('AccountingJournalType9'); |
|
335 | + } elseif ($nature == 5) { |
|
336 | + return $langs->trans('AccountingJournalType5'); |
|
337 | + } elseif ($nature == 4) { |
|
338 | + return $langs->trans('AccountingJournalType4'); |
|
339 | + } elseif ($nature == 3) { |
|
340 | + return $langs->trans('AccountingJournalType3'); |
|
341 | + } elseif ($nature == 2) { |
|
342 | + return $langs->trans('AccountingJournalType2'); |
|
343 | + } elseif ($nature == 1) { |
|
344 | + return $langs->trans('AccountingJournalType1'); |
|
345 | + } |
|
319 | 346 | } |
320 | 347 | } |
321 | 348 | } |
@@ -192,7 +192,9 @@ discard block |
||
192 | 192 | $arrayyears[$val['year']] = $val['year']; |
193 | 193 | } |
194 | 194 | } |
195 | -if (!count($arrayyears)) $arrayyears[$nowyear] = $nowyear; |
|
195 | +if (!count($arrayyears)) { |
|
196 | + $arrayyears[$nowyear] = $nowyear; |
|
197 | +} |
|
196 | 198 | |
197 | 199 | $h = 0; |
198 | 200 | $head = array(); |
@@ -229,8 +231,12 @@ discard block |
||
229 | 231 | print '</td></tr>'; |
230 | 232 | // Year |
231 | 233 | print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">'; |
232 | - if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year; |
|
233 | - if (!in_array($nowyear, $arrayyears)) $arrayyears[$nowyear] = $nowyear; |
|
234 | + if (!in_array($year, $arrayyears)) { |
|
235 | + $arrayyears[$year] = $year; |
|
236 | + } |
|
237 | + if (!in_array($nowyear, $arrayyears)) { |
|
238 | + $arrayyears[$nowyear] = $nowyear; |
|
239 | + } |
|
234 | 240 | arsort($arrayyears); |
235 | 241 | print $form->selectarray('year', $arrayyears, $year, 0); |
236 | 242 | print '</td></tr>'; |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | $projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); |
51 | 51 | |
52 | 52 | // Security check |
53 | -if ($user->socid) $socid = $user->socid; |
|
53 | +if ($user->socid) { |
|
54 | + $socid = $user->socid; |
|
55 | +} |
|
54 | 56 | $result = restrictedArea($user, 'don', $id, ''); |
55 | 57 | |
56 | 58 | |
@@ -63,8 +65,12 @@ discard block |
||
63 | 65 | $offset = $limit * $page; |
64 | 66 | $pageprev = $page - 1; |
65 | 67 | $pagenext = $page + 1; |
66 | -if (!$sortorder) $sortorder = "ASC"; |
|
67 | -if (!$sortfield) $sortfield = "name"; |
|
68 | +if (!$sortorder) { |
|
69 | + $sortorder = "ASC"; |
|
70 | +} |
|
71 | +if (!$sortfield) { |
|
72 | + $sortfield = "name"; |
|
73 | +} |
|
68 | 74 | |
69 | 75 | |
70 | 76 | $object = new Don($db); |
@@ -112,7 +112,9 @@ discard block |
||
112 | 112 | $sql = " select rowid as id, email, firstname, lastname, plan, partner"; |
113 | 113 | $sql .= " from ".MAIN_DB_PREFIX."myobject"; |
114 | 114 | $sql .= " where email IS NOT NULL AND email != ''"; |
115 | - if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; |
|
115 | + if (GETPOSTISSET('filter') && GETPOST('filter', 'alphanohtml') != 'none') { |
|
116 | + $sql .= " AND status = '".$this->db->escape(GETPOST('filter', 'alphanohtml'))."'"; |
|
117 | + } |
|
116 | 118 | $sql .= " ORDER BY email"; |
117 | 119 | |
118 | 120 | // Stocke destinataires dans target |
@@ -197,7 +199,9 @@ discard block |
||
197 | 199 | { |
198 | 200 | $a = parent::getNbOfRecipients("select count(distinct(email)) as nb from ".MAIN_DB_PREFIX."myobject as p where email IS NOT NULL AND email != ''"); |
199 | 201 | |
200 | - if ($a < 0) return -1; |
|
202 | + if ($a < 0) { |
|
203 | + return -1; |
|
204 | + } |
|
201 | 205 | return $a; |
202 | 206 | } |
203 | 207 | } |
@@ -136,8 +136,11 @@ discard block |
||
136 | 136 | if ($resql) |
137 | 137 | { |
138 | 138 | $obj = $db->fetch_object($resql); |
139 | - if ($obj) $max = intval($obj->max); |
|
140 | - else $max = 0; |
|
139 | + if ($obj) { |
|
140 | + $max = intval($obj->max); |
|
141 | + } else { |
|
142 | + $max = 0; |
|
143 | + } |
|
141 | 144 | } else { |
142 | 145 | dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); |
143 | 146 | return -1; |
@@ -147,8 +150,13 @@ discard block |
||
147 | 150 | $date = $object->date_creation; |
148 | 151 | $yymm = strftime("%y%m", $date); |
149 | 152 | |
150 | - if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
151 | - else $num = sprintf("%04s", $max + 1); |
|
153 | + if ($max >= (pow(10, 4) - 1)) { |
|
154 | + $num = $max + 1; |
|
155 | + } |
|
156 | + // If counter > 9999, we do not format on 4 chars, we take number as it is |
|
157 | + else { |
|
158 | + $num = sprintf("%04s", $max + 1); |
|
159 | + } |
|
152 | 160 | |
153 | 161 | dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num); |
154 | 162 | return $this->prefix.$yymm."-".$num; |
@@ -99,7 +99,8 @@ discard block |
||
99 | 99 | $error = 0; // Error counter |
100 | 100 | |
101 | 101 | /* print_r($parameters); print_r($object); echo "action: " . $action; */ |
102 | - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' |
|
102 | + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { |
|
103 | + // do something only for the context 'somecontext1' or 'somecontext2' |
|
103 | 104 | { |
104 | 105 | // Do what you want here... |
105 | 106 | // You can for example call global vars like $fieldstosearchall to overwrite them, or update database depending on $action and $_POST values. |
@@ -107,6 +108,7 @@ discard block |
||
107 | 108 | |
108 | 109 | if (!$error) { |
109 | 110 | $this->results = array('myreturn' => 999); |
111 | + } |
|
110 | 112 | $this->resprints = 'A text to show'; |
111 | 113 | return 0; // or return 1 to replace standard code |
112 | 114 | } else { |
@@ -132,7 +134,8 @@ discard block |
||
132 | 134 | $error = 0; // Error counter |
133 | 135 | |
134 | 136 | /* print_r($parameters); print_r($object); echo "action: " . $action; */ |
135 | - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' |
|
137 | + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { |
|
138 | + // do something only for the context 'somecontext1' or 'somecontext2' |
|
136 | 139 | { |
137 | 140 | foreach ($parameters['toselect'] as $objectid) |
138 | 141 | { |
@@ -142,6 +145,7 @@ discard block |
||
142 | 145 | |
143 | 146 | if (!$error) { |
144 | 147 | $this->results = array('myreturn' => 999); |
148 | + } |
|
145 | 149 | $this->resprints = 'A text to show'; |
146 | 150 | return 0; // or return 1 to replace standard code |
147 | 151 | } else { |
@@ -168,10 +172,12 @@ discard block |
||
168 | 172 | $disabled = 1; |
169 | 173 | |
170 | 174 | /* print_r($parameters); print_r($object); echo "action: " . $action; */ |
171 | - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' |
|
175 | + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { |
|
176 | + // do something only for the context 'somecontext1' or 'somecontext2' |
|
172 | 177 | { |
173 | 178 | $this->resprints = '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>'.$langs->trans("MyModuleMassAction").'</option>'; |
174 | 179 | } |
180 | + } |
|
175 | 181 | |
176 | 182 | if (!$error) { |
177 | 183 | return 0; // or return 1 to replace standard code |
@@ -204,11 +210,13 @@ discard block |
||
204 | 210 | dol_syslog(get_class($this).'::executeHooks action='.$action); |
205 | 211 | |
206 | 212 | /* print_r($parameters); print_r($object); echo "action: " . $action; */ |
207 | - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' |
|
213 | + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { |
|
214 | + // do something only for the context 'somecontext1' or 'somecontext2' |
|
208 | 215 | { |
209 | 216 | } |
210 | 217 | |
211 | 218 | return $ret; |
219 | + } |
|
212 | 220 | } |
213 | 221 | |
214 | 222 | /** |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | include_once 'inc.php'; |
30 | -if (file_exists($conffile)) include_once $conffile; |
|
30 | +if (file_exists($conffile)) { |
|
31 | + include_once $conffile; |
|
32 | +} |
|
31 | 33 | require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; |
32 | 34 | require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash |
33 | 35 | |
@@ -42,13 +44,21 @@ discard block |
||
42 | 44 | // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install |
43 | 45 | // or MAIN_VERSION_LAST_UPGRADE for upgrade. |
44 | 46 | $targetversion = DOL_VERSION; // If it's latest upgrade |
45 | -if (!empty($action) && preg_match('/upgrade/i', $action)) // If it's an old upgrade |
|
47 | +if (!empty($action) && preg_match('/upgrade/i', $action)) { |
|
48 | + // If it's an old upgrade |
|
46 | 49 | { |
47 | 50 | $tmp = explode('_', $action, 2); |
51 | +} |
|
48 | 52 | if ($tmp[0] == 'upgrade') |
49 | 53 | { |
50 | - if (!empty($tmp[1])) $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' |
|
51 | - else $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION |
|
54 | + if (!empty($tmp[1])) { |
|
55 | + $targetversion = $tmp[1]; |
|
56 | + } |
|
57 | + // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' |
|
58 | + else { |
|
59 | + $targetversion = DOL_VERSION; |
|
60 | + } |
|
61 | + // if $action = 'upgrade', we use DOL_VERSION |
|
52 | 62 | } |
53 | 63 | } |
54 | 64 | |
@@ -63,7 +73,9 @@ discard block |
||
63 | 73 | |
64 | 74 | $useforcedwizard = false; |
65 | 75 | $forcedfile = "./install.forced.php"; |
66 | -if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
76 | +if ($conffile == "/etc/dolibarr/conf.php") { |
|
77 | + $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
78 | +} |
|
67 | 79 | if (@file_exists($forcedfile)) { |
68 | 80 | $useforcedwizard = true; |
69 | 81 | include_once $forcedfile; |
@@ -130,7 +142,9 @@ discard block |
||
130 | 142 | $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); |
131 | 143 | $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); |
132 | 144 | $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted |
133 | - } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
145 | + } else { |
|
146 | + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
147 | + } |
|
134 | 148 | } |
135 | 149 | |
136 | 150 | $conf->db->type = $dolibarr_main_db_type; |
@@ -160,13 +174,17 @@ discard block |
||
160 | 174 | include_once DOL_DOCUMENT_ROOT."/core/modules/".$file; |
161 | 175 | $objMod = new $modName($db); |
162 | 176 | $result = $objMod->init(); |
163 | - if (!$result) print 'ERROR in activating module file='.$file; |
|
177 | + if (!$result) { |
|
178 | + print 'ERROR in activating module file='.$file; |
|
179 | + } |
|
164 | 180 | |
165 | 181 | if ($db->connected) |
166 | 182 | { |
167 | 183 | $conf->setValues($db); |
168 | 184 | // Reset forced setup after the setValues |
169 | - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
185 | + if (defined('SYSLOG_FILE')) { |
|
186 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
187 | + } |
|
170 | 188 | $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; |
171 | 189 | |
172 | 190 | // Create admin user |
@@ -184,9 +202,14 @@ discard block |
||
184 | 202 | // Define default setup for password encryption |
185 | 203 | dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); |
186 | 204 | dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities |
187 | - if (function_exists('password_hash')) |
|
188 | - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities |
|
189 | - else dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities |
|
205 | + if (function_exists('password_hash')) { |
|
206 | + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); |
|
207 | + } |
|
208 | + // All entities |
|
209 | + else { |
|
210 | + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); |
|
211 | + } |
|
212 | + // All entities |
|
190 | 213 | } |
191 | 214 | |
192 | 215 | dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO); |
@@ -243,25 +266,35 @@ discard block |
||
243 | 266 | |
244 | 267 | dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG); |
245 | 268 | $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'"); |
246 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
269 | + if (!$resql) { |
|
270 | + dol_print_error($db, 'Error in setup program'); |
|
271 | + } |
|
247 | 272 | $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)"); |
248 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
273 | + if (!$resql) { |
|
274 | + dol_print_error($db, 'Error in setup program'); |
|
275 | + } |
|
249 | 276 | $conf->global->MAIN_VERSION_LAST_INSTALL = $targetversion; |
250 | 277 | |
251 | 278 | if ($useforcedwizard) |
252 | 279 | { |
253 | 280 | dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG); |
254 | 281 | $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'"); |
255 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
282 | + if (!$resql) { |
|
283 | + dol_print_error($db, 'Error in setup program'); |
|
284 | + } |
|
256 | 285 | $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)"); |
257 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
286 | + if (!$resql) { |
|
287 | + dol_print_error($db, 'Error in setup program'); |
|
288 | + } |
|
258 | 289 | $conf->global->MAIN_REMOVE_INSTALL_WARNING = 1; |
259 | 290 | } |
260 | 291 | |
261 | 292 | // If we ask to force some modules to be enabled |
262 | 293 | if (!empty($force_install_module)) |
263 | 294 | { |
264 | - if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); |
|
295 | + if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) { |
|
296 | + define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); |
|
297 | + } |
|
265 | 298 | |
266 | 299 | $tmparray = explode(',', $force_install_module); |
267 | 300 | foreach ($tmparray as $modtoactivate) |
@@ -274,13 +307,17 @@ discard block |
||
274 | 307 | $res = dol_include_once("/core/modules/".$file); |
275 | 308 | |
276 | 309 | $res = activateModule($modtoactivatenew, 1); |
277 | - if (!empty($res['errors'])) print 'ERROR in activating module file='.$file; |
|
310 | + if (!empty($res['errors'])) { |
|
311 | + print 'ERROR in activating module file='.$file; |
|
312 | + } |
|
278 | 313 | } |
279 | 314 | } |
280 | 315 | |
281 | 316 | dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const'); |
282 | 317 | $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'"); |
283 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
318 | + if (!$resql) { |
|
319 | + dol_print_error($db, 'Error in setup program'); |
|
320 | + } |
|
284 | 321 | |
285 | 322 | $db->commit(); |
286 | 323 | } |
@@ -295,25 +332,36 @@ discard block |
||
295 | 332 | { |
296 | 333 | $conf->setValues($db); |
297 | 334 | // Reset forced setup after the setValues |
298 | - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
335 | + if (defined('SYSLOG_FILE')) { |
|
336 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
337 | + } |
|
299 | 338 | $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; |
300 | 339 | |
301 | 340 | // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database |
302 | 341 | $tagdatabase = false; |
303 | - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed. |
|
342 | + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { |
|
343 | + $tagdatabase = true; |
|
344 | + } |
|
345 | + // We don't know what it was before, so now we consider we are version choosed. |
|
304 | 346 | else { |
305 | 347 | $mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE); |
306 | 348 | $targetversionarray = preg_split('/[.-]/', $targetversion); |
307 | - if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase = true; |
|
349 | + if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) { |
|
350 | + $tagdatabase = true; |
|
351 | + } |
|
308 | 352 | } |
309 | 353 | |
310 | 354 | if ($tagdatabase) |
311 | 355 | { |
312 | 356 | dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion); |
313 | 357 | $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'"); |
314 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
358 | + if (!$resql) { |
|
359 | + dol_print_error($db, 'Error in setup program'); |
|
360 | + } |
|
315 | 361 | $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)"); |
316 | - if (!$resql) dol_print_error($db, 'Error in setup program'); |
|
362 | + if (!$resql) { |
|
363 | + dol_print_error($db, 'Error in setup program'); |
|
364 | + } |
|
317 | 365 | $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion; |
318 | 366 | } else { |
319 | 367 | dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.'); |
@@ -353,7 +401,10 @@ discard block |
||
353 | 401 | $fp = @fopen($lockfile, "w"); |
354 | 402 | if ($fp) |
355 | 403 | { |
356 | - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall = 444; // For backward compatibility |
|
404 | + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { |
|
405 | + $force_install_lockinstall = 444; |
|
406 | + } |
|
407 | + // For backward compatibility |
|
357 | 408 | fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); |
358 | 409 | fclose($fp); |
359 | 410 | @chmod($lockfile, octdec($force_install_lockinstall)); |
@@ -401,7 +452,10 @@ discard block |
||
401 | 452 | $fp = @fopen($lockfile, "w"); |
402 | 453 | if ($fp) |
403 | 454 | { |
404 | - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall = 444; // For backward compatibility |
|
455 | + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { |
|
456 | + $force_install_lockinstall = 444; |
|
457 | + } |
|
458 | + // For backward compatibility |
|
405 | 459 | fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); |
406 | 460 | fclose($fp); |
407 | 461 | @chmod($lockfile, octdec($force_install_lockinstall)); |
@@ -437,7 +491,9 @@ discard block |
||
437 | 491 | clearstatcache(); |
438 | 492 | |
439 | 493 | $ret = 0; |
440 | -if ($error && isset($argv[1])) $ret = 1; |
|
494 | +if ($error && isset($argv[1])) { |
|
495 | + $ret = 1; |
|
496 | +} |
|
441 | 497 | dolibarr_install_syslog("Exit ".$ret); |
442 | 498 | |
443 | 499 | dolibarr_install_syslog("- step5: Dolibarr setup finished"); |
@@ -445,4 +501,6 @@ discard block |
||
445 | 501 | pFooter(1, $setuplang); |
446 | 502 | |
447 | 503 | // Return code if ran from command line |
448 | -if ($ret) exit($ret); |
|
504 | +if ($ret) { |
|
505 | + exit($ret); |
|
506 | +} |
@@ -1,5 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> |
|
2 | +if (!defined('ISLOADEDBYSTEELSHEET')) { |
|
3 | + die('Must be call by steelsheet'); |
|
4 | +} |
|
5 | +?> |
|
3 | 6 | /* <style type="text/css" > */ |
4 | 7 | |
5 | 8 | /* |
@@ -198,10 +201,16 @@ discard block |
||
198 | 201 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
199 | 202 | |
200 | 203 | $prefix = ''; |
201 | -if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) $prefix = 'background-'; |
|
204 | +if (!empty($conf->global->THEME_INFOBOX_COLOR_ON_BACKGROUND)) { |
|
205 | + $prefix = 'background-'; |
|
206 | +} |
|
202 | 207 | |
203 | -if (!isset($conf->global->THEME_SATURATE_RATIO)) $conf->global->THEME_SATURATE_RATIO = 0.7; |
|
204 | -if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int'); |
|
208 | +if (!isset($conf->global->THEME_SATURATE_RATIO)) { |
|
209 | + $conf->global->THEME_SATURATE_RATIO = 0.7; |
|
210 | +} |
|
211 | +if (GETPOSTISSET('THEME_SATURATE_RATIO')) { |
|
212 | + $conf->global->THEME_SATURATE_RATIO = GETPOST('THEME_SATURATE_RATIO', 'int'); |
|
213 | +} |
|
205 | 214 | |
206 | 215 | ?> |
207 | 216 | .info-box-icon { |
@@ -250,10 +250,16 @@ discard block |
||
250 | 250 | { |
251 | 251 | $num = $this->db->num_rows($resql); |
252 | 252 | |
253 | - if (empty($conf->categorie->enabled)) $num = 0; // Force empty list if category module is not enabled |
|
253 | + if (empty($conf->categorie->enabled)) { |
|
254 | + $num = 0; |
|
255 | + } |
|
256 | + // Force empty list if category module is not enabled |
|
254 | 257 | |
255 | - if ($num) $s .= '<option value="0"> </option>'; |
|
256 | - else $s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>'; |
|
258 | + if ($num) { |
|
259 | + $s .= '<option value="0"> </option>'; |
|
260 | + } else { |
|
261 | + $s .= '<option value="0">'.$langs->trans("ContactsAllShort").'</option>'; |
|
262 | + } |
|
257 | 263 | |
258 | 264 | $i = 0; |
259 | 265 | while ($i < $num) |
@@ -261,10 +267,16 @@ discard block |
||
261 | 267 | $obj = $this->db->fetch_object($resql); |
262 | 268 | |
263 | 269 | $type = ''; |
264 | - if ($obj->type == 1) $type = $langs->trans("Supplier"); |
|
265 | - if ($obj->type == 2) $type = $langs->trans("Customer"); |
|
270 | + if ($obj->type == 1) { |
|
271 | + $type = $langs->trans("Supplier"); |
|
272 | + } |
|
273 | + if ($obj->type == 2) { |
|
274 | + $type = $langs->trans("Customer"); |
|
275 | + } |
|
266 | 276 | $s .= '<option value="'.$obj->rowid.'">'.dol_trunc($obj->label, 38, 'middle'); |
267 | - if ($type) $s .= ' ('.$type.')'; |
|
277 | + if ($type) { |
|
278 | + $s .= ' ('.$type.')'; |
|
279 | + } |
|
268 | 280 | $s .= '</option>'; |
269 | 281 | $i++; |
270 | 282 | } |