From a5deeebfdca8aca6c2d97f4d0d0ed60251fb6acb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Aug 2014 19:32:36 +0200 Subject: [PATCH] Add try catch --- htdocs/comm/mailing/cibles.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index df51f91e1a2..e10ea970b43 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -98,11 +98,10 @@ if ($action == 'add') $result=$obj->add_to_target($id,$filtersarray); } } - if ($result > 0) { setEventMessage($langs->trans("XTargetsAdded",$result),'mesgs'); - + header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } @@ -167,7 +166,6 @@ if ($_POST["button_removefilter"]) /* * View */ - llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); $form = new Form($db); @@ -306,12 +304,14 @@ if ($object->fetch($id) >= 0) print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc(); print ''; - /* - print ''; - print $modulename; - print ""; - */ - $nbofrecipient=$obj->getNbOfRecipients(''); + try { + $nbofrecipient=$obj->getNbOfRecipients(''); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } + print ''; if ($nbofrecipient >= 0) { @@ -324,7 +324,13 @@ if ($object->fetch($id) >= 0) print ''; print ''; - $filter=$obj->formFilter(); + try { + $filter=$obj->formFilter(); + } + catch(Exception $e) + { + dol_syslog($e->getMessage(), LOG_ERR); + } if ($filter) print $filter; else print $langs->trans("None"); print ''; @@ -421,7 +427,7 @@ if ($object->fetch($id) >= 0) print ''; print ' '; print ''; - + print ''; // Ligne des champs de filtres @@ -446,7 +452,7 @@ if ($object->fetch($id) >= 0) print ''; print ' '; print ''; - + // Date sending print ''; print ' '; @@ -530,7 +536,7 @@ if ($object->fetch($id) >= 0) print $object::libStatutDest($obj->statut,2); print ''; } - + //Sreach Icon print ''; print '';