Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
* @brief send_signed_docs
* @author dev <dev@maarch.org>
* @ingroup visa
*/
require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_db.php';
function checkAllSigned($id)
{
$db = new Database();
$stmt = $db->query("SELECT status from res_view_attachments where attachment_type= ? and res_id_master = ?", array('response_project', $id));
while ($line = $stmt->fetchObject()) {
if ($line->status == 'TRA' || $line->status == 'A_TRA' ) {
return false;
}
}
return true;
}
require_once 'modules/visa/class/class_modules_tools.php';
$visa = new visa();
$warnMsg = '';
if ($visa->currentUserSignRequired($_SESSION['doc_id']) == 'true') {
$confirm = true;
$warnMsg = _NO_USER_SIGNED_DOC;
} else {
$confirm = false;
}
$etapes = ['empty_error'];
/**
* $etapes array Contains only one etap, the status modification
*/
$etapes = array('empty_error');
function manage_empty_error($arr_id, $history, $id_action, $label_action, $status)
{
$_SESSION['action_error'] = '';
$result = '';
$new_result = '';
for ($i=0; $i<count($arr_id); $i++) {
if (checkAllSigned($arr_id[$i])) {
$new_result .= $arr_id[$i].',';
}
$result .= $arr_id[$i].'#';
}
$new_result = substr($new_result, 0, -1);
return array('result' => $result, 'history_msg' => '', 'newResultId' => $new_result, 'action_status' => $status);
}