diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php
index 6f99893a703..d6c876477d3 100755
--- a/htdocs/adherents/cartes/carte.php
+++ b/htdocs/adherents/cartes/carte.php
@@ -26,9 +26,9 @@
*/
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/member/PDF_card.class.php");
-//require_once(DOL_DOCUMENT_ROOT."/adherents/cartes/PDF_card.class.php");
// liste des patterns remplacable dans le texte a imprimer
@@ -49,14 +49,6 @@ $patterns = array (
'/%ANNEE%/'
);
-/*
- *-------------------------------------------------
- * Pour cr�er l'objet on a 2 moyens :
- * Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel)
- * Soit on donne le type d'�tiquette au format AVERY
- *-------------------------------------------------
- */
-
$dir = $conf->adherent->dir_tmp;
$file = $dir . "/tmpcard.pdf";
@@ -88,7 +80,7 @@ $sql.= " t.libelle as type,";
$sql.= " p.libelle as pays";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
-$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin >= ".$db->idate(mktime());
+$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql.= " ORDER BY d.rowid ASC";
$result = $db->query($sql);
@@ -132,16 +124,22 @@ if ($result)
$db->close();
- // Output file
- $type = 'application/octet-stream';
-
- if ($type) header('Content-Type: '.$type);
- header('Content-Disposition: attachment; filename="tmpcard.pdf"');
+ clearstatcache();
+
+ $attachment=true;
+ if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
+ $filename='tmpcards.pdf';
+ $type=dol_mimetype($filename);
+ if ($encoding) header('Content-Encoding: '.$encoding);
+ if ($type) header('Content-Type: '.$type);
+ 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');
-
+
readfile($file);
}
else
diff --git a/htdocs/adherents/cartes/etiquette.php b/htdocs/adherents/cartes/etiquette.php
index 82021d7c1fd..9d8e0e6f6e1 100755
--- a/htdocs/adherents/cartes/etiquette.php
+++ b/htdocs/adherents/cartes/etiquette.php
@@ -26,17 +26,10 @@
*/
require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
-/*
- *-------------------------------------------------
- * Pour cr�er l'objet on a 2 moyens :
- * Soit on donne les valeurs en les passant dans un tableau (sert pour un format personnel)
- * Soit on donne le type d'�tiquette au format AVERY
- *-------------------------------------------------
- */
-
$dir = $conf->adherent->dir_tmp;
$file = $dir . "/tmplabel.pdf";
@@ -75,7 +68,7 @@ $sql.= " t.libelle as type,";
$sql.= " p.libelle as pays";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid";
-$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1 AND datefin >= ".$db->idate(mktime());
+$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql.= " ORDER BY d.rowid ASC";
$result = $db->query($sql);
@@ -100,16 +93,22 @@ if ($result)
$db->close();
- // Output file
- $type = 'application/octet-stream';
-
- if ($type) header('Content-Type: '.$type);
- header('Content-Disposition: attachment; filename="tmplabel.pdf"');
+ clearstatcache();
+
+ $attachment=true;
+ if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
+ $filename='tmplabels.pdf';
+ $type=dol_mimetype($filename);
+ if ($encoding) header('Content-Encoding: '.$encoding);
+ if ($type) header('Content-Type: '.$type);
+ 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');
-
+
readfile($file);
}
else
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index f5693adf882..60a70777e2b 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -166,7 +166,7 @@ if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
$adh->email = trim($_POST["email"]);
$adh->naiss = $datenaiss;
- $adh->typeid = $_POST["type"];
+ $adh->typeid = $_POST["typeid"];
$adh->note = trim($_POST["comment"]);
$adh->morphy = $_POST["morphy"];
@@ -244,7 +244,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
$datecotisation=dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
}
- $type=$_POST["type"];
+ $typeid=$_POST["typeid"];
$nom=$_POST["nom"];
$prenom=$_POST["prenom"];
$societe=$_POST["societe"];
@@ -279,7 +279,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
$adh->pass = $pass;
$adh->naiss = $datenaiss;
$adh->photo = $photo;
- $adh->typeid = $type;
+ $adh->typeid = $typeid;
$adh->note = $comment;
$adh->morphy = $morphy;
foreach($_POST as $key => $value){
@@ -291,12 +291,12 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
}
// Test validite des parametres
- if(!isset($type) || $type==''){
+ if (empty($typeid)) {
$error++;
$errmsg .= $langs->trans("ErrorMemberTypeNotDefined")." \n";
}
// Test si le login existe deja
- if(!isset($login) || $login==''){
+ if (empty($login)) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->trans("Login"))." \n";
}
@@ -312,7 +312,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
$errmsg .= $langs->trans("ErrorLoginAlreadyExists",$login)." \n";
}
}
- if (!isset($nom) || $nom=='') {
+ if (empty($nom)) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))." \n";
}
@@ -324,7 +324,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
$error++;
$errmsg .= $langs->trans("ErrorBadEMail",$email)." \n";
}
- if (!isset($pass) || $pass == '' ) {
+ if (empty($pass)) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Password"))." \n";
}
@@ -627,12 +627,12 @@ if ($action == 'edit')
print '
'.$langs->trans("Type").'*
';
if ($user->rights->adherent->creer) // If $user->rights->adherent->self->creer, we do not allow.
{
- $htmls->select_array("type", $adht->liste_array(), $adh->typeid);
+ $htmls->select_array("typeid", $adht->liste_array(), $adh->typeid);
}
else
{
print $adht->getNomUrl(1);
- print '';
+ print '';
}
print "
";
@@ -748,7 +748,7 @@ if ($action == 'create')
$listetype=$adht->liste_array();
if (sizeof($listetype))
{
- $htmls->select_array("type", $listetype, $typeid);
+ $htmls->select_array("typeid", $listetype, $typeid);
} else {
print ''.$langs->trans("NoTypeDefinedGoToSetup").'';
}
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index f5a724b80aa..0a40cdb11be 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -46,9 +46,10 @@ $var=True;
$Adherents=array();
$AdherentsAValider=array();
+$MemberUpToDate=array();
$AdherentsResilies=array();
+
$AdherentType=array();
-$Cotisants=array();
# Liste les adherents
$sql = "SELECT t.rowid, t.libelle, t.cotisation,";
@@ -57,6 +58,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut";
+dol_syslog("index.php::select nb of members by type sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
@@ -72,30 +74,27 @@ if ($result)
$adhtype->libelle=$objp->libelle;
$AdherentType[$objp->rowid]=$adhtype;
- if ($objp->statut == -1) { $AdherentsAValider[$objp->rowid]=$objp->somme; }
- if ($objp->statut == 1) { $Adherents[$objp->rowid]=$objp->somme; }
- if ($objp->statut == 0) { $AdherentsResilies[$objp->rowid]=$objp->somme; }
+ if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
+ if ($objp->statut == 1) { $MembersValidated[$objp->rowid]=$objp->somme; }
+ if ($objp->statut == 0) { $MembersResiliated[$objp->rowid]=$objp->somme; }
- if ($objp->cotisation != 'yes')
- {
- $Cotisants[$objp->rowid]=$Adherents[$objp->rowid]=$objp->somme;
- }
- else
- {
- $Cotisants[$objp->rowid]=0; // Calcule plus loin
- }
$i++;
}
$db->free($result);
}
-# Liste les cotisants a jour
+// List members up to date
+// current rule: uptodate = the end date is in future whatever is type
+// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
-$sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate(mktime());
+$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
+//$sql.= " WHERE d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= ".$db->idate(gmmktime()).')';
+$sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate(gmmktime());
+$sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type";
+dol_syslog("index.php::select nb of uptodate members by type sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{
@@ -104,7 +103,7 @@ if ($result)
while ($i < $num)
{
$objp = $db->fetch_object($result);
- $Cotisants[$objp->fk_adherent_type]=$objp->somme;
+ $MemberUpToDate[$objp->fk_adherent_type]=$objp->somme;
$i++;
}
$db->free();
@@ -145,7 +144,7 @@ $SommeD=0;
print '
';
@@ -229,7 +228,7 @@ else
-// Tableau r�sum� par an
+// List of subscription by year
$Total=array();
$Number=array();
$tot=0;
@@ -261,7 +260,7 @@ if ($result)
print '