diff --git a/core/manage_action.php b/core/manage_action.php index 74afa373c5a0c6ee5f030e505756c79eb4bc360d..1b5453198e90bde71c3a5ea41a010ae39640ca59 100644 --- a/core/manage_action.php +++ b/core/manage_action.php @@ -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"); $hist = new history(); $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++) { if(!empty($arr_res[$i])) @@ -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; - 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['cpt_info_basket'] = 0; diff --git a/modules/visa/visa_workflow.php b/modules/visa/visa_workflow.php old mode 100644 new mode 100755 index 3ab79e89fee9235d300c8b1dd1ce2eb82ef70fa2..2196dba886fd90f2867b764b4e1e6290121fe6ff --- a/modules/visa/visa_workflow.php +++ b/modules/visa/visa_workflow.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) { - $db = new Database(); + $db = new Database(); $result = ''; if (!empty($_SESSION['stockCheckbox'])) { @@ -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'); $stepDetails = array(); $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 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 = ?" , 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 { - $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 = ?" , 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)) { @@ -96,5 +106,5 @@ function manage_empty_error($arr_id, $history, $id_action, $label_action, $statu $result .= $arr_id[$i] . '#'; } - return array('result' => $result, 'history_msg' => ''); + return array('result' => $result, 'history_msg' => $message); }