Skip to content
Snippets Groups Projects
Commit fa7b7928 authored by Damien's avatar Damien
Browse files

FEAT #6273 informations about requested_signature on signature book

parent a439fb5d
No related branches found
No related tags found
No related merge requests found
......@@ -456,22 +456,40 @@ var SignatureBookComponent = (function () {
SignatureBookComponent.prototype.validForm = function () {
var _this = this;
if ($j("#signatureBookActions option:selected")[0].value != "") {
unlockDocument(this.resId);
if (this.signatureBook.resList.length == 0) {
this.http.get(this.coreUrl + 'rest/' + this.basketId + '/signatureBook/resList')
if (this.signatureBook['listinstance']['requested_signature'] == true) {
this.http.get(this.coreUrl + 'rest/listinstance/' + this.signatureBook['listinstance']['listinstance_id'])
.subscribe(function (data) {
_this.signatureBook.resList = data.resList;
valid_action_form('empty', 'index.php?display=true&page=manage_action&module=core', _this.signatureBook.currentAction.id, _this.resId, 'res_letterbox', 'null', 'letterbox_coll', 'page', false, [$j("#signatureBookActions option:selected")[0].value]);
var r = true;
if (data['signatory'] == false) {
r = confirm("Vous n’avez signé aucun document. Êtes-vous sûr de vouloir continuer ?");
}
if (r) {
_this.sendActionForm();
}
});
}
else {
valid_action_form('empty', 'index.php?display=true&page=manage_action&module=core', this.signatureBook.currentAction.id, this.resId, 'res_letterbox', 'null', 'letterbox_coll', 'page', false, [$j("#signatureBookActions option:selected")[0].value]);
this.sendActionForm();
}
}
else {
alert("Aucune action choisie");
}
};
SignatureBookComponent.prototype.sendActionForm = function () {
var _this = this;
unlockDocument(this.resId);
if (this.signatureBook.resList.length == 0) {
this.http.get(this.coreUrl + 'rest/' + this.basketId + '/signatureBook/resList')
.subscribe(function (data) {
_this.signatureBook.resList = data.resList;
valid_action_form('empty', 'index.php?display=true&page=manage_action&module=core', _this.signatureBook.currentAction.id, _this.resId, 'res_letterbox', 'null', 'letterbox_coll', 'page', false, [$j("#signatureBookActions option:selected")[0].value]);
});
}
else {
valid_action_form('empty', 'index.php?display=true&page=manage_action&module=core', this.signatureBook.currentAction.id, this.resId, 'res_letterbox', 'null', 'letterbox_coll', 'page', false, [$j("#signatureBookActions option:selected")[0].value]);
}
};
return SignatureBookComponent;
}());
SignatureBookComponent = __decorate([
......
......@@ -469,42 +469,61 @@ export class SignatureBookComponent implements OnInit {
validForm() {
if ($j("#signatureBookActions option:selected")[0].value != "") {
unlockDocument(this.resId);
if (this.signatureBook['listinstance']['requested_signature'] == true) {
this.http.get(this.coreUrl + 'rest/listinstance/' + this.signatureBook['listinstance']['listinstance_id'])
.subscribe((data: any) => {
var r = true;
if (data['signatory'] == false) {
r = confirm("Vous n’avez signé aucun document. Êtes-vous sûr de vouloir continuer ?");
}
if (this.signatureBook.resList.length == 0) {
this.http.get(this.coreUrl + 'rest/' + this.basketId + '/signatureBook/resList')
.subscribe((data : any) => {
this.signatureBook.resList = data.resList;
valid_action_form(
'empty',
'index.php?display=true&page=manage_action&module=core',
this.signatureBook.currentAction.id,
this.resId,
'res_letterbox',
'null',
'letterbox_coll',
'page',
false,
[$j("#signatureBookActions option:selected")[0].value]
);
if (r) {
this.sendActionForm();
}
});
} else {
valid_action_form(
'empty',
'index.php?display=true&page=manage_action&module=core',
this.signatureBook.currentAction.id,
this.resId,
'res_letterbox',
'null',
'letterbox_coll',
'page',
false,
[$j("#signatureBookActions option:selected")[0].value]
);
this.sendActionForm();
}
} else {
alert("Aucune action choisie");
}
}
sendActionForm() {
unlockDocument(this.resId);
if (this.signatureBook.resList.length == 0) {
this.http.get(this.coreUrl + 'rest/' + this.basketId + '/signatureBook/resList')
.subscribe((data: any) => {
this.signatureBook.resList = data.resList;
valid_action_form(
'empty',
'index.php?display=true&page=manage_action&module=core',
this.signatureBook.currentAction.id,
this.resId,
'res_letterbox',
'null',
'letterbox_coll',
'page',
false,
[$j("#signatureBookActions option:selected")[0].value]
);
});
} else {
valid_action_form(
'empty',
'index.php?display=true&page=manage_action&module=core',
this.signatureBook.currentAction.id,
this.resId,
'res_letterbox',
'null',
'letterbox_coll',
'page',
false,
[$j("#signatureBookActions option:selected")[0].value]
);
}
}
}
<?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 Listinstance Controller
* @author dev@maarch.org
* @ingroup core
*/
namespace Core\Controllers;
use Core\Models\ListinstanceModel;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
class ListinstanceController
{
public function getById(RequestInterface $request, ResponseInterface $response, $aArgs)
{
$listinstance = ListinstanceModel::getById(['id' => $aArgs['id']]);
return $response->withJson($listinstance);
}
}
......@@ -54,4 +54,26 @@ class ListinstanceModelAbstract
return true;
}
public static function getCurrentStepByResId(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['resId']);
ValidatorModel::intVal($aArgs, ['resId']);
ValidatorModel::arrayType($aArgs, ['select']);
$aListinstance = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['listinstance'],
'where' => ['res_id = ?', 'difflist_type = ?', 'process_date is null'],
'data' => [$aArgs['resId'], 'VISA_CIRCUIT'],
'order_by' => ['listinstance_id ASC'],
'limit' => 1
]);
if (empty($aListinstance[0])) {
return [];
}
return $aListinstance[0];
}
}
......@@ -84,6 +84,7 @@ class VisaController
$datas['signatures'] = UserModel::getSignaturesById(['id' => $user['id']]);
$datas['consigne'] = UserModel::getCurrentConsigneById(['resId' => $resId]);
$datas['hasWorkflow'] = VisaModel::hasVisaWorkflowByResId(['resId' => $resId]);
$datas['listinstance'] = ListinstanceModel::getCurrentStepByResId(['resId' => $resId]);
$datas['canSign'] = ServiceModel::hasService(['id' => 'sign_document', 'userId' => $_SESSION['user']['UserId'], 'location' => 'visa', 'type' => 'use']);
$datas['lang'] = LangModel::getSignatureBookLang();
......
......@@ -234,6 +234,9 @@ $app->delete('/notifications/{id}', \Notifications\Controllers\NotificationContr
$app->get('/reports/groups/{groupId}', \Core\Controllers\ReportController::class . ':getByGroupId');
$app->put('/reports/groups/{groupId}', \Core\Controllers\ReportController::class . ':updateForGroupId');
//Listinstance
$app->get('/listinstance/{id}', \Core\Controllers\ListinstanceController::class . ':getById');
//Contacts
$app->post('/contacts', \Core\Controllers\ContactController::class . ':create');
......
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