From cd30e2744b4c7d73e6f72b3d202829b0d0d5ebe9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Dec 2011 15:22:48 +0100 Subject: [PATCH] New: Add error message of login not found --- htdocs/adherents/cartes/carte.php | 100 ++++++++++++++++-------------- 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index ad783039514..8b0a051e0b0 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) 2006-2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ $mode=GETPOST('mode'); $mesg=''; + /* * View */ @@ -51,46 +52,8 @@ if ($mode == 'cardlogin' && empty($foruserlogin)) $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Login")); } -if ((empty($foruserid) && empty($foruserlogin) && empty($mode)) || $mesg) +if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg) { - llxHeader('',$langs->trans("MembersCards")); - - print_fiche_titre($langs->trans("LinkToGeneratedPages")); - print '
'; - - print $langs->trans("LinkToGeneratedPagesDesc").'
'; - print '
'; - - if ($mesg) print '
'.$mesg.'

'; - - print $langs->trans("DocForAllMembersCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; - print '
'; - print ''; - print ''; - print ' '; - print '
'; - print '
'; - - print $langs->trans("DocForOneMemberCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; - print '
'; - print ''; - print $langs->trans("Login").': '; - print ' '; - print '
'; - print '
'; - - print $langs->trans("DocForLabels",$conf->global->ADHERENT_ETIQUETTE_TYPE).' '; - print '
'; - print ''; - print ' '; - print '
'; - print '
'; - - llxFooter(); -} -else -{ - $arrayofmembers=array(); // requete en prenant que les adherents a jour de cotisation @@ -192,25 +155,70 @@ else // Build and output PDF if (empty($mode) || $mode=='card' || $mode='cardlogin') { - $result=members_card_pdf_create($db, $arrayofmembers, '', $outputlangs); + if (! count($arrayofmembers)) + { + $mesg=$langs->trans("ErrorRecordNotFound"); + } + + if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, '', $outputlangs); + } - if ($mode == 'label') + elseif ($mode == 'label') { $result=members_label_pdf_create($db, $arrayofmembers, '', $outputlangs); } if ($result <= 0) { - dol_print_error($db,$result); - exit; + dol_print_error('',$result); } } else { dol_print_error($db); - - llxFooter(); } + + if (! $mesg) exit; } + + + + +llxHeader('',$langs->trans("MembersCards")); + +print_fiche_titre($langs->trans("LinkToGeneratedPages")); +print '
'; + +print $langs->trans("LinkToGeneratedPagesDesc").'
'; +print '
'; + +dol_htmloutput_errors($mesg); + +print $langs->trans("DocForAllMembersCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; +print '
'; +print ''; +print ''; +print ' '; +print '
'; +print '
'; + +print $langs->trans("DocForOneMemberCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; +print '
'; +print ''; +print $langs->trans("Login").': '; +print ' '; +print '
'; +print '
'; + +print $langs->trans("DocForLabels",$conf->global->ADHERENT_ETIQUETTE_TYPE).' '; +print '
'; +print ''; +print ' '; +print '
'; +print '
'; + +llxFooter(); + +$db->close(); ?>