diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 1ba8dbfd63971800a15775a4c2884fc957e149eb..f21090d4a8e5922b7d1d30cfef2394b11241176d 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 = '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$this->id.'">'; - $lienfin='</a>'; + if ($option == 'card') + { + $lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$this->id.'">'; + $lienfin='</a>'; + } + if ($option == 'subscription') + { + $lien = '<a href="'.DOL_URL_ROOT.'/adherents/card_subscriptions.php?rowid='.$this->id.'">'; + $lienfin='</a>'; + } $picto='user'; $label=$langs->trans("ShowMember"); diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 5fd8a37f6e99539af1cd13ca6de1e8ed6848d967..d57bbdb3c67726d877ab31693f9825b17e01c4c4 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 '<tr><td colspan="2"><b>'.$langs->trans("NewCotisation").'</b></td></tr>'; + $today=mktime(); + $defaultdelay=1; + $defaultdelayunit='y'; + + // Date start subscription print '<tr><td>'.$langs->trans("DateSubscription").'</td><td>'; 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 "</td></tr>"; + + // Date end subscription + print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>'; + $dateto=dolibarr_time_plus_duree(dolibarr_time_plus_duree($datefrom,$defaultdelay,$defaultdelayunit),-1,'d'); + $html->select_date($dateto,'end','','','',"cotisation"); print "</td></tr>"; if ($adht->cotisation) diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index 2966ec13b7b8962883ae074718feb9f6d3421c3f..41324f41885ead8f4c936ed49eb3aec4da5761df 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 19e663692ded1cf2c175378d755eccf71de56f23..edce2ed32339b8be2d7631385f5f0c36e4f65877 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 '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$subscription->ref.' </td></tr>'; - // Date - print '<tr><td>'.$langs->trans("Date").'</td><td class="valeur" colspan="2">'; + // Date start subscription + print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">'; $htmls->select_date($subscription->dateh,'datesub',1,1,0,'update',1); print '</td>'; print '</tr>'; + // Date end subscription + print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">'; + $htmls->select_date($subscription->datef,'datesubend',0,0,0,'update',1); + print '</td>'; + print '</tr>'; + // Amount print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">'; print '<input type="text" class="flat" size="10" name="amount" value="'.price($subscription->amount).'"></td></tr>'; @@ -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 '</td><td class="nobordernopadding" align="center" width="20">'.$previous_id.'</td><td class="nobordernopadding" align="center" width="20">'.$next_id.'</td></tr></table>'; print '</td></tr>'; - // Date - print '<tr><td>'.$langs->trans("Date").'</td><td class="valeur">'.dolibarr_print_date($subscription->dateh,'dayhour').'</td>'; + // Member + $adh->ref=$adh->fullname; + print '<tr>'; + print '<td>'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1,0,'subscription').'</td>'; + print '</tr>'; + + // Date subscription + print '<tr>'; + print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dolibarr_print_date($subscription->dateh,'dayhour').'</td>'; + print '</tr>'; + + // Date end subscription + print '<tr>'; + print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur">'.dolibarr_print_date($subscription->datef,'day').'</td>'; print '</tr>'; // Amount diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql index 90b5bbe6e4c509d21ab1af34da2b681194febcef..0556e99dc5329391d2a6bb23f9f98a38279ce757 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 06983d356ff7bba6afc1630ff456e4f59846e219..a1ca0a22ffd88a8b316ab1da9d6d4d0e8b223d56 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