Qual: uniformize code for propertie dateh (removed dateadh), for class

Cotisation.
This commit is contained in:
Laurent Destailleur 2014-05-05 00:42:52 +02:00
parent 63100c9c06
commit 33ac8cc5f3
5 changed files with 22 additions and 22 deletions

View File

@ -337,7 +337,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
$error++; $error++;
} }
} }
if (! $error) if (! $error)
@ -349,7 +349,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$error++; $error++;
} }
} }
if (! $error) if (! $error)
{ {
// Create draft invoice // Create draft invoice
@ -367,7 +367,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
} }
$invoice->socid=$object->fk_soc; $invoice->socid=$object->fk_soc;
$invoice->date=$datecotisation; $invoice->date=$datecotisation;
$result=$invoice->create($user); $result=$invoice->create($user);
if ($result <= 0) if ($result <= 0)
{ {
@ -375,7 +375,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$error++; $error++;
} }
} }
if (! $error) if (! $error)
{ {
// Add line to draft invoice // Add line to draft invoice
@ -392,11 +392,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
$errmsg=$invoice->error; $errmsg=$invoice->error;
$error++; $error++;
} }
// Validate invoice // Validate invoice
$result=$invoice->validate($user); $result=$invoice->validate($user);
} }
// Add payment onto invoice // Add payment onto invoice
if ($option == 'bankviainvoice' && $accountid) if ($option == 'bankviainvoice' && $accountid)
{ {
@ -681,7 +681,7 @@ if ($rowid)
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,"; $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,";
$sql.= " c.rowid as crowid, c.cotisation,"; $sql.= " c.rowid as crowid, c.cotisation,";
$sql.= " c.datec,"; $sql.= " c.datec,";
$sql.= " c.dateadh,"; $sql.= " c.dateadh as dateh,";
$sql.= " c.datef,"; $sql.= " c.datef,";
$sql.= " c.fk_bank,"; $sql.= " c.fk_bank,";
$sql.= " b.rowid as bid,"; $sql.= " b.rowid as bid,";
@ -724,7 +724,7 @@ if ($rowid)
$cotisationstatic->id=$objp->crowid; $cotisationstatic->id=$objp->crowid;
print '<td>'.$cotisationstatic->getNomUrl(1).'</td>'; print '<td>'.$cotisationstatic->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->datec),'dayhour')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($objp->dateadh),'day')."</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="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->cotisation).'</td>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))

View File

@ -1191,7 +1191,7 @@ class Adherent extends CommonObject
$sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, c.fk_bank,"; $sql = "SELECT c.rowid, c.fk_adherent, c.cotisation, c.note, c.fk_bank,";
$sql.= " c.tms as datem,"; $sql.= " c.tms as datem,";
$sql.= " c.datec as datec,"; $sql.= " c.datec as datec,";
$sql.= " c.dateadh as dateadh,"; $sql.= " c.dateadh as dateh,";
$sql.= " c.datef as datef"; $sql.= " c.datef as datef";
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c"; $sql.= " FROM ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " WHERE c.fk_adherent = ".$this->id; $sql.= " WHERE c.fk_adherent = ".$this->id;
@ -1208,10 +1208,10 @@ class Adherent extends CommonObject
{ {
if ($i==0) if ($i==0)
{ {
$this->first_subscription_date=$obj->dateadh; $this->first_subscription_date=$obj->dateh;
$this->first_subscription_amount=$obj->cotisation; $this->first_subscription_amount=$obj->cotisation;
} }
$this->last_subscription_date=$obj->dateadh; $this->last_subscription_date=$obj->dateh;
$this->last_subscription_amount=$obj->cotisation; $this->last_subscription_amount=$obj->cotisation;
$subscription=new Cotisation($this->db); $subscription=new Cotisation($this->db);
@ -1222,7 +1222,7 @@ class Adherent extends CommonObject
$subscription->fk_bank=$obj->fk_bank; $subscription->fk_bank=$obj->fk_bank;
$subscription->datem=$this->db->jdate($obj->datem); $subscription->datem=$this->db->jdate($obj->datem);
$subscription->datec=$this->db->jdate($obj->datec); $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); $subscription->datef=$this->db->jdate($obj->datef);
$this->subscriptions[]=$subscription; $this->subscriptions[]=$subscription;

View File

@ -36,9 +36,9 @@ class Cotisation extends CommonObject
var $id; var $id;
var $ref; var $ref;
var $datec; var $datec; // Date creation
var $datem; var $datem; // Date modification
var $dateh; // Subscription start date var $dateh; // Subscription start date (date subscription)
var $datef; // Subscription end date var $datef; // Subscription end date
var $fk_adherent; var $fk_adherent;
var $amount; var $amount;
@ -107,7 +107,7 @@ class Cotisation extends CommonObject
{ {
$sql ="SELECT rowid, fk_adherent, datec,"; $sql ="SELECT rowid, fk_adherent, datec,";
$sql.=" tms,"; $sql.=" tms,";
$sql.=" dateadh,"; $sql.=" dateadh as dateh,";
$sql.=" datef,"; $sql.=" datef,";
$sql.=" cotisation, note, fk_bank"; $sql.=" cotisation, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
@ -127,7 +127,7 @@ class Cotisation extends CommonObject
$this->fk_adherent = $obj->fk_adherent; $this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms); $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->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->cotisation; $this->amount = $obj->cotisation;
$this->note = $obj->note; $this->note = $obj->note;

View File

@ -63,7 +63,7 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu
if ($msg) print $msg.'<br>'; if ($msg) print $msg.'<br>';
// Liste des cotisations // List of subscriptions
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,"; $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.cotisation,";
$sql.= " c.dateadh,"; $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"; $sql.= " WHERE d.rowid = c.fk_adherent";
if (isset($date_select) && $date_select != '') 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->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($conf->liste_limit+1, $offset);

View File

@ -367,13 +367,13 @@ $Number=array();
$tot=0; $tot=0;
$numb=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.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c";
$sql.= " WHERE d.entity IN (".getEntity().")"; $sql.= " WHERE d.entity IN (".getEntity().")";
$sql.= " AND d.rowid = c.fk_adherent"; $sql.= " AND d.rowid = c.fk_adherent";
if(isset($date_select) && $date_select != '') if(isset($date_select) && $date_select != '')
{ {
$sql .= " AND dateadh LIKE '$date_select%'"; $sql .= " AND c.dateadh LIKE '".$date_select."%'";
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -383,7 +383,7 @@ if ($result)
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $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; $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation;
$Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1;
$tot+=$objp->cotisation; $tot+=$objp->cotisation;