diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php
index 4da5ffaad58..7d781fe5b0c 100755
--- a/dev/initdemo/sftpget_and_loaddump.php
+++ b/dev/initdemo/sftpget_and_loaddump.php
@@ -41,14 +41,30 @@ $passwordbase=isset($argv[6])?$argv[6]:'';
// Include Dolibarr environment
$res=0;
-if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php";
-if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php";
-if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
-if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
-if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
-if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res) die("Failed to include master.inc.php file\n");
+if (! $res && file_exists($path."../../master.inc.php")) {
+ $res=@include $path."../../master.inc.php";
+}
+if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
+ $res=@include $path."../../htdocs/master.inc.php";
+}
+if (! $res && file_exists("../master.inc.php")) {
+ $res=@include "../master.inc.php";
+}
+if (! $res && file_exists("../../master.inc.php")) {
+ $res=@include "../../master.inc.php";
+}
+if (! $res && file_exists("../../../master.inc.php")) {
+ $res=@include "../../../master.inc.php";
+}
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
+ $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+}
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
+ $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+}
+if (! $res) {
+ die("Failed to include master.inc.php file\n");
+}
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -58,15 +74,13 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$login='';
$server='';
-if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg))
-{
+if (preg_match('/^(.*)@(.*):(.*)$/', $sourceserver, $reg)) {
$login=$reg[1];
$server=$reg[2];
$sourcefile=$reg[3];
$targetfile=basename($sourcefile);
}
-if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase))
-{
+if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile) || empty($password) || empty($database) || empty($loginbase) || empty($passwordbase)) {
print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n";
print "Return code: 0 if success, <>0 if error\n";
print "Warning, this script may take a long time.\n";
@@ -88,14 +102,11 @@ if (! function_exists("ssh2_connect")) {
}
$connection = ssh2_connect($server, 22);
-if ($connection)
-{
- if (! @ssh2_auth_password($connection, $login, $password))
- {
+if ($connection) {
+ if (! @ssh2_auth_password($connection, $login, $password)) {
dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR);
exit(-5);
- }
- else {
+ } else {
//$stream = ssh2_exec($connection, '/usr/bin/php -i');
/*
print "Generate dump ".$filesys1.'.bz2'."\n";
@@ -111,12 +122,10 @@ if ($connection)
ssh2_scp_recv($connection, $sourcefile, $targetdir.$targetfile);
$fullcommand="cat ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
- if (preg_match('/\.bz2$/', $targetfile))
- {
+ if (preg_match('/\.bz2$/', $targetfile)) {
$fullcommand="bzip2 -c -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
- if (preg_match('/\.gz$/', $targetfile))
- {
+ if (preg_match('/\.gz$/', $targetfile)) {
$fullcommand="gzip -d ".$targetdir.$targetfile." | mysql -h".$databaseserver." -u".$loginbase." -p".$passwordbase." -D ".$database;
}
print "Load dump with ".$fullcommand."\n";
@@ -124,13 +133,14 @@ if ($connection)
$return_var=0;
print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n";
exec($fullcommand, $output, $return_var);
- foreach ($output as $line) print $line."\n";
+ foreach ($output as $line) {
+ print $line."\n";
+ }
//ssh2_sftp_unlink($sftp, $fileinstalllock);
//print $output;
}
-}
-else {
+} else {
print 'Failed to connect to ssh2 to '.$server;
exit(-6);
}
diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php
index 5da0d4a2498..d798d3f5fdc 100755
--- a/dev/initdemo/updatedemo.php
+++ b/dev/initdemo/updatedemo.php
@@ -36,14 +36,30 @@ $confirm=isset($argv[1])?$argv[1]:'';
// Include Dolibarr environment
$res=0;
-if (! $res && file_exists($path."../../master.inc.php")) $res=@include $path."../../master.inc.php";
-if (! $res && file_exists($path."../../htdocs/master.inc.php")) $res=@include $path."../../htdocs/master.inc.php";
-if (! $res && file_exists("../master.inc.php")) $res=@include "../master.inc.php";
-if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.inc.php";
-if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php";
-if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
-if (! $res) die("Failed to include master.inc.php file\n");
+if (! $res && file_exists($path."../../master.inc.php")) {
+ $res=@include $path."../../master.inc.php";
+}
+if (! $res && file_exists($path."../../htdocs/master.inc.php")) {
+ $res=@include $path."../../htdocs/master.inc.php";
+}
+if (! $res && file_exists("../master.inc.php")) {
+ $res=@include "../master.inc.php";
+}
+if (! $res && file_exists("../../master.inc.php")) {
+ $res=@include "../../master.inc.php";
+}
+if (! $res && file_exists("../../../master.inc.php")) {
+ $res=@include "../../../master.inc.php";
+}
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
+ $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+}
+if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) {
+ $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only
+}
+if (! $res) {
+ die("Failed to include master.inc.php file\n");
+}
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -53,8 +69,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
print "***** ".$script_file." *****\n";
print "Update dates to current year for database name = ".$db->database_name."\n";
-if (empty($confirm))
-{
+if (empty($confirm)) {
print "Usage: $script_file confirm\n";
print "Return code: 0 if success, <>0 if error\n";
exit(-1);
@@ -65,66 +80,64 @@ $tmp=dol_getdate(dol_now());
$tables=array(
- 'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'),
- 'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'),
+ 'propal'=>array(0=>'datep', 1=>'fin_validite', 2=>'date_valid', 3=>'date_cloture'),
+ 'commande'=>array(0=>'date_commande', 1=>'date_valid', 2=>'date_cloture'),
'facture'=>array(0=>'datec', 0=>'datef', 1=>'date_valid', 2=>'date_lim_reglement'),
- 'paiement'=>array(0=>'datep'),
- 'bank'=>array(0=>'datev', 1=>'dateo'),
- 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
- 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
+ 'paiement'=>array(0=>'datep'),
+ 'bank'=>array(0=>'datev', 1=>'dateo'),
+ 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'),
+ 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'),
'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'),
'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel')
);
$year=2010;
$currentyear=$tmp['year'];
-while ($year <= $currentyear)
-{
- //$year=2021;
- $delta1=($currentyear - $year);
- $delta2=($currentyear - $year - 1);
- //$delta=-1;
+while ($year <= $currentyear) {
+ //$year=2021;
+ $delta1=($currentyear - $year);
+ $delta2=($currentyear - $year - 1);
+ //$delta=-1;
- if ($delta1)
- {
- foreach ($tables as $tablekey => $tableval)
- {
- print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
- $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
- //$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i=0;
- while ($i < $num)
- {
- $obj=$db->fetch_object($resql);
- if ($obj)
- {
- print ".";
- $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
- $j=0;
- foreach ($tableval as $field)
- {
- if ($j) $sql2.=", ";
- $sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
- $j++;
- }
- $sql2.=" WHERE rowid = ".$obj->rowid;
- //print $sql2."\n";
- $resql2 = $db->query($sql2);
- if (! $resql2) dol_print_error($db);
- }
- $i++;
- }
- }
- else dol_print_error($db);
- print "\n";
- }
- }
+ if ($delta1) {
+ foreach ($tables as $tablekey => $tableval) {
+ print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." ";
+ $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)";
+ //$sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." > NOW()";
+ $resql = $db->query($sql);
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $i=0;
+ while ($i < $num) {
+ $obj=$db->fetch_object($resql);
+ if ($obj) {
+ print ".";
+ $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set ";
+ $j=0;
+ foreach ($tableval as $field) {
+ if ($j) {
+ $sql2.=", ";
+ }
+ $sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)");
+ $j++;
+ }
+ $sql2.=" WHERE rowid = ".$obj->rowid;
+ //print $sql2."\n";
+ $resql2 = $db->query($sql2);
+ if (! $resql2) {
+ dol_print_error($db);
+ }
+ }
+ $i++;
+ }
+ } else {
+ dol_print_error($db);
+ }
+ print "\n";
+ }
+ }
- $year++;
+ $year++;
}
print "\n";
diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index db4945a654c..278260ff06b 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -174,8 +174,8 @@
-
-
+
+
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 4467844b04e..ac8c3db644b 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -542,17 +542,17 @@ class AccountancyExport
// Credit invoice - invert sens
/*
- if ($data->montant < 0) {
- if ($data->sens == 'C') {
- $Tab['sens'] = 'D';
- } else {
- $Tab['sens'] = 'C';
- }
- $Tab['signe_montant'] = '-';
- } else {
- $Tab['sens'] = $data->sens; // C or D
- $Tab['signe_montant'] = '+';
- }*/
+ if ($data->montant < 0) {
+ if ($data->sens == 'C') {
+ $Tab['sens'] = 'D';
+ } else {
+ $Tab['sens'] = 'C';
+ }
+ $Tab['signe_montant'] = '-';
+ } else {
+ $Tab['sens'] = $data->sens; // C or D
+ $Tab['signe_montant'] = '+';
+ }*/
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
@@ -856,8 +856,8 @@ class AccountancyExport
foreach ($objectLines as $line) {
if ($line->debit == 0 && $line->credit == 0) {
- //unset($array[$line]);
- } else {
+ //unset($array[$line]);
+ } else {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php
index fef3bd53177..adcf7d49311 100644
--- a/htdocs/adherents/admin/adherent.php
+++ b/htdocs/adherents/admin/adherent.php
@@ -37,7 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "members"));
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
$choices = array('yesno', 'texte', 'chaine');
@@ -126,17 +128,24 @@ if ($action == 'update' || $action == 'add') {
$constname = GETPOST('constname', 'alpha');
$constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
- if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = '';
+ if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) {
+ $constvalue = '';
+ }
if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') { // Invert choice
- if ($constvalue) $constvalue = 0;
- else $constvalue = 1;
+ if ($constvalue) {
+ $constvalue = 0;
+ } else {
+ $constvalue = 1;
+ }
}
$consttype = GETPOST('consttype', 'alpha');
$constnote = GETPOST('constnote');
$res = dolibarr_set_const($db, $constname, $constvalue, $choices[$consttype], 0, $constnote, $conf->entity);
- if (!($res > 0)) $error++;
+ if (!($res > 0)) {
+ $error++;
+ }
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
@@ -211,9 +220,15 @@ print "\n";
// Insert subscription into bank account
print '
'.$langs->trans("MoreActionsOnSubscription").' ';
$arraychoices = array('0'=>$langs->trans("None"));
-if (!empty($conf->banque->enabled)) $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
-if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
-if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
+if (!empty($conf->banque->enabled)) {
+ $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
+}
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+ $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
+}
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
+ $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
+}
print '';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
@@ -349,7 +364,9 @@ foreach ($dirmodels as $reldir) {
$module = new $classname($db);
$modulequalified = 1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+ $modulequalified = 0;
+ }
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
@@ -404,8 +421,7 @@ foreach ($dirmodels as $reldir) {
// Preview
print ' ';
- if ($module->type == 'pdf')
- {
+ if ($module->type == 'pdf') {
print ''.img_object($langs->trans("Preview"), 'contract').' ';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php
index 21ce5037ef5..e1867285930 100644
--- a/htdocs/adherents/admin/adherent_emails.php
+++ b/htdocs/adherents/admin/adherent_emails.php
@@ -36,7 +36,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "members"));
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
$oldtypetonewone = array('texte'=>'text', 'chaine'=>'string'); // old type to new ones
@@ -92,7 +94,9 @@ if ($action == 'update' || $action == 'add') {
$res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
- if (!($res > 0)) $error++;
+ if (!($res > 0)) {
+ $error++;
+ }
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php
index a391770fdd5..0465b7eee4f 100644
--- a/htdocs/adherents/admin/adherent_extrafields.php
+++ b/htdocs/adherents/admin/adherent_extrafields.php
@@ -37,13 +37,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
+foreach ($tmptype2label as $key => $val) {
+ $type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent'; //Must be the $table_element of the class that manage extrafield
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
/*
diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php
index 92b5ed990e3..c33ee5a4739 100644
--- a/htdocs/adherents/admin/adherent_type_extrafields.php
+++ b/htdocs/adherents/admin/adherent_type_extrafields.php
@@ -40,13 +40,17 @@ $form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
+foreach ($tmptype2label as $key => $val) {
+ $type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'adherent_type'; //Must be the $table_element of the class that manage extrafield
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
/*
diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php
index 56d6ec996e4..d13b4a27c43 100644
--- a/htdocs/adherents/admin/website.php
+++ b/htdocs/adherents/admin/website.php
@@ -35,7 +35,9 @@ $langs->loadLangs(array("admin", "members"));
$action = GETPOST('action', 'aZ09');
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
/*
@@ -43,8 +45,11 @@ if (!$user->admin) accessforbidden();
*/
if ($action == 'setMEMBER_ENABLE_PUBLIC') {
- if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
- else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
+ if (GETPOST('value')) {
+ dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
+ } else {
+ dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
+ }
}
if ($action == 'update') {
@@ -58,14 +63,17 @@ if ($action == 'update') {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT", $amount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity);
- if ($forcetype < 0) $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
- else {
+ if ($forcetype < 0) {
+ $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity);
+ } else {
$res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity);
}
- if (!($res > 0)) $error++;
+ if (!($res > 0)) {
+ $error++;
+ }
- if (!$error) {
+ if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
@@ -195,9 +203,15 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
$listofval = array();
$listofval['-1'] = $langs->trans('No');
$listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
- if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox';
- if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal';
- if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe';
+ if (!empty($conf->paybox->enabled)) {
+ $listofval['paybox'] = 'Paybox';
+ }
+ if (!empty($conf->paypal->enabled)) {
+ $listofval['paypal'] = 'PayPal';
+ }
+ if (!empty($conf->stripe->enabled)) {
+ $listofval['stripe'] = 'Stripe';
+ }
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
print " \n";
diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php
index 2e74fdde9be..edb2e9ba4dc 100644
--- a/htdocs/adherents/agenda.php
+++ b/htdocs/adherents/agenda.php
@@ -42,16 +42,24 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) {
+ $page = 0;
+} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortfield) $sortfield = 'a.datep,a.id';
-if (!$sortorder) $sortorder = 'DESC';
+if (!$sortfield) {
+ $sortfield = 'a.datep,a.id';
+}
+if (!$sortorder) {
+ $sortorder = 'DESC';
+}
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
- if (!count($actioncode)) $actioncode = '0';
+ if (!count($actioncode)) {
+ $actioncode = '0';
+ }
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
@@ -76,7 +84,9 @@ if ($result > 0) {
$parameters = array('id'=>$id, 'objcanvas'=>$objcanvas);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
if (empty($reshook)) {
// Cancel
@@ -115,7 +125,9 @@ if ($object->id > 0) {
$helpurl = "EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
llxHeader("", $title, $helpurl);
- if (!empty($conf->notification->enabled)) $langs->load("mails");
+ if (!empty($conf->notification->enabled)) {
+ $langs->load("mails");
+ }
$head = member_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
@@ -149,8 +161,12 @@ if ($object->id > 0) {
print ' ';
$param = '&id='.$id;
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.$contextpage;
+ }
+ if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.$limit;
+ }
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 46c4b07b57c..970609fce65 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -64,13 +64,15 @@ abstract class ActionsAdherentCardCommon
//$ret = $this->getInstanceDao();
/*if (is_object($this->object) && method_exists($this->object,'fetch'))
- {
- if (! empty($id)) $this->object->fetch($id);
- }
- else
- {*/
+ {
+ if (! empty($id)) $this->object->fetch($id);
+ }
+ else
+ {*/
$object = new Adherent($this->db);
- if (!empty($id)) $object->fetch($id);
+ if (!empty($id)) {
+ $object->fetch($id);
+ }
$this->object = $object;
//}
}
@@ -89,7 +91,9 @@ abstract class ActionsAdherentCardCommon
global $conf, $langs, $user, $canvas;
global $form, $formcompany, $objsoc;
- if ($action == 'add' || $action == 'update') $this->assign_post();
+ if ($action == 'add' || $action == 'update') {
+ $this->assign_post();
+ }
foreach ($this->object as $key => $value) {
$this->tpl[$key] = $value;
@@ -123,12 +127,24 @@ abstract class ActionsAdherentCardCommon
// Predefined with third party
if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) {
- if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address;
- if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip;
- if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town;
- if (dol_strlen(trim($this->object->phone_perso)) == 0) $this->object->phone_perso = $objsoc->phone;
- if (dol_strlen(trim($this->object->phone_mobile)) == 0) $this->object->phone_mobile = $objsoc->phone_mobile;
- if (dol_strlen(trim($this->object->email)) == 0) $this->object->email = $objsoc->email;
+ if (dol_strlen(trim($this->object->address)) == 0) {
+ $this->tpl['address'] = $objsoc->address;
+ }
+ if (dol_strlen(trim($this->object->zip)) == 0) {
+ $this->object->zip = $objsoc->zip;
+ }
+ if (dol_strlen(trim($this->object->town)) == 0) {
+ $this->object->town = $objsoc->town;
+ }
+ if (dol_strlen(trim($this->object->phone_perso)) == 0) {
+ $this->object->phone_perso = $objsoc->phone;
+ }
+ if (dol_strlen(trim($this->object->phone_mobile)) == 0) {
+ $this->object->phone_mobile = $objsoc->phone_mobile;
+ }
+ if (dol_strlen(trim($this->object->email)) == 0) {
+ $this->object->email = $objsoc->email;
+ }
}
// Zip
@@ -137,17 +153,24 @@ abstract class ActionsAdherentCardCommon
// Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
- if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
+ if (dol_strlen(trim($this->object->country_id)) == 0) {
+ $this->object->country_id = $objsoc->country_id;
+ }
// Country
$this->tpl['select_country'] = $form->select_country($this->object->country_id, 'country_id');
$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
- if ($user->admin) $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ if ($user->admin) {
+ $this->tpl['info_admin'] = info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
// State
- if ($this->object->country_id) $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
- else $this->tpl['select_state'] = $countrynotdefined;
+ if ($this->object->country_id) {
+ $this->tpl['select_state'] = $formcompany->select_state($this->object->state_id, $this->object->country_code);
+ } else {
+ $this->tpl['select_state'] = $countrynotdefined;
+ }
// Physical or Moral
$selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
@@ -166,7 +189,9 @@ 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') {
@@ -205,7 +230,7 @@ abstract class ActionsAdherentCardCommon
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = dol_buildlogin($this->object->lastname, $this->object->firstname);
- $generated_password = getRandomPassword(false);
+ $generated_password = getRandomPassword(false);
$password = $generated_password;
// Create a form array
diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
index 43d6622f8c9..c79143ab345 100644
--- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
+++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
@@ -60,9 +60,15 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$out = '';
- if ($action == 'view') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
- if ($action == 'edit') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
- if ($action == 'create') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
+ if ($action == 'view') {
+ $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
+ }
+ if ($action == 'edit') {
+ $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
+ }
+ if ($action == 'create') {
+ $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
+ }
return $out;
}
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
index 539e174681f..16e9dc1886a 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
@@ -29,8 +29,12 @@ echo "\n";
echo $this->control->tpl['showhead'];
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
-if (!empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
-if (!empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
+if (!empty($this->control->tpl['action_create_user'])) {
+ echo $this->control->tpl['action_create_user'];
+}
+if (!empty($this->control->tpl['action_delete'])) {
+ echo $this->control->tpl['action_delete'];
+} ?>
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 8f2ea3f0706..d2987734f8c 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -118,7 +118,9 @@ if ($id) {
$parameters = array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
if (empty($reshook)) {
if ($cancel) {
@@ -141,7 +143,9 @@ if (empty($reshook)) {
if (!$error) {
if ($userid != $object->user_id) { // If link differs from currently in database
$result = $object->setUserId($userid);
- if ($result < 0) dol_print_error($object->db, $object->error);
+ if ($result < 0) {
+ dol_print_error($object->db, $object->error);
+ }
$action = '';
}
}
@@ -169,7 +173,9 @@ if (empty($reshook)) {
if (!$error) {
$result = $object->setThirdPartyId($socid);
- if ($result < 0) dol_print_error($object->db, $object->error);
+ if ($result < 0) {
+ dol_print_error($object->db, $object->error);
+ }
$action = '';
}
}
@@ -221,8 +227,7 @@ if (empty($reshook)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$birthdate = '';
- if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int'))
- {
+ if (GETPOST("birthday", 'int') && GETPOST("birthmonth", 'int') && GETPOST("birthyear", 'int')) {
$birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
}
$lastname = GETPOST("lastname", 'alphanohtml');
@@ -294,8 +299,11 @@ if (empty($reshook)) {
//$object->note = trim(GETPOST("comment","alpha"));
$object->morphy = GETPOST("morphy", 'alpha');
- if (GETPOST('deletephoto', 'alpha')) $object->photo = '';
- elseif (!empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
+ if (GETPOST('deletephoto', 'alpha')) {
+ $object->photo = '';
+ } elseif (!empty($_FILES['photo']['name'])) {
+ $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
+ }
// Get status and public property
$object->statut = GETPOST("statut", 'alpha');
@@ -303,18 +311,24 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
- if ($ret < 0) $error++;
+ if ($ret < 0) {
+ $error++;
+ }
// Check if we need to also synchronize user information
$nosyncuser = 0;
if ($object->user_id) { // If linked to a user
- if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser = 1; // Disable synchronizing
+ if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) {
+ $nosyncuser = 1; // Disable synchronizing
+ }
}
// Check if we need to also synchronize password information
$nosyncuserpass = 0;
if ($object->user_id) { // If linked to a user
- if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing
+ if ($user->id != $object->user_id && empty($user->rights->user->user->password)) {
+ $nosyncuserpass = 1; // Disable synchronizing
+ }
}
$result = $object->update($user, 0, $nosyncuser, $nosyncuserpass);
@@ -380,7 +394,9 @@ if (empty($reshook)) {
}
if ($action == 'add' && $user->rights->adherent->creer) {
- if ($canvas) $object->canvas = $canvas;
+ if ($canvas) {
+ $object->canvas = $canvas;
+ }
$birthdate = '';
if (GETPOSTISSET("birthday") && GETPOST("birthday") && GETPOSTISSET("birthmonth") && GETPOST("birthmonth") && GETPOSTISSET("birthyear") && GETPOST("birthyear")) {
$birthdate = dol_mktime(12, 0, 0, GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
@@ -461,7 +477,9 @@ if (empty($reshook)) {
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
- if ($ret < 0) $error++;
+ if ($ret < 0) {
+ $error++;
+ }
// Check parameters
if (empty($morphy) || $morphy == "-1") {
@@ -515,7 +533,9 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
}
$public = 0;
- if (isset($public)) $public = 1;
+ if (isset($public)) {
+ $public = 1;
+ }
if (!$error) {
$db->begin();
@@ -590,7 +610,9 @@ if (empty($reshook)) {
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
- if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ }
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
@@ -659,7 +681,9 @@ if (empty($reshook)) {
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
- if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ }
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
@@ -757,9 +781,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($object->error) && $id) {
$object = new Adherent($db);
$result = $object->fetch($id);
- if ($result <= 0) dol_print_error('', $object->error);
+ if ($result <= 0) {
+ dol_print_error('', $object->error);
+ }
}
- $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
+ $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template
} else {
// -----------------------------------------
@@ -785,7 +811,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($socid)) {
$object = new Societe($db);
- if ($socid > 0) $object->fetch($socid);
+ if ($socid > 0) {
+ $object->fetch($socid);
+ }
if (!($object->id > 0)) {
$langs->load("errors");
@@ -832,7 +860,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
print ' ';
print ' ';
- if ($backtopage) print ' ';
+ if ($backtopage) {
+ print ' ';
+ }
print dol_get_fiche_head('');
@@ -913,7 +943,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
print ''.$langs->trans('Country').' ';
print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'alpha') : $object->country_id, 'country_id');
- if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ if ($user->admin) {
+ print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
print ' ';
// State
@@ -941,7 +973,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
- if (!$value['active']) break;
+ if (!$value['active']) {
+ break;
+ }
print ''.$langs->trans($value['label']).' ';
}
}
@@ -1057,7 +1091,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
print ' ';
print ' ';
- if ($backtopage) print ' ';
+ if ($backtopage) {
+ print ' ';
+ }
print dol_get_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
@@ -1121,9 +1157,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '';
print $form->showphoto('memberphoto', $object)."\n";
if ($caneditfieldmember) {
- if ($object->photo) print " \n";
+ if ($object->photo) {
+ print " \n";
+ }
print '';
@@ -1150,7 +1190,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined
print ' '.$langs->trans('Country').' ';
print $form->select_country(GETPOSTISSET("country_id") ? GETPOST("country_id", "alpha") : $object->country_id, 'country_id');
- if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ if ($user->admin) {
+ print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
print ' ';
// State
@@ -1174,7 +1216,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
- if (!$value['active']) break;
+ if (!$value['active']) {
+ break;
+ }
print ''.$langs->trans($value['label']).' ';
}
}
@@ -1223,7 +1267,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ''.$langs->trans("LinkedToDolibarrUser").' ';
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 ' ';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
@@ -1279,7 +1325,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$login = dol_buildlogin($object->lastname, $object->firstname);
}
- if (empty($login)) $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
+ if (empty($login)) {
+ $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4));
+ }
// Create a form array
$formquestion = array(
@@ -1304,10 +1352,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($object->morphy == 'mor') {
$companyname = $object->company;
- if (!empty($fullname)) $companyalias = $fullname;
+ if (!empty($fullname)) {
+ $companyalias = $fullname;
+ }
} else {
$companyname = $fullname;
- if (!empty($object->company)) $companyalias = $object->company;
+ if (!empty($object->company)) {
+ $companyalias = $object->company;
+ }
}
// Create a form array
@@ -1341,7 +1393,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
- if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ }
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
@@ -1368,7 +1422,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create form popup
$formquestion = array();
- if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
+ if ($object->email) {
+ $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false));
+ }
if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
$formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>'');
}
@@ -1400,7 +1456,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
- if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ }
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
@@ -1427,15 +1485,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create an array
$formquestion = array();
- if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 'true' : 'false'));
- if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
+ if ($object->email) {
+ $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 'true' : 'false'));
+ }
+ if ($backtopage) {
+ $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
+ }
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 240);
}
// Confirm remove member
if ($action == 'delete') {
$formquestion = array();
- if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
+ if ($backtopage) {
+ $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
+ }
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("DeleteMember"), $langs->trans("ConfirmDeleteMember"), "confirm_delete", $formquestion, 'no', 1);
}
@@ -1449,8 +1513,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
$rowspan = 17;
- if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
- if (!empty($conf->societe->enabled)) $rowspan++;
+ if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
+ $rowspan++;
+ }
+ if (!empty($conf->societe->enabled)) {
+ $rowspan++;
+ }
$linkback = ''.$langs->trans("BackToList").' ';
@@ -1477,7 +1545,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Gender
print ''.$langs->trans("Gender").' ';
print '';
- if ($object->gender) print $langs->trans("Gender".$object->gender);
+ if ($object->gender) {
+ print $langs->trans("Gender".$object->gender);
+ }
print ' ';
// Company
@@ -1490,10 +1560,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print ''.$langs->trans("Password").' '.preg_replace('/./i', '*', $object->pass);
- if ($object->pass) print preg_replace('/./i', '*', $object->pass);
- else {
- if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
- else print $langs->trans("Hidden");
+ if ($object->pass) {
+ print preg_replace('/./i', '*', $object->pass);
+ } else {
+ if ($user->admin) {
+ print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
+ } else {
+ print $langs->trans("Hidden");
+ }
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
$langs->load("errors");
@@ -1515,10 +1589,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $langs->trans("SubscriptionNotNeeded");
} elseif (!$adht->subscription) {
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 {
print $langs->trans("SubscriptionNotReceived");
- 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
+ }
}
}
print ' ';
@@ -1687,8 +1765,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create third party
if (!empty($conf->societe->enabled) && !$object->socid) {
if ($user->rights->societe->creer) {
- if ($object->statut != -1) print '';
- else print '';
+ if ($object->statut != -1) {
+ print '';
+ } else {
+ print '';
+ }
} else {
print ''.$langs->trans("CreateDolibarrThirdParty")."
";
}
@@ -1697,8 +1778,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create user
if (!$user->socid && !$object->user_id) {
if ($user->rights->user->user->creer) {
- if ($object->statut != -1) print '';
- else print '';
+ if ($object->statut != -1) {
+ print '';
+ } else {
+ print '';
+ }
} else {
print ''.$langs->trans("CreateDolibarrLogin")."
";
}
diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php
index e70248a455e..9d403d88320 100644
--- a/htdocs/adherents/cartes/carte.php
+++ b/htdocs/adherents/cartes/carte.php
@@ -80,8 +80,12 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
}
$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql .= " AND d.entity IN (".getEntity('adherent').")";
- if (is_numeric($foruserid)) $sql .= " AND d.rowid=".(int) $foruserid;
- if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
+ if (is_numeric($foruserid)) {
+ $sql .= " AND d.rowid=".(int) $foruserid;
+ }
+ if ($foruserlogin) {
+ $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
+ }
$sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG);
@@ -92,7 +96,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
while ($i < $num) {
$objp = $db->fetch_object($result);
- if ($objp->country == '-') $objp->country = '';
+ if ($objp->country == '-') {
+ $objp->country = '';
+ }
$adherentstatic->id = $objp->rowid;
$adherentstatic->ref = $objp->ref;
@@ -147,7 +153,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
if (is_numeric($foruserid) || $foruserlogin) {
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
- if ($nb <= 0) $nb = 1; // Protection to avoid empty page
+ if ($nb <= 0) {
+ $nb = 1; // Protection to avoid empty page
+ }
for ($j = 0; $j < $nb; $j++) {
$arrayofmembers[] = array(
@@ -175,7 +183,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
// For labels
if ($mode == 'label') {
- if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
+ if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) {
+ $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
+ }
$textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
$textheader = '';
$textfooter = '';
@@ -203,7 +213,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
if (empty($model) || $model == '-1') {
$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') {
if (!count($arrayofmembers)) {
$mesg = $langs->trans("ErrorRecordNotFound");
@@ -211,7 +223,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
if (empty($modellabel) || $modellabel == '-1') {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
- if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
+ if (!$mesg) {
+ $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
+ }
}
if ($result <= 0) {
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 8e5cdbe8067..43447665b94 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -373,18 +373,24 @@ class Adherent extends CommonObject
// Detect if message is HTML
if ($msgishtml == -1) {
$msgishtml = 0;
- if (dol_textishtml($text, 0)) $msgishtml = 1;
+ if (dol_textishtml($text, 0)) {
+ $msgishtml = 1;
+ }
}
dol_syslog('send_an_email msgishtml='.$msgishtml);
$texttosend = $this->makeSubstitution($text);
$subjecttosend = $this->makeSubstitution($subject);
- if ($msgishtml) $texttosend = dol_htmlentitiesbr($texttosend);
+ if ($msgishtml) {
+ $texttosend = dol_htmlentitiesbr($texttosend);
+ }
// Envoi mail confirmation
$from = $conf->email_from;
- if (!empty($conf->global->ADHERENT_MAIL_FROM)) $from = $conf->global->ADHERENT_MAIL_FROM;
+ if (!empty($conf->global->ADHERENT_MAIL_FROM)) {
+ $from = $conf->global->ADHERENT_MAIL_FROM;
+ }
$trackid = 'mem'.$this->id;
@@ -413,10 +419,14 @@ class Adherent extends CommonObject
$birthday = dol_print_date($this->birth, 'day');
$msgishtml = 0;
- if (dol_textishtml($text, 1)) $msgishtml = 1;
+ if (dol_textishtml($text, 1)) {
+ $msgishtml = 1;
+ }
$infos = '';
- if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
+ if ($this->civility_id) {
+ $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
+ }
$infos .= $langs->transnoentities("id").": ".$this->id."\n";
$infos .= $langs->transnoentities("ref").": ".$this->ref."\n";
$infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
@@ -514,7 +524,9 @@ class Adherent extends CommonObject
$this->error = $langs->trans("ErrorBadEMail", $this->email);
return -1;
}
- if (!$this->datec) $this->datec = $now;
+ if (!$this->datec) {
+ $this->datec = $now;
+ }
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
if (empty($this->login)) {
$this->error = $langs->trans("ErrorWrongValueForParameterX", "Login");
@@ -669,9 +681,15 @@ class Adherent extends CommonObject
$sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid);
$sql .= ", morphy = '".$this->db->escape($this->morphy)."'";
$sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null");
- if ($this->socid) $sql .= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
- if ($this->datefin) $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
- if ($this->datevalid) $sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
+ if ($this->socid) {
+ $sql .= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
+ }
+ if ($this->datefin) {
+ $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
+ }
+ if ($this->datevalid) {
+ $sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
+ }
$sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
$sql .= " WHERE rowid = ".$this->id;
@@ -716,7 +734,9 @@ class Adherent extends CommonObject
// If password to set differs from the one found into database
$result = $this->setPassword($user, $this->pass, $isencrypted, $notrigger, $nosyncuserpass);
- if (!$nbrowsaffected) $nbrowsaffected++;
+ if (!$nbrowsaffected) {
+ $nbrowsaffected++;
+ }
}
}
@@ -759,7 +779,9 @@ class Adherent extends CommonObject
//var_dump($this->login);exit;
// If option ADHERENT_LOGIN_NOT_REQUIRED is on, there is no login of member, so we do not overwrite user login to keep existing one.
- if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $luser->login = $this->login;
+ if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
+ $luser->login = $this->login;
+ }
$luser->ref = $this->ref;
$luser->civility_id = $this->civility_id;
@@ -925,14 +947,18 @@ class Adherent extends CommonObject
$errorflag = 0;
// Check parameters
- if (empty($rowid)) $rowid = $this->id;
+ if (empty($rowid)) {
+ $rowid = $this->id;
+ }
$this->db->begin();
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('MEMBER_DELETE', $user);
- if ($result < 0) $error++;
+ if ($result < 0) {
+ $error++;
+ }
// End call triggers
}
@@ -1474,7 +1500,9 @@ class Adherent extends CommonObject
$error = 0;
// Clean parameters
- if (!$amount) $amount = 0;
+ if (!$amount) {
+ $amount = 0;
+ }
$this->db->begin();
@@ -1605,10 +1633,14 @@ class Adherent extends CommonObject
if ($this->morphy == 'mor') {
$companyname = $this->company;
- if (!empty($fullname)) $companyalias = $fullname;
+ if (!empty($fullname)) {
+ $companyalias = $fullname;
+ }
} else {
$companyname = $fullname;
- if (!empty($this->company)) $companyalias = $this->company;
+ if (!empty($this->company)) {
+ $companyalias = $this->company;
+ }
}
$result = $customer->create_from_member($this, $companyname, $companyalias);
@@ -1671,7 +1703,9 @@ class Adherent extends CommonObject
if (!$error) {
// Add line to draft invoice
$idprodsubscription = 0;
- if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS;
+ if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
+ $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS;
+ }
$vattouse = 0;
if (isset($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) && $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS == 'defaultforfoundationcountry') {
@@ -1758,8 +1792,12 @@ class Adherent extends CommonObject
$outputlangs = $langs;
$newlang = '';
$lang_id = GETPOST('lang_id');
- if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($lang_id)) $newlang = $lang_id;
- if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $customer->default_lang;
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($lang_id)) {
+ $newlang = $lang_id;
+ }
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
+ $newlang = $customer->default_lang;
+ }
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -1901,7 +1939,9 @@ class Adherent extends CommonObject
$result = $mailmanspip->add_to_mailman($this);
if ($result < 0) {
- if (!empty($mailmanspip->error)) $this->errors[] = $mailmanspip->error;
+ if (!empty($mailmanspip->error)) {
+ $this->errors[] = $mailmanspip->error;
+ }
$err += 1;
}
foreach ($mailmanspip->mladded_ko as $tmplist => $tmpemail) {
@@ -1950,7 +1990,9 @@ class Adherent extends CommonObject
if (!empty($conf->global->ADHERENT_USE_MAILMAN)) {
$result = $mailmanspip->del_to_mailman($this);
if ($result < 0) {
- if (!empty($mailmanspip->error)) $this->errors[] = $mailmanspip->error;
+ if (!empty($mailmanspip->error)) {
+ $this->errors[] = $mailmanspip->error;
+ }
$err += 1;
}
@@ -1991,7 +2033,9 @@ class Adherent extends CommonObject
$langs->load("dict");
$code = (empty($this->civility_id) ? '' : $this->civility_id);
- if (empty($code)) return '';
+ if (empty($code)) {
+ return '';
+ }
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
}
@@ -2012,7 +2056,9 @@ class Adherent extends CommonObject
{
global $conf, $langs;
- if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg = 0;
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) {
+ $withpictoimg = 0;
+ }
$result = '';
$label = '';
@@ -2028,9 +2074,15 @@ class Adherent extends CommonObject
$label .= '';
$label .= img_picto('', $this->picto).' '.$langs->trans("Member").' ';
$label .= ' '.$this->getLibStatut(4);
- if (!empty($this->ref)) $label .= ''.$langs->trans('Ref').': '.$this->ref;
- if (!empty($this->firstname) || !empty($this->lastname)) $label .= ''.$langs->trans('Name').': '.$this->getFullName($langs);
- if (!empty($this->company)) $label .= ''.$langs->trans('Company').': '.$this->company;
+ if (!empty($this->ref)) {
+ $label .= ''.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->firstname) || !empty($this->lastname)) {
+ $label .= ''.$langs->trans('Name').': '.$this->getFullName($langs);
+ }
+ if (!empty($this->company)) {
+ $label .= ''.$langs->trans('Company').': '.$this->company;
+ }
$label .= '
';
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
@@ -2041,8 +2093,12 @@ class Adherent extends CommonObject
if ($option != 'nolink') {
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
- if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
+ $add_save_lastsearch_values = 1;
+ }
+ if ($add_save_lastsearch_values) {
+ $url .= '&save_lastsearch_values=1';
+ }
}
$linkstart .= '';
$result .= $linkstart;
- if ($withpictoimg) $result .= '';
+ if ($withpictoimg) {
+ $result .= '
';
+ }
if ($withpictoimg) {
$paddafterimage = '';
- if (abs($withpictoimg) == 1) $paddafterimage = 'style="margin-right: 3px;"';
+ if (abs($withpictoimg) == 1) {
+ $paddafterimage = 'style="margin-right: 3px;"';
+ }
// Only picto
- if ($withpictoimg > 0)
+ if ($withpictoimg > 0) {
$picto = ''.
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).' ';
- // Picto must be a photo
- else {
+ } else {
+ // Picto must be a photo
$picto = '';
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
$picto .= ' ';
@@ -2078,8 +2138,10 @@ class Adherent extends CommonObject
$result .= $picto;
}
if ($withpictoimg > -2 && $withpictoimg != 2) {
- if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= 'statut) || $this->statut) ? '' : ' strikefordisabled').
($morecss ? ' usertext'.$morecss : '').'">';
+ }
if ($mode == 'login') {
$result .= dol_trunc($this->login, $maxlen);
} elseif ($mode == 'ref') {
@@ -2087,9 +2149,13 @@ class Adherent extends CommonObject
} else {
$result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : ($mode == 'lastname' ? 4 : -1)), $maxlen);
}
- if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ' ';
+ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ $result .= '';
+ }
+ }
+ if ($withpictoimg) {
+ $result .= '
';
}
- if ($withpictoimg) $result .= '
';
$result .= $linkend;
if ($addlinktonotes) {
@@ -2214,7 +2280,9 @@ class Adherent extends CommonObject
// phpcs:enable
global $conf, $langs;
- if ($user->socid) return -1; // protection pour eviter appel par utilisateur externe
+ if ($user->socid) {
+ return -1; // protection pour eviter appel par utilisateur externe
+ }
$now = dol_now();
@@ -2398,9 +2466,15 @@ class Adherent extends CommonObject
// phpcs:enable
global $conf;
$dn = '';
- if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN;
- if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_DN;
- if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS];
+ if ($mode == 0) {
+ $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN;
+ }
+ if ($mode == 1) {
+ $dn = $conf->global->LDAP_MEMBER_DN;
+ }
+ if ($mode == 2) {
+ $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS];
+ }
return $dn;
}
@@ -2448,31 +2522,65 @@ class Adherent extends CommonObject
// Check if it is the LDAP key and if its value has been changed
if (!empty($conf->global->LDAP_KEY_MEMBERS) && $conf->global->LDAP_KEY_MEMBERS == $conf->global->$constname) {
- if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) $keymodified = true; // For check if LDAP key has been modified
+ if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) {
+ $keymodified = true; // For check if LDAP key has been modified
+ }
}
}
}
- if ($this->firstname && !empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
- if ($this->poste && !empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
- if ($this->company && !empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->company;
- if ($this->address && !empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
- if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
- if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
- if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
+ if ($this->firstname && !empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
+ }
+ if ($this->poste && !empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
+ }
+ if ($this->company && !empty($conf->global->LDAP_MEMBER_FIELD_COMPANY)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_COMPANY] = $this->company;
+ }
+ if ($this->address && !empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
+ }
+ if ($this->zip && !empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
+ }
+ if ($this->town && !empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
+ }
+ if ($this->country_code && !empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
+ }
foreach ($socialnetworks as $key => $value) {
if ($this->socialnetworks[$value['label']] && !empty($conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])})) {
$info[$conf->global->{'LDAP_MEMBER_FIELD_'.strtoupper($value['label'])}] = $this->socialnetworks[$value['label']];
}
}
- if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
- if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
- if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
- if ($this->fax && !empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
- if ($this->note_private && !empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
- if ($this->note_public && !empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = dol_string_nohtmltag($this->note_public, 2);
- if ($this->birth && !empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth, 'dayhourldap');
- if (isset($this->statut) && !empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
- if ($this->datefin && !empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin, 'dayhourldap');
+ if ($this->phone && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
+ }
+ if ($this->phone_perso && !empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
+ }
+ if ($this->phone_mobile && !empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
+ }
+ if ($this->fax && !empty($conf->global->LDAP_MEMBER_FIELD_FAX)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
+ }
+ if ($this->note_private && !empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
+ }
+ if ($this->note_public && !empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = dol_string_nohtmltag($this->note_public, 2);
+ }
+ if ($this->birth && !empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth, 'dayhourldap');
+ }
+ if (isset($this->statut) && !empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
+ }
+ if ($this->datefin && !empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin, 'dayhourldap');
+ }
// When password is modified
if (!empty($this->pass)) {
@@ -2482,8 +2590,9 @@ class Adherent extends CommonObject
if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
}
- } // Set LDAP password if possible
- elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
+ } elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
+ // Set LDAP password if possible
+ // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
// Just for the default MD5 !
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
@@ -2493,18 +2602,30 @@ class Adherent extends CommonObject
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
}
}
- } // Use $this->pass_indatabase value if exists
- elseif (!empty($this->pass_indatabase)) {
- if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
- if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
+ } elseif (!empty($this->pass_indatabase)) {
+ // Use $this->pass_indatabase value if exists
+ if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
+ }
+ if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
+ $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
+ }
}
}
// Subscriptions
- if ($this->first_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date, 'dayhourldap');
- if (isset($this->first_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
- if ($this->last_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date, 'dayhourldap');
- if (isset($this->last_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount;
+ if ($this->first_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date, 'dayhourldap');
+ }
+ if (isset($this->first_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT] = $this->first_subscription_amount;
+ }
+ if ($this->last_subscription_date && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE] = dol_print_date($this->last_subscription_date, 'dayhourldap');
+ }
+ if (isset($this->last_subscription_amount) && !empty($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT)) {
+ $info[$conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT] = $this->last_subscription_amount;
+ }
return $info;
}
@@ -2626,8 +2747,12 @@ class Adherent extends CommonObject
global $conf;
//Only valid members
- if ($this->statut <= 0) return false;
- if (!$this->datefin) return false;
+ if ($this->statut <= 0) {
+ return false;
+ }
+ if (!$this->datefin) {
+ return false;
+ }
$now = dol_now();
@@ -2720,7 +2845,9 @@ class Adherent extends CommonObject
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
- if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
+ }
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $adherent);
@@ -2763,7 +2890,9 @@ class Adherent extends CommonObject
if ($message) {
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
- if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
+ if ($sendtocc) {
+ $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
+ }
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg = dol_concatdesc($actionmsg, $message);
@@ -2843,7 +2972,9 @@ class Adherent extends CommonObject
$listofids .= $idmember;
$i++;
}
- if ($listofids) $listofids .= ']';
+ if ($listofids) {
+ $listofids .= ']';
+ }
$this->output .= $listofids;
}
if ($nbko) {
@@ -2864,7 +2995,9 @@ class Adherent extends CommonObject
$listofids .= $idmember;
$i++;
}
- if ($listofids) $listofids .= ']';
+ if ($listofids) {
+ $listofids .= ']';
+ }
$this->output .= $listofids;
}
}
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 9c677148b92..40e3e97deb4 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -74,8 +74,8 @@ class AdherentType extends CommonObject
public $duration;
/*
- * type expiration
- */
+ * type expiration
+ */
public $duration_value;
/**
@@ -241,12 +241,12 @@ class AdherentType extends CommonObject
}
/**
- * Delete a language for this member type
- *
- * @param string $langtodelete Language code to delete
- * @param User $user Object user making delete
- * @return int <0 if KO, >0 if OK
- */
+ * Delete a language for this member type
+ *
+ * @param string $langtodelete Language code to delete
+ * @param User $user Object user making delete
+ * @return int <0 if KO, >0 if OK
+ */
public function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang";
@@ -313,7 +313,9 @@ class AdherentType extends CommonObject
if (!$notrigger) {
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_CREATE', $user);
- if ($result < 0) { $error++; }
+ if ($result < 0) {
+ $error++;
+ }
// End call triggers
}
@@ -386,7 +388,9 @@ class AdherentType extends CommonObject
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_MODIFY', $user);
- if ($result < 0) { $error++; }
+ if ($result < 0) {
+ $error++;
+ }
// End call triggers
}
@@ -423,7 +427,9 @@ class AdherentType extends CommonObject
if ($resql) {
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_DELETE', $user);
- if ($result < 0) { $error++; $this->db->rollback(); return -2; }
+ if ($result < 0) {
+ $error++; $this->db->rollback(); return -2;
+ }
// End call triggers
$this->db->commit();
@@ -499,7 +505,9 @@ class AdherentType extends CommonObject
$sql = "SELECT rowid, libelle as label";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
- if ($status >= 0) $sql .= " AND statut = ".((int) $status);
+ if ($status >= 0) {
+ $sql .= " AND statut = ".((int) $status);
+ }
$resql = $this->db->query($sql);
if ($resql) {
@@ -539,7 +547,9 @@ class AdherentType extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql .= " WHERE a.entity IN (".getEntity('member').")";
$sql .= " AND a.fk_adherent_type = ".$this->id;
- if (!empty($excludefilter)) $sql .= ' AND ('.$excludefilter.')';
+ if (!empty($excludefilter)) {
+ $sql .= ' AND ('.$excludefilter.')';
+ }
dol_syslog(get_class($this)."::listUsersForGroup", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -554,7 +564,9 @@ class AdherentType extends CommonObject
$memberstatic->fetch($obj->rowid);
}
$ret[$obj->rowid] = $memberstatic;
- } else $ret[$obj->rowid] = $obj->rowid;
+ } else {
+ $ret[$obj->rowid] = $obj->rowid;
+ }
}
}
@@ -578,7 +590,13 @@ class AdherentType extends CommonObject
public function getmorphylib($morphy = '')
{
global $langs;
- if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } else return $langs->trans("MorAndPhy");
+ if ($morphy == 'phy') {
+ return $langs->trans("Physical");
+ } elseif ($morphy == 'mor') {
+ return $langs->trans("Moral");
+ } else {
+ return $langs->trans("MorAndPhy");
+ }
//return $morphy;
}
@@ -609,8 +627,12 @@ class AdherentType extends CommonObject
$linkend = ' ';
$result .= $linkstart;
- 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);
- if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
+ 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);
+ }
+ if ($withpicto != 2) {
+ $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
+ }
$result .= $linkend;
return $result;
@@ -642,7 +664,9 @@ class AdherentType extends CommonObject
$langs->load('companies');
$statusType = 'status4';
- if ($status == 0) $statusType = 'status5';
+ if ($status == 0) {
+ $statusType = 'status5';
+ }
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
$this->labelStatus[0] = $langs->trans("ActivityCeased");
@@ -670,9 +694,15 @@ class AdherentType extends CommonObject
// phpcs:enable
global $conf;
$dn = '';
- if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
- if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_TYPE_DN;
- if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES];
+ if ($mode == 0) {
+ $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
+ }
+ if ($mode == 1) {
+ $dn = $conf->global->LDAP_MEMBER_TYPE_DN;
+ }
+ if ($mode == 2) {
+ $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES];
+ }
return $dn;
}
@@ -695,11 +725,15 @@ class AdherentType extends CommonObject
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
// Champs
- if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
- if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
+ if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) {
+ $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
+ }
+ if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) {
+ $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1);
+ }
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array();
- foreach ($this->members as $key=>$val) { // This is array of users for group into dolibarr database.
+ foreach ($this->members as $key => $val) { // This is array of users for group into dolibarr database.
$member = new Adherent($this->db);
$member->fetch($val->id, '', '', '', false, false);
$info2 = $member->_load_ldap_info();
diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 6fa3058dca1..277d2798bb7 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -36,7 +36,7 @@ class Members extends DolibarrApi
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
- static $FIELDS = array(
+ public static $FIELDS = array(
'morphy',
'typeid'
);
@@ -325,7 +325,9 @@ class Members extends DolibarrApi
}
foreach ($request_data as $field => $value) {
- if ($field == 'id') continue;
+ if ($field == 'id') {
+ continue;
+ }
// Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class Adherent.
if ($field == 'statut') {
@@ -399,8 +401,9 @@ class Members extends DolibarrApi
{
$member = array();
foreach (Members::$FIELDS as $field) {
- if (!isset($data[$field]))
+ if (!isset($data[$field])) {
throw new RestException(400, "$field field missing");
+ }
$member[$field] = $data[$field];
}
return $member;
diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php
index f9f410f34aa..fbf9150be68 100644
--- a/htdocs/adherents/class/api_memberstypes.class.php
+++ b/htdocs/adherents/class/api_memberstypes.class.php
@@ -30,7 +30,7 @@ class MembersTypes extends DolibarrApi
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
- static $FIELDS = array(
+ public static $FIELDS = array(
'label',
);
@@ -190,7 +190,9 @@ class MembersTypes extends DolibarrApi
}
foreach ($request_data as $field => $value) {
- if ($field == 'id') continue;
+ if ($field == 'id') {
+ continue;
+ }
// Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class AdherentType.
$membertype->$field = $value;
@@ -250,8 +252,9 @@ class MembersTypes extends DolibarrApi
{
$membertype = array();
foreach (MembersTypes::$FIELDS as $field) {
- if (!isset($data[$field]))
+ if (!isset($data[$field])) {
throw new RestException(400, "$field field missing");
+ }
$membertype[$field] = $data[$field];
}
return $membertype;
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index 04b9f750a88..3758885c4a3 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -30,7 +30,7 @@ class Subscriptions extends DolibarrApi
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
- static $FIELDS = array(
+ public static $FIELDS = array(
'fk_adherent',
'dateh',
'datef',
diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 35ce841ba6e..349cf5e7b75 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -50,12 +50,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) {
+ $page = 0;
+} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortorder) $sortorder = "ASC";
-if (!$sortfield) $sortfield = "name";
+if (!$sortorder) {
+ $sortorder = "ASC";
+}
+if (!$sortfield) {
+ $sortfield = "name";
+}
$form = new Form($db);
@@ -96,8 +102,9 @@ if ($id > 0) {
$totalsize += $file['size'];
}
- if (!empty($conf->notification->enabled))
+ if (!empty($conf->notification->enabled)) {
$langs->load("mails");
+ }
$head = member_prepare_head($object);
@@ -125,8 +132,8 @@ if ($id > 0) {
// Morphy
print ''.$langs->trans("MemberNature").' '.$object->getmorphylib().' ';
/*print '';
- print $form->showphoto('memberphoto',$object);
- print ' ';*/
+ print $form->showphoto('memberphoto',$object);
+ print '';*/
print ' ';
// Company
diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php
index fc9b2eaf7f9..a1c105bd192 100644
--- a/htdocs/adherents/htpasswd.php
+++ b/htdocs/adherents/htpasswd.php
@@ -27,7 +27,9 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// Security check
-if (!$user->rights->adherent->export) accessforbidden();
+if (!$user->rights->adherent->export) {
+ accessforbidden();
+}
/*
@@ -38,8 +40,12 @@ llxHeader();
$now = dol_now();
-if (empty($sortorder)) { $sortorder = "ASC"; }
-if (empty($sortfield)) { $sortfield = "d.login"; }
+if (empty($sortorder)) {
+ $sortorder = "ASC";
+}
+if (empty($sortfield)) {
+ $sortfield = "d.login";
+}
if (!isset($statut)) {
$statut = 1;
}
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 192c6f97a45..ec55870e49f 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -257,7 +257,7 @@ print "\n";
krsort($Total);
$i = 0;
-foreach ($Total as $key=>$value) {
+foreach ($Total as $key => $value) {
if ($i >= 8) {
print '';
print "... ";
diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php
index 6be535b6e3b..843ca08a5df 100644
--- a/htdocs/adherents/ldap.php
+++ b/htdocs/adherents/ldap.php
@@ -142,7 +142,9 @@ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTI
print "\n";
-if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print " \n";
+if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
+ print " \n";
+}
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 704f484f38a..c37e9e325cf 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -69,24 +69,36 @@ $catid = GETPOST("catid", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$filter = GETPOST("filter", 'alpha');
-if ($filter) $search_filter = $filter; // For backward compatibility
+if ($filter) {
+ $search_filter = $filter; // For backward compatibility
+}
$statut = GETPOST("statut", 'alpha');
-if ($statut != '') $search_status = $statut; // For backward compatibility
+if ($statut != '') {
+ $search_status = $statut; // For backward compatibility
+}
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
-if ($search_status < -1) $search_status = '';
+if ($search_status < -1) {
+ $search_status = '';
+}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) {
+ $page = 0;
+} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (!$sortorder) { $sortorder = ($filter == 'outofdate' ? "DESC" : "ASC"); }
-if (!$sortfield) { $sortfield = ($filter == 'outofdate' ? "d.datefin" : "d.lastname"); }
+if (!$sortorder) {
+ $sortorder = ($filter == 'outofdate' ? "DESC" : "ASC");
+}
+if (!$sortfield) {
+ $sortfield = ($filter == 'outofdate' ? "d.datefin" : "d.lastname");
+}
$object = new Adherent($db);
@@ -117,7 +129,9 @@ $fieldstosearchall = array(
'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate',
);
-if ($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']);
+if ($db->type == 'pgsql') {
+ unset($fieldstosearchall['d.rowid']);
+}
$arrayfields = array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0),
@@ -153,12 +167,18 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
* Actions
*/
-if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; }
+if (GETPOST('cancel', 'alpha')) {
+ $action = 'list'; $massaction = '';
+}
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
+ $massaction = '';
+}
$parameters = array('socid'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
if (empty($reshook)) {
// Selection of new fields
@@ -212,7 +232,9 @@ if (empty($reshook)) {
if ($result < 0 && !count($tmpmember->errors)) {
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else {
- if ($result > 0) $nbclose++;
+ if ($result > 0) {
+ $nbclose++;
+ }
}
}
@@ -256,8 +278,11 @@ $sql .= " s.nom,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields
-if (!empty($extrafields->attributes[$object->table_element]['label']))
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+if (!empty($extrafields->attributes[$object->table_element]['label'])) {
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
+ }
+}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -276,16 +301,34 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid =
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid ";
-if ($catid > 0) $sql .= " AND cm.fk_categorie = ".$db->escape($catid);
-if ($catid == -2) $sql .= " AND cm.fk_categorie IS NULL";
-if ($search_categ > 0) $sql .= " AND cm.fk_categorie = ".$db->escape($search_categ);
-if ($search_categ == -2) $sql .= " AND cm.fk_categorie IS NULL";
+if ($catid > 0) {
+ $sql .= " AND cm.fk_categorie = ".$db->escape($catid);
+}
+if ($catid == -2) {
+ $sql .= " AND cm.fk_categorie IS NULL";
+}
+if ($search_categ > 0) {
+ $sql .= " AND cm.fk_categorie = ".$db->escape($search_categ);
+}
+if ($search_categ == -2) {
+ $sql .= " AND cm.fk_categorie IS NULL";
+}
$sql .= " AND d.entity IN (".getEntity('adherent').")";
-if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
-if ($search_type > 0) $sql .= " AND t.rowid=".$db->escape($search_type);
-if ($search_filter == 'withoutsubscription') $sql .= " AND (datefin IS NULL OR t.subscription = 0)";
-if ($search_filter == 'uptodate') $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
-if ($search_filter == 'outofdate') $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
+if ($sall) {
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall);
+}
+if ($search_type > 0) {
+ $sql .= " AND t.rowid=".$db->escape($search_type);
+}
+if ($search_filter == 'withoutsubscription') {
+ $sql .= " AND (datefin IS NULL OR t.subscription = 0)";
+}
+if ($search_filter == 'uptodate') {
+ $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
+}
+if ($search_filter == 'outofdate') {
+ $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
+}
if ($search_status != '') {
// Peut valoir un nombre ou liste de nombre separes par virgules
$sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")";
@@ -293,21 +336,51 @@ if ($search_status != '') {
if ($search_ref) {
$sql .= natural_search("d.ref", $search_ref);
}
-if ($search_civility) $sql .= natural_search("d.civility", $search_civility);
-if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname);
-if ($search_lastname) $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
-if ($search_gender != '' && $search_gender != '-1') $sql .= natural_search("d.gender", $search_gender);
-if ($search_login) $sql .= natural_search("d.login", $search_login);
-if ($search_company) $sql .= natural_search("s.nom", $search_company);
-if ($search_email) $sql .= natural_search("d.email", $search_email);
-if ($search_address) $sql .= natural_search("d.address", $search_address);
-if ($search_town) $sql .= natural_search("d.town", $search_town);
-if ($search_zip) $sql .= natural_search("d.zip", $search_zip);
-if ($search_state) $sql .= natural_search("state.nom", $search_state);
-if ($search_phone) $sql .= natural_search("d.phone", $search_phone);
-if ($search_phone_perso) $sql .= natural_search("d.phone_perso", $search_phone_perso);
-if ($search_phone_mobile) $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
-if ($search_country) $sql .= " AND d.country IN (".$search_country.')';
+if ($search_civility) {
+ $sql .= natural_search("d.civility", $search_civility);
+}
+if ($search_firstname) {
+ $sql .= natural_search("d.firstname", $search_firstname);
+}
+if ($search_lastname) {
+ $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
+}
+if ($search_gender != '' && $search_gender != '-1') {
+ $sql .= natural_search("d.gender", $search_gender);
+}
+if ($search_login) {
+ $sql .= natural_search("d.login", $search_login);
+}
+if ($search_company) {
+ $sql .= natural_search("s.nom", $search_company);
+}
+if ($search_email) {
+ $sql .= natural_search("d.email", $search_email);
+}
+if ($search_address) {
+ $sql .= natural_search("d.address", $search_address);
+}
+if ($search_town) {
+ $sql .= natural_search("d.town", $search_town);
+}
+if ($search_zip) {
+ $sql .= natural_search("d.zip", $search_zip);
+}
+if ($search_state) {
+ $sql .= natural_search("state.nom", $search_state);
+}
+if ($search_phone) {
+ $sql .= natural_search("d.phone", $search_phone);
+}
+if ($search_phone_perso) {
+ $sql .= natural_search("d.phone_perso", $search_phone_perso);
+}
+if ($search_phone_mobile) {
+ $sql .= natural_search("d.phone_mobile", $search_phone_mobile);
+}
+if ($search_country) {
+ $sql .= " AND d.country IN (".$search_country.')';
+}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -323,8 +396,11 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
- if ($resql) $nbtotalofrecords = $db->num_rows($resql);
- else dol_print_error($db);
+ if ($resql) {
+ $nbtotalofrecords = $db->num_rows($resql);
+ } else {
+ dol_print_error($db);
+ }
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
@@ -355,13 +431,27 @@ llxHeader('', $langs->trans("Member"), 'EN:Module_Foundations|FR:Module_Adh&eacu
$titre = $langs->trans("MembersList");
if (GETPOSTISSET("search_status")) {
- if ($search_status == '-1,1') { $titre = $langs->trans("MembersListQualified"); }
- if ($search_status == '-1') { $titre = $langs->trans("MembersListToValid"); }
- if ($search_status == '1' && $filter == '') { $titre = $langs->trans("MembersValidated"); }
- if ($search_status == '1' && $filter == 'withoutsubscription') { $titre = $langs->trans("MembersWithSubscriptionToReceive"); }
- if ($search_status == '1' && $filter == 'uptodate') { $titre = $langs->trans("MembersListUpToDate"); }
- if ($search_status == '1' && $filter == 'outofdate') { $titre = $langs->trans("MembersListNotUpToDate"); }
- if ($search_status == '0') { $titre = $langs->trans("MembersListResiliated"); }
+ if ($search_status == '-1,1') {
+ $titre = $langs->trans("MembersListQualified");
+ }
+ if ($search_status == '-1') {
+ $titre = $langs->trans("MembersListToValid");
+ }
+ if ($search_status == '1' && $filter == '') {
+ $titre = $langs->trans("MembersValidated");
+ }
+ if ($search_status == '1' && $filter == 'withoutsubscription') {
+ $titre = $langs->trans("MembersWithSubscriptionToReceive");
+ }
+ if ($search_status == '1' && $filter == 'uptodate') {
+ $titre = $langs->trans("MembersListUpToDate");
+ }
+ if ($search_status == '1' && $filter == 'outofdate') {
+ $titre = $langs->trans("MembersListNotUpToDate");
+ }
+ if ($search_status == '0') {
+ $titre = $langs->trans("MembersListResiliated");
+ }
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
}
@@ -373,30 +463,78 @@ if ($search_type > 0) {
}
$param = '';
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
-if ($sall != "") $param .= "&sall=".urlencode($sall);
-if ($search_ref) $param .= "&search_ref=".urlencode($search_ref);
-if ($search_civility) $param .= "&search_civility=".urlencode($search_civility);
-if ($search_firstname) $param .= "&search_firstname=".urlencode($search_firstname);
-if ($search_lastname) $param .= "&search_lastname=".urlencode($search_lastname);
-if ($search_gender) $param .= "&search_gender=".urlencode($search_gender);
-if ($search_login) $param .= "&search_login=".urlencode($search_login);
-if ($search_email) $param .= "&search_email=".urlencode($search_email);
-if ($search_categ) $param .= "&search_categ=".urlencode($search_categ);
-if ($search_company) $param .= "&search_company=".urlencode($search_company);
-if ($search_address != '') $param .= "&search_address=".urlencode($search_address);
-if ($search_town != '') $param .= "&search_town=".urlencode($search_town);
-if ($search_zip != '') $param .= "&search_zip=".urlencode($search_zip);
-if ($search_state != '') $param .= "&search_state=".urlencode($search_state);
-if ($search_country != '') $param .= "&search_country=".urlencode($search_country);
-if ($search_phone != '') $param .= "&search_phone=".urlencode($search_phone);
-if ($search_phone_perso != '') $param .= "&search_phone_perso=".urlencode($search_phone_perso);
-if ($search_phone_mobile != '') $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
-if ($search_filter && $search_filter != '-1') $param .= "&search_filter=".urlencode($search_filter);
-if ($search_status != "" && $search_status != '-1') $param .= "&search_status=".urlencode($search_status);
-if ($search_type > 0) $param .= "&search_type=".urlencode($search_type);
-if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+ $param .= '&contextpage='.urlencode($contextpage);
+}
+if ($limit > 0 && $limit != $conf->liste_limit) {
+ $param .= '&limit='.urlencode($limit);
+}
+if ($sall != "") {
+ $param .= "&sall=".urlencode($sall);
+}
+if ($search_ref) {
+ $param .= "&search_ref=".urlencode($search_ref);
+}
+if ($search_civility) {
+ $param .= "&search_civility=".urlencode($search_civility);
+}
+if ($search_firstname) {
+ $param .= "&search_firstname=".urlencode($search_firstname);
+}
+if ($search_lastname) {
+ $param .= "&search_lastname=".urlencode($search_lastname);
+}
+if ($search_gender) {
+ $param .= "&search_gender=".urlencode($search_gender);
+}
+if ($search_login) {
+ $param .= "&search_login=".urlencode($search_login);
+}
+if ($search_email) {
+ $param .= "&search_email=".urlencode($search_email);
+}
+if ($search_categ) {
+ $param .= "&search_categ=".urlencode($search_categ);
+}
+if ($search_company) {
+ $param .= "&search_company=".urlencode($search_company);
+}
+if ($search_address != '') {
+ $param .= "&search_address=".urlencode($search_address);
+}
+if ($search_town != '') {
+ $param .= "&search_town=".urlencode($search_town);
+}
+if ($search_zip != '') {
+ $param .= "&search_zip=".urlencode($search_zip);
+}
+if ($search_state != '') {
+ $param .= "&search_state=".urlencode($search_state);
+}
+if ($search_country != '') {
+ $param .= "&search_country=".urlencode($search_country);
+}
+if ($search_phone != '') {
+ $param .= "&search_phone=".urlencode($search_phone);
+}
+if ($search_phone_perso != '') {
+ $param .= "&search_phone_perso=".urlencode($search_phone_perso);
+}
+if ($search_phone_mobile != '') {
+ $param .= "&search_phone_mobile=".urlencode($search_phone_mobile);
+}
+if ($search_filter && $search_filter != '-1') {
+ $param .= "&search_filter=".urlencode($search_filter);
+}
+if ($search_status != "" && $search_status != '-1') {
+ $param .= "&search_status=".urlencode($search_status);
+}
+if ($search_type > 0) {
+ $param .= "&search_type=".urlencode($search_type);
+}
+if ($optioncss != '') {
+ $param .= '&optioncss='.urlencode($optioncss);
+}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -405,10 +543,18 @@ $arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
-if ($user->rights->adherent->creer) $arrayofmassactions['close'] = $langs->trans("Resiliate");
-if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete'] = ' '.$langs->trans("Delete");
-if ($user->rights->societe->creer) $arrayofmassactions['preaffecttag'] = ' '.$langs->trans("AffectTag");
-if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) $arrayofmassactions = array();
+if ($user->rights->adherent->creer) {
+ $arrayofmassactions['close'] = $langs->trans("Resiliate");
+}
+if ($user->rights->adherent->supprimer) {
+ $arrayofmassactions['predelete'] = ' '.$langs->trans("Delete");
+}
+if ($user->rights->societe->creer) {
+ $arrayofmassactions['preaffecttag'] = ' '.$langs->trans("AffectTag");
+}
+if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
+ $arrayofmassactions = array();
+}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
@@ -417,7 +563,9 @@ if ($user->rights->adherent->creer) {
}
print '