In case of document reference already in use, FA suggest the next number (if possible...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 24 Jan 2013 12:53:06 +0000 (13:53 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Thu, 24 Jan 2013 12:53:06 +0000 (13:53 +0100)
sales/sales_order_entry.php

index 23410132e3290a820e37c2f90061117ccb212609..98cf5411d64c99bd76528fffe5b63f1007f5fe27 100644 (file)
@@ -439,6 +439,13 @@ if (isset($_POST['ProcessOrder']) && can_process()) {
        if ($ret == -1)
        {
                display_error(_("The entered reference is already in use."));
+               $ref = get_next_reference($_SESSION['Items']->trans_type);
+               if ($ref != $_SESSION['Items']->reference)
+               {
+                       display_error(_("The reference number field has been increased. Please save the document again."));
+                       $_POST['ref'] = $_SESSION['Items']->reference = $ref;
+                       $Ajax->activate('ref');
+               }       
                set_focus('ref');
        }
        else