From 3f5c7866bc6ee20f028afa3862de2e14745bf795 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 29 Sep 2014 14:13:14 +0200 Subject: [PATCH] =?utf8?q?PriceRule:=20Belegdatum=20als=20Kriterium=20hinz?= =?utf8?q?ugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/Manager/PriceRuleItem.pm | 3 ++- SL/DB/PriceRuleItem.pm | 14 ++++++++++++++ locale/de/all | 3 +++ templates/webpages/price_rule/item.html | 2 ++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/SL/DB/Manager/PriceRuleItem.pm b/SL/DB/Manager/PriceRuleItem.pm index a96a8b3d3..2d3e9cfe9 100644 --- a/SL/DB/Manager/PriceRuleItem.pm +++ b/SL/DB/Manager/PriceRuleItem.pm @@ -15,7 +15,7 @@ __PACKAGE__->make_manager_methods; use SL::Locale::String qw(t8); my @types = qw( - part customer vendor business partsgroup qty reqdate pricegroup + part customer vendor business partsgroup qty reqdate transdate pricegroup ); my %ops = ( @@ -28,6 +28,7 @@ my %types = ( 'vendor' => { description => t8('Vendor'), customer => 0, vendor => 1, data_type => 'int', data => sub { $_[0]->vendor->id }, }, 'business' => { description => t8('Type of Business'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[0]->customervendor->business_id }, exclude_nulls => 1 }, 'reqdate' => { description => t8('Reqdate'), customer => 1, vendor => 1, data_type => 'date', data => sub { $_[0]->reqdate }, ops => 'date' }, + 'transdate' => { description => t8('Transdate'), customer => 1, vendor => 1, data_type => 'date', data => sub { $_[0]->transdate }, ops => 'date' }, 'part' => { description => t8('Part'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[1]->part->id }, }, 'pricegroup' => { description => t8('Pricegroup'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[1]->pricegroup_id }, exclude_nulls => 1 }, 'partsgroup' => { description => t8('Group'), customer => 1, vendor => 1, data_type => 'int', data => sub { $_[1]->part->partsgroup_id }, exclude_nulls => 1 }, diff --git a/SL/DB/PriceRuleItem.pm b/SL/DB/PriceRuleItem.pm index c53d9b7d0..35620554c 100644 --- a/SL/DB/PriceRuleItem.pm +++ b/SL/DB/PriceRuleItem.pm @@ -58,6 +58,15 @@ sub match_reqdate { return $_[0]->value_date > $_[1]{record}->reqdate; } } +sub match_transdate { + if ($_[0]->op eq 'eq') { + return $_[0]->value_date == $_[1]{record}->transdate; + } elsif ($_[0]->op eq 'lt') { + return $_[0]->value_date < $_[1]{record}->transdate; + } elsif ($_[0]->op eq 'gt') { + return $_[0]->value_date > $_[1]{record}->transdate; + } +} sub match_pricegroup { $_[0]->value_int == $_[1]{record_item}->customervendor->pricegroup_id; } @@ -113,6 +122,11 @@ sub full_description { : $op eq 'lt' ? t8('Reqdate is before #1', $self->value_date_as_date) : $op eq 'gt' ? t8('Reqdate is after #1', $self->value_date_as_date) : do { die "unknown op $op for type $type" } ) + : $type eq 'transdate' ? ( + $op eq 'eq' ? t8('Transdate is #1', $self->value_date_as_date) + : $op eq 'lt' ? t8('Transdate is before #1', $self->value_date_as_date) + : $op eq 'gt' ? t8('Transdate is after #1', $self->value_date_as_date) + : do { die "unknown op $op for type $type" } ) : do { die "unknown type $type" } } diff --git a/locale/de/all b/locale/de/all index 54d2061fc..2b937a0eb 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2779,6 +2779,9 @@ $self->{texts} = { 'Transactions without reference:' => 'Buchungen ohne Referenz:', 'Transactions, AR transactions, AP transactions' => 'Dialogbuchen, Debitorenrechnungen, Kreditorenrechnungen', 'Transdate' => 'Belegdatum', + 'Transdate is #1' => 'Belegdatum ist #1', + 'Transdate is after #1' => 'Belegdatum ist nach #1', + 'Transdate is before #1' => 'Belegdatum ist vor #1', 'Transfer' => 'Umlagern', 'Transfer Quantity' => 'Umlagermenge', 'Transfer To Stock' => 'Lagereingang', diff --git a/templates/webpages/price_rule/item.html b/templates/webpages/price_rule/item.html index 78515e87a..b9f9618f8 100644 --- a/templates/webpages/price_rule/item.html +++ b/templates/webpages/price_rule/item.html @@ -31,6 +31,8 @@ [% 'Quantity' | $T8 %] [% L.select_tag('price_rule.items[].op', num_compare_ops, default=item.op) %] [% L.input_tag('price_rule.items[].value_num_as_number', item.value_num_as_number) %] [% CASE 'reqdate' %] [% 'Reqdate' | $T8 %] [% L.select_tag('price_rule.items[].op', date_compare_ops, default=item.op) %] [% L.date_tag('price_rule.items[].value_date', item.value_date) %] + [% CASE 'transdate' %] + [% 'Transdate' | $T8 %] [% L.select_tag('price_rule.items[].op', date_compare_ops, default=item.op) %] [% L.date_tag('price_rule.items[].value_date', item.value_date) %] [% CASE 'pricegroup' %] [% 'Pricegroup' | $T8 %] [% 'is' | $T8 %] [% L.select_tag('price_rule.items[].value_int', SELF.pricegroups, title_key='pricegroup', default=item.value_int) %] [% CASE %] -- 2.20.1