From: Janusz Dobrowolski Date: Sat, 26 Sep 2020 13:28:16 +0000 (+0200) Subject: Added max parameter to textarea*() helpers, added constraints on all memo/comments... X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=78e85d9a746e57dd04989bd7a889e6dee79301e0 Added max parameter to textarea*() helpers, added constraints on all memo/comments input fields. Fixes [0005179]. --- diff --git a/admin/crm_categories.php b/admin/crm_categories.php index 6db43e58..a7a26af3 100644 --- a/admin/crm_categories.php +++ b/admin/crm_categories.php @@ -141,7 +141,7 @@ if ($Mode == 'Edit' && $myrow['system']) { } text_row_ex(_("Category Short Name:"), 'name', 30); -textarea_row(_("Category Description:"), 'description', null, 60,4); +textarea_row(_("Category Description:"), 'description', null, 60, 4); end_table(1); diff --git a/fixed_assets/process_depreciation.php b/fixed_assets/process_depreciation.php index 67abc10f..227c4b9f 100644 --- a/fixed_assets/process_depreciation.php +++ b/fixed_assets/process_depreciation.php @@ -172,7 +172,7 @@ function show_gl_controls() { hidden ('months'); } refline_list_row(_("Reference line:"), 'refline', ST_JOURNAL, null, false, true); - textarea_row(_("Memo:"), 'memo_', null, 40,4); + textarea_row(_("Memo:"), 'memo_', null, 40, 4); end_table(1); diff --git a/includes/ui/ui_input.inc b/includes/ui/ui_input.inc index 59a3676e..0b59aaaa 100644 --- a/includes/ui/ui_input.inc +++ b/includes/ui/ui_input.inc @@ -911,7 +911,7 @@ function small_qty_cells($label, $name, $init=null, $params=null, $post_label=nu //----------------------------------------------------------------------------------- -function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $params="") +function textarea_cells($label, $name, $value, $cols, $rows, $max=255, $title = null, $params="") { global $Ajax; @@ -922,14 +922,15 @@ function textarea_cells($label, $name, $value, $cols, $rows, $title = null, $par $value = (!isset($_POST[$name]) ? "" : $_POST[$name]); echo "\n"; $Ajax->addUpdate($name, $name, $value); } -function textarea_row($label, $name, $value, $cols, $rows, $title=null, $params="") +function textarea_row($label, $name, $value, $cols, $rows, $max=255, $title=null, $params="") { echo "$label"; - textarea_cells(null, $name, $value, $cols, $rows, $title, $params); + textarea_cells(null, $name, $value, $cols, $rows, $max, $title, $params); echo "\n"; } diff --git a/manufacturing/includes/work_order_issue_ui.inc b/manufacturing/includes/work_order_issue_ui.inc index 066f80d6..969810cd 100644 --- a/manufacturing/includes/work_order_issue_ui.inc +++ b/manufacturing/includes/work_order_issue_ui.inc @@ -166,7 +166,7 @@ function issue_options_controls() yesno_list_row(_("Type:"), 'IssueType', $_POST['IssueType'], _("Return Items to Location"), _("Issue Items to Work order")); - textarea_row(_("Memo"), 'memo_', null, 50, 3); + textarea_row(_("Memo"), 'memo_', null, 50, 3, 40); // stock move reference is 40 max end_table(1); } diff --git a/purchasing/includes/ui/po_ui.inc b/purchasing/includes/ui/po_ui.inc index b7135957..80d6a3b5 100644 --- a/purchasing/includes/ui/po_ui.inc +++ b/purchasing/includes/ui/po_ui.inc @@ -403,10 +403,13 @@ function po_item_controls(&$order, &$rowcounter, $line_no=-1) $Ajax->activate('req_del_date'); $Ajax->activate('line_total'); } - $item_info = get_item_edit_info($_POST['stock_id']); - $_POST['units'] = $item_info["units"]; - $dec = $item_info["decimals"]; + $dec = 0; $_POST['units'] = ''; + $item_info = get_item_edit_info($_POST['stock_id']); + if ($item_info) { + $_POST['units'] = $item_info["units"]; + $dec = $item_info["decimals"]; + } $_POST['qty'] = number_format2(get_purchase_conversion_factor ($order->supplier_id, $_POST['stock_id']), $dec); $_POST['price'] = price_decimal_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']), $dec2); if ($order->trans_type == ST_PURCHORDER) diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index c0337bc0..bd99f58e 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -632,7 +632,7 @@ function display_delivery_details(&$order) text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 50, 60, _('Additional identifier for delivery e.g. name of receiving person')); - textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5, + textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5, 255, _('Delivery address. Default is address of customer branch')); table_section(2);