@@ -, +, @@ detail page --- 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(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -2063,6 +2063,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; @@ -2115,10 +2117,16 @@ sub GetHistory { $query .= " WHERE 1 "; - $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " if $orderstatus ne 'cancelled'; + $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') " + if not $get_canceled_order or ( defined $orderstatus and $orderstatus ne 'cancelled' ); my @query_params = (); + if ( $biblionumber ) { + $query .= " AND biblio.biblionumber = ?"; + push @query_params, $biblionumber; + } + if ( $title ) { $query .= " AND biblio.title LIKE ? "; $title =~ s/\s+/%/g; --- a/catalogue/detail.pl +++ a/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; @@ -43,8 +44,6 @@ use Koha::DateUtils; use C4::HTML5Media; use C4::CourseReserves qw(GetItemCourseReservesInfo); -# use Smart::Comments; - my $query = CGI->new(); my $analyze = $query->param('analyze'); @@ -165,6 +164,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} ); } --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -1,5 +1,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AcqCreateItem','ordering','ordering|receiving|cataloguing','Define when the item is created : when ordering, when receiving, or in cataloguing module','Choice'), +('AcquisitionDetails', '1', '', 'Hide/Show acquisition details on the biblio detail page.', 'YesNo'), ('AcqViewBaskets','user','user|branch|all','Define which baskets a user is allowed to view: his own only, any within his branch or all','Choice'), ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), ('AddPatronLists','categorycode','categorycode|category_type','Allow user to choose what list to pick up from when adding patrons','Choice'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -7156,6 +7156,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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/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. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1,3 +1,4 @@ +[% USE KohaDates %] [% USE AuthorisedValues %] [% ShowCourseReserves = 0 %] @@ -142,6 +143,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 %] }); //]]> @@ -370,6 +383,7 @@ function verify_images() { [% END %] [% IF ( MARCNOTES || notes ) %]
Basket | +Ordernumber | +Creation date | +Receive date | +Status | +Quantity / items | +
---|---|---|---|---|---|
[% order.basketname %] | +[% order.ordernumber %] | +[% order.creationdate | $KohaDates%] | +[% order.datereceived | $KohaDates%] | ++ [% SWITCH order.orderstatus %] + [% CASE '0' %]New + [% CASE '1' %]Ordered + [% CASE '2' %]Partial + [% CASE '3' %]Complete + [% CASE '4' %]Deleted + [% END %] + | ++ [% order.quantity %] + [% IF order.itemnumbers.size > 0 && order.orderstatus != '4' %] + ( + [% FOR itemnumber IN order.itemnumbers %] + [% itemnumber %] + [%- UNLESS loop.last %],[% END %] + [% END %] + ) + [% END %] + + |