! -> Note
$ -> Affected files
+19-Oct-2010 Janusz Dobrowolski
+! Accounts list compares keypresses to starting fragment of GL code (combo3)
+$ /includes/ui/ui_lists.inc
+ /js/inserts.js
+
17-Oct-2010 Joe Hunt
! Changed Inventory Sales Report to use average cost by actual trans dates if non zero
$ /reporting/rep304.php
$ /gl/inquiry/balance_sheet.php
/gl/inquiry/gl_trial_balance.php
/gl/inquiry/profit_loss.php
-
+
15-Oct-2010 Joe Hunt
# [0000263] Customer Credit Note didn't update units when shifting items.
$ /sales/includes/ui/sales_credit_ui.inc
'sel_hint' => null,
'search_box' => false, // name or true/false
'type' => 0, // type of extended selector:
- // 0 - with (optional) visible search box, search by id
+ // 0 - with (optional) visible search box, search by fragment inside id
// 1 - with hidden search box, search by option text
- // 2 - TODO reverse: box with hidden selector available via enter; this
+ // 2 - with (optional) visible search box, search by fragment at the start of id
+ // 3 - TODO reverse: box with hidden selector available via enter; this
// would be convenient for optional ad hoc adding of new item
'search_submit' => true, //search submit button: true/false
'size' => 8, // size and max of box tag
$select_submit = $opts['select_submit'];
$spec_id = $opts['spec_id'];
$spec_option = $opts['spec_option'];
- $by_id = ($opts['type'] == 0);
- $class = $by_id ? 'combo':'combo2';
+ if ($opts['type'] == 0) {
+ $by_id = true;
+ $class = 'combo';
+ } elseif($opts['type'] == 1) {
+ $by_id = false;
+ $class = 'combo2';
+ } else {
+ $by_id = true;
+ $class = 'combo3';
+ }
+
$disabled = $opts['disabled'] ? "disabled" : '';
$multi = $opts['multi'];
if ($spec_option === false && $selected_id == array())
$limit = ' LIMIT 1';
else
- $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
+ $opts['where'][] = $valfield . "=". db_escape(get_post($name, $spec_id));
}
else
if ($txt != '*') {
foreach($opts['search'] as $i=> $s)
- $opts['search'][$i] = $s . " LIKE '%{$txt}%'";
+ $opts['search'][$i] = $s . " LIKE "
+ .db_escape(($class=='combo3' ? '' : '%').$txt.'%');
$opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
}
}
global $all_items;
$sql = "SELECT branch_code, branch_ref FROM ".TB_PREF."cust_branch
- WHERE debtor_no='" . $customer_id . "' ";
+ WHERE debtor_no=" . db_escape($customer_id)." ";
if ($editkey)
set_editor('branch', $name, $editkey);
'format' => '_format_account',
'spec_option' => $all_option===true ? _("Use Item Sales Accounts") : $all_option,
'spec_id' => '',
+ 'type' => 2,
'order' => array('type.class_id','type.id','account_code'),
'search_box' => $cells,
'search_submit' => false,
var select = document.getElementsByName(this.getAttribute('rel'))[0];
if(select && select.selectedIndex>=0) {
var len = select.length;
- var byid = this.className=='combo';
+ var byid = this.className=='combo' || this.className=='combo3';
var ac = this.value.toUpperCase();
select.options[select.selectedIndex].selected = false;
for (i = 0; i < len; i++) {
var txt = byid ? select.options[i].value : select.options[i].text;
- if (txt.toUpperCase().indexOf(ac) >= 0) {
- select.options[i].selected = true;
- break;
+ if (this.className=='combo3') {
+ if(txt.toUpperCase().indexOf(ac) == 0) {
+ select.options[i].selected = true;
+ break;
+ }
+ } else {
+ if(txt.toUpperCase().indexOf(ac) >= 0) {
+ select.options[i].selected = true;
+ break;
+ }
}
}
}
}
function _update_box(s) {
- var byid = s.className=='combo';
+ var byid = s.className=='combo' || s.className=='combo3';
var rel = s.getAttribute('rel');
var box = document.getElementsByName(rel)[0];
if(box && s.selectedIndex>=0) {
// if(this.className=='combo')
// _update_box(this);
if ((this.selectedIndex != this.getAttribute('_last'))
- ||(this.className=='combo' && _update_box(this))
+ ||((this.className=='combo' || this.className=='combo3') && _update_box(this))
)
this.onchange();
}
e.onchange = function() {
var s = this;
- this.setAttribute('_last', this.selectedIndex);
- if(s.className=='combo')
+ this.setAttribute('_last', this.selectedIndex);
+ if(s.className=='combo' || this.className=='combo3')
_update_box(s);
if(s.selectedIndex>=0) {
var sname = '_'+s.name+'_update';
if(e.onfocus==undefined) {
e.onfocus = function() {
save_focus(this);
- if (this.className == 'combo')
+ if (this.className == 'combo' || this.className == 'combo3')
this.select();
};
}
- if (e.className == 'combo' || e.className == 'combo2') {
+ if (e.className == 'combo' || e.className == 'combo2' || e.className == 'combo3') {
_set_combo_input(e);
}
else
save_focus(this);
};
var c = e.className;
- if (c == 'combo' || c == 'combo2')
+ if (c == 'combo' || c == 'combo2' || c == 'combo3')
_set_combo_select(e);
}
},