From 4eacad52f2ce32d3cb08c4b57ac7694be3b48bd5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 27 Jul 2018 10:06:56 +0200 Subject: [PATCH] Clean and update code --- htdocs/public/ticket/list.php | 5 +++-- htdocs/public/ticket/view.php | 5 +++-- htdocs/resource/contact.php | 10 +++++----- htdocs/ticket/class/ticket.class.php | 11 +++++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index d8290849f55..fe1dacbbbc7 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -121,8 +121,9 @@ if ($action == "view_ticketlist") { } } - if ($error) { - setEventMessage($object->errors, 'errors'); + if ($error || $errors) + { + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 5383133c42e..38fcb3c4991 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -112,8 +112,9 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | } } - if ($error) { - setEventMessage($object->errors, 'errors'); + if ($error || $errors) + { + setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index 981a07d7e73..e350c746c12 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2016 Gilles Poirier * * This program is free software; you can redistribute it and/or modify @@ -47,7 +47,7 @@ $result = $object->fetch($id,$ref); /* - * Ajout d'un nouveau contact + * Add a new contact */ if ($action == 'addcontact' && $user->rights->resource->write) @@ -72,17 +72,17 @@ if ($action == 'addcontact' && $user->rights->resource->write) $mesg = $object->error; } - setEventMessage($mesg, 'errors'); + setEventMessages($mesg, null, 'errors'); } } -// bascule du statut d'un contact +// Toggle the status of a contact else if ($action == 'swapstatut' && $user->rights->resource->write) { $result=$object->swapContactStatus(GETPOST('ligne','int')); } -// Efface un contact +// Erase a contact else if ($action == 'deletecontact' && $user->rights->resource->write) { $result = $object->delete_contact(GETPOST('lineid','int')); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3dc0ab39756..bcec0158454 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1614,9 +1614,12 @@ class Ticket extends CommonObject } include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); - if ($mailfile->error) { - setEventMessage($mailfile->error, 'errors'); - } else { + if ($mailfile->error || $mailfile->errors) + { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } + else + { $result = $mailfile->sendfile(); if ($result > 0) { $nb_sent++; @@ -1627,7 +1630,7 @@ class Ticket extends CommonObject } } - setEventMessage($langs->trans('TicketNotificationNumberEmailSent', $nb_sent)); + setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs'); } return $nb_sent;