Error management
This commit is contained in:
parent
7e70aaa2f0
commit
264df5d3a6
@ -47,9 +47,9 @@ $errmsg='';
|
|||||||
$defaultdelay=1;
|
$defaultdelay=1;
|
||||||
$defaultdelayunit='y';
|
$defaultdelayunit='y';
|
||||||
|
|
||||||
$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
$action=GETPOST('action');
|
||||||
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
|
$rowid=GETPOST('rowid');
|
||||||
$typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
$typeid=GETPOST('typeid');
|
||||||
|
|
||||||
if (! $user->rights->adherent->cotisation->lire)
|
if (! $user->rights->adherent->cotisation->lire)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -233,78 +233,80 @@ if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisatio
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
$adh->id = $rowid;
|
llxHeader('',$langs->trans("Subscriptions"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||||
$result=$adh->fetch($rowid);
|
|
||||||
$result=$adh->fetch_optionals($rowid);
|
|
||||||
|
|
||||||
$adht->fetch($adh->typeid);
|
if ($rowid)
|
||||||
|
|
||||||
// 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)
|
|
||||||
{
|
{
|
||||||
|
$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))
|
if (preg_match('/^Error/i',$errmsg))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg=$langs->trans($errmsg);
|
$errmsg=$langs->trans($errmsg);
|
||||||
}
|
}
|
||||||
print '<div class="error">'.$errmsg.'</div>'."\n";
|
print '<div class="error">'.$errmsg.'</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// Lien nouvelle cotisation si non brouillon et non resilie
|
// Lien nouvelle cotisation si non brouillon et non resilie
|
||||||
if ($user->rights->adherent->cotisation->creer)
|
if ($user->rights->adherent->cotisation->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'addsubscription')
|
if ($action != 'addsubscription')
|
||||||
{
|
{
|
||||||
if ($adh->statut > 0) print "<a class=\"butAction\" href=\"card_subscriptions.php?rowid=$rowid&action=addsubscription\">".$langs->trans("AddSubscription")."</a>";
|
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 "<br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Date fin cotisation
|
// Date fin cotisation
|
||||||
print "<table class=\"border\" width=\"50%\">\n";
|
print "<table class=\"border\" width=\"50%\">\n";
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionEndDate");
|
print '<tr><td>'.$langs->trans("SubscriptionEndDate");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($adh->datefin)
|
if ($adh->datefin)
|
||||||
{
|
{
|
||||||
if ($adh->datefin < time())
|
if ($adh->datefin < time())
|
||||||
{
|
{
|
||||||
print dol_print_date($adh->datefin,'day');
|
print dol_print_date($adh->datefin,'day');
|
||||||
@ -333,23 +335,23 @@ if ($adh->datefin)
|
|||||||
{
|
{
|
||||||
print dol_print_date($adh->datefin,'day');
|
print dol_print_date($adh->datefin,'day');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
if ($adh->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of subscriptions
|
* List of subscriptions
|
||||||
*/
|
*/
|
||||||
if ($action != 'addsubscription')
|
if ($action != 'addsubscription')
|
||||||
{
|
{
|
||||||
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
|
$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,";
|
||||||
$sql.= " c.rowid as crowid, c.cotisation,";
|
$sql.= " c.rowid as crowid, c.cotisation,";
|
||||||
$sql.= " c.dateadh,";
|
$sql.= " c.dateadh,";
|
||||||
@ -420,15 +422,15 @@ if ($action != 'addsubscription')
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new subscription form
|
* Add new subscription form
|
||||||
*/
|
*/
|
||||||
if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("NewCotisation"));
|
print_fiche_titre($langs->trans("NewCotisation"));
|
||||||
@ -628,11 +630,16 @@ if ($action == 'addsubscription' && $user->rights->adherent->cotisation->creer)
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print "\n<!-- End form subscription -->\n\n";
|
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();
|
$db->close();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user