PHP 8.2 Compatibility Improvement, better implementation.
[fa-stable.git] / sales / customer_payments.php
index 78561a9104b91531ea7b07e52261f452b0ef66fc..b9f945f8d34bdae28866d33714059c6cb2fb4c0c 100644 (file)
@@ -107,14 +107,14 @@ if (isset($_GET['AddedID'])) {
        submenu_print(_("&Email This Receipt"), ST_CUSTPAYMENT, $payment_no."-".ST_CUSTPAYMENT, null, 1);
 
        submenu_view(_("&View this Customer Payment"), ST_CUSTPAYMENT, $payment_no);
+       display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")), 0, 1);
 
        submenu_option(_("Enter Another &Customer Payment"), "/sales/customer_payments.php");
        submenu_option(_("Enter Other &Deposit"), "/gl/gl_bank.php?NewDeposit=Yes");
        submenu_option(_("Enter Payment to &Supplier"), "/purchasing/supplier_payment.php");
        submenu_option(_("Enter Other &Payment"), "/gl/gl_bank.php?NewPayment=Yes");
        submenu_option(_("Bank Account &Transfer"), "/gl/bank_transfer.php");
-
-       display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")));
+       submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_CUSTPAYMENT."&trans_no=$payment_no");
 
        display_footer_exit();
 }
@@ -261,8 +261,8 @@ function read_customer_data()
 
        $myrow = get_customer_habit($_POST['customer_id']);
 
-       $_POST['HoldAccount'] = $myrow["dissallow_invoices"];
-       $_POST['pymt_discount'] = $myrow["pymt_discount"];
+       $_POST['HoldAccount'] = !$myrow ? false : $myrow["dissallow_invoices"];
+       $_POST['pymt_discount'] = !$myrow ? 0 : $myrow["pymt_discount"];
        // To support Edit feature
        // If page is called first time and New entry fetch the nex reference number
        if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge'])) 
@@ -368,8 +368,8 @@ if ($cust_currency != $bank_currency)
 amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
 
 $row = get_customer($_POST['customer_id']);
-$_POST['dimension_id'] = $row['dimension_id'];
-$_POST['dimension2_id'] = $row['dimension2_id'];
+$_POST['dimension_id'] = !$row ? 0 : $row['dimension_id'];
+$_POST['dimension2_id'] = !$row ? 0 : $row['dimension2_id'];
 $dim = get_company_pref('use_dimension');
 if ($dim > 0)
     dimensions_list_row(_("Dimension").":", 'dimension_id',