From 67d0073110eb04564fa905da84443e716d4bc2d0 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. --- 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 ++++++++ .../prog/en/includes/acquisitions-add-to-basket.inc | 14 ++++++-------- koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 1 + .../intranet-tmpl/prog/en/modules/acqui/booksellers.tt | 1 + .../intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt | 1 + .../intranet-tmpl/prog/en/modules/catalogue/results.tt | 6 ++++++ koha-tmpl/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 aade9c90be7..eb96fff1fdc 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 ab44ef76d4c..adfe24c1928 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 249a7417cb9..8e9163a26d4 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 009b82ecf12..8b734a4ce41 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 7c3b77bc9a5..90543f67946 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 f74bc85aa0d..ccff8276a47 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 89a5211b5c1..882a9eb0527 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 6e5698f08cb..b4f37edb190 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 %]