Error management
This commit is contained in:
parent
7e70aaa2f0
commit
264df5d3a6
@ -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,78 +233,80 @@ 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 '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print $html->showrefnav($adh,'rowid');
|
||||
print '</td></tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$adh->nom.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$adh->prenom.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($errmsg)
|
||||
if ($rowid)
|
||||
{
|
||||
$adh->id = $rowid;
|
||||
$result=$adh->fetch($rowid);
|
||||
$result=$adh->fetch_optionals($rowid);
|
||||
|
||||
$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 '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print $html->showrefnav($adh,'rowid');
|
||||
print '</td></tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$adh->nom.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Prenom
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$adh->prenom.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($errmsg)
|
||||
{
|
||||
if (preg_match('/^Error/i',$errmsg))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$errmsg=$langs->trans($errmsg);
|
||||
}
|
||||
print '<div class="error">'.$errmsg.'</div>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Lien nouvelle cotisation si non brouillon et non resilie
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
// Lien nouvelle cotisation si non brouillon et non resilie
|
||||
if ($user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($action != 'addsubscription')
|
||||
{
|
||||
if ($adh->statut > 0) print "<a class=\"butAction\" href=\"card_subscriptions.php?rowid=$rowid&action=addsubscription\">".$langs->trans("AddSubscription")."</a>";
|
||||
@ -312,18 +314,18 @@ if ($user->rights->adherent->cotisation->creer)
|
||||
|
||||
print "<br>\n";
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
// Date fin cotisation
|
||||
print "<table class=\"border\" width=\"50%\">\n";
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($adh->datefin)
|
||||
{
|
||||
// Date fin cotisation
|
||||
print "<table class=\"border\" width=\"50%\">\n";
|
||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($adh->datefin)
|
||||
{
|
||||
if ($adh->datefin < time())
|
||||
{
|
||||
print dol_print_date($adh->datefin,'day');
|
||||
@ -333,23 +335,23 @@ if ($adh->datefin)
|
||||
{
|
||||
print dol_print_date($adh->datefin,'day');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* List of subscriptions
|
||||
*/
|
||||
if ($action != 'addsubscription')
|
||||
{
|
||||
if ($action != 'addsubscription')
|
||||
{
|
||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
|
||||
$sql.= " c.rowid as crowid, c.cotisation,";
|
||||
$sql.= " c.dateadh,";
|
||||
@ -420,15 +422,15 @@ if ($action != 'addsubscription')
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Add new subscription form
|
||||
*/
|
||||
if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("NewCotisation"));
|
||||
@ -628,11 +630,16 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
||||
print '</form>';
|
||||
|
||||
print "\n<!-- End form subscription -->\n\n";
|
||||
}
|
||||
|
||||
//print '</td></tr>';
|
||||
//print '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
}
|
||||
|
||||
//print '</td></tr>';
|
||||
//print '</table>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user