diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 31a1cdf0603..fc8b9e78437 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -47,9 +47,9 @@ $errmsg=''; $defaultdelay=1; $defaultdelayunit='y'; -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; -$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; -$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; +$action=GETPOST('action'); +$rowid=GETPOST('rowid'); +$typeid=GETPOST('typeid'); if (! $user->rights->adherent->cotisation->lire) accessforbidden(); @@ -233,406 +233,413 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio * View */ -llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); - $html = new Form($db); -$adh->id = $rowid; -$result=$adh->fetch($rowid); -$result=$adh->fetch_optionals($rowid); +llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'); -$adht->fetch($adh->typeid); - -// fetch optionals attributes and labels -$adho->fetch_optionals(); - - -$head = member_prepare_head($adh); - -dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user'); - -print '
'; - -dol_fiche_end(); - - -if ($errmsg) +if ($rowid) { - if (preg_match('/^Error/i',$errmsg)) - { - $langs->load("errors"); - $errmsg=$langs->trans($errmsg); - } - print '| '.$langs->trans("SubscriptionEndDate"); -print ' | '; -print '';
-if ($adh->datefin)
-{
- if ($adh->datefin < time())
+ dol_fiche_end();
+
+
+ if ($errmsg)
{
- print dol_print_date($adh->datefin,'day');
+ if (preg_match('/^Error/i',$errmsg))
+ {
+ $langs->load("errors");
+ $errmsg=$langs->trans($errmsg);
+ }
+ print ' '.$errmsg.' '."\n";
+ }
+
+
+ /*
+ * Barre d'actions
+ */
+
+ print '';
+
+ // Lien nouvelle cotisation si non brouillon et non resilie
+ if ($user->rights->adherent->cotisation->creer)
+ {
+ if ($action != 'addsubscription')
+ {
+ if ($adh->statut > 0) print "".$langs->trans("AddSubscription")."";
+ else print ''.$langs->trans("AddSubscription").'';
+
+ print " ';
+
+
+
+ // Date fin cotisation
+ print "\n"; + } + } + print '
'; - - -/* - * List of subscriptions - */ -if ($action != 'addsubscription') -{ - $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; - $sql.= " c.rowid as crowid, c.cotisation,"; - $sql.= " c.dateadh,"; - $sql.= " c.datef,"; - $sql.= " c.fk_bank,"; - $sql.= " b.rowid as bid,"; - $sql.= " ba.rowid as baid, ba.label, ba.bank"; - $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; - $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; - - $result = $db->query($sql); - if ($result) - { - $cotisationstatic=new Cotisation($db); - $accountstatic=new Account($db); - - $num = $db->num_rows($result); - $i = 0; - - print "
'; - - print_fiche_titre($langs->trans("NewCotisation")); - - $bankdirect=0; // Option to write to bank is on by default - $bankviainvoice=0; // Option to write via invoice is on by default - $invoiceonly=0; - if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && (empty($_POST['paymentsave']) || $_POST["paymentsave"] == 'bankdirect')) $bankdirect=1; - if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled && $adh->fk_soc) $bankviainvoice=1; - // TODO A virer - //$bankviainvoice=0; - - print "\n\n\n"; - - if ($conf->use_javascript_ajax) - { - print "\n".''."\n"; - } - - print ''; + /* + * List of subscriptions + */ + if ($action != 'addsubscription') + { + $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; + $sql.= " c.rowid as crowid, c.cotisation,"; + $sql.= " c.dateadh,"; + $sql.= " c.datef,"; + $sql.= " c.fk_bank,"; + $sql.= " b.rowid as bid,"; + $sql.= " ba.rowid as baid, ba.label, ba.bank"; + $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."cotisation as c"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; + $sql.= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid; - print "\n\n\n"; + $result = $db->query($sql); + if ($result) + { + $cotisationstatic=new Cotisation($db); + $accountstatic=new Account($db); + + $num = $db->num_rows($result); + $i = 0; + + print "
'; + + print_fiche_titre($langs->trans("NewCotisation")); + + $bankdirect=0; // Option to write to bank is on by default + $bankviainvoice=0; // Option to write via invoice is on by default + $invoiceonly=0; + if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE && (empty($_POST['paymentsave']) || $_POST["paymentsave"] == 'bankdirect')) $bankdirect=1; + if ($conf->banque->enabled && $conf->societe->enabled && $conf->facture->enabled && $adh->fk_soc) $bankviainvoice=1; + // TODO A virer + //$bankviainvoice=0; + + print "\n\n\n"; + + if ($conf->use_javascript_ajax) + { + print "\n".''."\n"; + } + + print ''; + + print "\n\n\n"; + } + + //print ' |