Bug 16256 - Can't edit library EAN if you leave EAN empty
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 18 Apr 2016 16:19:47 +0000 (16:19 +0000)
committerBrendan Gallagher <bredan@bywatersolutions.com>
Wed, 20 Apr 2016 16:52:17 +0000 (16:52 +0000)
Test Plan:
1) Create an empty EAN
2) Edit it and save
3) Note you get a new EAN row
4) Apply this patch
5) Edit the empty EAN again
6) Note you now get an updated EAN and not a new row

Signed-off-by: Chris Cormack <chrisc@catalyst.net.z>
Depends on bug 16208 (which depends on 16206)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
admin/edi_ean_accounts.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/edi_ean_accounts.tt

index ceb7ef5..f65ab9e 100755 (executable)
@@ -58,7 +58,7 @@ elsif ( $op eq 'delete_confirm' ) {
 }
 else {
     if ( $op eq 'save' ) {
-        my $change = $input->param('oldean');
+        my $change = $input->param('id');
         if ($change) {
             editsubmit();
         }
@@ -124,19 +124,14 @@ sub addsubmit {
 }
 
 sub editsubmit {
-    $schema->resultset('EdifactEan')->search(
-        {
-            branchcode => $input->param('oldbranchcode'),
-            ean        => $input->param('oldean'),
-        }
-      )->update_all(
+    $schema->resultset('EdifactEan')->find( $input->param('id') )->update(
         {
             branchcode        => $input->param('branchcode'),
             description       => $input->param('description'),
             ean               => $input->param('ean'),
             id_code_qualifier => $input->param('id_code_qualifier'),
         }
-      );
+    );
     return;
 }
 
index 1bbf671..03614ad 100644 (file)
@@ -52,7 +52,7 @@
   <input type="hidden" name="op" value="save" />
   [% IF ean %]
       <input type="hidden" name="oldbranchcode" value="[% ean.branch.branchcode %]" />
-      <input type="hidden" name="oldean" value="[% ean.ean %]" />
+      <input type="hidden" name="id" value="[% ean.id %]" />
   [% END %]
 
   <fieldset class="rows">
                  [% END %]
                 </td>
                 <td class="actions">
-                    <a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=ean_form&branchcode=[% ean.branch.branchcode %]&ean=[% ean.ean %]"><i class="fa fa-pencil"></i> Edit</a>
+                    <a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=ean_form&id=[% ean.id %]"><i class="fa fa-pencil"></i> Edit</a>
                     <a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=delete_confirm&id=[% ean.id %]"><i class="fa fa-trash"></i> Delete</a>
                 </td>
             </tr>