diff --git a/.travis.yml b/.travis.yml
index 1112454c991..f7903361b02 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -291,8 +291,8 @@ script:
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
- phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
- #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
+ #phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
+ if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
set +e
echo
diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index a6a915094e2..03104270dcf 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -214,6 +214,7 @@
+
diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php
index 22519c55ab0..c6eec8b2d83 100644
--- a/htdocs/adherents/admin/adherent_emails.php
+++ b/htdocs/adherents/admin/adherent_emails.php
@@ -95,8 +95,7 @@ if ($action == 'update' || $action == 'add') {
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else {
+ } else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 79e4cab1719..aa9797959a7 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -166,8 +166,7 @@ abstract class ActionsAdherentCardCommon
$dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
- }
- else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
+ } else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
}
if ($action == 'view' || $action == 'delete') {
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index cf5253e3bf8..727a99e060c 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -539,8 +539,7 @@ if (empty($reshook)) {
$action = 'create';
}
- }
- else {
+ } else {
$action = 'create';
}
}
@@ -599,8 +598,7 @@ if (empty($reshook)) {
//fallback on the old configuration.
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
$error++;
- }
- else {
+ } else {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
@@ -669,8 +667,7 @@ if (empty($reshook)) {
//fallback on the old configuration.
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
$error++;
- }
- else {
+ } else {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
@@ -1215,8 +1212,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '
';
// Show graphs
print '
';
-if ($mesg) { print $mesg; }
-else {
+if ($mesg) { print $mesg; } else {
print $px1->show();
print " \n";
print $px2->show();
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index a3d72e600e6..06b8cecf7f3 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -121,12 +121,10 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) {
$langs->load("errors");
setEventMessages($company->error, $company->errors, 'errors');
- }
- else {
+ } else {
$action = 'addsubscription';
}
- }
- else {
+ } else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
@@ -246,15 +244,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
setEventMessages($errmsg, null, 'errors');
$error++;
$action = 'addsubscription';
- }
- else {
+ } else {
if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') {
if ($_POST["subscription"]) {
if (!$_POST["label"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"));
if ($_POST["paymentsave"] != 'invoiceonly' && !$_POST["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount"));
- }
- else {
+ } else {
if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
}
if ($errmsg) {
@@ -284,16 +280,14 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
- }
- else {
+ } else {
// If an invoice was created, it is into $object->invoice
}
}
if (!$error) {
$db->commit();
- }
- else {
+ } else {
$db->rollback();
$action = 'addsubscription';
}
@@ -355,12 +349,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) {
$errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors');
- }
- else {
+ } else {
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
}
- }
- else {
+ } else {
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
}
}
@@ -491,13 +483,11 @@ if ($rowid > 0) {
if ($object->hasDelay()) {
print " ".img_warning($langs->trans("Late"));
}
- }
- else {
+ } else {
if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
- }
- else {
+ } else {
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
@@ -525,14 +515,12 @@ if ($rowid > 0) {
print ' | ';
print ' | ';
print '
';
- }
- else {
+ } else {
if ($object->fk_soc) {
$company = new Societe($db);
$result = $company->fetch($object->fk_soc);
print $company->getNomUrl(1);
- }
- else {
+ } else {
print $langs->trans("NoThirdPartyAssociatedToMember");
}
}
@@ -555,12 +543,10 @@ if ($rowid > 0) {
print '
';
if ($action == 'editlogin') {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
- }
- else {
+ } else {
if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
- }
- else print $langs->trans("NoDolibarrAccess");
+ } else print $langs->trans("NoDolibarrAccess");
}
print ' | ';
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 534e7c2896c..ed0172c1f12 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -123,8 +123,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if (empty($object->label)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
- }
- else {
+ } else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$result = $db->query($sql);
if ($result) {
@@ -142,13 +141,11 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if ($id > 0) {
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
- }
- else {
+ } else {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
- }
- else {
+ } else {
$action = 'create';
}
}
@@ -176,8 +173,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
if ($ret >= 0 && !count($object->errors)) {
setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
- }
- else {
+ } else {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -193,8 +189,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
- }
- else {
+ } else {
setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
$action = '';
}
@@ -277,9 +272,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '';
print '
'.dol_escape_htmltag($objp->label).' | ';
print '
';
- if ($objp->morphy == 'phy') { print $langs->trans("Physical"); }
- elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
- else print $langs->trans("MorPhy");
+ if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorPhy");
print ' | ';
print '
'.yn($objp->subscription).' | ';
print '
'.yn($objp->vote).' | ';
@@ -296,8 +289,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '
';
print '';
- }
- else {
+ } else {
dol_print_error($db);
}
}
@@ -424,8 +416,7 @@ if ($rowid > 0) {
print '
| '.$langs->trans("Duration").' | '.$object->duration_value.' ';
if ($object->duration_value > 1) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years"));
- }
- elseif ($object->duration_value > 0) {
+ } elseif ($object->duration_value > 0) {
$dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year"));
}
print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
@@ -535,14 +526,8 @@ if ($rowid > 0) {
$titre = $langs->trans("MembersList");
if ($status != '') {
- if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
- elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); }
- elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); }
- elseif ($status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
- elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
- elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); }
- }
- elseif ($action == 'search') {
+ if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } elseif ($status == '-1') { $titre = $langs->trans("MembersListToValid"); } elseif ($status == '1' && !$filter) { $titre = $langs->trans("MembersListValid"); } elseif ($status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } elseif ($status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } elseif ($status == '0') { $titre = $langs->trans("MembersListResiliated"); }
+ } elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
}
@@ -623,8 +608,7 @@ if ($rowid > 0) {
print ' |
';
if ($objp->company != '') {
print '| '.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).' | '."\n";
- }
- else {
+ } else {
print ''.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).' | '."\n";
}
@@ -655,19 +639,16 @@ if ($rowid > 0) {
print '';
if ($datefin < dol_now() && $objp->statut > 0) {
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
- }
- else {
+ } else {
print dol_print_date($datefin, 'day');
}
print ' | ';
- }
- else {
+ } else {
print '';
if ($objp->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
- }
- else {
+ } else {
print ' ';
}
print ' | ';
@@ -695,8 +676,7 @@ if ($rowid > 0) {
if ($num > $conf->liste_limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
}
- }
- else {
+ } else {
dol_print_error($db);
}
}
diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php
index 47dcacf1d6a..433c83d72be 100644
--- a/htdocs/adherents/type_ldap.php
+++ b/htdocs/adherents/type_ldap.php
@@ -70,8 +70,7 @@ if (empty($reshook)) {
if ($result >= 0) {
setEventMessages($langs->trans("MemberTypeSynchronized"), null, 'mesgs');
- }
- else {
+ } else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
}
@@ -159,19 +158,16 @@ if ($result > 0) {
if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) {
print '
| '.$langs->trans("ErrorFailedToReadLDAP").' |
';
- }
- else {
+ } else {
$result = show_ldap_content($records, 0, $records['count'], true);
}
- }
- else {
+ } else {
print '
| '.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.') |
';
}
$ldap->unbind();
$ldap->close();
-}
-else {
+} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index 1e1d06f85b8..b45c7cf76f5 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -72,8 +72,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
- }
- else {
+ } else {
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]);
@@ -82,8 +81,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
// backup into database
if ($object->setMultiLangs($user) > 0) {
$action = '';
- }
- else {
+ } else {
$action = 'add';
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -100,8 +98,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
$object->label = $_POST["libelle-".$key];
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->other = dol_htmlcleanlastbr($_POST["other-".$key]);
- }
- else {
+ } else {
$object->multilangs[$key]["label"] = $_POST["libelle-".$key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]);
@@ -110,8 +107,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
if ($object->setMultiLangs($user) > 0) {
$action = '';
- }
- else {
+ } else {
$action = 'edit';
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -126,8 +122,7 @@ if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights-
if ($object->delMultiLangs($langtodelete, $user) > 0) {
$action = '';
- }
- else {
+ } else {
$action = 'edit';
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -229,8 +224,7 @@ if ($action == 'edit') {
print '
';
print '';
-}
-elseif ($action != 'add') {
+} elseif ($action != 'add') {
if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) {
$s = picto_from_langcode($key);
diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php
index 399be5de0ee..744f8ea900e 100644
--- a/htdocs/variants/card.php
+++ b/htdocs/variants/card.php
@@ -102,8 +102,7 @@ if ($confirm == 'yes') {
header('Location: '.dol_buildpath('/variants/list.php', 2));
}
exit();
- }
- elseif ($action == 'confirm_deletevalue')
+ } elseif ($action == 'confirm_deletevalue')
{
if ($objectval->fetch($valueid) > 0) {
if ($objectval->delete() < 1) {
diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php
index 160504b518b..36b4823b51b 100644
--- a/htdocs/variants/class/ProductAttribute.class.php
+++ b/htdocs/variants/class/ProductAttribute.class.php
@@ -119,8 +119,7 @@ class ProductAttribute
$return[] = $tmp;
}
- }
- else dol_print_error($this->db);
+ } else dol_print_error($this->db);
return $return;
}
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index f29cc49f35b..3886a8fcdce 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -105,8 +105,7 @@ if ($_POST) {
if (!$features) {
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
- }
- else {
+ } else {
$reference = trim($reference);
if (empty($reference)) {
$reference = false;
@@ -165,8 +164,7 @@ if ($_POST) {
$db->rollback();
}
- }
- elseif (!empty($massaction))
+ } elseif (!empty($massaction))
{
$bulkaction = $massaction;
$error = 0;
@@ -219,8 +217,7 @@ if ($_POST) {
$db->commit();
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
}
- }
- elseif ($valueid > 0) {
+ } elseif ($valueid > 0) {
if ($prodcomb->fetch($valueid) < 0) {
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
exit();
@@ -359,8 +356,7 @@ if (!empty($id) || !empty($ref))
if ($object->weight != '')
{
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
- }
- else {
+ } else {
print ' ';
}
print "\n";
@@ -625,8 +621,7 @@ if (!empty($id) || !empty($ref))
';
- }
- else {
+ } else {
if ($action === 'delete') {
if ($prodcomb->fetch($valueid) > 0) {
$prodstatic->fetch($prodcomb->fk_product_child);
@@ -797,8 +792,7 @@ if (!empty($id) || !empty($ref))
print '';
print '';
}
- }
- else {
+ } else {
print '