Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +15 −1 Original line number Diff line number Diff line Loading @@ -2421,6 +2421,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'mp' => 'Montant prévu', 'at' => 'est de type', 'st' => 'n\'est pas de type', 'td' => 'Ayant ce type de document', 'add' => 'Date de début', 'adf' => 'Date de fin', 'adc' => 'Date de création', Loading Loading @@ -2801,6 +2802,15 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } break; case 'td': $value1 = $crit['val1'] = explode(',', $params[1]); try { $ids = $this->getActivityService()->getActivitiesIdsWithTypeDocument($value1); } catch (\Exception $e) { throw new OscarException($e->getMessage()); } break; case 'ao' : case 'so' : $organizationId[] = $value1; Loading Loading @@ -2984,7 +2994,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } $criterias[] = $crit; if ($type == 'ap' || $type == 'ao' || $type == 'pm' || $type == 'om' || $type == 'fdt' || $type == 'cb' || $type == 'cb2') { || $type == 'fdt' || $type == 'cb' || $type == 'cb2' || $type == 'td') { if ($filterIds === null) { $filterIds = $ids; } else { Loading Loading @@ -3085,6 +3095,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return $this->ajaxResponse($json); } // Données de la vue $documentsTypes = $this->getActivityService()->getTypesDocuments(true); $view = new ViewModel( [ 'projectview' => $projectview, Loading @@ -3109,6 +3122,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'sortDirection' => $sortDirection, 'sortIgnoreNull' => $sortIgnoreNull, 'types' => $this->getActivityTypeService()->getActivityTypes(true), 'documentsTypes' => $documentsTypes, 'disciplines' => $this->getActivityService()->getDisciplines(), 'projectsIds' => $projectsIds, ] Loading module/Oscar/src/Oscar/Entity/ActivityRepository.php +82 −60 Original line number Diff line number Diff line Loading @@ -19,8 +19,20 @@ use Oscar\Utils\DateTimeUtils; */ class ActivityRepository extends EntityRepository { public function getActivitiesIdsWithTypeDocument(array $idsTypeDocument): array { $queryBuilder = $this->createQueryBuilder('a') ->select('DISTINCT a.id') ->innerJoin('a.documents', 'd') ->where('d.typeDocument IN(:typesDocument)') ->setParameter('typesDocument', $idsTypeDocument) ; return array_map('current', $queryBuilder->getQuery()->getArrayResult()); } public function getActivitiesWithNumber( string $key ) :array { public function getActivitiesWithNumber(string $key): array { $len = strlen($key); $queryBuilder = $this->createQueryBuilder('a') ->where("a.numbers LIKE '%s:$len:\"" . $key . "\"%'"); Loading @@ -40,8 +52,7 @@ class ActivityRepository extends EntityRepository $queryBuilder = $this->createQueryBuilder('a') ->select('a.id') ->where('a.codeEOTP IN(:pfis)') ->setParameter('pfis', $pfis) ; ->setParameter('pfis', $pfis); return array_map('current', $queryBuilder->getQuery()->getArrayResult()); } Loading Loading @@ -96,7 +107,9 @@ class ActivityRepository extends EntityRepository ->innerJoin('a.persons', 'ap') ->leftJoin('a.project', 'p') ->leftJoin('p.members', 'pp') ->where('(ap.person = :personId OR pp.person = :personId) AND (a.dateStart < :date AND a.dateEnd >= :date)') ->where( '(ap.person = :personId OR pp.person = :personId) AND (a.dateStart < :date AND a.dateEnd >= :date)' ) ->setParameters( [ 'personId' => "$personId", Loading Loading @@ -190,9 +203,7 @@ class ActivityRepository extends EntityRepository public function getBaseQueryBuilder(): QueryBuilder { return $this->createQueryBuilder('c') ->leftJoin('c.project', 'p') ; ->leftJoin('c.project', 'p'); // ->leftJoin('c.persons', 'm1') // ->leftJoin('m1.person', 'pers1') // ->leftJoin('c.disciplines', 'dis') Loading @@ -217,9 +228,11 @@ class ActivityRepository extends EntityRepository ->where('c.id in(:ids)') ->setFirstResult($offsetSQL) ->setMaxResults($limitSQL) ->setParameters([ ->setParameters( [ 'ids' => $ids ]); ] ); } /** Loading @@ -227,7 +240,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsWithoutPersonWithRole( int $idPerson, int $idRole ) :array { public function getIdsWithoutPersonWithRole(int $idPerson, int $idRole): array { $idsWith = $this->getIdsForPersonWithRole($idPerson, $idRole); $qb = $this->createQueryBuilder('a') ->select('a.id') Loading Loading @@ -270,7 +284,8 @@ class ActivityRepository extends EntityRepository * * @return array */ public function getIdsForPersonWithRole( int $idPerson, int $idRole ) :array { public function getIdsForPersonWithRole(int $idPerson, int $idRole): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->leftJoin('a.persons', 'act_per') Loading @@ -282,8 +297,10 @@ class ActivityRepository extends EntityRepository ]; if ($idRole > 0) { $qb->where('(act_per.person = :person AND act_per.roleObj = :role) ' .'OR (prj_pers.person = :person AND prj_pers.roleObj = :role)'); $qb->where( '(act_per.person = :person AND act_per.roleObj = :role) ' . 'OR (prj_pers.person = :person AND prj_pers.roleObj = :role)' ); $parameters['role'] = $idRole; } else { $qb->where('act_per.person = :person OR prj_pers.person = :person'); Loading @@ -304,7 +321,8 @@ class ActivityRepository extends EntityRepository * @param array $status * @return array */ public function getIdsWithStatus( array $status ) :array { public function getIdsWithStatus(array $status): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->where('a.status IN(:status)'); Loading @@ -322,8 +340,8 @@ class ActivityRepository extends EntityRepository ); } public function getBeetween2Dates( string $from, string $to, string $field ) :array { public function getBeetween2Dates(string $from, string $to, string $field): array { if (!$from && !$to) { throw new OscarException("Le filtrage par date implique des dates"); } Loading Loading @@ -354,7 +372,8 @@ class ActivityRepository extends EntityRepository ); } public function getActivitiesIdsAll() :array { public function getActivitiesIdsAll(): array { $qb = $this->createQueryBuilder('a') ->select('a.id'); Loading @@ -373,7 +392,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsWithoutOrganizationWithRole( int $idOrganization, int $idRole ) :array { public function getIdsWithoutOrganizationWithRole(int $idOrganization, int $idRole): array { $idsExclude = $this->getIdsForOrganizationWithRole($idOrganization, $idRole); $qb = $this->createQueryBuilder('a') ->select('a.id') Loading @@ -392,7 +412,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsForOrganizationWithRole( int $idOrganization, int $idRole ) :array { public function getIdsForOrganizationWithRole(int $idOrganization, int $idRole): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->leftJoin('a.organizations', 'act_org') Loading @@ -400,8 +421,7 @@ class ActivityRepository extends EntityRepository ->leftJoin('prj.partners', 'prj_org') ->where( 'act_org.organization = :organization OR prj_org.organization = :organization' ) ; ); $parameters = [ Loading @@ -409,8 +429,10 @@ class ActivityRepository extends EntityRepository ]; if ($idRole > 0) { $qb->where('(act_org.organization = :organization AND act_org.roleObj = :role) ' .'OR (prj_org.organization = :organization AND prj_org.roleObj = :role)'); $qb->where( '(act_org.organization = :organization AND act_org.roleObj = :role) ' . 'OR (prj_org.organization = :organization AND prj_org.roleObj = :role)' ); $parameters['role'] = $idRole; } else { $qb->where('act_org.organization = :organization OR prj_org.organization = :organization'); Loading module/Oscar/src/Oscar/Formatter/JSONFormatter.php +1 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ class JSONFormatter $principal = $activityOrganization->getRoleObj() && $activityOrganization->getRoleObj()->isPrincipal(); if ($principal) { if (!array_key_exists($role, $datas['organizations'])) { if (!array_key_exists($role, $datas['organizations_primary'])) { $datas['organizations_primary'][$role] = []; } $datas['organizations_primary'][$role][] = $organization; Loading module/Oscar/src/Oscar/Service/ProjectGrantService.php +4 −0 Original line number Diff line number Diff line Loading @@ -1197,6 +1197,10 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi ]; } public function getActivitiesIdsWithTypeDocument( array $idsTypeDocument ):array { return $this->getActivityRepository()->getActivitiesIdsWithTypeDocument($idsTypeDocument); } /** * Renomage des clefs pour les numérotations personnalisées; * Loading module/Oscar/view/oscar/project-grant/advanced-search.phtml +27 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,25 @@ </article> </script> <script type="text/x-handlebars" id="typedocument-tpl"> <article class="criteria criteria-typedocument card"> <div class="icon-docs"></div> {{#if error}}<strong class="text-danger"><i class="icon-attention-1"></i> {{error}}</strong>{{/if}} <input type="hidden" name="criteria[]" class="criteria" value="{{criteria}}"/> <small>{{typeLabel}}</small> <select class="select2 form-control val1 changer types" id="filter_typeorga" multiple> <?php foreach( $documentsTypes as $typeDocId=>$typeDoc ): ?> <option value="<?= $typeDocId ?>"><?= $typeDoc ?></option> <?php endforeach; ?> </select> <nav> <a href="#" class="delete"> <i class="icon-cancel-outline"></i> </a> </nav> </article> </script> <script type="text/x-handlebars" id="milestones-criteria-tpl"> <article class="criteria criteria-{{type}} card"> <div class="icon-calendar"></div> Loading Loading @@ -758,6 +777,8 @@ var dom, applyChange; if( datas.type == 'ap' || datas.type == 'sp' || datas.type == 'ao' || datas.type == 'so' ){ dom = $(tpl(datas)); } Loading @@ -783,6 +804,11 @@ datas.label = "Pays d'une des organisations"; dom = $(tplCountry(datas)); } else if(datas.type == 'td' ){ //$documentsTypes datas.label = "Type de document"; dom = $(tplTypeDocument(datas)); } else if(datas.type == 'tnt' ) { datas.label = "Type d'organisation"; dom = $(tplTypeOrga(datas)); Loading Loading @@ -1041,6 +1067,7 @@ tplStatus = Handlebars.compile($('#status-criteria-tpl').html()), tplCountry = Handlebars.compile($('#country-tpl').html()), tplTypeOrga = Handlebars.compile($('#typeorga-tpl').html()), tplTypeDocument = Handlebars.compile($('#typedocument-tpl').html()), tplFinance = Handlebars.compile($('#finance-criteria-tpl').html()), tplType = Handlebars.compile($('#type-criteria-tpl').html()), tplDiscipline = Handlebars.compile($('#discipline-criteria-tpl').html()), Loading Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +15 −1 Original line number Diff line number Diff line Loading @@ -2421,6 +2421,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'mp' => 'Montant prévu', 'at' => 'est de type', 'st' => 'n\'est pas de type', 'td' => 'Ayant ce type de document', 'add' => 'Date de début', 'adf' => 'Date de fin', 'adc' => 'Date de création', Loading Loading @@ -2801,6 +2802,15 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } break; case 'td': $value1 = $crit['val1'] = explode(',', $params[1]); try { $ids = $this->getActivityService()->getActivitiesIdsWithTypeDocument($value1); } catch (\Exception $e) { throw new OscarException($e->getMessage()); } break; case 'ao' : case 'so' : $organizationId[] = $value1; Loading Loading @@ -2984,7 +2994,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif } $criterias[] = $crit; if ($type == 'ap' || $type == 'ao' || $type == 'pm' || $type == 'om' || $type == 'fdt' || $type == 'cb' || $type == 'cb2') { || $type == 'fdt' || $type == 'cb' || $type == 'cb2' || $type == 'td') { if ($filterIds === null) { $filterIds = $ids; } else { Loading Loading @@ -3085,6 +3095,9 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif return $this->ajaxResponse($json); } // Données de la vue $documentsTypes = $this->getActivityService()->getTypesDocuments(true); $view = new ViewModel( [ 'projectview' => $projectview, Loading @@ -3109,6 +3122,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif 'sortDirection' => $sortDirection, 'sortIgnoreNull' => $sortIgnoreNull, 'types' => $this->getActivityTypeService()->getActivityTypes(true), 'documentsTypes' => $documentsTypes, 'disciplines' => $this->getActivityService()->getDisciplines(), 'projectsIds' => $projectsIds, ] Loading
module/Oscar/src/Oscar/Entity/ActivityRepository.php +82 −60 Original line number Diff line number Diff line Loading @@ -19,8 +19,20 @@ use Oscar\Utils\DateTimeUtils; */ class ActivityRepository extends EntityRepository { public function getActivitiesIdsWithTypeDocument(array $idsTypeDocument): array { $queryBuilder = $this->createQueryBuilder('a') ->select('DISTINCT a.id') ->innerJoin('a.documents', 'd') ->where('d.typeDocument IN(:typesDocument)') ->setParameter('typesDocument', $idsTypeDocument) ; return array_map('current', $queryBuilder->getQuery()->getArrayResult()); } public function getActivitiesWithNumber( string $key ) :array { public function getActivitiesWithNumber(string $key): array { $len = strlen($key); $queryBuilder = $this->createQueryBuilder('a') ->where("a.numbers LIKE '%s:$len:\"" . $key . "\"%'"); Loading @@ -40,8 +52,7 @@ class ActivityRepository extends EntityRepository $queryBuilder = $this->createQueryBuilder('a') ->select('a.id') ->where('a.codeEOTP IN(:pfis)') ->setParameter('pfis', $pfis) ; ->setParameter('pfis', $pfis); return array_map('current', $queryBuilder->getQuery()->getArrayResult()); } Loading Loading @@ -96,7 +107,9 @@ class ActivityRepository extends EntityRepository ->innerJoin('a.persons', 'ap') ->leftJoin('a.project', 'p') ->leftJoin('p.members', 'pp') ->where('(ap.person = :personId OR pp.person = :personId) AND (a.dateStart < :date AND a.dateEnd >= :date)') ->where( '(ap.person = :personId OR pp.person = :personId) AND (a.dateStart < :date AND a.dateEnd >= :date)' ) ->setParameters( [ 'personId' => "$personId", Loading Loading @@ -190,9 +203,7 @@ class ActivityRepository extends EntityRepository public function getBaseQueryBuilder(): QueryBuilder { return $this->createQueryBuilder('c') ->leftJoin('c.project', 'p') ; ->leftJoin('c.project', 'p'); // ->leftJoin('c.persons', 'm1') // ->leftJoin('m1.person', 'pers1') // ->leftJoin('c.disciplines', 'dis') Loading @@ -217,9 +228,11 @@ class ActivityRepository extends EntityRepository ->where('c.id in(:ids)') ->setFirstResult($offsetSQL) ->setMaxResults($limitSQL) ->setParameters([ ->setParameters( [ 'ids' => $ids ]); ] ); } /** Loading @@ -227,7 +240,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsWithoutPersonWithRole( int $idPerson, int $idRole ) :array { public function getIdsWithoutPersonWithRole(int $idPerson, int $idRole): array { $idsWith = $this->getIdsForPersonWithRole($idPerson, $idRole); $qb = $this->createQueryBuilder('a') ->select('a.id') Loading Loading @@ -270,7 +284,8 @@ class ActivityRepository extends EntityRepository * * @return array */ public function getIdsForPersonWithRole( int $idPerson, int $idRole ) :array { public function getIdsForPersonWithRole(int $idPerson, int $idRole): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->leftJoin('a.persons', 'act_per') Loading @@ -282,8 +297,10 @@ class ActivityRepository extends EntityRepository ]; if ($idRole > 0) { $qb->where('(act_per.person = :person AND act_per.roleObj = :role) ' .'OR (prj_pers.person = :person AND prj_pers.roleObj = :role)'); $qb->where( '(act_per.person = :person AND act_per.roleObj = :role) ' . 'OR (prj_pers.person = :person AND prj_pers.roleObj = :role)' ); $parameters['role'] = $idRole; } else { $qb->where('act_per.person = :person OR prj_pers.person = :person'); Loading @@ -304,7 +321,8 @@ class ActivityRepository extends EntityRepository * @param array $status * @return array */ public function getIdsWithStatus( array $status ) :array { public function getIdsWithStatus(array $status): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->where('a.status IN(:status)'); Loading @@ -322,8 +340,8 @@ class ActivityRepository extends EntityRepository ); } public function getBeetween2Dates( string $from, string $to, string $field ) :array { public function getBeetween2Dates(string $from, string $to, string $field): array { if (!$from && !$to) { throw new OscarException("Le filtrage par date implique des dates"); } Loading Loading @@ -354,7 +372,8 @@ class ActivityRepository extends EntityRepository ); } public function getActivitiesIdsAll() :array { public function getActivitiesIdsAll(): array { $qb = $this->createQueryBuilder('a') ->select('a.id'); Loading @@ -373,7 +392,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsWithoutOrganizationWithRole( int $idOrganization, int $idRole ) :array { public function getIdsWithoutOrganizationWithRole(int $idOrganization, int $idRole): array { $idsExclude = $this->getIdsForOrganizationWithRole($idOrganization, $idRole); $qb = $this->createQueryBuilder('a') ->select('a.id') Loading @@ -392,7 +412,8 @@ class ActivityRepository extends EntityRepository * @param int $idRole * @return array */ public function getIdsForOrganizationWithRole( int $idOrganization, int $idRole ) :array { public function getIdsForOrganizationWithRole(int $idOrganization, int $idRole): array { $qb = $this->createQueryBuilder('a') ->select('a.id') ->leftJoin('a.organizations', 'act_org') Loading @@ -400,8 +421,7 @@ class ActivityRepository extends EntityRepository ->leftJoin('prj.partners', 'prj_org') ->where( 'act_org.organization = :organization OR prj_org.organization = :organization' ) ; ); $parameters = [ Loading @@ -409,8 +429,10 @@ class ActivityRepository extends EntityRepository ]; if ($idRole > 0) { $qb->where('(act_org.organization = :organization AND act_org.roleObj = :role) ' .'OR (prj_org.organization = :organization AND prj_org.roleObj = :role)'); $qb->where( '(act_org.organization = :organization AND act_org.roleObj = :role) ' . 'OR (prj_org.organization = :organization AND prj_org.roleObj = :role)' ); $parameters['role'] = $idRole; } else { $qb->where('act_org.organization = :organization OR prj_org.organization = :organization'); Loading
module/Oscar/src/Oscar/Formatter/JSONFormatter.php +1 −1 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ class JSONFormatter $principal = $activityOrganization->getRoleObj() && $activityOrganization->getRoleObj()->isPrincipal(); if ($principal) { if (!array_key_exists($role, $datas['organizations'])) { if (!array_key_exists($role, $datas['organizations_primary'])) { $datas['organizations_primary'][$role] = []; } $datas['organizations_primary'][$role][] = $organization; Loading
module/Oscar/src/Oscar/Service/ProjectGrantService.php +4 −0 Original line number Diff line number Diff line Loading @@ -1197,6 +1197,10 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi ]; } public function getActivitiesIdsWithTypeDocument( array $idsTypeDocument ):array { return $this->getActivityRepository()->getActivitiesIdsWithTypeDocument($idsTypeDocument); } /** * Renomage des clefs pour les numérotations personnalisées; * Loading
module/Oscar/view/oscar/project-grant/advanced-search.phtml +27 −0 Original line number Diff line number Diff line Loading @@ -282,6 +282,25 @@ </article> </script> <script type="text/x-handlebars" id="typedocument-tpl"> <article class="criteria criteria-typedocument card"> <div class="icon-docs"></div> {{#if error}}<strong class="text-danger"><i class="icon-attention-1"></i> {{error}}</strong>{{/if}} <input type="hidden" name="criteria[]" class="criteria" value="{{criteria}}"/> <small>{{typeLabel}}</small> <select class="select2 form-control val1 changer types" id="filter_typeorga" multiple> <?php foreach( $documentsTypes as $typeDocId=>$typeDoc ): ?> <option value="<?= $typeDocId ?>"><?= $typeDoc ?></option> <?php endforeach; ?> </select> <nav> <a href="#" class="delete"> <i class="icon-cancel-outline"></i> </a> </nav> </article> </script> <script type="text/x-handlebars" id="milestones-criteria-tpl"> <article class="criteria criteria-{{type}} card"> <div class="icon-calendar"></div> Loading Loading @@ -758,6 +777,8 @@ var dom, applyChange; if( datas.type == 'ap' || datas.type == 'sp' || datas.type == 'ao' || datas.type == 'so' ){ dom = $(tpl(datas)); } Loading @@ -783,6 +804,11 @@ datas.label = "Pays d'une des organisations"; dom = $(tplCountry(datas)); } else if(datas.type == 'td' ){ //$documentsTypes datas.label = "Type de document"; dom = $(tplTypeDocument(datas)); } else if(datas.type == 'tnt' ) { datas.label = "Type d'organisation"; dom = $(tplTypeOrga(datas)); Loading Loading @@ -1041,6 +1067,7 @@ tplStatus = Handlebars.compile($('#status-criteria-tpl').html()), tplCountry = Handlebars.compile($('#country-tpl').html()), tplTypeOrga = Handlebars.compile($('#typeorga-tpl').html()), tplTypeDocument = Handlebars.compile($('#typedocument-tpl').html()), tplFinance = Handlebars.compile($('#finance-criteria-tpl').html()), tplType = Handlebars.compile($('#type-criteria-tpl').html()), tplDiscipline = Handlebars.compile($('#discipline-criteria-tpl').html()), Loading