diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 1ba8dbfd639..f21090d4a8e 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1739,16 +1739,25 @@ class Adherent * \brief Renvoie nom clicable (avec eventuellement le picto) * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * \param maxlen Longueur max libelle + * \param option Page lien * \return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlen=0) + function getNomUrl($withpicto=0,$maxlen=0,$option='card') { global $langs; $result=''; - $lien = ''; - $lienfin=''; + if ($option == 'card') + { + $lien = ''; + $lienfin=''; + } + if ($option == 'subscription') + { + $lien = ''; + $lienfin=''; + } $picto='user'; $label=$langs->trans("ShowMember"); diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 5fd8a37f6e9..d57bbdb3c67 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -362,15 +362,27 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer) print ''.$langs->trans("NewCotisation").''; + $today=mktime(); + $defaultdelay=1; + $defaultdelayunit='y'; + + // Date start subscription print ''.$langs->trans("DateSubscription").''; if ($adh->datefin > 0) { - $html->select_date(dolibarr_time_plus_duree($adh->datefin,1,'d'),'','','','',"cotisation"); + $datefrom=dolibarr_time_plus_duree($adh->datefin,1,'d'); } else { - $html->select_date('','','','','',"cotisation"); + $datefrom=mktime(); } + $html->select_date($datefrom,'','','','',"cotisation"); + print ""; + + // Date end subscription + print ''.$langs->trans("DateEndSubscription").''; + $dateto=dolibarr_time_plus_duree(dolibarr_time_plus_duree($datefrom,$defaultdelay,$defaultdelayunit),-1,'d'); + $html->select_date($dateto,'end','','','',"cotisation"); print ""; if ($adht->cotisation) diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index 2966ec13b7b..41324f41885 100644 --- a/htdocs/adherents/cotisation.class.php +++ b/htdocs/adherents/cotisation.class.php @@ -93,6 +93,7 @@ class Cotisation $sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,"; $sql.=" tms,"; $sql.=" ".$this->db->pdate("dateadh")." as dateadh,"; + $sql.=" ".$this->db->pdate("datef")." as datef,"; $sql.=" cotisation, note, fk_bank"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" WHERE rowid=".$rowid; @@ -112,6 +113,7 @@ class Cotisation $this->datec = $obj->datec; $this->datem = $obj->tms; $this->dateh = $obj->dateadh; + $this->datef = $obj->datef; $this->amount = $obj->cotisation; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 19e663692de..edce2ed3233 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -194,12 +194,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') // Ref print ''.$langs->trans("Ref").''.$subscription->ref.' '; - // Date - print ''.$langs->trans("Date").''; + // Date start subscription + print ''.$langs->trans("DateSubscription").''; $htmls->select_date($subscription->dateh,'datesub',1,1,0,'update',1); print ''; print ''; + // Date end subscription + print ''.$langs->trans("DateEndSubscription").''; + $htmls->select_date($subscription->datef,'datesubend',0,0,0,'update',1); + print ''; + print ''; + // Amount print ''.$langs->trans("Amount").''; print ''; @@ -226,8 +232,9 @@ if ($rowid && $action != 'edit') /* */ /* ************************************************************************** */ - $subscription->fetch($rowid); - + $result=$subscription->fetch($rowid); + $result=$adh->fetch($subscription->fk_adherent); + $html = new Form($db); /* @@ -272,8 +279,20 @@ if ($rowid && $action != 'edit') if ($previous_id || $next_id) print ''.$previous_id.''.$next_id.''; print ''; - // Date - print ''.$langs->trans("Date").''.dolibarr_print_date($subscription->dateh,'dayhour').''; + // Member + $adh->ref=$adh->fullname; + print ''; + print ''.$langs->trans("Member").''.$adh->getNomUrl(1,0,'subscription').''; + print ''; + + // Date subscription + print ''; + print ''.$langs->trans("DateSubscription").''.dolibarr_print_date($subscription->dateh,'dayhour').''; + print ''; + + // Date end subscription + print ''; + print ''.$langs->trans("DateEndSubscription").''.dolibarr_print_date($subscription->datef,'day').''; print ''; // Amount diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index 90b5bbe6e4c..0556e99dc53 100644 --- a/mysql/migration/2.1.0-2.2.0.sql +++ b/mysql/migration/2.1.0-2.2.0.sql @@ -31,7 +31,10 @@ alter table llx_paiement drop column author; update llx_actioncomm set fk_action = 9 where fk_action = 10; +ALTER TABLE llx_cotisation ADD COLUMN datef date after dateadh; +ALTER TABLE llx_cotisation modify datef date; ALTER TABLE llx_cotisation ADD UNIQUE INDEX uk_cotisation (fk_adherent,dateadh); +update llx_cotisation set datef = ADDDATE(ADDDATE(dateadh, INTERVAL 1 YEAR),INTERVAL -1 DAY); update llx_const set name='MAIN_ENABLE_DEVELOPMENT' where name='MAIN_SHOW_DEVELOPMENT_MODULES'; delete from llx_const where name='MAIN_SHOW_DEVELOPMENT_MODULES'; diff --git a/mysql/tables/llx_cotisation.sql b/mysql/tables/llx_cotisation.sql index 06983d356ff..a1ca0a22ffd 100644 --- a/mysql/tables/llx_cotisation.sql +++ b/mysql/tables/llx_cotisation.sql @@ -26,6 +26,7 @@ create table llx_cotisation datec datetime, fk_adherent integer, dateadh datetime, + datef date, cotisation real, fk_bank int(11) DEFAULT NULL, note text