. */ /** * @brief Action : proceed visa workflow * * Permet de récupérer l'état de visa en cours et de transmettre à la personne suivante devant viser * * @file * @author Nicolas Couture * @date $date$ * @version $Revision$ * @ingroup apps */ /** * $confirm bool true */ $confirm = true; /** * $etapes array Contains only one etap, the status modification */ // $error_visa_workflow = false; // $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')); // if ($stmt->rowCount() < 2) { // $error_visa_workflow = true; // } $etapes = array('empty_error'); require_once "modules/visa/class/class_modules_tools.php"; function manage_empty_error($arr_id, $history, $id_action, $label_action, $status) { $db = new Database(); $result = ''; if (!empty($_SESSION['stockCheckbox'])) { $arr_id = $_SESSION['stockCheckbox']; } for ($i=0; $iretrieve_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' => $result, 'history_msg' => ''); }