';
//print '
';
// Message list
@@ -716,7 +734,6 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
$actionobject->viewTicketTimelineMessages($show_private_message, true, $object);
print '
';
-
print '
';
print '
';
} elseif ($action == 'add_message') {
diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php
index 08c28ad3085..9a978e2e066 100644
--- a/htdocs/ticketsup/class/actions_ticketsup.class.php
+++ b/htdocs/ticketsup/class/actions_ticketsup.class.php
@@ -92,7 +92,7 @@ class ActionsTicketsup
if (GETPOST('addfile')) {
// altairis : allow files from public interface
if (GETPOST('track_id')) {
- $res = $object->fetch('', GETPOST('track_id','alpha'));
+ $res = $object->fetch('', '', GETPOST('track_id','alpha'));
}
////if($res > 0)
@@ -116,7 +116,7 @@ class ActionsTicketsup
if (GETPOST('removedfile')) {
// altairis : allow files from public interface
if (GETPOST('track_id')) {
- $res = $object->fetch('', GETPOST('track_id'));
+ $res = $object->fetch('', '', GETPOST('track_id','alpha'));
}
////if($res > 0)
@@ -309,7 +309,7 @@ class ActionsTicketsup
}
if ($action == "mark_ticket_read" && $user->rights->ticketsup->write) {
- $object->fetch('', GETPOST("track_id"));
+ $object->fetch('', '', GETPOST("track_id",'alpha'));
if ($object->markAsRead($user) > 0) {
// Log action in ticket logs table
@@ -328,22 +328,26 @@ class ActionsTicketsup
$action = 'view';
}
- if ($action == "assign_user" && GETPOST('btn_assign_user') && $user->rights->ticketsup->write) {
- $object->fetch('', GETPOST("track_id"));
-
+ if ($action == "assign_user" && GETPOST('btn_assign_user','aplha') && $user->rights->ticketsup->write) {
+ $object->fetch('', '', GETPOST("track_id",'alpha'));
$useroriginassign = $object->fk_user_assign;
- $usertoassign = GETPOST('fk_user_assign');
- if (!$usertoassign) {
+ $usertoassign = GETPOST('fk_user_assign','int');
+
+ /*if (! ($usertoassign > 0)) {
$error++;
array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("UserAssignedTo")));
$action = 'view';
+ }*/
+
+ if (!$error)
+ {
+ $ret = $object->assignUser($user, $usertoassign);
+ if ($ret < 0) $error++;
}
- if (!$error) {
- $ret = $object->assignUser($user, $usertoassign);
-
- if ($ret) {
- // Si déjà un user assigné on le supprime des contacts
+ if (! $error) // Update list of contacts
+ {
+ // Si déjà un user assigné on le supprime des contacts
if ($useroriginassign > 0) {
$internal_contacts = $object->listeContact(-1, 'internal');
@@ -356,9 +360,12 @@ class ActionsTicketsup
}
}
}
- $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
- }
+ if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
+ }
+
+ if (! $error)
+ {
// Log action in ticket logs table
$object->fetch_user($usertoassign);
$log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs));
@@ -377,7 +384,7 @@ class ActionsTicketsup
}
if ($action == "change_property" && GETPOST('btn_update_ticket_prop') && $user->rights->ticketsup->write) {
- $this->fetch('', GETPOST('track_id'));
+ $this->fetch('', '', GETPOST('track_id','alpha'));
$fieldtomodify = GETPOST('property') . '_code';
$fieldtomodify_label = GETPOST('property') . '_label';
@@ -423,7 +430,7 @@ class ActionsTicketsup
}
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticketsup->write) {
- $this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha'));
+ $this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
if ($object->close()) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $user->getFullName($langs));
@@ -442,7 +449,7 @@ class ActionsTicketsup
}
if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') {
- $this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha'));
+ $this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
if (($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) && $object->close()) {
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']);
@@ -461,7 +468,7 @@ class ActionsTicketsup
}
if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticketsup->delete) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
if ($object->delete($user) > 0) {
setEventMessages('
' . $langs->trans('TicketDeletedSuccess') . '
', null, 'mesgs');
Header("Location: ".DOL_URL_ROOT."/ticketsup/list.php");
@@ -476,7 +483,7 @@ class ActionsTicketsup
// Set parent company
if ($action == 'set_thirdparty' && $user->rights->societe->creer) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = 'card.php?action=view&track_id=' . GETPOST('track_id', 'alpha');
header("Location: " . $url);
@@ -485,7 +492,7 @@ class ActionsTicketsup
}
if ($action == 'set_progression' && $user->rights->ticketsup->write) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setProgression(GETPOST('progress'));
// Log action in ticket logs table
$log_action = $langs->trans('TicketLogProgressSetTo', GETPOST('progress'));
@@ -517,7 +524,7 @@ class ActionsTicketsup
}
if ($action == "set_extrafields" && GETPOST('btn_edit_extrafields') && $user->rights->ticketsup->write && !GETPOST('cancel')) {
- $res = $this->fetch('', GETPOST('track_id'));
+ $res = $this->fetch('', '', GETPOST('track_id','alpha'));
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
@@ -534,7 +541,7 @@ class ActionsTicketsup
$action = 'view';
} // Reopen ticket
elseif ($action == 'confirm_reopen' && $user->rights->ticketsup->manage && !GETPOST('cancel')) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times
if ($object->fk_statut == 8) {
$res = $object->setStatut(4);
@@ -550,7 +557,7 @@ class ActionsTicketsup
}
} // Categorisation dans projet
elseif ($action == 'classin' && $user->rights->ticketsup->write) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setProject(GETPOST('projectid'));
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
@@ -558,7 +565,7 @@ class ActionsTicketsup
}
} // Categorisation dans contrat
elseif ($action == 'setcontract' && $user->rights->ticketsup->write) {
- if ($this->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
+ if ($this->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$object->setContract(GETPOST('contractid'));
$url = 'card.php?action=view&track_id=' . $object->track_id;
header("Location: " . $url);
@@ -567,7 +574,7 @@ class ActionsTicketsup
} elseif ($action == "set_message" && $user->rights->ticketsup->manage) {
// altairis: manage cancel button
if (!GETPOST('cancel')) {
- $this->fetch('', GETPOST('track_id'));
+ $this->fetch('', '', GETPOST('track_id','alpha'));
$oldvalue_message = $object->message;
$fieldtomodify = GETPOST('message_initial');
@@ -627,7 +634,7 @@ class ActionsTicketsup
$error = 0;
$object = new Ticketsup($this->db);
- $ret = $object->fetch('', GETPOST('track_id'));
+ $ret = $object->fetch('', '', GETPOST('track_id','alpha'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if ($ret < 0) {
@@ -833,7 +840,7 @@ class ActionsTicketsup
global $mysoc, $conf, $langs;
$error = 0;
- $ret = $object->fetch('', GETPOST('track_id'));
+ $ret = $object->fetch('', '', GETPOST('track_id','alpha'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
if ($ret < 0) {
@@ -969,14 +976,14 @@ class ActionsTicketsup
* Fetch object
*
* @param int $id ID of ticket
- * @param int $track_id Track ID of ticket (for public area)
* @param string $ref Reference of ticket
+ * @param string $track_id Track ID of ticket (for public area)
* @return void
*/
- public function fetch($id = 0, $track_id = 0, $ref = '')
+ public function fetch($id = 0, $ref = '', $track_id = '')
{
$this->getInstanceDao();
- return $this->dao->fetch($id, $track_id, $ref);
+ return $this->dao->fetch($id, $ref, $track_id);
}
/**
@@ -1000,7 +1007,7 @@ class ActionsTicketsup
public function getInfo($id)
{
$this->getInstanceDao();
- $this->dao->fetch($id, $track_id);
+ $this->dao->fetch($id, '', $track_id);
$this->label = $this->dao->label;
$this->description = $this->dao->description;
@@ -1140,10 +1147,12 @@ class ActionsTicketsup
/**
* Show ticket original message
*
- * @param User $user $user wich display
- * @param string $action Action mode
+ * @param User $user User wich display
+ * @param string $action Action mode
+ * @param TicketSup $object Object ticket
+ * @return void
*/
- public function viewTicketOriginalMessage($user, $action = '')
+ public function viewTicketOriginalMessage($user, $action, $object)
{
global $langs;
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
@@ -1151,16 +1160,18 @@ class ActionsTicketsup
print '