diff --git a/migration/20.10/2010.sql b/migration/20.10/2010.sql index e82c7ed2aded24fa907e8695edebfed088073ebb..8fd75347c8d1547c214cce079a34285517462817 100755 --- a/migration/20.10/2010.sql +++ b/migration/20.10/2010.sql @@ -287,6 +287,10 @@ ALTER TABLE entities DROP COLUMN IF EXISTS producer_service; ALTER TABLE entities ADD COLUMN producer_service character varying(255); UPDATE entities SET producer_service = entity_id; +UPDATE component = 'sendToRecordManagementAction' where action_page = 'export_seda'; +UPDATE component = 'checkAcknowledgmentRecordManagementAction' where action_page = 'check_acknowledgement'; +UPDATE component = 'checkReplyRecordManagementAction' where action_page = 'check_reply'; + /* RE CREATE VIEWS */ CREATE OR REPLACE VIEW res_view_letterbox AS SELECT r.res_id, diff --git a/package.json b/package.json index dc92a229685fe710bf24bb419cd9e4ebb5a46ae3..935fa31d0f8fab02295a0f4a50ee3c9afc18463d 100755 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/jquery.nicescroll": "^3.7.1", "@types/jstree": "^3.3.40", "@types/tooltipster": "0.0.30", - "ajv": "^6.12.5", + "ajv": "^6.12.6", "bootstrap": "^3.4.1", "chosen-js": "^1.8.7", "codelyzer": "^6.0.0", @@ -75,12 +75,12 @@ "tinymce": "^5.5.0", "tinymce-i18n": "^20.4.4", "tooltipster": "^4.2.8", - "tslib": "^2.0.1", + "tslib": "^2.0.3", "tslint": "^6.1.3", "typescript": "4.0.3", "uglify-es": "3.3.9", "uglifyjs-webpack-plugin": "2.2.0", - "url-loader": "^4.1.0", + "url-loader": "^4.1.1", "webpack": "^4.44.2" }, "repository": {} diff --git a/sql/data_fr.sql b/sql/data_fr.sql index 08a5e565b4c4ef61d23da9da9a328c409937f65e..48ede7305d7f373ade128733c44fca11073752e2 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -1068,9 +1068,9 @@ INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_pag INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (420, '', 'Classer sans suite', 'SSUITE', 'N', 'confirm_status', 'Y', 'confirmAction'); INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (421, '', 'Retourner au Service Courrier', 'RET', 'N', 'confirm_status', 'Y', 'confirmAction'); INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (431, '', 'Envoyer en GRC', 'GRC', 'N', 'confirm_status', 'Y', 'confirmAction'); -INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (500, '', 'Transférer au système d''archivage', 'SEND_SEDA', 'N', 'export_seda', 'Y', 'v1Action'); -INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (501, '', 'Valider la réception du courrier par le système d''archivage', 'ACK_SEDA', 'N', 'check_acknowledgement', 'Y', 'v1Action'); -INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (502, '', 'Valider l''archivage du courrier', 'REPLY_SEDA', 'N', 'check_reply', 'Y', 'v1Action'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (500, '', 'Transférer au système d''archivage', 'SEND_SEDA', 'N', 'export_seda', 'Y', 'sendToRecordManagementAction'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (501, '', 'Valider la réception du courrier par le système d''archivage', 'ACK_SEDA', 'N', 'check_acknowledgment', 'Y', 'checkAcknowledgmentRecordManagementAction'); +INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (502, '', 'Valider l''archivage du courrier', 'REPLY_SEDA', 'N', 'check_reply', 'Y', 'checkReplyRecordManagementAction'); INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (503, '', 'Purger le courrier', 'DEL', 'N', 'purge_letter', 'Y', 'v1Action'); INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component) VALUES (504, '', 'Remise à zero du courrier', 'END', 'N', 'reset_letter', 'Y', 'v1Action'); INSERT INTO actions (id, keyword, label_action, id_status, is_system, action_page, history, component, parameters) VALUES (505, '', 'Clôturer avec suivi', 'STDBY', 'N', 'close_mail', 'Y', 'closeMailAction', '{"requiredFields": []}'); diff --git a/src/app/action/controllers/ActionMethodController.php b/src/app/action/controllers/ActionMethodController.php index a2fad6b64b1def41297013ec247e3868069d6812..1ee23e8dcc95f0cabe485163b80f0042047abf7c 100644 --- a/src/app/action/controllers/ActionMethodController.php +++ b/src/app/action/controllers/ActionMethodController.php @@ -35,6 +35,7 @@ use MessageExchange\controllers\MessageExchangeReviewController; use Note\models\NoteEntityModel; use Note\models\NoteModel; use RegisteredMail\controllers\RegisteredMailTrait; +use ExportSeda\controllers\ExportSEDATrait; use Resource\controllers\ResController; use Resource\controllers\StoreController; use Resource\models\ResModel; @@ -52,6 +53,7 @@ class ActionMethodController use RegisteredMailTrait; use ShippingTrait; use ExternalSignatoryBookTrait; + use ExportSEDATrait; const COMPONENTS_ACTIONS = [ 'confirmAction' => null, @@ -86,6 +88,9 @@ class ActionMethodController 'saveAndIndexRegisteredMailAction' => 'saveAndPrintRegisteredMail', 'printRegisteredMailAction' => 'printRegisteredMail', 'printDepositListAction' => 'printDepositList', + 'sendToRecordManagementAction' => 'sendToRecordManagement', + 'checkAcknowledgmentRecordManagementAction' => 'checkAcknowledgmentRecordManagement', + 'checkReplyRecordManagementAction' => 'checkReplyRecordManagement', 'noConfirmAction' => null ]; diff --git a/src/app/external/exportSeda/controllers/ExportSEDATrait.php b/src/app/external/exportSeda/controllers/ExportSEDATrait.php new file mode 100644 index 0000000000000000000000000000000000000000..c4b667fc7b9b34877d79349b3ef477e459d6dc7c --- /dev/null +++ b/src/app/external/exportSeda/controllers/ExportSEDATrait.php @@ -0,0 +1,43 @@ +<?php + +/** +* Copyright Maarch since 2008 under licence GPLv3. +* See LICENCE.txt file at the root folder for more details. +* This file is part of Maarch software. + +* @brief ExportSEDATrait +* @author dev <dev@maarch.org> +* @ingroup core +*/ + +namespace ExportSeda\controllers; + +use SrcCore\models\ValidatorModel; + +trait ExportSEDATrait +{ + public static function sendToRecordManagement(array $args) + { + ValidatorModel::notEmpty($args, ['resId']); + ValidatorModel::intVal($args, ['resId']); + + // TODO : CONTROL + GET DATAS + $data = []; + + $controller = ExportSEDATrait::generateSEDAPackage(['data' => $data]); + if (!empty($controller['errors'])) { + return ['errors' => [$controller['errors']]]; + } + + // TODO : SEND PACKAGE TO RM + + return true; + } + + public static function generateSEDAPackage(array $args) + { + $encodedFile = ''; + + return ['encodedFile' => $encodedFile]; + } +} diff --git a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html index daba0d57de4f626f63255a2352b6c20332149048..bd7ac8bb9225e7547702d354b61927b9c795d09f 100644 --- a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html +++ b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.html @@ -17,7 +17,7 @@ <div class="col-md-6"> <mat-form-field> <mat-label>{{'lang.archivalAgreement' | translate}}</mat-label> - <mat-select formControlName="archivalAgreement"> + <mat-select formControlName="archivalAgreement" (selectionChange)="archivalAgreementSelected($event)"> <mat-option *ngFor="let agreement of archivalAgreements" [value]="agreement.id">{{agreement.label}}</mat-option> </mat-select> </mat-form-field> @@ -25,8 +25,8 @@ <div class="col-md-6"> <mat-form-field> <mat-label>{{'lang.archivalAgency' | translate}}</mat-label> - <mat-select formControlName="entityArchiveRecipient"> - <mat-option *ngFor="let entity of entityArchiveRecipients" [value]="entity.id">{{entity.label}}</mat-option> + <mat-select formControlName="entityArchiveRecipient" (selectionChange)="entityArchiveRecipientSelected($event)"> + <mat-option *ngFor="let entity of recipientArchiveEntities" [value]="entity.id">{{entity.label}}</mat-option> </mat-select> </mat-form-field> </div> @@ -109,9 +109,9 @@ </div> <span class="divider-modal"></span> <div mat-dialog-actions class="actions"> - <button mat-raised-button mat-button color="primary" [disabled]="loading || !isValidAction()" + <button mat-raised-button mat-button color="primary" [disabled]="loading || !this.actionFormGroup.valid" (click)="onSubmit()">{{'lang.validate' | translate}}</button> - <button mat-raised-button mat-button color="primary" [disabled]="loading || !isValidAction()" + <button mat-raised-button mat-button color="primary" [disabled]="loading || !this.actionFormGroup.valid" (click)="onSubmit()">{{'lang.download' | translate}}</button> <button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{'lang.cancel' | translate}}</button> diff --git a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts index 15018dabb24d5587d7ea1be38b7a868cae859886..a424923535341488f858694bf2cc0a444ce0f1fe 100644 --- a/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts +++ b/src/frontend/app/actions/send-to-record-management-action/send-to-record-management.component.ts @@ -16,18 +16,8 @@ import { catchError, finalize, tap } from 'rxjs/operators'; export class SendToRecordManagementComponent implements OnInit { loading: boolean = false; - entityArchiveRecipients = [ - { - id: 1, - label: 'Service 1' - } - ]; - archivalAgreements = [ - { - id: 1, - label: 'Accord 1' - } - ]; + recipientArchiveEntities = []; + archivalAgreements = []; descriptionLevels = [ { @@ -112,6 +102,8 @@ export class SendToRecordManagementComponent implements OnInit { this.archives.forEach((element: any) => { element.type = this.translate.instant('lang.' + element.type); }); + this.recipientArchiveEntities = data.recipientArchiveEntities; + this.archivalAgreements = data.archivalAgreements; this.actionFormGroup = this._formBuilder.group({ packageName: ['', Validators.required], slipId: [{value: data.data.slipInfo.slipId, disabled: true}, Validators.required], @@ -145,7 +137,6 @@ export class SendToRecordManagementComponent implements OnInit { } executeAction() { - const realResSelected: number[] = this.data.resIds; this.http.put(this.data.processActionRoute, { resources: realResSelected, data: {} }).pipe( @@ -165,8 +156,17 @@ export class SendToRecordManagementComponent implements OnInit { ).subscribe(); } - isValidAction() { - return true; + archivalAgreementSelected(ev: any) { + const archivalAgreement = this.archivalAgreements.filter((element: any) => element.id === ev.value); + this.actionFormGroup.patchValue({entityArchiveRecipient: archivalAgreement[0].archiveEntityRegNumber}); } + entityArchiveRecipientSelected(ev: any) { + if (!this.functions.empty(this.actionFormGroup.get('archivalAgreement').value) && !this.functions.empty(ev.value)) { + const archivalAgreement = this.archivalAgreements.filter((element: any) => element.id === this.actionFormGroup.get('archivalAgreement').value && element.archiveEntityRegNumber === ev.value); + if (archivalAgreement.length === 0) { + this.actionFormGroup.patchValue({archivalAgreement: null}); + } + } + } }