@@ -, +, @@
- 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 "acquitision details" tab
contains the right number of items which is in order.
- 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 "acquitision details" tab
contains the list of items which is in order.
- receive the items.
- verify the received items don't appear anymore in the table.
---
C4/Acquisition.pm | 5 +
installer/data/mysql/sysprefs.sql | 1 +
installer/data/mysql/updatedatabase.pl | 14 +++
.../prog/en/modules/admin/preferences/opac.pref | 8 +-
.../opac-tmpl/prog/en/includes/item-status.inc | 2 +
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 21 +++-
opac/opac-detail.pl | 128 ++++++++++++--------
7 files changed, 129 insertions(+), 50 deletions(-)
--- a/C4/Acquisition.pm
+++ a/C4/Acquisition.pm
@@ -1494,6 +1494,7 @@ sub SearchOrders {
my $basketgroupname = $params->{basketgroupname};
my $owner = $params->{owner};
my $pending = $params->{pending};
+ my $biblionumber = $params->{biblionumber};
my $dbh = C4::Context->dbh;
my @args = ();
@@ -1538,6 +1539,10 @@ sub SearchOrders {
$query .= ' AND (aqorders.ordernumber=?)';
push @args, $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%");
--- a/installer/data/mysql/sysprefs.sql
+++ a/installer/data/mysql/sysprefs.sql
@@ -199,6 +199,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'),
--- a/installer/data/mysql/updatedatabase.pl
+++ a/installer/data/mysql/updatedatabase.pl
@@ -7596,6 +7596,20 @@ if ( CheckVersion($DBversion) ) {
}
+
+
+$DBversion = "3.13.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 (MT12445 - Add OPACAcquisitionDetails syspref)\n";
+ SetVersion($DBversion);
+}
+
+
+
+
=head1 FUNCTIONS
=head2 TableExists($table)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -424,7 +424,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
--- a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
+++ a/koha-tmpl/opac-tmpl/prog/en/includes/item-status.inc
@@ -39,6 +39,8 @@
[% ELSE %]
Item damaged
[% END %]
+[% ELSIF item.on_order %]
+ On order
[% ELSE %]
Available [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %]
[% END %]
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -980,6 +980,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
Subscriptions
[% END %]
+[% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.orders.size > 0 %]
+
Acquisition details
+[% END %]
[% IF ( Koha.Preference( 'reviewson' ) == 1 ) %]
[% END %]
@@ -1235,6 +1238,22 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% END %]
+
+[% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.orders.size > 0 %]
+
+
Acquisition details
+ [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
+ The following items are on order.
+ [% INCLUDE items_table items=acquisition_details.items tab="acquisition_details" noshelfbrowser=1 %]
+ [% ELSE %]
+ [% acquisition_details.total_quantity %] items are on order.
+ [% END %]
+
+[% END %]
+
+
+
+
[% IF ( LibraryThingForLibrariesID ) %]
[% IF ( LibraryThingForLibrariesTabbedView ) %]
@@ -1543,7 +1562,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% IF ( ITEM_RESULT.itemcallnumber ) %]
[% ITEM_RESULT.itemcallnumber %]
- [% IF ( OPACShelfBrowser ) %]
+ [% IF ( OPACShelfBrowser and not noshelfbrowser ) %]
[% IF ( ITEM_RESULT.itemnumber == starting_itemnumber ) %]
(Browse shelf)
[% ELSE %]
--- a/opac/opac-detail.pl
+++ a/opac/opac-detail.pl
@@ -25,6 +25,7 @@ use warnings;
use CGI;
use C4::Auth qw(:DEFAULT get_session);
+use C4::Acquisition qw( SearchOrders );
use C4::Branch;
use C4::Koha;
use C4::Serials; #uses getsubscriptionfrom biblionumber
@@ -486,16 +487,16 @@ if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
my $dat = &GetBiblioData($biblionumber);
-my $itemtypes = GetItemTypes();
+our $itemtypes = GetItemTypes();
# imageurl:
my $itemtype = $dat->{'itemtype'};
if ( $itemtype ) {
$dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
}
-my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
-my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
-my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
+our $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
+our $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
+our $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
@@ -531,7 +532,7 @@ $dat->{'count'} = scalar(@items);
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) );
-my (%item_reserves, %priority);
+our (%item_reserves, %priority);
my ($show_holds_count, $show_priority);
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
m/holds/o and $show_holds_count = 1;
@@ -562,50 +563,8 @@ if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
}
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
for my $itm (@items) {
- $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
- $itm->{priority} = $priority{ $itm->{itemnumber} };
- $norequests = 0
- if ( (not $itm->{'withdrawn'} )
- && (not $itm->{'itemlost'} )
- && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
- && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
- && ($itm->{'itemnumber'} ) );
+ $itm = _get_items_infos( $itm );
- # get collection code description, too
- my $ccode = $itm->{'ccode'};
- $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
- my $copynumber = $itm->{'copynumber'};
- $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
- if ( defined $itm->{'location'} ) {
- $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
- }
- if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
- $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
- $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
- }
- foreach (qw(ccode enumchron copynumber itemnotes uri)) {
- $itemfields{$_} = 1 if ($itm->{$_});
- }
-
- # walk through the item-level authorised values and populate some images
- my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
- # warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) );
-
- if ( $itm->{'itemlost'} ) {
- my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
- $itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' };
- $itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
- }
- my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
- if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
- if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
-
- my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
- if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
- $itm->{transfertwhen} = $transfertwhen;
- $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
- $itm->{transfertto} = $branches->{$transfertto}{branchname};
- }
my $itembranch = $itm->{$separatebranch};
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
if ($itembranch and $itembranch eq $currentbranch) {
@@ -1066,4 +1025,77 @@ if ( C4::Context->preference('UseCourseReserves') ) {
}
}
+if ( C4::Context->preference('OPACAcquisitionDetails') ) {
+ my $orders = C4::Acquisition::SearchOrders({
+ biblionumber => $biblionumber,
+ pending => 1,
+ });
+
+ my @items;
+ my $total_quantity;
+ for my $order ( @$orders ) {
+ if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
+ for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
+ my $item = C4::Items::GetItem( $itemnumber );
+ $item->{on_order} = 1;
+ push @items, _get_items_infos( $item );
+ }
+ }
+ $total_quantity += $order->{quantity};
+ }
+ $template->{VARS}->{acquisition_details} = {
+ orders => $orders,
+ items => \@items,
+ total_quantity => $total_quantity,
+ };
+}
+
output_html_with_http_headers $query, $cookie, $template->output;
+
+sub _get_items_infos {
+ my ( $itm ) = @_;
+ $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
+ $itm->{priority} = $priority{ $itm->{itemnumber} };
+ $norequests = 0
+ if ( (not $itm->{'withdrawn'} )
+ && (not $itm->{'itemlost'} )
+ && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
+ && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
+ && ($itm->{'itemnumber'} ) );
+
+ # get collection code description, too
+ my $ccode = $itm->{'ccode'};
+ $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
+ my $copynumber = $itm->{'copynumber'};
+ $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
+ if ( defined $itm->{'location'} ) {
+ $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
+ }
+ if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
+ $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
+ $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
+ }
+ foreach (qw(ccode enumchron copynumber itemnotes uri)) {
+ $itemfields{$_} = 1 if ($itm->{$_});
+ }
+
+ # walk through the item-level authorised values and populate some images
+ my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
+
+ if ( $itm->{'itemlost'} ) {
+ my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
+ $itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' };
+ $itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
+ }
+ my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
+ if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
+ if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
+
+ my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
+ if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
+ $itm->{transfertwhen} = $transfertwhen;
+ $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
+ $itm->{transfertto} = $branches->{$transfertto}{branchname};
+ }
+ return $itm;
+}
--
|