Added max parameter to textarea*() helpers, added constraints on all memo/comments...
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 26 Sep 2020 13:28:16 +0000 (15:28 +0200)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 26 Sep 2020 21:18:18 +0000 (23:18 +0200)
admin/crm_categories.php
fixed_assets/process_depreciation.php
includes/ui/ui_input.inc
manufacturing/includes/work_order_issue_ui.inc
purchasing/includes/ui/po_ui.inc
sales/includes/ui/sales_order_ui.inc

index 6db43e58179830e1148302964cc380d7be2bec6c..a7a26af3f8c4506b451a65d309ff13601857d298 100644 (file)
@@ -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);
 
index 67abc10fba5b97367c14fd6e4a0e5344f5e1f55a..227c4b9f58f2d897a88699c07305abc065e2d2ca 100644 (file)
@@ -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);
 
index 59a3676ef5664ed7ccc7bd004411ac37c2c824aa..0b59aaaac15cce9fefa937f56d37de597de0cc0a 100644 (file)
@@ -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 "<td><textarea name='$name' cols='$cols' rows='$rows'"
        .($title ? " title='$title'" : '')
+       .($max ? " maxlength=$max" : '')
        .">$value</textarea></td>\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 "<tr><td class='label'>$label</td>";
-       textarea_cells(null, $name, $value, $cols, $rows, $title, $params);
+       textarea_cells(null, $name, $value, $cols, $rows, $max, $title, $params);
        echo "</tr>\n";
 }
 
index 066f80d63a52050feea101fe96a8f7b81c04411f..969810cd11f2dc4d69e261198ec95f90ea001fea 100644 (file)
@@ -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);
 }
index b71359576c1f5b06759d925a69c22e7489bff8cc..80d6a3b5a803396c549e09f363d8cfd33a4b5e9b 100644 (file)
@@ -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)
index c0337bc0059683522b980d3040d18f54aea2fb99..bd99f58eeb8a5893d56cdbb2523c0c4d0800fe8a 100644 (file)
@@ -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);