From: Sven Schöling Date: Tue, 19 Dec 2017 14:30:27 +0000 (+0100) Subject: Presenter: Neue Struktur in Belegen umgesetzt X-Git-Tag: release-3.5.4~563 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0aa885f4f0bb531a7691a641f954ff296ffa04a5;p=kivitendo-erp.git Presenter: Neue Struktur in Belegen umgesetzt --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 7c8210500..06a9f74cb 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -4,7 +4,7 @@ use strict; use parent qw(SL::Controller::Base); use SL::Helper::Flash qw(flash_later); -use SL::Presenter; +use SL::Presenter::Tag qw(select_tag); use SL::Locale::String qw(t8); use SL::SessionFile::Random; use SL::PriceSource; @@ -771,12 +771,12 @@ sub _check_auth { sub build_contact_select { my ($self) = @_; - $self->p->select_tag('order.cp_id', [ $self->order->{$self->cv}->contacts ], - value_key => 'cp_id', - title_key => 'full_name_dep', - default => $self->order->cp_id, - with_empty => 1, - style => 'width: 300px', + select_tag('order.cp_id', [ $self->order->{$self->cv}->contacts ], + value_key => 'cp_id', + title_key => 'full_name_dep', + default => $self->order->cp_id, + with_empty => 1, + style => 'width: 300px', ); } @@ -786,12 +786,12 @@ sub build_contact_select { sub build_shipto_select { my ($self) = @_; - $self->p->select_tag('order.shipto_id', [ $self->order->{$self->cv}->shipto ], - value_key => 'shipto_id', - title_key => 'displayable_id', - default => $self->order->shipto_id, - with_empty => 1, - style => 'width: 300px', + select_tag('order.shipto_id', [ $self->order->{$self->cv}->shipto ], + value_key => 'shipto_id', + title_key => 'displayable_id', + default => $self->order->shipto_id, + with_empty => 1, + style => 'width: 300px', ); } diff --git a/SL/DB/DeliveryOrderItem.pm b/SL/DB/DeliveryOrderItem.pm index c60b2a501..045e2e6c7 100644 --- a/SL/DB/DeliveryOrderItem.pm +++ b/SL/DB/DeliveryOrderItem.pm @@ -43,7 +43,7 @@ sub displayable_delivery_order_info { $dec //= 2; - return SL::Presenter->get->sales_delivery_order($self->delivery_order, display => 'inline') + $self->delivery_order->presenter->sales_delivery_order(display => 'inline') . " " . $::form->format_amount(\%::myconfig, $self->qty, $dec) . " " . $self->unit . " (" . $self->delivery_order->transdate->to_kivitendo . ")"; }; diff --git a/SL/DB/GLTransaction.pm b/SL/DB/GLTransaction.pm index 2ad8e0c0d..b0c265515 100644 --- a/SL/DB/GLTransaction.pm +++ b/SL/DB/GLTransaction.pm @@ -46,7 +46,7 @@ sub link { my ($self) = @_; my $html; - $html = SL::Presenter->get->gl_transaction($self, display => 'inline'); + $html = $self->presenter->gl_transaction(display => 'inline'); return $html; } diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 44b81dfd0..ad590c79c 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -578,8 +578,8 @@ sub link { my ($self) = @_; my $html; - $html = SL::Presenter->get->sales_invoice($self, display => 'inline') if $self->invoice; - $html = SL::Presenter->get->ar_transaction($self, display => 'inline') if !$self->invoice; + $html = $self->presenter->sales_invoice(display => 'inline') if $self->invoice; + $html = $self->presenter->ar_transaction(display => 'inline') if !$self->invoice; return $html; } diff --git a/SL/DB/PurchaseInvoice.pm b/SL/DB/PurchaseInvoice.pm index 631816591..93fc1fe30 100644 --- a/SL/DB/PurchaseInvoice.pm +++ b/SL/DB/PurchaseInvoice.pm @@ -99,8 +99,8 @@ sub link { my ($self) = @_; my $html; - $html = SL::Presenter->get->purchase_invoice($self, display => 'inline') if $self->invoice; - $html = SL::Presenter->get->ap_transaction($self, display => 'inline') if !$self->invoice; + $html = $self->presenter->purchase_invoice(display => 'inline') if $self->invoice; + $html = $self->presenter->ap_transaction(display => 'inline') if !$self->invoice; return $html; } diff --git a/SL/IR.pm b/SL/IR.pm index 891f24a6f..45cd7de7d 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -50,6 +50,7 @@ use SL::MoreCommon; use SL::DB::Default; use SL::DB::TaxZone; use SL::DB; +use SL::Presenter::Part qw(type_abbreviation classification_abbreviation); use List::Util qw(min); use strict; @@ -1309,8 +1310,8 @@ sub retrieve_item { if (($::form->{"partnumber_$i"} ne '') && ($ref->{ean} eq $::form->{"partnumber_$i"})) { push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean}; } - $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}). - $::request->presenter->classification_abbreviation($ref->{classification_id}); + $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) . + classification_abbreviation($ref->{classification_id}); if (! $ref->{used_for_purchase} ) { $has_wrong_pclass = PCLASS_NOTFORPURCHASE; diff --git a/SL/IS.pm b/SL/IS.pm index 3b90ceaa5..609d3c015 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -57,6 +57,7 @@ use SL::DB::Tax; use SL::DB::TaxZone; use SL::TransNumber; use SL::DB; +use SL::Presenter::Part qw(type_abbreviation classification_abbreviation); use Data::Dumper; use strict; @@ -2353,8 +2354,8 @@ sub retrieve_item { push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean}; } - $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}). - $::request->presenter->classification_abbreviation($ref->{classification_id}); + $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) . + classification_abbreviation($ref->{classification_id}); if (! $ref->{used_for_sale} ) { $has_wrong_pclass = PCLASS_NOTFORSALE ; next; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index dfd65c50c..14c95821f 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -53,6 +53,7 @@ use SL::IC; use SL::IO; use SL::File; use SL::PriceSource; +use SL::Presenter::Part; use SL::DB::Contact; use SL::DB::Customer; @@ -308,8 +309,8 @@ sub display_row { $column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -id => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"}); - $column_data{type_and_classific} = $::request->presenter->type_abbreviation($form->{"part_type_$i"}). - $::request->presenter->classification_abbreviation($form->{"classification_id_$i"}) if $form->{"id_$i"}; + $column_data{type_and_classific} = SL::Presenter::Part::type_abbreviation($form->{"part_type_$i"}). + SL::Presenter::Part::classification_abbreviation($form->{"classification_id_$i"}) if $form->{"id_$i"}; $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30) : $cgi->textfield(-name => "description_$i", -id => "description_$i", -value => $form->{"description_$i"}, -size => 30)) diff --git a/templates/webpages/ap/form_header.html b/templates/webpages/ap/form_header.html index d749e581e..45dcf332a 100644 --- a/templates/webpages/ap/form_header.html +++ b/templates/webpages/ap/form_header.html @@ -1,4 +1,5 @@ [%- USE L %] +[%- USE P %] [%- USE HTML %] [%- USE T8 %] [%- USE LxERP %][%- USE P -%] @@ -82,7 +83,7 @@ [% 'Vendor' | $T8 %] - [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px", onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker("vendor_id", vendor_id, type="vendor", style="width: 300px", onchange="\$('#update_button').click()") %] [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %] [% L.hidden_tag("previous_vendor_id", vendor_id) %] @@ -188,7 +189,7 @@ [% SET selected_chart_id = "AP_amount_chart_id_"_ i %] - [% P.chart_picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %] + [% P.chart.picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %] [% L.hidden_tag("previous_AP_amount_chart_id_" _ i, $selected_chart_id) %] @@ -217,7 +218,7 @@ - [% P.chart_picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %] + [% P.chart.picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %] [% invtotal | html %] diff --git a/templates/webpages/ap/search.html b/templates/webpages/ap/search.html index ac1d70fd6..3ee796ff7 100644 --- a/templates/webpages/ap/search.html +++ b/templates/webpages/ap/search.html @@ -37,7 +37,7 @@ [% 'Project Number' | $T8 %] - [% P.project_picker("project_id", project_id, style=style) %] + [% P.project.picker("project_id", project_id, style=style) %] [% 'Part Number' | $T8 %] [% L.input_tag("parts_partnumber", "", style=style) %] diff --git a/templates/webpages/ar/form_header.html b/templates/webpages/ar/form_header.html index d1916ecea..75bc22eb4 100644 --- a/templates/webpages/ar/form_header.html +++ b/templates/webpages/ar/form_header.html @@ -47,7 +47,7 @@ [% 'Customer' | $T8 %] - [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : ""), onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : ""), onchange="\$('#update_button').click()") %] [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %] [% L.hidden_tag("previous_customer_id", customer_id) %] [% L.hidden_tag('terms', terms) %] @@ -181,7 +181,7 @@ - [% P.chart_picker("AR_chart_id", AR_chart_id, style="width: 400px", type="AR") %] + [% P.chart.picker("AR_chart_id", AR_chart_id, style="width: 400px", type="AR") %] [% LxERP.format_amount(invtotal, 2) | html %] diff --git a/templates/webpages/ar/search.html b/templates/webpages/ar/search.html index f3b7aa2fc..c32800377 100644 --- a/templates/webpages/ar/search.html +++ b/templates/webpages/ar/search.html @@ -56,7 +56,7 @@ [% 'Project Number' | $T8 %] - [% P.project_picker("project_id", project_id, style=style) %] + [% P.project.picker("project_id", project_id, style=style) %] [% IF ALL_BUSINESS_TYPES.as_list.size > 0 %] diff --git a/templates/webpages/do/form_header.html b/templates/webpages/do/form_header.html index ef87d879d..6e7c49984 100644 --- a/templates/webpages/do/form_header.html +++ b/templates/webpages/do/form_header.html @@ -136,7 +136,7 @@ [% P.hidden_tag(vc_id, $vc_id) %] [% HTML.escape(VC_OBJ.name) %] [% ELSE %] - [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="fixed_width", onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker(vc_id, $vc_id, type=vc, class="fixed_width", onchange="\$('#update_button').click()") %] [% END %] [% P.hidden_tag("previous_" _ vc_id, $vc_id) %] [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %] diff --git a/templates/webpages/ir/form_header.html b/templates/webpages/ir/form_header.html index de5e62344..775a8b636 100644 --- a/templates/webpages/ir/form_header.html +++ b/templates/webpages/ir/form_header.html @@ -51,7 +51,7 @@ [% 'Vendor' | $T8 %] - [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] [% P.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %] [% P.hidden_tag("previous_vendor_id", vendor_id) %] @@ -181,7 +181,7 @@ [% 'Project Number' | $T8 %] - [% P.project_picker('globalproject_id', globalproject_id) %] + [% P.project.picker('globalproject_id', globalproject_id) %] diff --git a/templates/webpages/is/form_header.html b/templates/webpages/is/form_header.html index 310508b76..5990f493d 100644 --- a/templates/webpages/is/form_header.html +++ b/templates/webpages/is/form_header.html @@ -54,7 +54,7 @@ [% 'Customer' | $T8 %] - [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %] [% L.hidden_tag("previous_customer_id", customer_id) %] [% L.hidden_tag("customer_pricegroup_id", customer_pricegroup_id) %] diff --git a/templates/webpages/oe/form_header.html b/templates/webpages/oe/form_header.html index 70735eaff..293265510 100644 --- a/templates/webpages/oe/form_header.html +++ b/templates/webpages/oe/form_header.html @@ -60,7 +60,7 @@ [% IF vc == 'customer' %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %] [%- SET vc_id = vc _ "_id" %] - [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] + [% P.customer_vendor.picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %] [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %] [% P.hidden_tag("previous_" _ vc_id, $vc_id) %] diff --git a/templates/webpages/oe/search.html b/templates/webpages/oe/search.html index 53b1a4764..e780d4b48 100644 --- a/templates/webpages/oe/search.html +++ b/templates/webpages/oe/search.html @@ -65,7 +65,7 @@ [% 'Project' | $T8 %] - [% P.project_picker("project_id", '', style=style) %] + [% P.project.picker("project_id", '', style=style) %] [% 'Part Number' | $T8 %] [% L.input_tag("parts_partnumber", "", style=style) %] diff --git a/templates/webpages/order/tabs/_item_input.html b/templates/webpages/order/tabs/_item_input.html index 1d86cf42f..9c6b5725f 100644 --- a/templates/webpages/order/tabs/_item_input.html +++ b/templates/webpages/order/tabs/_item_input.html @@ -1,4 +1,4 @@ -[%- USE T8 %][%- USE HTML %][%- USE LxERP %][%- USE L %] +[%- USE T8 %][%- USE HTML %][%- USE LxERP %][%- USE L %][%- USE P %]
@@ -14,7 +14,7 @@ - + [% FOREACH order_item = SELF.orderitems %] - - - + + +
[% L.part_picker('add_item.parts_id', '', fat_set_item=1, style='width: 300px', class="add_item_input") %][% P.part.picker('add_item.parts_id', '', fat_set_item=1, style='width: 300px', class="add_item_input") %] [% L.input_tag('add_item.description', '', class="add_item_input") %] [% L.input_tag('add_item.qty_as_number', '', size = 5, class="add_item_input numeric") %] diff --git a/templates/webpages/order/tabs/_row.html b/templates/webpages/order/tabs/_row.html index 7b2e2e71a..f000ba6fd 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -35,7 +35,7 @@
[% HTML.escape(ITEM.part.partnumber) %]
-
[% P.typeclass_abbreviation(ITEM.part) %]
+
[% ITEM.part.presenter.typeclass_abbreviation %]
[% L.areainput_tag("order.orderitems[].description", diff --git a/templates/webpages/order/tabs/_second_row.html b/templates/webpages/order/tabs/_second_row.html index 9e1370858..1a09f0f69 100644 --- a/templates/webpages/order/tabs/_second_row.html +++ b/templates/webpages/order/tabs/_second_row.html @@ -2,13 +2,14 @@ [%- USE HTML %] [%- USE LxERP %] [%- USE L %] +[%- USE P %] [% SET cv_id = SELF.cv _ '_id' %] - + @@ -69,7 +70,7 @@ - +
[%- 'Serial No.' | $T8 %]  [%- L.input_tag("order.orderitems[].serialnumber", ITEM.serialnumber, size = 15) %]  [%- 'Project' | $T8 %]  - [% L.project_picker("order.orderitems[].project_id", ITEM.project_id, size = 15) %]  + [% P.project.picker("order.orderitems[].project_id", ITEM.project_id, size = 15) %]  [%- 'Reqdate' | $T8 %]  [% L.date_tag("order.orderitems[].reqdate", ITEM.reqdate) %]  [%- 'Subtotal' | $T8 %]  diff --git a/templates/webpages/order/tabs/basic_data.html b/templates/webpages/order/tabs/basic_data.html index 526e028bf..ad41537f9 100644 --- a/templates/webpages/order/tabs/basic_data.html +++ b/templates/webpages/order/tabs/basic_data.html @@ -2,6 +2,7 @@ [%- USE HTML %] [%- USE LxERP %] [%- USE L %] +[%- USE P %] [%- INCLUDE 'generic/set_longdescription.html' %] @@ -13,7 +14,7 @@
[% SELF.cv | $T8 %][% L.customer_vendor_picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %][% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]
[% 'Project Number' | $T8 %][% L.project_picker('order.globalproject_id', SELF.order.globalproject_id, style='width: 300px') %][% P.project.picker('order.globalproject_id', SELF.order.globalproject_id, style='width: 300px') %]
diff --git a/templates/webpages/order_items_search/_order_item_list.html b/templates/webpages/order_items_search/_order_item_list.html index 0ae57596d..e79d0e4da 100644 --- a/templates/webpages/order_items_search/_order_item_list.html +++ b/templates/webpages/order_items_search/_order_item_list.html @@ -21,9 +21,9 @@
[% P.part(order_item.part, no_link => 0) %] [% P.customer(order_item.order.customer, no_link => 0) %] [% P.sales_order(order_item.order, no_link => 0) %] [% order_item.part.presenter.part(no_link => 0) %] [% order_item.order.customer.presenter.customer(no_link => 0) %] [% order_item.order.presenter.sales_order(no_link => 0) %] [% order_item.order.transdate.to_kivitendo %] [% LxERP.format_amount(order_item.qty, qty_round) %] [% order_item.unit | html %] diff --git a/templates/webpages/order_items_search/order_items.html b/templates/webpages/order_items_search/order_items.html index 8bcfa9202..495d2a5e4 100644 --- a/templates/webpages/order_items_search/order_items.html +++ b/templates/webpages/order_items_search/order_items.html @@ -2,6 +2,7 @@ [%- USE LxERP %] [%- USE T8 %] [%- USE L %] +[%- USE P %] [% SET size=50 %] [% SET show_images=0 %] @@ -13,7 +14,7 @@ - +
[% 'Customer' | $T8 %][% L.customer_vendor_picker('filter.order.customer.id', FORM.customer_id, type='customer', class="filter", size=size) %][% P.customer_vendor.picker('filter.order.customer.id', FORM.customer_id, type='customer', class="filter", size=size) %]
[% 'Part' | $T8 %]