Commit a91dfdea authored by Damien's avatar Damien

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchCourrier!158
parents 0cae43dc c55a6340
......@@ -50,7 +50,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
}
$html = '<div id="frm_error_'.$id_action.'" class="error"></div>';
$html .= '<h2 class="title">' . $labelAction . '</h2>';
$html .= '<h2 class="title">'._ACTION_CONFIRM. '<br>' . $labelAction . '</h2>';
$html .= '<form name="sendToExternalSB" id="sendToExternalSB" method="post" class="forms" action="#">';
$html .= '<input type="hidden" name="chosen_action" id="chosen_action" value="end_action" />';
......@@ -94,6 +94,7 @@ function get_form_txt($values, $path_manage_action, $id_action, $table, $module,
}
}
}
$htmlModal = '';
}
}
......@@ -238,11 +239,26 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
$attachmentToFreeze = FastParapheurController::sendDatas(['config' => $config, 'resIdMaster' => $res_id]);
} elseif ($config['id'] == 'maarchParapheur') {
$listinstances = \Entity\models\ListInstanceModel::getVisaCircuitByResId(['select' => ['external_id', 'users.user_id', 'requested_signature'], 'id' => $res_id]);
if (empty($listinstances)) {
var_dump('No visa workflow');
}
$workflow = [];
foreach ($listinstances as $user) {
$externalId = json_decode($user['external_id'], true);
if (empty($externalId['maarchParapheur'])) {
return ['error' => 'Some users does not exist in Maarch Parapheur'];
}
$workflow[] = ['userId' => $externalId['maarchParapheur'], 'mode' => ($user['requested_signature'] ? 'sign' : 'visa')];
}
$sendedInfo = \ExternalSignatoryBook\controllers\MaarchParapheurController::sendDatas([
'config' => $config,
'resIdMaster' => $res_id,
'objectSent' => 'attachment',
'userId' => $_SESSION['user']['UserId']
'config' => $config,
'resIdMaster' => $res_id,
'objectSent' => 'attachment',
'userId' => $_SESSION['user']['UserId'],
'steps' => $workflow,
]);
if (!empty($sendedInfo['error'])) {
var_dump($sendedInfo['error']);
......
......@@ -48,7 +48,7 @@ if ($category_id == "incoming" || $category_id == 'attachment' || ($category_id
echo "{status: 1, chronoNB: '".functions::xssafe($myChrono)."'}";
}
} elseif ($category_id == "outgoing" && $nb_attachment == 0) {
$stmt = $db->query("SELECT alt_identifier FROM ".$view." WHERE res_id = ?", array($_SESSION['doc_id']));
$stmt = $db->query("SELECT alt_identifier FROM mlb_coll_ext WHERE res_id = ?", array($_SESSION['doc_id']));
$chronoMaster = $stmt->fetchObject();
echo "{status: 1, chronoNB: '".functions::xssafe($chronoMaster->alt_identifier)."'}";
}
......@@ -287,6 +287,9 @@ $templates_controler = new templates_controler();
$db = new Database();
\SrcCore\models\DatabasePDO::reset();
new \SrcCore\models\DatabasePDO(['customId' => $_SESSION['custom_override_id']]);
$databasetype = (string)$xmlconfig->CONFIG_BASE->databasetype;
// Collection for res
......
......@@ -275,47 +275,6 @@ function Bt_refusedSignedMail($aArgs = [])
]);
}
function Bt_processVisaWorkflow($aArgs = [])
{
$visaWorkflow = Bt_getVisaWorkflow(['resId' => $aArgs['res_id_master']]);
$nbVisaWorkflow = $visaWorkflow->rowCount();
if ($nbVisaWorkflow > 0) {
while ($listInstance = $visaWorkflow->fetchObject()) {
$GLOBALS['db']->query("UPDATE listinstance SET process_date = CURRENT_TIMESTAMP WHERE listinstance_id = ?", [$listInstance->listinstance_id]);
$nbUserProcess++;
// Stop to the first signatory user
if ($listInstance->requested_signature) {
$GLOBALS['db']->query("UPDATE listinstance SET signatory = 'true' WHERE listinstance_id = ?", [$listInstance->listinstance_id]);
break;
}
}
if ($nbUserProcess < $nbVisaWorkflow) {
// Get the next user in workflow
$listInstance = $visaWorkflow->fetchObject();
if ($listInstance->requested_signature) {
$mailStatus = 'ESIG';
} else {
$mailStatus = 'EVIS';
}
Bt_validatedMail(['status' => $mailStatus, 'resId' => $aArgs['res_id_master']]);
} else {
Bt_validatedMail(['status' => $aArgs['validatedStatus'], 'resId' => $aArgs['res_id_master']]);
}
} else {
Bt_validatedMail(['status' => $aArgs['validatedStatus'], 'resId' => $aArgs['res_id_master']]);
}
}
function Bt_getVisaWorkflow($aArgs = [])
{
$req = "SELECT listinstance_id, item_id, requested_signature FROM listinstance WHERE res_id = ? AND difflist_type = 'VISA_CIRCUIT' AND process_date IS NULL ORDER BY listinstance_id ASC";
$stmt = $GLOBALS['db']->query($req, array($aArgs['resId']));
return $stmt;
}
function Bt_validatedMail($aArgs = [])
{
$req = "SELECT count(1) as nbresult FROM res_view_attachments WHERE res_id_master = ? AND status = ?";
......
......@@ -335,8 +335,8 @@ foreach ($retrievedMails['isVersion'] as $resId => $value) {
} else {
$status = $validatedStatus;
}
Bt_processVisaWorkflow(['res_id_master' => $value->res_id_master, 'validatedStatus' => $status]);
Bt_validatedMail(['status' => $status, 'resId' => $value->res_id_master]);
$historyInfo = 'La signature de la pièce jointe '.$resId.' (res_version_attachments) a été validée dans le parapheur externe';
Bt_history([
'table_name' => 'res_version_attachments',
......@@ -439,7 +439,7 @@ foreach ($retrievedMails['noVersion'] as $resId => $value) {
} else {
$status = $validatedStatus;
}
Bt_processVisaWorkflow(['res_id_master' => $value->res_id_master, 'validatedStatus' => $status]);
Bt_validatedMail(['status' => $status, 'resId' => $value->res_id_master]);
$historyInfo = 'La signature de la pièce jointe '.$resId.' (res_attachments) a été validée dans le parapheur externe';
Bt_history([
......@@ -508,7 +508,7 @@ foreach ($retrievedMails['resLetterbox'] as $resId => $value) {
if ($value->status == 'validatedNote') {
$GLOBALS['logger']->write('Document validated', 'INFO');
Bt_processVisaWorkflow(['res_id_master' => $value->res_id, 'validatedStatus' => $validatedStatusAnnot]);
Bt_validatedMail(['status' => $validatedStatusAnnot, 'resId' => $value->res_id]);
Bt_history([
'table_name' => 'res_letterbox',
......
......@@ -78,6 +78,7 @@ $app->get('/res/{resIdMaster}/attachments/{resId}/thumbnail', \Attachment\contro
//AutoComplete
$app->get('/autocomplete/contacts', \SrcCore\controllers\AutoCompleteController::class . ':getContacts');
$app->get('/autocomplete/users', \SrcCore\controllers\AutoCompleteController::class . ':getUsers');
$app->get('/autocomplete/maarchParapheurUsers', \SrcCore\controllers\AutoCompleteController::class . ':getMaarchParapheurUsers');
$app->get('/autocomplete/contactsUsers', \SrcCore\controllers\AutoCompleteController::class . ':getContactsAndUsers');
$app->get('/autocomplete/contacts/groups', \SrcCore\controllers\AutoCompleteController::class . ':getContactsForGroups');
$app->get('/autocomplete/users/administration', \SrcCore\controllers\AutoCompleteController::class . ':getUsersForAdministration');
......@@ -381,6 +382,8 @@ $app->post('/saveNumericPackage', \Sendmail\Controllers\ReceiveMessageExchangeCo
$app->post('/saveMessageExchangeReturn', \Sendmail\Controllers\ReceiveMessageExchangeController::class . ':saveMessageExchangeReturn');
$app->post('/saveMessageExchangeReview', \Sendmail\Controllers\MessageExchangeReviewController::class . ':saveMessageExchangeReview');
$app->get('/maarchParapheur/user/{id}/picture', \ExternalSignatoryBook\controllers\MaarchParapheurController::class . ':getUserPicture');
$app->get('/xParaphWorkflow', \ExternalSignatoryBook\controllers\XParaphController::class . ':getWorkflow');
$app->post('/xParaphAccount', \ExternalSignatoryBook\controllers\XParaphController::class . ':createXparaphAccount');
$app->delete('/xParaphAccount', \ExternalSignatoryBook\controllers\XParaphController::class . ':deleteXparaphAccount');
......
......@@ -5,7 +5,10 @@
-- --
-- --
-- *************************************************************************--
UPDATE parameters SET param_value_string = '19.04.1' WHERE id = 'database_version';
UPDATE parameters SET param_value_string = '19.04.3' WHERE id = 'database_version';
DELETE FROM parameters WHERE id = 'QrCodePrefix';
INSERT INTO parameters (id, description, param_value_int) VALUES ('QrCodePrefix', 'Si activé (1), ajoute "Maarch_" dans le contenu des QrCode générés. (Utilisable avec MaarchCapture >= 1.4)', 0);
DROP VIEW IF EXISTS res_view_letterbox;
DROP VIEW IF EXISTS view_contacts;
......@@ -255,6 +258,8 @@ END$$;
ALTER TABLE res_mark_as_read DROP COLUMN IF EXISTS coll_id;
UPDATE listinstance SET added_by_entity = 'superadmin' WHERE added_by_user = 'superadmin';
UPDATE listinstance SET added_by_entity = 'superadmin' WHERE listinstance_id IN
(SELECT listinstance_id FROM listinstance LEFT JOIN entities ON listinstance.added_by_entity = entities.entity_id WHERE entities.entity_id IS null);
UPDATE listinstance SET added_by_entity =
(SELECT entity_id FROM users_entities WHERE users_entities.user_id = listinstance.added_by_user AND primary_entity = 'Y')
WHERE added_by_entity IS NULL OR added_by_entity = '';
......
......@@ -60,10 +60,11 @@ trait ExternalSignatoryBookTrait
}
$sendedInfo = MaarchParapheurController::sendDatas([
'config' => $config,
'resIdMaster' => $args['resId'],
'objectSent' => 'attachment',
'userId' => $GLOBALS['userId']
'config' => $config,
'resIdMaster' => $args['resId'],
'objectSent' => 'attachment',
'userId' => $GLOBALS['userId'],
'steps' => $args['data']['steps'],
]);
if (!empty($sendedInfo['error'])) {
return ['errors' => [$sendedInfo['error']]];
......
......@@ -427,18 +427,16 @@ class PreProcessActionController
} elseif ($signatureBookEnabled == 'fastParapheur') {
// TODO
} elseif ($signatureBookEnabled == 'maarchParapheur') {
$userList = MaarchParapheurController::getInitializeDatas(['config' => $config]);
if (!empty($userList['users'])) {
$additionalsInfos['users'] = $userList['users'];
$aUsersInMP = [];
foreach ($userList['users'] as $value) {
$aUsersInMP[] = $value['id'];
}
if (is_array($data['resources']) && count($data['resources']) == 1) {
$resDestination = ResModel::getById([
'select' => ['entities.id'],
'table' => ['entities'],
'leftJoin' => ['res_letterbox.destination = entities.entity_id'],
'resId' => $data['resources'][0]
]);
$additionalsInfos['destinationId'] = $resDestination['id'];
} else {
$additionalsInfos['users'] = [];
}
if (!empty($userList['errors'])) {
$errors[] = $userList['errors'];
$additionalsInfos['destinationId'] = '';
}
foreach ($data['resources'] as $resId) {
......@@ -447,20 +445,6 @@ class PreProcessActionController
$noAttachmentsResource['alt_identifier'] = _UNDEFINED;
}
$listinstances = ListInstanceModel::getVisaCircuitByResId(['select' => ['external_id', 'firstname', 'lastname'], 'id' => $resId]);
if (empty($listinstances)) {
$additionalsInfos['visaWorkflowError'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resId, 'reason' => 'noVisaWorkflow'];
continue;
}
foreach ($listinstances as $user) {
$externalId = json_decode($user['external_id'], true);
if (!in_array($externalId['maarchParapheur'], $aUsersInMP)) {
$additionalsInfos['visaWorkflowError'][] = ['alt_identifier' => $noAttachmentsResource['alt_identifier'], 'res_id' => $resId, 'reason' => 'usersNotExistedInMaarchParapheur'];
continue 2;
}
}
// Check attachments
$attachments = AttachmentModel::getOnView([
'select' => [
......@@ -627,10 +611,6 @@ class PreProcessActionController
$userList = MaarchParapheurController::getInitializeDatas(['config' => $config]);
if (!empty($userList['users'])) {
$additionalsInfos['users'] = $userList['users'];
$aUsersInMP = [];
foreach ($userList['users'] as $value) {
$aUsersInMP[] = $value['id'];
}
} else {
$additionalsInfos['users'] = [];
}
......
......@@ -62,9 +62,12 @@ class ListInstanceController
if (!Validator::intVal()->validate($aArgs['resId']) || !ResController::hasRightByResId(['resId' => [$aArgs['resId']], 'userId' => $GLOBALS['userId']])) {
return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
}
$listinstances = ListInstanceModel::getVisaCircuitByResId(['select' => ['listinstance_id', 'sequence', 'item_id', 'item_type', 'firstname as item_firstname', 'lastname as item_lastname', 'entity_label as item_entity', 'viewed', 'process_date', 'process_comment', 'signatory', 'requested_signature'], 'id' => $aArgs['resId']]);
return $response->withJson($listinstances);
$listInstances = ListInstanceModel::getVisaCircuitByResId(['select' => ['listinstance_id', 'sequence', 'item_id', 'item_type', 'firstname as item_firstname', 'lastname as item_lastname', 'entity_label as item_entity', 'viewed', 'process_date', 'process_comment', 'signatory', 'requested_signature'], 'id' => $aArgs['resId']]);
foreach ($listInstances as $key => $value) {
$listInstances[$key]['labelToDisplay'] = $listInstances[$key]['item_firstname'].' '.$listInstances[$key]['item_lastname'];
}
return $response->withJson($listInstances);
}
public function getAvisCircuitByResId(Request $request, Response $response, array $aArgs)
......@@ -72,9 +75,12 @@ class ListInstanceController
if (!Validator::intVal()->validate($aArgs['resId']) || !ResController::hasRightByResId(['resId' => [$aArgs['resId']], 'userId' => $GLOBALS['userId']])) {
return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
}
$listinstances = ListInstanceModel::getAvisCircuitByResId(['select' => ['listinstance_id', 'sequence', 'item_id', 'item_type', 'firstname as item_firstname', 'lastname as item_lastname', 'entity_label as item_entity', 'viewed', 'process_date', 'process_comment'], 'id' => $aArgs['resId']]);
return $response->withJson($listinstances);
$listInstances = ListInstanceModel::getAvisCircuitByResId(['select' => ['listinstance_id', 'sequence', 'item_id', 'item_type', 'firstname as item_firstname', 'lastname as item_lastname', 'entity_label as item_entity', 'viewed', 'process_date', 'process_comment'], 'id' => $aArgs['resId']]);
foreach ($listInstances as $key => $value) {
$listInstances[$key]['labelToDisplay'] = $listInstances[$key]['item_firstname'].' '.$listInstances[$key]['item_lastname'];
}
return $response->withJson($listInstances);
}
public function update(Request $request, Response $response)
......
......@@ -265,7 +265,7 @@ class ListTemplateController
return $response->withStatus(400)->withJson(['errors' => 'Entity does not exist']);
}
$listTemplates = ListTemplateModel::get(['select' => ['*'], 'where' => ['object_id = ?', 'object_type = ?'], 'data' => [$entity['entity_id'], 'entity_id']]);
$listTemplates = ListTemplateModel::get(['select' => ['*'], 'where' => ['object_id = ?'], 'data' => [$entity['entity_id']]]);
foreach ($listTemplates as $key => $value) {
if ($value['item_type'] == 'entity_id') {
......@@ -274,6 +274,9 @@ class ListTemplateController
} else {
$listTemplates[$key]['labelToDisplay'] = UserModel::getLabelledUserById(['login' => $value['item_id']]);
$listTemplates[$key]['descriptionToDisplay'] = UserModel::getPrimaryEntityByUserId(['userId' => $value['item_id']])['entity_label'];
$userInfos = UserModel::getByLowerLogin(['login' => $value['item_id'], 'select' => ['external_id']]);
$listTemplates[$key]['externalId'] = json_decode($userInfos['external_id'], true);
}
}
......
......@@ -23,7 +23,10 @@ use Note\models\NoteModel;
use Priority\models\PriorityModel;
use Resource\controllers\SummarySheetController;
use Resource\models\ResModel;
use Respect\Validation\Validator;
use setasign\Fpdi\Tcpdf\Fpdi;
use Slim\Http\Request;
use Slim\Http\Response;
use SrcCore\models\CoreConfigModel;
use SrcCore\models\CurlModel;
use User\models\UserModel;
......@@ -179,18 +182,12 @@ class MaarchParapheurController
$senderPrimaryEntity = UserModel::getPrimaryEntityByUserId(['userId' => $aArgs['userId']]);
if ($aArgs['objectSent'] == 'attachment') {
$listinstances = ListInstanceModel::getVisaCircuitByResId(['select' => ['external_id', 'users.user_id', 'requested_signature'], 'id' => $mainResource[0]['res_id']]);
if (empty($listinstances)) {
return ['error' => 'No visa workflow'];
}
$workflow = [];
foreach ($listinstances as $user) {
$externalId = json_decode($user['external_id'], true);
if (empty($externalId['maarchParapheur'])) {
return ['error' => 'Some users does not exist in Maarch Parapheur'];
if (!empty($aArgs['steps'])) {
foreach ($aArgs['steps'] as $step) {
$workflow[] = ['userId' => $step['externalId'], 'mode' => $step['action']];
}
$workflow[] = ['processingUser' => $user['user_id'], 'mode' => ($user['requested_signature'] ? 'sign' : 'visa')];
} else {
return ['error' => 'steps is empty'];
}
$excludeAttachmentTypes = ['converted_pdf', 'print_folder', 'signed_response'];
......@@ -426,4 +423,49 @@ class MaarchParapheurController
$state['mode'] = $step['mode'];
return $state;
}
public static function getUserPicture(Request $request, Response $response, array $aArgs)
{
$check = Validator::intVal()->validate($aArgs['id']);
if (!$check) {
return $response->withStatus(400)->withJson(['errors' => 'id should be an integer']);
}
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']);
if ($loadedXml->signatoryBookEnabled == 'maarchParapheur') {
foreach ($loadedXml->signatoryBook as $value) {
if ($value->id == "maarchParapheur") {
$url = $value->url;
$userId = $value->userId;
$password = $value->password;
break;
}
}
$curlResponse = CurlModel::execSimple([
'url' => rtrim($url, '/') . '/rest/users/'.$aArgs['id'].'/picture',
'basicAuth' => ['user' => $userId, 'password' => $password],
'headers' => ['content-type:application/json'],
'method' => 'GET'
]);
if ($curlResponse['code'] != '200') {
if (!empty($curlResponse['response']['errors'])) {
$errors = $curlResponse['response']['errors'];
} else {
$errors = $curlResponse['errors'];
}
if (empty($errors)) {
$errors = 'An error occured. Please check your configuration file.';
}
return $response->withStatus(400)->withJson(['errors' => $errors]);
}
} else {
return $response->withStatus(403)->withJson(['errors' => 'maarchParapheur is not enabled']);
}
return $response->withJson(['picture' => $curlResponse['response']['picture']]);
}
}
......@@ -80,7 +80,8 @@ abstract class ResModelAbstract
$aResources = DatabaseModel::select([
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['res_letterbox'],
'table' => empty($aArgs['table']) ? ['res_letterbox'] : array_merge(['res_letterbox'], $aArgs['table']),
'left_join' => empty($aArgs['leftJoin']) ? [] : $aArgs['leftJoin'],
'where' => ['res_id = ?'],
'data' => [$aArgs['resId']]
]);
......
......@@ -17,11 +17,12 @@ namespace SrcCore\controllers;
use Contact\controllers\ContactController;
use Contact\controllers\ContactGroupController;
use Contact\models\ContactModel;
use Entity\models\EntityModel;
use Respect\Validation\Validator;
use Slim\Http\Request;
use Slim\Http\Response;
use Entity\models\EntityModel;
use SrcCore\models\CoreConfigModel;
use SrcCore\models\CurlModel;
use SrcCore\models\DatabaseModel;
use SrcCore\models\TextFormatModel;
use SrcCore\models\ValidatorModel;
......@@ -115,6 +116,55 @@ class AutoCompleteController
return $response->withJson($data);
}
public static function getMaarchParapheurUsers(Request $request, Response $response)
{
$data = $request->getQueryParams();
$check = Validator::stringType()->notEmpty()->validate($data['search']);
if (!$check) {
return $response->withStatus(400)->withJson(['errors' => 'search is empty']);
}
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'modules/visa/xml/remoteSignatoryBooks.xml']);
if ($loadedXml->signatoryBookEnabled == 'maarchParapheur') {
foreach ($loadedXml->signatoryBook as $value) {
if ($value->id == "maarchParapheur") {
$url = $value->url;
$userId = $value->userId;
$password = $value->password;
break;
}
}
$curlResponse = CurlModel::execSimple([
'url' => rtrim($url, '/') . '/rest/autocomplete/users?search='.$data['search'],
'basicAuth' => ['user' => $userId, 'password' => $password],
'headers' => ['content-type:application/json'],
'method' => 'GET'
]);
if ($curlResponse['code'] != '200') {
if (!empty($curlResponse['response']['errors'])) {
$errors = $curlResponse['response']['errors'];
} else {
$errors = $curlResponse['errors'];
}
if (empty($errors)) {
$errors = 'An error occured. Please check your configuration file.';
}
return $response->withStatus(400)->withJson(['errors' => $errors]);
}
foreach ($curlResponse['response'] as $key => $value) {
$curlResponse['response'][$key]['idToDisplay'] = $value['firstname'] . ' ' . $value['lastname'];
$curlResponse['response'][$key]['externalId']['maarchParapheur'] = $value['id'];
}
return $response->withJson($curlResponse['response']);
} else {
return $response->withStatus(403)->withJson(['errors' => 'maarchParapheur is not enabled']);
}
}
public static function getContactsAndUsers(Request $request, Response $response)
{
$data = $request->getQueryParams();
......@@ -310,7 +360,7 @@ class AutoCompleteController
]);
$data = [];
foreach ($users as $key => $value) {
foreach ($users as $value) {
$data[] = [
'type' => 'user',
'id' => $value['user_id'],
......
......@@ -320,7 +320,7 @@ define('_MARK_AS_READ_DESC', 'Marque le courrier comme \'lu\' dans la bannette.
define('_SEND_FILE_WS', 'Envoyer le document via Web Service');
define('_SEND_DATA_WS', 'Envoyer des données via Web Service');
define('_SEND_TO_EXTERNAL_SB', 'Envoyer des données vers un parapheur externe');
define('_SEND_TO_EXTERNAL_NOTEBOOK', 'Envoyer des données vers un annotateur externe');
define('_SEND_TO_EXTERNAL_NOTEBOOK', 'Envoyer des courriers à annoter vers Maarch Parapheur');
define('_CLOSE_MAIL_AND_INDEX', 'Clôturer un courrier et lancer l\'indexation');
define('_CLOSE_MAIL_AND_INDEX_DESC', 'Permet de mettre à jour la date de clôture d\'un courrier (\'closing_date\' de la table mlb_coll_ext) ET ouvre la page d\'indexation afin d\'enregistrer un nouveau courrier.');
define('_CLOSE_MAIL_WITH_ATTACHMENT', 'Clôturer un courrier avec pièce jointe');
......
......@@ -36,6 +36,7 @@ class CurlModel
$opts = [
CURLOPT_URL => $curlConfig['url'],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
];
if (empty($aArgs['multipleObject'])) {
......@@ -261,7 +262,7 @@ class CurlModel
ValidatorModel::stringType($args, ['url', 'method', 'user', 'password']);
ValidatorModel::arrayType($args, ['headers', 'queryParams', 'basicAuth', 'bearerAuth']);
$opts = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true];
$opts = [CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_SSL_VERIFYPEER => false];
//Headers
if (!empty($args['headers'])) {
......
<div class="col-md-12" *ngIf="additionalsInfos.users.length == 0">
{{lang.noUserDefinedInMaarchParapheur}}
</div>
<div class="col-md-12">
<div class="alert-message alert-message-info" role="alert">{{lang.visaWorkflowWillBeSend}}</div>
<div class="fieldsetdContainer" style="flex:2">
<h2>{{lang.visaWorkflow}} :</h2>
<div class="fieldsetdContent">
<app-visa-workflow #appVisaWorkflow [injectDatas]="injectDatasParam"></app-visa-workflow>
<div *ngIf="appVisaWorkflow.checkExternalSignatoryBook().length > 0" class="alert-message alert-message-danger" role="alert">
<b>{{appVisaWorkflow.checkExternalSignatoryBook().join(', ')}}</b> {{lang.usersMissingInSignatureBook}} !
</div>
</div>
</div>
</div>
<div class="col-md-12" *ngIf="additionalsInfos.visaWorkflowError">
<div>
......
.fieldsetdContainer {
position: relative;
h2 {
white-space: pre;
overflow: hidden;
max-width: 85%;
text-overflow: ellipsis;
z-index: 1;
font-size: 10px;
font-weight: bold;
background: white;
position: absolute;
top: -5px;
left: 30px;
padding: 0px;
margin: 0px;
padding-left: 5px;
padding-right: 5px;
color: #135f7f;
}
.fieldsetdContent {
background: white;
border-radius: 4px;
border: solid 1px #ccc;
margin-top: 10px;
padding: 10px;
overflow: auto;
}
}
.alert-message {
margin: 0 ;
}
\ No newline at end of file
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { LANG } from '../../../translate.component';
import { NotificationService } from '../../../notification.service';
import { HttpClient } from '@angular/common/http';
import { VisaWorkflowComponent } from '../../../visa/visa-workflow.component';
declare function $j(selector: any): any;
......@@ -18,16 +19,27 @@ export class MaarchParaphComponent implements OnInit {
currentAccount: any = null;
usersWorkflowList: any[] = [];
injectDatasParam = {
resId: 0,
editable: true
};
@ViewChild('appVisaWorkflow') appVisaWorkflow: VisaWorkflowComponent;
@Input('additionalsInfos') additionalsInfos: any;
@Input('externalSignatoryBookDatas') externalSignatoryBookDatas: any;
constructor(public http: HttpClient, private notify: NotificationService) { }
ngOnInit(): void { }
ngOnInit(): void {
if (this.additionalsInfos.destinationId !== '') {
this.appVisaWorkflow.loadListModel(this.additionalsInfos.destinationId);
}
}
checkValidParaph() {
if (this.additionalsInfos.attachments.length == 0) {
if (this.additionalsInfos.attachments.length == 0 || this.appVisaWorkflow.getWorkflow().length === 0 || this.appVisaWorkflow.checkExternalSignatoryBook().length > 0) {
return true;
} else {
return false;
......@@ -39,6 +51,17 @@ export class MaarchParaphComponent implements OnInit {
}
getDatas() {
const workflow = this.appVisaWorkflow.getWorkflow();
workflow.forEach((element:any) => {
this.externalSignatoryBookDatas.steps.push(
{
'externalId' : element.externalId.maarchParapheur,
'action' : element.requested_signature ? 'sign' : 'visa',
}
);
});
return this.externalSignatoryBookDatas;
}
}
......@@ -17,13 +17,15 @@ export class SendExternalSignatoryBookActionComponent implements OnInit {
lang: any = LANG;
loading: boolean = false;
additionalsInfos: any = {
destinationId: '',
users: [],
attachments: [],
noAttachment: []
};
signatoryBookEnabled: string = 'maarchParapheur';
signatoryBookEnabled: string = '';
externalSignatoryBookDatas: any = {
steps: [],
objectSent: 'attachment'
};
errors: any;
......@@ -41,9 +43,12 @@ export class SendExternalSignatoryBookActionComponent implements OnInit {
this.http.post('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/checkExternalSignatoryBook', { resources: this.data.selectedRes })
.subscribe((data: any) => {
this.additionalsInfos = data.additionalsInfos;
this.signatoryBookEnabled = data.signatureBookEnabled;
if (this.additionalsInfos.attachments.length > 0) {
this.signatoryBookEnabled = data.signatureBookEnabled;
}
this.errors = data.errors;
this.loading = false;
console.log(data);
}, (err: any) => {
this.notify.handleErrors(err);
this.loading = false;
......