Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bc40bcab

Von Moritz Bunkus vor fast 9 Jahren hinzugefügt

  • ID bc40bcabc425b99f3b79a5544684a6fe8674adfe
  • Vorgänger 9ebaa094
  • Nachfolger 0bf92081

(I)LIKE-Argumente immer mit Funktion SL::DBUtils::like erstellen

Unterschiede anzeigen:

SL/AP.pm
458 458
  }
459 459
  if ($form->{"cp_name"}) {
460 460
    $where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
461
    push(@values, ('%' . trim($form->{"cp_name"}) . '%')x2);
461
    push(@values, (like($form->{"cp_name"}))x2);
462 462
  }
463 463
  if ($form->{department}) {
464 464
    # ähnlich wie commit 0bbfb33b6aa8e38bb6c81d1684ab7d08e5b5c5af abteilung
SL/AR.pm
511 511
  }
512 512
  if ($form->{"cp_name"}) {
513 513
    $where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
514
    push(@values, ('%' . trim($form->{"cp_name"}) . '%')x2);
514
    push(@values, (like($form->{"cp_name"}))x2);
515 515
  }
516 516
  if ($form->{business_id}) {
517 517
    my $business_id = $form->{business_id};
......
524 524
    push(@values, $department_id);
525 525
  }
526 526
  if ($form->{department}) {
527
    my $department = "%" . trim($form->{department}) . "%";
527
    my $department = like($form->{department});
528 528
    $where .= " AND d.description ILIKE ?";
529 529
    push(@values, $department);
530 530
  }
SL/CP.pm
76 76
    qq|FROM chart | .
77 77
    qq|WHERE link LIKE ? |.
78 78
    qq|ORDER BY accno|;
79
  my $sth = prepare_execute_query($form, $dbh, $query, '%' . $ARAP . '%');
79
  my $sth = prepare_execute_query($form, $dbh, $query, like($ARAP));
80 80

  
81 81
  $form->{PR}{ $form->{ARAP} } = ();
82 82
  $form->{PR}{"$form->{ARAP}_paid"} = ();
SL/CT.pm
104 104

  
105 105
  if ($form->{"${cv}number"}) {
106 106
    $where .= " AND ct.${cv}number ILIKE ?";
107
    push(@values, '%' . $form->{"${cv}number"} . '%');
107
    push(@values, like($form->{"${cv}number"}));
108 108
  }
109 109

  
110 110
  foreach my $key (qw(name contact email)) {
111 111
    if ($form->{$key}) {
112 112
      $where .= " AND ct.$key ILIKE ?";
113
      push(@values, '%' . $form->{$key} . '%');
113
      push(@values, like($form->{$key}));
114 114
    }
115 115
  }
116 116

  
117 117
  if ($form->{cp_name}) {
118 118
    $where .= " AND ct.id IN (SELECT cp_cv_id FROM contacts WHERE lower(cp_name) LIKE lower(?))";
119
    push @values, '%' . $form->{cp_name} . '%';
119
    push @values, like($form->{cp_name});
120 120
  }
121 121

  
122 122
  if ($form->{addr_street}) {
......
127 127
              qq|         WHERE (sc.module = 'CT') | .
128 128
              qq|           AND (sc.shiptostreet ILIKE ?) | .
129 129
              qq|      ))) |;
130
    push @values, ('%' . $form->{addr_street} . '%') x 2;
130
    push @values, (like($form->{addr_street})) x 2;
131 131
  }
132 132

  
133 133
  if ($form->{addr_zipcode}) {
......
138 138
              qq|         WHERE (sc.module = 'CT') | .
139 139
              qq|           AND (sc.shiptozipcode ILIKE ?) | .
140 140
              qq|      ))) |;
141
    push @values, ('%' . $form->{addr_zipcode} . '%') x 2;
141
    push @values, (like($form->{addr_zipcode})) x 2;
142 142
  }
143 143

  
144 144
  if ($form->{addr_city}) {
......
151 151
                          AND (lower(sc.shiptocity) LIKE lower(?))
152 152
                      ))
153 153
                     )";
154
    push @values, ('%' . $form->{addr_city} . '%') x 2;
154
    push @values, (like($form->{addr_city})) x 2;
155 155
  }
156 156

  
157 157
  if ($form->{addr_country}) {
......
164 164
                          AND (lower(so.shiptocountry) LIKE lower(?))
165 165
                      ))
166 166
                     )";
167
    push @values, ('%' . $form->{addr_country} . '%') x 2;
167
    push @values, (like($form->{addr_country})) x 2;
168 168
  }
169 169

  
170 170
  if ($form->{addr_gln}) {
......
177 177
                          AND (lower(so.shiptogln) LIKE lower(?))
178 178
                      ))
179 179
                     )";
180
    push @values, ('%' . $form->{addr_gln} . '%') x 2;
180
    push @values, (like($form->{addr_gln})) x 2;
181 181
  }
182 182

  
183 183
  if ( $form->{status} eq 'orphaned' ) {
......
431 431
      'cp.cp_name      ILIKE ?',
432 432
      'cp.cp_givenname ILIKE ?',
433 433
      'cp.cp_email     ILIKE ?';
434
    push @values, ('%' . $params{search_term} . '%') x 3;
434
    push @values, (like($params{search_term})) x 3;
435 435

  
436 436
    if (($params{search_term} =~ m/\d/) && ($params{search_term} !~ m/[^\d \(\)+\-]/)) {
437 437
      my $number =  $params{search_term};
SL/CVar.pm
356 356
      next unless ($params{filter}->{$name});
357 357

  
358 358
      push @sub_where,  qq|cvar.text_value ILIKE ?|;
359
      push @sub_values, '%' . trim($params{filter}->{$name}) . '%'
359
      push @sub_values, like($params{filter}->{$name});
360 360

  
361 361
    } elsif ($config->{type} eq 'select') {
362 362
      next unless ($params{filter}->{$name});
......
419 419

  
420 420
      my $table = $config->{type};
421 421
      push @sub_where, qq|cvar.number_value * 1 IN (SELECT id FROM $table WHERE name ILIKE ?)|;
422
      push @sub_values, "%" . trim($params{filter}->{$name}) . "%";
422
      push @sub_values, like($params{filter}->{$name});
423 423
    } elsif ($config->{type} eq 'part') {
424 424
      next unless $params{filter}->{$name};
425 425

  
426 426
      push @sub_where, qq|cvar.number_value * 1 IN (SELECT id FROM parts WHERE partnumber ILIKE ?)|;
427
      push @sub_values, "%" . trim($params{filter}->{$name}) . "%";
427
      push @sub_values, like($params{filter}->{$name});
428 428
    }
429 429

  
430 430
    if (@sub_where) {
SL/Common.pm
62 62
    next unless $form->{$_};
63 63

  
64 64
    $filter .= qq| AND ($_ ILIKE ?)|;
65
    push @filter_values, '%' . $form->{$_} . '%';
65
    push @filter_values, like($form->{$_});
66 66
  }
67 67

  
68 68
  if ($form->{no_assemblies}) {
......
110 110
  my (@filter_values, $filter);
111 111
  if ($form->{"name"}) {
112 112
    $filter .= " AND (TABLE.name ILIKE ?)";
113
    push(@filter_values, '%' . $form->{"name"} . '%');
113
    push(@filter_values, like($form->{"name"}));
114 114
  }
115 115
  if (!$form->{"obsolete"}) {
116 116
    $filter .= " AND NOT TABLE.obsolete";
......
173 173
  my (@filter_values, $filter);
174 174
  if ($form->{"name"}) {
175 175
    $filter .= qq| (name ILIKE ?) AND|;
176
    push(@filter_values, '%' . $form->{"name"} . '%');
176
    push(@filter_values, like($form->{"name"}));
177 177
  }
178 178

  
179 179
  $order_by =~ s/[^a-zA-Z_]//g;
......
209 209
  my (@filter_values, $filter);
210 210
  if ($form->{"name"}) {
211 211
    $filter .= qq| (name ILIKE ?) AND|;
212
    push(@filter_values, '%' . $form->{"name"} . '%');
212
    push(@filter_values, like($form->{"name"}));
213 213
  }
214 214

  
215 215
  $order_by =~ s/[^a-zA-Z_]//g;
SL/Controller/BankTransaction.pm
23 23
use SL::DB::Tax;
24 24
use SL::DB::Draft;
25 25
use SL::DB::BankAccount;
26
use SL::DBUtils qw(like);
26 27
use SL::Presenter;
27 28
use List::Util qw(max);
28 29

  
......
277 278
  my @where_purchase = (amount => { ne => \'paid' });
278 279

  
279 280
  if ($::form->{invnumber}) {
280
    push @where_sale,     (invnumber => { ilike => '%' . $::form->{invnumber} . '%'});
281
    push @where_purchase, (invnumber => { ilike => '%' . $::form->{invnumber} . '%'});
281
    push @where_sale,     (invnumber => { ilike => like($::form->{invnumber})});
282
    push @where_purchase, (invnumber => { ilike => like($::form->{invnumber})});
282 283
  }
283 284

  
284 285
  if ($::form->{amount}) {
......
287 288
  }
288 289

  
289 290
  if ($::form->{vcnumber}) {
290
    push @where_sale,     ('customer.customernumber' => { ilike => '%' . $::form->{vcnumber} . '%'});
291
    push @where_purchase, ('vendor.vendornumber'     => { ilike => '%' . $::form->{vcnumber} . '%'});
291
    push @where_sale,     ('customer.customernumber' => { ilike => like($::form->{vcnumber})});
292
    push @where_purchase, ('vendor.vendornumber'     => { ilike => like($::form->{vcnumber})});
292 293
  }
293 294

  
294 295
  if ($::form->{vcname}) {
295
    push @where_sale,     ('customer.name' => { ilike => '%' . $::form->{vcname} . '%'});
296
    push @where_purchase, ('vendor.name'   => { ilike => '%' . $::form->{vcname} . '%'});
296
    push @where_sale,     ('customer.name' => { ilike => like($::form->{vcname})});
297
    push @where_purchase, ('vendor.name'   => { ilike => like($::form->{vcname})});
297 298
  }
298 299

  
299 300
  if ($::form->{transdatefrom}) {
SL/Controller/RecordLinks.pm
14 14
use SL::DB::PurchaseInvoice;
15 15
use SL::DB::RecordLink;
16 16
use SL::DB::RequirementSpec;
17
use SL::DBUtils qw(like);
17 18
use SL::JSON;
18 19
use SL::Locale::String;
19 20

  
......
124 125
  my $filter      = $self->link_type_desc->{filter};
125 126

  
126 127
  my @where = $filter && $manager->can($filter) ? $manager->$filter($self->link_type) : ();
127
  push @where, ("${vc}.${vc}number"     => { ilike => '%' . $::form->{vc_number} . '%' })               if $::form->{vc_number};
128
  push @where, ("${vc}.name"            => { ilike => '%' . $::form->{vc_name}   . '%' })               if $::form->{vc_name};
129
  push @where, ($description            => { ilike => '%' . $::form->{transaction_description} . '%' }) if $::form->{transaction_description};
130
  push @where, ($project_id             => $::form->{globalproject_id})                                 if $::form->{globalproject_id} && $manager->can($project_id);
128
  push @where, ("${vc}.${vc}number"     => { ilike => like($::form->{vc_number}) })               if $::form->{vc_number};
129
  push @where, ("${vc}.name"            => { ilike => like($::form->{vc_name}) })                 if $::form->{vc_name};
130
  push @where, ($description            => { ilike => like($::form->{transaction_description}) }) if $::form->{transaction_description};
131
  push @where, ($project_id             => $::form->{globalproject_id})                           if $::form->{globalproject_id} && $manager->can($project_id);
131 132

  
132 133
  my @with_objects = ($vc);
133 134
  push @with_objects, $project if $manager->can($project_id);
SL/Controller/TopQuickSearch/Contact.pm
5 5

  
6 6
use SL::Controller::CustomerVendor;
7 7
use SL::DB::Vendor;
8
use SL::DBUtils qw(selectfirst_array_query);
8
use SL::DBUtils qw(selectfirst_array_query like);
9 9
use SL::Locale::String qw(t8);
10 10

  
11 11
sub auth { 'customer_vendor_edit' }
......
22 22
  my $result = SL::DB::Manager::Contact->get_all(
23 23
    query => [
24 24
      or => [
25
        cp_name      => { ilike => "%$::form->{term}%" },
26
        cp_givenname => { ilike => "%$::form->{term}%" },
27
        cp_email     => { ilike => "%$::form->{term}%" },
25
        cp_name      => { ilike => like($::form->{term}) },
26
        cp_givenname => { ilike => like($::form->{term}) },
27
        cp_email     => { ilike => like($::form->{term}) },
28 28
      ],
29 29
      cp_cv_id => [ \'SELECT id FROM customer UNION SELECT id FROM vendor' ],
30 30
    ],
SL/Controller/TopQuickSearch/GLTransaction.pm
8 8
use SL::DB::PurchaseInvoice;
9 9
use SL::DB::AccTransaction;
10 10
use SL::Locale::String qw(t8);
11
use SL::DBUtils qw(like);
11 12
use List::Util qw(sum);
12 13

  
13 14
sub auth { 'general_ledger' }
......
24 25
  my $limit = $::form->{limit} || 40; # max number of results per type (AR/AP/GL)
25 26
  my $term  = $::form->{term}  || '';
26 27

  
27
  my $descriptionquery = { ilike => '%' . $term . '%' };
28
  my $referencequery   = { ilike => '%' . $term . '%' };
29
  my $apinvnumberquery = { ilike => '%' . $term . '%' };
30
  my $namequery        = { ilike => '%' . $term . '%' };
31
  my $arinvnumberquery = { ilike => '%' . $term       };
28
  my $descriptionquery = { ilike => like($term) };
29
  my $referencequery   = { ilike => like($term) };
30
  my $apinvnumberquery = { ilike => like($term) };
31
  my $namequery        = { ilike => like($term) };
32
  my $arinvnumberquery = { ilike => '%' . SL::Util::trim($term) };
32 33
  # ar match is more restrictive. Left fuzzy beginning so it also matches "Storno zu $INVNUMBER"
33 34
  # and numbers like 000123 if you only enter 123.
34 35
  # When used in quicksearch short numbers like 1 or 11 won't match because of the
SL/DBUtils.pm
348 348
    id     => \&conv_i,
349 349
    bool   => \&conv_b,
350 350
    date   => \&conv_date,
351
    start  => sub { $_[0] . '%' },
352
    end    => sub { '%' . $_[0] },
353
    substr => sub { '%' . $_[0] . '%' },
351
    start  => sub { trim($_[0]) . '%' },
352
    end    => sub { '%' . trim($_[0]) },
353
    substr => sub { like($_[0]) },
354 354
  );
355 355

  
356 356
  my $_long_token = sub {
SL/DN.pm
492 492

  
493 493
  } elsif ($form->{customer}) {
494 494
    $where .= qq| AND (ct.name ILIKE ?)|;
495
    push(@values, '%' . trim($form->{customer}) . '%');
495
    push(@values, like($form->{customer}));
496 496
  }
497 497

  
498 498
  my %columns = (
......
504 504
  foreach my $key (keys(%columns)) {
505 505
    next unless ($form->{$key});
506 506
    $where .= qq| AND $columns{$key} ILIKE ?|;
507
    push(@values, '%' . trim($form->{$key}) . '%');
507
    push(@values, like($form->{$key}));
508 508
  }
509 509

  
510 510
  if ($form->{dunning_level}) {
......
619 619

  
620 620
  } elsif ($form->{customer}) {
621 621
    $where .= qq| AND (ct.name ILIKE ?)|;
622
    push(@values, '%' . $form->{customer} . '%');
622
    push(@values, like($form->{customer}));
623 623
  }
624 624

  
625 625
  my %columns = (
......
630 630
  foreach my $key (keys(%columns)) {
631 631
    next unless ($form->{$key});
632 632
    $where .= qq| AND $columns{$key} ILIKE ?|;
633
    push(@values, '%' . $form->{$key} . '%');
633
    push(@values, like($form->{$key}));
634 634
  }
635 635

  
636 636
  if ($form->{dunning_level}) {
SL/DO.pm
111 111

  
112 112
  } elsif ($form->{$vc}) {
113 113
    push @where,  qq|ct.name ILIKE ?|;
114
    push @values, '%' . trim($form->{$vc}) . '%';
114
    push @values, like($form->{$vc});
115 115
  }
116 116

  
117 117
  if ($form->{"cp_name"}) {
118 118
    push @where, "(cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
119
    push @values, ('%' . trim($form->{"cp_name"}) . '%')x2;
119
    push @values, (like($form->{"cp_name"}))x2;
120 120
  }
121 121

  
122 122
  foreach my $item (qw(employee_id salesman_id)) {
......
132 132
  foreach my $item (qw(donumber ordnumber cusordnumber transaction_description)) {
133 133
    next unless ($form->{$item});
134 134
    push @where,  qq|dord.$item ILIKE ?|;
135
    push @values, '%' . trim($form->{$item}) . '%';
135
    push @values, like($form->{$item});
136 136
  }
137 137

  
138 138
  if (($form->{open} || $form->{closed}) &&
......
147 147

  
148 148
  if ($form->{serialnumber}) {
149 149
    push @where, 'dord.id IN (SELECT doi.delivery_order_id FROM delivery_order_items doi WHERE doi.serialnumber LIKE ?)';
150
    push @values, '%' . trim($form->{serialnumber}) . '%';
150
    push @values, like($form->{serialnumber});
151 151
  }
152 152

  
153 153
  if($form->{transdatefrom}) {
SL/FU.pm
210 210
  foreach my $item (qw(subject body)) {
211 211
    next unless ($params{$item});
212 212
    $where .= qq| AND (n.${item} ILIKE ?)|;
213
    push @values, '%' . $params{$item} . '%';
213
    push @values, like($params{$item});
214 214
  }
215 215

  
216 216
  if ($params{reference}) {
......
219 219
                              WHERE (ful.follow_up_id = fu.id)
220 220
                                AND (ful.trans_info ILIKE ?)
221 221
                              LIMIT 1)|;
222
    push @values, '%' . $params{reference} . '%';
222
    push @values, like($params{reference});
223 223
  }
224 224

  
225 225
  if ($params{follow_up_date_from}) {
SL/Form.pm
2499 2499
    my $where;
2500 2500
    if ($self->{customernumber} ne "") {
2501 2501
      $where = qq|(vc.customernumber ILIKE ?)|;
2502
      push(@values, '%' . $self->{customernumber} . '%');
2502
      push(@values, like($self->{customernumber}));
2503 2503
    } else {
2504 2504
      $where = qq|(vc.name ILIKE ?)|;
2505
      push(@values, '%' . $self->{$table} . '%');
2505
      push(@values, like($self->{$table}));
2506 2506
    }
2507 2507

  
2508 2508
    $query =
......
2519 2519
         JOIN $table vc ON (a.${table}_id = vc.id)
2520 2520
         WHERE NOT (a.amount = a.paid) AND (vc.name ILIKE ?)
2521 2521
         ORDER BY vc.name~;
2522
    push(@values, '%' . $self->{$table} . '%');
2522
    push(@values, like($self->{$table}));
2523 2523
  }
2524 2524

  
2525 2525
  $self->{name_list} = selectall_hashref_query($self, $dbh, $query, @values);
......
2744 2744

  
2745 2745
    $sth = $dbh->prepare($query);
2746 2746

  
2747
    do_statement($self, $sth, $query, '%' . $module . '%');
2747
    do_statement($self, $sth, $query, like($module));
2748 2748

  
2749 2749
    $self->{accounts} = "";
2750 2750
    while ($ref = $sth->fetchrow_hashref("NAME_lc")) {
......
2819 2819
                ORDER BY c.accno|;
2820 2820

  
2821 2821
    $sth = $dbh->prepare($query);
2822
    do_statement($self, $sth, $query, "%$module%");
2822
    do_statement($self, $sth, $query, like($module));
2823 2823

  
2824 2824
    $self->{accounts} = "";
2825 2825
    while ($ref = $sth->fetchrow_hashref("NAME_lc")) {
SL/IC.pm
878 878
  if ($form->{all}) {
879 879
    $form->{"l_$_"} = 1 for qw(partnumber description unit sellprice lastcost cvar_packaging linetotal);
880 880
    push @where_tokens, "p.partnumber ILIKE ? OR p.description ILIKE ?";
881
    push @bind_vars,    "%$form->{all}%", "%$form->{all}%";
881
    push @bind_vars,    (like($form->{all})) x 2;
882 882
  }
883 883

  
884 884
  # special case insertdate
......
1342 1342
  # connect to database
1343 1343
  my $dbh = $form->get_standard_dbh;
1344 1344

  
1345
  my @values = ('%' . $module . '%');
1345
  my @values = like($module);
1346 1346
  my $query;
1347 1347

  
1348 1348
  if ($form->{id}) {
SL/IR.pm
1234 1234
    my $field = (split m{\.}, $table_column)[1];
1235 1235
    next unless $form->{"${field}_${i}"};
1236 1236
    $where .= " AND lower(${table_column}) LIKE lower(?)";
1237
    push @values, '%' . $form->{"${field}_${i}"} . '%';
1237
    push @values, like($form->{"${field}_${i}"});
1238 1238
  }
1239 1239

  
1240 1240
  my (%mm_by_id);
......
1248 1248
      LEFT JOIN parts ON parts.id = parts_id
1249 1249
      WHERE NOT parts.obsolete AND model ILIKE ? AND (make IS NULL OR make = ?);
1250 1250
    |;
1251
    my $mm_results = selectall_hashref_query($::form, $dbh, $mm_query, '%' . $form->{"partnumber_$i"} . '%', $::form->{vendor_id});
1251
    my $mm_results = selectall_hashref_query($::form, $dbh, $mm_query, like($form->{"partnumber_$i"}), $::form->{vendor_id});
1252 1252
    my @mm_ids     = map { $_->{parts_id} } @$mm_results;
1253 1253
    push @{$mm_by_id{ $_->{parts_id} } ||= []}, $_ for @$mm_results;
1254 1254

  
SL/IS.pm
2227 2227
    my ($table, $field) = split m/\./, $column;
2228 2228
    next if !$form->{"${field}_${i}"};
2229 2229
    $where .= qq| AND lower(${column}) ILIKE ?|;
2230
    push @values, '%' . $form->{"${field}_${i}"} . '%';
2230
    push @values, like($form->{"${field}_${i}"});
2231 2231
  }
2232 2232

  
2233 2233
  my (%mm_by_id);
......
2239 2239
    my $mm_query = qq|
2240 2240
      SELECT parts_id, model FROM makemodel LEFT JOIN parts ON parts.id = parts_id WHERE NOT parts.obsolete AND model ILIKE ?;
2241 2241
    |;
2242
    my $mm_results = selectall_hashref_query($::form, $dbh, $mm_query, '%' . $form->{"partnumber_$i"} . '%');
2242
    my $mm_results = selectall_hashref_query($::form, $dbh, $mm_query, like($form->{"partnumber_$i"}));
2243 2243
    my @mm_ids     = map { $_->{parts_id} } @$mm_results;
2244 2244
    push @{$mm_by_id{ $_->{parts_id} } ||= []}, $_ for @$mm_results;
2245 2245

  
SL/OE.pm
159 159
        WHERE proi.projectnumber ILIKE ? AND oi.trans_id = o.id
160 160
      ))
161 161
SQL
162
    push @values, "%" . $form->{"projectnumber"} . "%", "%" . $form->{"projectnumber"} . "%" ;
162
    push @values, like($form->{"projectnumber"}), like($form->{"projectnumber"});
163 163
  }
164 164

  
165 165
  if ($form->{"business_id"}) {
......
173 173

  
174 174
  } elsif ($form->{$vc}) {
175 175
    $query .= " AND ct.name ILIKE ?";
176
    push(@values, '%' . trim($form->{$vc}) . '%');
176
    push(@values, like($form->{$vc}));
177 177
  }
178 178

  
179 179
  if ($form->{"cp_name"}) {
180 180
    $query .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
181
    push(@values, ('%' . trim($form->{"cp_name"}) . '%')x2);
181
    push(@values, (like($form->{"cp_name"}))x2);
182 182
  }
183 183

  
184 184
  if (!$main::auth->assert('sales_all_edit', 1)) {
......
209 209

  
210 210
  if ($form->{$ordnumber}) {
211 211
    $query .= qq| AND o.$ordnumber ILIKE ?|;
212
    push(@values, '%' . trim($form->{$ordnumber}) . '%');
212
    push(@values, like($form->{$ordnumber}));
213 213
  }
214 214

  
215 215
  if ($form->{cusordnumber}) {
216 216
    $query .= qq| AND o.cusordnumber ILIKE ?|;
217
    push(@values, '%' . trim($form->{cusordnumber}) . '%');
217
    push(@values, like($form->{cusordnumber}));
218 218
  }
219 219

  
220 220
  if($form->{transdatefrom}) {
......
249 249

  
250 250
  if ($form->{shippingpoint}) {
251 251
    $query .= qq| AND o.shippingpoint ILIKE ?|;
252
    push(@values, '%' . trim($form->{shippingpoint}) . '%');
252
    push(@values, like($form->{shippingpoint}));
253 253
  }
254 254

  
255 255
  if ($form->{taxzone_id} ne '') { # taxzone_id could be 0
......
259 259

  
260 260
  if ($form->{transaction_description}) {
261 261
    $query .= qq| AND o.transaction_description ILIKE ?|;
262
    push(@values, '%' . trim($form->{transaction_description}) . '%');
262
    push(@values, like($form->{transaction_description}));
263 263
  }
264 264

  
265 265
  if ($form->{periodic_invoices_active} ne $form->{periodic_invoices_inactive}) {
......
296 296
      ct.name     ILIKE ? OR
297 297
      o.transaction_description ILIKE ?
298 298
    )| for @tokens;
299
    push @values, ("%$_%")x4 for @tokens;
299
    push @values, (like($_))x4 for @tokens;
300 300
  }
301 301

  
302 302
  my ($cvar_where, @cvar_values) = CVar->build_filter_query('module'         => 'CT',
SL/PE.pm
52 52

  
53 53
  if ($form->{partsgroup}) {
54 54
    $where .= qq| AND partsgroup ILIKE ?|;
55
    push(@values, '%' . $form->{partsgroup} . '%');
55
    push(@values, like($form->{partsgroup}));
56 56
  }
57 57

  
58 58
  if ($form->{status} eq 'orphaned') {
......
174 174

  
175 175
  if ($form->{pricegroup}) {
176 176
    $where .= qq| AND pricegroup ILIKE ?|;
177
    push(@values, '%' . $form->{pricegroup} . '%');
177
    push(@values, like($form->{pricegroup}));
178 178
  }
179 179

  
180 180
  if ($form->{status} eq 'orphaned') {
SL/RP.pm
1521 1521
  my $invnumber;
1522 1522
  my $reference;
1523 1523
  if ($form->{reference}) {
1524
    $reference = $dbh->quote('%' . $form->{reference} . '%');
1524
    $reference = $dbh->quote(like($form->{reference}));
1525 1525
    $invnumber = " AND (a.invnumber LIKE $reference)";
1526 1526
    $reference = " AND (a.reference LIKE $reference)";
1527 1527
  }
1528 1528
  if ($form->{source}) {
1529
    $where .= " AND (ac.source ILIKE " . $dbh->quote('%' . $form->{source} . '%') . ") ";
1529
    $where .= " AND (ac.source ILIKE " . $dbh->quote(like($form->{source})) . ") ";
1530 1530
  }
1531 1531
  if ($form->{memo}) {
1532
    $where .= " AND (ac.memo ILIKE " . $dbh->quote('%' . $form->{memo} . '%') . ") ";
1532
    $where .= " AND (ac.memo ILIKE " . $dbh->quote(like($form->{memo})) . ") ";
1533 1533
  }
1534 1534

  
1535 1535
  my %sort_columns =  (
SL/SEPA.pm
322 322

  
323 323
  if ($filter->{invnumber}) {
324 324
    push @where_sub,  "arap.invnumber ILIKE ?";
325
    push @values_sub, '%' . $filter->{invnumber} . '%';
325
    push @values_sub, like($filter->{invnumber});
326 326
    $joins_sub{$arap} = 1;
327 327
  }
328 328

  
329 329
  if ($filter->{message_id}) {
330
    push @values, '%' . $filter->{message_id} . '%';
330
    push @values, like($filter->{message_id});
331 331
    push @where,  <<SQL;
332 332
      se.id IN (
333 333
        SELECT sepa_export_id
......
339 339

  
340 340
  if ($filter->{vc}) {
341 341
    push @where_sub,  "vc.name ILIKE ?";
342
    push @values_sub, '%' . $filter->{vc} . '%';
342
    push @values_sub, like($filter->{vc});
343 343
    $joins_sub{$arap} = 1;
344 344
    $joins_sub{vc}    = 1;
345 345
  }
SL/VK.pm
120 120
  }
121 121
  if ($form->{partnumber}) {
122 122
    $where .= qq| AND (p.partnumber ILIKE ?)|;
123
    push(@values, '%' . $form->{partnumber} . '%');
123
    push(@values, like($form->{partnumber}));
124 124
  }
125 125
  if ($form->{partsgroup_id}) {
126 126
    $where .= qq| AND (pg.id = ?)|;
......
128 128
  }
129 129
  if ($form->{country}) {
130 130
    $where .= qq| AND (ct.country ILIKE ?)|;
131
    push(@values, '%' . $form->{country} . '%');
131
    push(@values, like($form->{country}));
132 132
  }
133 133

  
134 134
  # when filtering for parts by description we probably want to filter by the description of the part as per the master data
......
136 136
  # at least in the translation case we probably want the report to also include translated articles, so we have to filter via parts.description
137 137
  if ($form->{description}) {
138 138
    $where .= qq| AND (p.description ILIKE ?)|;
139
    push(@values, '%' . $form->{description} . '%');
139
    push(@values, like($form->{description}));
140 140
  }
141 141
  if ($form->{transdatefrom}) {
142 142
    $where .= " AND ar.transdate >= ?";

Auch abrufbar als: Unified diff