add new rule

This commit is contained in:
Frédéric FRANCE 2020-05-21 09:21:30 +02:00
parent ccc859ec80
commit ba8cf2b398
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
21 changed files with 68 additions and 138 deletions

View File

@ -291,8 +291,8 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # 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 . #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 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 set +e
echo echo

View File

@ -214,6 +214,7 @@
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> --> <!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> -->
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" /> -->
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" /> <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

View File

@ -95,8 +95,7 @@ if ($action == 'update' || $action == 'add') {
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@ -166,8 +166,7 @@ abstract class ActionsAdherentCardCommon
$dolibarr_user = new User($this->db); $dolibarr_user = new User($this->db);
$result = $dolibarr_user->fetch($this->object->user_id); $result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); $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') { if ($action == 'view' || $action == 'delete') {

View File

@ -539,8 +539,7 @@ if (empty($reshook)) {
$action = 'create'; $action = 'create';
} }
} } else {
else {
$action = 'create'; $action = 'create';
} }
} }
@ -599,8 +598,7 @@ if (empty($reshook)) {
//fallback on the old configuration. //fallback on the old configuration.
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
$error++; $error++;
} } else {
else {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
@ -669,8 +667,7 @@ if (empty($reshook)) {
//fallback on the old configuration. //fallback on the old configuration.
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors'); setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
$error++; $error++;
} } else {
else {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
@ -1215,8 +1212,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td colspan="2" class="valeur">'; print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td colspan="2" class="valeur">';
if ($object->user_id) { if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
} } else print $langs->trans("NoDolibarrAccess");
else print $langs->trans("NoDolibarrAccess");
print '</td></tr>'; print '</td></tr>';
// Other attributes. Fields from hook formObjectOptions and Extrafields. // Other attributes. Fields from hook formObjectOptions and Extrafields.
@ -1502,8 +1498,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} else { } else {
if ($object->need_subscription == 0) { if ($object->need_subscription == 0) {
print $langs->trans("SubscriptionNotNeeded"); print $langs->trans("SubscriptionNotNeeded");
} } elseif (!$adht->subscription) {
elseif (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded"); print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
} else { } else {

View File

@ -192,8 +192,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
} }
if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
} } elseif ($mode == 'label') {
elseif ($mode == 'label') {
if (!count($arrayofmembers)) { if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound"); $mesg = $langs->trans("ErrorRecordNotFound");
} }

View File

@ -190,8 +190,7 @@ class AdherentType extends CommonObject
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
return -1; return -1;
} }
} } elseif (isset($this->multilangs[$key])) {
elseif (isset($this->multilangs[$key])) {
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id; $sql .= " WHERE fk_type=".$this->id;
@ -550,8 +549,7 @@ class AdherentType extends CommonObject
$memberstatic->fetch($obj->rowid); $memberstatic->fetch($obj->rowid);
} }
$ret[$obj->rowid] = $memberstatic; $ret[$obj->rowid] = $memberstatic;
} } else $ret[$obj->rowid] = $obj->rowid;
else $ret[$obj->rowid] = $obj->rowid;
} }
} }
@ -575,9 +573,7 @@ class AdherentType extends CommonObject
public function getmorphylib($morphy = '') public function getmorphylib($morphy = '')
{ {
global $langs; global $langs;
if ($morphy == 'phy') { return $langs->trans("Physical"); } if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } else return $langs->trans("MorPhy");
elseif ($morphy == 'mor') { return $langs->trans("Moral"); }
else return $langs->trans("MorPhy");
//return $morphy; //return $morphy;
} }

View File

@ -149,8 +149,7 @@ class Members extends DolibarrApi
} }
$i++; $i++;
} }
} } else {
else {
throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror());
} }
if (!count($obj_ret)) { if (!count($obj_ret)) {

View File

@ -132,8 +132,7 @@ class MembersTypes extends DolibarrApi
} }
$i++; $i++;
} }
} } else {
else {
throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror());
} }
if (!count($obj_ret)) { if (!count($obj_ret)) {

View File

@ -129,8 +129,7 @@ class Subscriptions extends DolibarrApi
} }
$i++; $i++;
} }
} } else {
else {
throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror()); throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror());
} }
if (!count($obj_ret)) { if (!count($obj_ret)) {

View File

@ -67,8 +67,7 @@ if ($action == 'dolibarr2ldap') {
if ($result >= 0) { if ($result >= 0) {
setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs'); setEventMessages($langs->trans("MemberSynchronized"), null, 'mesgs');
} } else {
else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }
} }

View File

@ -344,8 +344,7 @@ if (GETPOSTISSET("statut")) {
if ($statut == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); } if ($statut == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); } if ($statut == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); } if ($statut == '0') { $titre = $langs->trans("MembersListResiliated"); }
} } elseif ($action == 'search') {
elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified"); $titre = $langs->trans("MembersListQualified");
} }

View File

@ -207,8 +207,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Show graphs // Show graphs
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">'; print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
if ($mesg) { print $mesg; } if ($mesg) { print $mesg; } else {
else {
print $px1->show(); print $px1->show();
print "<br>\n"; print "<br>\n";
print $px2->show(); print $px2->show();

View File

@ -121,12 +121,10 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) { if ($result < 0) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($company->error, $company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} } else {
else {
$action = 'addsubscription'; $action = 'addsubscription';
} }
} } else {
else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -246,15 +244,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
setEventMessages($errmsg, null, 'errors'); setEventMessages($errmsg, null, 'errors');
$error++; $error++;
$action = 'addsubscription'; $action = 'addsubscription';
} } else {
else {
if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') { if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') {
if ($_POST["subscription"]) { if ($_POST["subscription"]) {
if (!$_POST["label"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); 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["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode"));
if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount")); if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount"));
} } else {
else {
if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
} }
if ($errmsg) { if ($errmsg) {
@ -284,16 +280,14 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) { if ($result < 0) {
$error++; $error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} } else {
else {
// If an invoice was created, it is into $object->invoice // If an invoice was created, it is into $object->invoice
} }
} }
if (!$error) { if (!$error) {
$db->commit(); $db->commit();
} } else {
else {
$db->rollback(); $db->rollback();
$action = 'addsubscription'; $action = 'addsubscription';
} }
@ -355,12 +349,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) { if ($result < 0) {
$errmsg = $object->error; $errmsg = $object->error;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} } else {
else {
setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs'); setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs');
} }
} } else {
else {
setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs'); setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs');
} }
} }
@ -491,13 +483,11 @@ if ($rowid > 0) {
if ($object->hasDelay()) { if ($object->hasDelay()) {
print " ".img_warning($langs->trans("Late")); print " ".img_warning($langs->trans("Late"));
} }
} } else {
else {
if (!$adht->subscription) { if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded"); 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 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"); 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 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 '</td>'; print '</td>';
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
} } else {
else {
if ($object->fk_soc) { if ($object->fk_soc) {
$company = new Societe($db); $company = new Societe($db);
$result = $company->fetch($object->fk_soc); $result = $company->fetch($object->fk_soc);
print $company->getNomUrl(1); print $company->getNomUrl(1);
} } else {
else {
print $langs->trans("NoThirdPartyAssociatedToMember"); print $langs->trans("NoThirdPartyAssociatedToMember");
} }
} }
@ -555,12 +543,10 @@ if ($rowid > 0) {
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editlogin') { if ($action == 'editlogin') {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', '');
} } else {
else {
if ($object->user_id) { if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
} } else print $langs->trans("NoDolibarrAccess");
else print $langs->trans("NoDolibarrAccess");
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -123,8 +123,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if (empty($object->label)) { if (empty($object->label)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); 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)."'"; $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
@ -142,13 +141,11 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
if ($id > 0) { if ($id > 0) {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'create'; $action = 'create';
} }
} } else {
else {
$action = 'create'; $action = 'create';
} }
} }
@ -176,8 +173,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
if ($ret >= 0 && !count($object->errors)) { if ($ret >= 0 && !count($object->errors)) {
setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
} } else {
else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -193,8 +189,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer) {
setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeDeleted"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors'); setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
$action = ''; $action = '';
} }
@ -277,9 +272,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</td>'; print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>'; print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">'; print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorPhy");
elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); }
else print $langs->trans("MorPhy");
print '</td>'; print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>'; print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>'; print '<td class="center">'.yn($objp->vote).'</td>';
@ -296,8 +289,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@ -424,8 +416,7 @@ if ($rowid > 0) {
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;'; print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.'&nbsp;';
if ($object->duration_value > 1) { 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")); $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")); $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]) : '')."&nbsp;"; print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')."&nbsp;";
@ -535,14 +526,8 @@ if ($rowid > 0) {
$titre = $langs->trans("MembersList"); $titre = $langs->trans("MembersList");
if ($status != '') { if ($status != '') {
if ($status == '-1,1') { $titre = $langs->trans("MembersListQualified"); } 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 ($status == '-1') { $titre = $langs->trans("MembersListToValid"); } } elseif ($action == 'search') {
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"); $titre = $langs->trans("MembersListQualified");
} }
@ -623,8 +608,7 @@ if ($rowid > 0) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if ($objp->company != '') { if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} } else {
else {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
} }
@ -655,19 +639,16 @@ if ($rowid > 0) {
print '<td class="nowrap center">'; print '<td class="nowrap center">';
if ($datefin < dol_now() && $objp->statut > 0) { if ($datefin < dol_now() && $objp->statut > 0) {
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
} } else {
else {
print dol_print_date($datefin, 'day'); print dol_print_date($datefin, 'day');
} }
print '</td>'; print '</td>';
} } else {
else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') { if ($objp->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();
} } else {
else {
print '&nbsp;'; print '&nbsp;';
} }
print '</td>'; print '</td>';
@ -695,8 +676,7 @@ if ($rowid > 0) {
if ($num > $conf->liste_limit) { if ($num > $conf->liste_limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -70,8 +70,7 @@ if (empty($reshook)) {
if ($result >= 0) { if ($result >= 0) {
setEventMessages($langs->trans("MemberTypeSynchronized"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeSynchronized"), null, 'mesgs');
} } else {
else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); 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_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0)) {
if (!is_array($records)) { if (!is_array($records)) {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} } else {
else {
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);
} }
} } else {
else {
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close(); $ldap->close();
} } else {
else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@ -72,8 +72,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$object->label = $_POST["libelle"]; $object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]); $object->other = dol_htmlcleanlastbr($_POST["other"]);
} } else {
else {
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); $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 // backup into database
if ($object->setMultiLangs($user) > 0) { if ($object->setMultiLangs($user) > 0) {
$action = ''; $action = '';
} } else {
else {
$action = 'add'; $action = 'add';
setEventMessages($object->error, $object->errors, 'errors'); 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->label = $_POST["libelle-".$key];
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->other = dol_htmlcleanlastbr($_POST["other-".$key]); $object->other = dol_htmlcleanlastbr($_POST["other-".$key]);
} } else {
else {
$object->multilangs[$key]["label"] = $_POST["libelle-".$key]; $object->multilangs[$key]["label"] = $_POST["libelle-".$key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$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) { if ($object->setMultiLangs($user) > 0) {
$action = ''; $action = '';
} } else {
else {
$action = 'edit'; $action = 'edit';
setEventMessages($object->error, $object->errors, 'errors'); 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) { if ($object->delMultiLangs($langtodelete, $user) > 0) {
$action = ''; $action = '';
} } else {
else {
$action = 'edit'; $action = 'edit';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -229,8 +224,7 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } elseif ($action != 'add') {
elseif ($action != 'add') {
if (!empty($object->multilangs)) { if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) { foreach ($object->multilangs as $key => $value) {
$s = picto_from_langcode($key); $s = picto_from_langcode($key);

View File

@ -102,8 +102,7 @@ if ($confirm == 'yes') {
header('Location: '.dol_buildpath('/variants/list.php', 2)); header('Location: '.dol_buildpath('/variants/list.php', 2));
} }
exit(); exit();
} } elseif ($action == 'confirm_deletevalue')
elseif ($action == 'confirm_deletevalue')
{ {
if ($objectval->fetch($valueid) > 0) { if ($objectval->fetch($valueid) > 0) {
if ($objectval->delete() < 1) { if ($objectval->delete() < 1) {

View File

@ -119,8 +119,7 @@ class ProductAttribute
$return[] = $tmp; $return[] = $tmp;
} }
} } else dol_print_error($this->db);
else dol_print_error($this->db);
return $return; return $return;
} }

View File

@ -105,8 +105,7 @@ if ($_POST) {
if (!$features) { if (!$features) {
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
} } else {
else {
$reference = trim($reference); $reference = trim($reference);
if (empty($reference)) { if (empty($reference)) {
$reference = false; $reference = false;
@ -165,8 +164,7 @@ if ($_POST) {
$db->rollback(); $db->rollback();
} }
} } elseif (!empty($massaction))
elseif (!empty($massaction))
{ {
$bulkaction = $massaction; $bulkaction = $massaction;
$error = 0; $error = 0;
@ -219,8 +217,7 @@ if ($_POST) {
$db->commit(); $db->commit();
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
} } elseif ($valueid > 0) {
elseif ($valueid > 0) {
if ($prodcomb->fetch($valueid) < 0) { if ($prodcomb->fetch($valueid) < 0) {
dol_print_error($db, $langs->trans('ErrorRecordNotFound')); dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
exit(); exit();
@ -359,8 +356,7 @@ if (!empty($id) || !empty($ref))
if ($object->weight != '') if ($object->weight != '')
{ {
print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units);
} } else {
else {
print '&nbsp;'; print '&nbsp;';
} }
print "</td></tr>\n"; print "</td></tr>\n";
@ -625,8 +621,7 @@ if (!empty($id) || !empty($ref))
<?php <?php
print '</form>'; print '</form>';
} } else {
else {
if ($action === 'delete') { if ($action === 'delete') {
if ($prodcomb->fetch($valueid) > 0) { if ($prodcomb->fetch($valueid) > 0) {
$prodstatic->fetch($prodcomb->fk_product_child); $prodstatic->fetch($prodcomb->fk_product_child);
@ -797,8 +792,7 @@ if (!empty($id) || !empty($ref))
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} } else {
else {
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -42,8 +42,7 @@ if ($_POST) {
if ($backtopage) if ($backtopage)
{ {
header('Location: '.$backtopage); header('Location: '.$backtopage);
} } else {
else {
header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$resid.'&backtopage='.urlencode($backtopage)); header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$resid.'&backtopage='.urlencode($backtopage));
} }
exit; exit;