Commit c348b05d authored by Damien's avatar Damien

Merge branch 'develop' into 'master'

Develop

See merge request maarch/MaarchCourrier!159
parents a91dfdea 03f7179e
......@@ -238,7 +238,6 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
include_once 'modules/visa/class/FastParapheurController.php';
$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');
......@@ -248,7 +247,7 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
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'];
return ['error' => 'Some users do not exist in Maarch Parapheur'];
}
$workflow[] = ['userId' => $externalId['maarchParapheur'], 'mode' => ($user['requested_signature'] ? 'sign' : 'visa')];
}
......
......@@ -260,6 +260,14 @@ 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 = 'superadmin' WHERE listinstance_id IN
(SELECT listinstance_id
FROM listinstance
LEFT JOIN users_entities ON listinstance.added_by_user = users_entities.user_id
LEFT JOIN entities ON users_entities.entity_id = entities.entity_id
WHERE primary_entity = 'Y' AND 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,7 +60,7 @@ class AcknowledgementReceiptModel
'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'],
'table' => ['acknowledgement_receipts'],
'where' => ['res_id in (?)'],
'data' => $aArgs['resIds'],
'data' => [$aArgs['resIds']],
'order_by' => empty($aArgs['orderBy']) ? [] : $aArgs['orderBy'],
'groupBy' => empty($aArgs['groupBy']) ? [] : $aArgs['groupBy']
]);
......
......@@ -765,7 +765,7 @@ class ResController
$select = explode(',', $data['select']);
$sve_start_date = false;
if ($keySve = array_search('sve_start_date', $select)) {
if ($keySve = array_search('sve_start_date', array_map('trim', $select))) {
unset($select[$keySve]);
$sve_start_date = true;
}
......
......@@ -27,6 +27,7 @@
margin-top: 10px;
padding: 10px;
overflow: auto;
height: 450px;
}
}
......
......@@ -13,10 +13,12 @@
<div class="emptyContent" *ngIf="visaWorkflow.items.length === 0">
{{lang.noPerson}}
</div>
<mat-list-item *ngFor="let diffusion of visaWorkflow.items;let i=index" cdkDrag class="columns"
<mat-list-item *ngFor="let diffusion of visaWorkflow.items;let i=index" cdkDrag class="columns workflow"
[cdkDragDisabled]="!injectDatas.editable" [class.notDraggable]="!injectDatas.editable"
[class.notEditable]="!injectDatas.editable" [class.processed]="diffusion.process_date != null">
<mat-icon mat-list-icon class="fa fa-user fa-2x" color="primary"></mat-icon>
<mat-icon *ngIf="!injectDatas.editable" mat-list-icon class="fa fa-user fa-2x" color="primary"></mat-icon>
<mat-icon *ngIf="injectDatas.editable" class="avatar" mat-list-icon color="primary"
[style.background-image]="'url('+diffusion.picture+')'"></mat-icon>
<ng-container *ngIf="!injectDatas.editable">
<mat-icon mat-list-icon class="fa fa-hourglass fa-2x"
[ngClass]="{'fa-hourglass': diffusion.process_date == null,'fa-check': diffusion.process_date != null}"
......
......@@ -6,7 +6,7 @@
0 3px 14px 2px rgba(0, 0, 0, 0.12);
background: white;
padding: 10px;
.mat-icon {
.mat-icon, .mat-icon-button {
display: none;
}
}
......@@ -66,6 +66,12 @@
background: rgba(0, 128, 0, 0.11);
}
.workflow {
height: auto !important;
padding-top: 10px;
padding-bottom: 10px;
}
.workflowLine {
display: flex !important;
align-items: center;
......@@ -82,6 +88,7 @@
}
&SubLabel {
font-size: 80%;
opacity:0.5;
flex: 1;
text-overflow: ellipsis;
......@@ -90,7 +97,16 @@
&ProcessDate {
flex: 1;
text-align: right;
text-align: left;
font-size: 90%;
}
}
.avatar {
border: solid 3px #F99830;
height: 45px !important;
width: 45px !important;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
\ No newline at end of file
......@@ -17,8 +17,8 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit
lang: any = LANG;
visaWorkflow: any = {
roles: ['sign','visa'],
items : []
roles: ['sign', 'visa'],
items: []
};
loading: boolean = false;
data: any;
......@@ -27,7 +27,7 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit
constructor(public http: HttpClient, private notify: NotificationService) {
super(http, ['signatureBookUsers']);
}
}
ngOnInit(): void { }
......@@ -44,10 +44,17 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit
this.http.get("../../rest/listTemplates/entities/" + entityId)
.subscribe((data: any) => {
data.listTemplate.forEach((element:any) => {
data.listTemplate.forEach((element: any, index : number) => {
if (element.object_type === 'VISA_CIRCUIT') {
element.requested_signature = (element.item_mode === 'visa' ? false : true);
this.visaWorkflow.items.push(element);
this.http.get("../../rest/maarchParapheur/user/" + element.externalId.maarchParapheur + "/picture")
.subscribe((data: any) => {
element.picture = data.picture
element.requested_signature = (element.item_mode === 'visa' ? false : true);
this.visaWorkflow.items.push(element);
}, (err: any) => {
this.notify.handleErrors(err);
});
}
});
this.loading = false;
......@@ -58,14 +65,14 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit
this.loading = true;
this.visaWorkflow.items = [];
this.http.get("../../rest/res/" + resId + "/visaCircuit")
.subscribe((data: any) => {
data.forEach((element:any) => {
this.visaWorkflow.items.push(element);
.subscribe((data: any) => {
data.forEach((element: any) => {
this.visaWorkflow.items.push(element);
});
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
deleteItem(index: number) {
......@@ -94,15 +101,22 @@ export class VisaWorkflowComponent extends AutoCompletePlugin implements OnInit
return usersMissing;
}
addItem(event: any) {
const user = {
'externalId': event.option.value.externalId,
'labelToDisplay' : event.option.value.idToDisplay,
'requested_signature' : false,
'labelToDisplay': event.option.value.idToDisplay,
'requested_signature': false,
'picture': ''
}
this.visaWorkflow.items.push(user);
$j('#availableUsers').blur();
this.userCtrl.setValue('');
this.http.get("../../rest/maarchParapheur/user/" + user.externalId.maarchParapheur + "/picture")
.subscribe((data: any) => {
this.visaWorkflow.items[this.visaWorkflow.items.length - 1].picture = data.picture;
}, (err: any) => {
this.notify.handleErrors(err);
});
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment