Commit 2836c400 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Fix : Recherche par type de document

parent 72520d57
Loading
Loading
Loading
Loading
Loading
+3 −23
Original line number Diff line number Diff line
@@ -2666,34 +2666,11 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif

            $accountsInfos = $this->getSpentService()->getAccountsInfosUsed();

            $queryPersons = $this->getEntityManager()->createQueryBuilder()
                ->select('a.id')
                ->from(Activity::class, 'a', 'a.id')
                ->leftJoin('a.project', 'p')
                ->leftJoin('p.partners', 'o1')
                ->leftJoin('a.organizations', 'o2')
                ->leftJoin('p.members', 'm1')
                ->leftJoin('a.persons', 'm2')
                ->where('m1.person in(:ids) OR m2.person in (:ids)');


            $queryOrganisations = $this->getEntityManager()->createQueryBuilder()
                ->select('a.id')
                ->from(Activity::class, 'a', 'a.id')
                ->leftJoin('a.project', 'p')
                ->leftJoin('p.partners', 'o1')
                ->leftJoin('a.organizations', 'o2')
                ->leftJoin('p.members', 'm1')
                ->leftJoin('a.persons', 'm2')
                ->where('(o1.organization in(:ids) OR o2.organization IN(:ids))');


            // Paramètres de la requête finale
            $parameters = [];

            $projectIds = [];


            if (!$search && count($criteria) === 0) {
                $ids = [];
                if ($include) {
@@ -2772,6 +2749,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                    case 'vp':
                        $qb->addSelect('c.payments', 'p');
                        break;

                    case 'mp':
                        $clause = [];

@@ -2844,6 +2822,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif
                            $crit['error'] = "Impossible de filtrer sur la personne";
                        }
                        break;

                    case 'cb':
                        // Récupération de l'organisation
                        $value1 = $crit['val1'] = explode(',', $params[1]);
@@ -2878,6 +2857,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif

                            $ids = $this->getActivityService()
                                ->getActivitiesIdsWithTypeDocument($value1, $reverse);

                        } catch (\Exception $e) {
                            throw new OscarException($e->getMessage());
                        }
+9 −4
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@
        <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}}"/>
            <input type="text" name="criteria[]" class="criteria" value="{{criteria}}"/>
            <small>
                <strong></p>Ayant au moins un des types de document</strong>
                (Laisser vide pour n'importe quel type de document)
@@ -901,6 +901,7 @@
                        var checkboxs = filter.find('.val2[type="checkbox"]');

                        if( checkboxs.length > 1 ){
                            console.log("VAL2 CHECKBOX x BEAUCOUP");
                            var values = [];
                            checkboxs.each(i => {
                                var checkbox = checkboxs[i];
@@ -910,17 +911,19 @@
                            });
                            val2 = values.join(',');
                        } else if (checkboxs.length == 1){
                            console.log("VAL2 CHECKBOX x 1");
                            var val2Elem = filter.find('.val2');
                            if( val2Elem ){
                                val2 = val2Elem[0].checked ? "1" : "0";
                            }

                            console.log('Val2', val2);
                        }

                        // Select
                        var select = filter.find('select.val2');

                        if( select.length > 0 ){
                            console.log("VAL2 SELECT");
                            var val2Elem = filter.find('.val2');
                            if( val2Elem ){
                                val2 = val2Elem[0].value ? val2Elem[0].value : "0";
@@ -929,16 +932,18 @@
                        }

                        // Select
                        var input = filter.find('input.val2');
                        var input = filter.find('input[type="text"].val2');

                        if( input.length > 0 ){
                            console.log("VAL2 INPUT");
                            var val2Elem = filter.find('.val2');
                            if( val2Elem ){
                                val2 = val2Elem[0].value ? val2Elem[0].value : "";
                            }

                        }

                        console.log("VAL2:", val2);

                        filter.find('.criteria').val(datas.type
                            + ';' + filter.find('.val1').val()
                            + ';' + val2);