Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1cd59d4

Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt

  • ID d1cd59d481286fc1dcd5aae5c1d09b41c5f3a729
  • Vorgänger 45ee0662
  • Nachfolger 9dfd320f

Volltext-Suche Auftrag: Kosmetik: Formatierung SQL-Statements

Unterschiede anzeigen:

SL/OE.pm
331 331
    $query .= ' AND (';
332 332
    $query .= join ' ILIKE ? OR ', @fulltext_fields;
333 333
    $query .= ' ILIKE ?';
334
    $query .= qq| OR EXISTS (SELECT files.id FROM files LEFT JOIN file_full_texts ON (file_full_texts.file_id = files.id) WHERE files.object_id = o.id AND files.object_type = 'sales_order' AND file_full_texts.full_text ILIKE ?)|;
335
    $query .= qq| OR EXISTS (SELECT notes.id FROM notes WHERE notes.trans_id = o.id AND notes.trans_module LIKE 'oe' AND (notes.subject ILIKE ? OR notes.body ILIKE ?))|;
336
    $query .= qq| OR EXISTS (SELECT follow_up_links.id FROM follow_up_links WHERE follow_up_links.trans_id = o.id AND trans_type = 'sales_order' AND EXISTS (SELECT notes.id FROM notes WHERE trans_module LIKE 'fu' AND trans_id = follow_up_links.follow_up_id AND (notes.subject ILIKE ? OR notes.body ILIKE ?)))|;
334

  
335
    $query .= <<SQL;
336
      OR EXISTS (
337
        SELECT files.id FROM files LEFT JOIN file_full_texts ON (file_full_texts.file_id = files.id)
338
          WHERE files.object_id = o.id AND files.object_type = 'sales_order'
339
            AND file_full_texts.full_text ILIKE ?)
340
SQL
341

  
342
    $query .= <<SQL;
343
      OR EXISTS (
344
        SELECT notes.id FROM notes
345
          WHERE notes.trans_id = o.id AND notes.trans_module LIKE 'oe'
346
            AND (notes.subject ILIKE ? OR notes.body ILIKE ?))
347
SQL
348

  
349
    $query .= <<SQL;
350
      OR EXISTS (
351
        SELECT follow_up_links.id FROM follow_up_links
352
          WHERE follow_up_links.trans_id = o.id AND trans_type = 'sales_order'
353
            AND EXISTS (
354
              SELECT notes.id FROM notes
355
                WHERE trans_module LIKE 'fu' AND trans_id = follow_up_links.follow_up_id
356
                  AND (notes.subject ILIKE ? OR notes.body ILIKE ?)))
357
SQL
358

  
337 359
    $query .= ')';
360

  
338 361
    push(@values, like($form->{fulltext})) for 1 .. (scalar @fulltext_fields) + 5;
339 362
  }
340 363

  

Auch abrufbar als: Unified diff