Do not allow editing of allocated sales invoices in Journal Inquiry.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 4 Jan 2012 23:33:38 +0000 (00:33 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 4 Jan 2012 23:33:38 +0000 (00:33 +0100)
gl/inquiry/journal_inquiry.php

index dccef78f5c568c503730cb8c06bedfc5504eb6cc..2d9eaabc93e32715f000b502fe905132bf526a1c 100644 (file)
@@ -107,7 +107,14 @@ function edit_link($row)
 {
        global $editors;
 
-       return isset($editors[$row["type"]]) && !is_closed_trans($row["type"], $row["type_no"]) ? 
+       $ok = true;
+       if ($row['type'] == ST_SALESINVOICE)
+       {
+               $myrow = get_customer_trans($row["type_no"], $row["type"]);
+               if ($myrow['alloc'] != 0 || get_voided_entry(ST_SALESINVOICE, $row["type_no"]) !== false)
+                       $ok = false;
+       }               
+       return isset($editors[$row["type"]]) && !is_closed_trans($row["type"], $row["type_no"]) && $ok ? 
                pager_link(_("Edit"), 
                        sprintf($editors[$row["type"]], $row["type_no"], $row["type"]),
                        ICON_EDIT) : '';