! -> Note
$ -> Affected files
+25-Jul-2009 Janusz Dobrowolski
+! Popup editor now available as option for some list selectors.
+$ /includes/ui/ui_lists.inc
+ /gl/gl_bank.php
+ /gl/includes/ui/gl_bank_ui.inc
+ /includes/session.inc
+ /includes/page/footer.inc
+ /includes/ui/ui_controls.inc
+ /inventory/purchasing_data.php
+ /js/inserts.js
+ /purchasing/po_entry_items.php
+ /purchasing/supplier_credit.php
+ /purchasing/supplier_invoice.php
+ /purchasing/supplier_payment.php
+ /purchasing/allocations/supplier_allocation_main.php
+ /purchasing/includes/ui/po_ui.inc
+ /sales/credit_note_entry.php
+ /sales/customer_payments.php
+ /sales/sales_order_entry.php
+ /sales/allocations/customer_allocation_main.php
+ /sales/includes/ui/sales_credit_ui.inc
+ /sales/includes/ui/sales_order_ui.inc
+ /themes/aqua/default.css
+ /themes/aqua/renderer.php
+ /themes/cool/default.css
+ /themes/cool/renderer.php
+ /themes/default/default.css
+ /themes/default/renderer.php
+
21-Jul-2009 Janusz Dobrowolski
! Asynchronous customer/supplier/item selection now use popup window.
$ /index.php
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
-set_editor('supplier', 'person_id' , 'ref');
-set_editor('customer', 'person_id' , 'ref');
-set_editor('branch', 'PersonDetailID' , 'ref');
-
if (list_updated('PersonDetailID')) {
$br = get_branch(get_post('PersonDetailID'));
$_POST['person_id'] = $br['debtor_no'];
$_POST['person_id'] = '';
$Ajax->activate('pmt_header');
$Ajax->activate('code_id');
+ $Ajax->activate('pagehelp');
+ $Ajax->activate('editors');
}
payment_person_types_list_row( $payment ? _("Pay To:"):_("From:"),
'PayType', $_POST['PayType'], true);
// workorders_list_row(_("Work Order:"), 'person_id', null);
// break;
case payment_person_types::supplier() :
- supplier_list_row(_("Supplier:"), 'person_id', null, false, true);
+ supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true);
break;
case payment_person_types::customer() :
- customer_list_row(_("Customer:"), 'person_id', null, false, true);
+ customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true);
if (db_customer_has_branches($_POST['person_id']))
{
- customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true);
+ customer_branches_list_row(_("Branch:"), $_POST['person_id'],
+ 'PersonDetailID', null, false, true, true, true);
}
else
{
***********************************************************************/
function page_footer($no_menu=false, $is_index=false)
{
- global $path_to_root, $js_lib, $Validate, $Editors;
-
- if (in_ajax())
- return;// just for speed up
+ global $path_to_root, $js_lib, $Validate, $Editors, $Ajax;
if (!$is_index && function_exists('hyperlink_back'))
hyperlink_back();
$rend = new renderer();
$rend->menu_footer($no_menu, $is_index);
+ $edits = "editors = ".JsHttpRequest::php2js($Editors).";";
+ $Ajax->addScript('editors', $edits);
+
echo "<script>
_focus = '" . get_post('_focus') . "';
_validate = " . JsHttpRequest::php2js($Validate).";
- var editors = ".JsHttpRequest::php2js($Editors).";
+ var $edits
</script>";
add_user_js_data();
$Validate = array();
// bindings for editors
$Editors = array();
+// page help. Currently help for function keys.
+$Pagehelp = array();
// intercept all output to destroy it in case of ajax call
register_shutdown_function('end_flush');
}
}
+/* Table editor interfaces. Key is editor type
+ 0 => url of editor page
+ 1 => hotkey code
+ 2 => context help
+*/
+$popup_editors = array(
+ 'customer' => array('/sales/manage/customers.php?debtor_no=',
+ 113, _("Customers")),
+ 'branch' => array('/sales/manage/customer_branches.php?SelectedBranch=',
+ 114, _("Branches")),
+ 'supplier' => array('/purchasing/manage/suppliers.php?supplier_id=',
+ 113, _("Suppliers")),
+ 'item' => array('/inventory/manage/items.php?stock_id=',
+ 115, _("Items"))
+);
/*
Bind editors for various selectors.
$type - type of editor
- $input - array org_input => editor_input
- $focus - focus after selection
+ $input - name of related input field
+ $caller - optional function key code (available values F1-F12: 112-123,
+ true: default)
*/
-function set_editor($type, $input, $focus=null)
+function set_editor($type, $input, $caller=true)
{
- global $path_to_root, $Editors;
- // table of table editor interfaces.
- // key is editor type, values contain:
- // 0 => url of editor page
- // 1 => array of names of parameters returned back from editor interface
- // 2 => hotkey code
+ global $path_to_root, $Editors, $popup_editors, $Pagehelp;
- if($focus === null) {
- $focus = $caller;
- }
- $urls = array(
- 'customer' => array('/sales/manage/customers.php?debtor_no=',
- 113, _("F2 - Customers")),
- 'branch' => array('/sales/manage/customer_branches.php?SelectedBranch=',
- 114, _("F3 - Branches")),
- 'supplier' => array('/purchasing/manage/suppliers.php?supplier_id=',
- 113, _("F2 - Suppliers")),
- 'item' => array('/inventory/manage/items.php?stock_id=',
- 115, _("F4 - Items"))
- );
- $back = array();
- $caller = $urls[$type][1];
- $Editors[$caller] = array( $path_to_root . $urls[$type][0], $input, $focus);
-
-// FIX status comments
+ $key = $caller===true ? $popup_editors[$type][1] : $caller;
+ $Editors[$key] = array( $path_to_root . $popup_editors[$type][0], $input);
+
+ $help = 'F' . ($key - 111) . ' - ';
+ $help .= $popup_editors[$type][2];
+ $Pagehelp[] = $help;
}
//------------------------------------------------------------------------------
// Procedures below are now obsolete. Preserved for eventual future use.
$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'];
+ $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'])
// 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 ----------
// ------ 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
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',
}
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',
}
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;
}
/*
//------------------------------------------------------------------------------------
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'"),
- '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'"),
- '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;
}
check_db_has_suppliers(_("There are no suppliers defined in the system."));
//----------------------------------------------------------------------------------------
-set_editor('supplier', 'supplier_id' , 'supplier_id');
-
simple_page_mode(true);
+
//--------------------------------------------------------------------------------------------------
if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
to[0].value = value; // ugly hack to set selector to any value
to.value = value;
// update page after item selection
- o.JsHttpRequest.request('_'+to.name+'_update');
+ o.JsHttpRequest.request('_'+to.name+'_update', to.form);
+ o.setFocus(to.name);
}
- o.setFocus(back[2]);
}
close();
}
page(_("Supplier Allocations"), false, false, "", $js);
//--------------------------------------------------------------------------------
-set_editor('supplier', 'supplier_id' , 'ShowSettled');
start_form();
if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all()))
$_POST['supplier_id'] = get_global_supplier();
- supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true);
+ supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true, false, true);
}
else
{
{
hidden('line_no', ($_SESSION['PO']->lines_on_order + 1));
- stock_purchasable_items_list_cells(null, 'stock_id', null, false, true);
+ stock_purchasable_items_list_cells(null, 'stock_id', null, false, false, true);
if (list_updated('stock_id')) {
$Ajax->activate('price');
$Ajax->activate('units');
check_db_has_purchasable_items(_("There are no purchasable inventory items defined in the system."));
//---------------------------------------------------------------------------------------------------------------
-set_editor('supplier', 'supplier_id' , 'ref');
-set_editor('item', 'stock_id' , 'qty');
if (isset($_GET['AddedID']))
{
check_db_has_suppliers(_("There are no suppliers defined in the system."));
//---------------------------------------------------------------------------------------------------------------
-set_editor('supplier', 'supplier_id' , 'reference');
if (isset($_GET['AddedID']))
{
$js .= get_js_date_picker();
page(_("Enter Supplier Invoice"), false, false, "", $js);
-set_editor('supplier', 'supplier_id' , 'reference');
//----------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
-set_editor('supplier', 'supplier_id' , 'bank_account');
if (!isset($_POST['supplier_id']))
$_POST['supplier_id'] = get_global_supplier(false);
page(_("Customer Allocations"), false, false, "", $js);
//--------------------------------------------------------------------------------
-set_editor('customer', 'customer_id' , 'ShowSettled');
start_form();
/* show all outstanding receipts and credits to be allocated */
check_db_has_customer_branches(_("There are no customers, or there are no customers with branches. Please define customers and customer branches."));
//-----------------------------------------------------------------------------
-set_editor('customer', 'customer_id' , 'branch_id');
-set_editor('branch', 'branch_id' , 'ref');
if (list_updated('branch_id')) {
// when branch is selected via external editor also customer can change
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
-set_editor('customer', 'customer_id' , 'sales_type');
-set_editor('branch', 'BranchID' , 'bank_account');
if (list_updated('BranchID')) {
// when branch is selected via external editor also customer can change
if (!isset($_POST['customer_id']) && (get_global_customer() != reserved_words::get_all()))
$_POST['customer_id'] = get_global_customer();
- customer_list_row(_("Customer:"), 'customer_id', null, false, true);
+ customer_list_row(_("Customer:"), 'customer_id', null, false, true, false, true);
if ($order->customer_id != $_POST['customer_id'] /*|| $order->sales_type != $_POST['sales_type_id']*/)
{
}
customer_branches_list_row(_("Branch:"), $_POST['customer_id'],
- 'branch_id', null, false, true, true);
+ 'branch_id', null, false, true, true, true);
//if (($_SESSION['credit_items']->order_no == 0) ||
// ($order->customer_id != $_POST['customer_id']) ||
}
else
{
- customer_list_row(_("Customer:"), 'customer_id', null, false, true);
+ customer_list_row(_("Customer:"), 'customer_id', null, false, true, false, true);
if ($order->customer_id != get_post('customer_id', -1))
{
$Ajax->activate('branch_id');
}
customer_branches_list_row(_("Branch:"),
- $_POST['customer_id'], 'branch_id', null, false, true, true);
+ $_POST['customer_id'], 'branch_id', null, false, true, true, true);
if( ($order->customer_id != get_post('customer_id', -1)) ||
($order->Branch != get_post('branch_id', -1)) ||
page($_SESSION['page_title'], false, false, "", $js);
//-----------------------------------------------------------------------------
-set_editor('customer', 'customer_id', 'sales_type');
-set_editor('branch', 'branch_id', 'sales_type');
if (list_updated('branch_id')) {
// when branch is selected via external editor also customer can change
border: 1px solid #8cacbb;
}
+#hotkeyshelp {
+ text-align: right;
+ font-weight: bolder;
+}
+
#footer {
position: relative;
bottom: -3px;
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root;
+ global $version, $allow_demo_mode, $app_title, $power_url,
+ $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once($path_to_root . "/includes/date_functions.inc");
if ($no_menu == false)
else
echo "<table class=bottomBar2>\n";
echo "<tr>";
- if (isset($_SESSION['wa_current_user']))
+ if (isset($_SESSION['wa_current_user'])) {
+ $phelp = implode('; ', $Pagehelp);
echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n";
+ $Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
+ echo "<td id='hotkeyshelp'>".$phelp."</td>";
+ }
echo "</tr></table>\n";
}
echo "</td></tr></table></td>\n";
border: 1px solid #cccccc;
}
+#hotkeyshelp {
+ text-align: right;
+ font-weight: bolder;
+}
+
#footer {
position: relative;
bottom: -3px;
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root;
+ global $version, $allow_demo_mode, $app_title, $power_url,
+ $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once($path_to_root . "/includes/date_functions.inc");
if ($no_menu == false)
else
echo "<table class=bottomBar2>\n";
echo "<tr>";
- if (isset($_SESSION['wa_current_user']))
+ if (isset($_SESSION['wa_current_user'])) {
+ $phelp = implode('; ', $Pagehelp);
echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n";
+ $Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
+ echo "<td id='hotkeyshelp'>".$phelp."</td>";
+ }
echo "</tr></table>\n";
}
echo "</td></tr></table></td>\n";
border: 1px solid #8cacbb;
}
+#hotkeyshelp {
+ text-align: right;
+ font-weight: bolder;
+}
+
#footer {
position: relative;
bottom: -3px;
function menu_footer($no_menu, $is_index)
{
- global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root;
+ global $version, $allow_demo_mode, $app_title, $power_url,
+ $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once($path_to_root . "/includes/date_functions.inc");
if ($no_menu == false)
else
echo "<table class=bottomBar2>\n";
echo "<tr>";
- if (isset($_SESSION['wa_current_user']))
+ if (isset($_SESSION['wa_current_user'])) {
+ $phelp = implode('; ', $Pagehelp);
echo "<td class=bottomBarCell>" . Today() . " | " . Now() . "</td>\n";
+ $Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
+ echo "<td id='hotkeyshelp'>".$phelp."</td>";
+ }
echo "</tr></table>\n";
}
echo "</td></tr></table></td>\n";