Bug 15256: Fix items table display on the detail page
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 25 Nov 2015 17:08:43 +0000 (17:08 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 4 Dec 2015 14:13:37 +0000 (14:13 +0000)
Bug 14966 fixed a bug but introduced another one: With
IndependentBranches set to 'prevent', if the librarian (without the
superlibrarian permission) can edit items but not all, the table is
broken.  DataTables raises the following warning: "DataTables warning:
table id=DataTables_Table_1 - Requested unknown parameter '8' for row0."
And does not display correctly.

Test plan:
1/ Create a biblio record with 1+ items located in different places.
2/ Create/use a patron with the permission to edit items
3/ Set the IndependentBranches pref to 'prevent'
4/ With this patron logged in, go on the record detail page.
Without this patch, the display is broken (only 1 edit link and 1 td
missing, DataTables raises a warning).
With this patch, the display is correct.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
  See the warning, and the broken table. Solved by this patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

index f9a1d35..f2fb6e2 100644 (file)
@@ -807,8 +807,12 @@ function verify_images() {
                        [% END %]
                     </td>
                 [% END %]
-                [% IF CAN_user_editcatalogue_edit_items and not item.cannot_be_edited %]
-                    <td><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber %]&itemnumber=[% item.itemnumber %]#edititem">Edit</a></td>
+                [% IF CAN_user_editcatalogue_edit_items %]
+                    <td>
+                        [% UNLESS item.cannot_be_edited %]
+                            <a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber %]&itemnumber=[% item.itemnumber %]#edititem">Edit</a>
+                        [% END %]
+                    </td>
                 [% END %]
                 </tr>
             [% END %]