From d84e286dfab19088807d3c1a666ad7f7d22d783e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 16 Oct 2024 17:24:55 +0000 Subject: [PATCH] Bug 36320: Clicking Edit items from catalogue/detail.pl leads to 'Add item' screen This patch updates the catalog toolbar so that the "Edit items" choice under the "Edit" menu is replaced with two new options: "Manage items," which takes you to the top of the add/edit items page; and "Add item" which takes the user directly to the add item form (scrolling automatically past the table of existing items). The patch also adds a "Jump to add item form" link at the top of the add/edit items page. To test, apply the patch and search for a bibliographic record in the staff interface. - View the detail page for the record. - Click the "Edit" menu button in the toolbar. - You should see the two new menu items, "Manage items" and "Add item." - Clicking the "Manage items" button should take you to the top of the add/edit items page in cataloging. - You should see a "Jump to add item form" limk under the page heading. - Clicking it should jump you to the "Add item" form. - Clicking the "Add item" menu item from the bibliographic detail "Edit" menu should take you directly to the add item form, scrolling down past the existing items. Sponsored-by: Athens County Public Libraries --- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 3 ++- .../prog/en/modules/cataloguing/additem.tt | 1 + .../intranet-tmpl/prog/js/cataloging_additem.js | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 4b99bbea27..81ccb4fb91 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -60,7 +60,8 @@ [% END %] [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] -
  • Edit items
  • +
  • Manage items
  • +
  • Add item
  • [% END %] [% IF ( CAN_user_tools_items_batchmod ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index ae6da07854..75fd44ceb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -77,6 +77,7 @@ [% END %]

    Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])

    + Jump to add item form [% IF ( barcode_not_unique ) %]
    Error saving item: Barcode must be unique.
    [% END %] [% IF ( no_next_barcode ) %]
    Error saving items: Unable to automatically determine values for barcodes. No item has been inserted.
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js index c8a2189b83..e975d66959 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js @@ -138,6 +138,19 @@ $(document).ready(function(){ return $("#" + $(this).data("item") + "-delete-item-form").submit(); } }) ; + + /* On page load, check for location.hash in the page URL */ + /* If present the location hash will be used to scroll to the relevant anchor */ + var hash = location.hash; + var hashPieces = hash.split('?'); + if( hashPieces[0] !== "" ){ + $( hashPieces[0] )[0].scrollIntoView(); + } + + $("#newitem_jump").on("click", function(e){ + e.preventDefault(); + document.getElementById("cataloguing_additem_newitem").scrollIntoView(); + }); }); function CheckTemplateForm(f) { -- 2.39.5