Allowed reuse of supplier references from voided documents.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 17 Jun 2009 14:08:54 +0000 (14:08 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 17 Jun 2009 14:08:54 +0000 (14:08 +0000)
purchasing/supplier_invoice.php

index b2ea26a39e24aed0b343ac310fec8b14da19a30e..fa379e903e65365943143fde506e7c0b36c398c9 100644 (file)
@@ -189,7 +189,11 @@ function check_data()
                return false;
        }
 
-       $sql = "SELECT Count(*) FROM ".TB_PREF."supp_trans WHERE supplier_id='" . $_SESSION['supp_trans']->supplier_id . "' AND supp_reference='" . $_POST['supp_reference'] . "'";
+       $sql = "SELECT Count(*) FROM ".TB_PREF."supp_trans WHERE supplier_id='" 
+               . $_SESSION['supp_trans']->supplier_id . "' AND supp_reference='" 
+               . $_POST['supp_reference'] 
+               . "' AND ov_amount!=0"; // ignore voided invoice references
+
        $result=db_query($sql,"The sql to check for the previous entry of the same invoice failed");
 
        $myrow = db_fetch_row($result);