From 0b9a7e354696ed905989f7f1ff581d59955406f3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 6 Jan 2020 01:45:21 +0000 Subject: [PATCH] Bug 24347: Add a 'search to order' option similar to 'search to hold' This patch modifes the process of searching for an existing record to add to a basket. Now the search is performed as a keyword search in the regular catalog rather than via a custom search script. Options are added to the search results and detail pages to add results to an order. This process follows the same pattern as the "Search to hold" feature: When the search is initiated, a cookie is set with the requisite information--in this case vendor id and basket number. If the search results or bibliographic detail pages detect that a "searchToOrder" cookie is present, the correct "Add order" link will be shown. Like with the "search to hold" feature, the cookie expires in 10 minutes. To test, apply the patch and log into the staff client as a user who has permission to add to a basket in acquisitions. - Go to Acquisitions -> Vendor -> Basket -> Add to basket. - Using the "From an existing record" option, perform a search. - On the search results page, test the "Add order" link which appears with each result. Clicking the link should take you to the "New order" page for the correct vendor and basket. The catalog details section of the form should include the correct information. - From the search results page view the bibliographic details page for any record. There should be a new toolbar button, "Add order." Verify that it works correctly. - Test the same thing from all bibliographic detail pages: Normal, MARC, Labeled MARC, ISBD, as well as the items page (moredetail.pl). - Test this process for both the locations in acquisitions where one can add to an existing basket: Vendor search results and the basket detail page - Test the cookie timeout: Wait 10 minutes and perform another catalog search. The "Add order" link should no longer be present. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- catalogue/ISBDdetail.pl | 8 ++++++++ catalogue/MARCdetail.pl | 8 ++++++++ catalogue/detail.pl | 8 ++++++++ catalogue/imageviewer.pl | 8 ++++++++ catalogue/labeledMARCdetail.pl | 8 ++++++++ catalogue/moredetail.pl | 8 ++++++++ catalogue/search.pl | 8 ++++++++ .../en/includes/acquisitions-add-to-basket.inc | 14 ++++++-------- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 8 ++++++++ .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 1 + .../prog/en/modules/acqui/booksellers.tt | 1 + .../prog/en/modules/acqui/neworderbiblio.tt | 1 + .../prog/en/modules/catalogue/results.tt | 6 ++++++ .../intranet-tmpl/prog/js/acquisitions-menu.js | 14 ++++++++++++++ 14 files changed, 93 insertions(+), 8 deletions(-) diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl index aade9c90be..eb96fff1fd 100755 --- a/catalogue/ISBDdetail.pl +++ b/catalogue/ISBDdetail.pl @@ -118,6 +118,14 @@ if($query->cookie("holdfor")){ ); } +if( $query->cookie("searchToOrder") ){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + # count of item linked with biblio my $itemcount = $biblio->items->count; $template->param( count => $itemcount); diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index ab44ef76d4..adfe24c192 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -113,6 +113,14 @@ if($query->cookie("holdfor")){ ); } +if( $query->cookie("searchToOrder") ){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + $template->param( ocoins => $biblio_object->get_coins ); #count of item linked diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 249a7417cb..8e9163a26d 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -126,6 +126,14 @@ if($query->cookie("holdfor")){ ); } +if($query->cookie("searchToOrder")){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + my $fw = GetFrameworkCode($biblionumber); my $showallitems = $query->param('showallitems'); my $marcflavour = C4::Context->preference("marcflavour"); diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl index 009b82ecf1..8b734a4ce4 100755 --- a/catalogue/imageviewer.pl +++ b/catalogue/imageviewer.pl @@ -67,6 +67,14 @@ if ( $query->cookie("holdfor") ) { ); } +if( $query->cookie("searchToOrder") ){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + if ( C4::Context->preference("LocalCoverImages") ) { my @images = ListImagesForBiblio($biblionumber); $template->{VARS}->{'LocalCoverImages'} = 1; diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl index 7c3b77bc9a..90543f6794 100755 --- a/catalogue/labeledMARCdetail.pl +++ b/catalogue/labeledMARCdetail.pl @@ -79,6 +79,14 @@ if($query->cookie("holdfor")){ ); } +if( $query->cookie("searchToOrder") ){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + #count of item linked my $itemcount = $biblio_object->items->count; $template->param( count => $itemcount, diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index f74bc85aa0..ccff8276a4 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -60,6 +60,14 @@ if($query->cookie("holdfor")){ ); } +if( $query->cookie("searchToOrder") ){ + my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + # get variables my $biblionumber=$query->param('biblionumber'); diff --git a/catalogue/search.pl b/catalogue/search.pl index 89a5211b5c..882a9eb052 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -211,6 +211,14 @@ if($cgi->cookie("holdforclub")){ ); } +if($cgi->cookie("searchToOrder")){ + my ( $basketno, $vendorid ) = split( /\//, $cgi->cookie("searchToOrder") ); + $template->param( + searchtoorder_basketno => $basketno, + searchtoorder_vendorid => $vendorid + ); +} + # get biblionumbers stored in the cart my @cart_list; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc index 6e5698f08c..b4f37edb19 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc @@ -3,14 +3,12 @@ [% IF has_budgets %]
  • -
    - - - - -
    +
    + + +
  • From a suggestion
  • From a subscription
  • 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 7ab50f59b6..12b903d039 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -139,6 +139,14 @@ CAN_user_serials_create_subscription ) %] [% END %] +[% IF ( CAN_user_acquisition_order_manage ) %] + [% IF ( searchtoorder_basketno && searchtoorder_vendorid ) %] + + [% END %] +[% END %] + [% FOREACH p IN plugins %] [% p.intranet_catalog_biblio_enhancements_toolbar_button | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 8bbfe08ecc..c4d4d178dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -783,6 +783,7 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] [% Asset.js("lib/hc-sticky.js") | $raw %] + [% Asset.js("js/acq.js") | $raw %]