diff --git a/apps/maarch_entreprise/js/angular/app/administration/groups-administration.component.js b/apps/maarch_entreprise/js/angular/app/administration/groups-administration.component.js index 8a4888360825640f385949813b0a65cb0178860f..766bf7b17aae71c2a8bddbf1cf2676948a9531d4 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/groups-administration.component.js +++ b/apps/maarch_entreprise/js/angular/app/administration/groups-administration.component.js @@ -56,7 +56,6 @@ var GroupsAdministrationComponent = (function () { }); } } - console.log(this.groupsForAssign); }; GroupsAdministrationComponent.prototype.reassignUsers = function (group, groupId) { var _this = this; 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 1981f8b61c73144437bb4a378bebfac809d008f6..368072511f184667a4700ace9cc5354f75f3881c 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 @@ -5,8 +5,6 @@ import { ActivatedRoute, Router } from '@angular/router'; import { NotificationService } from '../notification.service'; declare function $j(selector: any) : any; -declare function successNotification(message: string) : void; -declare function errorNotification(message: string) : void; declare var angularGlobals : any; @@ -18,127 +16,104 @@ declare var angularGlobals : any; export class NotificationAdministrationComponent implements OnInit { coreUrl : string; - notificationId : string; - creationMode : boolean; - notification : any = { - diffusionType_label : null - }; - loading : boolean = false; - lang : any = LANG; + + creationMode : boolean; + notification : any = { + diffusionType_label : null + }; + loading : boolean = false; + lang : any = LANG; constructor(public http: HttpClient, private route: ActivatedRoute, private router: Router, private notify: NotificationService) { } + 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'>Administration</a> > <a onclick='location.hash = \"/administration/notifications\"' style='cursor: pointer'>notifications</a>"; + } + } + ngOnInit(): void { - this.prepareNotifications(); + this.updateBreadcrumb(angularGlobals.applicationName); this.loading = true; this.coreUrl = angularGlobals.coreUrl; - this.updateBreadcrumb(angularGlobals.applicationName); + this.route.params.subscribe(params => { - console.log(params['identifier']); - if(typeof params['identifier']== "undefined"){ - //if(params['identifier']== "new"){ + if (typeof params['identifier'] == "undefined") { this.creationMode = true; this.http.get(this.coreUrl + 'rest/administration/notifications/new') .subscribe((data : any) => { this.notification = data.notification; this.loading = false; - // setTimeout(() => { - // $j("select").chosen({width:"100%",disable_search_threshold: 10, search_contains: true}); - // }, 0); }, (err) => { - errorNotification(JSON.parse(err._body).errors); + this.notify.error(err.error.errors); }); - }else { + } else { this.creationMode = false; this.http.get(this.coreUrl + 'rest/administration/notifications/' + params['identifier']) - .subscribe((data : any) => { + .subscribe((data : any) => { - this.notification = data.notification; - console.log(data.notification); - this.loading = false; - setTimeout(() => { - $j("select").chosen({width:"100%",disable_search_threshold: 10, search_contains: true}); - }, 0); - }); - + this.notification = data.notification; + this.loading = false; + }, (err) => { + this.notify.error(err.error.errors); + }); } }); } - selectAll(event:any){ + selectAll(event: any) { var target = event.target.getAttribute("data-target"); $j('#' + target + ' option').prop('selected', true); $j('#' + target).trigger('chosen:updated'); - } - unselectAll(event:any){ + unselectAll(event: any) { var target = event.target.getAttribute("data-target"); $j('#' + target + ' option').prop('selected', false); $j('#' + target).trigger('chosen:updated'); } onSubmit() { - //affect value of select - if($j("#groupslist").chosen().val()){ - this.notification.diffusion_properties = $j("#groupslist").chosen().val(); - }else if($j("#entitieslist").chosen().val()){ - this.notification.diffusion_properties = $j("#entitieslist").chosen().val(); - }else if($j("#statuseslist").chosen().val()){ - this.notification.diffusion_properties = $j("#statuseslist").chosen().val(); - }else if($j("#userslist").chosen().val()){ - this.notification.diffusion_properties = $j("#userslist").chosen().val(); + if ($j("#groupslist").val()) { + this.notification.diffusion_properties = $j("#groupslist").val(); + } else if($j("#entitieslist").val()) { + this.notification.diffusion_properties = $j("#entitieslist").val(); + } else if($j("#statuseslist").val()) { + this.notification.diffusion_properties = $j("#statuseslist").val(); + } else if($j("#userslist").val()) { + this.notification.diffusion_properties = $j("#userslist").val(); } - console.log($j("#groupslistJd").chosen().val()); - console.log($j("#entitieslistJd").chosen().val()); - console.log($j("#statuseslistJd").chosen().val()); - console.log($j("#userslistJd").chosen().val()); - console.log($j("#joinDocJd").chosen().val()); - if($j("#joinDocJd").chosen().val() == null){ + if ($j("#joinDocJd").val() == null) { this.notification.attachfor_properties = ''; - }else if($j("#groupslistJd").chosen().val()){ - this.notification.attachfor_properties = $j("#groupslistJd").chosen().val(); - }else if($j("#entitieslistJd").chosen().val()){ - console.log($j("#entitieslistJd").chosen().val()); - this.notification.attachfor_properties = $j("#entitieslistJd").chosen().val(); - }else if($j("#statuseslistJd").chosen().val()){ - this.notification.attachfor_properties = $j("#statuseslistJd").chosen().val(); - }else if($j("#userslistJd").chosen().val()){ - this.notification.attachfor_properties = $j("#userslistJd").chosen().val(); + } else if ($j("#groupslistJd").val()) { + this.notification.attachfor_properties = $j("#groupslistJd").val(); + } else if($j("#entitieslistJd").val()) { + this.notification.attachfor_properties = $j("#entitieslistJd").val(); + } else if($j("#statuseslistJd").val()) { + this.notification.attachfor_properties = $j("#statuseslistJd").val(); + } else if($j("#userslistJd").val()) { + this.notification.attachfor_properties = $j("#userslistJd").val(); } + if (this.creationMode) { - console.log(this.notification); this.http.post(this.coreUrl + 'rest/notifications', this.notification) - .subscribe((data : any) => { - this.router.navigate(['/administration/notifications']); - this.notify.success(this.lang.newNotificationAdded+' « '+this.notification.notification_id+' »'); - },(err) => { - this.notify.error(err.error.errors); - }); - }else{ + .subscribe((data : any) => { + this.router.navigate(['/administration/notifications']); + this.notify.success(this.lang.newNotificationAdded+' « '+this.notification.notification_id+' »'); + },(err) => { + this.notify.error(err.error.errors); + }); + } else { this.http.put(this.coreUrl + 'rest/notifications/' + this.notification.notification_sid, this.notification) - .subscribe((data : any) => { - this.router.navigate(['/administration/notifications']); - this.notify.success(this.lang.notificationUpdated+' « '+this.notification.notification_id+' »'); - },(err) => { - this.notify.error(err.error.errors); - }); - } - } - - - prepareNotifications() { - $j('#inner_content').remove(); - } - - 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'>Administration</a> > <a onclick='location.hash = \"/administration/notifications\"' style='cursor: pointer'>notifications</a>"; + .subscribe((data : any) => { + this.router.navigate(['/administration/notifications']); + this.notify.success(this.lang.notificationUpdated+' « '+this.notification.notification_id+' »'); + },(err) => { + this.notify.error(err.error.errors); + }); } } - - } diff --git a/apps/maarch_entreprise/js/angular/app/administration/notifications-administration.component.ts b/apps/maarch_entreprise/js/angular/app/administration/notifications-administration.component.ts index d9d10cfec8a5ed5e9257dbf2d53166d33cdf926b..23608487adb200577f5750a9b27f3fff221faa0e 100644 --- a/apps/maarch_entreprise/js/angular/app/administration/notifications-administration.component.ts +++ b/apps/maarch_entreprise/js/angular/app/administration/notifications-administration.component.ts @@ -4,8 +4,6 @@ import { LANG } from '../translate.component'; import { NotificationService } from '../notification.service'; declare function $j(selector: any) : any; -declare function successNotification(message: string) : void; -declare function errorNotification(message: string) : void; declare var angularGlobals : any; @@ -17,7 +15,8 @@ declare var angularGlobals : any; export class NotificationsAdministrationComponent implements OnInit { coreUrl : string; - notifications : any[] = []; + + notifications : any[] = []; loading : boolean = false; lang : any = LANG; @@ -26,42 +25,36 @@ export class NotificationsAdministrationComponent implements OnInit { } ngOnInit(): void { - this.coreUrl = angularGlobals.coreUrl; - - this.prepareNotifications(); + this.updateBreadcrumb(angularGlobals.applicationName); + this.coreUrl = angularGlobals.coreUrl; this.loading = true; this.http.get(this.coreUrl + 'rest/notifications') .subscribe((data : any) => { this.notifications = data.notifications; - this.updateBreadcrumb(angularGlobals.applicationName); this.loading = false; }, (err) => { - errorNotification(JSON.parse(err._body).errors); + this.notify.error(err.error.errors); }); } - prepareNotifications() { - $j('#inner_content').remove(); - } - - updateBreadcrumb(applicationName: string){ + updateBreadcrumb(applicationName: string) { $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.admin_notifications; } - deleteNotification(notification : any){ - var resp = confirm(this.lang.deleteMsg + " ?"); - if(resp){ - this.http.delete(this.coreUrl + 'rest/notifications/'+notification.notification_sid) + deleteNotification(notification : any) { + let r = confirm(this.lang.deleteMsg); + + if (r) { + this.http.delete(this.coreUrl + 'rest/notifications/' + notification.notification_sid) .subscribe((data : any) => { - this.notifications = data.notifications + this.notifications = data.notifications; this.notify.success(data.success); }, (err) => { this.notify.error(err.error.errors); }); } } - } diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.js b/apps/maarch_entreprise/js/angular/app/profile.component.js index a23a45903052710ca625be1ef6cffb1052a327ca..b68831156973044040cfee7760635cbab7283ad7 100755 --- a/apps/maarch_entreprise/js/angular/app/profile.component.js +++ b/apps/maarch_entreprise/js/angular/app/profile.component.js @@ -40,6 +40,7 @@ var ProfileComponent = (function () { title: "", }; this.userAbsenceModel = []; + this.basketsToRedirect = []; this.showPassword = false; this.selectedSignature = -1; this.selectedSignatureLabel = ""; diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.ts b/apps/maarch_entreprise/js/angular/app/profile.component.ts index a6240c5d9c5aff5e64f5157dd602268c979335da..c475cd84fc09e309266b2da85baaac49fbe5eb09 100755 --- a/apps/maarch_entreprise/js/angular/app/profile.component.ts +++ b/apps/maarch_entreprise/js/angular/app/profile.component.ts @@ -41,6 +41,7 @@ export class ProfileComponent implements OnInit { title : "", }; userAbsenceModel : any[] = []; + basketsToRedirect : string[] = []; showPassword : boolean = false; selectedSignature : number = -1; diff --git a/apps/maarch_entreprise/template/header.html b/apps/maarch_entreprise/template/header.html index c97bb7886cb6dec288f4646eb3fa812517650dad..d4d0caf879e5b89a5ad23a28390dfa096ba469bf 100755 --- a/apps/maarch_entreprise/template/header.html +++ b/apps/maarch_entreprise/template/header.html @@ -9,20 +9,28 @@ require_once 'core/Models/UserModel.php'; $userGroups=\Core\Models\UserModel::getGroupsByUserId(['userId'=> $_SESSION['user']['UserId']]); if(!empty($userGroups)){ - $strUserInfos.=" ("; - for($i=0;$i<count($userGroups);$i++){ - if($i==count($userGroups)-1){ - $strUserInfos.=$userGroups[$i]['group_desc']; - } else { - $strUserInfos.=$userGroups[$i]['group_desc'].", "; - } + if(count($userGroups)>=2){ + $strGroupList=" "; + for($i=0;$i<count($userGroups);$i++){ + if($i==count($userGroups)-1){ + $strGroupList.=$userGroups[$i]['group_desc']; + } else { + $strGroupList.=$userGroups[$i]['group_desc']."<br><br>"; + } + } + $strUserInfos .= ' <div id="header_usergroups" class="header_usergroups" title="'.$strGroupList.'" style="display:inline-block;">('.count($userGroups).' groupes)</div>'; + }else{ + $strUserInfos .= ' ('.$userGroups[0]['group_desc'].')'; } - $strUserInfos.=")"; } echo $strUserInfos; ?> </div> + <script>$j(".header_usergroups").tooltipster({ + delay : 0, + contentAsHTML:true + });</script> <div id="menu" onmouseover="ShowHideMenu('menunav','on');" onmouseout="ShowHideMenu('menunav','off');" class="off"> <p> <span style="background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfsAAAGECAYAAAAx/4nGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAACZVSURBVHja7J19jBxnfcd/szO7e3d7e76L7fhIJCKRFAxxpBZBghWpITSRihQlwKl5gTSx1Cq5VBGlNeBYon8ViVIlBakRBylSgSbgEBzLEFEqosqJiExK1EgNIYhSBIimdhzL73bu9uXpH/Gc5/Zm73Z35pl5Xj4fyUrsOLe7szPzeb6/55nfEyilBACcRudFvkdE7uAQA5hNgOwBEL2OewuHHsAcIg4BAKIv4LX3rPF3qQwAkOwBwDLRZ2UPAwIAkj0AuCt6EZHbh/z7DAQASPYA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btRxib8ahfTgHwGllIzXqhwIINkDIHzzk/7G5sTyv3/1/lul1e6Q9AeRvZ6RHakekD2AxeK3YvV+LP5kykf86VTY7AaQPQDYnPbjRWf04S/tHAFA9gAO3NStSPpxH/43ltrOSd+wYI7oAdkDOCr8b53/99tNf7NjtUhma005s7hE0gfw5SZFBz0ALVh1YR2yvDPfl++bky3TxjwjT7IHkj2AR2nfGunPzjSl0+2ymA/RA8keAHxJ+612R46eOmuF9A3bpQ7Zg5HQVAegWBFYIYN4MV8sU5r0IHqwG8r4AOVIwZryfjJB25D0AQDZA5iWAq0p7SeTPtIn1QOyBwCPpI/4AZA9AAyfDK0q8R86dsr3tE+qB2QPAG6n/Vj6J88tUuIHMBRW4wOYLf09trzZqfG6zM405aLmRKEr+JsTdVI9wHonKs/ZA1iDlV35dCf9b3/qT6UahcgeYA0o4wPYlfStEb8Hj+0hekD2AKBdNFat4FdKuSR9RA/IHgBI+qvebBDw2B5AWdcfc/YATmHVBZ21B//C/JxsmmpIFBa+1phkDyR7ACg97Vsh/bgHf3LHvWGlj+gB1odH7wDclb41UgorFVs23kH0QLIHACPlZF0r3lj6MczrAyB7ABg8jVonfoPa8ZLqwVoo4wP4J36rpDU707SlxA9g7oXPanwAr7HuBpDszJesAJDqAZA9ADgm/kPHTsnM5LjUq4XMRiJ7QPYAgPRdvk9yCMB2WKAHAGvJDfEDOAAL9ACAVAtAsgcAhO9t0mewAyR7APBS/AgQANkDANIn1QMgewBA+ogeoDCYsweAvOWoHPosAMgeAMAx8SN6cBLK+ACgW56BRe8VgGQPAJBBpMrQ9wWA7AEANIiVznwABUIZHwDKEj+pGoBkDwCkfQAg2QMAaR8AkD0AIP01XgcA2QMAOCp9RA/IHgDAMOkjeoAM/P8A6WAIZSGjEIoAAAAASUVORK5CYII=');background-position: 10px 0px;background-size:25%; diff --git a/core/Controllers/ResController.php b/core/Controllers/ResController.php index c40325dee5200b2799a15db79d1717e7bf786c88..009677baabd095b959e0a1bb5db428925f75b756 100755 --- a/core/Controllers/ResController.php +++ b/core/Controllers/ResController.php @@ -34,19 +34,22 @@ class ResController { public function create(RequestInterface $request, ResponseInterface $response, $aArgs) { - if(empty($aArgs)) { - - $aArgs = $request->getQueryParams(); - $aArgs['data'] = json_decode($aArgs['data']); + if (empty($aArgs)) { + $aArgs = $request->getParsedBody(); + } - $aArgs['data'] = $this->object2array($aArgs['data']); + // if(empty($aArgs)) { + // $aArgs = $request->getQueryParams(); + // $aArgs['data'] = json_decode($aArgs['data']); + // $aArgs['data'] = $this->object2array($aArgs['data']); + // //FIX pb if data has parent + // if (isset($aArgs['data']['data'])) { + // $aArgs['data'] = $aArgs['data']['data']; + // } + // } - //FIX pb if data has parent - if (isset($aArgs['data']['data'])) { - $aArgs['data'] = $aArgs['data']['data']; - } - } + $aArgs['data'] = $this->object2array($aArgs['data']); //***************************************************************************************** //LOG ONLY LOG FOR DEBUG @@ -641,13 +644,15 @@ class ResController if (strtoupper($data[$i]['column']) == strtoupper('custom_t10')) { $mail = array(); $theString = str_replace(">", "", $data[$i]['value']); + $mail = explode("<", $theString); $user = $userModel->getByEmail(['mail' => $mail[count($mail) -1]]); + $userIdFound = $user[0]['user_id']; if (!empty($userIdFound)) { $toAddressFound = true; $destUser = $userIdFound; - $entity = $entityModel->getByUserId(['user_id' => $destUser]); + $entity = $entityModel->getByUserId(['userId' => $destUser]); if (!empty($entity[0]['entity_id'])) { $userEntity = $entity[0]['entity_id']; $userPrimaryEntity = true; diff --git a/core/Controllers/ResExtController.php b/core/Controllers/ResExtController.php index 8bee0e0f90e9f05e8ab8ed50ed3a34e6378418cd..5159938eca57a274a154dbe877e4ba0fad4f7b1f 100755 --- a/core/Controllers/ResExtController.php +++ b/core/Controllers/ResExtController.php @@ -27,19 +27,25 @@ class ResExtController { public function create(RequestInterface $request, ResponseInterface $response, $aArgs) { - if(empty($aArgs)) { + if (empty($aArgs)) { + $aArgs = $request->getParsedBody(); + } + + $aArgs['data'] = $this->object2array($aArgs['data']); + + // if(empty($aArgs)) { - $aArgs = $request->getQueryParams(); + // $aArgs = $request->getQueryParams(); - $aArgs['data'] = json_decode($aArgs['data']); + // $aArgs['data'] = json_decode($aArgs['data']); - $aArgs['data'] = $this->object2array($aArgs['data']); + // $aArgs['data'] = $this->object2array($aArgs['data']); - //FIX pb if data has parent - if (isset($aArgs['data']['data'])) { - $aArgs['data'] = $aArgs['data']['data']; - } - } + // //FIX pb if data has parent + // if (isset($aArgs['data']['data'])) { + // $aArgs['data'] = $aArgs['data']['data']; + // } + // } //***************************************************************************************** //LOG ONLY LOG FOR DEBUG diff --git a/core/Controllers/UserController.php b/core/Controllers/UserController.php index 8ff46c8411d7582f1f8429eba172178c6bfabf0d..25b7f95536205a4a259f3c19cfea10046419e76c 100755 --- a/core/Controllers/UserController.php +++ b/core/Controllers/UserController.php @@ -42,7 +42,8 @@ class UserController $user['groups'] = UserModel::getGroupsByUserId(['userId' => $_SESSION['user']['UserId']]); $user['entities'] = UserModel::getEntitiesById(['userId' => $_SESSION['user']['UserId']]); $user['baskets'] = BasketsModel::getBasketsByUserId(['userId' => $_SESSION['user']['UserId']]); - + $user['redirectedBaskets'] = BasketsModel::getBasketsRedirectedByUserId(['userId' => $_SESSION['user']['UserId']]); + return $response->withJson($user); } @@ -214,7 +215,7 @@ class UserController return $response->withJson(['success' => _UPDATED_PASSWORD]); } - public function setBasketsRedirectionForAbsence(RequestInterface $request, ResponseInterface $response, $aArgs) { + public function setRedirectedBaskets(RequestInterface $request, ResponseInterface $response, $aArgs) { $error = $this->hasUsersRights(['id' => $aArgs['id'], 'himself' => true]); if (!empty($error['error'])) { return $response->withStatus($error['status'])->withJson(['errors' => $error['error']]); @@ -254,6 +255,19 @@ class UserController ]); } + public function deleteRedirectedBaskets(RequestInterface $request, ResponseInterface $response, $aArgs) { + $error = $this->hasUsersRights(['id' => $aArgs['id'], 'himself' => true]); + if (!empty($error['error'])) { + return $response->withStatus($error['status'])->withJson(['errors' => $error['error']]); + } + + $user = UserModel::getById(['id' => $aArgs['id'], 'select' => ['user_id']]); + + BasketsModel::deleteBasketRedirection(['userId' => $user['user_id'], 'basketId' => $aArgs['basketId']]); + + return $response->withJson(['redirectedBaskets' => BasketsModel::getRedirectedBasketsByUserId(['userId' => $user['user_id']])]); + } + public function updateStatus(RequestInterface $request, ResponseInterface $response, $aArgs) { $error = $this->hasUsersRights(['id' => $aArgs['id'], 'himself' => true]); if (!empty($error['error'])) { diff --git a/core/Test/ResControllerTest.php b/core/Test/ResControllerTest.php index 6ed1101d217785d738725e2085b8ac0d5a2a85d0..9539dcac7bbf098f6745e0a1e16b4ad4f53c66a0 100755 --- a/core/Test/ResControllerTest.php +++ b/core/Test/ResControllerTest.php @@ -226,7 +226,7 @@ class ResControllerTest extends TestCase $request = \Slim\Http\Request::createFromEnvironment($environment); $response = new \Slim\Http\Response(); $response = $action->create($request, $response, $aArgs); - //print_r($response);exit; + $this->assertGreaterThan(1, json_decode($response->getBody())->resId); } diff --git a/modules/basket/Models/BasketsModelAbstract.php b/modules/basket/Models/BasketsModelAbstract.php index 7d1f2edc4d189505c1d15a9b2eb01455dfea817e..7f1e48504c2d37999bdafe2dbde24a32625403b0 100755 --- a/modules/basket/Models/BasketsModelAbstract.php +++ b/modules/basket/Models/BasketsModelAbstract.php @@ -168,4 +168,40 @@ class BasketsModelAbstract return true; } + + public static function deleteBasketRedirection(array $aArgs) + { + ValidatorModel::notEmpty($aArgs, ['userId', 'basketId']); + ValidatorModel::stringType($aArgs, ['userId', 'basketId']); + + DatabaseModel::delete([ + 'table' => 'user_abs', + 'where' => ['(user_abs = ? OR basket_owner = ?)', 'basket_id = ?'], + 'data' => [$aArgs['userId'], $aArgs['userId'], $aArgs['basketId']] + ]); + + return true; + } + + public static function getRedirectedBasketsByUserId(array $aArgs) { + ValidatorModel::notEmpty($aArgs, ['userId']); + ValidatorModel::stringType($aArgs, ['userId']); + + $aBaskets = DatabaseModel::select([ + 'select' => ['ba.basket_id', 'ba.basket_name', 'ua.new_user', 'ua.basket_owner'], + 'table' => ['baskets ba, user_abs ua'], + 'where' => ['ua.user_abs = ?', 'ua.basket_id = ba.basket_id'], + 'data' => [$aArgs['userId']], + 'order_by' => ['ua.system_id'] + ]); + + foreach ($aBaskets as $key => $value) { + $user = UserModel::getById(['userId' => $value['new_user'], 'select' => ['firstname', 'lastname']]); + $aBaskets[$key]['userToDisplay'] = "{$user['firstname']} {$user['lastname']} ({$value['new_user']})"; + $aBaskets[$key]['user'] = "{$user['firstname']} {$user['lastname']}"; + } + + return $aBaskets; + } + } \ No newline at end of file diff --git a/modules/basket/class/class_admin_basket_Abstract.php b/modules/basket/class/class_admin_basket_Abstract.php index 35f72b161ef52404ce5ef7d43b7b30cb1a50d446..ab3446a746667a1dd872c6add8dabb84c4207dc0 100755 --- a/modules/basket/class/class_admin_basket_Abstract.php +++ b/modules/basket/class/class_admin_basket_Abstract.php @@ -132,6 +132,7 @@ abstract class admin_basket_Abstract extends Database if ($mode == "add") { $_SESSION['m_admin']['basket']['coll_id'] = $_SESSION['collections'][0]['id']; + $_SESSION['m_admin']['basket']['color'] = '#666666'; } // If mode "Up", Loading the informations of the basket in session @@ -154,6 +155,11 @@ abstract class admin_basket_Abstract extends Database $line = $stmt->fetchObject(); $_SESSION['m_admin']['basket']['desc'] = functions::show_string($line->basket_desc); $_SESSION['m_admin']['basket']['name'] = functions::show_string($line->basket_name); + if (empty($line->color)) { + $_SESSION['m_admin']['basket']['color'] = '#666666'; + } else { + $_SESSION['m_admin']['basket']['color'] = functions::show_string($line->color); + } $_SESSION['m_admin']['basket']['clause'] = functions::show_string($line->basket_clause); $_SESSION['m_admin']['basket']['is_generic'] = functions::show_string($line->is_generic); $_SESSION['m_admin']['basket']['is_visible'] = functions::show_string($line->is_visible); @@ -248,6 +254,11 @@ abstract class admin_basket_Abstract extends Database <label><?php echo _BASKET;?> : </label> <input name="basketname" type="text" id="basketname" value="<?php functions::xecho($_SESSION['m_admin']['basket']['name']);?>" /> </p> + <p> + <label>Couleur : </label> + <input name="color" type="color" id="color" style="width: 38%;" value="<?php functions::xecho($_SESSION['m_admin']['basket']['color']);?>" /> + <a title="Réinitialiser la couleur" style="cursor: pointer" onclick="$j('#color')[0].value = '#666666'"><i class="fa fa-magic"></i></a> + </p> <p> <label><?php echo _DESC;?> : </label> <textarea cols="30" rows="4" name="basketdesc" style="width:200px;" id="basketdesc" ><?php functions::xecho($_SESSION['m_admin']['basket']['desc']);?></textarea> @@ -446,6 +457,10 @@ abstract class admin_basket_Abstract extends Database { $_SESSION['m_admin']['basket']['name'] = $this->wash($_REQUEST['basketname'], "no", _THE_BASKET, 'yes', 0, 255); } + if(!empty($_REQUEST['color'])) + { + $_SESSION['m_admin']['basket']['color'] = $this->wash($_REQUEST['color'], "no", _THE_BASKET, 'yes', 0, 255); + } if (isset($_REQUEST['basketdesc']) && !empty($_REQUEST['basketdesc'])) { $_SESSION['m_admin']['basket']['desc'] = $this->wash($_REQUEST['basketdesc'], "no", _THE_DESC, 'yes', 0, 255); @@ -544,8 +559,8 @@ abstract class admin_basket_Abstract extends Database exit(); } $db->query( - "INSERT INTO ".$_SESSION['tablename']['bask_baskets']." ( coll_id, basket_id, basket_name, basket_desc , basket_clause, is_visible, is_folder_basket, flag_notif ) " - ."VALUES (?,?,?,?,?,?,?,?)", array($_SESSION['m_admin']['basket']['coll_id'],$_SESSION['m_admin']['basket']['basketId'],$_SESSION['m_admin']['basket']['name'],$_SESSION['m_admin']['basket']['desc'],$tmp,$_SESSION['m_admin']['basket']['is_visible'],$_SESSION['m_admin']['basket']['is_folder_basket'],$_SESSION['m_admin']['basket']['flag_notif'])); + "INSERT INTO ".$_SESSION['tablename']['bask_baskets']." ( coll_id, basket_id, basket_name, basket_desc , basket_clause, is_visible, is_folder_basket, flag_notif, color) " + ."VALUES (?,?,?,?,?,?,?,?,?)", array($_SESSION['m_admin']['basket']['coll_id'],$_SESSION['m_admin']['basket']['basketId'],$_SESSION['m_admin']['basket']['name'],$_SESSION['m_admin']['basket']['desc'],$tmp,$_SESSION['m_admin']['basket']['is_visible'],$_SESSION['m_admin']['basket']['is_folder_basket'],$_SESSION['m_admin']['basket']['flag_notif'], $_SESSION['m_admin']['basket']['color'])); $this->load_db(); // Log in database if required @@ -594,7 +609,7 @@ abstract class admin_basket_Abstract extends Database exit(); } - $db->query("UPDATE ".$_SESSION['tablename']['bask_baskets']." set basket_name = ? , coll_id = ? , basket_desc = ? ,basket_clause = ?, is_folder_basket = ?, is_visible = ?, flag_notif = ? where basket_id = ?",array($name,$_SESSION['m_admin']['basket']['coll_id'],$desc, $tmp, $_SESSION['m_admin']['basket']['is_folder_basket'], $_SESSION['m_admin']['basket']['is_visible'], $_SESSION['m_admin']['basket']['flag_notif'], $_SESSION['m_admin']['basket']['basketId'])); + $db->query("UPDATE baskets set basket_name = ? , coll_id = ? , basket_desc = ? ,basket_clause = ?, is_folder_basket = ?, is_visible = ?, flag_notif = ?, color = ? where basket_id = ?",array($name,$_SESSION['m_admin']['basket']['coll_id'],$desc, $tmp, $_SESSION['m_admin']['basket']['is_folder_basket'], $_SESSION['m_admin']['basket']['is_visible'], $_SESSION['m_admin']['basket']['flag_notif'], $_SESSION['m_admin']['basket']['color'], $_SESSION['m_admin']['basket']['basketId'])); $this->load_db(); // Log in database if required diff --git a/modules/basket/class/class_modules_tools_Abstract.php b/modules/basket/class/class_modules_tools_Abstract.php index 078743e28ca85022866acf2bd33eb90447e3db25..c1b05be7481cba463c78b4fdb80bc3b771abe623 100755 --- a/modules/basket/class/class_modules_tools_Abstract.php +++ b/modules/basket/class/class_modules_tools_Abstract.php @@ -795,7 +795,7 @@ abstract class basket_Abstract extends Database $secCtrl = new SecurityControler(); $stmt = $db->query( "select basket_id, coll_id, basket_name, basket_desc, " - . "basket_clause, is_visible, is_generic, is_folder_basket from " + . "basket_clause, is_visible, is_generic, is_folder_basket, color from " . BASKET_TABLE . " where basket_id = ? and enabled = 'Y'",array($basketId)); $res = $stmt->fetchObject(); $tab['id'] = $res->basket_id; @@ -811,6 +811,7 @@ abstract class basket_Abstract extends Database $tab['is_generic'] = $res->is_generic; $tab['desc'] = $this->show_string($res->basket_desc); $tab['name'] = $this->show_string($res->basket_name); + $tab['color'] = $this->show_string($res->color); $tab['clause'] = $res->basket_clause; $tab['is_visible'] = $res->is_visible; $tab['is_folder_basket'] = $res->is_folder_basket; diff --git a/modules/basket/display_basket_list.php b/modules/basket/display_basket_list.php index 1cbfbc3d25cff2f754f130461cd26042cc1e88ec..06dad9cc6270cb4fd5b846e27b175dfb4529ac76 100755 --- a/modules/basket/display_basket_list.php +++ b/modules/basket/display_basket_list.php @@ -75,6 +75,7 @@ if ($core_tools->test_service('display_basket_list','basket', false)) { <h2><?php echo _MY_BASKETS;?> : </h2> <?php + $redirectedBaskets = \Baskets\Models\BasketsModel::getRedirectedBasketsByUserId(['userId' => $_SESSION['user']['UserId']]); $countColl = count($collWithUserBaskets); $currentGroup = ''; for ($cpt=0;$cpt<$countColl;$cpt++) { @@ -132,7 +133,7 @@ if ($core_tools->test_service('display_basket_list','basket', false)) { . '" name="nb_' . $_SESSION['user']['baskets'][$i]['id'] . '"><i class="fa-li fa fa-spinner fa-spin" style="margin-left: -10px;position: inherit;margin-right: -7px;"></i>' . '</span></b> <i class="fa-li fa fa-folder" style="padding-top: 5px;padding-bottom: 5px;"></i>' - . functions::xssafe($_SESSION['user']['baskets'][$i]['name']) + . '<span style="color: ' .$_SESSION['user']['baskets'][$i]['color'] . '">' . functions::xssafe($_SESSION['user']['baskets'][$i]['name']) . '</span>' . ' </a></li>'; } else { echo '<li style="padding-top: 5px;padding-bottom: 5px;"><a title="'.$_SESSION['user']['baskets'][$i]['desc'].'" href="' @@ -143,7 +144,7 @@ if ($core_tools->test_service('display_basket_list','basket', false)) { . '" name="nb_' . $_SESSION['user']['baskets'][$i]['id'] . '"><i class="fa-li fa fa-spinner fa-spin" style=";margin-left: -10px;position: inherit;margin-right: -7px;"></i>' . '</span></b> <i class="fa-li fa fa-tasks" style="padding-top: 5px;padding-bottom: 5px;"></i> ' - . functions::xssafe($_SESSION['user']['baskets'][$i]['name']) + . '<span style="color: ' .$_SESSION['user']['baskets'][$i]['color'] . '">' . functions::xssafe($_SESSION['user']['baskets'][$i]['name']) . '</span>' . ' </a></li>'; } } diff --git a/modules/basket/xml/IVS/validation_rules.xml b/modules/basket/xml/IVS/validation_rules.xml index 61cc7445af06fc1f8d606762686f65655f68bf36..a7dd2a1c52fbcbc565b36c8970d203eaf042e8c9 100755 --- a/modules/basket/xml/IVS/validation_rules.xml +++ b/modules/basket/xml/IVS/validation_rules.xml @@ -18,6 +18,7 @@ <parameter name="collection" type="collection_list" /> <parameter name="basketId" type="identifier" /> <parameter name="basketname" type="string" /> + <parameter name="color" type="string" /> <parameter name="basketdesc" type="string" /> <parameter name="basketclause" type="string" /> <parameter name="Submit" type="string" /> diff --git a/modules/entities/class/class_manage_entities_Abstract.php b/modules/entities/class/class_manage_entities_Abstract.php index 286fbcbe3e04f9f7b8c95155d1e573f201c60a7c..6ca7714207fa58f951d77caf020dc4168f3039d3 100755 --- a/modules/entities/class/class_manage_entities_Abstract.php +++ b/modules/entities/class/class_manage_entities_Abstract.php @@ -52,6 +52,7 @@ abstract class entity_Abstract extends functions $line = $stmt->fetchObject(); $_SESSION['m_admin']['entity']['label'] = functions::show_string($line->entity_label); $_SESSION['m_admin']['entity']['short_label'] = functions::show_string($line->short_label); + $_SESSION['m_admin']['entity']['entity_full_name'] = functions::show_string($line->entity_full_name); $_SESSION['m_admin']['entity']['enabled'] = functions::show_string($line->enabled); $_SESSION['m_admin']['entity']['adrs1'] = functions::show_string($line->adrs_1); $_SESSION['m_admin']['entity']['adrs2'] = functions::show_string($line->adrs_2); @@ -155,6 +156,10 @@ abstract class entity_Abstract extends functions <label><?php echo _SHORT_LABEL;?> : </label> <input name="short_label" type="text" id="short_label" value="<?php if(isset($_SESSION['m_admin']['entity']['short_label'])){ functions::xecho($_SESSION['m_admin']['entity']['short_label']);} ?>" /><span class="red_asterisk"><i class="fa fa-star"></i></span> </p> + <p style="text-align:right;"> + <label><?php echo _ENTITY_FULL_NAME;?> : </label> + <textarea name="entity_full_name" style="margin-right: 7px" type="text" id="entity_full_name"><?php if(isset($_SESSION['m_admin']['entity']['entity_full_name'])){ functions::xecho($_SESSION['m_admin']['entity']['entity_full_name']);}?></textarea> + </p> <p style="text-align:right;"> <label><?php echo _ENTITY_ADR_1;?> : </label> <input name="adrs1" style="margin-right: 7px" type="text" id="adrs1" value="<?php if(isset( $_SESSION['m_admin']['entity']['adrs1'])){functions::xecho($_SESSION['m_admin']['entity']['adrs1']); }?>" /> @@ -736,10 +741,10 @@ abstract class entity_Abstract extends functions { $entities = array(); $db = new Database(); - $stmt = $db->query("select e.entity_id,e.entity_label,e.short_label, ue.primary_entity, ue.user_role from ".ENT_ENTITIES." e, ".ENT_USERS_ENTITIES." ue where ue.entity_id = e.entity_id and ue.user_id = ? order by e.entity_label",array(trim($user_id))); + $stmt = $db->query("select e.entity_id,e.entity_label,e.short_label,e.entity_full_name ue.primary_entity, ue.user_role from ".ENT_ENTITIES." e, ".ENT_USERS_ENTITIES." ue where ue.entity_id = e.entity_id and ue.user_id = ? order by e.entity_label",array(trim($user_id))); while($res = $stmt->fetchObject()) { - array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res->entity_label, 'SHORT_LABEL' => $res->short_label,'PRIMARY' => $res->entity_label, 'ROLE' => $res->user_role )); + array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res->entity_label, 'SHORT_LABEL' => $res->short_label,'ENTITY_FULL_NAME' => $res->entity_full_name, 'PRIMARY' => $res->entity_label, 'ROLE' => $res->user_role )); } return $entities; } @@ -941,6 +946,11 @@ abstract class entity_Abstract extends functions { $_SESSION['error'].= _SHORT_LABEL_MISSING."<br/>"; } + $_SESSION['m_admin']['entity']['entity_full_name'] = ''; + if(isset($_REQUEST['entity_full_name']) && !empty($_REQUEST['entity_full_name'])){ + $_SESSION['m_admin']['entity']['entity_full_name'] = functions::wash(utf8_decode($_REQUEST['entity_full_name']), "no", _FULL_NAME, 'yes', 0); + $_SESSION['m_admin']['entity']['entity_full_name'] = utf8_encode($_SESSION['m_admin']['entity']['entity_full_name']); + } $_SESSION['m_admin']['entity']['adrs1'] = ''; if(isset($_REQUEST['adrs1']) && !empty($_REQUEST['adrs1'])) { @@ -1097,7 +1107,7 @@ abstract class entity_Abstract extends functions $entityPath .= $entityIdForTree . '/' . $_SESSION['m_admin']['entity']['entityId']; } - $stmt = $db->query('INSERT INTO '.ENT_ENTITIES." (entity_id, entity_label, short_label, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type, entity_path, archival_agency, archival_agreement) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",array($_SESSION['m_admin']['entity']['entityId'],$_SESSION['m_admin']['entity']['label'],$_SESSION['m_admin']['entity']['short_label'],$_SESSION['m_admin']['entity']['adrs1'],$_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'],$_SESSION['m_admin']['entity']['zcode'],$_SESSION['m_admin']['entity']['city'],$_SESSION['m_admin']['entity']['country'],$_SESSION['m_admin']['entity']['email'],$_SESSION['m_admin']['entity']['business'],$_SESSION['m_admin']['entity']['parent'],$_SESSION['m_admin']['entity']['type'],$entityPath,$_SESSION['m_admin']['entity']['archival_agency'],$_SESSION['m_admin']['entity']['archival_agreement'])); + $stmt = $db->query('INSERT INTO '.ENT_ENTITIES." (entity_id, entity_label, short_label, adrs_1, adrs_2, adrs_3, zipcode, city, country, email, business_id, parent_entity_id, entity_type, entity_path, archival_agency, archival_agreement, entity_full_name) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",array($_SESSION['m_admin']['entity']['entityId'],$_SESSION['m_admin']['entity']['label'],$_SESSION['m_admin']['entity']['short_label'],$_SESSION['m_admin']['entity']['adrs1'],$_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'],$_SESSION['m_admin']['entity']['zcode'],$_SESSION['m_admin']['entity']['city'],$_SESSION['m_admin']['entity']['country'],$_SESSION['m_admin']['entity']['email'],$_SESSION['m_admin']['entity']['business'],$_SESSION['m_admin']['entity']['parent'],$_SESSION['m_admin']['entity']['type'],$entityPath,$_SESSION['m_admin']['entity']['archival_agency'],$_SESSION['m_admin']['entity']['archival_agreement'],$_SESSION['m_admin']['entity']['entity_full_name'])); $_SESSION['service_tag'] = 'entity_add_db'; $core->execute_modules_services($_SESSION['modules_services'], 'entity_add_db', "include"); $core->execute_app_services($_SESSION['app_services'], 'entity_add_db', 'include'); @@ -1147,7 +1157,7 @@ abstract class entity_Abstract extends functions $entityPath .= $entityIdForTree . '/' . $_SESSION['m_admin']['entity']['entityId']; } - $stmt = $db->query('UPDATE '.ENT_ENTITIES." set entity_label = ? , short_label = ? , adrs_1 = ?, adrs_2 = ?, adrs_3 = ?, zipcode = ?, city = ?, country = ?, email = ?, business_id = ?, parent_entity_id = ?, entity_type = ?, entity_path = ?, archival_agency = ?, archival_agreement = ? where entity_id = ?",array($_SESSION['m_admin']['entity']['label'], $_SESSION['m_admin']['entity']['short_label'], $_SESSION['m_admin']['entity']['adrs1'], $_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'], $_SESSION['m_admin']['entity']['zcode'], $_SESSION['m_admin']['entity']['city'], $_SESSION['m_admin']['entity']['country'], $_SESSION['m_admin']['entity']['email'], $_SESSION['m_admin']['entity']['business'], $_SESSION['m_admin']['entity']['parent'], $_SESSION['m_admin']['entity']['type'], $entityPath, $_SESSION['m_admin']['entity']['archival_agency'], $_SESSION['m_admin']['entity']['archival_agreement'],$_SESSION['m_admin']['entity']['entityId'])); + $stmt = $db->query('UPDATE '.ENT_ENTITIES." set entity_label = ? , short_label = ? , adrs_1 = ?, adrs_2 = ?, adrs_3 = ?, zipcode = ?, city = ?, country = ?, email = ?, business_id = ?, parent_entity_id = ?, entity_type = ?, entity_path = ?, archival_agency = ?, archival_agreement = ?, entity_full_name = ? where entity_id = ?",array($_SESSION['m_admin']['entity']['label'], $_SESSION['m_admin']['entity']['short_label'], $_SESSION['m_admin']['entity']['adrs1'], $_SESSION['m_admin']['entity']['adrs2'],$_SESSION['m_admin']['entity']['adrs3'], $_SESSION['m_admin']['entity']['zcode'], $_SESSION['m_admin']['entity']['city'], $_SESSION['m_admin']['entity']['country'], $_SESSION['m_admin']['entity']['email'], $_SESSION['m_admin']['entity']['business'], $_SESSION['m_admin']['entity']['parent'], $_SESSION['m_admin']['entity']['type'], $entityPath, $_SESSION['m_admin']['entity']['archival_agency'], $_SESSION['m_admin']['entity']['archival_agreement'], $_SESSION['m_admin']['entity']['entity_full_name'], $_SESSION['m_admin']['entity']['entityId'])); $_SESSION['service_tag'] = 'entity_up_db'; $core->execute_modules_services($_SESSION['modules_services'], 'entity_up_db', "include"); $core->execute_app_services($_SESSION['app_services'], 'entity_up_db', 'include'); diff --git a/modules/entities/difflist_display.php b/modules/entities/difflist_display.php index ee7a3f08293b757125781958ddb6c13966aa2893..c4193b6fb907c2e16e80948b05533a95df349c2e 100755 --- a/modules/entities/difflist_display.php +++ b/modules/entities/difflist_display.php @@ -39,7 +39,7 @@ if ($color == ' class="col"') $color = ' '; else $color = ' class="col"'; - if (preg_match("/[DEL]/", $difflist[$role_id]['users'][$i]['process_comment'])) { + if (preg_match("/\[DEL\]/", $difflist[$role_id]['users'][$i]['process_comment'])) { $styleMoved=" style='text-decoration: line-through;opacity:0.5;' "; $descMoved=$difflist[$role_id]['users'][$i]['process_comment']; } else { diff --git a/modules/entities/lang/en.php b/modules/entities/lang/en.php index af57e5a0b94b0df72263dde3363a57a1ee4be2de..49eafc29e003588a145e5ff30b6c86cfe38d768a 100755 --- a/modules/entities/lang/en.php +++ b/modules/entities/lang/en.php @@ -118,6 +118,8 @@ if (!defined("_ENTITY_LABEL")) define("_ENTITY_LABEL", "Name"); if (!defined("_SHORT_LABEL")) define("_SHORT_LABEL", "Short name"); +if (!defined("_ENTITY_FULL_NAME")) + define("_ENTITY_FULL_NAME", "Full name"); if (!defined("_ENTITY_ADR_1")) define("_ENTITY_ADR_1", "Address 1"); if (!defined("_ENTITY_ADR_2")) diff --git a/modules/entities/lang/fr.php b/modules/entities/lang/fr.php index f60df86a340195fd742674c85b10ede4f31f3154..100191e684557f4919601ed989f16abd8d13b117 100755 --- a/modules/entities/lang/fr.php +++ b/modules/entities/lang/fr.php @@ -118,6 +118,8 @@ if (!defined("_ENTITY_LABEL")) define("_ENTITY_LABEL", "Nom"); if (!defined("_SHORT_LABEL")) define("_SHORT_LABEL", "Nom court"); +if (!defined("_ENTITY_FULL_NAME")) + define("_ENTITY_FULL_NAME", "Nom complet"); if (!defined("_ENTITY_ADR_1")) define("_ENTITY_ADR_1", "Adresse 1"); if (!defined("_ENTITY_ADR_2")) diff --git a/modules/entities/xml/IVS/validation_rules.xml b/modules/entities/xml/IVS/validation_rules.xml index 0b94080959aea33d66f4a076c4c8b760cd9eeedd..82049567a0ded787cf29425e1d9db6d82e9eddde 100755 --- a/modules/entities/xml/IVS/validation_rules.xml +++ b/modules/entities/xml/IVS/validation_rules.xml @@ -70,6 +70,7 @@ <parameter name="mode" type="mode" /> <parameter name="parententity" type="identifier" /> <parameter name="short_label" type="string" /> + <parameter name="entity_full_name" type="string" /> <parameter name="type" type="string" /> <parameter name="archival_agreement" type="string" /> <parameter name="archival_agency" type="string" /> diff --git a/modules/notifications/Controllers/NotificationController.php b/modules/notifications/Controllers/NotificationController.php index 88ca6e3fd32e1f20ff3f8597cb090ab7983e90af..321b432a1eeefe76fb3be094ada21e3aba4a306d 100644 --- a/modules/notifications/Controllers/NotificationController.php +++ b/modules/notifications/Controllers/NotificationController.php @@ -21,7 +21,6 @@ use Psr\Http\Message\ResponseInterface; use Respect\Validation\Validator; use Notifications\Models\NotificationModel; use Core\Models\ServiceModel; -use Core\Models\LangModel; use Core\Controllers\HistoryController; @@ -43,6 +42,7 @@ class NotificationController if (!ServiceModel::hasService(['id' => 'admin_notif', 'userId' => $_SESSION['user']['UserId'], 'location' => 'notifications', 'type' => 'admin'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } + $notification['notifications'] = NotificationModel::getByNotificationId(['notificationId' => $aArgs['id'], 'select' => ['notification_sid', 'notification_id', 'description', 'is_enabled', 'event_id', 'notification_mode', 'template_id', 'diffusion_type','diffusion_properties', 'attachfor_type','attachfor_properties']]); if (empty($notification['notifications'])) { return $response->withStatus(400)->withJson(['errors' => 'Notification not found']); @@ -65,44 +65,37 @@ class NotificationController $notificationInDb = NotificationModel::getByNotificationId(['notificationId' => $data['notification_id'], 'select' => ['notification_sid']]); if($data){ - if(is_int($notificationInDb['notification_sid'])){ + if(is_int($notificationInDb['notification_sid'])) { return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_ALREADY_EXIST]); - }elseif(strlen($data[description]) > 255){ + }elseif(strlen($data['description']) > 255) { return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_DESCRIPTION_TOO_LONG]); - }elseif(strlen($data[event_id]) > 255 && is_string($data[event_id])){ + }elseif(strlen($data['event_id']) > 255 && is_string($data['event_id'])) { return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_EVENT_TOO_LONG]); - }elseif(strlen($data[notification_mode]) > 30){ + }elseif(strlen($data['notification_mode']) > 30){ return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_MODE_TOO_LONG]); - }elseif(Validator::intType()->notEmpty()->validate($data[template_id])){ + }elseif(Validator::intType()->notEmpty()->validate($data['template_id'])){ return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_TEMPLATE_NOT_A_INT]); - }elseif(!is_string($data[diffusion_type])){ + }elseif(!is_string($data['diffusion_type'])){ return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_DIFFUSION_IS_A_INT]); } - // elseif(!is_array($data[diffusion_properties])){ - // return $response->withStatus(400)->withJson(['errors' => _NOTIFICATIONS_ERROR.' '._NOTIF_DIFFUSION_PROPERTIES_NOT_INT]); - // } - if($data[is_enabled] == true){ - $data[is_enabled] = 'Y'; + if($data['is_enabled'] == true){ + $data['is_enabled'] = 'Y'; }else{ - $data[is_enabled] = 'N'; + $data['is_enabled'] = 'N'; } - $data[notification_mode] = 'EMAIL'; + $data['notification_mode'] = 'EMAIL'; - if($data[diffusion_properties]){ - $data[diffusion_properties] = implode(",",$data[diffusion_properties]); + if($data['diffusion_properties']){ + $data['diffusion_properties'] = implode(",", $data['diffusion_properties']); } - if($data[attachfor_properties]){ - $data[attachfor_properties] = implode(",",$data[attachfor_properties]); + if($data['attachfor_properties']){ + $data['attachfor_properties'] = implode(",", $data['attachfor_properties']); }else{ - $data[attachfor_properties] = ''; + $data['attachfor_properties'] = ''; } - - // elseif(!is_string($data[rss_url_template])){ - // return $response->withStatus(400)->withJson(['errors' => 'Notification error : rss_url_template is not in good format ']); - // } if (NotificationModel::create($data)) { HistoryController::add([ @@ -129,33 +122,26 @@ class NotificationController $data = $request->getParams(); $data['notification_sid'] = $aArgs['id']; - $data[diffusion_properties] = implode(",",$data[diffusion_properties]); + $data['diffusion_properties'] = implode(",", $data['diffusion_properties']); - $data[attachfor_properties] = implode(",",$data[attachfor_properties]); - // var_dump($aArgs); - // var_dump($data); - - //$aArgs = self::manageValue($request); - //$errors = $this->control($aArgs, 'update'); - + $data['attachfor_properties'] = implode(",", $data['attachfor_properties']); if (!empty($errors)) { return $response->withStatus(500)->withJson(['errors' => $errors]); } NotificationModel::update($data); - $notification = NotificationModel::getById(['notificationId' => $data['notification_id']]); + $notification = NotificationModel::getById(['notificationId' => $data['notification_id']]); - HistoryController::add([ - 'table_name' => 'notifications', - 'record_id' => $data['notification_sid'], - 'event_type' => 'UP', - 'event_id' => 'notificationsup', - 'info' => _MODIFY_NOTIFICATIONS . ' : ' . $data['notification_sid'] - ]); + HistoryController::add([ + 'table_name' => 'notifications', + 'record_id' => $data['notification_sid'], + 'event_type' => 'UP', + 'event_id' => 'notificationsup', + 'info' => _MODIFY_NOTIFICATIONS . ' : ' . $data['notification_sid'] + ]); - return $response->withJson(['notification'=> $notification]); - + return $response->withJson(['notification'=> $notification]); } public function delete(RequestInterface $request, ResponseInterface $response, $aArgs) @@ -186,9 +172,10 @@ class NotificationController if (!ServiceModel::hasService(['id' => 'admin_notif', 'userId' => $_SESSION['user']['UserId'], 'location' => 'notifications', 'type' => 'admin'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } + $notification = []; - $notification[diffusion_properties] = []; - $notification[attachfor_properties] = []; + $notification['diffusion_properties'] = []; + $notification['attachfor_properties'] = []; $data = []; $data['event'] = NotificationModel::getEvent(); @@ -209,9 +196,9 @@ class NotificationController if (!ServiceModel::hasService(['id' => 'admin_notif', 'userId' => $_SESSION['user']['UserId'], 'location' => 'notifications', 'type' => 'admin'])) { return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); } + $notification = NotificationModel::getById(['notification_sid' => $aArgs['id'], 'select' => ['notification_sid', 'notification_id', 'description', 'is_enabled', 'event_id', 'notification_mode', 'template_id', 'diffusion_type','diffusion_properties', 'attachfor_type','attachfor_properties']]); - - + $notification['diffusion_properties'] = explode(",",$notification['diffusion_properties']); foreach ($notification['diffusion_properties'] as $key => $value) { diff --git a/modules/notifications/Models/NotificationModelAbstract.php b/modules/notifications/Models/NotificationModelAbstract.php index 5c09dcaa3907ac0d250b1d5868569d47f4cbce35..22fd1ffd6d5a6a935a1b2bb743a49cab77d5acc7 100644 --- a/modules/notifications/Models/NotificationModelAbstract.php +++ b/modules/notifications/Models/NotificationModelAbstract.php @@ -25,7 +25,6 @@ class NotificationModelAbstract { public static function get(array $aArgs = []) { - ValidatorModel::notEmpty($aArgs, ['select']); $aNotifications = DatabaseModel::select([ 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], 'table' => ['notifications'] @@ -36,13 +35,15 @@ class NotificationModelAbstract public static function getById(array $aArgs = []) { - //ValidatorModel::notEmpty($aArgs, ['notification_sid']); + ValidatorModel::notEmpty($aArgs, ['notification_sid']); + $aNotification = DatabaseModel::select([ 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], 'table' => ['notifications'], 'where' => ['notification_sid = ?'], 'data' => [$aArgs['notification_sid']] ]); + if (empty($aNotification[0])) { return []; } @@ -52,13 +53,15 @@ class NotificationModelAbstract public static function getByNotificationId(array $aArgs = []) { - //ValidatorModel::notEmpty($aArgs, ['notificationId']); + ValidatorModel::notEmpty($aArgs, ['notificationId']); + $aNotification = DatabaseModel::select([ 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], 'table' => ['notifications'], 'where' => ['notification_id = ?'], 'data' => [$aArgs['notificationId']] ]); + if (empty($aNotification[0])) { return []; } @@ -70,6 +73,7 @@ class NotificationModelAbstract { ValidatorModel::notEmpty($aArgs, ['notification_sid']); ValidatorModel::intVal($aArgs, ['notification_sid']); + DatabaseModel::delete([ 'table' => 'notifications', 'where' => ['notification_sid = ?'], @@ -84,26 +88,25 @@ class NotificationModelAbstract ValidatorModel::notEmpty($aArgs, ['notification_id', 'description', 'is_enabled', 'event_id', 'notification_mode', 'template_id', 'diffusion_type', 'diffusion_properties']); ValidatorModel::intVal($aArgs, ['template_id']); ValidatorModel::stringType($aArgs, ['notification_id','description','is_enabled','event_id','notification_mode',]); - //var_dump($aArgs);exit; + DatabaseModel::insert([ 'table' => 'notifications', 'columnsValues' => [ - 'notification_id' => $aArgs['notification_id'], - 'description' => $aArgs['description'], - 'is_enabled' => $aArgs['is_enabled'], - 'event_id' => $aArgs['event_id'], - 'notification_mode' => $aArgs['notification_mode'], - 'template_id' => $aArgs['template_id'], - 'rss_url_template' => $aArgs['rss_url_template'], - 'diffusion_type' => $aArgs['diffusion_type'], - 'diffusion_properties' => $aArgs['diffusion_properties'], - 'attachfor_type' => $aArgs['attachfor_type'], - 'attachfor_properties' => $aArgs['attachfor_properties'] + 'notification_id' => $aArgs['notification_id'], + 'description' => $aArgs['description'], + 'is_enabled' => $aArgs['is_enabled'], + 'event_id' => $aArgs['event_id'], + 'notification_mode' => $aArgs['notification_mode'], + 'template_id' => $aArgs['template_id'], + 'rss_url_template' => $aArgs['rss_url_template'], + 'diffusion_type' => $aArgs['diffusion_type'], + 'diffusion_properties' => $aArgs['diffusion_properties'], + 'attachfor_type' => $aArgs['attachfor_type'], + 'attachfor_properties' => $aArgs['attachfor_properties'] ] ]); return true; - } public static function update(array $aArgs) @@ -111,7 +114,7 @@ class NotificationModelAbstract ValidatorModel::notEmpty($aArgs, ['notification_sid']); ValidatorModel::intVal($aArgs, ['notification_sid']); - $where['notification_sid'] = $aArgs['notification_sid']; + $notification_sid = $aArgs['notification_sid']; unset($aArgs['data']); unset($aArgs['notification_sid']); @@ -119,7 +122,7 @@ class NotificationModelAbstract 'table' => 'notifications', 'set' => $aArgs, 'where' => ['notification_sid = ?'], - 'data' => [$where['notification_sid']] + 'data' => [$notification_sid] ]); return $aReturn; @@ -127,7 +130,6 @@ class NotificationModelAbstract public static function getEvent() { - //get event action in the database $tabEvent_Type = DatabaseModel::select([ 'select' => ['id, label_action'], 'table' => ['actions'] @@ -152,7 +154,6 @@ class NotificationModelAbstract } } - return $tabEvent_Type; } @@ -162,8 +163,7 @@ class NotificationModelAbstract 'select' => ['template_id, template_label'], 'table' => ['templates'], 'where' => ['template_target = ?'], - 'data' => ['notifications'] - + 'data' => ['notifications'] ]); return $tabTemplate; diff --git a/modules/notifications/class/class_schedule_notifications_Abstract.php b/modules/notifications/class/class_schedule_notifications_Abstract.php index 073e02ed0f1aa4cd746c448d990722b512e0ee85..383a65443b09bafa96352c333c624efea5f29991 100755 --- a/modules/notifications/class/class_schedule_notifications_Abstract.php +++ b/modules/notifications/class/class_schedule_notifications_Abstract.php @@ -155,7 +155,13 @@ abstract class ScheduleNotifications_Abstract fwrite($file_open, "\n"); if ($notification_id == 'BASKETS') { fwrite($file_open, 'php \'basket_event_stack.php\' -c '.$ConfigNotif.' -n '.$notification_id); - } else { + } + else if ($notification_id == 'RELANCE1' || $notification_id == 'RELANCE2' || $notification_id == 'RET1' || $notification_id == 'RET2'){ + fwrite($file_open, 'php \'process_event_stack.php\' -c '.$ConfigNotif.' -n '.$notification_id); + fwrite($file_open, "\n"); + fwrite($file_open, 'php \'stack_letterbox_alerts.php\' -c '.$ConfigNotif); + } + else { fwrite($file_open, 'php \'process_event_stack.php\' -c '.$ConfigNotif.' -n '.$notification_id); } fwrite($file_open, "\n"); diff --git a/modules/visa/class/class_modules_tools_Abstract.php b/modules/visa/class/class_modules_tools_Abstract.php index 5b4c9966cb7be7348e9f1bb6edb8d7ce828fe7e6..230eedd2815a21b87b7d0599de0aee8b53c3e752 100755 --- a/modules/visa/class/class_modules_tools_Abstract.php +++ b/modules/visa/class/class_modules_tools_Abstract.php @@ -412,10 +412,10 @@ abstract class visa_Abstract extends Database users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN (SELECT group_id FROM usergroups_services WHERE service_id = ? AND group_id = ?) order by users.lastname", array('visa_documents',$group_id)); }else{ - $stmt = $db->query("SELECT users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id, users.enabled from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and + $stmt = $db->query("SELECT distinct on(users.user_id) users.user_id, users.firstname, users.lastname, usergroup_content.group_id,entities.entity_id, users.enabled from users, usergroup_content, users_entities,entities WHERE users_entities.user_id = users.user_id and users.status <> 'DEL' and users_entities.primary_entity = 'Y' and users.user_id = usergroup_content.user_id AND entities.entity_id = users_entities.entity_id AND group_id IN (SELECT group_id FROM usergroups_services WHERE service_id = ?) - order by users.lastname", array('visa_documents')); + order by users.user_id,users.lastname", array('visa_documents')); } $tab_users = array(); @@ -626,7 +626,7 @@ abstract class visa_Abstract extends Database $disabled = ' disabled="disabled"'; - if(preg_match("/[DEL]/", $info_userVis['process_comment'])){ + if(preg_match("/\[DEL\]/", $info_userVis['process_comment'])){ $info_vised = ''; $link_vis = 'times'; $vised = ' moved vised'; @@ -713,7 +713,7 @@ abstract class visa_Abstract extends Database }else{ $modif = 'false'; - if (preg_match("/[DEL]/", $info_userSign['process_comment'])) { + if (preg_match("/\[DEL\]/", $info_userSign['process_comment'])) { $info_vised = ''; $link_vis = 'times'; $vised = ' moved vised'; diff --git a/rest/index.php b/rest/index.php index 85089f5e5dccde38af3e529ac4ee93d29a796c0b..b8bf83a3586bbd311b1367e9efe0e9189cb47ec6 100755 --- a/rest/index.php +++ b/rest/index.php @@ -189,7 +189,9 @@ $app->put('/users/{id}/status', \Core\Controllers\UserController::class . ':upda $app->post('/users/{id}/signatures', \Core\Controllers\UserController::class . ':addSignature'); $app->put('/users/{id}/signatures/{signatureId}', \Core\Controllers\UserController::class . ':updateSignature'); $app->delete('/users/{id}/signatures/{signatureId}', \Core\Controllers\UserController::class . ':deleteSignature'); -$app->post('/users/{id}/baskets/absence', \Core\Controllers\UserController::class . ':setBasketsRedirectionForAbsence'); +$app->post('/users/{id}/baskets/absence', \Core\Controllers\UserController::class . ':setRedirectedBaskets'); //TODO penser à une meilleure route +$app->delete('/users/{id}/baskets/{basketId}/absence', \Core\Controllers\UserController::class . ':deleteRedirectedBaskets'); //TODO penser à une meilleure route + //CurrentUser $app->put('/currentUser/password', \Core\Controllers\UserController::class . ':updateCurrentUserPassword'); diff --git a/sql/17_xx.sql b/sql/17_xx.sql index d08837a236bc3c77b7ceb386a6b9d57b8847c560..17b476464a5cf9f9c8df069a3b075a6cae0b8462 100755 --- a/sql/17_xx.sql +++ b/sql/17_xx.sql @@ -102,4 +102,11 @@ ALTER TABLE sendmail ADD COLUMN res_version_att_id_list character varying(255); /*SALT*/ UPDATE users set password = '$2y$10$C.QSslBKD3yNMfRPuZfcaubFwPKiCkqqOUyAdOr5FSGKPaePwuEjG', change_password = 'Y' WHERE user_id != 'superadmin'; -UPDATE users set password = '$2y$10$Vq244c5s2zmldjblmMXEN./Q2qZrqtGVgrbz/l1WfsUJbLco4E.e.' where user_id = 'superadmin'; \ No newline at end of file +UPDATE users set password = '$2y$10$Vq244c5s2zmldjblmMXEN./Q2qZrqtGVgrbz/l1WfsUJbLco4E.e.' where user_id = 'superadmin'; + +/*BASKETS COLOR*/ +ALTER TABLE baskets DROP COLUMN IF EXISTS color; +ALTER TABLE baskets ADD color character varying(16); +/*ENTITIES FULL NAME*/ +ALTER TABLE entities DROP COLUMN IF EXISTS entity_full_name; +ALTER TABLE entities ADD entity_full_name text; diff --git a/sql/structure.sql b/sql/structure.sql index 37cfd797bd2f053f71e0709bf71f20522fb36bcf..0ae9896701acbf780675faca4d62a962842d7f90 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -633,6 +633,7 @@ CREATE TABLE entities entity_id character varying(32) NOT NULL, entity_label character varying(255), short_label character varying(50), + entity_full_name text, enabled character(1) NOT NULL DEFAULT 'Y'::bpchar, adrs_1 character varying(255), adrs_2 character varying(255),