Bugzilla – Attachment 17651 Details for
Bug 8230
Show the ordered status in catalogue page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8230: Display acquisition details on the catalogue detail page
Bug-8230-Display-acquisition-details-on-the-catalo.patch (text/plain), 10.58 KB, created by
Jonathan Druart
on 2013-04-24 13:05:44 UTC
(
hide
)
Description:
Bug 8230: Display acquisition details on the catalogue detail page
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-04-24 13:05:44 UTC
Size:
10.58 KB
patch
obsolete
>From 0316e9c5053d98dbf797b5fe73df8244ce56ebe8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 24 Apr 2013 14:11:32 +0200 >Subject: [PATCH] Bug 8230: Display acquisition details on the catalogue > detail page > >This patch adds a new tab "Acquitition details" on the catalogue detail >page. It provides a list of order made for this biblio. > >New system preference: >AcquisitionDetails: Hide/Show the new tab > >Test plan: >1/ Apply the patch. >2/ Select the "placing an order" value for the AcqCreateItem pref. >3/ Create a new order with X items. >4/ Go on the catalogue detail page for the selected biblio. >5/ Click on the "Acquisition details" tab and check that your order is >displayed. Itemnumbers are present in the last column. Check that links >are not broken. >6/ Close your basket. >7/ Status become "Ordered" >8/ Receive X-1 items. >9/ Come back on the catalogue detail page. There are 2 orders: 1 >complete and 1 partial. The complete one has a receive date. >10/ Receive the last item. >11/ Now you have 2 orders with a complete status. >12/ Cancel the last receipt. >13/ You have 1 ordered and 1 complete (2 items). >14/ Cancel the first receipt. >15/ You have 1 ordered (3 items). >16/ Delete your order >17/ You have 1 deleted order. >18/ Switch the AcqCreateItem pref to "receiving an order" >19/ Do again steps 3 to 17. >--- > C4/Acquisition.pm | 10 ++- > catalogue/detail.pl | 16 ++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 13 ++++ > .../en/modules/admin/preferences/cataloguing.pref | 6 ++ > .../prog/en/modules/catalogue/detail.tt | 65 ++++++++++++++++++++ > 6 files changed, 108 insertions(+), 3 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index 863fbd1..11fe88a 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2036,6 +2036,8 @@ sub GetHistory { > my $basketgroupname = $params{basketgroupname}; > my $budget = $params{budget}; > my $orderstatus = $params{orderstatus}; >+ my $biblionumber = $params{biblionumber}; >+ my $get_canceled_order = $params{get_canceled_order} || 0; > > my @order_loop; > my $total_qty = 0; >@@ -2087,10 +2089,16 @@ sub GetHistory { > > $query .= " WHERE 1 "; > >- $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne '4'; >+ $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " >+ if not $get_canceled_order or ( defined $orderstatus and $orderstatus ne '4' ); > > my @query_params = (); > >+ if ( $biblionumber ) { >+ $query .= " AND biblio.biblionumber = ?"; >+ push @query_params, $biblionumber; >+ } >+ > if ( $title ) { > $query .= " AND biblio.title LIKE ? "; > $title =~ s/\s+/%/g; >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index a5b32c6..57da92e 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -20,6 +20,7 @@ use strict; > use warnings; > > use CGI; >+use C4::Acquisition qw( GetHistory GetItemnumbersFromOrder ); > use C4::Auth; > use C4::Dates qw/format_date/; > use C4::Koha; >@@ -42,8 +43,6 @@ use C4::Images; > use Koha::DateUtils; > use C4::HTML5Media; > >-# use Smart::Comments; >- > my $query = CGI->new(); > > my $analyze = $query->param('analyze'); >@@ -164,6 +163,19 @@ foreach my $subscription (@subscriptions) { > push @subs, \%cell; > } > >+ >+# Get acquisition details >+my ( $orders, $qty, $price, $received ) = C4::Acquisition::GetHistory( biblionumber => $biblionumber, get_canceled_order => 1 ); >+if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { >+ for my $order ( @$orders ) { >+ $order->{itemnumbers} = [ C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ]; >+ } >+} >+$template->param( >+ orders => $orders, >+ AcquisitionDetails => C4::Context->preference('AcquisitionDetails'), >+); >+ > if ( defined $dat->{'itemtype'} ) { > $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }{imageurl} ); > } >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 5d536c5..acf1838 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -423,3 +423,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('DisplayIconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.', 'YesNo'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice') >+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index a16509f..d696672 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6788,6 +6788,19 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+ >+ >+ >+ >+$DBversion = "3.13.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo');"); >+ print "Upgrade to $DBversion done (Bug 8230: Add AcquisitionDetails)\n"; >+ SetVersion ($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >index 96f3603..96c6a60 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref >@@ -176,3 +176,9 @@ Cataloging: > - pref: NotesBlacklist > class: multi > - note fields in title notes separator (OPAC record details) and in the description separator (Staff client record details). The fields should appear separated with commas and according with the Koha MARC format (eg 3.. for UNIMARC, 5.. for MARC21) >+ - >+ - pref: AcquisitionDetails >+ choices: >+ yes: Display >+ no: "Don't display" >+ - acquisition details on the biblio detail page. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 8f40e31..cd79a9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > [% INCLUDE 'greybox.inc' %] > <title>Koha › Catalog › >@@ -117,6 +118,18 @@ function verify_images() { > table.before(link); > deactivate_filters(id); > } >+ [% IF AcquisitionDetails %] >+ $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'sDom': 't', >+ 'bPaginate': false, >+ 'bAutoWidth': false, >+ "aaSorting": [[ 2, "desc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": [ 2, 3 ], "sType": "title-string" } >+ ] >+ })); >+ >+ [% END %] > }); > //]]> > </script> >@@ -345,6 +358,7 @@ function verify_images() { > [% END %] > <li><a href="#description">Descriptions</a></li> > [% IF ( subscriptionsnumber ) %]<li><a href="#subscriptions">Subscriptions</a></li>[% END %] >+[% IF AcquisitionDetails %]<li><a href="#acq_details">Acquisition details</a></li>[% END %] > [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %]<li><a href="#editions">Editions</a></li>[% END %][% END %] > [% IF ( LocalCoverImages ) %][% IF ( localimages || CAN_user_tools_upload_local_cover_images ) %]<li><a href="#images">Images</a></li>[% END %][% END %] > [% IF ( HTML5MediaEnabled ) %][% IF ( HTML5MediaSets ) %]<li><a href="#html5media">Play media</a></li>[% END %][% END %] >@@ -629,6 +643,57 @@ function verify_images() { > </div> > [% END %] > >+[% IF AcquisitionDetails %] >+<div id="acq_details"> >+ [% IF orders %] >+ <table id="orders"> >+ <thead> >+ <tr> >+ <th>Basket</th> >+ <th>Ordernumber</th> >+ <th>Creation date</th> >+ <th>Receive date</th> >+ <th>Status</th> >+ <th>Quantity / items</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOR order IN orders %] >+ <tr> >+ <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno %]">[% order.basketname %]</a></td> >+ <td>[% order.ordernumber %]</td> >+ <td><span title="[% order.creationdate %]">[% order.creationdate | $KohaDates%]</span></td> >+ <td><span title="[% order.datereceived %]">[% order.datereceived | $KohaDates%]</span></td> >+ <td> >+ [% SWITCH order.orderstatus %] >+ [% CASE '0' %]New >+ [% CASE '1' %]Ordered >+ [% CASE '2' %]Partial >+ [% CASE '3' %]Complete >+ [% CASE '4' %]Deleted >+ [% END %] >+ </td> >+ <td> >+ [% order.quantity %] >+ [% IF order.itemnumbers.size > 0 && order.orderstatus != '4' %] >+ ( >+ [% FOR itemnumber IN order.itemnumbers %] >+ <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblionumber %]#item[% itemnumber %]">[% itemnumber %]</a> >+ [%- UNLESS loop.last %],[% END %] >+ [% END %] >+ ) >+ [% END %] >+ </th> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ There is no order for this biblio. >+ [% END %] >+</div> >+[% END %] >+ > [% IF ( FRBRizeEditions ) %][% IF ( XISBNS ) %] > <div id="editions"><h4>Editions</h4> > <table> >-- >1.7.10.4
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 8230
:
10197
|
17651
|
21199
|
22047
|
22326
|
22524
|
22544
|
22545
|
23545
|
23546