Fixed range selection for bulk document printing to avoid unexpected blank page when...
[fa-stable.git] / reporting / rep210.php
index 072e8d90721620324d92d69496005342fc4a301c..1b80b72e8368814d54efb411a981ce736be07519 100644 (file)
@@ -71,14 +71,14 @@ function print_remittances()
        $email = $_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, 85, 150, 225, 275, 360, 450, 515);
 
@@ -98,7 +98,7 @@ function print_remittances()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                if ($fno[0] == $tno[0])
                        $types = array($fno[1]);