Commit a2808cf1 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Ajout d'un filtre sur les avenants dans la recherche avancées

parent 12ac54f4
Loading
Loading
Loading
Loading
+0 −30
Changes for module/Oscar/src/Oscar/Controller/ActivityAvenantsControllerFactory.php: 0 added lines, 30 removed lines.
Original line number Diff line number Diff line
<?php
/**
 * Created by PhpStorm.
 * User: bouvry
 * Date: 27/09/19
 * Time: 15:50
 */

namespace Oscar\Controller;


use Interop\Container\ContainerInterface;
use Oscar\Service\ActivityAvenantsService;
use Oscar\Service\ActivityLogService;
use Oscar\Service\LoggerService;
use Oscar\Service\MilestoneService;
use Oscar\Service\OscarUserContext;
use Oscar\Service\ProjectGrantService;
use Laminas\ServiceManager\Factory\FactoryInterface;
class ActivityAvenantsControllerFactory extends AbstractOscarController
{
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $c = new ActivityAvenantsController();
        $c->setActivityAvenantsService(ActivityAvenantsService::class);
        $c->setLoggerService($container->get('Logger'));
        $c->setOscarUserContextService($container->get(OscarUserContext::class));
        return $c;
    }
}
 No newline at end of file
+14 −0
Changes for module/Oscar/src/Oscar/Entity/ActivityRepository.php: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -709,6 +709,20 @@ class ActivityRepository extends EntityRepository
        );
    }

    public function getActivityIdsWithAvenants(): array
    {
        $qb = $this->createQueryBuilder('a')
            ->select('a.id')
            ->innerJoin('a.avenants', 'av');

        return array_map(
            'current',
            $qb
                ->getQuery()
                ->getResult()
        );
    }

    public function getQueryActivityIdsWithWorkpackage(): QueryBuilder
    {
        $qb = $this->createQueryBuilder('a')
+11 −3
Changes for module/Oscar/src/Oscar/Service/ProjectGrantSearchService.php: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -36,14 +36,15 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U

    use UseEntityManagerTrait, UsePersonServiceTrait, UseOscarConfigurationServiceTrait, UseProjectGrantServiceTrait, UseLoggerServiceTrait, UseSpentServiceTrait;

    const FILTER_ACTIVITY_STATUS = 'as';
    const FILTER_ACTIVITY_STATUS_OUT = 'ss';
    const FILTER_AVENANT = 'avn';
    const FILTER_PERSON_ROLLED = 'ap';
    const FILTER_PERSON_ROLLED_OUT = 'sp';
    const FILTER_PERSONS = 'pm';
    const FILTER_ORGANIZATION_ROLLED = 'ao';
    const FILTER_ORGANIZATION_ROLLED_OUT = 'so';
    const FILTER_ORGANIZATIONS = 'om';
    const FILTER_ACTIVITY_STATUS = 'as';
    const FILTER_ACTIVITY_STATUS_OUT = 'ss';
    const FILTER_ORGANIZATION_COUNTRY = 'cnt';
    const FILTER_ORGANIZATION_TYPE = 'tnt';

@@ -111,6 +112,7 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
            self::FILTER_ACTIVITY_MILESTONE             => 'Ayant le jalon',
            self::FILTER_ACTIVITY_DOCUMENT_TYPE         => 'Ayant ce type de document',
            self::FILTER_ACTIVITY_TIMESHEET             => 'Activités soumise à feuille de temps',
            self::FILTER_AVENANT                        => 'Activités ayant des avenants',
            // Dates
            self::FILTER_ACTIVITY_DATE_START            => 'Date de début',
            self::FILTER_ACTIVITY_DATE_END              => 'Date de fin',
@@ -820,11 +822,17 @@ class ProjectGrantSearchService implements UseEntityManager, UsePersonService, U
                        break;

                    ///////////////////////////////// ACTIVITY / FEUILLE de TEMPS
                    case 'fdt' :
                    case self::FILTER_ACTIVITY_TIMESHEET :
                        $filteredIds = $this->getProjectGrantService()
                            ->getActivityRepository()->getActivityIdsWithWorkpackage();
                        break;

                    ///////////////////////////////// AVENANT
                    case self::FILTER_AVENANT :
                        $filteredIds = $this->getProjectGrantService()
                            ->getActivityRepository()->getActivityIdsWithAvenants();
                        break;

                    ///////////////////////////////// ACTIVITY / DATES
                    case 'add' :
                    case 'adf' :
+3 −0
Changes for module/Oscar/view/oscar/project-grant/advanced-search.phtml: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -907,6 +907,9 @@
                    else if(datas.type == 'fdt' ) {
                        dom = $(tplStatic(datas));
                    }
                    else if(datas.type == 'avn' ) {
                        dom = $(tplStatic(datas));
                    }
                    else if(datas.type == 'mp' ) {
                        dom = $(tplNumber(datas));
                    }