Revision 78df36d1
Von Sven Schöling vor etwa 10 Jahren hinzugefügt
SL/Controller/PriceRule.pm | ||
---|---|---|
202 | 202 |
} |
203 | 203 |
|
204 | 204 |
sub add_javascripts { |
205 |
$::request->{layout}->add_javascripts(qw(kivi.PriceRule.js autocomplete_customer.js autocomplete_vendor.js)); |
|
205 |
$::request->{layout}->add_javascripts(qw(kivi.PriceRule.js autocomplete_customer.js autocomplete_vendor.js autocomplete_part.js));
|
|
206 | 206 |
} |
207 | 207 |
|
208 | 208 |
sub init_price_rule { |
SL/DB/Manager/PriceRuleItem.pm | ||
---|---|---|
15 | 15 |
use SL::Locale::String qw(t8); |
16 | 16 |
|
17 | 17 |
my @types = qw( |
18 |
customer vendor business partsgroup qty reqdate pricegroup |
|
18 |
part customer vendor business partsgroup qty reqdate pricegroup
|
|
19 | 19 |
); |
20 | 20 |
|
21 | 21 |
my %ops = ( |
... | ... | |
28 | 28 |
'vendor' => { description => t8('Vendor'), customer => 0, vendor => 1, data_type => 'int', data => sub { $_[0]->vendor->id }, }, |
29 | 29 |
'business' => { description => t8('Type of Business'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[0]->customervendor->business_id }, exclude_nulls => 1 }, |
30 | 30 |
'reqdate' => { description => t8('Reqdate'), customer => 1, vendor => 1, data_type => 'date', data => sub { $_[0]->reqdate }, ops => 'date' }, |
31 |
'part' => { description => t8('Part'), customer => 1, vendor => 0, data_type => 'int', data => sub { $_[1]->part->id }, }, |
|
31 | 32 |
'pricegroup' => { description => t8('Pricegroup'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[1]->pricegroup_id }, exclude_nulls => 1 }, |
32 | 33 |
'partsgroup' => { description => t8('Group'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[1]->part->partsgroup_id }, exclude_nulls => 1 }, |
33 | 34 |
'qty' => { description => t8('Qty'), customer => 1, vendor => 1, data_type => 'num', data => sub { $_[1]->qty }, ops => 'num' }, |
SL/DB/PriceRuleItem.pm | ||
---|---|---|
37 | 37 |
sub match_partsgroup { |
38 | 38 |
$_[0]->value_int == $_[1]{record_item}->parts->partsgroup_id; |
39 | 39 |
} |
40 |
sub match_part { |
|
41 |
$_[0]->value_int == $_[1]{record_item}->parts_id; |
|
42 |
} |
|
40 | 43 |
sub match_qty { |
41 | 44 |
if ($_[0]->op eq 'eq') { |
42 | 45 |
return $_[0]->value_num == $_[1]{record_item}->qty |
... | ... | |
59 | 62 |
$_[0]->value_int == $_[1]{record_item}->customervendor->pricegroup_id; |
60 | 63 |
} |
61 | 64 |
|
65 |
sub part { |
|
66 |
require SL::DB::Part; |
|
67 |
SL::DB::Part->load_cached($_[0]->value_int); |
|
68 |
} |
|
62 | 69 |
sub customer { |
63 | 70 |
require SL::DB::Customer; |
64 | 71 |
SL::DB::Customer->load_cached($_[0]->value_int); |
... | ... | |
95 | 102 |
: $type eq 'business' ? t8('Type of Business') . ' ' . $self->business->displayable_name |
96 | 103 |
: $type eq 'partsgroup' ? t8('Group') . ' ' . $self->partsgroup->displayable_name |
97 | 104 |
: $type eq 'pricegroup' ? t8('Pricegroup') . ' ' . $self->pricegroup->displayable_name |
105 |
: $type eq 'part' ? t8('Part') . ' ' . $self->part->long_description |
|
98 | 106 |
: $type eq 'qty' ? ( |
99 | 107 |
$op eq 'eq' ? t8('Qty equals #1', $self->value_num_as_number) |
100 | 108 |
: $op eq 'lt' ? t8('Qty less than #1', $self->value_num_as_number) |
templates/webpages/price_rule/item.html | ||
---|---|---|
17 | 17 |
[% L.hidden_tag('price_rule.items[+].id', item.id) %] |
18 | 18 |
[% L.hidden_tag('price_rule.items[].type', item.type) %] |
19 | 19 |
[%- SWITCH item.type %] |
20 |
[% CASE 'part' %] |
|
21 |
[% 'Part' | $T8 %] [% 'is' | $T8 %] [% L.part_picker('price_rule.items[].value_int', item.part) %] |
|
20 | 22 |
[% CASE 'customer' %] |
21 | 23 |
[% 'Customer' | $T8 %] [% 'is' | $T8 %] [% L.customer_vendor_picker('price_rule.items[].value_int', item.customer, type='customer') %] |
22 | 24 |
[% CASE 'vendor' %] |
Auch abrufbar als: Unified diff
PriceRule: Filter nach Ware implementiert