From dcfc34e64e49f9fcaec7f4128021f1a794f3a830 Mon Sep 17 00:00:00 2001 From: Regis Houssin <regis@dolibarr.fr> Date: Sat, 25 Aug 2012 19:20:17 +0200 Subject: [PATCH] Fix: more better of better --- htdocs/comm/propal.php | 16 +++++++++++++-- htdocs/comm/propal/contact.php | 36 ++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 13d1fe73b8d..169233e9f6e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -96,12 +96,24 @@ $object = new Propal($db); if ($id > 0 || ! empty($ref)) { $ret=$object->fetch($id, $ref); + if ($ret == 0) + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); + $error++; + } + else if ($ret < 0) + { + setEventMessage($object->error, 'errors'); + $error++; + } +} +if (! $error) +{ $object->fetch_thirdparty(); } else { - $langs->load("errors"); - setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); Header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); exit; } diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 8bea9fa2471..60f354d5f2a 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -47,18 +47,30 @@ $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); -// Load object -if ($id > 0 || ! empty($ref)) -{ - $ret=$object->fetch($id, $ref); - $object->fetch_thirdparty(); -} -else -{ - $langs->load("errors"); - setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); - Header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); - exit; +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); + if ($ret == 0) + { + $langs->load("errors"); + setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors'); + $error++; + } + else if ($ret < 0) + { + setEventMessage($object->error, 'errors'); + $error++; + } +} +if (! $error) +{ + $object->fetch_thirdparty(); +} +else +{ + Header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); + exit; } -- GitLab