diff --git a/src/app/basket/controllers/BasketController.php b/src/app/basket/controllers/BasketController.php index 3f7429816886c69106d8b0de3699cf2300292456..913caddd9999125f777f31b610306de345b25dad 100755 --- a/src/app/basket/controllers/BasketController.php +++ b/src/app/basket/controllers/BasketController.php @@ -115,7 +115,7 @@ class BasketController return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } - if (!PreparedClauseController::isRequestValid(['clause' => $data['clause'], 'userId' => $GLOBALS['login']])) { + if (!PreparedClauseController::isRequestValid(['clause' => $data['clause'], 'userId' => $GLOBALS['login'], 'limit' => 1])) { return $response->withStatus(400)->withJson(['errors' => _INVALID_CLAUSE]); } @@ -591,7 +591,7 @@ class BasketController return ['errors' => 'Action must be present in action page or in action list']; } if (!empty($aArgs['groupActions'][$key]['where_clause'])) { - if (!PreparedClauseController::isRequestValid(['clause' => $aArgs['groupActions'][$key]['where_clause'], 'userId' => $aArgs['userId']])) { + if (!PreparedClauseController::isRequestValid(['clause' => $aArgs['groupActions'][$key]['where_clause'], 'userId' => $aArgs['userId'], 'limit' => 1])) { return ['errors' => _INVALID_CLAUSE]; } } diff --git a/src/app/group/controllers/GroupController.php b/src/app/group/controllers/GroupController.php index c8e380c0c5a154172cc804ed863b16ac00276490..e8dff3dea0448e7acc51580bd6c64800b611e83e 100755 --- a/src/app/group/controllers/GroupController.php +++ b/src/app/group/controllers/GroupController.php @@ -73,7 +73,7 @@ class GroupController return $response->withStatus(400)->withJson(['errors' => _ID. ' ' . _ALREADY_EXISTS]); } - if (!PreparedClauseController::isRequestValid(['clause' => $data['security']['where_clause'], 'userId' => $GLOBALS['login']])) { + if (!PreparedClauseController::isRequestValid(['clause' => $data['security']['where_clause'], 'userId' => $GLOBALS['login'], 'limit' => 1])) { return $response->withStatus(400)->withJson(['errors' => _INVALID_CLAUSE]); } @@ -105,7 +105,7 @@ class GroupController return $response->withStatus(400)->withJson(['errors' => 'Bad Request']); } - if (!PreparedClauseController::isRequestValid(['clause' => $data['security']['where_clause'], 'userId' => $GLOBALS['login']])) { + if (!PreparedClauseController::isRequestValid(['clause' => $data['security']['where_clause'], 'userId' => $GLOBALS['login'], 'limit' => 1])) { return $response->withStatus(400)->withJson(['errors' => _INVALID_CLAUSE]); } diff --git a/src/app/search/controllers/SearchController.php b/src/app/search/controllers/SearchController.php index e18883b9ea4504bf5c0d893eb9fd9ac961040f6a..14fe2d1d39f01e8db029d4fbff64bca0d35f757f 100644 --- a/src/app/search/controllers/SearchController.php +++ b/src/app/search/controllers/SearchController.php @@ -873,6 +873,15 @@ class SearchController 'where' => ["({$where})", 'signatory = ?'], 'data' => $data ]); + } elseif ($roleId == 'visa') { + $data[] = 'VISA_CIRCUIT'; + $data[] = 'false'; + $data[] = 'false'; + $rolesMatch = ListInstanceModel::get([ + 'select' => ['res_id'], + 'where' => ["({$where})", 'difflist_type = ?', 'signatory = ?', 'requested_signature = ?'], + 'data' => $data + ]); } else { $data[] = $roleId; $rolesMatch = ListInstanceModel::get([ @@ -884,13 +893,15 @@ class SearchController if (in_array(null, $value['values'])) { $args['searchWhere'][] = 'res_id not in (select res_id from listinstance where item_mode = ?)'; $args['searchData'][] = $roleId; + } elseif (empty($rolesMatch)) { + return null; } - if (empty($rolesMatch)) { - continue; + + if (!empty($rolesMatch)) { + $rolesMatch = array_column($rolesMatch, 'res_id'); + $args['searchWhere'][] = 'res_id in (?)'; + $args['searchData'][] = $rolesMatch; } - $rolesMatch = array_column($rolesMatch, 'res_id'); - $args['searchWhere'][] = 'res_id in (?)'; - $args['searchData'][] = $rolesMatch; } } } diff --git a/src/frontend/app/visa/visa-workflow.component.html b/src/frontend/app/visa/visa-workflow.component.html index 5684312746ee97408809c4a727ff424641a6a398..6b060d1e13f94ff087d7451358203c1454604723 100755 --- a/src/frontend/app/visa/visa-workflow.component.html +++ b/src/frontend/app/visa/visa-workflow.component.html @@ -99,17 +99,17 @@ </div> <div *ngIf="diffusion.process_date != null && [this.translate.instant('lang.visaWorkflowInterrupted'), this.translate.instant('lang.hasInterruptedWorkflow')].indexOf(diffusion.process_comment) === -1" class="workflowLineProcessDate" title='{{diffusion.process_date | fullDate}}' - color="accent">{{diffusion.requested_signature ? this.translate.instant('lang.signedUserDate') : this.translate.instant('lang.approvedUserDate')}} {{diffusion.process_date + color="accent">{{((functions.empty(diffusion.process_date) && diffusion.requested_signature) || diffusion.signatory) ? this.translate.instant('lang.signedUserDate') : this.translate.instant('lang.approvedUserDate')}} {{diffusion.process_date | timeAgo : 'full'}}</div> <div *ngIf="diffusion.process_date != null && ['A terminé le circuit'].indexOf(diffusion.process_comment) > -1" class="workflowLineProcessDate" title='{{diffusion.process_date | fullDate}}' color="warn">{{'lang.interrupted' | translate}} {{diffusion.process_date | timeAgo : 'full'}}</div> </div> <div *ngIf="diffusion.hasPrivilege && diffusion.isValid"> - <button class="currentRoleButton" [color]="diffusion.requested_signature ? 'primary': '' " + <button class="currentRoleButton" [color]="((functions.empty(diffusion.process_date) && diffusion.requested_signature) || diffusion.signatory) ? 'primary': '' " [disabled]="!canManageUser(diffusion, i)" mat-raised-button title="{{'lang.' + diffusion.currentRole + 'User' | translate}}" - (click)="changeRole(i)">{{diffusion.requested_signature ? this.translate.instant('lang.signUser') : this.translate.instant('lang.visaUser')}}</button> + (click)="changeRole(i)">{{((functions.empty(diffusion.process_date) && diffusion.requested_signature) || diffusion.signatory) ? this.translate.instant('lang.signUser') : this.translate.instant('lang.visaUser')}}</button> </div> <div *ngIf="!diffusion.hasPrivilege" class="invalid"> {{'lang.noPrivileges' | translate}} diff --git a/src/frontend/app/visa/visa-workflow.component.ts b/src/frontend/app/visa/visa-workflow.component.ts index c63748e722fc00dd0d537fe305b86e06398357c0..70a4f969d9320553f3b0ba5d9f14342cba3a9488 100644 --- a/src/frontend/app/visa/visa-workflow.component.ts +++ b/src/frontend/app/visa/visa-workflow.component.ts @@ -21,7 +21,6 @@ import {ActivatedRoute} from "@angular/router"; }) export class VisaWorkflowComponent implements OnInit { - visaWorkflow: any = { roles: ['sign', 'visa'], items: []