Move tab menu for subscription in member.lib

Move all pages for subscription member in adherent/subscription (Card / Info / List)
Rename llx_cotisation in llx_subscription
Rename all db field cotisation in subscription
Rename class Cotisation in class Subscription
This commit is contained in:
aspangaro 2016-09-24 06:48:40 +02:00
parent f1166f1898
commit 2dbeeedd14
33 changed files with 273 additions and 274 deletions

View File

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -47,7 +47,7 @@ $langs->load("users");
$langs->load('other');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$cancel=GETPOST('cancel','alpha');
$backtopage=GETPOST('backtopage','alpha');
$confirm=GETPOST('confirm','alpha');
$rowid=GETPOST('rowid','int');
@ -424,10 +424,10 @@ if (empty($reshook))
{
$birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
}
$datecotisation='';
$datesubscription='';
if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"]))
{
$datecotisation=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datesubscription=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
}
$typeid=$_POST["typeid"];
@ -451,7 +451,7 @@ if (empty($reshook))
$photo=$_POST["photo"];
//$comment=$_POST["comment"];
$morphy=$_POST["morphy"];
$cotisation=$_POST["cotisation"];
$subscription=$_POST["subscription"];
$public=$_POST["public"];
$userid=$_POST["userid"];
@ -1497,7 +1497,7 @@ else
}
else
{
if (! $adht->cotisation)
if (! $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

View File

@ -5,11 +5,11 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -643,7 +643,7 @@ class Adherent extends CommonObject
// Search for last subscription id and end date
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."subscription";
$sql.= " WHERE fk_adherent='".$this->id."'";
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
@ -717,10 +717,10 @@ class Adherent extends CommonObject
}
// Remove cotisation
// Remove subscription
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE fk_adherent = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
@ -1072,7 +1072,7 @@ class Adherent extends CommonObject
$sql.= " d.state_id,";
$sql.= " c.rowid as country_id, c.code as country_code, c.label as country,";
$sql.= " dep.nom as state, dep.code_departement as state_code,";
$sql.= " t.libelle as type, t.cotisation as cotisation,";
$sql.= " t.libelle as type, t.subscription as subscription,";
$sql.= " u.rowid as user_id, u.login as user_login";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
@ -1150,7 +1150,7 @@ class Adherent extends CommonObject
$this->typeid = $obj->fk_adherent_type;
$this->type = $obj->type;
$this->need_subscription = ($obj->cotisation=='yes'?1:0);
$this->need_subscription = ($obj->subscription=='yes'?1:0);
$this->user_id = $obj->user_id;
$this->user_login = $obj->user_login;
@ -1193,14 +1193,14 @@ class Adherent extends CommonObject
{
global $langs;
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, c.fk_bank,";
$sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,";
$sql.= " c.tms as datem,";
$sql.= " c.datec as datec,";
$sql.= " c.dateadh as dateh,";
$sql.= " c.datef as datef";
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " FROM ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE c.fk_adherent = ".$this->id;
$sql.= " ORDER BY c.dateadh";
dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG);
@ -1216,15 +1216,15 @@ class Adherent extends CommonObject
if ($i==0)
{
$this->first_subscription_date=$obj->dateh;
$this->first_subscription_amount=$obj->cotisation;
$this->first_subscription_amount=$obj->subscription;
}
$this->last_subscription_date=$obj->dateh;
$this->last_subscription_amount=$obj->cotisation;
$this->last_subscription_amount=$obj->subscription;
$subscription=new Cotisation($this->db);
$subscription=new Subscription($this->db);
$subscription->id=$obj->rowid;
$subscription->fk_adherent=$obj->fk_adherent;
$subscription->amount=$obj->cotisation;
$subscription->amount=$obj->subscription;
$subscription->note=$obj->note;
$subscription->fk_bank=$obj->fk_bank;
$subscription->datem=$this->db->jdate($obj->datem);
@ -1260,11 +1260,11 @@ class Adherent extends CommonObject
* @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO
*/
function cotisation($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
function subscription($date, $montant, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0)
{
global $conf,$langs,$user;
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$error=0;
@ -1285,14 +1285,14 @@ class Adherent extends CommonObject
}
// Create subscription
$cotisation=new Cotisation($this->db);
$cotisation->fk_adherent=$this->id;
$cotisation->dateh=$date; // Date of new subscription
$cotisation->datef=$datefin; // End data of new subscription
$cotisation->amount=$montant;
$cotisation->note=$label;
$subscription=new Subscription($this->db);
$subscription->fk_adherent=$this->id;
$subscription->dateh=$date; // Date of new subscription
$subscription->datef=$datefin; // End data of new subscription
$subscription->amount=$montant;
$subscription->note=$label;
$rowid=$cotisation->create($user);
$rowid=$subscription->create($user);
if ($rowid > 0)
{
// Update denormalized subscription end date (read database subscription to find values)
@ -1325,7 +1325,7 @@ class Adherent extends CommonObject
}
else
{
$this->error=$cotisation->error;
$this->error=$subscription->error;
$this->db->rollback();
return -1;
}
@ -1587,7 +1587,7 @@ class Adherent extends CommonObject
}
if ($option == 'subscription')
{
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.$linkclose;
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.$linkclose;
$linkend='</a>';
}
@ -1753,7 +1753,7 @@ class Adherent extends CommonObject
$langs->load("members");
$response = new WorkboardResponse();
$response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24;
$response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24;
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut=1&amp;filter=outofdate';
$response->img=img_object($langs->trans("Members"),"user");
@ -2039,7 +2039,7 @@ class Adherent extends CommonObject
$now = dol_now();
return $this->datefin < ($now - $conf->adherent->cotisation->warning_delay);
return $this->datefin < ($now - $conf->adherent->subscription->warning_delay);
}
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -39,7 +39,7 @@ class AdherentType extends CommonObject
var $id;
var $ref;
var $libelle;
var $cotisation; // Soumis a la cotisation
var $subscription; // Soumis a la cotisation
var $note;
var $vote; // droit de vote
var $mail_valid; //mail envoye lors de la validation
@ -111,7 +111,7 @@ class AdherentType extends CommonObject
$sql.= "SET ";
$sql.= "statut = ".$this->statut.",";
$sql.= "libelle = '".$this->db->escape($this->libelle) ."',";
$sql.= "cotisation = '".$this->cotisation."',";
$sql.= "subscription = '".$this->subscription."',";
$sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = '".$this->vote."',";
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
@ -188,7 +188,7 @@ class AdherentType extends CommonObject
*/
function fetch($rowid)
{
$sql = "SELECT d.rowid, d.libelle, d.statut, d.cotisation, d.mail_valid, d.note, d.vote";
$sql = "SELECT d.rowid, d.libelle, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".$rowid;
@ -205,7 +205,7 @@ class AdherentType extends CommonObject
$this->ref = $obj->rowid;
$this->libelle = $obj->libelle;
$this->statut = $obj->statut;
$this->cotisation = $obj->cotisation;
$this->subscription = $obj->subscription;
$this->mail_valid = $obj->mail_valid;
$this->note = $obj->note;
$this->vote = $obj->vote;

View File

@ -24,7 +24,7 @@
*/
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT . '/adherents/class/cotisation.class.php';
include_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
/**
@ -57,12 +57,12 @@ class AdherentStats extends Stats
$this->socid = $socid;
$this->userid = $userid;
$object=new Cotisation($this->db);
$object=new Subscription($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
$this->from.= ", ".MAIN_DB_PREFIX."adherent as m";
$this->field='cotisation';
$this->field='subscription';
$this->where.= " m.statut != 0";
$this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent', 1).")";
@ -76,7 +76,7 @@ class AdherentStats extends Stats
/**
* Renvoie le nombre de proposition par mois pour une annee donnee
* Return the number of proposition by month for a given year
*
* @param int $year Year
* @return array Array of nb each month
@ -97,7 +97,7 @@ class AdherentStats extends Stats
}
/**
* Renvoie le nombre de cotisation par annee
* Return the number of subscriptions by year
*
* @return array Array of nb each year
*/
@ -116,7 +116,7 @@ class AdherentStats extends Stats
}
/**
* Renvoie le nombre de cotisation par mois pour une annee donnee
* Return the number of subscriptions by month for a given year
*
* @param int $year Year
* @return array Array of amount each month

View File

@ -17,9 +17,9 @@
*/
/**
* \file htdocs/adherents/class/cotisation.class.php
* \ingroup member
* \brief File of class to manage subscriptions of foundation members
* \file htdocs/adherents/class/subscription.class.php
* \ingroup member
* \brief File of class to manage subscriptions of foundation members
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
@ -28,10 +28,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/**
* Class to manage subscriptions of foundation members
*/
class Cotisation extends CommonObject
class Subscription extends CommonObject
{
public $element='subscription';
public $table_element='cotisation';
public $table_element='subscription';
var $datec; // Date creation
var $datem; // Date modification
@ -54,7 +54,7 @@ class Cotisation extends CommonObject
/**
* Fonction qui permet de creer la cotisation
* Function who permitted cretaion of the subscription
*
* @param int $userid userid de celui qui insere
* @return int <0 if KO, Id subscription created if OK
@ -72,17 +72,18 @@ class Cotisation extends CommonObject
return -1;
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cotisation (fk_adherent, datec, dateadh, datef, cotisation, note)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, datec, dateadh, datef, subscription, note)";
$sql.= " VALUES (".$this->fk_adherent.", '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.",'".$this->db->escape($this->note)."')";
$sql.= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note)."')";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
return $this->db->last_insert_id(MAIN_DB_PREFIX."cotisation");
return $this->db->last_insert_id(MAIN_DB_PREFIX."subscription");
}
else
{
@ -104,8 +105,8 @@ class Cotisation extends CommonObject
$sql.=" tms,";
$sql.=" dateadh as dateh,";
$sql.=" datef,";
$sql.=" cotisation, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
$sql.=" subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -124,7 +125,7 @@ class Cotisation extends CommonObject
$this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->cotisation;
$this->amount = $obj->subscription;
$this->note = $obj->note;
$this->fk_bank = $obj->fk_bank;
return 1;
@ -143,20 +144,20 @@ class Cotisation extends CommonObject
/**
* Met a jour en base la cotisation
* Update subscription
*
* @param User $user Objet user qui met a jour
* @param int $notrigger 0=Desactive les triggers
* @param User $user User who updated
* @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user,$notrigger=0)
{
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."cotisation SET ";
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " cotisation = '".price2num($this->amount)."',";
$sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',";
@ -201,7 +202,7 @@ class Cotisation extends CommonObject
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cotisation WHERE rowid = ".$this->id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@ -263,7 +264,7 @@ class Cotisation extends CommonObject
$result='';
$label=$langs->trans("ShowSubscription").': '.$this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='payment';
@ -276,7 +277,7 @@ class Cotisation extends CommonObject
/**
* Charge les informations d'ordre info dans l'objet cotisation
* Load information of the subscription object
*
* @param int $id Id subscription
* @return void
@ -285,7 +286,7 @@ class Cotisation extends CommonObject
{
$sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'cotisation as c';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql);

View File

@ -27,7 +27,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$langs->load("companies");
$langs->load("members");
@ -44,7 +44,7 @@ llxHeader('',$langs->trans("Members"),'EN:Module_Foundations|FR:Module_Adh&eacut
$staticmember=new Adherent($db);
$statictype=new AdherentType($db);
$subscriptionstatic=new Cotisation($db);
$subscriptionstatic=new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"));
@ -59,14 +59,14 @@ $AdherentsResilies=array();
$AdherentType=array();
// Liste les adherents
$sql = "SELECT t.rowid, t.libelle, t.cotisation,";
$sql = "SELECT t.rowid, t.libelle, t.subscription,";
$sql.= " d.statut, count(d.rowid) as somme";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql.= " ON t.rowid = d.fk_adherent_type";
$sql.= " AND d.entity IN (".getEntity().")";
$sql.= " WHERE t.entity IN (".getEntity().")";
$sql.= " GROUP BY t.rowid, t.libelle, t.cotisation, d.statut";
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);
$result = $db->query($sql);
@ -80,7 +80,7 @@ if ($result)
$adhtype=new AdherentType($db);
$adhtype->id=$objp->rowid;
$adhtype->cotisation=$objp->cotisation;
$adhtype->subscription=$objp->subscription;
$adhtype->libelle=$objp->libelle;
$AdherentType[$objp->rowid]=$adhtype;
@ -101,7 +101,7 @@ $now=dol_now();
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.entity IN (".getEntity().")";
//$sql.= " AND d.statut = 1 AND ((t.cotisation = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')";
//$sql.= " AND d.statut = 1 AND ((t.subscription = 0 AND d.datefin IS NULL) OR d.datefin >= '".$db->idate($now)."')";
$sql.= " AND d.statut = 1 AND d.datefin >= '".$db->idate($now)."'";
$sql.= " AND t.rowid = d.fk_adherent_type";
$sql.= " GROUP BY d.fk_adherent_type";
@ -212,7 +212,7 @@ $max=5;
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql.= " a.tms as datem, datefin as date_end_subscription,";
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
$sql.= " ta.rowid as typeid, ta.libelle, ta.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
$sql.= " WHERE a.entity IN (".getEntity().")";
$sql.= " AND a.fk_adherent_type = ta.rowid";
@ -255,7 +255,7 @@ if ($resql)
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '</tr>';
$i++;
}
@ -275,8 +275,8 @@ $max=5;
$sql = "SELECT a.rowid, a.statut, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql.= " datefin as date_end_subscription,";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE a.entity IN (".getEntity().")";
$sql.= " AND c.fk_adherent = a.rowid";
$sql.= $db->order("c.tms","DESC");
@ -315,8 +315,8 @@ if ($resql)
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
print '<td align="right">'.price($obj->cotisation).'</td>';
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '<td align="right">'.price($obj->subscription).'</td>';
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->subscription=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datem?$obj->datem:$obj->datec),'dayhour').'</td>';
print '</tr>';
$i++;
@ -345,18 +345,18 @@ foreach ($AdherentType as $key => $adhtype)
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
print '<td align="right">'.(isset($MembersResiliated[$key]) && $MembersResiliated[$key]> 0 ?$MembersResiliated[$key]:'').' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->cotisation,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeA.' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeB.' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeC.' '.$staticmember->LibStatut(1,$adhtype->subscription,$now,3).'</td>';
print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibStatut(0,$adhtype->subscription,0,3).'</td>';
print '</tr>';
print "</table>\n";
@ -369,8 +369,8 @@ $Number=array();
$tot=0;
$numb=0;
$sql = "SELECT c.cotisation, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql = "SELECT c.subscription, c.dateadh as dateh";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " WHERE d.entity IN (".getEntity().")";
$sql.= " AND d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != '')
@ -386,9 +386,9 @@ if ($result)
{
$objp = $db->fetch_object($result);
$year=dol_print_date($db->jdate($objp->dateh),"%Y");
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation;
$Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription;
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
$tot+=$objp->cotisation;
$tot+=$objp->subscription;
$numb+=1;
$i++;
}
@ -408,7 +408,7 @@ foreach ($Total as $key=>$value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td><a href=\"cotisations.php?date_select=$key\">$key</a></td>";
print "<td><a href=\"./subscription/list.php?date_select=$key\">$key</a></td>";
print "<td align=\"right\">".$Number[$key]."</td>";
print "<td align=\"right\">".price($value)."</td>";
print "<td align=\"right\">".price(price2num($value/$Number[$key],'MT'))."</td>";

View File

@ -187,7 +187,7 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company,
$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql.= " t.libelle as type, t.cotisation,";
$sql.= " t.libelle as type, t.subscription,";
$sql.= " state.code_departement as state_code, state.nom as state_name";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
@ -736,7 +736,7 @@ if ($resql)
else
{
print '<td align="left" class="nowrap">';
if ($obj->cotisation == 'yes')
if ($obj->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) print " ".img_warning();
@ -790,7 +790,7 @@ if ($resql)
if (! empty($arrayfields['d.statut']['checked']))
{
print '<td align="right" class="nowrap">';
print $memberstatic->LibStatut($obj->statut,$obj->cotisation,$datefin,2);
print $memberstatic->LibStatut($obj->statut,$obj->subscription,$datefin,2);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}

View File

View File

@ -3,7 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
*/
/**
* \file htdocs/adherents/card_subscriptions.php
* \file htdocs/adherents/subscription.php
* \ingroup member
* \brief Onglet d'ajout, edition, suppression des adhesions d'un adherent
*/
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -186,7 +186,7 @@ if ($action == 'setsocid')
}
}
if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $_POST["cancel"])
if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $_POST["cancel"])
{
$error=0;
@ -196,12 +196,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$result=$adht->fetch($object->typeid);
// Subscription informations
$datecotisation=0;
$datesubscription=0;
$datesubend=0;
$paymentdate=0;
if ($_POST["reyear"] && $_POST["remonth"] && $_POST["reday"])
{
$datecotisation=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
$datesubscription=dol_mktime(0, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
}
if ($_POST["endyear"] && $_POST["endmonth"] && $_POST["endday"])
{
@ -211,7 +211,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
}
$cotisation=$_POST["cotisation"]; // Amount of subscription
$subscription=$_POST["subscription"]; // Amount of subscription
$label=$_POST["label"];
// Payment informations
@ -224,7 +224,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (empty($option)) $option='none';
// Check parameters
if (! $datecotisation)
if (! $datesubscription)
{
$error++;
$langs->load("errors");
@ -240,7 +240,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
if (! $datesubend)
{
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datecotisation,$defaultdelay,$defaultdelayunit),-1,'d');
$datesubend=dol_time_plus_duree(dol_time_plus_duree($datesubscription,$defaultdelay,$defaultdelayunit),-1,'d');
}
if (($option == 'bankviainvoice' || $option == 'bankdirect') && ! $paymentdate)
{
@ -250,9 +250,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
// Check if a payment is mandatory or not
if (! $error && $adht->cotisation) // Type adherent soumis a cotisation
if (! $error && $adht->subscription) // Type adherent soumis a cotisation
{
if (! is_numeric($_POST["cotisation"]))
if (! is_numeric($_POST["subscription"]))
{
// If field is '' or not a numeric value
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
@ -263,7 +263,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{
if (! empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none')
{
if ($_POST["cotisation"])
if ($_POST["subscription"])
{
if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
if ($_POST["paymentsave"] != 'invoiceonly' && ! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
@ -278,12 +278,12 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
}
if (! $error && $action=='cotisation')
if (! $error && $action=='subscription')
{
$db->begin();
// Create subscription
$crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
$crowid=$object->subscription($datesubscription, $subscription, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
if ($crowid <= 0)
{
$error++;
@ -293,7 +293,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! $error)
{
// Insert into bank account directlty (if option choosed for) + link to llx_cotisation if option is 'bankdirect'
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
if ($option == 'bankdirect' && $accountid)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -303,17 +303,17 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$dateop=$paymentdate;
$insertid=$acct->addline($dateop, $operation, $label, $cotisation, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
$insertid=$acct->addline($dateop, $operation, $label, $subscription, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
if ($insertid > 0)
{
$inserturlid=$acct->add_url_line($insertid, $object->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $object->getFullname($langs), 'member');
if ($inserturlid > 0)
{
// Met a jour la table cotisation
$sql ="UPDATE ".MAIN_DB_PREFIX."cotisation SET fk_bank=".$insertid;
// Update table subscription
$sql ="UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
$sql.=" WHERE rowid=".$crowid;
dol_syslog("card_subscriptions::cotisation", LOG_DEBUG);
dol_syslog("subscription::subscription", LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql)
{
@ -381,7 +381,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
}
$invoice->socid=$object->fk_soc;
$invoice->date=$datecotisation;
$invoice->date=$datesubscription;
// Possibility to add external linked objects with hooks
$invoice->linked_objects['subscription'] = $crowid;
@ -411,7 +411,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$vattouse=get_default_tva($mysoc, $mysoc, $idprodsubscription);
}
//print xx".$vattouse." - ".$mysoc." - ".$customer;exit;
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datecotisation,$datesubend,0,0,'','TTC',$cotisation,1);
$result=$invoice->addline($label,0,1,$vattouse,0,0,$idprodsubscription,0,$datesubscription,$datesubend,0,0,'','TTC',$subscription,1);
if ($result <= 0)
{
$errmsg=$invoice->error;
@ -438,7 +438,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
$amounts[$invoice->id] = price2num($cotisation);
$amounts[$invoice->id] = price2num($subscription);
$paiement = new Paiement($db);
$paiement->datepaye = $paymentdate;
$paiement->amounts = $amounts;
@ -474,7 +474,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! $error)
{
// Update fk_bank into subscription table
$sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
$sql.= ' WHERE rowid='.$crowid;
$result = $db->query($sql);
@ -538,7 +538,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
}
}
$_POST["cotisation"]='';
$_POST["subscription"]='';
$_POST["accountid"]='';
$_POST["operation"]='';
$_POST["label"]='';
@ -665,7 +665,7 @@ if ($rowid > 0)
}
else
{
if (! $adht->cotisation)
if (! $adht->subscription)
{
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
@ -786,14 +786,14 @@ if ($rowid > 0)
if ($action != 'addsubscription' && $action != 'create_thirdparty')
{
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
$sql.= " c.rowid as crowid, c.cotisation,";
$sql.= " c.rowid as crowid, c.subscription,";
$sql.= " c.datec,";
$sql.= " c.dateadh as dateh,";
$sql.= " c.datef,";
$sql.= " c.fk_bank,";
$sql.= " b.rowid as bid,";
$sql.= " ba.rowid as baid, ba.label, ba.bank";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
$sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
@ -801,7 +801,7 @@ if ($rowid > 0)
$result = $db->query($sql);
if ($result)
{
$cotisationstatic=new Cotisation($db);
$subscriptionstatic=new Subscription($db);
$accountstatic=new Account($db);
$num = $db->num_rows($result);
@ -827,13 +827,13 @@ if ($rowid > 0)
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
$cotisationstatic->ref=$objp->crowid;
$cotisationstatic->id=$objp->crowid;
print '<td>'.$cotisationstatic->getNomUrl(1).'</td>';
$subscriptionstatic->ref=$objp->crowid;
$subscriptionstatic->id=$objp->crowid;
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->datec),'dayhour')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->dateh),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
print '<td align="right">'.price($objp->cotisation).'</td>';
print '<td align="right">'.price($objp->subscription).'</td>';
if (! empty($conf->banque->enabled))
{
print '<td align="right">';
@ -954,9 +954,9 @@ if ($rowid > 0)
}
print '<form name="cotisation" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<form name="subscription" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="cotisation">';
print '<input type="hidden" name="action" value="subscription">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
@ -995,7 +995,7 @@ if ($rowid > 0)
$datefrom=$object->datevalid;
}
}
print $form->select_date($datefrom,'','','','',"cotisation",1,1,1);
print $form->select_date($datefrom,'','','','',"subscription",1,1,1);
print "</td></tr>";
// Date end subscription
@ -1008,13 +1008,13 @@ if ($rowid > 0)
$dateto=-1; // By default, no date is suggested
}
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
print $form->select_date($dateto,'end','','','',"cotisation",1,0,1);
print $form->select_date($dateto,'end','','','',"subscription",1,0,1);
print "</td></tr>";
if ($adht->cotisation)
if ($adht->subscription)
{
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="cotisation" size="6" value="'.GETPOST('cotisation').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
@ -1109,7 +1109,7 @@ if ($rowid > 0)
// Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1,1);
print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'subscription',1,1,1);
print "</td></tr>\n";
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');

View File

@ -16,7 +16,7 @@
*/
/**
* \file htdocs/adherents/fiche_subscription.php
* \file htdocs/adherents/subscription/card.php
* \ingroup member
* \brief Page to add/edit/remove a member subscription
*/
@ -24,7 +24,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("companies");
@ -33,7 +33,7 @@ $langs->load("members");
$langs->load("users");
$adh = new Adherent($db);
$object = new Cotisation($db);
$object = new Subscription($db);
$errmsg='';
$action=GETPOST("action",'alpha');
@ -109,7 +109,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
{
$db->commit();
header("Location: fiche_subscription.php?rowid=".$object->id);
header("Location: card.php?rowid=".$object->id);
exit;
}
else
@ -172,28 +172,14 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
{
/********************************************
*
* Fiche en mode edition
* Subscription card in edit mode
*
********************************************/
$object->fetch($rowid);
$result=$adh->fetch($object->fk_adherent);
/*
* Affichage onglets
*/
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("SubscriptionCard");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$head = subscription_prepare_head($object);
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -206,10 +192,10 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
print "\n";
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/cotisations.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="3">';
print $form->showrefnav($object, 'rowid', $linkback, 1);
print '</td></tr>';
@ -276,30 +262,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
if ($rowid && $action != 'edit')
{
/* ************************************************************************** */
/* */
/* Mode affichage */
/* */
/* ************************************************************************** */
/********************************************
*
* Subscription card in view mode
*
********************************************/
$result=$object->fetch($rowid);
$result=$adh->fetch($object->fk_adherent);
/*
* Affichage onglets
*/
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("SubscriptionCard");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$head = subscription_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("Subscription"), '', 'payment');
@ -317,10 +289,10 @@ if ($rowid && $action != 'edit')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/cotisations.php">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="3">';
print $form->showrefnav($object, 'rowid', $linkback, 1);
print '</td></tr>';

View File

View File

@ -17,16 +17,16 @@
*/
/**
* \file htdocs/adherents/info_subscription.php
* \file htdocs/adherents/subscription/info.php
* \ingroup member
* \brief Page with information of subscriptions of a member
* \brief Page with information of subscriptions of a member
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$langs->load("companies");
$langs->load("bills");
@ -41,37 +41,24 @@ $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
/*
* Visualisation de la fiche
*
* View
*/
llxHeader();
$form = new Form($db);
$subscription = new Cotisation($db);
$result=$subscription->fetch($rowid);
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/fiche_subscription.php?rowid='.$subscription->id;
$head[$h][1] = $langs->trans("SubscriptionCard");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/info_subscription.php?rowid='.$subscription->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$object = new Subscription($db);
$result = $object->fetch($rowid);
$head = subscription_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Subscription"), '', 'payment');
$subscription->info($rowid);
$object->info($rowid);
print '<table width="100%"><tr><td>';
dol_print_object_info($subscription);
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';

View File

@ -18,14 +18,14 @@
*/
/**
* \file htdocs/adherents/cotisations.php
* \file htdocs/adherents/subscription/list.php
* \ingroup member
* \brief Page de consultation et insertion d'une cotisation
* \brief list of subscription
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("members");
@ -85,12 +85,12 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu
// List of subscriptions
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,";
$sql.= " c.rowid as crowid, c.cotisation,";
$sql.= " c.rowid as crowid, c.subscription,";
$sql.= " c.dateadh,";
$sql.= " c.datef,";
$sql.= " c.fk_bank as bank, c.note,";
$sql.= " b.fk_account";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
$sql.= " WHERE d.rowid = c.fk_adherent";
if (isset($date_select) && $date_select != '')
@ -103,10 +103,10 @@ if ($search_ref)
else $sql.=" AND 1 = 2"; // Always wrong
}
if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname);
if ($search_login) $sql.= natural_search('c.cotisation', $search_login);
if ($search_login) $sql.= natural_search('c.subscription', $search_login);
if ($search_note) $sql.= natural_search('c.note', $search_note);
if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account;
if ($search_amount) $sql.= natural_search('c.cotisation', $search_amount, 1);
if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1);
$sql.= $db->order($sortfield,$sortorder);
$nbtotalofrecords = 0;
@ -166,7 +166,7 @@ if ($result)
}
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@ -211,7 +211,7 @@ if ($result)
// Static objects
$cotisation=new Cotisation($db);
$subscription=new Subscription($db);
$adherent=new Adherent($db);
$accountstatic=new Account($db);
@ -220,10 +220,10 @@ if ($result)
while ($i < min($num, $limit))
{
$objp = $db->fetch_object($result);
$total+=$objp->cotisation;
$total+=$objp->subscription;
$cotisation->ref=$objp->crowid;
$cotisation->id=$objp->crowid;
$subscription->ref=$objp->crowid;
$subscription->id=$objp->crowid;
$adherent->lastname=$objp->lastname;
$adherent->firstname=$objp->firstname;
@ -236,7 +236,7 @@ if ($result)
print "<tr ".$bc[$var].">";
// Ref
print '<td>'.$cotisation->getNomUrl(1).'</td>';
print '<td>'.$subscription->getNomUrl(1).'</td>';
// Lastname
print '<td>'.$adherent->getNomUrl(1).'</td>';
@ -273,7 +273,7 @@ if ($result)
print '<td align="center">'.dol_print_date($db->jdate($objp->datef),'day')."</td>\n";
// Price
print '<td align="right">'.price($objp->cotisation).'</td>';
print '<td align="right">'.price($objp->subscription).'</td>';
print '<td></td>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -23,7 +23,7 @@
/**
* \file htdocs/adherents/type.php
* \ingroup member
* \brief Member's type setup
* \brief Member's type setup
*/
require '../main.inc.php';
@ -55,7 +55,7 @@ if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="d.lastname"; }
$label=GETPOST("libelle","alpha");
$cotisation=GETPOST("cotisation","int");
$subscription=GETPOST("subscription","int");
$vote=GETPOST("vote","int");
$comment=GETPOST("comment");
$mail_valid=GETPOST("mail_valid");
@ -90,11 +90,11 @@ if ($action == 'add' && $user->rights->adherent->configurer)
{
$object = new AdherentType($db);
$object->libelle = trim($label);
$object->cotisation = trim($cotisation);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
$object->libelle = trim($label);
$object->subscription = trim($subscription);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -127,12 +127,12 @@ if ($action == 'update' && $user->rights->adherent->configurer)
if (! $cancel)
{
$object = new AdherentType($db);
$object->id = $rowid;
$object->libelle = trim($label);
$object->cotisation = trim($cotisation);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
$object->id = $rowid;
$object->libelle = trim($label);
$object->subscription = trim($subscription);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -171,7 +171,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
//dol_fiche_head('');
$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql = "SELECT d.rowid, d.libelle, d.subscription, d.vote";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql.= " WHERE d.entity IN (".getEntity().")";
@ -199,7 +199,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print "<tr ".$bc[$var].">";
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>'.dol_escape_htmltag($objp->libelle).'</td>';
print '<td align="center">'.yn($objp->cotisation).'</td>';
print '<td align="center">'.yn($objp->subscription).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
if ($user->rights->adherent->configurer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
@ -240,7 +240,7 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("cotisation",1,1);
print $form->selectyesno("subscription",1,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
@ -308,7 +308,7 @@ if ($rowid > 0)
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($object->cotisation);
print yn($object->subscription);
print '</tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
@ -367,7 +367,7 @@ if ($rowid > 0)
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, ";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
$sql.= " t.libelle as type, t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity IN (".getEntity().")";
@ -546,7 +546,7 @@ if ($rowid > 0)
// Statut
print '<td class="nowrap">';
print $adh->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// Date fin cotisation
@ -566,7 +566,7 @@ if ($rowid > 0)
else
{
print '<td align="left" class="nowrap">';
if ($objp->cotisation == 'yes')
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
@ -638,7 +638,7 @@ if ($rowid > 0)
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.dol_escape_htmltag($object->libelle).'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("cotisation",$object->cotisation,1);
print $form->selectyesno("subscription",$object->subscription,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';

View File

@ -84,7 +84,7 @@ class box_members extends ModeleBoxes
{
$sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.cotisation";
$sql.= " t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE a.entity = ".$conf->entity;
$sql.= " AND a.fk_adherent_type = t.rowid";
@ -135,7 +135,7 @@ class box_members extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3),
'text' => $memberstatic->LibStatut($objp->status,$objp->subscription,$db->jdate($objp->date_end_subscription),3),
);
$line++;

View File

@ -2606,7 +2606,7 @@ abstract class CommonObject
$classfile = 'facture-rec'; $classname = 'FactureRec';
}
else if ($objecttype == 'subscription') {
$classfile = 'cotisation'; $classname = 'Cotisation';
$classfile = 'subscription'; $classname = 'Subscription';
}
// Here $module, $classfile and $classname are set

View File

@ -508,8 +508,8 @@ class Conf
// Delay before warnings
// Avoid strict errors. TODO: Replace xxx->warning_delay with a property ->warning_delay_xxx
if (isset($this->agenda)) {
$this->adherent->cotisation = new stdClass();
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
$this->adherent->subscription = new stdClass();
$this->adherent->subscription->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
}
if (isset($this->agenda)) $this->agenda->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
if (isset($this->projet))

View File

@ -20,14 +20,14 @@
/**
* \file htdocs/core/lib/member.lib.php
* \brief Ensemble de fonctions de base pour les adherents
* \brief Functions for module members
*/
/**
* Return array head with list of tabs to view object informations
*
* @param Adherent $object Member
* @return array head
* @param Adherent $object Member
* @return array head
*/
function member_prepare_head(Adherent $object)
{
@ -51,9 +51,9 @@ function member_prepare_head(Adherent $object)
$h++;
}
if (! empty($user->rights->adherent->cotisation->lire))
if (! empty($user->rights->adherent->cotisation->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Subscriptions");
$head[$h][2] = 'subscription';
$h++;
@ -62,10 +62,10 @@ function member_prepare_head(Adherent $object)
// Show agenda tab
if (! empty($conf->agenda->enabled))
{
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans('Agenda');
$head[$h][2] = 'agenda';
$h++;
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans('Agenda');
$head[$h][2] = 'agenda';
$h++;
}
// Show more tabs from modules
@ -233,3 +233,37 @@ function member_stats_prepare_head($object)
return $head;
}
/**
* Return array head with list of tabs to view object informations
*
* @param Subscription $object Subscription
* @return array head
*/
function subscription_prepare_head(Subscription $object)
{
global $db, $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription/info.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription');
complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription','remove');
return $head;
}

View File

@ -309,7 +309,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Members - Subscriptions
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4300__+MAX_llx_menu__, 'members', '', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=members&amp;mainmenu=members', 'Subscriptions', 0, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4301__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/list.php?statut=-1&amp;leftmenu=accountancy&amp;mainmenu=members', 'NewSubscription', 1, 'compta', '$user->rights->adherent->cotisation->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4302__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/cotisations.php?leftmenu=members', 'List', 1, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4302__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/subscription/list.php?leftmenu=members', 'List', 1, 'compta', '$user->rights->adherent->cotisation->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4303__+MAX_llx_menu__, 'members', '', 4300__+MAX_llx_menu__, '/adherents/stats/index.php?leftmenu=members', 'MenuMembersStats', 1, 'members', '$user->rights->adherent->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled', __HANDLER__, 'left', 4500__+MAX_llx_menu__, 'members', 'export', 13__+MAX_llx_menu__, '/adherents/index.php?leftmenu=export&amp;mainmenu=members', 'Exports', 0, 'members', '$user->rights->adherent->export', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->adherent->enabled && $conf->export->enabled', __HANDLER__, 'left', 4501__+MAX_llx_menu__, 'members', '', 4500__+MAX_llx_menu__, '/exports/index.php?leftmenu=export', 'Datas', 1, 'members', '$user->rights->adherent->export', '', 2, 0, __ENTITY__);

View File

@ -1328,7 +1328,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/adherents/index.php?leftmenu=members&amp;mainmenu=members",$langs->trans("Subscriptions"),0,$user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/list.php?leftmenu=members&amp;statut=-1,1&amp;mainmenu=members",$langs->trans("NewSubscription"),1,$user->rights->adherent->cotisation->creer);
$newmenu->add("/adherents/cotisations.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/subscription/list.php?leftmenu=members",$langs->trans("List"),1,$user->rights->adherent->cotisation->lire);
$newmenu->add("/adherents/stats/index.php?leftmenu=members",$langs->trans("MenuMembersStats"),1,$user->rights->adherent->lire);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -156,7 +156,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_BANK_USE_AUTO";
$this->const[$r][1] = "yesno";
$this->const[$r][2] = "";
$this->const[$r][3] = "Insertion automatique des cotisations dans le compte banquaire";
$this->const[$r][3] = "Insertion automatique des cotisations dans le compte bancaire";
$this->const[$r][4] = 0;
$r++;
@ -170,7 +170,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][0] = "ADHERENT_BANK_CATEGORIE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][3] = "ID de la catégorie banquaire des cotisations";
$this->const[$r][3] = "ID de la catégorie bancaire des cotisations";
$this->const[$r][4] = 0;
$r++;
@ -271,9 +271,9 @@ class modAdherent extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='MembersAndSubscriptions';
$this->export_permission[$r]=array(array("adherent","export"));
$this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount');
$this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Numeric');
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription');
$this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.subscription'=>'Amount');
$this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.subscription'=>'Numeric');
$this->export_entities_array[$r]=array('a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.subscription'=>'subscription');
// Add extra fields
$sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity = ".$conf->entity;
@ -289,7 +289,7 @@ class modAdherent extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON a.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid';
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid';

View File

@ -85,6 +85,11 @@ create table llx_expensereport_extrafields
ALTER TABLE llx_expensereport_extrafields ADD INDEX idx_expensereport_extrafields (fk_object);
ALTER TABLE llx_cotisation RENAME TO llx_subscription;
ALTER TABLE llx_subscription ADD UNIQUE INDEX uk_subscription (fk_adherent,dateadh);
ALTER TABLE llx_subscription CHANGE COLUMN cotisation subscription real;
ALTER TABLE llx_adherent_type CHANGE COLUMN cotisation subscription varchar(3) NOT NULL DEFAULT 'yes';
create table llx_product_lot_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,

View File

@ -45,7 +45,7 @@ delete from llx_holiday_logs where fk_user_update not IN (select rowid from llx_
update llx_deplacement set dated='2010-01-01' where dated < '2000-01-01';
update llx_cotisation set fk_bank = null where fk_bank not in (select rowid from llx_bank);
update llx_subscription set fk_bank = null where fk_bank not in (select rowid from llx_bank);
update llx_propal set fk_projet = null where fk_projet not in (select rowid from llx_projet);
update llx_commande set fk_projet = null where fk_projet not in (select rowid from llx_projet);

View File

@ -29,7 +29,7 @@ create table llx_adherent_type
tms timestamp,
statut smallint NOT NULL DEFAULT 0,
libelle varchar(50) NOT NULL,
cotisation varchar(3) NOT NULL DEFAULT 'yes',
subscription varchar(3) NOT NULL DEFAULT 'yes',
vote varchar(3) NOT NULL DEFAULT 'yes',
note text,
mail_valid text -- mail envoye a la validation

View File

@ -16,4 +16,4 @@
--
-- ============================================================================
ALTER TABLE llx_cotisation ADD UNIQUE INDEX uk_cotisation (fk_adherent,dateadh);
ALTER TABLE llx_subscription ADD UNIQUE INDEX uk_subscription (fk_adherent,dateadh);

View File

@ -16,7 +16,7 @@
--
-- ===================================================================
create table llx_cotisation
create table llx_subscription
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
@ -24,7 +24,7 @@ create table llx_cotisation
fk_adherent integer,
dateadh datetime,
datef date,
cotisation real,
subscription real,
fk_bank integer DEFAULT NULL,
note text
)ENGINE=innodb;

View File

@ -86,7 +86,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contrat_extrafields
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contratdet FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contratdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contratdet_log FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cotisation FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_subscription FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@ -114,7 +114,7 @@ $sql.= " AND statut = 1";
$sql.= " AND public = 1";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
//$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, zip, town, d.email, t.libelle as type, d.morphy, d.statut, t.subscription";
//$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);

View File

@ -649,7 +649,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
$langs->load("members");
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$member=new Adherent($db);
$result=$member->fetch('',$ref);
@ -660,7 +660,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
}
else
{
$subscription=new Cotisation($db);
$subscription=new Subscription($db);
}
$amount=$subscription->total_ttc;

View File

@ -804,7 +804,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
$langs->load("members");
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
$member=new Adherent($db);
$result=$member->fetch('',$ref);
@ -815,7 +815,7 @@ if (GETPOST("source") == 'membersubscription' && $valid)
}
else
{
$subscription=new Cotisation($db);
$subscription=new Subscription($db);
}
$amount=$subscription->total_ttc;

View File

@ -213,7 +213,7 @@ if ($id > 0 || ! empty($ref))
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
$sql.= " t.libelle as type, t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_soc=".$id;
@ -292,7 +292,7 @@ if ($id > 0 || ! empty($ref))
// Statut
print '<td class="nowrap">';
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print $memberstatic->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// End of subscription date
@ -308,7 +308,7 @@ if ($id > 0 || ! empty($ref))
else
{
print '<td align="left" class="nowrap">';
if ($objp->cotisation == 'yes')
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();