From: Jan Büren Date: Fri, 27 Oct 2017 13:52:05 +0000 (+0200) Subject: Erzeugnis nach Fertigen editieren -> Recht in template ausgelagert X-Git-Tag: release-3.5.4~663 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=67814d7d3ae60f48c7f970474de7b102e93639a2;p=kivitendo-erp.git Erzeugnis nach Fertigen editieren -> Recht in template ausgelagert 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. --- 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 %]