Bug 5687: Unable to dispatch SO for service items with u/m decimal places set as...
[fa-stable.git] / sales / customer_delivery.php
index c634a94e75109bf06a1fee1d597c014e29cb1db0..e58eb4a719c1cbe2859384a66f909c393f3a9327 100644 (file)
@@ -62,6 +62,8 @@ if (isset($_GET['AddedID'])) {
 
        hyperlink_params("$path_to_root/sales/inquiry/sales_orders_view.php", _("Select Another Order For Dispatch"), "OutstandingOnly=1");
 
+       hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=".ST_CUSTDELIVERY."&trans_no=$dispatch_no");
+
        display_footer_exit();
 
 } elseif (isset($_GET['UpdatedID'])) {
@@ -254,7 +256,9 @@ function check_quantities()
                        } else {
                                $min = 0;
                                // Fixing floating point problem in PHP.
-                               $max = round2($itm->quantity - $itm->qty_done, get_unit_dec($itm->stock_id));
+                               $dec = get_unit_dec($itm->stock_id);
+                               $dec = $dec == -1 ? user_qty_dec() : $dec;
+                               $max = round2($itm->quantity - $itm->qty_done, $dec);
                        }
 
                        if (check_num('Line'.$line, $min, $max)) {
@@ -264,7 +268,6 @@ function check_quantities()
                                set_focus('Line'.$line);
                                $ok = 0;
                        }
-
                }
 
                if (isset($_POST['Line'.$line.'Desc'])) {