From: Sven Schöling Date: Tue, 19 Dec 2017 14:31:51 +0000 (+0100) Subject: Presenter: Neue Struktur im Warenstamm umgesetzt X-Git-Tag: release-3.5.4~562 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9c29f7183bb2e2861553339789d7ac8ba7dd188d;p=kivitendo-erp.git Presenter: Neue Struktur im Warenstamm umgesetzt --- diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index f152e0844..53d51ced5 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -19,6 +19,7 @@ use SL::DB::Helper::ValidateAssembly qw(validate_assembly); use SL::CVar; use SL::MoreCommon qw(save_form); use Carp; +use SL::Presenter::EscapedText qw(escape is_escaped); use Rose::Object::MakeMethods::Generic ( 'scalar --get_set_init' => [ qw(parts models part p warehouses multi_items_models @@ -408,10 +409,10 @@ sub action_multi_items_update_result { my $count = $_[0]->multi_items_models->count; if ($count == 0) { - my $text = SL::Presenter::EscapedText->new(text => $::locale->text('No results.')); + my $text = escape($::locale->text('No results.')); $_[0]->render($text, { layout => 0 }); } elsif ($count > $max_count) { - my $text = SL::Presenter::EscapedText->new(text => $::locale->text('Too many results (#1 from #2).', $count, $max_count)); + my $text = escpae($::locale->text('Too many results (#1 from #2).', $count, $max_count)); $_[0]->render($text, { layout => 0 }); } else { my $multi_items = $_[0]->multi_items_models->get; diff --git a/SL/IC.pm b/SL/IC.pm index 54a2c5d78..0b836a0a1 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -45,6 +45,7 @@ use SL::HTML::Restrict; use SL::TransNumber; use SL::Util qw(trim); use SL::DB; +use SL::Presenter::Part qw(type_abbreviation classification_abbreviation separate_abbreviation); use Carp; use strict; @@ -640,8 +641,8 @@ sub get_parts { } $j++; - $form->{"type_and_classific_$j"} = $::request->presenter->type_abbreviation($ref->{part_type}). - $::request->presenter->classification_abbreviation($ref->{classification_id}); + $form->{"type_and_classific_$j"} = type_abbreviation($ref->{part_type}). + classification_abbreviation($ref->{classification_id}); $form->{"id_$j"} = $ref->{id}; $form->{"partnumber_$j"} = $ref->{partnumber}; $form->{"description_$j"} = $ref->{description}; @@ -938,11 +939,11 @@ sub prepare_parts_for_printing { my $id = $form->{"${prefix}${i}"}; next unless $id; my $prt = $parts_by_id{$id}; - my $type_abbr = $::request->presenter->type_abbreviation($prt->part_type); + my $type_abbr = type_abbreviation($prt->part_type); push @{ $template_arrays{part_type} }, $prt->part_type; push @{ $template_arrays{part_abbreviation} }, $type_abbr; - push @{ $template_arrays{type_and_classific}}, $type_abbr.$::request->presenter->classification_abbreviation($prt->classification_id); - push @{ $template_arrays{separate} }, $::request->presenter->separate_abbreviation($prt->classification_id); + push @{ $template_arrays{type_and_classific}}, $type_abbr . classification_abbreviation($prt->classification_id); + push @{ $template_arrays{separate} }, separate_abbreviation($prt->classification_id); } $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 784cc1ad2..9fd05898d 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -41,6 +41,7 @@ use SL::CVar; use SL::IC; use SL::Helper::Flash qw(flash); use SL::HTML::Util; +use SL::Presenter::Part; use SL::ReportGenerator; #use SL::PE; @@ -556,8 +557,8 @@ sub generate_report { map { $row->{$_}{link} = $ref->{$_} } qw(drawing microfiche); $row->{notes}{data} = SL::HTML::Util->strip($ref->{notes}); - $row->{type_and_classific}{data} = $::request->presenter->type_abbreviation($ref->{part_type}). - $::request->presenter->classification_abbreviation($ref->{classification_id}); + $row->{type_and_classific}{data} = SL::Presenter::Part::type_abbreviation($ref->{part_type}). + SL::Presenter::Part::classification_abbreviation($ref->{classification_id}); $report->add_data($row); diff --git a/templates/webpages/ic/search.html b/templates/webpages/ic/search.html index 0df68022d..0b3dd0809 100644 --- a/templates/webpages/ic/search.html +++ b/templates/webpages/ic/search.html @@ -54,7 +54,7 @@ [% 'Part Classification' | $T8 %]: - [% P.select_classification('classification_id', style=style) %] + [% P.part.select_classification('classification_id', style=style) %] [% 'Part Description' | $T8 %] diff --git a/templates/webpages/part/_assembly.html b/templates/webpages/part/_assembly.html index bec2f89d1..629122947 100644 --- a/templates/webpages/part/_assembly.html +++ b/templates/webpages/part/_assembly.html @@ -2,6 +2,7 @@ [%- USE HTML %] [%- USE LxERP %] [%- USE L %] +[%- USE P %]
@@ -41,7 +42,7 @@ [% 'Part' | $T8 %]: - [% L.part_picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assembly_picker', action={set_multi_items='kivi.Part.set_multi_assembly_items', commit_one='kivi.Part.add_assembly_item'}) %] + [% P.part.picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assembly_picker', action={set_multi_items='kivi.Part.set_multi_assembly_items', commit_one='kivi.Part.add_assembly_item'}) %] [%- L.button_tag("kivi.Part.add_assembly_item()", LxERP.t8("Add")) %] [% L.button_tag('$("#assembly_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %] [% L.hidden_tag('add_items[].qty_as_number', 1) %] diff --git a/templates/webpages/part/_assembly_row.html b/templates/webpages/part/_assembly_row.html index 4be4f4c94..95c097ac5 100644 --- a/templates/webpages/part/_assembly_row.html +++ b/templates/webpages/part/_assembly_row.html @@ -22,10 +22,10 @@ [%- LxERP.t8('reorder item') %] - [% P.part(ITEM.part) %] + [% ITEM.part.presenter.part %] - [% P.type_abbreviation(ITEM.part.part_type) %][% P.classification_abbreviation(ITEM.part.classification_id) %] + [% P.part.type_abbreviation(ITEM.part.part_type) %][% P.classification_abbreviation(ITEM.part.classification_id) %] [% HTML.escape(ITEM.part.description) %] diff --git a/templates/webpages/part/_assortment.html b/templates/webpages/part/_assortment.html index 934bdc459..55b04e83f 100644 --- a/templates/webpages/part/_assortment.html +++ b/templates/webpages/part/_assortment.html @@ -2,6 +2,7 @@ [%- USE HTML %] [%- USE LxERP %] [%- USE L %] +[%- USE P %]
@@ -40,7 +41,7 @@ [% 'Part' | $T8 %]: - [% L.part_picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assortment_picker', action={set_multi_items='kivi.Part.set_multi_assortment_items'}) %] + [% P.part.picker('add_items[+].parts_id', '', style='width: 300px', multiple=1, id='assortment_picker', action={set_multi_items='kivi.Part.set_multi_assortment_items'}) %] [%- L.button_tag("kivi.Part.add_assortment_item()", LxERP.t8("Add")) %] [% L.button_tag('$("#assortment_picker").data("part_picker").open_dialog()', LxERP.t8('Add multiple items')) %] [% L.hidden_tag('add_items[].qty_as_number', 1) %] diff --git a/templates/webpages/part/_assortment_row.html b/templates/webpages/part/_assortment_row.html index a86412c91..fcd88fd8f 100644 --- a/templates/webpages/part/_assortment_row.html +++ b/templates/webpages/part/_assortment_row.html @@ -22,7 +22,7 @@ [%- LxERP.t8('reorder item') %] - [% P.part(ITEM.part) %] + [% ITEM.part.presenter.part %] [% HTML.escape(ITEM.part.description) %] diff --git a/templates/webpages/part/_basic_data.html b/templates/webpages/part/_basic_data.html index 00ee4adf7..06a704180 100644 --- a/templates/webpages/part/_basic_data.html +++ b/templates/webpages/part/_basic_data.html @@ -23,7 +23,7 @@ [% 'Part Classification' | $T8 %] - [% P.select_classification('part.classification_id', default => SELF.part.classification_id, type => SELF.parts_classification_filter ) %] + [% P.part.select_classification('part.classification_id', default => SELF.part.classification_id, type => SELF.parts_classification_filter ) %] [% 'Part Description' | $T8 %] diff --git a/templates/webpages/part/_makemodel.html b/templates/webpages/part/_makemodel.html index 8822aba0d..6f3ecc7a8 100644 --- a/templates/webpages/part/_makemodel.html +++ b/templates/webpages/part/_makemodel.html @@ -1,5 +1,6 @@ [%- USE T8 %] [%- USE L %] +[%- USE P %] [%- USE HTML %] [%- USE LxERP %] @@ -30,7 +31,7 @@ [% 'Vendor' | $T8 %] - [% L.customer_vendor_picker('add_makemodel', '', type='vendor', style='width: 300px', class="add_makemodel_input") %] + [% P.customer_vendor.picker('add_makemodel', '', type='vendor', style='width: 300px', class="add_makemodel_input") %] [% L.button_tag('kivi.Part.add_makemodel_row()', LxERP.t8('Add')) %] diff --git a/templates/webpages/part/_multi_items_result.html b/templates/webpages/part/_multi_items_result.html index a06fe3d00..7a710fb48 100644 --- a/templates/webpages/part/_multi_items_result.html +++ b/templates/webpages/part/_multi_items_result.html @@ -25,7 +25,7 @@ class = 'multi_items_qty numeric') %] [% HTML.escape(item.unit) %] - [% P.part(item) %] [% HTML.escape(item.description) %] + [% item.presenter.part %] [% HTML.escape(item.description) %] [% HTML.escape(item.sellprice_as_number) %] [% HTML.escape(item.partsgroup.partsgroup) %] diff --git a/templates/webpages/part/_part_picker_result.html b/templates/webpages/part/_part_picker_result.html index d6a386fcc..677e772db 100644 --- a/templates/webpages/part/_part_picker_result.html +++ b/templates/webpages/part/_part_picker_result.html @@ -16,7 +16,7 @@ [% part.description | html %]
[% 'Sellprice' | $T8 %]: [% part.sellprice_as_number | html %] - [% P.typeclass_abbreviation(part) %] + [% part.presenter.typeclass_abbreviation %]
[%- END %] diff --git a/templates/webpages/part/test_page.html b/templates/webpages/part/test_page.html index 4527534ab..fb7853f3f 100644 --- a/templates/webpages/part/test_page.html +++ b/templates/webpages/part/test_page.html @@ -1,52 +1,53 @@ [% USE L %] +[% USE P %]

Part Picker Testpage


Alle:
-[% L.part_picker('part_id') %] text
+[% P.part.picker('part_id') %] text
Nur Waren:
-[% L.part_picker('part_id2', undef, part_type='part') %]
+[% P.part.picker('part_id2', undef, part_type='part') %]
Nur Dienstleistungen:
-[% L.part_picker('part_id3', undef, part_type='service') %]
+[% P.part.picker('part_id3', undef, part_type='service') %]
Nur Erzeugnisse:
-[% L.part_picker('part_id4', undef, part_type='assembly') %]
+[% P.part.picker('part_id4', undef, part_type='assembly') %]
Waren und Dienstleistungen:
-[% L.part_picker('part_id5', undef, part_type='part,service') %]
+[% P.part.picker('part_id5', undef, part_type='part,service') %]
Artikel-Klassifizierung: Einkauf
-[% L.part_picker('part_id10', undef, classification_id='1') %]
+[% P.part.picker('part_id10', undef, classification_id='1') %]
Artikel-Klassifizierung: Verkauf
-[% L.part_picker('part_id11', undef, classification_id='2') %]
+[% P.part.picker('part_id11', undef, classification_id='2') %]
Artikel-Klassifizierung: Handelsware
-[% L.part_picker('part_id12', undef, classification_id='3') %]
+[% P.part.picker('part_id12', undef, classification_id='3') %]
Artikel-Klassifizierung: Produktion
-[% L.part_picker('part_id13', undef, classification_id='4') %]
+[% P.part.picker('part_id13', undef, classification_id='4') %]
Artikel-Klassifizierung: Eink.,Verk.,Prod.
-[% L.part_picker('part_id14', undef, classification_id='1,2,4') %]
+[% P.part.picker('part_id14', undef, classification_id='1,2,4') %]
Pre-filled:
-[% L.part_picker('part_id6', pre_filled_part) %]
+[% P.part.picker('part_id6', pre_filled_part) %]
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)
-[% L.part_picker('part_id7', undef, convertible_unit='Std') %]
+[% P.part.picker('part_id7', undef, convertible_unit='Std') %]
With multi select popup
-[% L.part_picker('part_id8', undef, multiple=1) %]
+[% P.part.picker('part_id8', undef, multiple=1) %]

Styling

In a span: -Leading text: [% L.part_picker('p1', undef, part_type='part,service') %] and text after with spacing
-Leading text:[% L.part_picker('p2', undef, part_type='part,service') %]and text after without spacing
-
Leading text: [% L.part_picker('p3', undef, part_type='part,service') %] and text after with spacing with div

-
Leading text:[% L.part_picker('p4', undef, part_type='part,service') %]and text after with spacing with div

+Leading text: [% P.part.picker('p1', undef, part_type='part,service') %] and text after with spacing
+Leading text:[% P.part.picker('p2', undef, part_type='part,service') %]and text after without spacing
+
Leading text: [% P.part.picker('p3', undef, part_type='part,service') %] and text after with spacing with div

+
Leading text:[% P.part.picker('p4', undef, part_type='part,service') %]and text after with spacing with div

-Picker + input next to each other: [% L.part_picker('p5', undef, part_type='part,service', width="100%") %] +Picker + input next to each other: [% P.part.picker('p5', undef, part_type='part,service', width="100%") %] -
[% L.part_picker('p6', undef, part_type='part,service', style="width:500px") %] 500px width
-
[% L.part_picker('p7', undef, part_type='part,service', style="width:200px") %] 200px width
-
[% L.part_picker('p8', undef, part_type='part,service', style="height:40px") %] 40px height
+
[% P.part.picker('p6', undef, part_type='part,service', style="width:500px") %] 500px width
+
[% P.part.picker('p7', undef, part_type='part,service', style="width:200px") %] 200px width
+
[% P.part.picker('p8', undef, part_type='part,service', style="height:40px") %] 40px height
[%# FOREACH i IN 1..50 %] -[%# L.part_picker('part_id_' _ i) %]
+[%# P.part.picker('part_id_' _ i) %]
[%# END %]

In tables

@@ -56,11 +57,11 @@ In a span: - + - +
Part picker in table heading[% L.part_picker('p9', undef, part_type='part,service') %][% P.part.picker('p9', undef, part_type='part,service') %]
Part picker in table cell[% L.part_picker('p10', undef, part_type='part,service') %][% P.part.picker('p10', undef, part_type='part,service') %]
@@ -69,10 +70,10 @@ In a span: - + - +
Part picker in table heading[% L.part_picker('p11', undef, part_type='part,service') %][% P.part.picker('p11', undef, part_type='part,service') %]
Part picker in table cell[% L.part_picker('p12', undef, part_type='part,service') %][% P.part.picker('p12', undef, part_type='part,service') %]