Bug 14141: Do not let edit the branch when updating/copying notice
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 14 Jul 2015 11:00:33 +0000 (12:00 +0100)
committerLiz Rea <wizzyrea@gmail.com>
Wed, 28 Oct 2015 01:12:04 +0000 (14:12 +1300)
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.

Works ok.

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
(cherry picked from commit 605f42a721b3a534d01b8f7c73502cfa810147ad)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
(cherry picked from commit 54cf2cc340e7f2abe96cdcfcb8aa4bb82031df79)
Signed-off-by: Liz Rea <wizzyrea@gmail.com>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
tools/letter.pl

index 6ad36eb..43fd3ad 100644 (file)
@@ -267,19 +267,24 @@ $(document).ready(function() {
                [% END %]
                <fieldset class="rows">
             <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
+            <ol>
             [% IF independant_branch %]
                 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
             [% ELSE %]
-               <ol>
-                       <li>
-                               <label for="branch">Library:</label>
-                <select name="branchcode" id="branch" style="width:20em;">
-                    <option value="">All libraries</option>
-                [% FOREACH branchloo IN branchloop %]
-                    [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
+            <li>
+
+                <label for="branch">Library:</label>
+                [% IF adding %]
+                    <select name="branchcode" id="branch" style="width:20em;">
+                        <option value="">All libraries</option>
+                    [% FOREACH branchloo IN branchloop %]
+                        [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
+                    [% END %]
+                    </select>
+                [% ELSE %]
+                    [% Branches.GetName( branchcode ) %]
                 [% END %]
-                </select>
-                       </li>
+            </li>
             [% END %]
                        <li>
                                <label for="module">Koha module:</label>
index 999b33c..331116c 100755 (executable)
@@ -235,6 +235,7 @@ sub add_form {
         module     => $module,
         branchloop => _branchloop($branchcode),
         SQLfieldnames => $field_selection,
+        branchcode => $branchcode,
     );
     return;
 }