projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CsvImport: customernumber/vendornumber statt number
[kivitendo-erp.git]
/
js
/
autocomplete_customer.js
diff --git
a/js/autocomplete_customer.js
b/js/autocomplete_customer.js
index
a42a709
..
8f8771d
100644
(file)
--- a/
js/autocomplete_customer.js
+++ b/
js/autocomplete_customer.js
@@
-1,4
+1,6
@@
namespace('kivi', function(k){
namespace('kivi', function(k){
+ "use strict";
+
k.CustomerVendorPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("customer_vendor_picker"))
k.CustomerVendorPicker = function($real, options) {
// short circuit in case someone double inits us
if ($real.data("customer_vendor_picker"))
@@
-12,6
+14,9
@@
namespace('kivi', function(k){
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
RIGHT: 39,
PAGE_UP: 33,
PAGE_DOWN: 34,
+ SHIFT: 16,
+ CTRL: 17,
+ ALT: 18,
};
var CLASSES = {
PICKED: 'customer-vendor-picker-picked',
};
var CLASSES = {
PICKED: 'customer-vendor-picker-picked',
@@
-59,7
+64,6
@@
namespace('kivi', function(k){
state = STATES.PICKED;
last_real = $real.val();
last_dummy = $dummy.val();
state = STATES.PICKED;
last_real = $real.val();
last_dummy = $dummy.val();
- last_unverified_dummy = $dummy.val();
$real.trigger('change');
if (o.fat_set_item && item.id) {
$real.trigger('change');
if (o.fat_set_item && item.id) {
@@
-80,10
+84,9
@@
namespace('kivi', function(k){
if (state == STATES.PICKED) {
annotate_state();
return true
if (state == STATES.PICKED) {
annotate_state();
return true
- } else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ } else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
set_item({})
else {
set_item({})
else {
- last_unverified_dummy = $dummy.val();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
set_item({ id: last_real, name: last_dummy })
}
annotate_state();
@@
-92,10
+95,9
@@
namespace('kivi', function(k){
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
function annotate_state () {
if (state == STATES.PICKED)
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
- else if (state == STATES.UNDEFINED && $dummy.val() == '')
+ else if (state == STATES.UNDEFINED && $dummy.val() ==
=
'')
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
$dummy.removeClass(STATES.UNDEFINED).addClass(STATES.PICKED);
else {
- last_unverified_dummy = $dummy.val();
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
$dummy.addClass(STATES.UNDEFINED).removeClass(STATES.PICKED);
}
}
@@
-119,7
+121,7
@@
namespace('kivi', function(k){
annotate_state();
}
});
annotate_state();
}
});
- }
;
+ }
$dummy.autocomplete({
source: function(req, rsp) {
$dummy.autocomplete({
source: function(req, rsp) {
@@
-133,6
+135,10
@@
namespace('kivi', function(k){
select: function(event, ui) {
set_item(ui.item);
},
select: function(event, ui) {
set_item(ui.item);
},
+ search: function(event, ui) {
+ if ((event.which == KEY.SHIFT) || (event.which == KEY.CTRL) || (event.which == KEY.ALT))
+ event.preventDefault();
+ }
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
});
/* In case users are impatient and want to skip ahead:
* Capture <enter> key events and check if it's a unique hit.
@@
-149,7
+155,7
@@
namespace('kivi', function(k){
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
$dummy.keydown(function(event){
if (event.which == KEY.ENTER || event.which == KEY.TAB) {
// if string is empty assume they want to delete
- if ($dummy.val() == '') {
+ if ($dummy.val() ==
=
'') {
set_item({});
return true;
} else if (state == STATES.PICKED) {
set_item({});
return true;
} else if (state == STATES.PICKED) {
@@
-165,7
+171,7
@@
namespace('kivi', function(k){
});
return false;
}
});
return false;
}
- } else {
+ } else
if ((event.which != KEY.SHIFT) && (event.which != KEY.CTRL) && (event.which != KEY.ALT))
{
state = STATES.UNDEFINED;
}
});
state = STATES.UNDEFINED;
}
});