Loading config/autoload/global.php +13 −0 Changes for config/autoload/global.php: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,21 @@ return array( 'theme' => 'oscar', /////////////////////////////////////////////////////////////////////////////////// oscar_num_separator [string] /// Permet de modifier le formalisme de la numérotation automatique dans Oscar, il faut également modifier /// la fonction Postgresql associée (doc/numerotation.md) /// 'oscar_num_separator' => 'DRI', ////////////////////////////////////////////////////////////////////// listPersonIncludeActivityMember [boolean] /// Lorsque qu'un membre d'une organisation disposant du privilège "Liste des personnes" /// accède à la liste du personnel de son organisation, cette denière ne propose que les personnes /// qualifiées avec un rôle dans l'oganisation. Cette option permet d'ajouter à cette liste /// les personnes impliquées dans des activités où la structure endosse un rôle principal. /// 'listPersonIncludeActivityMember' => false, // ./doc/connectors.md 'connectors' => [ 'organization' => [], Loading module/Oscar/src/Oscar/Controller/PersonController.php +55 −0 Changes for module/Oscar/src/Oscar/Controller/PersonController.php: 55 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace Oscar\Controller; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\Query; use Oscar\Entity\Activity; use Oscar\Entity\ActivityPerson; use Oscar\Entity\Authentification; use Oscar\Entity\ContractDocument; Loading @@ -20,6 +21,7 @@ use Oscar\Entity\Organization; use Oscar\Entity\OrganizationPerson; use Oscar\Entity\Person; use Oscar\Entity\ProjectMember; use Oscar\Entity\Referent; use Oscar\Entity\Role; use Oscar\Entity\TimeSheet; use Oscar\Entity\WorkPackagePerson; Loading Loading @@ -51,6 +53,59 @@ class PersonController extends AbstractOscarController } public function personnelAction(){ if( $this->isAjax() || $this->params()->fromQuery('format') == 'json' ){ $q = $this->params()->fromQuery('q'); $page = $this->params()->fromQuery('p', 1); $params = [ 'filter_roles' => [], 'order_by' => 'lastname', 'leader' => null ]; $idCoWorkers = $this->getPersonService()->getCoWorkerIds($this->getCurrentPerson()->getId()); $idSubordinates = $this->getPersonService()->getSubordinateIds($this->getCurrentPerson()->getId()); if( !$this->getOscarUserContext()->hasPrivileges(Privileges::PERSON_INDEX) ){ $params['ids'] = array_merge($idCoWorkers, $idSubordinates); } $datas = $this->getPersonService()->getPersonsSearchPaged($q, $page, $params); $output = [ 'total'=> count($datas), 'persons' => [], 'page' => $page, 'resultbypage' => 50, 'coworkers' => [], 'subordinates' => [], ]; /** @var Person $person */ foreach ($datas as $person) { $datasPerson = $person->toArrayList(); $datasPerson['sub'] = false; $datasPerson['coworker'] = false; $datasPerson['activities'] = count($person->getActivities()); if( in_array($person->getId(), $idSubordinates ) ){ $datasPerson['sub'] = true; } if( in_array($person->getId(), $idCoWorkers ) ){ $datasPerson['coworker'] = true; } $output['persons'][] = $datasPerson; } $output['subordinates'] = $idSubordinates; $output['coworkers'] = $idCoWorkers; return $this->ajaxResponse($output); } $datas = []; Loading module/Oscar/src/Oscar/Entity/Person.php +22 −0 Changes for module/Oscar/src/Oscar/Entity/Person.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -723,6 +723,7 @@ class Person implements ResourceInterface 'displayname' => $this->getDisplayName(), 'text' => $this->getDisplayName(), 'email' => $this->getEmail(), 'phone' => $this->getPhone(), 'mail' => $this->getEmail(), 'mailMd5' => md5($this->getEmail()), 'ucbnSiteLocalisation' => $this->getLdapSiteLocation() ? $this->getLdapSiteLocation() : "", Loading @@ -730,6 +731,27 @@ class Person implements ResourceInterface ); } public function toArrayList(){ $datas = $this->toArray(); $organisations = []; /** @var OrganizationPerson $o */ foreach ($this->getOrganizations() as $o) { $organisation = $o->getOrganization(); $role = (string)$o->getRoleObj(); if( !array_key_exists($organisation->getId()) ){ $organisations[$organisation->getId()] = [ 'organisation' => $organisation->displayName(), 'roles' => [] ]; } if( !in_array($role, $organisations[$organisation->getId()]['roles']) ){ $organisations[$organisation->getId()]['roles'][] = $role; } } $datas['organisations'] = $organisations; return $datas; } /** * SYNC : Supprimer l'ID centaure de la liste. * Loading module/Oscar/src/Oscar/Service/PersonService.php +97 −3 Changes for module/Oscar/src/Oscar/Service/PersonService.php: 97 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -480,6 +480,91 @@ die($privilege); } } public function getCoWorkerIds( $idPerson ){ $ids = []; // Liste des organisations ou la personne a un role principal $orga = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder('o') ->select('o.id') ->innerJoin('o.persons', 'op') ->innerJoin('op.roleObj', 'r') ->where('op.person = :person AND r.principal = \'true\'') ->setParameter('person', $idPerson) ->getQuery(); $orgaIds = array_map('current', $orga->getResult()); $coworkers = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->select('p.id') ->innerJoin('p.organizations', 'op') ->where('op.organization IN(:organisationsIds)') ->setParameter('organisationsIds', $orgaIds) ->getQuery(); $coWorkersIds = array_map('current', $coworkers->getResult()); $listPersonIncludeActivityMember = true; if( $listPersonIncludeActivityMember ){ $activityMembers = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->select('DISTINCT p.id') ->innerJoin('p.activities', 'ap') ->innerJoin('ap.activity', 'a') ->innerJoin('a.organizations', 'o') ->innerJoin('o.roleObj', 'r') ->where('r.principal = \'true\' AND o.organization IN(:organizationIds)') ->setParameter('organizationIds', $orgaIds) ->getQuery(); $coWorkersIds = array_merge($coWorkersIds, array_map('current', $activityMembers->getResult())); } return $coWorkersIds; // /** @var OrganizationPerson $personOrganisation */ // foreach ($this->getCurrentPerson()->getLeadedOrganizations() as $personOrganisation) { // if( $personOrganisation->getRoleObj()->isPrincipal() ){ // /** @var OrganizationPerson $po */ // foreach ($personOrganisation->getOrganization()->getPersons() as $po){ // if( !in_array($po->getPerson()->getId(), $idsMembers) ){ // $idsMembers[] = $po->getPerson()->getId(); // } // } // // if( $includePersonsInActivity ){ // /** @var Activity $activity */ // foreach ($personOrganisation->getOrganization()->getActivities() as $activity){ // if( $activity->getRoleObj()->isPrincipal() ){ // foreach ($activity->getActivity()->getPersonsDeep(true) as $person) { // if (!in_array($person->getPerson()->getId(), $idsMembers)) { // $idsMembers[] = $person->getPerson()->getId(); // } // } // } // } // } // } // } return $ids; } public function getSubordinateIds( $idPerson ){ // Récupération des subordonnés $nm1 = $this->getEntityManager()->getRepository(Referent::class)->createQueryBuilder('r') ->innerJoin('r.person', 'p') ->select('p.id') ->where('r.referent = :person') ->setParameters([ 'person' => $this->getCurrentPerson() ]) ->getQuery() ->getResult(); return array_map('current', $nm1); } /** * @param int $currentPage * @param int $resultByPage Loading @@ -506,15 +591,19 @@ die($privilege); $resultByPage = 50 ) { $query = $this->getBaseQuery(); $query->leftJoin('p.organizations', 'o') ->leftJoin('p.activities', 'a'); if( $filters['leader'] ){ $query = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->innerJoin('p.organizations', 'o') ->innerJoin('o.roleObj', 'r') ->innerJoin('p.activities', 'a') ->where('r.principal = true') ; } else { $query = $this->getBaseQuery(); } if( array_key_exists('order_by', $filters) ){ Loading Loading @@ -656,6 +745,11 @@ die($privilege); ->setParameter(':ids', $ids); } if( $filters['ids'] ){ $query->andWhere('p.id IN(:filterIds)') ->setParameter('filterIds', $filters['ids']); } return new UnicaenDoctrinePaginator($query, $currentPage, $resultByPage); } Loading public/css/_common.scss +8 −1 Changes for public/css/_common.scss: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3662,6 +3662,13 @@ pre.alert { } } .oscar-text-loading { animation-name: disco; animation-iteration-count: infinite; animation-duration: .5s; animation-direction: alternate; } ///////////////////////////////////////////////////////////////////////// JALONS @keyframes disco { Loading @@ -3669,7 +3676,7 @@ pre.alert { color: saturate($brand-complementary, 20); } to { color: rgb(255, 255, 255); color: $colorDark; } } Loading Loading
config/autoload/global.php +13 −0 Changes for config/autoload/global.php: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -14,8 +14,21 @@ return array( 'theme' => 'oscar', /////////////////////////////////////////////////////////////////////////////////// oscar_num_separator [string] /// Permet de modifier le formalisme de la numérotation automatique dans Oscar, il faut également modifier /// la fonction Postgresql associée (doc/numerotation.md) /// 'oscar_num_separator' => 'DRI', ////////////////////////////////////////////////////////////////////// listPersonIncludeActivityMember [boolean] /// Lorsque qu'un membre d'une organisation disposant du privilège "Liste des personnes" /// accède à la liste du personnel de son organisation, cette denière ne propose que les personnes /// qualifiées avec un rôle dans l'oganisation. Cette option permet d'ajouter à cette liste /// les personnes impliquées dans des activités où la structure endosse un rôle principal. /// 'listPersonIncludeActivityMember' => false, // ./doc/connectors.md 'connectors' => [ 'organization' => [], Loading
module/Oscar/src/Oscar/Controller/PersonController.php +55 −0 Changes for module/Oscar/src/Oscar/Controller/PersonController.php: 55 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ namespace Oscar\Controller; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\Query; use Oscar\Entity\Activity; use Oscar\Entity\ActivityPerson; use Oscar\Entity\Authentification; use Oscar\Entity\ContractDocument; Loading @@ -20,6 +21,7 @@ use Oscar\Entity\Organization; use Oscar\Entity\OrganizationPerson; use Oscar\Entity\Person; use Oscar\Entity\ProjectMember; use Oscar\Entity\Referent; use Oscar\Entity\Role; use Oscar\Entity\TimeSheet; use Oscar\Entity\WorkPackagePerson; Loading Loading @@ -51,6 +53,59 @@ class PersonController extends AbstractOscarController } public function personnelAction(){ if( $this->isAjax() || $this->params()->fromQuery('format') == 'json' ){ $q = $this->params()->fromQuery('q'); $page = $this->params()->fromQuery('p', 1); $params = [ 'filter_roles' => [], 'order_by' => 'lastname', 'leader' => null ]; $idCoWorkers = $this->getPersonService()->getCoWorkerIds($this->getCurrentPerson()->getId()); $idSubordinates = $this->getPersonService()->getSubordinateIds($this->getCurrentPerson()->getId()); if( !$this->getOscarUserContext()->hasPrivileges(Privileges::PERSON_INDEX) ){ $params['ids'] = array_merge($idCoWorkers, $idSubordinates); } $datas = $this->getPersonService()->getPersonsSearchPaged($q, $page, $params); $output = [ 'total'=> count($datas), 'persons' => [], 'page' => $page, 'resultbypage' => 50, 'coworkers' => [], 'subordinates' => [], ]; /** @var Person $person */ foreach ($datas as $person) { $datasPerson = $person->toArrayList(); $datasPerson['sub'] = false; $datasPerson['coworker'] = false; $datasPerson['activities'] = count($person->getActivities()); if( in_array($person->getId(), $idSubordinates ) ){ $datasPerson['sub'] = true; } if( in_array($person->getId(), $idCoWorkers ) ){ $datasPerson['coworker'] = true; } $output['persons'][] = $datasPerson; } $output['subordinates'] = $idSubordinates; $output['coworkers'] = $idCoWorkers; return $this->ajaxResponse($output); } $datas = []; Loading
module/Oscar/src/Oscar/Entity/Person.php +22 −0 Changes for module/Oscar/src/Oscar/Entity/Person.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -723,6 +723,7 @@ class Person implements ResourceInterface 'displayname' => $this->getDisplayName(), 'text' => $this->getDisplayName(), 'email' => $this->getEmail(), 'phone' => $this->getPhone(), 'mail' => $this->getEmail(), 'mailMd5' => md5($this->getEmail()), 'ucbnSiteLocalisation' => $this->getLdapSiteLocation() ? $this->getLdapSiteLocation() : "", Loading @@ -730,6 +731,27 @@ class Person implements ResourceInterface ); } public function toArrayList(){ $datas = $this->toArray(); $organisations = []; /** @var OrganizationPerson $o */ foreach ($this->getOrganizations() as $o) { $organisation = $o->getOrganization(); $role = (string)$o->getRoleObj(); if( !array_key_exists($organisation->getId()) ){ $organisations[$organisation->getId()] = [ 'organisation' => $organisation->displayName(), 'roles' => [] ]; } if( !in_array($role, $organisations[$organisation->getId()]['roles']) ){ $organisations[$organisation->getId()]['roles'][] = $role; } } $datas['organisations'] = $organisations; return $datas; } /** * SYNC : Supprimer l'ID centaure de la liste. * Loading
module/Oscar/src/Oscar/Service/PersonService.php +97 −3 Changes for module/Oscar/src/Oscar/Service/PersonService.php: 97 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -480,6 +480,91 @@ die($privilege); } } public function getCoWorkerIds( $idPerson ){ $ids = []; // Liste des organisations ou la personne a un role principal $orga = $this->getEntityManager()->getRepository(Organization::class)->createQueryBuilder('o') ->select('o.id') ->innerJoin('o.persons', 'op') ->innerJoin('op.roleObj', 'r') ->where('op.person = :person AND r.principal = \'true\'') ->setParameter('person', $idPerson) ->getQuery(); $orgaIds = array_map('current', $orga->getResult()); $coworkers = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->select('p.id') ->innerJoin('p.organizations', 'op') ->where('op.organization IN(:organisationsIds)') ->setParameter('organisationsIds', $orgaIds) ->getQuery(); $coWorkersIds = array_map('current', $coworkers->getResult()); $listPersonIncludeActivityMember = true; if( $listPersonIncludeActivityMember ){ $activityMembers = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->select('DISTINCT p.id') ->innerJoin('p.activities', 'ap') ->innerJoin('ap.activity', 'a') ->innerJoin('a.organizations', 'o') ->innerJoin('o.roleObj', 'r') ->where('r.principal = \'true\' AND o.organization IN(:organizationIds)') ->setParameter('organizationIds', $orgaIds) ->getQuery(); $coWorkersIds = array_merge($coWorkersIds, array_map('current', $activityMembers->getResult())); } return $coWorkersIds; // /** @var OrganizationPerson $personOrganisation */ // foreach ($this->getCurrentPerson()->getLeadedOrganizations() as $personOrganisation) { // if( $personOrganisation->getRoleObj()->isPrincipal() ){ // /** @var OrganizationPerson $po */ // foreach ($personOrganisation->getOrganization()->getPersons() as $po){ // if( !in_array($po->getPerson()->getId(), $idsMembers) ){ // $idsMembers[] = $po->getPerson()->getId(); // } // } // // if( $includePersonsInActivity ){ // /** @var Activity $activity */ // foreach ($personOrganisation->getOrganization()->getActivities() as $activity){ // if( $activity->getRoleObj()->isPrincipal() ){ // foreach ($activity->getActivity()->getPersonsDeep(true) as $person) { // if (!in_array($person->getPerson()->getId(), $idsMembers)) { // $idsMembers[] = $person->getPerson()->getId(); // } // } // } // } // } // } // } return $ids; } public function getSubordinateIds( $idPerson ){ // Récupération des subordonnés $nm1 = $this->getEntityManager()->getRepository(Referent::class)->createQueryBuilder('r') ->innerJoin('r.person', 'p') ->select('p.id') ->where('r.referent = :person') ->setParameters([ 'person' => $this->getCurrentPerson() ]) ->getQuery() ->getResult(); return array_map('current', $nm1); } /** * @param int $currentPage * @param int $resultByPage Loading @@ -506,15 +591,19 @@ die($privilege); $resultByPage = 50 ) { $query = $this->getBaseQuery(); $query->leftJoin('p.organizations', 'o') ->leftJoin('p.activities', 'a'); if( $filters['leader'] ){ $query = $this->getEntityManager()->getRepository(Person::class)->createQueryBuilder('p') ->innerJoin('p.organizations', 'o') ->innerJoin('o.roleObj', 'r') ->innerJoin('p.activities', 'a') ->where('r.principal = true') ; } else { $query = $this->getBaseQuery(); } if( array_key_exists('order_by', $filters) ){ Loading Loading @@ -656,6 +745,11 @@ die($privilege); ->setParameter(':ids', $ids); } if( $filters['ids'] ){ $query->andWhere('p.id IN(:filterIds)') ->setParameter('filterIds', $filters['ids']); } return new UnicaenDoctrinePaginator($query, $currentPage, $resultByPage); } Loading
public/css/_common.scss +8 −1 Changes for public/css/_common.scss: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -3662,6 +3662,13 @@ pre.alert { } } .oscar-text-loading { animation-name: disco; animation-iteration-count: infinite; animation-duration: .5s; animation-direction: alternate; } ///////////////////////////////////////////////////////////////////////// JALONS @keyframes disco { Loading @@ -3669,7 +3676,7 @@ pre.alert { color: saturate($brand-complementary, 20); } to { color: rgb(255, 255, 255); color: $colorDark; } } Loading