From 6aa8481c67112afbbea15a7627653ac218dfea7d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 14 Jul 2015 12:00:33 +0100 Subject: [PATCH] Bug 14141: Do not let edit the branch when updating/copying notice If a user modify the library when he's updating a notice, the notice will be duplicated, instead of modified. To reproduce: 1/ Go on the notice & slips tools (tools/letter.pl) 2/ Create a notice A for library L1 3/ Edit this notice and update the library with L2 4/ On the list view, you will observe that 2 notices A now exist, one for L1 and one for L2. The code in tools/letters.pl should be rebuilt completely, it becomes a house of cards. To prevent this bug, I suggest to not let the user modify the library value on editing a notice. It cans be done by copying the notice to another library and remove the original one. Counter patch welcomed. Test plan: 1/ Go on the notice & slips tools (tools/letter.pl). 2/ Create a notice A for library L1. 3/ Edit this notice: you are not able to modify the library anymore. 4/ Copy the notice to library L2. You are not able to modify the library neither. --- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 23 +++++++++++++--------- tools/letter.pl | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 06bf585..be5ddac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -271,19 +271,24 @@ $(document).ready(function() { [% END %]
+
    [% IF independant_branch %] [% ELSE %] -
      -
    1. - - + + [% FOREACH branchloo IN branchloop %] + [% IF ( branchloo.selected ) %][% ELSE %][% END %] + [% END %] + + [% ELSE %] + [% Branches.GetName( branchcode ) %] [% END %] - -
    2. + [% END %]
    3. diff --git a/tools/letter.pl b/tools/letter.pl index ca9f0ce..487cb2d 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -238,6 +238,7 @@ sub add_form { module => $module, branchloop => _branchloop($branchcode), SQLfieldname => $field_selection, + branchcode => $branchcode, ); return; } -- 2.1.0