From 33ac8cc5f3dfdb7148fd618b72bbd085272bc826 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 May 2014 00:42:52 +0200 Subject: [PATCH] Qual: uniformize code for propertie dateh (removed dateadh), for class Cotisation. --- htdocs/adherents/card_subscriptions.php | 16 ++++++++-------- htdocs/adherents/class/adherent.class.php | 8 ++++---- htdocs/adherents/class/cotisation.class.php | 10 +++++----- htdocs/adherents/cotisations.php | 4 ++-- htdocs/adherents/index.php | 6 +++--- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 28e75e36694..a838be2ccb3 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -337,7 +337,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ { $langs->load("errors"); $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); - $error++; + $error++; } } if (! $error) @@ -349,7 +349,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $error++; } } - + if (! $error) { // Create draft invoice @@ -367,7 +367,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ } $invoice->socid=$object->fk_soc; $invoice->date=$datecotisation; - + $result=$invoice->create($user); if ($result <= 0) { @@ -375,7 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $error++; } } - + if (! $error) { // Add line to draft invoice @@ -392,11 +392,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $errmsg=$invoice->error; $error++; } - + // Validate invoice $result=$invoice->validate($user); } - + // Add payment onto invoice if ($option == 'bankviainvoice' && $accountid) { @@ -681,7 +681,7 @@ if ($rowid) $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,"; $sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " c.datec,"; - $sql.= " c.dateadh,"; + $sql.= " c.dateadh as dateh,"; $sql.= " c.datef,"; $sql.= " c.fk_bank,"; $sql.= " b.rowid as bid,"; @@ -724,7 +724,7 @@ if ($rowid) $cotisationstatic->id=$objp->crowid; print ''.$cotisationstatic->getNomUrl(1).''; print ''.dol_print_date($db->jdate($objp->datec),'dayhour')."\n"; - print ''.dol_print_date($db->jdate($objp->dateadh),'day')."\n"; + print ''.dol_print_date($db->jdate($objp->dateh),'day')."\n"; print ''.dol_print_date($db->jdate($objp->datef),'day')."\n"; print ''.price($objp->cotisation).''; if (! empty($conf->banque->enabled)) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b98f9364f0b..73036747a6c 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1191,7 +1191,7 @@ class Adherent extends CommonObject $sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, c.fk_bank,"; $sql.= " c.tms as datem,"; $sql.= " c.datec as datec,"; - $sql.= " c.dateadh as dateadh,"; + $sql.= " c.dateadh as dateh,"; $sql.= " c.datef as datef"; $sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " WHERE c.fk_adherent = ".$this->id; @@ -1208,10 +1208,10 @@ class Adherent extends CommonObject { if ($i==0) { - $this->first_subscription_date=$obj->dateadh; + $this->first_subscription_date=$obj->dateh; $this->first_subscription_amount=$obj->cotisation; } - $this->last_subscription_date=$obj->dateadh; + $this->last_subscription_date=$obj->dateh; $this->last_subscription_amount=$obj->cotisation; $subscription=new Cotisation($this->db); @@ -1222,7 +1222,7 @@ class Adherent extends CommonObject $subscription->fk_bank=$obj->fk_bank; $subscription->datem=$this->db->jdate($obj->datem); $subscription->datec=$this->db->jdate($obj->datec); - $subscription->dateadh=$this->db->jdate($obj->dateadh); + $subscription->dateh=$this->db->jdate($obj->dateh); $subscription->datef=$this->db->jdate($obj->datef); $this->subscriptions[]=$subscription; diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 544b198e494..1fc0994b54a 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -36,9 +36,9 @@ class Cotisation extends CommonObject var $id; var $ref; - var $datec; - var $datem; - var $dateh; // Subscription start date + var $datec; // Date creation + var $datem; // Date modification + var $dateh; // Subscription start date (date subscription) var $datef; // Subscription end date var $fk_adherent; var $amount; @@ -107,7 +107,7 @@ class Cotisation extends CommonObject { $sql ="SELECT rowid, fk_adherent, datec,"; $sql.=" tms,"; - $sql.=" dateadh,"; + $sql.=" dateadh as dateh,"; $sql.=" datef,"; $sql.=" cotisation, note, fk_bank"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; @@ -127,7 +127,7 @@ class Cotisation extends CommonObject $this->fk_adherent = $obj->fk_adherent; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->tms); - $this->dateh = $this->db->jdate($obj->dateadh); + $this->dateh = $this->db->jdate($obj->dateh); $this->datef = $this->db->jdate($obj->datef); $this->amount = $obj->cotisation; $this->note = $obj->note; diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 2784a150e1d..2bb7a438f3e 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -63,7 +63,7 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu if ($msg) print $msg.'
'; -// Liste des cotisations +// List of subscriptions $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,"; $sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " c.dateadh,"; @@ -75,7 +75,7 @@ $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 != '') { - $sql.= " AND dateadh LIKE '$date_select%'"; + $sql.= " AND c.dateadh LIKE '".$date_select."%'"; } $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index e8ee6bc07c2..e64466ce9a6 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -367,13 +367,13 @@ $Number=array(); $tot=0; $numb=0; -$sql = "SELECT c.cotisation, c.dateadh"; +$sql = "SELECT c.cotisation, c.dateadh as dateh"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " WHERE d.entity IN (".getEntity().")"; $sql.= " AND d.rowid = c.fk_adherent"; if(isset($date_select) && $date_select != '') { - $sql .= " AND dateadh LIKE '$date_select%'"; + $sql .= " AND c.dateadh LIKE '".$date_select."%'"; } $result = $db->query($sql); if ($result) @@ -383,7 +383,7 @@ if ($result) while ($i < $num) { $objp = $db->fetch_object($result); - $year=dol_print_date($db->jdate($objp->dateadh),"%Y"); + $year=dol_print_date($db->jdate($objp->dateh),"%Y"); $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation; $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; $tot+=$objp->cotisation;