add new rule

This commit is contained in:
Frédéric FRANCE 2021-03-01 00:19:52 +01:00
parent 0a6f307716
commit 1b046f25cf
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
55 changed files with 2228 additions and 1147 deletions

View File

@ -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);
}

View File

@ -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";

View File

@ -174,8 +174,8 @@
<rule ref="Generic.Strings.UnnecessaryStringConcat.Found">
</rule>
<!-- Disallow usage of tab -->
<!-- <rule ref="Generic.WhiteSpace.DisallowTabIndent" /> -->
<!-- Disallow usage of space -->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent" />
<!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab -->

View File

@ -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');

View File

@ -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 "</td></tr>\n";
// Insert subscription into bank account
print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
$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 '<td>';
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 '<td class="center">';
if ($module->type == 'pdf')
{
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');

View File

@ -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');

View File

@ -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();
}
/*

View File

@ -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();
}
/*

View File

@ -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 "</td></tr>\n";

View File

@ -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&eacute;rents|ES:M&oacute;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 '<br>';
$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);

View File

@ -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

View File

@ -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;
}

View File

@ -29,8 +29,12 @@ echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\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'];
} ?>
<table class="border allwidth">

View File

@ -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 '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
}
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 '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
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 '</td></tr>';
// 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 '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOSTISSET('member_'.$key) ? GETPOST('member_'.$key, 'alpha') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
@ -1057,7 +1091,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="hidden" name="action" value="update" />';
print '<input type="hidden" name="rowid" value="'.$id.'" />';
print '<input type="hidden" name="statut" value="'.$object->statut.'" />';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
}
print dol_get_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
@ -1121,9 +1157,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<td class="hideonsmartphone" valign="middle">';
print $form->showphoto('memberphoto', $object)."\n";
if ($caneditfieldmember) {
if ($object->photo) print "<br>\n";
if ($object->photo) {
print "<br>\n";
}
print '<table class="nobordernopadding">';
if ($object->photo) print '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
if ($object->photo) {
print '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
}
print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
print '</table>';
@ -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 '<tr><td>'.$langs->trans('Country').'</td><td>';
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 '</td></tr>';
// 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 '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
@ -1223,7 +1267,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td colspan="2" class="valeur">';
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 '</td></tr>';
// 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 = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -1477,7 +1545,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Gender
print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>';
if ($object->gender) print $langs->trans("Gender".$object->gender);
if ($object->gender) {
print $langs->trans("Gender".$object->gender);
}
print '</td></tr>';
// Company
@ -1490,10 +1560,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Password").'</td><td>'.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 '</td></tr>';
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
if ($object->statut != -1) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>';
}
} else {
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty")."</font></div>";
}
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
if ($object->statut != -1) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>';
}
} else {
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin")."</font></div>";
}

View File

@ -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) {

View File

@ -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 .= '<div class="centpercent">';
$label .= img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u>';
$label .= ' '.$this->getLibStatut(4);
if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
if (!empty($this->company)) $label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
if (!empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
}
if (!empty($this->firstname) || !empty($this->lastname)) {
$label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
}
if (!empty($this->company)) {
$label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
}
$label .= '</div>';
$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 .= '<a href="'.$url.'"';
@ -2061,16 +2117,20 @@ class Adherent extends CommonObject
$linkend = '</a>';
$result .= $linkstart;
if ($withpictoimg) $result .= '<div class="inline-block nopadding valignmiddle">';
if ($withpictoimg) {
$result .= '<div class="inline-block nopadding valignmiddle">';
}
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 = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</span>';
// Picto must be a photo
else {
} else {
// Picto must be a photo
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
$picto .= '</span>';
@ -2078,8 +2138,10 @@ class Adherent extends CommonObject
$result .= $picto;
}
if ($withpictoimg > -2 && $withpictoimg != 2) {
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$result .= '<span class="nopadding valignmiddle'.((!isset($this->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 .= '</span>';
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$result .= '</span>';
}
}
if ($withpictoimg) {
$result .= '</div>';
}
if ($withpictoimg) $result .= '</div>';
$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;
}
}

View File

@ -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 = '</a>';
$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();

View File

@ -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;

View File

@ -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;

View File

@ -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',

View File

@ -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 '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$object);
print '</td>';*/
print $form->showphoto('memberphoto',$object);
print '</td>';*/
print '</tr>';
// Company

View File

@ -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;
}

View File

@ -257,7 +257,7 @@ print "</tr>\n";
krsort($Total);
$i = 0;
foreach ($Total as $key=>$value) {
foreach ($Total as $key => $value) {
if ($i >= 8) {
print '<tr class="oddeven">';
print "<td>...</td>";

View File

@ -142,7 +142,9 @@ if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTI
print "</div>\n";
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print "<br>\n";
if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') {
print "<br>\n";
}

View File

@ -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'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->societe->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$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'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -434,7 +582,9 @@ $trackid = 'mem'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
}
@ -448,8 +598,11 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
$moreforfilter = $hookmanager->resPrint;
}
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
@ -458,7 +611,9 @@ if (!empty($moreforfilter)) {
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -609,26 +764,66 @@ print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], 'd.firstname', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], 'd.lastname', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.gender']['checked'])) print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'], $_SERVER["PHP_SELF"], 'd.morphy', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], 't.libelle', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'], $_SERVER["PHP_SELF"], 'd.address', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'], $_SERVER["PHP_SELF"], 'd.zip', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'], $_SERVER["PHP_SELF"], 'd.town', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
if (!empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'], $_SERVER["PHP_SELF"], 'd.phone_perso', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'], $_SERVER["PHP_SELF"], 'd.phone_mobile', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder);
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print_liste_field_titre("ID", $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.ref']['checked'])) {
print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], 'd.ref', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.civility']['checked'])) {
print_liste_field_titre($arrayfields['d.civility']['label'], $_SERVER["PHP_SELF"], 'd.civility', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.firstname']['checked'])) {
print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], 'd.firstname', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.lastname']['checked'])) {
print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], 'd.lastname', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.gender']['checked'])) {
print_liste_field_titre($arrayfields['d.gender']['label'], $_SERVER['PHP_SELF'], 'd.gender', $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.company']['checked'])) {
print_liste_field_titre($arrayfields['d.company']['label'], $_SERVER["PHP_SELF"], 'd.societe', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.login']['checked'])) {
print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], 'd.login', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.morphy']['checked'])) {
print_liste_field_titre($arrayfields['d.morphy']['label'], $_SERVER["PHP_SELF"], 'd.morphy', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['t.libelle']['checked'])) {
print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], 't.libelle', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.address']['checked'])) {
print_liste_field_titre($arrayfields['d.address']['label'], $_SERVER["PHP_SELF"], 'd.address', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.zip']['checked'])) {
print_liste_field_titre($arrayfields['d.zip']['label'], $_SERVER["PHP_SELF"], 'd.zip', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.town']['checked'])) {
print_liste_field_titre($arrayfields['d.town']['label'], $_SERVER["PHP_SELF"], 'd.town', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['state.nom']['checked'])) {
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['country.code_iso']['checked'])) {
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.phone']['checked'])) {
print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.phone_perso']['checked'])) {
print_liste_field_titre($arrayfields['d.phone_perso']['label'], $_SERVER["PHP_SELF"], 'd.phone_perso', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print_liste_field_titre($arrayfields['d.phone_mobile']['label'], $_SERVER["PHP_SELF"], 'd.phone_mobile', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.email']['checked'])) {
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.datefin']['checked'])) {
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -636,10 +831,18 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (!empty($arrayfields['d.birth']['checked'])) print_liste_field_titre($arrayfields['d.birth']['label'], $_SERVER["PHP_SELF"], "d.birth", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (!empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (!empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
if (!empty($arrayfields['d.datec']['checked'])) {
print_liste_field_titre($arrayfields['d.datec']['label'], $_SERVER["PHP_SELF"], "d.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.birth']['checked'])) {
print_liste_field_titre($arrayfields['d.birth']['label'], $_SERVER["PHP_SELF"], "d.birth", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.tms']['checked'])) {
print_liste_field_titre($arrayfields['d.tms']['label'], $_SERVER["PHP_SELF"], "d.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.statut']['checked'])) {
print_liste_field_titre($arrayfields['d.statut']['label'], $_SERVER["PHP_SELF"], "d.statut", "", $param, 'class="right"', $sortfield, $sortorder);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
@ -676,7 +879,9 @@ while ($i < min($num, $limit)) {
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
print '<td class="center">'.$obj->rowid.'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Ref
@ -684,35 +889,47 @@ while ($i < min($num, $limit)) {
print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Civility
if (!empty($arrayfields['d.civility']['checked'])) {
print "<td>";
print $obj->civility;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print "<td>";
print $obj->firstname;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print "<td>";
print $obj->lastname;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Gender
if (!empty($arrayfields['d.gender']['checked'])) {
print '<td>';
if ($obj->gender) print $langs->trans("Gender".$obj->gender);
if ($obj->gender) {
print $langs->trans("Gender".$obj->gender);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Company
if (!empty($arrayfields['d.company']['checked'])) {
@ -723,7 +940,9 @@ while ($i < min($num, $limit)) {
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print "<td>".$obj->login."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Nature (Moral/Physical)
if (!empty($arrayfields['d.morphy']['checked'])) {
@ -737,7 +956,9 @@ while ($i < min($num, $limit)) {
}
print $s;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type label
if (!empty($arrayfields['t.libelle']['checked'])) {
@ -746,33 +967,43 @@ while ($i < min($num, $limit)) {
print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1, 32);
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Address
if (!empty($arrayfields['d.address']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->address;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Zip
if (!empty($arrayfields['d.zip']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Town
if (!empty($arrayfields['d.town']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Country
if (!empty($arrayfields['country.code_iso']['checked'])) {
@ -780,28 +1011,36 @@ while ($i < min($num, $limit)) {
$tmparray = getCountry($obj->country, 'all');
print $tmparray['label'];
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone pro
if (!empty($arrayfields['d.phone']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone perso
if (!empty($arrayfields['d.phone_perso']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_perso;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Phone mobile
if (!empty($arrayfields['d.phone_mobile']['checked'])) {
print '<td class="nocellnopadd">';
print $obj->phone_mobile;
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// EMail
if (!empty($arrayfields['d.email']['checked'])) {
@ -822,7 +1061,9 @@ while ($i < min($num, $limit)) {
print '<td class="nowrap left">';
if ($obj->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning();
if ($obj->statut > 0) {
print " ".img_warning();
}
} else {
print '&nbsp;';
}
@ -840,38 +1081,50 @@ while ($i < min($num, $limit)) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Birth
if (!empty($arrayfields['d.birth']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->birth), 'day', 'tzuser');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Status
if (!empty($arrayfields['d.statut']['checked'])) {
print '<td class="nowrap right">';
print $memberstatic->LibStatut($obj->statut, $obj->subscription, $datefin, 5);
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
$i++;
@ -884,7 +1137,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}

View File

@ -91,8 +91,8 @@ if ($id) {
// Morphy
print '<tr><td class="titlefield">'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" class="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';
// Company

View File

@ -82,8 +82,12 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
if ($obj->code == 'phy') {
$foundphy++;
}
if ($obj->code == 'mor') {
$foundmor++;
}
$data[$obj->code] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'nbsubscriptions'=>$obj->nbsubscriptions, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
@ -113,8 +117,12 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
if ($obj->code == 'phy') {
$foundphy++;
}
if ($obj->code == 'mor') {
$foundmor++;
}
$data[$obj->code]['nbactive'] = $obj->nb;
@ -152,8 +160,12 @@ print '<td class="right">'.$langs->trans("NbOfSubscriptions").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
if (!$foundphy) {
$data[] = array('label'=>'phy', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
}
if (!$foundmor) {
$data[] = array('label'=>'mor', 'nb'=>'0', 'nbactive'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
}
foreach ($data as $val) {
$nb = $val['nb'];

View File

@ -56,13 +56,23 @@ $langs->loadLangs(array("companies", "members", "banks"));
$memberstatic = new Adherent($db);
$arrayjs = array('https://www.google.com/jsapi');
if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
if (!empty($conf->dol_use_jmobile)) {
$arrayjs = array();
}
$title = $langs->trans("Statistics");
if ($mode == 'memberbycountry') $title = $langs->trans("MembersStatisticsByCountries");
if ($mode == 'memberbystate') $title = $langs->trans("MembersStatisticsByState");
if ($mode == 'memberbytown') $title = $langs->trans("MembersStatisticsByTown");
if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion");
if ($mode == 'memberbycountry') {
$title = $langs->trans("MembersStatisticsByCountries");
}
if ($mode == 'memberbystate') {
$title = $langs->trans("MembersStatisticsByState");
}
if ($mode == 'memberbytown') {
$title = $langs->trans("MembersStatisticsByTown");
}
if ($mode == 'memberbyregion') {
$title = $langs->trans("MembersStatisticsByRegion");
}
llxHeader('', $title, '', '', 0, 0, $arrayjs);
@ -207,11 +217,15 @@ if ($mode && !count($data)) {
print $langs->trans("NoValidatedMemberYet").'<br>';
print '<br>';
} else {
if ($mode == 'memberbycountry') print '<span class="opacitymedium">'.$langs->trans("MembersByCountryDesc").'</span><br>';
elseif ($mode == 'memberbystate') print '<span class="opacitymedium">'.$langs->trans("MembersByStateDesc").'</span><br>';
elseif ($mode == 'memberbytown') print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
elseif ($mode == 'memberbyregion') print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
else {
if ($mode == 'memberbycountry') {
print '<span class="opacitymedium">'.$langs->trans("MembersByCountryDesc").'</span><br>';
} elseif ($mode == 'memberbystate') {
print '<span class="opacitymedium">'.$langs->trans("MembersByStateDesc").'</span><br>';
} elseif ($mode == 'memberbytown') {
print '<span class="opacitymedium">'.$langs->trans("MembersByTownDesc").'</span><br>';
} elseif ($mode == 'memberbyregion') {
print '<span class="opacitymedium">'.$langs->trans("MembersByRegion").'</span><br>'; //+
} else {
print '<span class="opacitymedium">'.$langs->trans("MembersStatisticsDesc").'</span><br>';
print '<br>';
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=memberbycountry">'.$langs->trans("MembersStatisticsByCountries").'</a><br>';
@ -229,7 +243,9 @@ if ($mode && !count($data)) {
// Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') {
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file;
if (is_readable($color_file)) {
include_once $color_file;
}
// Assume we've already included the proper headers so just call our script inline
// More doc: https://developers.google.com/chart/interactive/docs/gallery/geomap?hl=fr-FR
@ -248,11 +264,15 @@ if (count($arrayjs) && $mode == 'memberbycountry') {
foreach ($data as $val) {
$valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']);
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
if ($valcountry == 'Great Britain') {
$valcountry = 'United Kingdom';
} // fix case of uk (when we use labels)
print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n";
print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries
if ($i >= 400) { break; }
if ($i >= 400) {
break;
}
$i++;
}
@ -279,7 +299,9 @@ if ($mode) {
print '<table class="liste centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$label.'</td>';
if ($label2) print '<td class="center">'.$label2.'</td>';
if ($label2) {
print '<td class="center">'.$label2.'</td>';
}
print '<td class="right">'.$langs->trans("NbOfMembers").' <span class="opacitymedium">('.$langs->trans("AllTime").')</span></td>';
print '<td class="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td class="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
@ -289,7 +311,9 @@ if ($mode) {
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$val['label'].'</td>';
if ($label2) print '<td class="center">'.$val['label2'].'</td>';
if ($label2) {
print '<td class="center">'.$val['label2'].'</td>';
}
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td class="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';

View File

@ -32,8 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
$userid = GETPOST('userid', 'int'); if ($userid < 0) {
$userid = 0;
}
$socid = GETPOST('socid', 'int'); if ($socid < 0) {
$socid = 0;
}
// Security check
if ($user->socid > 0) {
@ -209,7 +213,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// Show graphs
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
if ($mesg) { print $mesg; } else {
if ($mesg) {
print $mesg;
} else {
print $px1->show();
print "<br>\n";
print $px2->show();

View File

@ -50,14 +50,20 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$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;
// Default sort order (if not yet defined by previous GETPOST)
if (!$sortfield) $sortfield = "c.rowid";
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) {
$sortfield = "c.rowid";
}
if (!$sortorder) {
$sortorder = "DESC";
}
// Security check
@ -150,7 +156,9 @@ if (empty($reshook) && $action == 'setuserid' && ($user->rights->user->self->cre
if (!$error) {
if ($_POST["userid"] != $object->user_id) { // If link differs from currently in database
$result = $object->setUserId($_POST["userid"]);
if ($result < 0) dol_print_error('', $object->error);
if ($result < 0) {
dol_print_error('', $object->error);
}
$_POST['action'] = '';
$action = '';
}
@ -178,7 +186,9 @@ if (empty($reshook) && $action == 'setsocid') {
if (!$error) {
$result = $object->setThirdPartyId(GETPOST('socid', 'int'));
if ($result < 0) dol_print_error('', $object->error);
if ($result < 0) {
dol_print_error('', $object->error);
}
$_POST['action'] = '';
$action = '';
}
@ -423,25 +433,37 @@ llxHeader("", $title, $helpurl);
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$param .= '&id='.$rowid;
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
// Add $param from extra fields
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
if ($rowid > 0) {
$res = $object->fetch($rowid);
if ($res < 0) { dol_print_error($db, $object->error); exit; }
if ($res < 0) {
dol_print_error($db, $object->error); exit;
}
$adht->fetch($object->typeid);
$head = member_prepare_head($object);
$rowspan = 10;
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++;
}
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -525,10 +547,14 @@ if ($rowid > 0) {
} else {
if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
if ($object->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
} else {
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
if ($object->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
}
}
print '</td></tr>';
@ -539,7 +565,9 @@ if ($rowid > 0) {
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty");
print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td colspan="2" class="valeur">';
if ($action == 'editthirdparty') {
@ -585,7 +613,9 @@ if ($rowid > 0) {
} else {
if ($object->user_id) {
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none');
} else print $langs->trans("NoDolibarrAccess");
} else {
print $langs->trans("NoDolibarrAccess");
}
}
print '</td></tr>';
@ -608,8 +638,11 @@ if ($rowid > 0) {
if ($action != 'addsubscription' && $action != 'create_thirdparty') {
print '<div class="tabsAction">';
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
if ($object->statut > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
}
print '</div>';
}
@ -712,7 +745,9 @@ if ($rowid > 0) {
if (empty($num)) {
$colspan = 6;
if (!empty($conf->banque->enabled)) $colspan++;
if (!empty($conf->banque->enabled)) {
$colspan++;
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
@ -749,13 +784,23 @@ if ($rowid > 0) {
$invoiceonly = 0; // 1 means option by default is invoice only
$bankviainvoice = 0; // 1 means option by default is write to bank via invoice
if (GETPOST('paymentsave')) {
if (GETPOST('paymentsave') == 'bankdirect') $bankdirect = 1;
if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly = 1;
if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice = 1;
if (GETPOST('paymentsave') == 'bankdirect') {
$bankdirect = 1;
}
if (GETPOST('paymentsave') == 'invoiceonly') {
$invoiceonly = 1;
}
if (GETPOST('paymentsave') == 'bankviainvoice') {
$bankviainvoice = 1;
}
} else {
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $bankviainvoice = 1;
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) $bankdirect = 1;
elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $invoiceonly = 1;
if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
$bankviainvoice = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) {
$bankdirect = 1;
} elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) {
$invoiceonly = 1;
}
}
print "\n\n<!-- Form add subscription -->\n";
@ -789,7 +834,9 @@ if ($rowid > 0) {
}
});
';
if (GETPOST('paymentsave')) print '$("#'.GETPOST('paymentsave').'").prop("checked",true);';
if (GETPOST('paymentsave')) {
print '$("#'.GETPOST('paymentsave').'").prop("checked",true);';
}
print '});';
print '</script>'."\n";
}
@ -802,10 +849,14 @@ if ($rowid > 0) {
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
@ -886,7 +937,9 @@ if ($rowid > 0) {
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td><input name="label" type="text" size="32" value="';
if (empty($conf->global->MEMBER_NO_DEFAULT_LABEL)) print $langs->trans("Subscription").' '.dol_print_date(($datefrom ? $datefrom : time()), "%Y");
if (empty($conf->global->MEMBER_NO_DEFAULT_LABEL)) {
print $langs->trans("Subscription").' '.dol_print_date(($datefrom ? $datefrom : time()), "%Y");
}
print '"></td></tr>';
// Complementary action
@ -914,16 +967,21 @@ if ($rowid > 0) {
print '<input type="radio" class="moreaction" id="invoiceonly" name="paymentsave" value="invoiceonly"'.(!empty($invoiceonly) ? ' checked' : '');
//if (empty($object->fk_soc)) print ' disabled';
print '> '.$langs->trans("MoreActionInvoiceOnly");
if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
else {
if ($object->fk_soc) {
print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
} else {
print ' (';
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
if (empty($object->fk_soc)) {
print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
}
print $langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
@ -943,13 +1001,17 @@ if ($rowid > 0) {
print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')';
} else {
print ' (';
if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
if (empty($object->fk_soc)) {
print img_warning($langs->trans("NoThirdPartyAssociatedToMember"));
}
print $langs->trans("NoThirdPartyAssociatedToMember");
print ' - <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">';
print $langs->trans("CreateDolibarrThirdParty");
print '</a>)';
}
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') {
print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
}
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) {
$prodtmp = new Product($db);
$result = $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);

View File

@ -48,8 +48,9 @@ $note = GETPOST('note', 'alpha');
$typeid = (int) GETPOST('typeid', 'int');
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
if (!$user->rights->adherent->cotisation->lire)
if (!$user->rights->adherent->cotisation->lire) {
accessforbidden();
}
$permissionnote = $user->rights->adherent->cotisation->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->adherent->cotisation->creer; // Used by the include of actions_dellink.inc.php
@ -65,7 +66,9 @@ $result = restrictedArea($user, 'subscription', 0); // TODO Check on object id
* Actions
*/
if ($cancel) $action = '';
if ($cancel) {
$action = '';
}
//include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
@ -122,7 +125,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
$errmsg = $object->error;
} else {
foreach ($object->errors as $error) {
if ($errmsg) $errmsg .= '<br>';
if ($errmsg) {
$errmsg .= '<br>';
}
$errmsg .= $error;
}
}
@ -269,7 +274,9 @@ if ($rowid && $action != 'edit') {
//$formquestion=array();
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
$text = $langs->trans("ConfirmDeleteSubscription");
if (!empty($conf->banque->enabled) && !empty($conf->global->ADHERENT_BANK_USE)) $text .= '<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
if (!empty($conf->banque->enabled) && !empty($conf->global->ADHERENT_BANK_USE)) {
$text .= '<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
}
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("DeleteSubscription"), $text, "confirm_delete", $formquestion, 0, 1);
}
@ -342,9 +349,9 @@ if ($rowid && $action != 'edit') {
print dol_get_fiche_end();
/*
* Barre d'actions
*
*/
* Barre d'actions
*
*/
print '<div class="tabsAction">';
if ($user->rights->adherent->cotisation->creer) {
@ -368,15 +375,15 @@ if ($rowid && $action != 'edit') {
// Documents generes
/*
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
$genallowed = $user->rights->facture->lire;
$delallowed = $user->rights->facture->creer;
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
$genallowed = $user->rights->facture->lire;
$delallowed = $user->rights->facture->creer;
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
$somethingshown = $formfile->numoffiles;
*/
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
$somethingshown = $formfile->numoffiles;
*/
// Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
$somethingshown = $form->showLinkedObjectBlock($object, '');
@ -384,16 +391,16 @@ if ($rowid && $action != 'edit') {
// Show links to link elements
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
*/
*/
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
/*
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
*/
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
*/
print '</div></div></div>';
}

View File

@ -31,8 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "members", "bills", "users"));
if (!$user->rights->adherent->lire)
if (!$user->rights->adherent->lire) {
accessforbidden();
}
$rowid = GETPOST("rowid", 'int');

View File

@ -55,12 +55,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 = "DESC"; }
if (!$sortfield) { $sortfield = "c.dateadh"; }
if (!$sortorder) {
$sortorder = "DESC";
}
if (!$sortfield) {
$sortfield = "c.dateadh";
}
$object = new Subscription($db);
@ -102,12 +108,18 @@ $result = restrictedArea($user, 'adherent', '', '', 'cotisation');
* 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
@ -157,16 +169,33 @@ if (isset($date_select) && $date_select != '') {
$sql .= " AND c.dateadh < '".((int) $date_select + 1)."-01-01 00:00:00'";
}
if ($search_ref) {
if (is_numeric($search_ref)) $sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
else $sql .= " AND 1 = 2"; // Always wrong
if (is_numeric($search_ref)) {
$sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
} else {
$sql .= " AND 1 = 2"; // Always wrong
}
}
if ($search_type) {
$sql .= natural_search(array('c.fk_type'), $search_type);
}
if ($search_lastname) {
$sql .= natural_search(array('d.lastname', 'd.societe'), $search_lastname);
}
if ($search_firstname) {
$sql .= natural_search(array('d.firstname'), $search_firstname);
}
if ($search_login) {
$sql .= natural_search('d.login', $search_login);
}
if ($search_note) {
$sql .= natural_search('c.note', $search_note);
}
if ($search_account > 0) {
$sql .= " AND b.fk_account = ".urldecode($search_account);
}
if ($search_amount) {
$sql .= natural_search('c.subscription', $search_amount, 1);
}
if ($search_type) $sql .= natural_search(array('c.fk_type'), $search_type);
if ($search_lastname) $sql .= natural_search(array('d.lastname', 'd.societe'), $search_lastname);
if ($search_firstname) $sql .= natural_search(array('d.firstname'), $search_firstname);
if ($search_login) $sql .= natural_search('d.login', $search_login);
if ($search_note) $sql .= natural_search('c.note', $search_note);
if ($search_account > 0) $sql .= " AND b.fk_account = ".urldecode($search_account);
if ($search_amount) $sql .= natural_search('c.subscription', $search_amount, 1);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -182,8 +211,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;
@ -215,19 +247,41 @@ llxHeader('', $langs->trans("ListOfSubscriptions"), $help_url);
$i = 0;
$title = $langs->trans("ListOfSubscriptions");
if (!empty($date_select)) $title .= ' ('.$langs->trans("Year").' '.$date_select.')';
if (!empty($date_select)) {
$title .= ' ('.$langs->trans("Year").' '.$date_select.')';
}
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($statut != '') $param .= "&statut=".urlencode($statut);
if ($search_type) $param .= "&search_type=".urlencode($search_type);
if ($date_select) $param .= "&date_select=".urlencode($date_select);
if ($search_lastname) $param .= "&search_lastname=".urlencode($search_lastname);
if ($search_login) $param .= "&search_login=".urlencode($search_login);
if ($search_account) $param .= "&search_account=".urlencode($search_account);
if ($search_amount) $param .= "&search_amount=".urlencode($search_amount);
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 ($statut != '') {
$param .= "&statut=".urlencode($statut);
}
if ($search_type) {
$param .= "&search_type=".urlencode($search_type);
}
if ($date_select) {
$param .= "&date_select=".urlencode($date_select);
}
if ($search_lastname) {
$param .= "&search_lastname=".urlencode($search_lastname);
}
if ($search_login) {
$param .= "&search_login=".urlencode($search_login);
}
if ($search_account) {
$param .= "&search_account=".urlencode($search_account);
}
if ($search_amount) {
$param .= "&search_amount=".urlencode($search_amount);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -237,7 +291,9 @@ $arrayofmassactions = array(
//'builddoc'=>$langs->trans("PDFMerge"),
);
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
if (in_array($massaction, array('presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$newcardbutton = '';
@ -246,7 +302,9 @@ if ($user->rights->adherent->cotisation->creer) {
}
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -263,7 +321,9 @@ $trackid = 'sub'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) {
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
}
@ -271,7 +331,9 @@ $moreforfilter = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
print '<div class="div-table-responsive">';
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -366,16 +428,36 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
if (!empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
if (!empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
if (!empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['d.ref']['checked'])) {
print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.fk_type']['checked'])) {
print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.lastname']['checked'])) {
print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.firstname']['checked'])) {
print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.login']['checked'])) {
print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.libelle']['checked'])) {
print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.bank']['checked'])) {
print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['c.dateadh']['checked'])) {
print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
}
if (!empty($arrayfields['c.datef']['checked'])) {
print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
}
if (!empty($arrayfields['d.amount']['checked'])) {
print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -384,8 +466,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (!empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (!empty($arrayfields['c.datec']['checked'])) {
print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
if (!empty($arrayfields['c.tms']['checked'])) {
print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n";
@ -420,7 +506,9 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['d.ref']['checked'])) {
print '<td>'.$subscription->getNomUrl(1).'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Type
if (!empty($arrayfields['d.fk_type']['checked'])) {
@ -429,24 +517,32 @@ while ($i < min($num, $limit)) {
print $adht->getNomUrl(1);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Lastname
if (!empty($arrayfields['d.lastname']['checked'])) {
print '<td>'.$adherent->getNomUrl(-1, 0, 'card', 'lastname').'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Firstname
if (!empty($arrayfields['d.firstname']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->firstname).'">'.$adherent->firstname.'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Login
if (!empty($arrayfields['d.login']['checked'])) {
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($adherent->login).'">'.$adherent->login.'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Label
@ -454,7 +550,9 @@ while ($i < min($num, $limit)) {
print '<td>';
print dol_trunc($obj->note, 128);
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Banque
@ -467,24 +565,34 @@ while ($i < min($num, $limit)) {
print $accountstatic->getNomUrl(1);
}
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date start
if (!empty($arrayfields['c.dateadh']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date end
if (!empty($arrayfields['c.datef']['checked'])) {
print '<td class="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Price
if (!empty($arrayfields['d.amount']['checked'])) {
print '<td class="right">'.price($obj->subscription).'</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
if (!$i) {
$totalarray['nbfield']++;
}
if (!$i) {
$totalarray['pos'][$totalarray['nbfield']] = 'd.amount';
}
$totalarray['val']['d.amount'] += $obj->subscription;
}
// Extra fields
@ -498,24 +606,32 @@ while ($i < min($num, $limit)) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Date modification
if (!empty($arrayfields['c.tms']['checked'])) {
print '<td class="nowrap center">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
}
// Action column
print '<td class="center">';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
if (in_array($obj->rowid, $arrayofselected)) {
$selected = 1;
}
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) {
$totalarray['nbfield']++;
}
print "</tr>\n";
$i++;
@ -528,7 +644,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0) {
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}

View File

@ -52,12 +52,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 = "DESC"; }
if (!$sortfield) { $sortfield = "d.lastname"; }
if (!$sortorder) {
$sortorder = "DESC";
}
if (!$sortfield) {
$sortfield = "d.lastname";
}
$label = GETPOST("label", "alpha");
$morphy = GETPOST("morphy", "alpha");
@ -118,7 +124,9 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
if ($ret < 0) {
$error++;
}
if (empty($object->label)) {
$error++;
@ -167,7 +175,9 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++;
if ($ret < 0) {
$error++;
}
$ret = $object->update($user);
@ -222,8 +232,12 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$i = 0;
$param = '';
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;
}
$newcardbutton = '';
if ($user->rights->adherent->configurer) {
@ -231,7 +245,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -273,14 +289,20 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorAndPhy");
if ($objp->morphy == 'phy') {
print $langs->trans("Physical");
} elseif ($objp->morphy == 'mor') {
print $langs->trans("Moral");
} else {
print $langs->trans("MorAndPhy");
}
print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer)
if ($user->rights->adherent->configurer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
else {
} else {
print '<td class="right">&nbsp;</td>';
}
print "</tr>";
@ -318,19 +340,19 @@ if ($action == 'create') {
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1);
print '</td></tr>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1);
print '</td></tr>';
// Morphy
$morphys = array();
$morphys[""] = $langs->trans("MorAndPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys = array();
$morphys[""] = $langs->trans("MorAndPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MembersNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription", 1, 1);
print '</td></tr>';
@ -485,8 +507,8 @@ if ($rowid > 0) {
}
if ($action == 'search') {
if (GETPOST('search', 'alpha')) {
$sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
}
$sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
}
}
if (!empty($search_lastname)) {
$sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
@ -510,8 +532,11 @@ if ($rowid > 0) {
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db);
if ($resql) {
$nbtotalofrecords = $db->num_rows($result);
} 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;
@ -551,12 +576,24 @@ if ($rowid > 0) {
}
$param = "&rowid=".$object->id;
if (!empty($status)) $param .= "&status=".$status;
if (!empty($search_lastname)) $param .= "&search_lastname=".$search_lastname;
if (!empty($search_firstname)) $param .= "&search_firstname=".$search_firstname;
if (!empty($search_login)) $param .= "&search_login=".$search_login;
if (!empty($search_email)) $param .= "&search_email=".$search_email;
if (!empty($filter)) $param .= "&filter=".$filter;
if (!empty($status)) {
$param .= "&status=".$status;
}
if (!empty($search_lastname)) {
$param .= "&search_lastname=".$search_lastname;
}
if (!empty($search_firstname)) {
$param .= "&search_firstname=".$search_firstname;
}
if (!empty($search_login)) {
$param .= "&search_login=".$search_login;
}
if (!empty($search_email)) {
$param .= "&search_email=".$search_email;
}
if (!empty($filter)) {
$param .= "&filter=".$filter;
}
if ($sall) {
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
@ -633,10 +670,10 @@ if ($rowid > 0) {
// Type
/*print '<td class="nowrap">';
$membertypestatic->id=$objp->type_id;
$membertypestatic->label=$objp->type;
print $membertypestatic->getNomUrl(1,12);
print '</td>';
$membertypestatic->id=$objp->type_id;
$membertypestatic->label=$objp->type;
print $membertypestatic->getNomUrl(1,12);
print '</td>';
*/
// Moral/Physique
@ -663,7 +700,9 @@ if ($rowid > 0) {
print '<td class="nowrap left">';
if ($objp->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived");
if ($objp->status > 0) print " ".img_warning();
if ($objp->status > 0) {
print " ".img_warning();
}
} else {
print '&nbsp;';
}

View File

@ -51,7 +51,9 @@ $hookmanager->initHooks(array('membertypeldapcard', 'globalcard'));
$parameters = array();
$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 ($action == 'dolibarr2ldap') {
@ -128,7 +130,9 @@ if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
print "</div>\n";
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) print "<br>\n";
if ($conf->global->LDAP_MEMBER_TYPE_ACTIVE == 1) {
print "<br>\n";
}

View File

@ -42,7 +42,9 @@ $ref = GETPOST('ref', 'alphanohtml');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if ($user->socid) $socid = $user->socid;
if ($user->socid) {
$socid = $user->socid;
}
// Security check
$result = restrictedArea($user, 'adherent', $id, 'adherent_type');
@ -184,7 +186,9 @@ print "\n<div class=\"tabsAction\">\n";
if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
if ($cnt_trans > 0) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
}
}
}
@ -242,7 +246,9 @@ if ($action == 'edit') {
print '</div>';
}
}
if (!$cnt_trans && $action != 'add') print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
if (!$cnt_trans && $action != 'add') {
print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
}
}

View File

@ -30,7 +30,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog"));
if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
if (!$user->admin || empty($conf->blockedlog->enabled)) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
@ -43,14 +45,14 @@ $withtab = GETPOST('withtab', 'int');
*/
$reg = array();
if (preg_match('/set_(.*)/', $action, $reg))
{
if (preg_match('/set_(.*)/', $action, $reg)) {
$code = $reg[1];
$values = GETPOST($code);
if (is_array($values)) $values = implode(',', $values);
if (is_array($values)) {
$values = implode(',', $values);
}
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0)
{
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) {
header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : ''));
exit;
} else {
@ -58,11 +60,9 @@ if (preg_match('/set_(.*)/', $action, $reg))
}
}
if (preg_match('/del_(.*)/', $action, $reg))
{
if (preg_match('/del_(.*)/', $action, $reg)) {
$code = $reg[1];
if (dolibarr_del_const($db, $code, 0) > 0)
{
if (dolibarr_del_const($db, $code, 0) > 0) {
Header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : ''));
exit;
} else {
@ -142,10 +142,8 @@ $sql .= " WHERE active > 0";
$countryArray = array();
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
}
}
@ -163,8 +161,7 @@ print '<tr class="oddeven">';
print '<td class="titlefield">';
print $langs->trans("ListOfTrackedEvents").'</td><td>';
$arrayoftrackedevents = $block_static->trackedevents;
foreach ($arrayoftrackedevents as $key => $val)
{
foreach ($arrayoftrackedevents as $key => $val) {
print $key.' - '.$langs->trans($val).'<br>';
}
@ -174,8 +171,7 @@ print '</tr>';
print '</table>';
if ($withtab)
{
if ($withtab) {
print dol_get_fiche_end();
}

View File

@ -33,7 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog", "bills"));
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
accessforbidden();
}
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search
@ -41,32 +43,46 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_showonlyerrors = GETPOST('search_showonlyerrors', 'int');
if ($search_showonlyerrors < 0) $search_showonlyerrors = 0;
if ($search_showonlyerrors < 0) {
$search_showonlyerrors = 0;
}
$search_id = GETPOST('search_id', 'alpha');
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
$search_start = -1;
if (GETPOST('search_startyear') != '') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
if (GETPOST('search_startyear') != '') {
$search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));
}
$search_end = -1;
if (GETPOST('search_endyear') != '') $search_end = dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
if (GETPOST('search_endyear') != '') {
$search_end = dol_mktime(23, 59, 59, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));
}
$search_code = GETPOST('search_code', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth')) $search_start = dol_time_plus_duree(dol_now(), '-1', 'w');
if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_startmonth')) {
$search_start = dol_time_plus_duree(dol_now(), '-1', 'w');
}
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$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 (empty($sortfield)) $sortfield = 'rowid';
if (empty($sortorder)) $sortorder = 'DESC';
if (empty($sortfield)) {
$sortfield = 'rowid';
}
if (empty($sortorder)) {
$sortorder = 'DESC';
}
$block_static = new BlockedLog($db);
$block_static->loadTrackedEvents();
@ -76,8 +92,7 @@ $result = restrictedArea($user, 'blockedlog', 0, '');
$max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport)
{
if ($max_time && $max_time < $max_execution_time_for_importexport) {
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
}
@ -88,8 +103,7 @@ if ($max_time && $max_time < $max_execution_time_for_importexport)
*/
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_id = '';
$search_fk_user = '';
$search_start = -1;
@ -120,14 +134,12 @@ if ($action === 'downloadblockchain') {
$previoushash = '';
$firstid = '';
if (!$error)
{
if (!$error) {
// Get ID of first line
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".$conf->entity;
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0)
{
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) {
$dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1);
$datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12);
$sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
@ -136,12 +148,10 @@ if ($action === 'downloadblockchain') {
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res)
{
if ($res) {
// Make the first fetch to get first line
$obj = $db->fetch_object($res);
if ($obj)
{
if ($obj) {
$previoushash = $block_static->getPreviousHash(0, $obj->rowid);
$firstid = $obj->rowid;
} else { // If not data found for filter, we do not need previoushash neither firstid
@ -154,14 +164,12 @@ if ($action === 'downloadblockchain') {
}
}
if (!$error)
{
if (!$error) {
// Now restart request with all data = no limit(1) in sql request
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".$conf->entity;
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0)
{
if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) {
$dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1);
$datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12);
$sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
@ -169,8 +177,7 @@ if ($action === 'downloadblockchain') {
$sql .= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature()
$res = $db->query($sql);
if ($res)
{
if ($res) {
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"unalterable-log-archive-".$dolibarr_main_db_name."-".(GETPOST('yeartoexport', 'int') > 0 ? GETPOST('yeartoexport', 'int').(GETPOST('monthtoexport', 'int') > 0 ?sprintf("%02d", GETPOST('monthtoexport', 'int')) : '').'-' : '').$previoushash.".csv\"");
@ -193,8 +200,7 @@ if ($action === 'downloadblockchain') {
$loweridinerror = 0;
$i = 0;
while ($obj = $db->fetch_object($res))
{
while ($obj = $db->fetch_object($res)) {
// We set here all data used into signature calculation (see checkSignature method) and more
// IMPORTANT: We must have here, the same rule for transformation of data than into the fetch method (db->jdate for date, ...)
$block_static->id = $obj->rowid;
@ -213,19 +219,20 @@ if ($action === 'downloadblockchain') {
$checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it
if ($checksignature)
{
if ($checksignature) {
$statusofrecord = 'Valid';
if ($loweridinerror > 0) $statusofrecordnote = 'ValidButFoundAPreviousKO';
else $statusofrecordnote = '';
if ($loweridinerror > 0) {
$statusofrecordnote = 'ValidButFoundAPreviousKO';
} else {
$statusofrecordnote = '';
}
} else {
$statusofrecord = 'KO';
$statusofrecordnote = 'LineCorruptedOrNotMatchingPreviousOne';
$loweridinerror = $obj->rowid;
}
if ($i == 0)
{
if ($i == 0) {
$statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote ? ' - '.$statusofrecordnote : '');
}
print $obj->rowid;
@ -263,8 +270,7 @@ if ($action === 'downloadblockchain') {
$form = new Form($db);
if (GETPOST('withtab', 'alpha'))
{
if (GETPOST('withtab', 'alpha')) {
$title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog');
} else {
$title = $langs->trans("BrowseBlockedLog");
@ -275,10 +281,8 @@ llxHeader('', $langs->trans("BrowseBlockedLog"));
$MAXLINES = 10000;
$blocks = $block_static->getLog('all', $search_id, $MAXLINES, $sortfield, $sortorder, $search_fk_user, $search_start, $search_end, $search_ref, $search_amount, $search_code);
if (!is_array($blocks))
{
if ($blocks == -2)
{
if (!is_array($blocks)) {
if ($blocks == -2) {
setEventMessages($langs->trans("TooManyRecordToScanRestrictFilters", $MAXLINES), null, 'errors');
} else {
dol_print_error($block_static->db, $block_static->error, $block_static->errors);
@ -287,15 +291,13 @@ if (!is_array($blocks))
}
$linkback = '';
if (GETPOST('withtab', 'alpha'))
{
if (GETPOST('withtab', 'alpha')) {
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
}
print load_fiche_titre($title, $linkback);
if (GETPOST('withtab', 'alpha'))
{
if (GETPOST('withtab', 'alpha')) {
$head = blockedlogadmin_prepare_head();
print dol_get_fiche_head($head, 'fingerprints', '', -1);
}
@ -305,19 +307,45 @@ print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("Fingerprint
print '<br>';
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_id != '') $param .= '&search_id='.urlencode($search_id);
if ($search_fk_user > 0) $param .= '&search_fk_user='.urlencode($search_fk_user);
if ($search_startyear > 0) $param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
if ($search_startmonth > 0) $param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
if ($search_startday > 0) $param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int'));
if ($search_endyear > 0) $param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int'));
if ($search_endmonth > 0) $param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int'));
if ($search_endday > 0) $param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int'));
if ($search_showonlyerrors > 0) $param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if (GETPOST('withtab', 'alpha')) $param .= '&withtab='.urlencode(GETPOST('withtab', 'alpha'));
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
if ($search_id != '') {
$param .= '&search_id='.urlencode($search_id);
}
if ($search_fk_user > 0) {
$param .= '&search_fk_user='.urlencode($search_fk_user);
}
if ($search_startyear > 0) {
$param .= '&search_startyear='.urlencode(GETPOST('search_startyear', 'int'));
}
if ($search_startmonth > 0) {
$param .= '&search_startmonth='.urlencode(GETPOST('search_startmonth', 'int'));
}
if ($search_startday > 0) {
$param .= '&search_startday='.urlencode(GETPOST('search_startday', 'int'));
}
if ($search_endyear > 0) {
$param .= '&search_endyear='.urlencode(GETPOST('search_endyear', 'int'));
}
if ($search_endmonth > 0) {
$param .= '&search_endmonth='.urlencode(GETPOST('search_endmonth', 'int'));
}
if ($search_endday > 0) {
$param .= '&search_endday='.urlencode(GETPOST('search_endday', 'int'));
}
if ($search_showonlyerrors > 0) {
$param .= '&search_showonlyerrors='.urlencode($search_showonlyerrors);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if (GETPOST('withtab', 'alpha')) {
$param .= '&withtab='.urlencode(GETPOST('withtab', 'alpha'));
}
// Add $param from extra fields
//include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -332,8 +360,7 @@ $smonth = GETPOST('monthtoexport', 'int');
$retstring = '';
$retstring .= '<select class="flat valignmiddle maxwidth75imp marginrightonly" id="monthtoexport" name="monthtoexport">';
$retstring .= '<option value="0" selected>&nbsp;</option>';
for ($month = 1; $month <= 12; $month++)
{
for ($month = 1; $month <= 12; $month++) {
$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
$retstring .= "</option>";
@ -343,7 +370,9 @@ print $retstring;
print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOST('yeartoexport', 'int').'">';
print '<input type="hidden" name="withtab" value="'.GETPOST('withtab', 'alpha').'">';
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab', 'alpha') ? '&withtab='.GETPOST('withtab', 'alpha') : '').'">'.$langs->trans('DownloadBlockChain').'</a>';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab', 'alpha') ? '&withtab='.GETPOST('withtab', 'alpha') : '').'">'.$langs->trans('DownloadBlockChain').'</a>';
}
print ' </div><br>';
print '</form>';
@ -352,7 +381,9 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
@ -446,10 +477,8 @@ if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) {
$loweridinerror = 0;
$checkresult = array();
$checkdetail = array();
if (is_array($blocks))
{
foreach ($blocks as &$block)
{
if (is_array($blocks)) {
foreach ($blocks as &$block) {
$tmpcheckresult = $block->checkSignature('', 1); // Note: this make a sql request at each call, we can't avoid this as the sorting order is various
$checksignature = $tmpcheckresult['checkresult'];
@ -457,26 +486,25 @@ if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) {
$checkresult[$block->id] = $checksignature; // false if error
$checkdetail[$block->id] = $tmpcheckresult;
if (!$checksignature)
{
if (empty($loweridinerror)) $loweridinerror = $block->id;
else $loweridinerror = min($loweridinerror, $block->id);
if (!$checksignature) {
if (empty($loweridinerror)) {
$loweridinerror = $block->id;
} else {
$loweridinerror = min($loweridinerror, $block->id);
}
}
}
}
}
if (is_array($blocks))
{
if (is_array($blocks)) {
$nbshown = 0;
$MAXFORSHOWLINK = 100;
$object_link = '';
foreach ($blocks as &$block)
{
foreach ($blocks as &$block) {
//if (empty($search_showonlyerrors) || ! $checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror))
if (empty($search_showonlyerrors) || !$checkresult[$block->id])
{
if (empty($search_showonlyerrors) || !$checkresult[$block->id]) {
$nbshown++;
if ($nbshown < $MAXFORSHOWLINK) { // For performance and memory purpose, we get/show the link of objects only for the 100 first output
@ -485,72 +513,71 @@ if (is_array($blocks))
$object_link = $block->element.'/'.$block->fk_object;
}
print '<tr class="oddeven">';
print '<tr class="oddeven">';
// ID
print '<td>'.$block->id.'</td>';
// ID
print '<td>'.$block->id.'</td>';
// Date
print '<td>'.dol_print_date($block->date_creation, 'dayhour').'</td>';
// Date
print '<td>'.dol_print_date($block->date_creation, 'dayhour').'</td>';
// User
print '<td>';
//print $block->getUser()
print $block->user_fullname;
print '</td>';
print '<td>';
//print $block->getUser()
print $block->user_fullname;
print '</td>';
// Action
print '<td>'.$langs->trans('log'.$block->action).'</td>';
// Action
print '<td>'.$langs->trans('log'.$block->action).'</td>';
// Ref
print '<td class="nowraponall">';
print $block->ref_object;
print '</td>';
// Ref
print '<td class="nowraponall">';
print $block->ref_object;
print '</td>';
// Link to source object
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
// Link to source object
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
// Amount
print '<td class="right nowraponall">'.price($block->amounts).'</td>';
// Amount
print '<td class="right nowraponall">'.price($block->amounts).'</td>';
// Details link
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
// Details link
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
// Fingerprint
print '<td class="nowrap">';
$texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':<br>'.$block->signature;
$texttoshow .= '<br><br>'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):<br>'.$checkdetail[$block->id]['calculatedsignature'];
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
//$texttoshow .= '<br>keyforsignature='.$checkdetail[$block->id]['keyforsignature'];
print $form->textwithpicto(dol_trunc($block->signature, '8'), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>';
// Fingerprint
print '<td class="nowrap">';
$texttoshow = $langs->trans("Fingerprint").' - '.$langs->trans("Saved").':<br>'.$block->signature;
$texttoshow .= '<br><br>'.$langs->trans("Fingerprint").' - Recalculated sha256(previoushash * data):<br>'.$checkdetail[$block->id]['calculatedsignature'];
$texttoshow .= '<br><span class="opacitymedium">'.$langs->trans("PreviousHash").'='.$checkdetail[$block->id]['previoushash'].'</span>';
//$texttoshow .= '<br>keyforsignature='.$checkdetail[$block->id]['keyforsignature'];
print $form->textwithpicto(dol_trunc($block->signature, '8'), $texttoshow, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>';
// Status
print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
{
if ($checkresult[$block->id]) {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidityButChainIsKo').'">OK</span>';
}
else {
print '<span class="badge badge-status8 badge-status" title="'.$langs->trans('KoCheckFingerprintValidity').'">KO</span>';
}
} else {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
}
print '</td>';
// Status
print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
if ($checkresult[$block->id]) {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidityButChainIsKo').'">OK</span>';
} else {
print '<span class="badge badge-status8 badge-status" title="'.$langs->trans('KoCheckFingerprintValidity').'">KO</span>';
}
} else {
print '<span class="badge badge-status4 badge-status" title="'.$langs->trans('OkCheckFingerprintValidity').'">OK</span>';
}
print '</td>';
// Note
print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) // If error
{
if ($checkresult[$block->id]) print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
}
// Note
print '<td class="center">';
if (!$checkresult[$block->id] || ($loweridinerror && $block->id >= $loweridinerror)) { // If error
if ($checkresult[$block->id]) {
print $form->textwithpicto('', $langs->trans('OkCheckFingerprintValidityButChainIsKo'));
}
}
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black'));
}
print '</td>';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black'));
}
print '</td>';
print '<td></td>';
@ -598,8 +625,7 @@ jQuery(document).ready(function () {
</script>'."\n";
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL))
{
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
?>
<script type="text/javascript">
@ -618,11 +644,10 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->glob
});
</script>
<?php
<?php
}
if (GETPOST('withtab', 'alpha'))
{
if (GETPOST('withtab', 'alpha')) {
print dol_get_fiche_end();
}

View File

@ -26,9 +26,15 @@
// This script is called with a POST method.
// Directory to scan (full path) is inside POST['dir'].
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
$res = require '../../master.inc.php';

View File

@ -26,9 +26,15 @@
// This script is called with a POST method.
// Directory to scan (full path) is inside POST['dir'].
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
$res = require '../../main.inc.php';

View File

@ -26,9 +26,15 @@
// This script is called with a POST method.
// Directory to scan (full path) is inside POST['dir'].
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
require '../../main.inc.php';
@ -37,7 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$id = GETPOST('id', 'int');
$block = new BlockedLog($db);
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) {
accessforbidden();
}
$langs->loadLangs(array("admin"));
@ -49,8 +57,7 @@ $langs->loadLangs(array("admin"));
print '<div id="pop-info"><table width="100%" height="80%" class="border"><thead><th width="50%" class="left">'.$langs->trans('Field').'</th><th class="left">'.$langs->trans('Value').'</th></thead>';
print '<tbody>';
if ($block->fetch($id) > 0)
{
if ($block->fetch($id) > 0) {
$objtoshow = $block->object_data;
print formatObject($objtoshow, '');
} else {
@ -77,18 +84,14 @@ function formatObject($objtoshow, $prefix)
$newobjtoshow = $objtoshow;
if (is_object($newobjtoshow) || is_array($newobjtoshow))
{
if (is_object($newobjtoshow) || is_array($newobjtoshow)) {
//var_dump($newobjtoshow);
foreach ($newobjtoshow as $key => $val)
{
if (!is_object($val) && !is_array($val))
{
foreach ($newobjtoshow as $key => $val) {
if (!is_object($val) && !is_array($val)) {
// TODO $val can be '__PHP_Incomplete_Class', the is_object return false
$s .= '<tr><td>'.($prefix ? $prefix.' > ' : '').$key.'</td>';
$s .= '<td>';
if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep')))
{
if (in_array($key, array('date', 'datef', 'dateh', 'datec', 'datem', 'datep'))) {
/*var_dump(is_object($val));
var_dump(is_array($val));
var_dump(is_array($val));
@ -99,11 +102,9 @@ function formatObject($objtoshow, $prefix)
$s .= $val;
}
$s .= '</td></tr>';
} elseif (is_array($val))
{
} elseif (is_array($val)) {
$s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
} elseif (is_object($val))
{
} elseif (is_object($val)) {
$s .= formatObject($val, ($prefix ? $prefix.' > ' : '').$key);
}
}

View File

@ -26,14 +26,22 @@
// This script is called with a POST method.
// Directory to scan (full path) is inside POST['dir'].
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
require '../../main.inc.php';
if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) exit('BLOCKEDLOG_AUTHORITY_URL not set');
if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
exit('BLOCKEDLOG_AUTHORITY_URL not set');
}
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php';

View File

@ -122,7 +122,9 @@ class BlockedLogAuthority
public function checkBlock($block)
{
if (strlen($block) != 64) return false;
if (strlen($block) != 64) {
return false;
}
$blocks = str_split($this->blockchain, 64);
@ -148,8 +150,7 @@ class BlockedLogAuthority
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
if (empty($id) && empty($signature))
{
if (empty($id) && empty($signature)) {
$this->error = 'BadParameter';
return -1;
}
@ -159,14 +160,15 @@ class BlockedLogAuthority
$sql = "SELECT b.rowid, b.signature, b.blockchain, b.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b";
if ($id) $sql .= " WHERE b.rowid = ".$id;
elseif ($signature)$sql .= " WHERE b.signature = '".$this->db->escape($signature)."'";
if ($id) {
$sql .= " WHERE b.rowid = ".$id;
} elseif ($signature) {
$sql .= " WHERE b.signature = '".$this->db->escape($signature)."'";
}
$resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
@ -216,12 +218,10 @@ class BlockedLogAuthority
$sql .= ")";
$res = $this->db->query($sql);
if ($res)
{
if ($res) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog_authority");
if ($id > 0)
{
if ($id > 0) {
$this->id = $id;
$this->db->commit();
@ -262,8 +262,7 @@ class BlockedLogAuthority
$sql .= " WHERE rowid=".$this->id;
$res = $this->db->query($sql);
if ($res)
{
if ($res) {
$this->db->commit();
return 1;

View File

@ -319,11 +319,9 @@ class BlockedLog
} else {
$this->error++;
}
} elseif ($this->action == 'MODULE_SET')
{
} elseif ($this->action == 'MODULE_SET') {
return '<i class="opacitymedium">System to track events into unalterable logs were enabled</i>';
} elseif ($this->action == 'MODULE_RESET')
{
} elseif ($this->action == 'MODULE_RESET') {
if ($this->signature == '0000000000') {
return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>';
} else {
@ -342,7 +340,9 @@ class BlockedLog
{
global $langs, $cachedUser;
if (empty($cachedUser))$cachedUser = array();
if (empty($cachedUser)) {
$cachedUser = array();
}
if (empty($cachedUser[$this->fk_user])) {
$u = new User($this->db);
@ -371,7 +371,9 @@ class BlockedLog
{
global $langs, $user, $mysoc;
if (is_object($fuser)) $user = $fuser;
if (is_object($fuser)) {
$user = $fuser;
}
// Generic fields
@ -380,20 +382,15 @@ class BlockedLog
// amount
$this->amounts = $amounts;
// date
if ($object->element == 'payment' || $object->element == 'payment_supplier')
{
if ($object->element == 'payment' || $object->element == 'payment_supplier') {
$this->date_object = $object->datepaye;
} elseif ($object->element == 'payment_salary')
{
} elseif ($object->element == 'payment_salary') {
$this->date_object = $object->datev;
} elseif ($object->element == 'payment_donation' || $object->element == 'payment_various')
{
} elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') {
$this->date_object = $object->datepaid ? $object->datepaid : $object->datep;
} elseif ($object->element == 'subscription')
{
} elseif ($object->element == 'subscription') {
$this->date_object = $object->dateh;
} elseif ($object->element == 'cashcontrol')
{
} elseif ($object->element == 'cashcontrol') {
$this->date_object = $object->date_creation;
} else {
$this->date_object = $object->date;
@ -424,70 +421,79 @@ class BlockedLog
'name', 'lastname', 'firstname', 'region', 'region_id', 'region_code', 'state', 'state_id', 'state_code', 'country', 'country_id', 'country_code',
'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2',
'barcode_type', 'barcode_type_code', 'barcode_type_label', 'barcode_type_coder', 'mode_reglement_id', 'cond_reglement_id', 'mode_reglement', 'cond_reglement', 'shipping_method_id',
'fk_incoterms', 'label_incoterms', 'location_incoterms', 'lines')
);
'fk_incoterms', 'label_incoterms', 'location_incoterms', 'lines'));
}
// Add thirdparty info
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) $object->fetch_thirdparty();
if (!empty($object->thirdparty))
{
if (empty($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) {
$object->fetch_thirdparty();
}
if (!empty($object->thirdparty)) {
$this->object_data->thirdparty = new stdClass();
foreach ($object->thirdparty as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
foreach ($object->thirdparty as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->thirdparty->{$key} = $value;
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->thirdparty->{$key} = $value;
}
}
}
// Add company info
if (!empty($mysoc))
{
if (!empty($mysoc)) {
$this->object_data->mycompany = new stdClass();
foreach ($mysoc as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
foreach ($mysoc as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->mycompany->{$key} = $value;
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->mycompany->{$key} = $value;
}
}
}
// Add user info
if (!empty($user))
{
if (!empty($user)) {
$this->fk_user = $user->id;
$this->user_fullname = $user->getFullName($langs);
}
// Field specific to object
if ($this->element == 'facture')
{
foreach ($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if ($this->element == 'facture') {
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'datev', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public', 'lines'
))) continue; // Discard if not into a dedicated list
if ($key == 'lines')
{
))) {
continue; // Discard if not into a dedicated list
}
if ($key == 'lines') {
$lineid = 0;
foreach ($value as $tmpline) // $tmpline is object FactureLine
{
foreach ($value as $tmpline) { // $tmpline is object FactureLine
$lineid++;
foreach ($tmpline as $keyline => $valueline)
{
foreach ($tmpline as $keyline => $valueline) {
if (!in_array($keyline, array(
'ref', 'multicurrency_code', 'multicurrency_total_ht', 'multicurrency_total_tva', 'multicurrency_total_ttc', 'qty', 'product_type', 'vat_src_code', 'tva_tx', 'info_bits', 'localtax1_tx', 'localtax2_tx', 'total_ht', 'total_tva', 'total_ttc', 'total_localtax1', 'total_localtax2'
))) continue; // Discard if not into a dedicated list
))) {
continue; // Discard if not into a dedicated list
}
if (empty($this->object_data->invoiceline[$lineid]) || !is_object($this->object_data->invoiceline[$lineid])) { // To avoid warning
$this->object_data->invoiceline[$lineid] = new stdClass();
@ -498,24 +504,33 @@ class BlockedLog
}
}
}
} elseif (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
} elseif (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
}
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
} elseif ($this->element == 'invoice_supplier')
{
foreach ($object as $key => $value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} elseif ($this->element == 'invoice_supplier') {
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
}
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
} elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various')
{
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various') {
$datepayment = $object->datepaye ? $object->datepaye : ($object->datepaid ? $object->datepaid : $object->datep);
$paymenttypeid = $object->paiementid ? $object->paiementid : ($object->paymenttype ? $object->paymenttype : $object->type_payment);
@ -523,53 +538,51 @@ class BlockedLog
$this->object_data->date = $datepayment;
$this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code');
if (!empty($object->num_payment)) $this->object_data->payment_num = $object->num_payment;
if (!empty($object->note_private)) $this->object_data->note_private = $object->note_private;
if (!empty($object->num_payment)) {
$this->object_data->payment_num = $object->num_payment;
}
if (!empty($object->note_private)) {
$this->object_data->note_private = $object->note_private;
}
//$this->object_data->fk_account = $object->fk_account;
//var_dump($this->object_data);exit;
$totalamount = 0;
if (!is_array($object->amounts) && $object->amount)
{
if (!is_array($object->amounts) && $object->amount) {
$object->amounts = array($object->id => $object->amount);
}
$paymentpartnumber = 0;
foreach ($object->amounts as $objid => $amount)
{
if (empty($amount)) continue;
foreach ($object->amounts as $objid => $amount) {
if (empty($amount)) {
continue;
}
$totalamount += $amount;
$tmpobject = null;
if ($this->element == 'payment_supplier')
{
if ($this->element == 'payment_supplier') {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$tmpobject = new FactureFournisseur($this->db);
} elseif ($this->element == 'payment')
{
} elseif ($this->element == 'payment') {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobject = new Facture($this->db);
} elseif ($this->element == 'payment_donation')
{
} elseif ($this->element == 'payment_donation') {
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$tmpobject = new Don($this->db);
} elseif ($this->element == 'payment_various')
{
} elseif ($this->element == 'payment_various') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
$tmpobject = new PaymentVarious($this->db);
}
if (!is_object($tmpobject))
{
if (!is_object($tmpobject)) {
continue;
}
$result = $tmpobject->fetch($objid);
if ($result <= 0)
{
if ($result <= 0) {
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR);
@ -579,50 +592,61 @@ class BlockedLog
$paymentpart = new stdClass();
$paymentpart->amount = $amount;
if (!in_array($this->element, array('payment_donation', 'payment_various')))
{
if (!in_array($this->element, array('payment_donation', 'payment_various'))) {
$result = $tmpobject->fetch_thirdparty();
if ($result == 0)
{
if ($result == 0) {
$this->error = 'Failed to fetch thirdparty for object with id '.$tmpobject->id;
$this->errors[] = $this->error;
dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR);
return -1;
} elseif ($result < 0)
{
} elseif ($result < 0) {
$this->error = $tmpobject->error;
$this->errors = $tmpobject->errors;
return -1;
}
$paymentpart->thirdparty = new stdClass();
foreach ($tmpobject->thirdparty as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
foreach ($tmpobject->thirdparty as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'name', 'name_alias', 'ref_ext', 'address', 'zip', 'town', 'state_code', 'country_code', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'phone', 'fax', 'email', 'barcode',
'tva_intra', 'localtax1_assuj', 'localtax1_value', 'localtax2_assuj', 'localtax2_value', 'managers', 'capital', 'typent_code', 'forme_juridique_code', 'code_client', 'code_fournisseur'
))) continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') $paymentpart->thirdparty->{$key} = $value;
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$paymentpart->thirdparty->{$key} = $value;
}
}
}
// Init object to avoid warnings
if ($this->element == 'payment_donation') $paymentpart->donation = new stdClass();
else $paymentpart->invoice = new stdClass();
if ($this->element == 'payment_donation') {
$paymentpart->donation = new stdClass();
} else {
$paymentpart->invoice = new stdClass();
}
if ($this->element != 'payment_various')
{
foreach ($tmpobject as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if ($this->element != 'payment_various') {
foreach ($tmpobject as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'ref', 'ref_client', 'ref_supplier', 'date', 'datef', 'type', 'total_ht', 'total_tva', 'total_ttc', 'localtax1', 'localtax2', 'revenuestamp', 'datepointoftax', 'note_public'
))) continue; // Discard if not into a dedicated list
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value;
elseif ($this->element == 'payment_various') $paymentpart->various->{$key} = $value;
else $paymentpart->invoice->{$key} = $value;
if ($this->element == 'payment_donation') {
$paymentpart->donation->{$key} = $value;
} elseif ($this->element == 'payment_various') {
$paymentpart->various->{$key} = $value;
} else {
$paymentpart->invoice->{$key} = $value;
}
}
}
@ -633,33 +657,47 @@ class BlockedLog
$this->object_data->amount = $totalamount;
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
} elseif ($this->element == 'payment_salary')
{
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} elseif ($this->element == 'payment_salary') {
$this->object_data->amounts = array($object->amount);
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
} elseif ($this->element == 'subscription')
{
foreach ($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} elseif ($this->element == 'subscription') {
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!in_array($key, array(
'id', 'datec', 'dateh', 'datef', 'fk_adherent', 'amount', 'import_key', 'statut', 'note'
))) continue; // Discard if not into a dedicated list
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
))) {
continue; // Discard if not into a dedicated list
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
}
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
} else // Generic case
{
foreach ($object as $key=>$value)
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (!is_object($value) && !is_null($value) && $value !== '') $this->object_data->{$key} = $value;
foreach ($object as $key => $value) {
if (in_array($key, $arrayoffieldstoexclude)) {
continue; // Discard some properties
}
if (!is_object($value) && !is_null($value) && $value !== '') {
$this->object_data->{$key} = $value;
}
}
if (!empty($object->newref)) $this->object_data->ref = $object->newref;
if (!empty($object->newref)) {
$this->object_data->ref = $object->newref;
}
}
return 1;
@ -675,8 +713,7 @@ class BlockedLog
{
global $langs;
if (empty($id))
{
if (empty($id)) {
$this->error = 'BadParameter';
return -1;
}
@ -684,11 +721,12 @@ class BlockedLog
$sql = "SELECT b.rowid, b.date_creation, b.signature, b.signature_line, b.amounts, b.action, b.element, b.fk_object, b.entity,";
$sql .= " b.certified, b.tms, b.fk_user, b.user_fullname, b.date_object, b.ref_object, b.object_data, b.object_version";
$sql .= " FROM ".MAIN_DB_PREFIX."blockedlog as b";
if ($id) $sql .= " WHERE b.rowid = ".((int) $id);
if ($id) {
$sql .= " WHERE b.rowid = ".((int) $id);
}
$resql = $this->db->query($sql);
if ($resql)
{
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$this->id = $obj->rowid;
@ -759,7 +797,9 @@ class BlockedLog
{
$res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".$this->id);
if ($res === false) return false;
if ($res === false) {
return false;
}
return true;
}
@ -785,8 +825,7 @@ class BlockedLog
dol_syslog(get_class($this).'::create action='.$this->action.' fk_user='.$this->fk_user.' user_fullname='.$this->user_fullname, LOG_DEBUG);
// Check parameters/properties
if (!isset($this->amounts)) // amount can be 0 for some events (like when module is disabled)
{
if (!isset($this->amounts)) { // amount can be 0 for some events (like when module is disabled)
$this->error = $langs->trans("BlockLogNeedAmountsValue");
dol_syslog($this->error, LOG_WARNING);
return -1;
@ -803,7 +842,9 @@ class BlockedLog
dol_syslog($this->error, LOG_WARNING);
return -3;
}
if (empty($this->fk_user)) $this->user_fullname = '(Anonymous)';
if (empty($this->fk_user)) {
$this->user_fullname = '(Anonymous)';
}
$this->date_creation = dol_now();
@ -817,7 +858,9 @@ class BlockedLog
$this->signature_line = dol_hash($keyforsignature, '5'); // Not really usefull
$this->signature = dol_hash($previoushash.$keyforsignature, '5');
if ($forcesignature) $this->signature = $forcesignature;
if ($forcesignature) {
$this->signature = $forcesignature;
}
//var_dump($keyforsignature);var_dump($previoushash);var_dump($this->signature_line);var_dump($this->signature);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."blockedlog (";
@ -855,12 +898,10 @@ class BlockedLog
$sql .= ")";
$res = $this->db->query($sql);
if ($res)
{
if ($res) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."blockedlog");
if ($id > 0)
{
if ($id > 0) {
$this->id = $id;
$this->db->commit();
@ -888,8 +929,7 @@ class BlockedLog
*/
public function checkSignature($previoushash = '', $returnarray = 0)
{
if (empty($previoushash))
{
if (empty($previoushash)) {
$previoushash = $this->getPreviousHash(0, $this->id);
}
// Recalculate hash
@ -949,31 +989,31 @@ class BlockedLog
$previoussignature = '';
$sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity=".$conf->entity;
if ($beforeid) $sql .= " AND rowid < ".(int) $beforeid;
$sql .= " ORDER BY rowid DESC LIMIT 1";
$sql .= ($withlock ? " FOR UPDATE " : "");
$sql = "SELECT rowid, signature FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity=".$conf->entity;
if ($beforeid) {
$sql .= " AND rowid < ".(int) $beforeid;
}
$sql .= " ORDER BY rowid DESC LIMIT 1";
$sql .= ($withlock ? " FOR UPDATE " : "");
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj)
{
$previoussignature = $obj->signature;
}
} else {
dol_print_error($this->db);
exit;
}
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$previoussignature = $obj->signature;
}
} else {
dol_print_error($this->db);
exit;
}
if (empty($previoussignature))
{
if (empty($previoussignature)) {
// First signature line (line 0)
$previoussignature = $this->getSignature();
}
$previoussignature = $this->getSignature();
}
return $previoussignature;
return $previoussignature;
}
/**
@ -1001,7 +1041,7 @@ class BlockedLog
//if (empty($cachedlogs)) $cachedlogs = array();
if ($element == 'all') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
WHERE entity=".$conf->entity;
} elseif ($element == 'not_certified') {
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
@ -1014,13 +1054,27 @@ class BlockedLog
WHERE entity=".$conf->entity." AND element='".$this->db->escape($element)."'";
}
if ($fk_object) $sql .= natural_search("rowid", $fk_object, 1);
if ($search_fk_user > 0) $sql .= natural_search("fk_user", $search_fk_user, 2);
if ($search_start > 0) $sql .= " AND date_creation >= '".$this->db->idate($search_start)."'";
if ($search_end > 0) $sql .= " AND date_creation <= '".$this->db->idate($search_end)."'";
if ($search_ref != '') $sql .= natural_search("ref_object", $search_ref);
if ($search_amount != '') $sql .= natural_search("amounts", $search_amount, 1);
if ($search_code != '' && $search_code != '-1') $sql .= natural_search("action", $search_code, 3);
if ($fk_object) {
$sql .= natural_search("rowid", $fk_object, 1);
}
if ($search_fk_user > 0) {
$sql .= natural_search("fk_user", $search_fk_user, 2);
}
if ($search_start > 0) {
$sql .= " AND date_creation >= '".$this->db->idate($search_start)."'";
}
if ($search_end > 0) {
$sql .= " AND date_creation <= '".$this->db->idate($search_end)."'";
}
if ($search_ref != '') {
$sql .= natural_search("ref_object", $search_ref);
}
if ($search_amount != '') {
$sql .= natural_search("amounts", $search_amount, 1);
}
if ($search_code != '' && $search_code != '-1') {
$sql .= natural_search("action", $search_code, 3);
}
$sql .= $this->db->order($sortfield, $sortorder);
$sql .= $this->db->plimit($limit + 1); // We want more, because we will stop into loop later with error if we reach max
@ -1030,11 +1084,9 @@ class BlockedLog
$results = array();
$i = 0;
while ($obj = $this->db->fetch_object($res))
{
while ($obj = $this->db->fetch_object($res)) {
$i++;
if ($i > $limit)
{
if ($i > $limit) {
// Too many record, we will consume too much memory
return -2;
}
@ -1096,15 +1148,20 @@ class BlockedLog
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog";
$sql .= " WHERE entity = ".$conf->entity;
if ($ignoresystem) $sql .= " AND action not in ('MODULE_SET','MODULE_RESET')";
if ($ignoresystem) {
$sql .= " AND action not in ('MODULE_SET','MODULE_RESET')";
}
$sql .= $this->db->plimit(1);
$res = $this->db->query($sql);
if ($res !== false)
{
if ($res !== false) {
$obj = $this->db->fetch_object($res);
if ($obj) $result = true;
} else dol_print_error($this->db);
if ($obj) {
$result = true;
}
} else {
dol_print_error($this->db);
}
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result);

View File

@ -44,8 +44,7 @@ function blockedlogadmin_prepare_head()
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$b = new BlockedLog($db);
if ($b->alreadyUsed())
{
if ($b->alreadyUsed()) {
$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">...</span>' : '');
}
$head[$h][2] = 'fingerprints';

View File

@ -1273,8 +1273,7 @@ class FormMail extends Form
//print $sql;
$resql = $db->query($sql);
if (!$resql)
{
if (!$resql) {
dol_print_error($db);
return -1;
}

View File

@ -1141,12 +1141,12 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
if ($date < $nextnewyeardate && $yearoffsettype == '+') {
$yearoffset = 1;
}
} // If after or equal of current new year date
elseif ($date >= $newyeardate && $yearoffsettype == '-') {
} elseif ($date >= $newyeardate && $yearoffsettype == '-') {
// If after or equal of current new year date
$yearoffset = -1;
}
} // For backward compatibility
elseif (date("m", $date) < $maskraz && empty($resetEveryMonth)) {
} elseif (date("m", $date) < $maskraz && empty($resetEveryMonth)) {
// For backward compatibility
$yearoffset = -1;
} // If current month lower that month of return to zero, year is previous year
@ -2121,8 +2121,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
$classpath = 'mrp/class';
$module = 'mrp';
$myobject = 'mo';
}
elseif ($objecttype == 'productlot') {
} elseif ($objecttype == 'productlot') {
$classpath = 'product/stock/class';
$module = 'stock';
$myobject = 'productlot';

View File

@ -32,24 +32,42 @@
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
// For direct external download link, we don't need to load/check we are into a login session
if (isset($_GET["hashp"]) && !defined("NOLOGIN"))
{
if (!defined("NOLOGIN")) define("NOLOGIN", 1);
if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
if (isset($_GET["hashp"]) && !defined("NOLOGIN")) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
if (!defined("NOCSRFCHECK")) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
}
if (!defined("NOIPCHECK")) {
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
}
// Some value of modulepart can be used to get resources that are public so no login are required.
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias'))
{
if (!defined("NOLOGIN")) define("NOLOGIN", 1);
if (!defined("NOCSRFCHECK")) define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
if (!defined("NOIPCHECK")) define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) {
if (!defined("NOLOGIN")) {
define("NOLOGIN", 1);
}
if (!defined("NOCSRFCHECK")) {
define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
}
if (!defined("NOIPCHECK")) {
define("NOIPCHECK", 1); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
}
/**
@ -84,17 +102,26 @@ $urlsource = GETPOST('urlsource', 'alpha');
$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity;
// Security check
if (empty($modulepart) && empty($hashp)) accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1);
if (empty($original_file) && empty($hashp)) accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1);
if ($modulepart == 'fckeditor') $modulepart = 'medias'; // For backward compatibility
if (empty($modulepart) && empty($hashp)) {
accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1);
}
if (empty($original_file) && empty($hashp)) {
accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1);
}
if ($modulepart == 'fckeditor') {
$modulepart = 'medias'; // For backward compatibility
}
$socid = 0;
if ($user->socid > 0) $socid = $user->socid;
if ($user->socid > 0) {
$socid = $user->socid;
}
// For some module part, dir may be privates
if (in_array($modulepart, array('facture_paiement', 'unpaid')))
{
if (!$user->rights->societe->client->voir || $socid) $original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user
if (in_array($modulepart, array('facture_paiement', 'unpaid'))) {
if (!$user->rights->societe->client->voir || $socid) {
$original_file = 'private/'.$user->id.'/'.$original_file; // If user has no permission to see all, output dir is specific to user
}
}
@ -111,25 +138,20 @@ if (in_array($modulepart, array('facture_paiement', 'unpaid')))
*/
// If we have a hash public (hashp), we guess the original_file.
if (!empty($hashp))
{
if (!empty($hashp)) {
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($db);
$result = $ecmfile->fetch(0, '', '', '', $hashp);
if ($result > 0)
{
if ($result > 0) {
$tmp = explode('/', $ecmfile->filepath, 2); // $ecmfile->filepath is relative to document directory
// filepath can be 'users/X' or 'X/propale/PR11111'
if (is_numeric($tmp[0])) // If first tmp is numeric, it is subdir of company for multicompany, we take next part.
{
if (is_numeric($tmp[0])) { // If first tmp is numeric, it is subdir of company for multicompany, we take next part.
$tmp = explode('/', $tmp[1], 2);
}
$moduleparttocheck = $tmp[0]; // moduleparttocheck is first part of path
if ($modulepart) // Not required, so often not defined, for link using public hashp parameter.
{
if ($moduleparttocheck == $modulepart)
{
if ($modulepart) { // Not required, so often not defined, for link using public hashp parameter.
if ($moduleparttocheck == $modulepart) {
// We remove first level of directory
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
//var_dump($original_file); exit;
@ -148,14 +170,23 @@ if (!empty($hashp))
// Define attachment (attachment=true to force choice popup 'open'/'save as')
$attachment = true;
if (preg_match('/\.(html|htm)$/i', $original_file)) $attachment = false;
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?true:false;
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
if (preg_match('/\.(html|htm)$/i', $original_file)) {
$attachment = false;
}
if (isset($_GET["attachment"])) {
$attachment = GETPOST("attachment", 'alpha') ?true:false;
}
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) {
$attachment = false;
}
// Define mime type
$type = 'application/octet-stream'; // By default
if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha');
else $type = dol_mimetype($original_file);
if (GETPOST('type', 'alpha')) {
$type = GETPOST('type', 'alpha');
} else {
$type = dol_mimetype($original_file);
}
// Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file
// We do not force if file is a javascript to be able to get js from website module with <script src="
// Note: Force whatever is $modulepart seems ok.
@ -170,7 +201,9 @@ $original_file = str_replace("../", "/", $original_file);
$refname = basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
if (empty($modulepart)) {
accessforbidden('Bad value for parameter modulepart');
}
// Check security and set return info with full path of file
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
@ -179,26 +212,20 @@ $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
//var_dump($fullpath_original_file);exit;
if (!empty($hashp))
{
if (!empty($hashp)) {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = '';
} else {
// Basic protection (against external users only)
if ($user->socid > 0)
{
if ($sqlprotectagainstexternals)
{
if ($user->socid > 0) {
if ($sqlprotectagainstexternals) {
$resql = $db->query($sqlprotectagainstexternals);
if ($resql)
{
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($user->socid != $obj->fk_soc)
{
if ($user->socid != $obj->fk_soc) {
$accessallowed = 0;
break;
}
@ -211,15 +238,13 @@ if (!empty($hashp))
// Security:
// Limit access if permissions are wrong
if (!$accessallowed)
{
if (!$accessallowed) {
accessforbidden();
}
// Security:
// We refuse directory transversal change and pipes in file names
if (preg_match('/\.\./', $fullpath_original_file) || preg_match('/[<>|]/', $fullpath_original_file))
{
if (preg_match('/\.\./', $fullpath_original_file) || preg_match('/[<>|]/', $fullpath_original_file)) {
dol_syslog("Refused to deliver file ".$fullpath_original_file);
print "ErrorFileNameInvalid: ".dol_escape_htmltag($original_file);
exit;
@ -236,8 +261,7 @@ dol_syslog("document.php download $fullpath_original_file filename=$filename con
$fullpath_original_file_osencoded = dol_osencode($fullpath_original_file); // New file name encoded in OS encoding charset
// This test if file exists should be useless. We keep it to find bug more easily
if (!file_exists($fullpath_original_file_osencoded))
{
if (!file_exists($fullpath_original_file_osencoded)) {
dol_syslog("ErrorFileDoesNotExists: ".$fullpath_original_file);
print "ErrorFileDoesNotExists: ".$original_file;
exit;
@ -263,10 +287,15 @@ if ($reshook < 0) {
// Permissions are ok and file found, so we return it
top_httphead($type);
header('Content-Description: File Transfer');
if ($encoding) header('Content-Encoding: '.$encoding);
if ($encoding) {
header('Content-Encoding: '.$encoding);
}
// Add MIME Content-Disposition from RFC 2183 (inline=automatically displayed, attachment=need user action to open)
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
if ($attachment) {
header('Content-Disposition: attachment; filename="'.$filename.'"');
} else {
header('Content-Disposition: inline; filename="'.$filename.'"');
}
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
@ -278,7 +307,9 @@ if (!$attachment && !empty($conf->global->MAIN_USE_EXIF_ROTATION) && image_forma
$readfile = !$imgres;
}
if (is_object($db)) $db->close();
if (is_object($db)) {
$db->close();
}
// Send file now
if ($readfile) {

View File

@ -41,18 +41,15 @@ $hookmanager->initHooks(array('index'));
*/
// Check if company name is defined (first install)
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM))
{
if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
exit;
}
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only user module enabled
header("Location: ".DOL_URL_ROOT."/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
exit;
}
if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
{
if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled)
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone = GETPOST('areacode', 'aZ09');
$userid = GETPOST('userid', 'int');
@ -60,7 +57,9 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
$boxorder .= GETPOST('boxcombo', 'aZ09');
$result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
if ($result > 0) {
setEventMessages($langs->trans("BoxAdded"), null);
}
}
@ -68,11 +67,15 @@ if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax dis
* View
*/
if (!isset($form) || !is_object($form)) $form = new Form($db);
if (!isset($form) || !is_object($form)) {
$form = new Form($db);
}
// Title
$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
}
llxHeader('', $title);
@ -82,11 +85,9 @@ $resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (select
print load_fiche_titre('&nbsp;', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
if (!empty($conf->global->MAIN_MOTD))
{
if (!empty($conf->global->MAIN_MOTD)) {
$conf->global->MAIN_MOTD = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD);
if (!empty($conf->global->MAIN_MOTD))
{
if (!empty($conf->global->MAIN_MOTD)) {
$substitutionarray = getCommonSubstitutionArray($langs);
complete_substitutions_array($substitutionarray, $langs);
$texttoshow = make_substitutions($conf->global->MAIN_MOTD, $substitutionarray, $langs);
@ -258,8 +259,12 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$object = new stdClass();
$parameters = array();
$action = '';
$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object,
$action); // Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks(
'addOpenElementsDashboardLine',
$parameters,
$object,
$action
); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
$dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
}
@ -414,8 +419,10 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
if ($showweather) {
if ($totallate > 0) {
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
"NActionsLate",
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
).')';
} else {
$text = $langs->transnoentitiesnoconv("NoItemLate");
}
@ -457,17 +464,17 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$globalStatsKey = $groupElement['globalStatsKey'];
$groupElement['globalStats'] = array();
if (is_array($keys) && in_array($globalStatsKey, $keys))
{
if (is_array($keys) && in_array($globalStatsKey, $keys)) {
// get key index of stats used in $includes, $classes, $keys, $icons, $titres, $links
$keyIndex = array_search($globalStatsKey, $keys);
$classe = (!empty($classes[$keyIndex]) ? $classes[$keyIndex] : '');
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe]))
{
if (isset($boardloaded[$classe]) && is_object($boardloaded[$classe])) {
$groupElement['globalStats']['total'] = $boardloaded[$classe]->nb[$globalStatsKey] ? $boardloaded[$classe]->nb[$globalStatsKey] : 0;
$nbTotal = doubleval($groupElement['globalStats']['total']);
if ($nbTotal >= 10000) { $nbTotal = round($nbTotal / 1000, 2).'k'; }
if ($nbTotal >= 10000) {
$nbTotal = round($nbTotal / 1000, 2).'k';
}
$groupElement['globalStats']['text'] = $langs->trans('Total').' : '.$langs->trans($titres[$keyIndex]).' ('.$groupElement['globalStats']['total'].')';
$groupElement['globalStats']['total'] = $nbTotal;
$groupElement['globalStats']['link'] = $links[$keyIndex];
@ -549,13 +556,15 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
}
if ($showweather && !empty($isIntopOpenedDashBoard)) {
$appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '');
$appendClass = (!empty($conf->global->MAIN_DISABLE_METEO) && $conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '');
$weather = getWeatherStatus($totallate);
$text = '';
if ($totallate > 0) {
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
$text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv(
"NActionsLate",
$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')
).')';
} else {
$text = $langs->transnoentitiesnoconv("NoItemLate");
}
@ -570,16 +579,24 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$weatherDashBoard .= ' <div class="info-box-title">'.$langs->trans('GlobalOpenedElemView').'</div>'."\n";
if ($totallatePercentage > 0 && !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
price($totallatePercentage).'%').'</span>'."\n";
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
$totalLateNumber).'</span>'."\n";
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv(
"NActionsLate",
price($totallatePercentage).'%'
).'</span>'."\n";
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans(
'NActionsLate',
$totalLateNumber
).'</span>'."\n";
} else {
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv("NActionsLate",
$totalLateNumber).'</span>'."\n";
$weatherDashBoard .= ' <span class="info-box-number">'.$langs->transnoentitiesnoconv(
"NActionsLate",
$totalLateNumber
).'</span>'."\n";
if ($totallatePercentage > 0) {
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans('NActionsLate',
price($totallatePercentage).'%').'</span>'."\n";
$weatherDashBoard .= ' <span class="progress-description">'.$langs->trans(
'NActionsLate',
price($totallatePercentage).'%'
).'</span>'."\n";
}
}
@ -627,8 +644,11 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$boxwork .= '<div class="dashboardlinelatecoin nowrap">';
$boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
//$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
$boxwork .= img_picto($textlate, "warning_white",
'class="inline-block hideonsmartphone valigntextbottom"').'';
$boxwork .= img_picto(
$textlate,
"warning_white",
'class="inline-block hideonsmartphone valigntextbottom"'
).'';
$boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
$boxwork .= $board->nbtodolate;
$boxwork .= '</span>';
@ -679,8 +699,7 @@ print '<div class="fichecenter fichecenterbis">';
$boxlist = '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if (!empty($nbworkboardcount))
{
if (!empty($nbworkboardcount)) {
$boxlist .= $boxwork;
}
@ -708,30 +727,26 @@ print '</div>';
*/
// Security warning repertoire install existe (si utilisateur admin)
if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING))
{
if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) {
$message = '';
// Check if install lock file is present
$lockfile = DOL_DATA_ROOT.'/install.lock';
if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install"))
{
if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
$langs->load("errors");
//if (! empty($message)) $message.='<br>';
$message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
}
// Conf files must be in read only mode
if (is_writable($conffile))
{
if (is_writable($conffile)) {
$langs->load("errors");
//$langs->load("other");
//if (! empty($message)) $message.='<br>';
$message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
}
if ($message)
{
if ($message) {
print $message;
//$message.='<br>';
//print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));

View File

@ -72,7 +72,7 @@ span.butAction, span.butActionDelete {
border-radius: 3px;
}
.butActionRefused:last-child, .butAction:last-child, .butActionDelete:last-child {
margin-right: 0px !important;
margin-right: 0px !important;
}
.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
text-decoration: none;

View File

@ -68,7 +68,7 @@ span.butAction, span.butActionDelete {
border-radius: 3px;
}
.butActionRefused:last-child, .butAction:last-child, .butActionDelete:last-child {
margin-right: 0px !important;
margin-right: 0px !important;
}
.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
text-decoration: none;

View File

@ -378,16 +378,16 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$this->assertTrue($ok, 'Found a declaration @var array() instead of @var array in file '.$file['relativename'].'.');
// Test we don't have CURDATE()
$ok=true;
$matches=array();
preg_match_all('/CURDATE\(\)/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
$ok=false;
break;
}
$this->assertTrue($ok, 'Found a CURDATE\(\) into code. Do not use this SQL method in file '.$file['relativename'].'. You must use the PHP function dol_now() instead.');
}
// Test we don't have CURDATE()
$ok=true;
$matches=array();
preg_match_all('/CURDATE\(\)/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
$ok=false;
break;
}
$this->assertTrue($ok, 'Found a CURDATE\(\) into code. Do not use this SQL method in file '.$file['relativename'].'. You must use the PHP function dol_now() instead.');
}
return;
}

View File

@ -279,14 +279,14 @@ class ExportTest extends PHPUnit\Framework\TestCase
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error in TSV export');
$model='excel2007';
$model='excel2007';
// Build export file
/* ko on php 7.4 on travis (zip not available) */
print "Process build_file for model = ".$model."\n";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error in Excel2007 export');
$this->assertEquals($expectedresult, $result, 'Error in Excel2007 export');
return true;
}

View File

@ -162,7 +162,7 @@ class ImportTest extends PHPUnit\Framework\TestCase
// according to option
$this->assertEquals(0, 0);
// TODO Export and compare the file exported with the $file imported.
// TODO Export and compare the file exported with the $file imported.

View File

@ -389,17 +389,17 @@ class SecurityTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST['param8c'], $result, 'Test a string with non closing html tag with alphanohtml');
$result=GETPOST("param8d", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('abc123 is html to clean', $result, 'Test a string with non closing html tag with alphanohtml');
$result=GETPOST("param8d", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('abc123 is html to clean', $result, 'Test a string with non closing html tag with alphanohtml');
$result=GETPOST("param8e", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST['param8e'], $result, 'Test a string with non closing html tag with alphanohtml');
$result=GETPOST("param8e", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST['param8e'], $result, 'Test a string with non closing html tag with alphanohtml');
$result=GETPOST("param9", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST["param9"], $result);
$result=GETPOST("param9", 'alphanohtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals($_POST["param9"], $result);
$result=GETPOST("param10", 'alphanohtml');
print __METHOD__." result=".$result."\n";
@ -413,12 +413,12 @@ class SecurityTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals(trim($_POST["param11"]), $result, 'Test an email string with alphawithlgt');
$result=GETPOST("param12", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals(trim($_POST["param12"]), $result, 'Test a string with DOCTYPE and restricthtml');
$result=GETPOST("param12", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals(trim($_POST["param12"]), $result, 'Test a string with DOCTYPE and restricthtml');
return $result;
}
return $result;
}
/**
* testCheckLoginPassEntity