Clean and update code

This commit is contained in:
Philippe GRAND 2018-07-27 10:06:56 +02:00
parent efa6ad0659
commit 4eacad52f2
4 changed files with 18 additions and 13 deletions

View File

@ -121,8 +121,9 @@ if ($action == "view_ticketlist") {
}
}
if ($error) {
setEventMessage($object->errors, 'errors');
if ($error || $errors)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}

View File

@ -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 = '';
}
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
*
* 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'));

View File

@ -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;