Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 945cd936

Von Sven Schöling vor etwa 13 Jahren hinzugefügt

  • ID 945cd9362ec39f5c253aa9eda6aed3b8491abcd6
  • Vorgänger e340c957
  • Nachfolger a5fe0a32

ParseFilter: Bugfix bei short circuit bedingung

Test angepasst

Unterschiede anzeigen:

SL/Controller/Helper/ParseFilter.pm
39 39
  _launder_keys($filter) unless $params{no_launder};
40 40

  
41 41
  return
42
    query => $query,
43
    @$objects ? ( with_objects => [ uniq @$objects ]) : ();
42
    ($query   && @$query   ? (query => $query) : ()),
43
    ($objects && @$objects ? ( with_objects => [ uniq @$objects ]) : ());
44 44
}
45 45

  
46 46
sub _launder_keys {
......
61 61
  my ($filter, $with_objects, $prefix, %params) = @_;
62 62

  
63 63
  return () unless 'HASH'  eq ref $filter;
64
  $with_objects = [];
64
  $with_objects ||= [];
65 65

  
66 66
  my @result;
67 67

  
t/controllers/helpers/parse_filter.t
22 22
}
23 23

  
24 24
test { }, {
25
  query => []
26 25
}, 'minimal test';
27 26

  
28 27
test {
......
52 51
  }
53 52
}, {
54 53
  query => [ 'customer.chart.accno' => 'test' ],
55
  with_objects => [ 'customer', 'chart' ],
54
  with_objects => bag( 'customer', 'chart' ),
56 55
}, 'nested joins';
57 56

  
58 57
test {
......
76 75
},
77 76
{
78 77
  query => [ 'customer.chart.accno' => { like => '%1200' } ],
79
  with_objects => ['customer', 'chart' ],
78
  with_objects => bag('customer', 'chart' ),
80 79
}, 'all together';
81 80

  
82 81

  
......
94 93
               'invoice.customer.name'  => 'test',
95 94
               'customer.name'          => 'test',
96 95
             }} ],
97
  'with_objects' => [
98
                      'invoice',
99
                      'customer'
100
                    ]
96
  'with_objects' => bag( 'invoice', 'customer' )
101 97
}, 'object in more than one relationship';
102 98

  
103 99
test {

Auch abrufbar als: Unified diff