From: Joe Date: Thu, 16 May 2024 08:07:55 +0000 (+0200) Subject: PHP 8 rerun of number_format fix. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=HEAD;hp=a04e9f37e4d1c10c2dc7332940d9f5b7b80d8fd4;p=fa-stable.git PHP 8 rerun of number_format fix. --- diff --git a/includes/current_user.inc b/includes/current_user.inc index ac5f943e..bb7478cd 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -313,13 +313,12 @@ function number_format2($number, $decimals=0) $tsep = $SysPrefs->thoseps[user_tho_sep()]; $dsep = $SysPrefs->decseps[user_dec_sep()]; - if ($number == '') - $number = 0; + $number = (float)$number; if($decimals==='max') $dec = 15 - floor(log10(abs($number))); else { $delta = ($number < 0 ? -.0000000001 : .0000000001); - @$number += $delta; + $number += $delta; $dec = $decimals; } diff --git a/sales/includes/db/sales_order_db.inc b/sales/includes/db/sales_order_db.inc index f2c62840..a8be2045 100644 --- a/sales/includes/db/sales_order_db.inc +++ b/sales/includes/db/sales_order_db.inc @@ -465,7 +465,7 @@ function get_branch_to_order($customer_id, $branch_id) { PrepaidOrders */ function get_sql_for_sales_orders_view($trans_type, $trans_no, $filter, - $stock_item='', $from='', $to='', $ref='', $location=ALL_TEXT, $customer_id=ALL_TEXT, $show_voided = 0) + $stock_item='', $from='', $to='', $ref='', $location=ALL_TEXT, $customer_id=ALL_TEXT, $show_voided = 0, $by_delivery=0, $no_auto=0) { if ($filter=='OutstandingOnly') $order_value = 'Sum(line.unit_price*(line.quantity-line.qty_sent)*(1-line.discount_percent))+freight_cost'; @@ -530,10 +530,12 @@ function get_sql_for_sales_orders_view($trans_type, $trans_no, $filter, { $date_after = date2sql($from); $date_before = date2sql($to); - - $sql .= " AND sorder.ord_date >= '$date_after'" - ." AND sorder.ord_date <= '$date_before'"; + $by_date = $by_delivery ? 'delivery_date' : 'ord_date'; + $sql .= " AND sorder.$by_date >= '$date_after'" + ." AND sorder.$by_date <= '$date_before'"; } + if ($no_auto) + $sql .= " AND sorder.reference != 'auto'"; } if ($trans_type == ST_SALESQUOTE && !check_value('show_all')) $sql .= " AND sorder.delivery_date >= '".date2sql(Today())."' AND line.qty_sent=0"; // show only outstanding, not realized quotes diff --git a/sales/includes/sales_ui.inc b/sales/includes/sales_ui.inc index 9b762621..5da08723 100644 --- a/sales/includes/sales_ui.inc +++ b/sales/includes/sales_ui.inc @@ -46,7 +46,7 @@ function check_edit_conflicts($cart_id, $cartname='Items') { global $Ajax, $SysPrefs; - if ((!isset($SysPrefs->no_check_edit_conflicts) || $SysPrefs->no_check_edit_conflicts==0) && $cart_id && isset($_SESSION[$cartname]) && $cart_id != $_SESSION[$cartname]->cart_id) { + if ((!isset($SysPrefs->no_check_edit_conflicts) || $SysPrefs->no_check_edit_conflicts==0) && $cart_id && isset($_SESSION[$cartname]) && $cart_id != $_SESSION[$cartname]->cart_id) { display_error(_('This edit session has been abandoned by opening sales document in another browser tab. You cannot edit more than one sales document at once.')); $Ajax->activate('_page_body'); display_footer_exit(); diff --git a/sales/includes/ui/sales_credit_ui.inc b/sales/includes/ui/sales_credit_ui.inc index 9d9223f4..19b76c6d 100644 --- a/sales/includes/ui/sales_credit_ui.inc +++ b/sales/includes/ui/sales_credit_ui.inc @@ -78,7 +78,7 @@ function display_credit_header(&$order) $_POST['ref'] = $Refs->get_next(ST_CUSTCREDIT, null, array('customer' => get_post('customer_id'), 'branch' => get_post('branch_id'), 'date' => get_post('OrderDate'))); if ($order->trans_no==0) - ref_row(_("Reference").':', 'ref'); + ref_row(_("Reference").':', 'ref', _('Reference number unique for this document type'), null, '', $order->trans_type, array('date'=> @$_POST['OrderDate'])); else label_row(_("Reference").':', $order->reference); diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index c3e63ab5..3873114b 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -232,11 +232,17 @@ start_table(TABLESTYLE_NOBORDER); start_row(); ref_cells(_("#:"), 'OrderNumber', '',null, '', true); ref_cells(_("Ref"), 'OrderReference', '',null, '', true); + +if ($show_dates) + yesno_list_cells('', 'by_delivery', null, ($trans_type==ST_SALESORDER ? _("Delivery date") : _("Valid until")).':', + ($trans_type==ST_SALESORDER ? _("Order date") : _("Quotation date")).':'); + if ($show_dates) { date_cells(_("from:"), 'OrdersAfterDate', '', null, -user_transaction_days()); date_cells(_("to:"), 'OrdersToDate', '', null, 1); } + locations_list_cells(_("Location:"), 'StockLocation', null, true, true); if($show_dates) { @@ -254,6 +260,9 @@ if ($trans_type == ST_SALESQUOTE) check_cells(_("Show All:"), 'show_all'); if ($trans_type == ST_SALESORDER) check_cells(_("Zero values"), 'show_voided'); +if ($show_dates && $trans_type == ST_SALESORDER) + check_cells(_("No auto"), 'no_auto'); + submit_cells('SearchOrders', _("Search"),'',_('Select documents'), 'default'); hidden('order_view_mode', $_POST['order_view_mode']); hidden('type', $trans_type); @@ -265,7 +274,8 @@ end_table(1); // Orders inquiry table // $sql = get_sql_for_sales_orders_view($trans_type, get_post('OrderNumber'), get_post('order_view_mode'), - get_post('SelectStockFromList'), get_post('OrdersAfterDate'), get_post('OrdersToDate'), get_post('OrderReference'), get_post('StockLocation'), get_post('customer_id'), check_value('show_voided')); + get_post('SelectStockFromList'), get_post('OrdersAfterDate'), get_post('OrdersToDate'), get_post('OrderReference'), get_post('StockLocation'), get_post('customer_id'), check_value('show_voided'), + get_post('by_delivery'), get_post('no_auto')); if ($trans_type == ST_SALESORDER) $cols = array( diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 85985fb1..6318b4fd 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -122,6 +122,7 @@ if (list_updated('branch_id')) { if (isset($_GET['AddedID'])) { $order_no = $_GET['AddedID']; + display_notification_centered(sprintf( _("Order # %d has been entered."),$order_no)); submenu_view(_("&View This Order"), ST_SALESORDER, $order_no); @@ -137,6 +138,14 @@ if (isset($_GET['AddedID'])) { submenu_option(_("Enter a &New Order"), "/sales/sales_order_entry.php?NewOrder=0"); + $order = get_sales_order_header($order_no, ST_SALESORDER); + $customer_id = $order['debtor_no']; + if ($order['prep_amount'] > 0) + { + $row = db_fetch(db_query(get_allocatable_sales_orders($customer_id, $order_no, ST_SALESORDER))); + if ($row === false) + submenu_option(_("Receive Customer Payment"), "/sales/customer_payments.php?customer_id=$customer_id"); + } submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_SALESORDER."&trans_no=$order_no"); display_footer_exit();