diff --git a/apps/maarch_entreprise/Views/notification-administration.component.html b/apps/maarch_entreprise/Views/notification-administration.component.html index 3d4d1ece720e5c6c1b3fda675ad163b8886706d8..1952447573fbe3a0d7df8e449fac4803ebf8040e 100644 --- a/apps/maarch_entreprise/Views/notification-administration.component.html +++ b/apps/maarch_entreprise/Views/notification-administration.component.html @@ -72,6 +72,7 @@ <div class="col-sm-12 panel-body" style="text-align:center;"> <button mat-raised-button color="primary" type="submit" [disabled]="!notificationsFormUp.form.valid">{{lang.validate}}</button> <button mat-raised-button routerLink='/administration/notifications'>{{lang.cancel}}</button> + <button mat-raised-button type="button" *ngIf="!notification.scriptcreated" (click)="createScript()">{{lang.createScriptNotification}}</button> </div> </form> </div> diff --git a/apps/maarch_entreprise/Views/notifications-administration.component.html b/apps/maarch_entreprise/Views/notifications-administration.component.html index 9d923b174cc24b80ad6f797b26d191952b106eb6..2326aedd012e968ab12764c1ff970bcaa4e0a6a1 100644 --- a/apps/maarch_entreprise/Views/notifications-administration.component.html +++ b/apps/maarch_entreprise/Views/notifications-administration.component.html @@ -10,6 +10,9 @@ <div *ngIf="!loading" class="container-fluid"> <div class="col-md-12"> <div class="example-container"> + <button mat-icon-button color="primary" matTooltip="{{lang.toSchedule}}" routerLink="/administration/notifications/schedule"> + {{lang.toSchedule}} + </button> <mat-grid-list cols="3" rowHeight="100px"> <mat-grid-tile> <mat-paginator #paginator [length]="100" [pageSize]="10" [pageSizeOptions]="[10, 25, 50, 100]"> diff --git a/apps/maarch_entreprise/Views/notifications-schedule-administration.component.html b/apps/maarch_entreprise/Views/notifications-schedule-administration.component.html new file mode 100644 index 0000000000000000000000000000000000000000..b9c3f901a58baa04578f045e1b85fead5bb0eb74 --- /dev/null +++ b/apps/maarch_entreprise/Views/notifications-schedule-administration.component.html @@ -0,0 +1,20 @@ +<div class="page-header"> + <h1>{{lang.notificationsSchedule}} + </h1> +</div> +<div *ngIf="loading"> + <mat-spinner style="margin:auto;"></mat-spinner> +</div> + +<div *ngIf="!loading" class="container-fluid"> + <div class="col-md-12"> + <div class="example-container"> + {{lang.NotificationScheduleInfo}} + + <div *ngFor="let crontabLine of crontab"> + {{crontabLine}} + </div> + {{authorizedNotification}} + </div> + </div> +</div> diff --git a/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.js b/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.js old mode 100755 new mode 100644 index 4d176f5ae190b40a52f62c8809ace7030dee5137..b7e253cfab72cd3cf3f87bf377bfd9319ff1f4dd --- a/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.js +++ b/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.js @@ -27,6 +27,7 @@ var priority_administration_component_1 = require("./priority-administration.com var reports_administration_component_1 = require("./reports-administration.component"); var notifications_administration_component_1 = require("./notifications-administration.component"); var notification_administration_component_1 = require("./notification-administration.component"); +var notifications_schedule_administration_component_1 = require("./notifications-schedule-administration.component"); var history_administration_component_1 = require("./history-administration.component"); var historyBatch_administration_component_1 = require("./historyBatch-administration.component"); var update_status_administration_component_1 = require("./update-status-administration.component"); @@ -63,6 +64,7 @@ var AdministrationRoutingModule = /** @class */ (function () { { path: 'administration/actions/:id', component: action_administration_component_1.ActionAdministrationComponent }, { path: 'administration/notifications', component: notifications_administration_component_1.NotificationsAdministrationComponent }, { path: 'administration/notifications/new', component: notification_administration_component_1.NotificationAdministrationComponent }, + { path: 'administration/notifications/schedule', component: notifications_schedule_administration_component_1.NotificationsScheduleAdministrationComponent }, { path: 'administration/notifications/:identifier', component: notification_administration_component_1.NotificationAdministrationComponent }, { path: 'administration/history', component: history_administration_component_1.HistoryAdministrationComponent }, { path: 'administration/historyBatch', component: historyBatch_administration_component_1.HistoryBatchAdministrationComponent }, diff --git a/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.ts b/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.ts index e8b3f349a9bb28dcca967e1ee64002b39cad51cd..eab7ab31fbfe0c873589d3a261efd6b9d9e8e43c 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/administration-routing.module.ts @@ -20,11 +20,12 @@ import { PriorityAdministrationComponent } from './priority-administration. import { ReportsAdministrationComponent } from './reports-administration.component'; import { NotificationsAdministrationComponent } from './notifications-administration.component'; import { NotificationAdministrationComponent } from './notification-administration.component'; +import { NotificationsScheduleAdministrationComponent } from './notifications-schedule-administration.component'; import { HistoryAdministrationComponent } from './history-administration.component'; import { HistoryBatchAdministrationComponent } from './historyBatch-administration.component'; import { UpdateStatusAdministrationComponent } from './update-status-administration.component'; - + @NgModule({ imports: [ RouterModule.forChild([ @@ -54,6 +55,7 @@ import { UpdateStatusAdministrationComponent } from './update-status-administra { path: 'administration/actions/:id', component: ActionAdministrationComponent }, { path: 'administration/notifications', component: NotificationsAdministrationComponent }, { path: 'administration/notifications/new', component: NotificationAdministrationComponent }, + { path: 'administration/notifications/schedule', component: NotificationsScheduleAdministrationComponent }, { path: 'administration/notifications/:identifier', component: NotificationAdministrationComponent }, { path: 'administration/history', component: HistoryAdministrationComponent }, { path: 'administration/historyBatch', component: HistoryBatchAdministrationComponent }, diff --git a/apps/maarch_entreprise/js/angular/app/administration/administration.module.js b/apps/maarch_entreprise/js/angular/app/administration/administration.module.js old mode 100755 new mode 100644 index f4a552348f936e408a9d7490efd08596be17834b..e2630c7a3e59354a91b6ff2df857b1c6c4d27063 --- a/apps/maarch_entreprise/js/angular/app/administration/administration.module.js +++ b/apps/maarch_entreprise/js/angular/app/administration/administration.module.js @@ -33,6 +33,7 @@ var history_administration_component_1 = require("./history-administration.compo var historyBatch_administration_component_1 = require("./historyBatch-administration.component"); var update_status_administration_component_1 = require("./update-status-administration.component"); var notifications_administration_component_1 = require("./notifications-administration.component"); +var notifications_schedule_administration_component_1 = require("./notifications-schedule-administration.component"); var notification_administration_component_1 = require("./notification-administration.component"); var AdministrationModule = /** @class */ (function () { function AdministrationModule() { @@ -69,6 +70,7 @@ var AdministrationModule = /** @class */ (function () { historyBatch_administration_component_1.HistoryBatchAdministrationComponent, update_status_administration_component_1.UpdateStatusAdministrationComponent, notifications_administration_component_1.NotificationsAdministrationComponent, + notifications_schedule_administration_component_1.NotificationsScheduleAdministrationComponent, notification_administration_component_1.NotificationAdministrationComponent, users_administration_component_1.UsersAdministrationRedirectModalComponent, groups_administration_component_1.GroupsAdministrationRedirectModalComponent diff --git a/apps/maarch_entreprise/js/angular/app/administration/administration.module.ts b/apps/maarch_entreprise/js/angular/app/administration/administration.module.ts index 3f27427de890e613813ea8a375a4d7e1ade9e8ba..7fa0b0fe0969a342eb932bac9898f08fa7fb5047 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/administration.module.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/administration.module.ts @@ -27,12 +27,13 @@ import { HistoryAdministrationComponent } from './history-administ import { HistoryBatchAdministrationComponent } from './historyBatch-administration.component'; import { UpdateStatusAdministrationComponent } from './update-status-administration.component'; import { NotificationsAdministrationComponent } from './notifications-administration.component'; +import { NotificationsScheduleAdministrationComponent } from './notifications-schedule-administration.component'; import { NotificationAdministrationComponent } from './notification-administration.component'; @NgModule({ imports: [ - CommonModule, + CommonModule, FormsModule, ReactiveFormsModule, HttpClientModule, @@ -61,6 +62,7 @@ import { NotificationAdministrationComponent } from './notification-adm HistoryBatchAdministrationComponent, UpdateStatusAdministrationComponent, NotificationsAdministrationComponent, + NotificationsScheduleAdministrationComponent, NotificationAdministrationComponent, UsersAdministrationRedirectModalComponent, GroupsAdministrationRedirectModalComponent diff --git a/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.js index 9585421ffc5503605ec3d1a304744f919140e98c..de130e7fbcea2e3310eceab7fbf468191cdb7ddb 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.js @@ -64,6 +64,16 @@ var NotificationAdministrationComponent = /** @class */ (function () { }); this.updateBreadcrumb(angularGlobals.applicationName); }; + NotificationAdministrationComponent.prototype.createScript = function () { + var _this = this; + this.http.post(this.coreUrl + 'rest/scriptNotification', this.notification) + .subscribe(function (data) { + _this.notification.scriptcreated = data; + _this.notify.success(_this.lang.ScriptCreated); + }, function (err) { + _this.notify.error(err.error.errors); + }); + }; NotificationAdministrationComponent.prototype.selectAll = function (event) { var target = event.target.getAttribute("data-target"); $j('#' + target + ' option').prop('selected', true); diff --git a/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.ts index e2a21047e95eff8d16ced9c3edb25f290f8d905e..8a84e560f1879ca3b699f15694c1858f59e59507 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/notification-administration.component.ts @@ -58,7 +58,6 @@ export class NotificationAdministrationComponent implements OnInit { this.creationMode = false; this.http.get(this.coreUrl + 'rest/notifications/' + params['identifier']) .subscribe((data : any) => { - this.notification = data.notification; this.loading = false; }, (err) => { @@ -71,6 +70,16 @@ export class NotificationAdministrationComponent implements OnInit { } + createScript() { + this.http.post(this.coreUrl + 'rest/scriptNotification', this.notification) + .subscribe((data : any) => { + this.notification.scriptcreated = data; + this.notify.success(this.lang.ScriptCreated); + },(err) => { + this.notify.error(err.error.errors); + }); + } + selectAll(event: any) { var target = event.target.getAttribute("data-target"); $j('#' + target + ' option').prop('selected', true); diff --git a/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.js new file mode 100644 index 0000000000000000000000000000000000000000..5b0662360078a35fe8a07320c97252d0119e6190 --- /dev/null +++ b/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.js @@ -0,0 +1,68 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var core_1 = require("@angular/core"); +var http_1 = require("@angular/common/http"); +var router_1 = require("@angular/router"); +var translate_component_1 = require("../translate.component"); +var notification_service_1 = require("../notification.service"); +var NotificationsScheduleAdministrationComponent = /** @class */ (function () { + function NotificationsScheduleAdministrationComponent(http, router, notify) { + this.http = http; + this.router = router; + this.notify = notify; + this.crontab = []; + this.authorizedNotification = []; + this.loading = false; + this.lang = translate_component_1.LANG; + } + NotificationsScheduleAdministrationComponent.prototype.ngOnInit = function () { + var _this = this; + this.updateBreadcrumb(angularGlobals.applicationName); + this.coreUrl = angularGlobals.coreUrl; + this.loading = true; + this.http.get(this.coreUrl + 'rest/notifications/schedule') + .subscribe(function (data) { + _this.crontab = data.crontab; + _this.authorizedNotification = data.authorizedNotification; + _this.loading = false; + }, function (err) { + _this.notify.error(err.error.errors); + }); + }; + NotificationsScheduleAdministrationComponent.prototype.updateBreadcrumb = function (applicationName) { + if ($j('#ariane')[0]) { + $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>" + this.lang.administration + + "</a> > <a onclick='location.hash = \"/administration/notifications\"' style='cursor: pointer'>" + this.lang.notifications + + "</a> > " + this.lang.notificationsSchedule; + } + }; + NotificationsScheduleAdministrationComponent.prototype.onSubmit = function () { + var _this = this; + this.http.post(this.coreUrl + 'rest/notifications/schedule', this.crontab) + .subscribe(function (data) { + _this.router.navigate(['/administration/notifications']); + _this.notify.success(_this.lang.NotificationScheduleUpdated); + }, function (err) { + _this.notify.error(err.error.errors); + }); + }; + NotificationsScheduleAdministrationComponent = __decorate([ + core_1.Component({ + templateUrl: angularGlobals["notifications-schedule-administrationView"], + providers: [notification_service_1.NotificationService] + }), + __metadata("design:paramtypes", [http_1.HttpClient, router_1.Router, notification_service_1.NotificationService]) + ], NotificationsScheduleAdministrationComponent); + return NotificationsScheduleAdministrationComponent; +}()); +exports.NotificationsScheduleAdministrationComponent = NotificationsScheduleAdministrationComponent; diff --git a/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..56673dea382a457a5094e5bd211c7840a046e506 --- /dev/null +++ b/apps/maarch_entreprise/js/angular/app/administration/notifications-schedule-administration.component.ts @@ -0,0 +1,65 @@ +import { Component, ViewChild, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Router, ActivatedRoute } from '@angular/router'; +import { LANG } from '../translate.component'; +import { NotificationService } from '../notification.service'; +// import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material'; + + +declare function $j(selector: any) : any; + +declare var angularGlobals : any; + + +@Component({ + templateUrl : angularGlobals["notifications-schedule-administrationView"], + providers : [NotificationService] +}) +export class NotificationsScheduleAdministrationComponent implements OnInit { + + coreUrl : string; + + crontab : any[] = []; + authorizedNotification : any[] = []; + loading : boolean = false; + lang : any = LANG; + + constructor(public http: HttpClient, private router: Router, private notify: NotificationService) { + } + + ngOnInit(): void { + this.updateBreadcrumb(angularGlobals.applicationName); + + this.coreUrl = angularGlobals.coreUrl; + this.loading = true; + + this.http.get(this.coreUrl + 'rest/notifications/schedule') + .subscribe((data : any) => { + this.crontab = data.crontab; + this.authorizedNotification = data.authorizedNotification; + this.loading = false; + }, (err) => { + this.notify.error(err.error.errors); + }); + } + + updateBreadcrumb(applicationName: string) { + if ($j('#ariane')[0]) { + $j('#ariane')[0].innerHTML = "<a href='index.php?reinit=true'>" + applicationName + + "</a> > <a onclick='location.hash = \"/administration\"' style='cursor: pointer'>"+this.lang.administration+ + "</a> > <a onclick='location.hash = \"/administration/notifications\"' style='cursor: pointer'>"+this.lang.notifications+ + "</a> > "+this.lang.notificationsSchedule; + } + } + + onSubmit() { + this.http.post(this.coreUrl + 'rest/notifications/schedule', this.crontab) + .subscribe((data : any) => { + this.router.navigate(['/administration/notifications']); + this.notify.success(this.lang.NotificationScheduleUpdated); + },(err) => { + this.notify.error(err.error.errors); + }); + } + +} diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.js b/apps/maarch_entreprise/js/angular/lang/lang-en.js index 1a46aa73112e9b3dfe129c00c75580d2ae303c7e..d8825947aeae65952323e3b69a21baa2d5f32d70 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.js @@ -71,16 +71,16 @@ exports.LANG_EN = { "groupCreation": "Create group", "groupDeleted": "Group deleted", "groupModification": "Modify group", - "groups": "Groups", "groupRedirect": "Group change", + "groups": "Groups", "groupUpdated": "Group updated", "history": "Historique", "id": "Login", - "isAssociatedTo": "is associated to", "imgRelated": "Associated image", "inactive": "Inactive", "informations": "Informations", "initials": "Initials", + "isAssociatedTo": "is associated to", "isFolderAction": "Folder action", "isFolderActionDesc": "Use this action in a folder folder", "isFolderStatus": "Folder status", @@ -88,6 +88,8 @@ exports.LANG_EN = { "keyword": "Keyword", "keywordHelp": "Keyword help", "keywordHelpDesc_1": "Identifier of logged user", + "keywordHelpDesc_10": "Immediate sub-entities (n-1) of entities passed in argument", + "keywordHelpDesc_11": "Example of security definition for a group (where clause) : access of main entity of logged user or sub-entity of this entity", "keywordHelpDesc_2": "Email of logged user", "keywordHelpDesc_3": "All entities linked to logged user. Sub-entities are excludes", "keywordHelpDesc_4": "Primary entity of logged user", @@ -96,8 +98,6 @@ exports.LANG_EN = { "keywordHelpDesc_7": "All entities to the same level of entity in argument", "keywordHelpDesc_8": "All entities with de same type passed in argument", "keywordHelpDesc_9": "All entities (enabled)", - "keywordHelpDesc_10": "Immediate sub-entities (n-1) of entities passed in argument", - "keywordHelpDesc_11": "Example of security definition for a group (where clause) : access of main entity of logged user or sub-entity of this entity", "keywordHelper": "Hide / Display keyword help", "label": "Label", "lastname": "Lastname", @@ -114,6 +114,8 @@ exports.LANG_EN = { "newElement": "New element", "newPsw": "New password", "newSignature": "New signature", + "no": "No", + "noReplacement": "No replacement", "notes": "Notes", "NotificationAdded": "Notification added", "notificationCreation": "Notification creation", @@ -126,10 +128,11 @@ exports.LANG_EN = { "notificationModification": "Notification modification", "notifications": "Notification(s)", "notificationSchedule": "Notifications schedule", + "NotificationScheduleInfo": "This part is used to define when notifications will be sent.\n\nIf you choose * from all the drop-down lists, the notification will be sent every minute 365 days a year.\n\nFrequency example :\n14 30 * * * [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les jours à 14h30\n9 30 * * Lundi [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les lundi à 9h30", + "NotificationScheduleUpdated": "Schedule updated", + "notificationsSchedule": "Notifications schedule", "NotificationToEnable": "To enable", "notificationUpdated": "Notification updated", - "no": "No", - "noReplacement": "No replacement", "parameter": "Parameter", "parameterAdded": "Parameter added", "parameterDeleted": "Parameter deleted", @@ -168,6 +171,7 @@ exports.LANG_EN = { "tooltipFolderStatus": "If checked, status can be used for folder baskets", "tooltipIndexStatus": "If checked, you can edit metadatas of the documents having this status", "tooltipSearchStatus": "If checked, the status will be offered in the search criteria STATUS of the advanced search", + "toSchedule": "To schedule", "unselectAll": "Unselect all", "update": "Update", "updateStatus": "Document status modification", @@ -181,4 +185,6 @@ exports.LANG_EN = { "visa": "Visa circuit", "workingDays": "Working days", "yes": "Yes", + "createScriptNotification": "Create the script", + "ScriptCreated": "Script created", }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-en.ts b/apps/maarch_entreprise/js/angular/lang/lang-en.ts index bb679e2757833febde5a270497f8d8e181d582b3..4e06e5b8d2d8e762b609d6ec90651378b949c09b 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-en.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-en.ts @@ -18,8 +18,8 @@ export const LANG_EN = { "administration" : "Administration", "administrationServices" : "Administration services", "application" : "Application", - "associatedStatus" : "Associated status", - "attachments" : "Attachments", + "associatedStatus" : "Associated status", + "attachments" : "Attachments", "authorize" : "Authorize", "autoLogoutAbsence" : "You are going to be automaticaly disconnected after your redirections", "avis" : "Avis circuit", @@ -35,7 +35,7 @@ export const LANG_EN = { "cases" : "Cases", "changeMyPassword" : "Change my password", "chooseBasket" : "Choose a basket", - "chooseCategoryAssociation" : "Choose one or some associatedd categories", + "chooseCategoryAssociation" : "Choose one or some associatedd categories", "chooseEntity" : "Choose a entity", "chooseGroup" : "Choose a group", "chooseRedirectGroup" : "Choose another group", @@ -48,7 +48,7 @@ export const LANG_EN = { "delete" : "Delete", "deleteMsg" : "Do you really want to delete this element", "description" : "Description", - "doNotModifyUnlessExpert" : "Do not edit this section unless you know what you are doing. Incorrect settings can cause the application to malfunction !", + "doNotModifyUnlessExpert" : "Do not edit this section unless you know what you are doing. Incorrect settings can cause the application to malfunction !", "email" : "Email", "emailSignatures" : "Email signatures", "entities" : "Entities", @@ -69,16 +69,16 @@ export const LANG_EN = { "groupCreation" : "Create group", "groupDeleted" : "Group deleted", "groupModification" : "Modify group", - "groups" : "Groups", "groupRedirect" : "Group change", + "groups" : "Groups", "groupUpdated" : "Group updated", "history" : "Historique", "id" : "Login", - "isAssociatedTo" : "is associated to", "imgRelated" : "Associated image", "inactive" : "Inactive", "informations" : "Informations", "initials" : "Initials", + "isAssociatedTo" : "is associated to", "isFolderAction" : "Folder action", "isFolderActionDesc" : "Use this action in a folder folder", "isFolderStatus" : "Folder status", @@ -86,6 +86,8 @@ export const LANG_EN = { "keyword" : "Keyword", "keywordHelp" : "Keyword help", "keywordHelpDesc_1" : "Identifier of logged user", + "keywordHelpDesc_10" : "Immediate sub-entities (n-1) of entities passed in argument", + "keywordHelpDesc_11" : "Example of security definition for a group (where clause) : access of main entity of logged user or sub-entity of this entity", "keywordHelpDesc_2" : "Email of logged user", "keywordHelpDesc_3" : "All entities linked to logged user. Sub-entities are excludes", "keywordHelpDesc_4" : "Primary entity of logged user", @@ -94,8 +96,6 @@ export const LANG_EN = { "keywordHelpDesc_7" : "All entities to the same level of entity in argument", "keywordHelpDesc_8" : "All entities with de same type passed in argument", "keywordHelpDesc_9" : "All entities (enabled)", - "keywordHelpDesc_10" : "Immediate sub-entities (n-1) of entities passed in argument", - "keywordHelpDesc_11" : "Example of security definition for a group (where clause) : access of main entity of logged user or sub-entity of this entity", "keywordHelper" : "Hide / Display keyword help", "label" : "Label", "lastname" : "Lastname", @@ -112,6 +112,8 @@ export const LANG_EN = { "newElement" : "New element", "newPsw" : "New password", "newSignature" : "New signature", + "no" : "No", + "noReplacement" : "No replacement", "notes" : "Notes", "NotificationAdded" : "Notification added", "notificationCreation" : "Notification creation", @@ -124,10 +126,11 @@ export const LANG_EN = { "notificationModification" : "Notification modification", "notifications" : "Notification(s)", "notificationSchedule" : "Notifications schedule", + "NotificationScheduleInfo" : "This part is used to define when notifications will be sent.\n\nIf you choose * from all the drop-down lists, the notification will be sent every minute 365 days a year.\n\nFrequency example :\n14 30 * * * [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les jours à 14h30\n9 30 * * Lundi [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les lundi à 9h30", + "NotificationScheduleUpdated" : "Schedule updated", + "notificationsSchedule" : "Notifications schedule", "NotificationToEnable" : "To enable", "notificationUpdated" : "Notification updated", - "no" : "No", - "noReplacement" : "No replacement", "parameter" : "Parameter", "parameterAdded" : "Parameter added", "parameterDeleted" : "Parameter deleted", @@ -166,6 +169,7 @@ export const LANG_EN = { "tooltipFolderStatus" : "If checked, status can be used for folder baskets", "tooltipIndexStatus" : "If checked, you can edit metadatas of the documents having this status", "tooltipSearchStatus" : "If checked, the status will be offered in the search criteria STATUS of the advanced search", + "toSchedule" : "To schedule", "unselectAll" : "Unselect all", "update" : "Update", "updateStatus" : "Document status modification", @@ -179,4 +183,7 @@ export const LANG_EN = { "visa" : "Visa circuit", "workingDays" : "Working days", "yes" : "Yes", + "createScriptNotification" : "Create the script", + "ScriptCreated" : "Script created", + }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.js b/apps/maarch_entreprise/js/angular/lang/lang-fr.js index c43557fdeb0639a1ee5db6bcc82f82a5210406e3..b0fe27fa6de4ff3b48da46d6efe5cf1bdef7c83a 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.js +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.js @@ -81,10 +81,10 @@ exports.LANG_FR = { "functionnalities": "Fonctionnalités", "groupAdded": "Groupe ajouté", "groupCreation": "Création d'un groupe", - "groupModification": "Modification d'un groupe", "groupDeleted": "Groupe supprimé", - "groups": "Groupes", + "groupModification": "Modification d'un groupe", "groupRedirect": "Changement de groupe", + "groups": "Groupes", "groupUpdated": "Groupe modifié", "history": "Historique", "historyBatch": "Historique des batchs", @@ -104,6 +104,8 @@ exports.LANG_FR = { "keyword": "Mot-clé", "keywordHelp": "Aide sur les mots-clés", "keywordHelpDesc_1": "Identifiant de l'utilisateur connecté", + "keywordHelpDesc_10": "Sous-entités immédiates (n-1) des entités données en argument", + "keywordHelpDesc_11": "Exemple dans la définition de la sécurité d'un groupe (where clause) : accès sur les ressources concernant le service d'appartenance principal de l'utilisateur connecté, ou les sous-services de ce service", "keywordHelpDesc_2": "Courriel de l'utilisateur connecté", "keywordHelpDesc_3": "Toutes les entités rattachées à l'utilisateur connecté. N'inclue pas les sous-entités", "keywordHelpDesc_4": "Entité primaire de l'utilisateur connecté", @@ -112,8 +114,6 @@ exports.LANG_FR = { "keywordHelpDesc_7": "Toutes les entités du même niveau que l'entité en argument", "keywordHelpDesc_8": "Toutes les entités du même type mis en argument", "keywordHelpDesc_9": "Toutes les entités (actives)", - "keywordHelpDesc_10": "Sous-entités immédiates (n-1) des entités données en argument", - "keywordHelpDesc_11": "Exemple dans la définition de la sécurité d'un groupe (where clause) : accès sur les ressources concernant le service d'appartenance principal de l'utilisateur connecté, ou les sous-services de ce service", "keywordHelper": "Afficher / Cacher l'aide sur les mots-clés", "label": "Label", "last": "dernier", @@ -148,6 +148,9 @@ exports.LANG_FR = { "notificationModification": "Modification de la notification", "notifications": "Notification(s)", "notificationSchedule": "Planifier les notifications", + "NotificationScheduleInfo": "Cette partie permet de définir quand seront envoyées les notifications.\n\nSi vous choisissez * dans toutes les listes déroulantes, la notification sera envoyée toutes les minutes 365 jours par an.\n\nExemple de fréquence :\n14 30 * * * [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les jours à 14h30\n9 30 * * Lundi [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les lundi à 9h30", + "NotificationScheduleUpdated": "Planification mise à jour", + "notificationsSchedule": "Planification des notifications", "NotificationToEnable": "Activer", "notificationUpdated": "Notification mise à jour", "outOf": "sur", @@ -202,6 +205,7 @@ exports.LANG_FR = { "tooltipFolderStatus": "Si coché, le statut pourra être utilisé pour des bannettes de dossiers", "tooltipIndexStatus": "Si coché, vous pourrez modifier les meta-données des documents ayant ce statut", "tooltipSearchStatus": "Si coché, le statut vous sera proposé dans le critère de recherche STATUTS de la recherche avancée", + "toSchedule": "Planifier", "totalErrors": "Élément(s) en erreur", "totalProcessed": "Élément(s) analysé(s)", "type": "Type", @@ -224,4 +228,6 @@ exports.LANG_FR = { "visa": "Circuit de visa", "workingDays": "Jours ouvrés", "yes": "Oui", + "createScriptNotification": "Créer le script", + "ScriptCreated": "Script créé", }; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index 0b628e6521dbf615d47192ef617192f4d4889804..8b9595c011bbacbb9dfb505ee77cab9908c67418 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -22,7 +22,7 @@ export const LANG_FR = { "administrationServices" : "Services d'administration", "application" : "Application", "associatedStatus" : "Statut associé", - "attachments" : "Attachments", + "attachments" : "Attachments", "authorize" : "Autoriser", "autoLogoutAbsence" : "Vous allez être automatiquement déconnecté après avoir défini vos redirections de bannettes", "available" : "disponible", @@ -79,10 +79,10 @@ export const LANG_FR = { "functionnalities" : "Fonctionnalités", "groupAdded" : "Groupe ajouté", "groupCreation" : "Création d'un groupe", - "groupModification" : "Modification d'un groupe", "groupDeleted" : "Groupe supprimé", - "groups" : "Groupes", + "groupModification" : "Modification d'un groupe", "groupRedirect" : "Changement de groupe", + "groups" : "Groupes", "groupUpdated" : "Groupe modifié", "history" : "Historique", "historyBatch" : "Historique des batchs", @@ -102,6 +102,8 @@ export const LANG_FR = { "keyword" : "Mot-clé", "keywordHelp" : "Aide sur les mots-clés", "keywordHelpDesc_1" : "Identifiant de l'utilisateur connecté", + "keywordHelpDesc_10" : "Sous-entités immédiates (n-1) des entités données en argument", + "keywordHelpDesc_11" : "Exemple dans la définition de la sécurité d'un groupe (where clause) : accès sur les ressources concernant le service d'appartenance principal de l'utilisateur connecté, ou les sous-services de ce service", "keywordHelpDesc_2" : "Courriel de l'utilisateur connecté", "keywordHelpDesc_3" : "Toutes les entités rattachées à l'utilisateur connecté. N'inclue pas les sous-entités", "keywordHelpDesc_4" : "Entité primaire de l'utilisateur connecté", @@ -110,8 +112,6 @@ export const LANG_FR = { "keywordHelpDesc_7" : "Toutes les entités du même niveau que l'entité en argument", "keywordHelpDesc_8" : "Toutes les entités du même type mis en argument", "keywordHelpDesc_9" : "Toutes les entités (actives)", - "keywordHelpDesc_10" : "Sous-entités immédiates (n-1) des entités données en argument", - "keywordHelpDesc_11" : "Exemple dans la définition de la sécurité d'un groupe (where clause) : accès sur les ressources concernant le service d'appartenance principal de l'utilisateur connecté, ou les sous-services de ce service", "keywordHelper" : "Afficher / Cacher l'aide sur les mots-clés", "label" : "Label", "last" : "dernier", @@ -146,6 +146,9 @@ export const LANG_FR = { "notificationModification" : "Modification de la notification", "notifications" : "Notification(s)", "notificationSchedule" : "Planifier les notifications", + "NotificationScheduleInfo" : "Cette partie permet de définir quand seront envoyées les notifications.\n\nSi vous choisissez * dans toutes les listes déroulantes, la notification sera envoyée toutes les minutes 365 jours par an.\n\nExemple de fréquence :\n14 30 * * * [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les jours à 14h30\n9 30 * * Lundi [courrier] Nouveaux courriers à traiter : La notification sera envoyée tous les lundi à 9h30", + "NotificationScheduleUpdated" : "Planification mise à jour", + "notificationsSchedule" : "Planification des notifications", "NotificationToEnable" : "Activer", "notificationUpdated" : "Notification mise à jour", "outOf" : "sur", @@ -200,6 +203,7 @@ export const LANG_FR = { "tooltipFolderStatus" : "Si coché, le statut pourra être utilisé pour des bannettes de dossiers", "tooltipIndexStatus" : "Si coché, vous pourrez modifier les meta-données des documents ayant ce statut", "tooltipSearchStatus" : "Si coché, le statut vous sera proposé dans le critère de recherche STATUTS de la recherche avancée", + "toSchedule" : "Planifier", "totalErrors" : "Élément(s) en erreur", "totalProcessed" : "Élément(s) analysé(s)", "type" : "Type", @@ -222,4 +226,6 @@ export const LANG_FR = { "visa" : "Circuit de visa", "workingDays" : "Jours ouvrés", "yes" : "Oui", + "createScriptNotification" : "Créer le script", + "ScriptCreated" : "Script créé", }; \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angularFunctions.js b/apps/maarch_entreprise/js/angularFunctions.js index 0debbc2f5ae70bff75cdb2db2035ef82c2806cce..4c0b5010dda400ee72f8dcf744cfda1a4242dd71 100755 --- a/apps/maarch_entreprise/js/angularFunctions.js +++ b/apps/maarch_entreprise/js/angularFunctions.js @@ -27,6 +27,7 @@ function triggerAngular(prodmode, locationToGo) { 'priority-administration', 'reports-administration', 'notifications-administration', + 'notifications-schedule-administration', 'notification-administration' ]; diff --git a/rest/index.php b/rest/index.php index d3d486800fec6c08dd35e427e80ba35b286cc72d..4bd07cd862e455f1567f8bf929f6cac6b7ec082f 100755 --- a/rest/index.php +++ b/rest/index.php @@ -244,13 +244,13 @@ $app->delete('/actions/{id}', \Action\controllers\ActionController::class . ':de //Notifications $app->get('/notifications', \Notification\controllers\NotificationController::class . ':get'); $app->post('/notifications', \Notification\controllers\NotificationController::class . ':create'); +$app->get('/notifications/schedule', \Notification\controllers\NotificationScheduleController::class . ':get'); +$app->post('/notifications/schedule', \Notification\controllers\NotificationScheduleController::class . ':create'); $app->put('/notifications/{id}', \Notification\controllers\NotificationController::class . ':update'); $app->delete('/notifications/{id}', \Notification\controllers\NotificationController::class . ':delete'); $app->get('/administration/notifications/new', \Notification\controllers\NotificationController::class . ':initNotification'); $app->get('/notifications/{id}', \Notification\controllers\NotificationController::class . ':getBySid'); -$app->get('/notificationsSchedule', \Notification\controllers\NotificationScheduleController::class . ':get'); -$app->post('/notificationsSchedule', \Notification\controllers\NotificationScheduleController::class . ':create'); $app->post('/scriptNotification', \Notification\controllers\NotificationScheduleController::class . ':createScriptNotification'); //Reports diff --git a/src/app/notification/controllers/NotificationController.php b/src/app/notification/controllers/NotificationController.php index 045fc6bff242526db58646813c90a28aaf973978..f1fc61ab09f83e85bbc1bd1e591863506dfbc967 100644 --- a/src/app/notification/controllers/NotificationController.php +++ b/src/app/notification/controllers/NotificationController.php @@ -78,7 +78,28 @@ class NotificationController $notification['data'] = $data; - return $response->withJson(['notification'=>$notification]); + $filename = "notification"; + $customId = CoreConfigModel::getCustomId(); + if ($customId <> "") { + $filename.="_".str_replace(" ", "", $customId); + } + $filename .= "_".$notification['notification_sid'].".sh"; + + $corePath = str_replace("custom/".$customId."/src/app/notification/controllers", "", __DIR__); + $corePath = str_replace("src/app/notification/controllers", "", $corePath); + if ($customId <> '') { + $pathToFolow = $corePath . 'custom/'.$customId. '/'; + } else { + $pathToFolow = $corePath; + } + + $notification["scriptcreated"] = false; + + if (file_exists($pathToFolow.'modules/notifications/batch/scripts/'.$filename)) { + $notification["scriptcreated"] = true; + } + + return $response->withJson(['notification' => $notification]); } public function create(Request $request, Response $response) @@ -145,6 +166,7 @@ class NotificationController $data = $request->getParams(); $data['notification_sid'] = $aArgs['id']; + unset($data['scriptcreated']); $errors = $this->control($data, 'update'); @@ -211,7 +233,8 @@ class NotificationController $flagCron = false; - $corePath = dirname(__FILE__, 5) . '/'; + $corePath = str_replace("custom/".$customId."/src/app/notification/controllers", "", __DIR__); + $corePath = str_replace("src/app/notification/controllers", "", $corePath); if ($customId <> '') { $pathToFolow = $corePath . 'custom/'.$customId. '/'; } else { diff --git a/src/app/notification/controllers/NotificationScheduleController.php b/src/app/notification/controllers/NotificationScheduleController.php index e7299298e468758de247269b9cc8518b4eb89c95..6a92e0074f4755c9190898ac424df2e38ce6482d 100644 --- a/src/app/notification/controllers/NotificationScheduleController.php +++ b/src/app/notification/controllers/NotificationScheduleController.php @@ -73,7 +73,8 @@ class NotificationScheduleController $aNotification = NotificationModel::getEnableNotifications(['select' => ['notification_sid', 'description']]); $notificationsArray = array(); $customId = CoreConfigModel::getCustomId(); - $corePath = dirname(__FILE__, 5) . '/'; + $corePath = str_replace("custom/".$customId."/src/app/notification/controllers", "", __DIR__); + $corePath = str_replace("src/app/notification/controllers", "", $corePath); foreach ($aNotification as $result) { $filename = "notification"; @@ -102,7 +103,8 @@ class NotificationScheduleController { $customId = CoreConfigModel::getCustomId(); $crontabBeforeSave = NotificationScheduleModel::getCrontab(); - $corePath = dirname(__FILE__, 5) . '/'; + $corePath = str_replace("custom/".$customId."/src/app/notification/controllers", "", __DIR__); + $corePath = str_replace("src/app/notification/controllers", "", $corePath); foreach ($crontabToSave as $id => $cronValue) { if ($cronValue['state'] != "hidden" && $crontabBeforeSave[$id]['state'] == "hidden") { $returnValue = false; @@ -158,5 +160,4 @@ class NotificationScheduleController return $response->withJson(true); } - } diff --git a/src/app/notification/models/NotificationScheduleModelAbstract.php b/src/app/notification/models/NotificationScheduleModelAbstract.php index bac131403c7f585dcf1f72db863ee6105ba4246b..9e7bc37dee7d862ec82cced57f9f2ca418264fde 100644 --- a/src/app/notification/models/NotificationScheduleModelAbstract.php +++ b/src/app/notification/models/NotificationScheduleModelAbstract.php @@ -69,7 +69,8 @@ class NotificationScheduleModelAbstract $lines = explode("\n", $crontab); $data = array(); $customId = CoreConfigModel::getCustomId(); - $corePath = dirname(__FILE__, 5) . '/'; + $corePath = str_replace("custom/".$customId."/src/app/notification/models", "", __DIR__); + $corePath = str_replace("src/app/notification/models", "", $corePath); foreach ($lines as $cronLine) { $cronLine = trim($cronLine); @@ -127,7 +128,8 @@ class NotificationScheduleModelAbstract } $filename.="_".$notification_sid.".sh"; - $corePath = dirname(__FILE__, 5) . '/'; + $corePath = str_replace("custom/".$customId."/src/app/notification/models", "", __DIR__); + $corePath = str_replace("src/app/notification/models", "", $corePath); if (file_exists($corePath. 'custom/'.$customId .'/modules/notifications/batch/config/config.xml')) { $ConfigNotif = $corePath. 'custom/'. $customId .'/modules/notifications/batch/config/config.xml';