}
sub action_show_multi_items_dialog {
+ my ($self) = @_;
+
+ my $search_term = $self->models->filtered->laundered->{all_substr_multi__ilike};
+ $search_term ||= $self->models->filtered->laundered->{all_with_makemodel_substr_multi__ilike};
+ $search_term ||= $self->models->filtered->laundered->{all_with_customer_partnumber_substr_multi__ilike};
+
$_[0]->render('part/_multi_items_dialog', { layout => 0 },
- all_partsgroups => SL::DB::Manager::PartsGroup->get_all
+ all_partsgroups => SL::DB::Manager::PartsGroup->get_all,
+ search_term => $search_term
);
}
# since we need a second get models instance with different filters for that,
# we only modify the original filter temporarily in place
if ($::form->{prefer_exact}) {
- local $::form->{filter}{'all::ilike'} = delete local $::form->{filter}{'all:substr:multi::ilike'};
+ local $::form->{filter}{'all::ilike'} = delete local $::form->{filter}{'all:substr:multi::ilike'};
+ local $::form->{filter}{'all_with_makemodel::ilike'} = delete local $::form->{filter}{'all_with_makemodel:substr:multi::ilike'};
+ local $::form->{filter}{'all_with_customer_partnumber::ilike'} = delete local $::form->{filter}{'all_with_customer_partnumber:substr:multi::ilike'};
my $exact_models = SL::Controller::Helper::GetModels->new(
controller => $self,
}
sub action_part_picker_search {
- $_[0]->render('part/part_picker_search', { layout => 0 });
+ my ($self) = @_;
+
+ my $search_term = $self->models->filtered->laundered->{all_substr_multi__ilike};
+ $search_term ||= $self->models->filtered->laundered->{all_with_makemodel_substr_multi__ilike};
+ $search_term ||= $self->models->filtered->laundered->{all_with_customer_partnumber_substr_multi__ilike};
+
+ $_[0]->render('part/part_picker_search', { layout => 0 }, search_term => $search_term);
}
sub action_part_picker_result {
If C<%params> contains C<convertible_unit> only parts with a unit
that's convertible to unit will be used for autocompletion.
+If C<%params> contains C<with_makemodel> or C<with_customer_partnumber> even
+parts will be used for autocompletion which partnumber is a vendor partnumber
+(makemodel) or a customer partnumber.
+
Obsolete parts will by default not be displayed for selection. However they are
accepted as default values and can persist during updates. As with other
selectors though, they are not selectable once overridden.
},
ajax_data: function(term) {
var data = {
- 'filter.all:substr:multi::ilike': term,
current: this.$real.val(),
};
if (this.o.convertible_unit)
data['filter.unit_obj.convertible_to'] = this.o.convertible_unit;
+ var filter_name = 'all';
+ if (this.o.with_makemodel) {
+ filter_name = 'all_with_makemodel';
+ }
+ if (this.o.with_customer_partnumber) {
+ filter_name = 'all_with_customer_partnumber';
+ }
+ data['filter.' + filter_name + ':substr:multi::ilike'] = term;
+
return data;
},
set_item: function(item) {
<table id='multi_items_filter_table'>
<tr>
<th>[%- LxERP.t8("Description") %]/[%- LxERP.t8("Partnumber") %]:</th>
- <td>[%- L.input_tag('multi_items_filter', SELF.multi_items_models.filtered.laundered.all_substr_multi__ilike) %]</td>
+ <td>[%- L.input_tag('multi_items_filter', search_term) %]</td>
<th>[%- LxERP.t8("Partsgroup") %]</th>
<td>[%- L.select_tag('multi_items.filter.partsgroup_id', all_partsgroups, title_key='partsgroup', value_key='id', with_empty=1) %]</td>
<tr>
<div style='overflow:hidden'>
-[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', SELF.models.filtered.laundered.all_substr_multi__ilike, class='part_picker_filter') %]
+[% LxERP.t8("Filter") %]: [% L.input_tag('part_picker_filter', search_term, class='part_picker_filter') %]
<div class='float-right'>
[% L.checkbox_tag('no_paginate', checked=FORM.no_paginate, id='no_paginate', for_submit=1, label=LxERP.t8('All as list')) %]
[% P.part.picker('part_id17', undef, status="obsolete") %]<br>
Artikel-Status: Alle<br>
[% P.part.picker('part_id18', undef, status="all") %]<br>
-
+<br>
Pre-filled:<br>
[% P.part.picker('part_id6', pre_filled_part) %]<br>
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)<br>
[% P.part.picker('part_id7', undef, convertible_unit='Std') %]<br>
-
+<br>
With multi select popup<br>
[% P.part.picker('part_id8', undef, multiple=1) %]<br>
+With multi select popup (only obsolete)<br>
+[% P.part.picker('part_id8', undef, multiple=1, status='obsolete') %]<br>
+<br>
+All parts including make models of all vendors: <br>
+[% P.part.picker('part_id', undef, with_makemodel=1) %]<br>
+All parts including make models of all vendors with multi select popup: <br>
+[% P.part.picker('part_id', undef, with_makemodel=1, multiple=1) %]<br>
+All parts including customer partnumbers of all customers: <br>
+[% P.part.picker('part_id', undef, with_customer_partnumber=1) %]<br>
<h2>Styling</h2>