New: Debut date fin adhesion sur adhesion.

This commit is contained in:
Laurent Destailleur 2007-09-04 17:53:11 +00:00
parent 51f62f4f66
commit e0dee02855
6 changed files with 57 additions and 11 deletions

View File

@ -1739,16 +1739,25 @@ class Adherent
* \brief Renvoie nom clicable (avec eventuellement le picto) * \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 withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* \param maxlen Longueur max libelle * \param maxlen Longueur max libelle
* \param option Page lien
* \return string Chaine avec URL * \return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlen=0) function getNomUrl($withpicto=0,$maxlen=0,$option='card')
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/adherents/fiche.php?rowid='.$this->id.'">'; if ($option == 'card')
$lienfin='</a>'; {
$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'; $picto='user';
$label=$langs->trans("ShowMember"); $label=$langs->trans("ShowMember");

View File

@ -362,15 +362,27 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
print '<tr><td colspan="2"><b>'.$langs->trans("NewCotisation").'</b></td></tr>'; 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>'; print '<tr><td>'.$langs->trans("DateSubscription").'</td><td>';
if ($adh->datefin > 0) 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 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>"; print "</td></tr>";
if ($adht->cotisation) if ($adht->cotisation)

View File

@ -93,6 +93,7 @@ class Cotisation
$sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,"; $sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,";
$sql.=" tms,"; $sql.=" tms,";
$sql.=" ".$this->db->pdate("dateadh")." as dateadh,"; $sql.=" ".$this->db->pdate("dateadh")." as dateadh,";
$sql.=" ".$this->db->pdate("datef")." as datef,";
$sql.=" cotisation, note, fk_bank"; $sql.=" cotisation, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation";
$sql.=" WHERE rowid=".$rowid; $sql.=" WHERE rowid=".$rowid;
@ -112,6 +113,7 @@ class Cotisation
$this->datec = $obj->datec; $this->datec = $obj->datec;
$this->datem = $obj->tms; $this->datem = $obj->tms;
$this->dateh = $obj->dateadh; $this->dateh = $obj->dateadh;
$this->datef = $obj->datef;
$this->amount = $obj->cotisation; $this->amount = $obj->cotisation;
$this->note = $obj->note; $this->note = $obj->note;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;

View File

@ -194,12 +194,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$subscription->ref.'&nbsp;</td></tr>'; print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$subscription->ref.'&nbsp;</td></tr>';
// Date // Date start subscription
print '<tr><td>'.$langs->trans("Date").'</td><td class="valeur" colspan="2">'; print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
$htmls->select_date($subscription->dateh,'datesub',1,1,0,'update',1); $htmls->select_date($subscription->dateh,'datesub',1,1,0,'update',1);
print '</td>'; print '</td>';
print '</tr>'; 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 // Amount
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">'; 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>'; 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); $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>'; 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>'; print '</td></tr>';
// Date // Member
print '<tr><td>'.$langs->trans("Date").'</td><td class="valeur">'.dolibarr_print_date($subscription->dateh,'dayhour').'</td>'; $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>'; print '</tr>';
// Amount // Amount

View File

@ -31,7 +31,10 @@ alter table llx_paiement drop column author;
update llx_actioncomm set fk_action = 9 where fk_action = 10; 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); 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'; update llx_const set name='MAIN_ENABLE_DEVELOPMENT' where name='MAIN_SHOW_DEVELOPMENT_MODULES';
delete from llx_const where name='MAIN_SHOW_DEVELOPMENT_MODULES'; delete from llx_const where name='MAIN_SHOW_DEVELOPMENT_MODULES';

View File

@ -26,6 +26,7 @@ create table llx_cotisation
datec datetime, datec datetime,
fk_adherent integer, fk_adherent integer,
dateadh datetime, dateadh datetime,
datef date,
cotisation real, cotisation real,
fk_bank int(11) DEFAULT NULL, fk_bank int(11) DEFAULT NULL,
note text note text