1177: Print single receipt fails
[fa-stable.git] / reporting / rep113.php
index 4a110745cd02180823c77ce2fc423c1c526d1d69..bca06d1b2cea99c4dd07da2ade2d4e9b25be8ad6 100644 (file)
@@ -43,14 +43,14 @@ function print_credits()
        $paylink = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
 
-       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);
 
@@ -70,7 +70,7 @@ function print_credits()
                $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_CUSTCREDIT, $i))
                                continue;
@@ -204,7 +204,7 @@ function print_credits()
                        if ($email == 1)
                        {
                                $myrow['dimension_id'] = $paylink; // helper for pmt link
-                               $rep->End($email, '', $myrow, ST_CUSTCREDIT);
+                               $rep->End($email);
                        }
        }
        if ($email == 0)