Project

General

Profile

Souhaits #907 » AdvancedMembersList.php.diff

Alain Castera, 03/12/2019 05:12 PM

View differences:

AdvancedMembersList.php 2019-03-11 17:47:24.000000000 +0100
116 116
        'contrib_min_amount',
117 117
        'contrib_max_amount',
118 118
        'contrib_dynamic',
119
        'free_search'
119
        'free_search',
120
        'groups_search', //modification for multiple groups search
121
        'groups_search_log_op' //modification for multiple groups search
120 122
    );
121 123

  
122 124
    protected $virtuals_advancedmemberslist_fields = array(
......
146 148
        )
147 149
    );
148 150

  
151
/** modification for multiple groups search */
152
    //an empty group search criteria to begin
153
    private $_groups_search = array(
154
        'empty' => array(
155
            'group'    => '',
156
        )
157
    );
158
  // "Oring" groups in search by default
159
    private $_groups_search_log_op = self::OP_OR;
160

  
161
/** end of modifications for multiple groups search */
162

  
149 163
    //an empty contributions dynamic field criteria to begin
150 164
    private $_contrib_dynamic = array(
151 165
        'empty' => array(
......
237 251
            )
238 252
        );
239 253

  
254
/** modification for multiple groups search
255
*/
256
        $this->_groups_search = array(
257
            'empty' => array(
258
                'group'     => '',
259
            )
260
        );
261

  
262
   $this->_groups_search_log_op = self::OP_OR;
263

  
264
/** end modification for multiple groups search*/
265

  
240 266
        $this->_contrib_dynamic = array(
241 267
            'empty' => array(
242 268
                'field'     => '',
......
546 572
                        );
547 573
                    }
548 574
                    break;
575
/** modification for multiple groups search */
576
            case 'groups_search':
577
                if ( isset($this->_groups_search['empty']) ) {
578
                    unset($this->_groups_search['empty']);
579
              }
580
                if ( is_array($value) ) {
581
                    if ( isset($value['group'])
582
                       && isset($value['idx'])
583
                    ) {
584
                        $id = $value['idx'];
585
                        unset($value['idx']);
586
                        $this->_groups_search[$id] = $value;
587
                    } else {
588
                        Analog::log(
589
                            '[AdvancedMembersList] bad construct for group filter',
590
                            Analog::WARNING
591
                        );
592
                    }
593
                } else {
594
                    Analog::log(
595
                        '[AdvancedMembersList] Value for group filter should be an '
596
                        .'array (' . gettype($value) . ' given',
597
                        Analog::WARNING
598
                    );
599
                }
600
                break;
601
       case 'groups_logical_operator':
602
       case 'groups_search_log_op': // TBD : change this, shame on me !
603
           if ($value == self::OP_AND || $value == self::OP_OR)
604
           {
605
                        $this->_groups_search_log_op = $value;
606
           } else {
607
             Analog::log(
608
                        '[AdvancedMembersList] Value for group filter logical operator should be '
609
                        .' in [0,1] (' . gettype($value) . '-> '.$value.' given )',
610
                        Analog::WARNING
611
                    );
612
           }
613
                break;
614
/** end of modification for multiple groups search */
549 615
                default:
550 616
                    if (substr($name, 0, 4) === 'cds_'
551 617
                        || substr($name, 0, 5) === 'cdsc_'
(10-10/11)