Commit 38beea20 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

UP : Le filtre par type d'activité a maintenant une option pour inclure ou pas les sous-types

parent 6ea9f4f7
Loading
Loading
Loading
Loading
Loading
+16 −3
Changes for module/Oscar/src/Oscar/Controller/ProjectGrantController.php: 16 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -221,8 +221,6 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
            'used_status' => $this->params()->fromQuery('st', []),
            'search' => $this->params()->fromQuery('q')
        ];


    }

    /**
@@ -1387,6 +1385,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
        /** @var Request $request */
        $request = $this->getRequest();
        if ($request->isPost()) {

            $validOrganizationForm = true;

            if ($withOrganization) {
@@ -1409,6 +1408,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                        $validOrganizationForm = true;
                    }
                }

                if (!$validOrganizationForm) {
                    $errorRoles = "Vous devez selectionner un rôle d'organisation";
                }
@@ -1443,7 +1443,11 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                }

                // Mise à jour de l'index de recherche
                try {
                    $this->getActivityService()->jobSearchUpdate($projectGrant);
                } catch (\Exception $e) {
                    $this->getLoggerService()->error($e->getMessage());
                }

                $this->redirect()->toRoute(
                    'contract/show',
@@ -2830,14 +2834,23 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif


                    case 'at' :

                        if (!isset($parameters['withtype'])) {
                            $parameters['withtype'] = [];
                            $qb->andWhere('c.activityType IN (:withtype)');
                        }

                        if( $value2 == 1 ){
                            $types = [$value1];
                        } else {
                            $types = $this->getActivityTypeService()->getTypeIdsInside($value1);
                        }

                        $parameters['withtype'] = array_merge(
                            $parameters['withtype'],
                            $this->getActivityTypeService()->getTypeIdsInside($value1)
                            $types
                        );
                        $result = $qb->setParameters($parameters)->getQuery()->getResult();
                        break;
                    case 'st' :
                        if (!isset($parameters['withouttype'])) {
+5 −1
Changes for module/Oscar/src/Oscar/Service/ProjectGrantService.php: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2537,9 +2537,13 @@ class ProjectGrantService implements UseGearmanJobLauncherService, UseOscarConfi
            $this->getEntityManager()->flush($organizationActivity);


            try {
                $this->jobSearchUpdate($activity);
            $this->getOrganizationService()->updateIndex($organization);
                $this->getGearmanJobLauncherService()->triggerUpdateSearchIndexOrganization($organization);
                $this->getNotificationService()->jobUpdateNotificationsActivity($activity);
            } catch (\Exception $e) {
                $this->getLoggerService()->error("Soucis d'appel avec Gearman");
            }

            $this->getActivityLogService()->addUserInfo(
                sprintf(" a ajouté l'organisation %s de l'activité %s", $organization->log(), $activity->log()),
+9 −1
Changes for module/Oscar/view/oscar/project-grant/advanced-search.phtml: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -175,6 +175,11 @@
                        value="<?= $id ?>"><?= $label ?></option>
                <?php endforeach; ?>
            </select>
            <select class="val2 changer">
                <option value="0">Et ces sous-types</option>
                <option value="1">Type seul</option>
            </select>

            <nav>
                <a href="#" class="delete">
                    <i class="icon-cancel-outline"></i>
@@ -699,7 +704,6 @@
                    };

                var addcriterie = function (datas) {
                    console.log("ADD", datas);
                    datas.typeLabel = (labelsType[datas.type]);
                    datas.criteria = datas.type + ";" + datas.val1 + ";" + datas.val2;

@@ -861,6 +865,10 @@
                        dom.find('.role').val(datas.val2);
                    }

                    if(datas.type == 'at'){
                        dom.find('.val2').val(datas.val2);
                    }

                    if(datas.type == 'add' || datas.type == 'adf' || datas.type == 'adm' || datas.type == 'ads' || datas.type == 'adp' || datas.type == 'adc') {
                        $('.datepicker').datepicker({
                            format: "yyyy-mm-dd",