Bugzilla – Attachment 28483 Details for
Bug 11169
OPAC: Display acquisition details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11169: Display acquition details at the OPAC
Bug-11169-Display-acquition-details-at-the-OPAC.patch (text/plain), 11.27 KB, created by
Jonathan Druart
on 2014-05-27 11:51:15 UTC
(
hide
)
Description:
Bug 11169: Display acquition details at the OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-05-27 11:51:15 UTC
Size:
11.27 KB
patch
obsolete
>From 98339de8c3506d9722c13a1fb86218265cbfad97 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 8 May 2014 11:23:38 +0200 >Subject: [PATCH] Bug 11169: Display acquition details at the OPAC > >This patch adds a new system preference 'OPACAcquisitionDetail'. >If it is enabled, information about items on order will be displayed on >the OPAC detail page. > >Test plan: >- switch on the OPACAcquisitionDetails pref. >- set the AcqCreateItems pref to 'receiving'. >- create some orders on 1 or more items. >- go to the opac detail page and verify the "Holdings" tab contains the > line "X item are on order." (at the bottom of the table containing the > item list). >- receive the items. >- verify the number of items has decreased. >- set the AcqCreateItems pref to 'ordering'. >- create some orders on 1 or more items. >- go to the opac detail page and verify the item list contains the items > with the "on order" status. >- receive the items. >- verify the received items don't have anymore the "on order" status. > >To test completely this feature, you should verify there is no >regression on the pref OpacMaxItemsToDisplay, OpacSeparateHoldings and >OpacSeparateHoldingsBranch. >--- > C4/Acquisition.pm | 5 ++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 12 ++++++++ > .../prog/en/modules/admin/preferences/opac.pref | 8 +++++- > .../bootstrap/en/includes/item-status.inc | 2 ++ > .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 18 ++++++++++-- > opac/opac-detail.pl | 32 ++++++++++++++++++++++ > t/db_dependent/Acquisition.t | 6 +++- > 8 files changed, 80 insertions(+), 4 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 38646cb..2e013ac 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -1723,6 +1723,7 @@ sub SearchOrders { > my $owner = $params->{owner}; > my $pending = $params->{pending}; > my $ordered = $params->{ordered}; >+ my $biblionumber = $params->{biblionumber}; > > my $dbh = C4::Context->dbh; > my @args = (); >@@ -1782,6 +1783,10 @@ sub SearchOrders { > $query .= ' AND ( aqorders.ordernumber = ? OR aqorders_transfers.ordernumber_from = ? ) '; > push @args, ( $ordernumber, $ordernumber ); > } >+ if ( $biblionumber ) { >+ $query .= 'AND aqorders.biblionumber = ?'; >+ push @args, $biblionumber; >+ } > if( $search ) { > $query .= ' AND (biblio.title LIKE ? OR biblio.author LIKE ? OR biblioitems.isbn LIKE ?)'; > push @args, ("%$search%","%$search%","%$search%"); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index aff00ab..5e4ce7c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -211,6 +211,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OAI-PMH:ConfFile','',NULL,'If empty, Koha OAI Server operates in normal mode, otherwise it operates in extended mode.','File'), > ('OAI-PMH:MaxCount','50',NULL,'OAI-PMH maximum number of records by answer to ListRecords and ListIdentifiers queries','Integer'), > ('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'), >+('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'), > ('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'), > ('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'), > ('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 01472d7..960ca6f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8551,6 +8551,18 @@ if (CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.15.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q| >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACAcquisitionDetails','0', '','Show the acquisition details at the OPAC','YesNo') >+ |); >+ print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n"; >+ SetVersion($DBversion); >+} >+ >+ >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 839daa8..1304cef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -460,7 +460,13 @@ OPAC: > yes: Allow > no: Do not allow > - users to add a note when placing a hold. >- >+ - >+ - pref: OPACAcquisitionDetails >+ default: 0 >+ choices: >+ yes: Display >+ no: Don't display >+ - the acquisition details on OPAC detail pages. > Policy: > - > - pref: singleBranchMode >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >index f14df90..16599de 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc >@@ -46,6 +46,8 @@ not use an API to fetch items that populates item.datedue. > [% ELSE %] > Item damaged > [% END %] >+[% ELSIF item.on_order %] >+ On order > [% ELSE %] > Available [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %] > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index dc6a3ae..ecfa256 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -633,7 +633,13 @@ > <p>This record has many physical items ([% items_count %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]&viewallitems=1">Click here to view them all.</a></p> > [% ELSIF ( itemloop.size ) %] > [% INCLUDE items_table items=itemloop tab="holdings" %] >- >+ [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %] >+ [% IF acquisition_details.total_quantity == 1 %] >+ 1 item is on order. >+ [% ELSE %] >+ [% acquisition_details.total_quantity %] items are on order. >+ [% END %] >+ [% END %] > [% IF holds_count.defined || priority %] > <div id="bib_holds"> > [% IF holds_count.defined %] >@@ -654,7 +660,15 @@ > <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div> > [% END %] > [% ELSE %] >- <div id="noitems">No physical items for this record</div> >+ [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %] >+ [% IF acquisition_details.total_quantity == 1 %] >+ 1 item is on order. >+ [% ELSE %] >+ [% acquisition_details.total_quantity %] items are on order. >+ [% END %] >+ [% ELSE %] >+ <div id="noitems">No physical items for this record</div> >+ [% END %] > [% END %] > [% END # IF itemloop.size %] > [% PROCESS 'shelfbrowser.inc' %] >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 0712707..de1a736 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -24,6 +24,7 @@ use strict; > use warnings; > > use CGI; >+use C4::Acquisition qw( SearchOrders ); > use C4::Auth qw(:DEFAULT get_session); > use C4::Branch; > use C4::Koha; >@@ -596,6 +597,28 @@ if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { > my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); > my $viewallitems = $query->param('viewallitems'); > my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50; >+ >+# Get items on order >+my ( @itemnumbers_on_order ); >+if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { >+ my $orders = C4::Acquisition::SearchOrders({ >+ biblionumber => $biblionumber, >+ pending => 1, >+ }); >+ my $total_quantity = 0; >+ for my $order ( @$orders ) { >+ if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { >+ for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) { >+ push @itemnumbers_on_order, $itemnumber; >+ } >+ } >+ $total_quantity += $order->{quantity}; >+ } >+ $template->{VARS}->{acquisition_details} = { >+ total_quantity => $total_quantity, >+ }; >+} >+ > if ( not $viewallitems and @items > $max_items_to_display ) { > $template->param( > too_many_items => 1, >@@ -647,6 +670,15 @@ if ( not $viewallitems and @items > $max_items_to_display ) { > $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname}; > $itm->{transfertto} = $branches->{$transfertto}{branchname}; > } >+ >+ >+ if ( C4::Context->preference('OPACAcquisitionDetails') >+ and C4::Context->preference('AcqCreateItem') eq 'ordering' ) >+ { >+ $itm->{on_order} = 1 >+ if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order; >+ } >+ > my $itembranch = $itm->{$separatebranch}; > if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { > if ($itembranch and $itembranch eq $currentbranch) { >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index 4863cc5..8936ec4 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -8,7 +8,7 @@ use POSIX qw(strftime); > > use C4::Bookseller qw( GetBookSellerFromId ); > >-use Test::More tests => 76; >+use Test::More tests => 77; > > BEGIN { > use_ok('C4::Acquisition'); >@@ -798,6 +798,10 @@ $search_orders = SearchOrders({ > }); > is( scalar (@$search_orders), 3, "SearchOrders with pending and ordered params gets only pending ordered orders. After closing the basket, orders are marked as 'ordered' (bug 11170)" ); > >+$search_orders = SearchOrders({ >+ ordernumber => $ordernumbers[4] >+}); >+is( scalar (@$search_orders), 1, "SearchOrders takes into account the ordernumber filter" ); > > # > # Test AddClaim >-- >2.0.0.rc2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11169
:
22594
|
22595
|
25654
|
25657
|
26082
|
26083
|
26084
|
26330
|
26331
|
26332
|
26343
|
26344
|
26345
|
27018
|
27019
|
27020
|
28045
|
28419
|
28483
|
28511
|
28512
|
28522
|
28523
|
28524
|
33522