Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bc40bcab

Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt

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

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

Unterschiede anzeigen:

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};

Auch abrufbar als: Unified diff