Fixed range selection for bulk document printing to avoid unexpected blank page when...
[fa-stable.git] / reporting / rep110.php
index ad19c6b1d5e0223bf751f15ba7206dae4a4d6dd7..cadfc522faaa708d481783878d95e297ff1d7d3f 100644 (file)
@@ -44,14 +44,14 @@ function print_deliveries()
        $packing_slip = $_POST['PARAM_3'];
        $comments = $_POST['PARAM_4'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
@@ -74,7 +74,7 @@ function print_deliveries()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                        if (!exists_customer_trans(ST_CUSTDELIVERY, $i))
                                continue;