FIX #9903 TIME 2:30 improve lock document in mass mode + fix visa and redirect in mass mode

parent 32250567
......@@ -121,6 +121,11 @@ class ListInstanceController
$listInstances[$key]['item_id'] = $listInstances[$key]['id'];
$listInstances[$key]['item_type'] = 'user';
$listInstances[$key]['labelToDisplay'] = $listInstances[$key]['item_firstname'].' '.$listInstances[$key]['item_lastname'];
$listInstances[$key]['hasPrivilege'] = true;
if (empty($value['process_date']) && !PrivilegeController::hasPrivilege(['privilegeId' => 'avis_documents', 'userId' => $value['id']])) {
$listInstances[$key]['hasPrivilege'] = false;
}
}
return $response->withJson($listInstances);
......
......@@ -542,7 +542,7 @@ class ResourceListController
}
}
return $response->withJson(['lockedResources' => $locked, 'lockers' => $lockers]);
return $response->withJson(['countLockedResources' => $locked, 'lockers' => $lockers, 'resourcesToProcess' => $resourcesToLock]);
}
public function unlock(Request $request, Response $response, array $aArgs)
......
......@@ -145,8 +145,9 @@ export class ActionsService {
} else {
this.http.put(`../../rest/resourcesList/users/${userId}/groups/${groupId}/baskets/${basketId}/lock`, { resources: resIds }).pipe(
tap((data: any) => {
if (this.canExecuteAction(data.lockedResources, data.lockers, resIds)) {
if (this.canExecuteAction(data.countLockedResources, data.lockers, resIds)) {
try {
this.currentResIds = data.resourcesToProcess;
this.lockResource();
this[action.component](action.data);
}
......
......@@ -92,11 +92,12 @@ export class DiffusionsListComponent implements OnInit {
await this.initRoles();
if (this.resId !== null && this.target !== 'redirect') {
if (this.resId !== null && this.resId != 0 && this.target !== 'redirect') {
this.loadListinstance(this.resId);
} else if (this.resId === null && this.entityId !== null) {
} else if ((this.resId === null || this.resId == 0) && !this.functions.empty(this.entityId)) {
this.loadListModel(this.entityId);
}
this.loading = false;
}
drop(event: CdkDragDrop<string[]>) {
......@@ -189,34 +190,38 @@ export class DiffusionsListComponent implements OnInit {
getListinstance(resId: number) {
return new Promise((resolve, reject) => {
this.http.get(`../../rest/resources/${resId}/listInstance`).pipe(
map((data: any) => {
data.listInstance = data.listInstance.map((item: any) => {
const obj: any = {
listinstance_id: item.listinstance_id,
item_mode: item.item_mode,
item_type: item.item_type === 'user_id' ? 'user' : 'entity',
itemSerialId: item.itemSerialId,
itemId: item.item_id,
itemLabel: item.labelToDisplay,
itemSubLabel: item.descriptionToDisplay,
difflist_type: item.difflist_type,
process_date: null,
process_comment: null,
};
return obj;
});
return data.listInstance;
}),
tap((listInstance: any) => {
resolve(listInstance);
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
if (resId != 0) {
this.http.get(`../../rest/resources/${resId}/listInstance`).pipe(
map((data: any) => {
data.listInstance = data.listInstance.map((item: any) => {
const obj: any = {
listinstance_id: item.listinstance_id,
item_mode: item.item_mode,
item_type: item.item_type === 'user_id' ? 'user' : 'entity',
itemSerialId: item.itemSerialId,
itemId: item.item_id,
itemLabel: item.labelToDisplay,
itemSubLabel: item.descriptionToDisplay,
difflist_type: item.difflist_type,
process_date: null,
process_comment: null,
};
return obj;
});
return data.listInstance;
}),
tap((listInstance: any) => {
resolve(listInstance);
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
} else {
resolve([]);
}
});
}
......
......@@ -499,8 +499,8 @@ export class SignatureBookComponent implements OnInit {
changeLocation(resId: number, origin: string) {
this.http.put('../../rest/resourcesList/users/' + this.userId + '/groups/' + this.groupId + '/baskets/' + this.basketId + '/lock', { resources: [resId] })
.subscribe((data: any) => {
if (data.lockedResources > 0) {
alert(data.lockedResources + ' ' + this.lang.warnLockRes + '.');
if (data.countLockedResources > 0) {
alert(data.countLockedResources + ' ' + this.lang.warnLockRes + '.');
} else {
let path = "signatureBook/users/" + this.userId + "/groups/" + this.groupId + "/baskets/" + this.basketId + "/resources/" + resId;
this.router.navigate([path]);
......
......@@ -90,6 +90,8 @@ export class VisaWorkflowComponent implements OnInit {
if (this.resId !== null && !this.loadedInConstructor) {
//this.initFilterVisaModelList();
this.loadWorkflow(this.resId);
} else {
this.loading = false;
}
}
......
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