@@ -, +, @@ --- Koha/Acquisition/Order.pm | 7 ++++ acqui/orderreceive.pl | 6 +-- acqui/showorder.pl | 45 ++++++++++++++++++++++ .../Bug-12395-add-column-aqorders.created_by.sql | 2 + installer/data/mysql/kohastructure.sql | 1 + .../prog/en/modules/acqui/orderreceive.tt | 14 ++++++- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 8 +++- .../prog/en/modules/acqui/showorder.tt | 38 ++++++++++++++++++ 8 files changed, 114 insertions(+), 7 deletions(-) create mode 100755 acqui/showorder.pl create mode 100644 installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt --- a/Koha/Acquisition/Order.pm +++ a/Koha/Acquisition/Order.pm @@ -69,6 +69,13 @@ sub store { unless $self->$key; } + if (not defined $self->{created_by}) { + my $userenv = C4::Context->userenv; + if ($userenv) { + $self->created_by($userenv->{number}); + } + } + $self->quantityreceived(0) unless $self->quantityreceived; $self->entrydate(dt_from_string) unless $self->entrydate; --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -183,8 +183,7 @@ if( defined $order->{tax_rate_on_receiving} ) { my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber}); -my $authorisedby = $order->{authorisedby}; -my $authorised_patron = Koha::Patrons->find( $authorisedby ); +my $creator = Koha::Patrons->find( $order->{created_by} ); my $budget = GetBudget( $order->{budget_id} ); @@ -217,8 +216,7 @@ $template->param( ecost => $ecost, unitprice => $unitprice, tax_rate => $tax_rate, - memberfirstname => $authorised_patron->firstname || "", - membersurname => $authorised_patron->surname || "", + creator => $creator, invoiceid => $invoice->{invoiceid}, invoice => $invoice->{invoicenumber}, datereceived => $datereceived, --- a/acqui/showorder.pl +++ a/acqui/showorder.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +use CGI; + +use C4::Auth; +use C4::Output; + +use Koha::Acquisition::Orders; +use Koha::Patrons; + +my $cgi = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ + template_name => "acqui/showorder.tt", + query => $cgi, + type => "intranet", + authnotrequired => 0, + flagsrequired => { acquisition => '*' }, +}); + +my $ordernumber = $cgi->param('ordernumber'); +my $order = Koha::Acquisition::Orders->find($ordernumber); +my $creator = Koha::Patrons->find($order->created_by); + +$template->param( + order => $order, + creator => $creator, +); + +output_html_with_http_headers $cgi, $cookie, $template->output; --- a/installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql +++ a/installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql @@ -0,0 +1,2 @@ +ALTER TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived; +UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -3134,6 +3134,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items `unitprice_tax_excluded` decimal(28,6) default NULL, -- the unit price excluding tax (on receiving) `unitprice_tax_included` decimal(28,6) default NULL, -- the unit price including tax (on receiving) `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far + `created_by` int(11) NULL DEFAULT NULL, -- the borrowernumber of order line's creator `datecancellationprinted` date default NULL, -- the date the line item was deleted `cancellationreason` MEDIUMTEXT default NULL, -- reason of cancellation `order_internalnote` LONGTEXT, -- notes related to this order line, made for staff --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -172,7 +172,19 @@ [% END %]
  • (Current: [% budget_period_description %] - [% bookfund %])
  • -
  • [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]
  • +
  • + + + [% IF (creator && creator.firstname && creator.surname) %] + [% IF creator.firstname %] + [% creator.firstname %] + [% END %] + [% creator.surname %] + [% ELSE %] + No name + [% END %] + +
  • [% IF ( edit and not subscriptionid) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -113,7 +113,7 @@ Basket group Order line Summary - View record + More Quantity Unit cost Order cost @@ -161,7 +161,11 @@ [Add vendor note] [% END %] - MARC | Card + + Order
    + MARC
    + Card + [% loop_order.quantity %] [% loop_order.ecost | $Price %] [% loop_order.total | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt @@ -0,0 +1,38 @@ +[% INCLUDE 'doc-head-open.inc' %] + + + + [% IF order %] + + + + + + + + + + + + + + + + + + + +
    Creation date[% order.entrydate %]
    Creator[% creator.firstname %] [% creator.surname %]
    Claims count[% order.claims_count %]
    Last claim date[% order.claimed_date %]
    + [% ELSE %] + No order found. + [% END %] + + --