From 67814d7d3ae60f48c7f970474de7b102e93639a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 27 Oct 2017 15:52:05 +0200 Subject: [PATCH] Erzeugnis nach Fertigen editieren -> Recht in template ausgelagert MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Vorher buggy und konzeptionell schlecht, da keine Unterscheidung von orphaned zu 'darf doch nach fertigen editierbar sein' möglich war. Ferner auch keine Differenzierung zum Sortiment möglich. Mit diesem Commit ist verwaist wieder verwaist und das zusätzliche Aushebeln des Schreibschutz beim Erzeugnis sauber nur über das Recht definiert. --- SL/Controller/Part.pm | 2 +- templates/webpages/part/_assembly.html | 8 ++++---- templates/webpages/part/_assembly_row.html | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index d27304029..f152e0844 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -813,7 +813,7 @@ sub init_part { sub init_orphaned { my ($self) = @_; - return $::auth->assert('assembly_edit', 1) // $self->part->orphaned; + return $self->part->orphaned; } sub init_models { diff --git a/templates/webpages/part/_assembly.html b/templates/webpages/part/_assembly.html index 66b9a7065..bec2f89d1 100644 --- a/templates/webpages/part/_assembly.html +++ b/templates/webpages/part/_assembly.html @@ -13,11 +13,11 @@ - [% IF SELF.orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [%- LxERP.t8('delete item') %] [% END %] [%- 'position' | $T8 %] - [% IF SELF.orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [%- LxERP.t8('reorder item') %] [% END %] [%- 'Partnumber' | $T8 %] @@ -37,7 +37,7 @@ - [% IF SELF.orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [% 'Part' | $T8 %]: @@ -60,7 +60,7 @@ [%- LxERP.format_amount(items_sum_diff, 2, 0) %] - [% IF SELF.orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [% END %] diff --git a/templates/webpages/part/_assembly_row.html b/templates/webpages/part/_assembly_row.html index e57215e29..e629ff875 100644 --- a/templates/webpages/part/_assembly_row.html +++ b/templates/webpages/part/_assembly_row.html @@ -5,11 +5,11 @@ [%- USE P %] - [% IF orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [% L.hidden_tag("assembly_items[+].parts_id", ITEM.part.id) %] [% END %] - + [%- L.button_tag("kivi.Part.delete_item_row(this)", LxERP.t8("X")) %] [% # , confirm=LxERP.t8("Are you sure?")) %] @@ -18,7 +18,7 @@ [% HTML.escape(position) or HTML.escape(ITEM.position) %] - + [%- LxERP.t8('reorder item') %] @@ -31,7 +31,7 @@ [% HTML.escape(ITEM.part.description) %] - [% IF orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [%- L.input_tag("assembly_items[].qty_as_number", ITEM.qty_as_number, size = 10, @@ -43,7 +43,7 @@ [% ITEM.part.unit | html %] - [% IF orphaned %] + [% IF SELF.orphaned || AUTH.assert('assembly_edit', 1) %] [% L.checkbox_tag("assembly_items[].bom", checked=ITEM.bom, for_submit=1) %] [% ELSE %] [% IF ITEM.bom %][% 'Yes' | $T8 %][% ELSE %][% 'No' | $T8 %][% END %] -- 2.20.1