Browse code

invoice: only update invoices that are not payed yet

Bernd Wurst authored on27/08/2021 06:31:00
Showing1 changed files
... ...
@@ -252,8 +252,10 @@ function sepamandat($name, $adresse, $iban, $bankname, $bic, $gueltig_ab)
252 252
                 ":today" => $today, ":gueltig_ab" => $gueltig_ab, ":name" => $name, ":adresse" => $adresse,
253 253
                 ":iban" => $iban, ":bic" => $bic, ":bankname" => $bankname)
254 254
     );
255
-    db_query("UPDATE kundendaten.ausgestellte_rechnungen SET abbuchung=1 WHERE kunde = :cid AND datum >= :gueltig_ab",
256
-        array(":cid" => $cid, ":gueltig_ab" => $gueltig_ab));
255
+    db_query(
256
+        "UPDATE kundendaten.ausgestellte_rechnungen SET abbuchung=1 WHERE kunde = :cid AND datum >= :gueltig_ab and bezahlt=0",
257
+        array(":cid" => $cid, ":gueltig_ab" => $gueltig_ab)
258
+    );
257 259
 }
258 260
 
259 261