diff --git a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js index 72b773fec2b1e82db4f96d80ef8fb9902b5bc9e1..2c7b349568bd74ad205067a2bb80da932caff97f 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/doctypes-administration.component.js @@ -321,7 +321,6 @@ var DoctypesAdministrationComponent = /** @class */ (function () { _this.config = { data: { count: data.deleted, types: data.doctypes } }; _this.dialogRef = _this.dialog.open(DoctypesAdministrationRedirectModalComponent, _this.config); _this.dialogRef.afterClosed().subscribe(function (result) { - console.log(result); if (result) { _this.http.put(_this.coreUrl + "rest/doctypes/types/" + _this.currentType.type_id + "/redirect", result) .subscribe(function (data) { diff --git a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.js index ff6adfb8377a2d7ba86fe8c0569d6a343e42c30f..dd6f1287bc9b05e4b263ed56ad35f85bf8ac4298 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.js @@ -75,26 +75,14 @@ var UserAdministrationComponent = /** @class */ (function (_super) { UserAdministrationComponent.prototype.ngOnDestroy = function () { this.mobileQuery.removeListener(this._mobileQueryListener); }; - UserAdministrationComponent.prototype.updateBreadcrumb = function (applicationName) { - var breadCrumb = "<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/users\"' style='cursor: pointer'>" + this.lang.users + "</a> > "; - if (this.creationMode == true) { - breadCrumb += this.lang.userCreation; - } - else { - breadCrumb += this.lang.userModification; - } - $j('#ariane')[0].innerHTML = breadCrumb; - }; UserAdministrationComponent.prototype.ngOnInit = function () { var _this = this; - //$j('#header').remove(); this.coreUrl = angularGlobals.coreUrl; this.loading = true; this.route.params.subscribe(function (params) { if (typeof params['id'] == "undefined") { _this.creationMode = true; _this.loading = false; - _this.updateBreadcrumb(angularGlobals.applicationName); } else { _this.creationMode = false; @@ -104,7 +92,6 @@ var UserAdministrationComponent = /** @class */ (function (_super) { _this.user = data; _this.data = data.history; _this.userId = data.user_id; - _this.updateBreadcrumb(angularGlobals.applicationName); _this.minDate = new Date(_this.CurrentYear + '-' + _this.currentMonth + '-01'); _this.loading = false; setTimeout(function () { @@ -120,7 +107,7 @@ var UserAdministrationComponent = /** @class */ (function (_super) { }; UserAdministrationComponent.prototype.toogleRedirect = function (basket) { $j('#redirectUser_' + basket.group_id + '_' + basket.basket_id).toggle(); - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe(function (data) { //this.userList = data['users']; }, function () { @@ -147,7 +134,6 @@ var UserAdministrationComponent = /** @class */ (function (_super) { .on('select_node.jstree', function (e, data) { _this.addEntity(data.node.id); }).on('deselect_node.jstree', function (e, data) { - //console.log(data.node.id); _this.deleteEntity(data.node.id); }) .jstree(); @@ -211,7 +197,7 @@ var UserAdministrationComponent = /** @class */ (function (_super) { if (r) { this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/password", {}) .subscribe(function (data) { - _this.notify.success(_this.lang.pswReseted + ' ' + _this.lang.for + ' « ' + user.user_id + ' »'); + _this.notify.success(_this.lang.pswReseted); }, function (err) { _this.notify.error(err.error.errors); }); @@ -304,7 +290,7 @@ var UserAdministrationComponent = /** @class */ (function (_super) { this.http.post(this.coreUrl + "rest/users/" + this.serialId + "/signatures", this.signatureModel) .subscribe(function (data) { _this.user.signatures = data.signatures; - _this.notify.success(_this.lang.signAdded + ' « ' + _this.signatureModel.name + ' »'); + _this.notify.success(_this.lang.signAdded); _this.signatureModel = { base64: "", base64ForJs: "", @@ -324,7 +310,7 @@ var UserAdministrationComponent = /** @class */ (function (_super) { this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/signatures/" + id, { "label": label }) .subscribe(function (data) { _this.user.signatures[selectedSignature].signature_label = data.signature.signature_label; - _this.notify.success(_this.lang.signUpdated + ' « ' + data.signature.signature_label + ' »'); + _this.notify.success(_this.lang.signUpdated); }, function (err) { _this.notify.error(err.error.errors); }); @@ -336,7 +322,7 @@ var UserAdministrationComponent = /** @class */ (function (_super) { this.http.delete(this.coreUrl + "rest/users/" + this.serialId + "/signatures/" + signature.id) .subscribe(function (data) { _this.user.signatures = data.signatures; - _this.notify.success(_this.lang.signDeleted + ' « ' + signature.signature_label + ' »'); + _this.notify.success(_this.lang.signDeleted); }, function (err) { _this.notify.error(err.error.errors); }); @@ -405,24 +391,6 @@ var UserAdministrationComponent = /** @class */ (function (_super) { }); } }; - UserAdministrationComponent.prototype.test = function (event) { - var _this = this; - console.log(event.mouseEvent.dataTransfer); - if (event.mouseEvent.dataTransfer.files && event.mouseEvent.dataTransfer.files[0]) { - var reader = new FileReader(); - this.signatureModel.name = event.mouseEvent.dataTransfer.files[0].name; - this.signatureModel.size = event.mouseEvent.dataTransfer.files[0].size; - this.signatureModel.type = event.mouseEvent.dataTransfer.files[0].type; - if (this.signatureModel.label == "") { - this.signatureModel.label = this.signatureModel.name; - } - reader.readAsDataURL(event.mouseEvent.dataTransfer.files[0]); - reader.onload = function (value) { - window['angularUserAdministrationComponent'].componentAfterUpload(value.target.result); - _this.submitSignature(); - }; - } - }; __decorate([ core_1.ViewChild(material_1.MatPaginator), __metadata("design:type", material_1.MatPaginator) diff --git a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts index 4957beda02a69a592ed466fcee5ad60203317718..b627c43ad58558085c15360037c1fe644f0b38c8 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/user-administration.component.ts @@ -72,19 +72,7 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.mobileQuery.removeListener(this._mobileQueryListener); } - updateBreadcrumb(applicationName: string) { - var breadCrumb = "<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/users\"' style='cursor: pointer'>" + this.lang.users + "</a> > "; - - if (this.creationMode == true) { - breadCrumb += this.lang.userCreation; - } else { - breadCrumb += this.lang.userModification; - } - $j('#ariane')[0].innerHTML = breadCrumb; - } - ngOnInit(): void { - //$j('#header').remove(); this.coreUrl = angularGlobals.coreUrl; this.loading = true; @@ -93,7 +81,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O if (typeof params['id'] == "undefined") { this.creationMode = true; this.loading = false; - this.updateBreadcrumb(angularGlobals.applicationName); } else { this.creationMode = false; this.serialId = params['id']; @@ -102,7 +89,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.user = data; this.data = data.history; this.userId = data.user_id; - this.updateBreadcrumb(angularGlobals.applicationName); this.minDate = new Date(this.CurrentYear + '-' + this.currentMonth + '-01'); this.loading = false; setTimeout(() => { @@ -120,7 +106,7 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O toogleRedirect(basket: any) { $j('#redirectUser_' + basket.group_id + '_' + basket.basket_id).toggle(); - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe((data: any) => { //this.userList = data['users']; @@ -149,7 +135,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O .on('select_node.jstree', (e: any, data: any) => { this.addEntity(data.node.id); }).on('deselect_node.jstree', (e: any, data: any) => { - //console.log(data.node.id); this.deleteEntity(data.node.id); }) // create the instance @@ -220,7 +205,7 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O if (r) { this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/password", {}) .subscribe((data: any) => { - this.notify.success(this.lang.pswReseted + ' ' + this.lang.for + ' « ' + user.user_id + ' »'); + this.notify.success(this.lang.pswReseted); }, (err) => { this.notify.error(err.error.errors); }); @@ -300,7 +285,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O } deleteEntity(entityId: any) { - this.http.delete(this.coreUrl + "rest/users/" + this.serialId + "/entities/" + entityId) .subscribe((data: any) => { this.user.entities = data.entities; @@ -309,14 +293,13 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O }, (err) => { this.notify.error(err.error.errors); }); - } submitSignature() { this.http.post(this.coreUrl + "rest/users/" + this.serialId + "/signatures", this.signatureModel) .subscribe((data: any) => { this.user.signatures = data.signatures; - this.notify.success(this.lang.signAdded + ' « ' + this.signatureModel.name + ' »'); + this.notify.success(this.lang.signAdded); this.signatureModel = { base64: "", base64ForJs: "", @@ -337,7 +320,7 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.http.put(this.coreUrl + "rest/users/" + this.serialId + "/signatures/" + id, { "label": label }) .subscribe((data: any) => { this.user.signatures[selectedSignature].signature_label = data.signature.signature_label; - this.notify.success(this.lang.signUpdated + ' « ' + data.signature.signature_label + ' »'); + this.notify.success(this.lang.signUpdated); }, (err) => { this.notify.error(err.error.errors); }); @@ -350,7 +333,7 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O this.http.delete(this.coreUrl + "rest/users/" + this.serialId + "/signatures/" + signature.id) .subscribe((data: any) => { this.user.signatures = data.signatures; - this.notify.success(this.lang.signDeleted + ' « ' + signature.signature_label + ' »'); + this.notify.success(this.lang.signDeleted); }, (err) => { this.notify.error(err.error.errors); }); @@ -421,27 +404,6 @@ export class UserAdministrationComponent extends AutoCompletePlugin implements O }); } } - - test(event:any) { - console.log(event.mouseEvent.dataTransfer); - if (event.mouseEvent.dataTransfer.files && event.mouseEvent.dataTransfer.files[0]) { - var reader = new FileReader(); - - this.signatureModel.name = event.mouseEvent.dataTransfer.files[0].name; - this.signatureModel.size = event.mouseEvent.dataTransfer.files[0].size; - this.signatureModel.type = event.mouseEvent.dataTransfer.files[0].type; - if (this.signatureModel.label == "") { - this.signatureModel.label = this.signatureModel.name; - } - - reader.readAsDataURL(event.mouseEvent.dataTransfer.files[0]); - - reader.onload = (value: any) => { - window['angularUserAdministrationComponent'].componentAfterUpload(value.target.result); - this.submitSignature(); - }; - } - } } export interface History { event_date: Date; diff --git a/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.js index f647ae50222fe5fe24210ec23721af218859236e..b8e687bdc9f5e2a06ac56af2cd141be6c0192cfe 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.js @@ -60,17 +60,11 @@ var UsersAdministrationComponent = /** @class */ (function (_super) { UsersAdministrationComponent.prototype.ngOnDestroy = function () { this.mobileQuery.removeListener(this._mobileQueryListener); }; - UsersAdministrationComponent.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> > " + this.lang.users; - } - }; UsersAdministrationComponent.prototype.ngOnInit = function () { var _this = this; - this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; this.loading = true; - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe(function (data) { _this.users = data['users']; _this.data = _this.users; diff --git a/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.ts index 28d4aa860c5a77ac42dffc83b05fd2cdfb2d14b0..2d79fd47fae33acd42773278174a2cb2749de2a1 100755 --- a/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/users-administration.component.ts @@ -1,10 +1,9 @@ -import { ChangeDetectorRef, Component, OnInit, ViewChild, Inject, TemplateRef } from '@angular/core'; +import { ChangeDetectorRef, Component, OnInit, ViewChild, Inject } from '@angular/core'; import { MediaMatcher } from '@angular/cdk/layout'; -import { DOCUMENT } from '@angular/common'; import { HttpClient } from '@angular/common/http'; import { LANG } from '../translate.component'; import { NotificationService } from '../notification.service'; -import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { MatPaginator, MatTableDataSource, MatSort, MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { AutoCompletePlugin } from '../../plugins/autocomplete.plugin'; @@ -59,19 +58,12 @@ export class UsersAdministrationComponent extends AutoCompletePlugin implements this.mobileQuery.removeListener(this._mobileQueryListener); } - 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> > " + this.lang.users; - } - } - ngOnInit(): void { - this.updateBreadcrumb(angularGlobals.applicationName); this.coreUrl = angularGlobals.coreUrl; this.loading = true; - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe((data: any) => { this.users = data['users']; this.data = this.users; diff --git a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts index 36ac798b27818fcfab959fac2788c51f54f6b29d..099a1b9337594f0efd72e5b100cdce32adf2ae29 100755 --- a/apps/maarch_entreprise/js/angular/lang/lang-fr.ts +++ b/apps/maarch_entreprise/js/angular/lang/lang-fr.ts @@ -254,77 +254,77 @@ export const LANG_FR = { "systemParameters" : "paramètres système", "tags" : "Mots clés", "templates" : "Modèles de documents", - "thesaurus" : "Thésaurus", - "to" : "vers", - "toDefault" : "par défaut", - "toEntities" : "Vers les services", - "tools" : "Outils", - "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", - "toStatuses" : "Vers les statuts", - "toStatusesDesc" : "Vous ne pouvez pas choisir de statut, un statut est dèja pré-définit pour cette action.", - "totalErrors" : "Élément(s) en erreur", - "totalProcessed" : "Élément(s) analysé(s)", - "toUsersEntities" : "Vers les utilisateurs des services", - "type" : "Type", - "unlinkGroup" : "Dissocier le groupe", - "unselectAll" : "Tout désélectionner", - "update" : "Modifier", - "updateStatus" : "Changement de statut de courrier", - "updateStatusInformationsChrono" : "En saisissant le NUMÉRO CHRONO du document, vous modifierez le statut du courrier. Le courrier sera disponible dans la bannette des utilisateurs auquel il était affecté suivant le statut que vous aurez défini.", - "updateStatusInformationsGed" : "En saisissant l'IDENTIFIANT GED du document, vous modifierez le statut du courrier. Le courrier sera disponible dans la bannette des utilisateurs auquel il était affecté suivant le statut que vous aurez défini.", - "uploadSignFile" : "Déposer une signature", - "uploadSignFileInfo" : "Cliquer pour ajouter une signature depuis votre poste", - "usedInActionPage" : "Action sur la page d'action", - "usedInBasketlist" : "Action sur la liste de résultat", - "user" : "utilisateur", - "userAdded" : "Utilisateur ajouté", - "userAuthorized" : "Utilisateur autorisé", - "userCreation" : "Création d'un utilisateur", - "userDeleted" : "Utilisateur supprimé", - "userModification" : "Modification de l'utilisateur", - "users" : "Utilisateur(s)", - "userSuspended" : "Utilisateur suspendu", - "userUpdated" : "Utilisateur modifié", - "validate" : "Valider", - "validateAction" : "Action(s) de qualification", - "value" : "valeur", - "view" : "Consulter", - "visa" : "Circuit de visa", - "whereClauseAction" : "Condition d'apparition de l'action (where clause)", - "workingDays" : "jour(s) ouvré(s)", - "yes" : "Oui", - "zipcode" : "Code postal", - "doctypesAdmin" : "Typologies documentaire", - "firstLevelDoctype" : "Chemise", - "secondLevelDoctype" : "Sous-chemise", - "doctype" : "Type de document", - "folderTypeList" : "Liste des types de dossier", - "firstLevelAttached" : "Rattacher à la chemise", - "secondLevelAttached" : "Rattacher à la sous-chemise", - "retentionFinalDisposition" : "Sort final", - "retentionRule" : "Règle de conservation", - "durationCurrentUse" : "Durée d'utilité courante", - "processDelayDay" : "Délai de traitement (en jours)", - "delay1" : "Délai relance 1 avant terme (en jours)", - "delay2" : "Délai relance 2 après terme (en jours)", - "processMode" : "Mode de traitement", - "loadedFile" : "Fichier importé", - "generatedFile" : "Fichier généré", - "destruction" : "Destruction", - "conservation" : "Conservation", - "firstLevelAdded" : "Chemise créée", + "thesaurus" : "Thésaurus", + "to" : "vers", + "toDefault" : "par défaut", + "toEntities" : "Vers les services", + "tools" : "Outils", + "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", + "toStatuses" : "Vers les statuts", + "toStatusesDesc" : "Vous ne pouvez pas choisir de statut, un statut est dèja pré-définit pour cette action.", + "totalErrors" : "Élément(s) en erreur", + "totalProcessed" : "Élément(s) analysé(s)", + "toUsersEntities" : "Vers les utilisateurs des services", + "type" : "Type", + "unlinkGroup" : "Dissocier le groupe", + "unselectAll" : "Tout désélectionner", + "update" : "Modifier", + "updateStatus" : "Changement de statut de courrier", + "updateStatusInformationsChrono" : "En saisissant le NUMÉRO CHRONO du document, vous modifierez le statut du courrier. Le courrier sera disponible dans la bannette des utilisateurs auquel il était affecté suivant le statut que vous aurez défini.", + "updateStatusInformationsGed" : "En saisissant l'IDENTIFIANT GED du document, vous modifierez le statut du courrier. Le courrier sera disponible dans la bannette des utilisateurs auquel il était affecté suivant le statut que vous aurez défini.", + "uploadSignFile" : "Déposer une signature", + "uploadSignFileInfo" : "Cliquer pour ajouter une signature depuis votre poste", + "usedInActionPage" : "Action sur la page d'action", + "usedInBasketlist" : "Action sur la liste de résultat", + "user" : "utilisateur", + "userAdded" : "Utilisateur ajouté", + "userAuthorized" : "Utilisateur autorisé", + "userCreation" : "Création d'un utilisateur", + "userDeleted" : "Utilisateur supprimé", + "userModification" : "Modification de l'utilisateur", + "users" : "Utilisateur(s)", + "userSuspended" : "Utilisateur suspendu", + "userUpdated" : "Utilisateur modifié", + "validate" : "Valider", + "validateAction" : "Action(s) de qualification", + "value" : "valeur", + "view" : "Consulter", + "visa" : "Circuit de visa", + "whereClauseAction" : "Condition d'apparition de l'action (where clause)", + "workingDays" : "jour(s) ouvré(s)", + "yes" : "Oui", + "zipcode" : "Code postal", + "doctypesAdmin" : "Typologies documentaire", + "firstLevelDoctype" : "Chemise", + "secondLevelDoctype" : "Sous-chemise", + "doctype" : "Type de document", + "folderTypeList" : "Liste des types de dossier", + "firstLevelAttached" : "Rattacher à la chemise", + "secondLevelAttached" : "Rattacher à la sous-chemise", + "retentionFinalDisposition" : "Sort final", + "retentionRule" : "Règle de conservation", + "durationCurrentUse" : "Durée d'utilité courante", + "processDelayDay" : "Délai de traitement (en jours)", + "delay1" : "Délai relance 1 avant terme (en jours)", + "delay2" : "Délai relance 2 après terme (en jours)", + "processMode" : "Mode de traitement", + "loadedFile" : "Fichier importé", + "generatedFile" : "Fichier généré", + "destruction" : "Destruction", + "conservation" : "Conservation", + "firstLevelAdded" : "Chemise créée", "firstLevelUpdated" : "Chemise mise à jour", "firstLevelDeleted" : "Chemise supprimée", - "secondLevelAdded" : "Sous-chemise créée", - "secondLevelUpdated" : "Sous-chemise mise à jour", - "secondLevelDeleted" : "Sous-chemise supprimée", - "chooseModel" : "Choisissez un modèle", + "secondLevelAdded" : "Sous-chemise créée", + "secondLevelUpdated" : "Sous-chemise mise à jour", + "secondLevelDeleted" : "Sous-chemise supprimée", + "chooseModel" : "Choisissez un modèle", "documentTypeAdded" : "Type de document ajouté", - "documentTypeUpdated" : "Type de document mis à jour", - "documentTypeDeleted" : "Type de document supprimé", - "documentTypeReplacement" : "Remplacement du type de document", + "documentTypeUpdated" : "Type de document mis à jour", + "documentTypeDeleted" : "Type de document supprimé", + "documentTypeReplacement" : "Remplacement du type de document", "transferToDoctype" : "Remplacer par le type de document", }; \ No newline at end of file diff --git a/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.js b/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.js index e812c29cafcdbfd3380a57798952c25fa1112a62..4d05cb5d18cb6f98aa1c46e51b160f8f378e1f4a 100644 --- a/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.js +++ b/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.js @@ -13,7 +13,7 @@ var AutoCompletePlugin = /** @class */ (function () { this.coreUrl = angularGlobals.coreUrl; if (target.indexOf('users') != -1) { this.userCtrl = new forms_1.FormControl(); - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe(function (data) { data.users.forEach(function (user) { if (user.enabled == "Y") { @@ -45,7 +45,7 @@ var AutoCompletePlugin = /** @class */ (function () { if (target.indexOf('usersAndEntities') != -1) { this.elementCtrl = new forms_1.FormControl(); this.elemList = []; - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe(function (data) { data.users.forEach(function (user) { if (user.enabled == "Y") { diff --git a/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.ts b/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.ts index 8f4f1c61be986c5007f7544ab692389c1704c651..319348ee24ff8a59942106fea465115d2a5447f8 100644 --- a/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.ts +++ b/apps/maarch_entreprise/js/angular/plugins/autocomplete.plugin.ts @@ -24,7 +24,7 @@ export class AutoCompletePlugin { if (target.indexOf('users') != -1) { this.userCtrl = new FormControl(); - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe((data: any) => { data.users.forEach((user: any) => { if (user.enabled == "Y") { @@ -64,7 +64,7 @@ export class AutoCompletePlugin { this.elementCtrl = new FormControl(); this.elemList = []; - this.http.get(this.coreUrl + 'rest/administration/users') + this.http.get(this.coreUrl + 'rest/users') .subscribe((data: any) => { data.users.forEach((user: any) => { if (user.enabled == "Y") { diff --git a/core/Test/UserControllerTest.php b/core/Test/UserControllerTest.php index 40ce32cd50ba7b1f7458364247ec3af59de4f825..e49587951a6fca5ea2a569339628f4d587774a6a 100755 --- a/core/Test/UserControllerTest.php +++ b/core/Test/UserControllerTest.php @@ -76,7 +76,7 @@ class UserControllerTest extends TestCase $response = $userController->update($fullRequest, new \Slim\Http\Response(), ['id' => self::$id]); $responseBody = json_decode((string)$response->getBody()); - $this->assertSame(_USER_UPDATED, $responseBody->success); + $this->assertSame('success', $responseBody->success); // READ $environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']); diff --git a/rest/index.php b/rest/index.php index 52712f15ac2a802139700264e2e058964e3984c0..a7d8bd3ba0b0a7555b021ca60b0cbd6fdd701171 100755 --- a/rest/index.php +++ b/rest/index.php @@ -112,8 +112,6 @@ $app->post('/initialize', \SrcCore\controllers\CoreController::class . ':initial //Administration $app->get('/administration', \SrcCore\controllers\CoreController::class . ':getAdministration'); -$app->get('/administration/users', \User\controllers\UserController::class . ':getUsersForAdministration'); -$app->get('/administration/users/{id}', \User\controllers\UserController::class . ':getUserForAdministration'); //AutoComplete $app->get('/autocomplete/users', \SrcCore\controllers\AutoCompleteController::class . ':getUsers'); @@ -179,6 +177,7 @@ $app->get('/res/{resId}/lock', \Resource\controllers\ResController::class . ':is $app->get('/res/{resId}/notes/count', \Resource\controllers\ResController::class . ':getNotesCountForCurrentUserById'); //Users +$app->get('/users', \User\controllers\UserController::class . ':get'); $app->post('/users', \User\controllers\UserController::class . ':create'); $app->get('/users/{id}/details', \User\controllers\UserController::class . ':getDetailledById'); $app->put('/users/{id}', \User\controllers\UserController::class . ':update'); diff --git a/src/app/user/controllers/UserController.php b/src/app/user/controllers/UserController.php index 8db516f60264889c0e583e390c3617bfcc7ec7c8..eb99d0b60852b114480d821a185b9ca026e547be 100644 --- a/src/app/user/controllers/UserController.php +++ b/src/app/user/controllers/UserController.php @@ -32,6 +32,69 @@ use User\models\UserModel; class UserController { + public function get(Request $request, Response $response) + { + if (!ServiceModel::hasService(['id' => 'admin_users', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { + return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); + } + + if ($GLOBALS['userId'] == 'superadmin') { + $users = UserModel::get([ + 'select' => ['id', 'user_id', 'firstname', 'lastname', 'status', 'enabled', 'mail'], + 'where' => ['user_id != ?', 'status != ?'], + 'data' => ['superadmin', 'DEL'] + ]); + } else { + $entities = EntityModel::getAllEntitiesByUserId(['userId' => $GLOBALS['userId']]); + $users = UserModel::getByEntities([ + 'select' => ['DISTINCT users.id', 'users.user_id', 'firstname', 'lastname', 'status', 'enabled', 'mail'], + 'entities' => $entities + ]); + } + + $usersIds = []; + foreach ($users as $value) { + $usersIds[] = $value['user_id']; + } + + $listModels = ListTemplateModel::get(['select' => ['item_id'], 'where' => ['item_id in (?)', 'object_type = ?', 'item_mode = ?'], 'data' => [$usersIds, 'entity_id', 'dest']]); + + $usersListModels = []; + foreach ($listModels as $value) { + $usersListModels[] = $value['item_id']; + } + + foreach ($users as $key => $value) { + if (in_array($value['user_id'], $usersListModels)) { + $users[$key]['inDiffListDest'] = 'Y'; + } else { + $users[$key]['inDiffListDest'] = 'N'; + } + } + + return $response->withJson(['users' => $users]); + } + + public function getDetailledById(Request $request, Response $response, array $aArgs) + { + $error = $this->hasUsersRights(['id' => $aArgs['id']]); + if (!empty($error['error'])) { + return $response->withStatus($error['status'])->withJson(['errors' => $error['error']]); + } + + $user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['id', 'user_id', 'firstname', 'lastname', 'status', 'enabled', 'phone', 'mail', 'initials', 'thumbprint']]); + $user['signatures'] = UserModel::getSignaturesById(['id' => $aArgs['id']]); + $user['emailSignatures'] = UserModel::getEmailSignaturesById(['userId' => $user['user_id']]); + $user['groups'] = UserModel::getGroupsByUserId(['userId' => $user['user_id']]); + $user['allGroups'] = GroupModel::getAvailableGroupsByUserId(['userId' => $user['user_id']]); + $user['entities'] = UserModel::getEntitiesById(['userId' => $user['user_id']]); + $user['allEntities'] = EntityModel::getAvailableEntitiesForAdministratorByUserId(['userId' => $user['user_id'], 'administratorUserId' => $GLOBALS['userId']]); + $user['baskets'] = BasketModel::getBasketsByUserId(['userId' => $user['user_id']]); + $user['history'] = HistoryModel::getByUserId(['userId' => $user['user_id']]); + + return $response->withJson($user); + } + public function create(Request $request, Response $response) { if (!ServiceModel::hasService(['id' => 'admin_users', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { @@ -61,10 +124,7 @@ class UserController return $response->withStatus(500)->withJson(['errors' => 'User Creation Error']); } - return $response->withJson([ - 'success' => _USER_ADDED, - 'user' => $newUser - ]); + return $response->withJson(['user' => $newUser]); } public function update(Request $request, Response $response, array $aArgs) @@ -87,7 +147,7 @@ class UserController UserModel::update(['id' => $aArgs['id'], 'user' => $data]); - return $response->withJson(['success' => _USER_UPDATED]); + return $response->withJson(['success' => 'success']); } public function delete(Request $request, Response $response, array $aArgs) @@ -149,7 +209,7 @@ class UserController UserModel::update(['id' => $user['id'], 'user' => $data]); - return $response->withJson(['success' => _UPDATED_PROFILE]); + return $response->withJson(['success' => 'success']); } public function resetPassword(Request $request, Response $response, array $aArgs) @@ -161,7 +221,7 @@ class UserController UserModel::resetPassword(['id' => $aArgs['id']]); - return $response->withJson(['success' => _RESET_PASSWORD]); + return $response->withJson(['success' => 'success']); } public function updateCurrentUserPassword(Request $request, Response $response) @@ -169,7 +229,7 @@ class UserController $data = $request->getParams(); if (!$this->checkNeededParameters(['data' => $data, 'needed' => ['currentPassword', 'newPassword', 'reNewPassword']])) { - return $response->withStatus(400)->withJson(['errors' => _EMPTY_PSW_FORM]); + return $response->withStatus(400)->withJson(['errors' => 'Bas request']); } if ($data['newPassword'] != $data['reNewPassword']) { @@ -181,7 +241,7 @@ class UserController $user = UserModel::getByUserId(['userId' => $GLOBALS['userId'], 'select' => ['id']]); UserModel::updatePassword(['id' => $user['id'], 'password' => $data['newPassword']]); - return $response->withJson(['success' => _UPDATED_PASSWORD]); + return $response->withJson(['success' => 'success']); } public function setRedirectedBaskets(Request $request, Response $response, array $aArgs) @@ -347,7 +407,6 @@ class UserController ]); return $response->withJson([ - 'success' => _NEW_SIGNATURE, 'signatures' => UserModel::getSignaturesById(['id' => $aArgs['id']]) ]); } @@ -372,7 +431,6 @@ class UserController ]); return $response->withJson([ - 'success' => _UPDATED_SIGNATURE, 'signature' => UserModel::getSignatureWithSignatureIdById(['id' => $aArgs['id'], 'signatureId' => $aArgs['signatureId']]) ]); } @@ -387,7 +445,6 @@ class UserController UserModel::deleteSignature(['signatureId' => $aArgs['signatureId'], 'userSerialId' => $aArgs['id']]); return $response->withJson([ - 'success' => _DELETED_SIGNATURE, 'signatures' => UserModel::getSignaturesById(['id' => $aArgs['id']]) ]); } @@ -411,7 +468,6 @@ class UserController } return $response->withJson([ - 'success' => _NEW_EMAIL_SIGNATURE, 'emailSignatures' => UserModel::getEmailSignaturesById(['userId' => $GLOBALS['userId']]) ]); } @@ -436,7 +492,6 @@ class UserController } return $response->withJson([ - 'success' => _UPDATED_EMAIL_SIGNATURE, 'emailSignature' => UserModel::getEmailSignatureWithSignatureIdById(['userId' => $GLOBALS['userId'], 'signatureId' => $aArgs['id']]) ]); } @@ -453,74 +508,10 @@ class UserController } return $response->withJson([ - 'success' => _DELETED_EMAIL_SIGNATURE, 'emailSignatures' => UserModel::getEmailSignaturesById(['userId' => $GLOBALS['userId']]) ]); } - public function getUsersForAdministration(Request $request, Response $response) - { - if (!ServiceModel::hasService(['id' => 'admin_users', 'userId' => $GLOBALS['userId'], 'location' => 'apps', 'type' => 'admin'])) { - return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); - } - - if ($GLOBALS['userId'] == 'superadmin') { - $users = UserModel::get([ - 'select' => ['id', 'user_id', 'firstname', 'lastname', 'status', 'enabled', 'mail'], - 'where' => ['user_id != ?', 'status != ?'], - 'data' => ['superadmin', 'DEL'] - ]); - } else { - $entities = EntityModel::getAllEntitiesByUserId(['userId' => $GLOBALS['userId']]); - $users = UserModel::getByEntities([ - 'select' => ['DISTINCT users.id', 'users.user_id', 'firstname', 'lastname', 'status', 'enabled', 'mail'], - 'entities' => $entities - ]); - } - - $usersIds = []; - foreach ($users as $value) { - $usersIds[] = $value['user_id']; - } - - $listModels = ListTemplateModel::get(['select' => ['item_id'], 'where' => ['item_id in (?)', 'object_type = ?', 'item_mode = ?'], 'data' => [$usersIds, 'entity_id', 'dest']]); - - $usersListModels = []; - foreach ($listModels as $value) { - $usersListModels[] = $value['item_id']; - } - - foreach ($users as $key => $value) { - if (in_array($value['user_id'], $usersListModels)) { - $users[$key]['inDiffListDest'] = 'Y'; - } else { - $users[$key]['inDiffListDest'] = 'N'; - } - } - - return $response->withJson(['users' => $users]); - } - - public function getDetailledById(Request $request, Response $response, array $aArgs) - { - $error = $this->hasUsersRights(['id' => $aArgs['id']]); - if (!empty($error['error'])) { - return $response->withStatus($error['status'])->withJson(['errors' => $error['error']]); - } - - $user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['id', 'user_id', 'firstname', 'lastname', 'status', 'enabled', 'phone', 'mail', 'initials', 'thumbprint']]); - $user['signatures'] = UserModel::getSignaturesById(['id' => $aArgs['id']]); - $user['emailSignatures'] = UserModel::getEmailSignaturesById(['userId' => $user['user_id']]); - $user['groups'] = UserModel::getGroupsByUserId(['userId' => $user['user_id']]); - $user['allGroups'] = GroupModel::getAvailableGroupsByUserId(['userId' => $user['user_id']]); - $user['entities'] = UserModel::getEntitiesById(['userId' => $user['user_id']]); - $user['allEntities'] = EntityModel::getAvailableEntitiesForAdministratorByUserId(['userId' => $user['user_id'], 'administratorUserId' => $GLOBALS['userId']]); - $user['baskets'] = BasketModel::getBasketsByUserId(['userId' => $user['user_id']]); - $user['history'] = HistoryModel::getByUserId(['userId' => $user['user_id']]); - - return $response->withJson($user); - } - public function addGroup(Request $request, Response $response, array $aArgs) { $error = $this->hasUsersRights(['id' => $aArgs['id']]); @@ -685,7 +676,7 @@ class UserController 'eventId' => 'userModification', ]); - return $response->withJson(['success' => _UPDATED_ENTITY]); + return $response->withJson(['success' => 'success']); } public function updatePrimaryEntity(Request $request, Response $response, array $aArgs) @@ -701,7 +692,7 @@ class UserController $user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['user_id']]); UserModel::updatePrimaryEntity(['id' => $aArgs['id'], 'entityId' => $aArgs['entityId']]); - return $response->withJson(['success' => _UPDATED_ENTITY, 'entities' => UserModel::getEntitiesById(['userId' => $user['user_id']])]); + return $response->withJson(['entities' => UserModel::getEntitiesById(['userId' => $user['user_id']])]); } public function deleteEntity(Request $request, Response $response, array $aArgs)