Skip to content
Snippets Groups Projects
Commit 31d198ca authored by Giovannoni Laurent's avatar Giovannoni Laurent
Browse files

FEAT #4840 multi visa

parent d72778ef
No related branches found
No related tags found
No related merge requests found
...@@ -39,14 +39,14 @@ $confirm = true; ...@@ -39,14 +39,14 @@ $confirm = true;
* $etapes array Contains only one etap, the status modification * $etapes array Contains only one etap, the status modification
*/ */
$error_visa_workflow = false; // $error_visa_workflow = false;
$db = new Database(); // $db = new Database();
$stmt = $db->query("SELECT listinstance_id from listinstance WHERE res_id= ? and coll_id = ? and difflist_type = ? and process_date ISNULL", array($_POST['values'], 'letterbox_coll', 'VISA_CIRCUIT')); // $stmt = $db->query("SELECT listinstance_id from listinstance WHERE res_id= ? and coll_id = ? and difflist_type = ? and process_date ISNULL", array($_POST['values'], 'letterbox_coll', 'VISA_CIRCUIT'));
if ($stmt->rowCount() < 2) { // if ($stmt->rowCount() < 2) {
$error_visa_workflow = true; // $error_visa_workflow = true;
} // }
$etapes = array('empty_error'); $etapes = array('empty_error');
...@@ -55,36 +55,46 @@ require_once "modules/visa/class/class_modules_tools.php"; ...@@ -55,36 +55,46 @@ 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();
$_SESSION['action_error'] = '';
$result = ''; $result = '';
$coll_id = $_SESSION['current_basket']['coll_id'];
$res_id = $arr_id[0];
require_once("core/class/class_security.php");
$sec = new security();
$table = $sec->retrieve_table_from_coll($coll_id);
$circuit_visa = new visa();
$sequence = $circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT');
$stepDetails = array();
$stepDetails = $circuit_visa->getStepDetails($res_id, $coll_id, 'VISA_CIRCUIT', $sequence);
$message = '';
//enables to process the visa if i am not the item_id if (!empty($_SESSION['stockCheckbox'])) {
if ($stepDetails['item_id'] <> $_SESSION['user']['UserId']) { $arr_id = $_SESSION['stockCheckbox'];
$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'];
} else {
$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'));
} }
if ($circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT') == $circuit_visa->nbVisa($res_id, $coll_id)) { for ($i=0; $i<count($arr_id);$i++) {
$mailStatus = 'ESIG'; $_SESSION['action_error'] = '';
$db->query("UPDATE res_letterbox SET status = ? WHERE res_id = ? ", [$mailStatus, $res_id]); $coll_id = $_SESSION['current_basket']['coll_id'];
$res_id = $arr_id[$i];
require_once("core/class/class_security.php");
$sec = new security();
require_once("core/class/class_history.php");
$history = new history();
$table = $sec->retrieve_table_from_coll($coll_id);
$circuit_visa = new visa();
$sequence = $circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT');
$stepDetails = array();
$stepDetails = $circuit_visa->getStepDetails($res_id, $coll_id, 'VISA_CIRCUIT', $sequence);
$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 "
. " 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'];
} else {
$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'));
}
if ($circuit_visa->getCurrentStep($res_id, $coll_id, 'VISA_CIRCUIT') == $circuit_visa->nbVisa($res_id, $coll_id)) {
$mailStatus = 'ESIG';
$db->query("UPDATE res_letterbox SET status = ? WHERE res_id = ? ", [$mailStatus, $res_id]);
}
$result .= $arr_id[$i] . '#';
} }
return array('result' => $res_id.'#', 'history_msg' => $message); return array('result' => $result, 'history_msg' => '');
} }
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