Fixed range selection for bulk document printing to avoid unexpected blank page when...
[fa-stable.git] / reporting / rep409.php
index 2974d647fae7f98d4b654937ad10bf8b76ecb5d3..a4d41c7008f741b7f2ca8ffaee50ded4e054db07 100644 (file)
@@ -37,14 +37,12 @@ function print_workorders()
        $email = $_POST['PARAM_2'];
        $comments = $_POST['PARAM_3'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
-       $dec = user_price_dec();
+       if (!$from || !$to) return;
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 60, 190, 255, 320, 385, 450, 515);
 
@@ -64,7 +62,7 @@ function print_workorders()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                $myrow = get_work_order($i);
                if ($myrow === false)