diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index d4522ef047e..c35fe2440ef 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -179,12 +179,10 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) if ($result) { print " OK with ref ".$object->ref."\n";; - } - else { + } else { dol_print_error($db, $object->error); } - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index f63d50a1967..c421e39ffe3 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -124,8 +124,7 @@ if ($resql) { $row = $db->fetch_row($resql); $societesid[$i] = $row[0]; } -} -else { print "err"; } +} else { print "err"; } $commandesid = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; @@ -138,8 +137,7 @@ if ($resql) { $row = $db->fetch_row($resql); $commandesid[$i] = $row[0]; } -} -else { print "err"; } +} else { print "err"; } $prodids = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."product WHERE tosell=1"; @@ -206,14 +204,12 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) { $db->commit(); print " OK with ref ".$object->ref."\n"; - } - else { + } else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); } - } - else { + } else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 60ba418b43b..42c0c4098f2 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -210,14 +210,12 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) { $db->commit(); print " OK with ref ".$object->ref."\n"; - } - else { + } else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); } - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index f7bde473038..a13e2351e9c 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -136,8 +136,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++) } print "Company ".$s." created nom=".$soc->name."\n"; - } - else { + } else { print "Error: ".$soc->error."\n"; } } diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index 78f3a0789f8..fb07143f972 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -163,8 +163,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create result code = ".$ret." - ".$produit->errorsToString(); $errorrecord++; - } - else { + } else { print " - Creation OK with ref ".$produit->ref." - id = ".$ret; } @@ -179,8 +178,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString(); $errorrecord++; - } - else { + } else { print " - updatePrice OK"; } } @@ -198,8 +196,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString(); $errorrecord++; - } - else { + } else { print " - setMultiLangs OK"; } } @@ -224,8 +221,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) { print "Rollback any changes.\n"; $db->rollback(); -} -else { +} else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 87fef83de0f..a0ddaac7674 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -181,8 +181,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create result code = ".$ret." - ".$object->errorsToString(); $errorrecord++; - } - else { + } else { print " - Creation OK with name ".$object->name." - id = ".$ret; } } @@ -211,8 +210,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString(); $errorrecord++; - } - else { + } else { print " - create link sale representative OK"; } } @@ -241,8 +239,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); $errorrecord++; - } - else { + } else { print " - create contact OK"; } } @@ -274,8 +271,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); $errorrecord++; - } - else { + } else { print " - create contact OK"; } } @@ -301,8 +297,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) { print "Rollback any changes.\n"; $db->rollback(); -} -else { +} else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 25fa6a69e2d..8e4878577a1 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -142,8 +142,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) { print " - Error in create result code = ".$ret." - ".$object->errorsToString(); $errorrecord++; - } - else { + } else { print " - Creation OK with login ".$object->login." - id = ".$ret; } @@ -167,8 +166,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) { print "Rollback any changes.\n"; $db->rollback(); -} -else { +} else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index f9d8420b1e1..183140af202 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -325,8 +325,7 @@ if ($error || $mode != 'confirm') { print "\nRollback any changes.\n"; $db->rollback(); -} -else { +} else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 03104270dcf..4494e21f95a 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -214,7 +214,7 @@ - + diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 569f4aa6c57..19f20276378 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -266,8 +266,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV { $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]); } - } - else { + } else { // Check HTTPS environment variable (Apache/mod_ssl only) $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"]; } @@ -860,14 +859,12 @@ if (!GETPOST('nojs', 'int')) // If javascript was not disabled on URL { $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT; } -} -else $conf->use_javascript_ajax = 0; +} else $conf->use_javascript_ajax = 0; // Set MAIN_OPTIMIZEFORTEXTBROWSER if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) // If we must enable text browser { $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1; -} -elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) +} elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = $user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; } @@ -1134,8 +1131,7 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0) // default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none' header("Content-Security-Policy: ".$contentsecuritypolicy); } - } - elseif (constant('FORCECSP')) + } elseif (constant('FORCECSP')) { header("Content-Security-Policy: ".constant('FORCECSP')); } @@ -1553,10 +1549,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; @@ -1727,8 +1721,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); - } - else { + } else { $nophoto = '/public/theme/common/user_anonymous.png'; if ($user->gender == 'man') $nophoto = '/public/theme/common/user_man.png'; if ($user->gender == 'woman') $nophoto = '/public/theme/common/user_woman.png'; @@ -1781,8 +1774,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') { if ($result == 0) { $dropdownBody .= $hookmanager->resPrint; // add - } - else { + } else { $dropdownBody = $hookmanager->resPrint; // replace } } @@ -1808,10 +1800,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '') if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $btnUser = ' @@ -2202,10 +2192,8 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; print '