Skip to content
Snippets Groups Projects
Commit ce15103e authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #5326 "visa instead of" is not write in history

parent f759a47e
No related branches found
No related tags found
No related merge requests found
...@@ -393,6 +393,10 @@ else if(empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST[' ...@@ -393,6 +393,10 @@ else if(empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST['
require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php"); require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_history.php");
$hist = new history(); $hist = new history();
$arr_res = explode('#', $res_action['result']); $arr_res = explode('#', $res_action['result']);
if(!is_array($res_action['history_msg'])){
$res_action['history_msg'] = [$res_action['history_msg']];
}
for($i=0; $i<count($arr_res );$i++) for($i=0; $i<count($arr_res );$i++)
{ {
if(!empty($arr_res[$i])) if(!empty($arr_res[$i]))
...@@ -407,9 +411,9 @@ else if(empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST[' ...@@ -407,9 +411,9 @@ else if(empty($_POST['values']) || !isset($_POST['action_id']) || empty($_POST['
} }
//$what .= $label_action.'('._NUM.$arr_res[$i].') '; //$what .= $label_action.'('._NUM.$arr_res[$i].') ';
$what .= $label_action; $what .= $label_action;
if(isset($res_action['history_msg']) && !empty($res_action['history_msg'])) if(isset($res_action['history_msg'][$i]) && !empty($res_action['history_msg'][$i]))
{ {
$what .= $res_action['history_msg']; $what .= $res_action['history_msg'][$i];
} }
$_SESSION['info'] = $what . ' '; $_SESSION['info'] = $what . ' ';
$_SESSION['cpt_info_basket'] = 0; $_SESSION['cpt_info_basket'] = 0;
......
...@@ -54,7 +54,7 @@ require_once "modules/visa/class/class_modules_tools.php"; ...@@ -54,7 +54,7 @@ require_once "modules/visa/class/class_modules_tools.php";
function manage_empty_error($arr_id, $history, $id_action, $label_action, $status) function manage_empty_error($arr_id, $history, $id_action, $label_action, $status)
{ {
$db = new Database(); $db = new Database();
$result = ''; $result = '';
if (!empty($_SESSION['stockCheckbox'])) { if (!empty($_SESSION['stockCheckbox'])) {
...@@ -74,19 +74,29 @@ function manage_empty_error($arr_id, $history, $id_action, $label_action, $statu ...@@ -74,19 +74,29 @@ function manage_empty_error($arr_id, $history, $id_action, $label_action, $statu
$sequence = $circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT'); $sequence = $circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT');
$stepDetails = array(); $stepDetails = array();
$stepDetails = $circuit_visa->getStepDetails($res_id, $coll_id, 'VISA_CIRCUIT', $sequence); $stepDetails = $circuit_visa->getStepDetails($res_id, $coll_id, 'VISA_CIRCUIT', $sequence);
$message = ''; $message = [];
//enables to process the visa if i am not the item_id //enables to process the visa if i am not the item_id
if ($stepDetails['item_id'] <> $_SESSION['user']['UserId']) { if ($stepDetails['item_id'] <> $_SESSION['user']['UserId']) {
$stmt = $db->query("UPDATE listinstance SET process_date = CURRENT_TIMESTAMP " $stmt = $db->query("UPDATE listinstance SET process_date = CURRENT_TIMESTAMP "
. " WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?" . " WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?"
, array($stepDetails['listinstance_id'], $stepDetails['item_mode'], $res_id, $stepDetails['item_id'], 'VISA_CIRCUIT')); , array($stepDetails['listinstance_id'], $stepDetails['item_mode'], $res_id, $stepDetails['item_id'], 'VISA_CIRCUIT'));
$message = _VISA_BY . " " . $_SESSION['user']['UserId']
. " " . _INSTEAD_OF . " " . $stepDetails['item_id']; $stmt = $db->query("SELECT firstname, lastname, user_id FROM users WHERE user_id IN (?)", array([$_SESSION['user']['UserId'], $stepDetails['item_id']]));
foreach ($stmt as $value) {
if($value['user_id'] == $_SESSION['user']['UserId']){
$user1 = $value['firstname'] . ' ' . $value['lastname'];
} else {
$user2 = $value['firstname'] . ' ' . $value['lastname'];
}
}
$message[] = " " ._VISA_BY . " " . $user1 . " " . _INSTEAD_OF . " " . $user2;
} else { } else {
$stmt = $db->query("UPDATE listinstance SET process_date = CURRENT_TIMESTAMP " $stmt = $db->query("UPDATE listinstance SET process_date = CURRENT_TIMESTAMP "
. " WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?" . " WHERE listinstance_id = ? AND item_mode = ? AND res_id = ? AND item_id = ? AND difflist_type = ?"
, array($stepDetails['listinstance_id'], $stepDetails['item_mode'], $res_id, $_SESSION['user']['UserId'], 'VISA_CIRCUIT')); , array($stepDetails['listinstance_id'], $stepDetails['item_mode'], $res_id, $_SESSION['user']['UserId'], 'VISA_CIRCUIT'));
$message[] = "";
} }
if ($circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT') == $circuit_visa->nbVisa($res_id, $coll_id)) { if ($circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT') == $circuit_visa->nbVisa($res_id, $coll_id)) {
...@@ -96,5 +106,5 @@ function manage_empty_error($arr_id, $history, $id_action, $label_action, $statu ...@@ -96,5 +106,5 @@ function manage_empty_error($arr_id, $history, $id_action, $label_action, $statu
$result .= $arr_id[$i] . '#'; $result .= $arr_id[$i] . '#';
} }
return array('result' => $result, 'history_msg' => ''); return array('result' => $result, 'history_msg' => $message);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment