From 8bd9c500423d1184629885136068e2246db008c8 Mon Sep 17 00:00:00 2001
From: "Martin Helmling mh@waldpark.octosoft.eu" <martin.helmling@octosoft.eu>
Date: Thu, 2 Jun 2016 07:41:42 +0200
Subject: [PATCH] Einkaufsrechnungen: Suche nach Artikelnummer/-beschreibung in
 Positionen(2)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

BUGfix für substr($where, 0, 4, " WHERE "):
$where muss am Anfang innerhalb 4 Zeichen das AND stehen haben,
sonst kommt es zu einem SQL Syntaxerror
---
 SL/AP.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/SL/AP.pm b/SL/AP.pm
index 92dc733ad..594728546 100644
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -482,7 +482,7 @@ sub ap_transactions {
   }
   if ($form->{project_id}) {
     $where .=
-      qq|AND ((a.globalproject_id = ?) OR EXISTS | .
+      qq| AND ((a.globalproject_id = ?) OR EXISTS | .
       qq|  (SELECT * FROM invoice i | .
       qq|   WHERE i.project_id = ? AND i.trans_id = a.id) | .
       qq| OR EXISTS | .
@@ -509,7 +509,7 @@ sub ap_transactions {
 
   if ($form->{parts_partnumber}) {
     $where .= <<SQL;
-      AND EXISTS (
+ AND EXISTS (
         SELECT invoice.trans_id
         FROM invoice
         LEFT JOIN parts ON (invoice.parts_id = parts.id)
@@ -523,7 +523,7 @@ SQL
 
   if ($form->{parts_description}) {
     $where .= <<SQL;
-      AND EXISTS (
+ AND EXISTS (
         SELECT invoice.trans_id
         FROM invoice
         WHERE (invoice.trans_id = a.id)
-- 
2.20.1