// submit on select parameters
'default' => '', // default value when $_POST is not set
'select_submit' => false, //submit on select: true/false
- 'edit_submit' => false, // call editor on F4
'async' => true, // select update via ajax (true) vs _page_body reload
// search box parameters
'sel_hint' => null,
if (!is_array($opts['where'])) $opts['where'] = array($opts['where']);
$search_box = $opts['search_box']===true ? '_'.$name.'_edit' : $opts['search_box'];
- $search_submit = $opts['search_submit']]===true ? '_'.$name.'_button' : $opts['search_submit'];
- $select_submit = $opts['select_submit']===true ? '_'.$name.'_update' : $opts['select_submit'];
+ $search_submit = $opts['search_submit']===true ? '_'.$name.'_button' : $opts['search_submit'];
+ $select_submit = $opts['select_submit'];
$spec_id = $opts['spec_id'];
$spec_option = $opts['spec_option'];
$by_id = ($opts['type'] == 0);
$rel = '';
$limit = '';
- if (isset($_POST[$select_submit])) {
+ if (isset($_POST['_'.$name.'_update'])) {
if ($by_id) $txt = $_POST[$name];
if (!$opts['async'])
$txt = $found;
$Ajax->addUpdate($name, $search_box, $txt ? $txt : '');
}
- $aspect = $opts['edit_submit'] ? " aspect='editable'" : '';
$selector = "<select $disabled name='$name' class='$class' title='"
- . $opts['sel_hint']."'$aspect $rel>".$selector."</select>\n";
+ . $opts['sel_hint']."' $rel>".$selector."</select>\n";
$Ajax->addUpdate($name, "_{$name}_sel", $selector);
// button class selects form reload/ajax selector update
$selector .= sprintf($_select_button, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
- $select_submit)."\n";
+ '_'.$name.'_update')."\n";
}
// ------ make combo ----------
'spec_option'=>false, // option text or false
'spec_id' => 0, // option id
'select_submit' => false, //submit on select: true/false
- 'edit_submit' => false, // call editor on F4
'async' => true, // select update via ajax (true) vs _page_body reload
'default' => '', // default value when $_POST is not set
// search box parameters
// ------ merge options with defaults ----------
if($options != null)
$opts = array_merge($opts, $options);
- $select_submit = $opts['select_submit']===true ? '_'.$name.'_update' : $opts['select_submit'];
+ $select_submit = $opts['select_submit'];
$spec_id = $opts['spec_id'];
$spec_option = $opts['spec_option'];
$disabled = $opts['disabled'] ? "disabled" : '';
$selected_id = get_post($name, $opts['default']);
}
- if (isset($_POST[$select_submit])) {
+ if (isset($_POST[ '_'.$name.'_update'])) {
if (!$opts['async'])
$Ajax->activate('_page_body');
else
}
$_POST[$name] = $selected_id;
- $aspect = $opts['edit_submit'] ? " aspect='editable'" : '';
$selector = "<select $disabled name='$name' class='combo' title='"
- . $opts['sel_hint']."'$aspect >".$selector."</select>\n";
+ . $opts['sel_hint']."'>".$selector."</select>\n";
$Ajax->addUpdate($name, "_{$name}_sel", $selector);
global $_select_button;
$selector .= sprintf($_select_button, $disabled, user_theme(),
(fallback_mode() ? '' : 'display:none;'),
- $select_submit)."\n";
+ '_'.$name.'_update')."\n";
}
default_focus($name);
echo $selector;
}
function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
- $all=false)
+ $all=false, $editkey = false)
{
global $all_items;
$mode = get_company_pref('no_supplier_list');
+ if ($editkey)
+ set_editor('supplier', $name, $editkey);
+
return combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name',
array(
'format' => '_format_add_curr',
'search_box' => $mode!=0,
- 'edit_submit' => true,
'type' => 1,
'spec_option' => $spec_option === true ? _("All Suppliers") : $spec_option,
'spec_id' => $all_items,
}
function supplier_list_cells($label, $name, $selected_id=null, $all_option=false,
- $submit_on_change=false, $all=false)
+ $submit_on_change=false, $all=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td><td>\n";
- $str = supplier_list($name, $selected_id, $all_option, $submit_on_change, $all);
+ $str = supplier_list($name, $selected_id, $all_option, $submit_on_change,
+ $all, $editkey);
echo "</td>\n";
return $str;
}
-function supplier_list_row($label, $name, $selected_id=null, $all_option = false, $submit_on_change=false)
+function supplier_list_row($label, $name, $selected_id=null, $all_option = false,
+ $submit_on_change=false, $all=false, $editkey = false)
{
echo "<tr><td>$label</td><td>";
- $str = supplier_list($name, $selected_id, $all_option, $submit_on_change );
+ $str = supplier_list($name, $selected_id, $all_option, $submit_on_change,
+ $all, $editkey);
echo "</td></tr>\n";
return $str;
}
//----------------------------------------------------------------------------------------------
-function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false, $show_inactive=false)
+function customer_list($name, $selected_id=null, $spec_option=false, $submit_on_change=false,
+ $show_inactive=false, $editkey = false)
{
global $all_items;
$mode = get_company_pref('no_customer_list');
+ if ($editkey)
+ set_editor('customer', $name, $editkey);
+
return combo_input($name, $selected_id, $sql, 'debtor_no', 'name',
array(
'format' => '_format_add_curr',
'spec_option' => $spec_option === true ? _("All Customers") : $spec_option,
'spec_id' => $all_items,
'select_submit'=> $submit_on_change,
- 'edit_submit' => true, // call editor on F4
'async' => false,
- 'sel_hint' => $mode ? _('Press Space tab to filter by name fragment; F4 - entry new customer') :
+ 'sel_hint' => $mode ? _('Press Space tab to filter by name fragment; F2 - entry new customer') :
_('Select customer'),
'show_inactive' => $show_inactive
) );
}
function customer_list_cells($label, $name, $selected_id=null, $all_option=false,
- $submit_on_change=false, $show_inactive=false)
+ $submit_on_change=false, $show_inactive=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td nowrap>";
$str = customer_list($name, $selected_id, $all_option, $submit_on_change,
- $show_inactive);
+ $show_inactive, $editkey);
echo "</td>\n";
return $str;
}
function customer_list_row($label, $name, $selected_id=null, $all_option = false,
- $submit_on_change=false, $show_inactive=false)
+ $submit_on_change=false, $show_inactive=false, $editkey = false)
{
echo "<tr><td>$label</td><td nowrap>";
$str = customer_list($name, $selected_id, $all_option, $submit_on_change,
- $show_inactive);
+ $show_inactive, $editkey);
echo "</td>\n</tr>\n";
return $str;
}
//------------------------------------------------------------------------------------------------
function customer_branches_list($customer_id, $name, $selected_id=null,
- $spec_option = true, $enabled=true, $submit_on_change=false)
+ $spec_option = true, $enabled=true, $submit_on_change=false, $editkey = false)
{
global $all_items;
$sql = "SELECT branch_code, br_name FROM ".TB_PREF."cust_branch
WHERE debtor_no='" . $customer_id . "' ";
+ if ($editkey)
+ set_editor('branch', $name, $editkey);
+
$where = $enabled ? array("disable_trans = 0") : array();
return combo_input($name, $selected_id, $sql, 'branch_code', 'br_name',
array(
}
//------------------------------------------------------------------------------------------------
-function customer_branches_list_cells($label,$customer_id, $name, $selected_id=null, $all_option = true, $enabled=true, $submit_on_change=false)
+function customer_branches_list_cells($label,$customer_id, $name, $selected_id=null,
+ $all_option = true, $enabled=true, $submit_on_change=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
echo "<td>";
- $ret = customer_branches_list($customer_id, $name, $selected_id, $all_option, $enabled, $submit_on_change);
+ $ret = customer_branches_list($customer_id, $name, $selected_id, $all_option, $enabled,
+ $submit_on_change, $editkey);
echo "</td>\n";
return $ret;
}
-function customer_branches_list_row($label,$customer_id, $name, $selected_id=null, $all_option = true, $enabled=true, $submit_on_change=false)
+function customer_branches_list_row($label, $customer_id, $name, $selected_id=null,
+ $all_option = true, $enabled=true, $submit_on_change=false, $editkey = false)
{
echo "<tr>";
- $ret = customer_branches_list_cells($label, $customer_id, $name, $selected_id, $all_option, $enabled, $submit_on_change);
+ $ret = customer_branches_list_cells($label, $customer_id, $name, $selected_id,
+ $all_option, $enabled, $submit_on_change, $editkey);
echo "</tr>";
return $ret;
}
//---------------------------------------------------------------------------------------------------
function stock_items_list($name, $selected_id=null, $all_option=false,
- $submit_on_change=false, $opts=array())
+ $submit_on_change=false, $opts=array(), $editkey = false)
{
global $all_items;
$sql = "SELECT stock_id, s.description, c.description, s.inactive
FROM ".TB_PREF."stock_master s,".TB_PREF."stock_category c WHERE s.category_id=c.category_id";
+ if ($editkey)
+ set_editor('item', $name, $editkey);
+
return combo_input($name, $selected_id, $sql, 'stock_id', 's.description',
array_merge(
array(
}
function stock_items_list_cells($label, $name, $selected_id=null, $all_option=false,
- $submit_on_change=false, $all=false)
+ $submit_on_change=false, $all=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('cells'=>true, 'show_inactive'=>$all));
+ array('cells'=>true, 'show_inactive'=>$all), $editkey);
return $str;
}
/*
$all_option=false, $submit_on_change=false)
{
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("mb_flag= 'M'"),
- 'edit_submit' => true));
+ array('where'=>array("mb_flag= 'M'")));
return $str;
}
//------------------------------------------------------------------------------------
function stock_component_items_list($name, $parent_stock_id, $selected_id=null,
- $all_option=false, $submit_on_change=false)
+ $all_option=false, $submit_on_change=false, $editkey = false)
{
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != '$parent_stock_id'")));
+ array('where'=>array("stock_id != '$parent_stock_id'")), $editkey);
return $str;
}
function stock_component_items_list_cells($label, $name, $parent_stock_id,
- $selected_id=null, $all_option=false, $submit_on_change=false)
+ $selected_id=null, $all_option=false, $submit_on_change=false, $editkey = false)
{
if ($label != null)
echo "<td>$label</td>\n";
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true));
+ array('where'=>array("stock_id != '$parent_stock_id'"), 'cells'=>true),
+ $editkey);
return $str;
}
//------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------
function stock_purchasable_items_list($name, $selected_id=null,
- $all_option=false, $submit_on_change=false, $all=false)
+ $all_option=false, $submit_on_change=false, $all=false, $editkey=false)
{
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!= 'M'"),
- 'edit_submit' => true,
- 'show_inactive'=>$all));
+ 'show_inactive'=>$all), $editkey);
return $str;
}
function stock_purchasable_items_list_cells($label, $name, $selected_id=null,
- $all_option=false, $submit_on_change=false, $all=false)
+ $all_option=false, $submit_on_change=false, $editkey=false)
{
if ($label != null)
echo "<td>$label</td>\n";
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
array('where'=>array("mb_flag!= 'M'"),
- 'edit_submit' => true,
- 'cells'=>true));
+ 'cells'=>true), $editkey);
return $str;
}
function stock_purchasable_items_list_row($label, $name, $selected_id=null,
- $all_option=false, $submit_on_change=false)
+ $all_option=false, $submit_on_change=false, $editkey=false)
{
echo "<tr>\n";
$ret = stock_purchasable_items_list_cells($label, $name, $selected_id=null,
- $all_option, $submit_on_change);
+ $all_option, $submit_on_change, $editkey);
echo "</tr>\n";
return $ret;
}