diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index 49954fcb41503014a77889ce357dee19f910bda6..723714b88aa691ffb85eea8761ac57c3df63bee0 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -1546,12 +1546,52 @@ function action_change_status(path_manage_script, mode_req, res_id_values, table if (typeof window['angularSignatureBookComponent'] != "undefined") { window.angularSignatureBookComponent.componentAfterAction(); } else { - //window.top.location.hash = ""; - //window.top.location.reload(); + var arr = window.top.location.href.split('&'); - arr = arr.unshift(); - console.log(arr); - triggerAngular('#/basketList/users/21/groups/2/baskets/9'); + arr.shift(); + + var urlV2Param = { + moduleId : '', + resId : '', + userId : '', + groupId : '', + basket_id : '', + basketId : '', + actionId : '', + } + + arr.forEach(element => { + if (element == 'module=basket') { + urlV2Param.moduleId = element.split('=')[1]; + } + if (element.indexOf('baskets=') > -1 ) { + urlV2Param.basket_id = element.split('=')[1]; + } + if (element.indexOf('basketId=') > -1 ) { + urlV2Param.basketId = element.split('=')[1]; + } + if (element.indexOf('resId=') > -1 ) { + urlV2Param.resId = element.split('=')[1]; + } + if (element.indexOf('userId=') > -1 ) { + urlV2Param.userId = element.split('=')[1]; + } + if (element.indexOf('groupIdSer=') > -1 ) { + urlV2Param.groupId = element.split('=')[1]; + } + if (element.indexOf('defaultAction=') > -1 ) { + urlV2Param.actionId = element.split('=')[1]; + urlV2Param.actionId = urlV2Param.actionId.split('#')[0]; + } + }); + + if (urlV2Param.basket_id.length > 0 && urlV2Param.moduleId.length > 0 && urlV2Param.resId.length > 0 && urlV2Param.userId.length > 0 && urlV2Param.groupId.length > 0 && urlV2Param.basketId.length > 0 && urlV2Param.actionId.length > 0) { + triggerAngular('#/basketList/users/'+urlV2Param.userId+'/groups/'+urlV2Param.groupId+'/baskets/' + urlV2Param.basketId); + } else { + window.top.location.hash = ""; + window.top.location.reload(); + } + } } } diff --git a/modules/basket/view_baskets.php b/modules/basket/view_baskets.php index ea29fa4601f155cdaca8110a6956ce072c505bd2..91da151c11118ee87dd40a9a5bb8572574df0bfd 100755 --- a/modules/basket/view_baskets.php +++ b/modules/basket/view_baskets.php @@ -364,7 +364,7 @@ if ($_SESSION['cpt_info_basket'] > 0) { $_SESSION['cpt_info_basket']++; } -if (!empty($_GET['resId']) && !empty($_GET['defaultAction']) && $_SESSION['alreadyDefaultAction'] == false) { +if (!empty($_GET['resId']) && !empty($_GET['defaultAction']) && ($_SESSION['alreadyDefaultAction'] == false || !empty($_GET['groupIdSer']))) { $_SESSION['alreadyDefaultAction'] = true; echo '<script language="javascript">'; echo 'setTimeout(function(){validForm(\'page\', \''.$_GET['resId'].'\', \''.$_GET['defaultAction'].'\');}, 800);'; diff --git a/src/frontend/app/actions/actions-list.component.ts b/src/frontend/app/actions/actions-list.component.ts index 3047be5f78b99e7f33319db7abe3425a6d831f61..ea904a4a766fa69c9cd6fac79a5f690e533fe82c 100644 --- a/src/frontend/app/actions/actions-list.component.ts +++ b/src/frontend/app/actions/actions-list.component.ts @@ -63,7 +63,6 @@ export class ActionsListComponent implements OnInit { this.arrRes = []; this.currentAction = action; - console.log(action); if (this.contextMode && this.selectedRes.length == 0) { this.arrRes = [this.contextResId]; } else { @@ -150,12 +149,8 @@ export class ActionsListComponent implements OnInit { } processAction() { - console.log(this.currentBasketInfo); - console.log(this.currentAction); - console.log(this.arrRes); - this.currentBasketInfo.basket_id = 'MyBasket'; - window.location.href = 'index.php?page=view_baskets&module=basket&baskets='+this.currentBasketInfo.basket_id+'&resId='+this.arrRes[0]+'&defaultAction='+this.currentAction.id; + window.location.href = 'index.php?page=view_baskets&module=basket&baskets='+this.currentBasketInfo.basket_id+'&basketId='+this.currentBasketInfo.basketId+'&resId='+this.arrRes[0]+'&userId='+this.currentBasketInfo.ownerId+'&groupIdSer='+this.currentBasketInfo.groupId+'&defaultAction='+this.currentAction.id; // WHEN V2 /*this.dialog.open(ProcessActionComponent, { width: '500px', diff --git a/src/frontend/app/actions/process-action/process-action.component.ts b/src/frontend/app/actions/process-action/process-action.component.ts index 55da5338fc60dee150be7696e6dcf00f6fb96436..a8d006e2e00bfd5355bd5533c84b22c122cde476 100644 --- a/src/frontend/app/actions/process-action/process-action.component.ts +++ b/src/frontend/app/actions/process-action/process-action.component.ts @@ -16,7 +16,17 @@ export class ProcessActionComponent implements OnInit { constructor(public http: HttpClient, private notify: NotificationService, public dialogRef: MatDialogRef<ProcessActionComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { } - ngOnInit(): void { - window.location.href = 'index.php?page=view_baskets&module=basket&baskets=MyBasket&resId=105&defaultAction=19'; + ngOnInit(): void { } + + onSubmit(): void { + this.loading = true; + /*this.http.put('../../rest/resourcesList/users/' + this.data.currentBasketInfo.ownerId + '/groups/' + this.data.currentBasketInfo.groupId + '/baskets/' + this.data.currentBasketInfo.basketId + '/actions/' + this.data.action.id, {resources : this.data.selectedRes}) + .subscribe((data: any) => { + this.loading = false; + this.dialogRef.close('success'); + }, (err: any) => { + this.notify.handleErrors(err); + this.loading = false; + });*/ } }