c59e395b74
In acquisition, several templates try to display publisher code and publication year : invoice.tt, parcel.tt, transferorder.tt. Thoses pages use C4::Acquisition methods GetPendingOrders or GetInvoiceDetails. The bug is that in the SQL query of those methods, biblioitems.publishercode and biblioitems.publicationyear. In uncertainprice.pl those datas are fetch using GetBiblioData. It whould be better to fetch them in GetPendingOrders and GetInvoiceDetails. This patch changes SQL queries to fetch wanted datas : aqorders.*,biblio.title,biblio.author,biblioitems.isbn,biblioitems.publishercode,biblioitems.publicationyear. GetInvoiceDetails also needs : biblio.seriestitle,biblioitems.volume. This patch also unifies the way biblio datas are displayed : <a href="link to catalog using biblionumber">[title]</a> <em>by</em> [author] – [isbn] <em>Publisher:</em> [publishercode], [publicationyear] Test plan : - Choose a biblio record containing a data in : biblio.title, biblio.author, biblioitems.isbn, biblioitems.publishercode, biblioitems.publicationyear, biblio.seriestitle, biblioitems.volume. - Create an order using this biblio. - Look at this order in pages : parcel.pl, transferorder.pl, uncertainprice.pl => You see publisher code and publication year - Look at this order in page : invoice.pl => You see publisher code, publication year, series title and volume Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
118 lines
4.3 KiB
Perl
Executable file
118 lines
4.3 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
#script to show a list of orders with uncertain prices for a bookseller
|
|
#the script also allows to edit the prices and uncheck the uncertainprice property of them
|
|
#written by john.soros@biblibre.com 01/10/2008
|
|
|
|
# Copyright 2008-2009 BibLibre SARL
|
|
#
|
|
# 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, see <http://www.gnu.org/licenses>.
|
|
|
|
|
|
=head1 NAME
|
|
|
|
uncertainprice.pl
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This script displays all the orders with uncertain prices for a given bookseller, it also lets the user modify the unitprice and uncertainprice properties of the order
|
|
|
|
=head1 CGI PARAMETERS
|
|
|
|
=over 4
|
|
|
|
=item $booksellerid
|
|
|
|
The bookseller who we want to display the orders of.
|
|
|
|
=back
|
|
|
|
=cut
|
|
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use C4::Auth;
|
|
use C4::Output;
|
|
use CGI qw ( -utf8 );
|
|
|
|
use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
|
|
use C4::Biblio qw/GetBiblioData/;
|
|
|
|
use Koha::Acquisition::Booksellers;
|
|
|
|
my $input=new CGI;
|
|
|
|
my ($template, $loggedinuser, $cookie)
|
|
= get_template_and_user({template_name => "acqui/uncertainprice.tt",
|
|
query => $input,
|
|
type => "intranet",
|
|
authnotrequired => 0,
|
|
flagsrequired => { acquisition => 'order_manage' },
|
|
debug => 1,
|
|
});
|
|
|
|
my $booksellerid = $input->param('booksellerid');
|
|
my $basketno = $input->param('basketno');
|
|
my $op = $input->param('op');
|
|
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
|
|
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
|
|
|
|
#show all orders that have uncertain price for the bookseller
|
|
my $pendingorders = SearchOrders({
|
|
booksellerid => $booksellerid,
|
|
owner => $owner,
|
|
basketno => $basketno,
|
|
pending => 1,
|
|
});
|
|
my @orders = grep { $_->{'uncertainprice'} } @$pendingorders;
|
|
|
|
if ( $op eq 'validate' ) {
|
|
$template->param( validate => 1);
|
|
my $count = scalar(@orders);
|
|
for (my $i=0; $i < $count; $i++) {
|
|
my $order = pop(@orders);
|
|
my $ordernumber = $order->{ordernumber};
|
|
my $order_as_from_db=GetOrder($order->{ordernumber});
|
|
$order->{'listprice'} = $input->param('price'.$ordernumber);
|
|
$order->{'ecost'}= $input->param('price'.$ordernumber) - (($input->param('price'.$ordernumber) /100) * $bookseller->discount);
|
|
$order->{'rrp'} = $input->param('price'.$ordernumber);
|
|
$order->{'quantity'}=$input->param('qty'.$ordernumber);
|
|
$order->{'uncertainprice'}=$input->param('uncertainprice'.$ordernumber);
|
|
ModOrder($order);
|
|
}
|
|
}
|
|
|
|
$template->param( uncertainpriceorders => \@orders,
|
|
booksellername => "".$bookseller->name,
|
|
booksellerid => $bookseller->id,
|
|
booksellerpostal =>$bookseller->postal,
|
|
bookselleraddress1 => $bookseller->address1,
|
|
bookselleraddress2 => $bookseller->address2,
|
|
bookselleraddress3 => $bookseller->address3,
|
|
bookselleraddress4 => $bookseller->address4,
|
|
booksellerphone =>$bookseller->phone,
|
|
booksellerfax => $bookseller->fax,
|
|
booksellerurl => $bookseller->url,
|
|
booksellernotes => $bookseller->notes,
|
|
basketcount => $bookseller->baskets->count,
|
|
subscriptioncount => $bookseller->subscriptions->count,
|
|
active => $bookseller->active,
|
|
owner => $owner,
|
|
scriptname => "/cgi-bin/koha/acqui/uncertainprice.pl");
|
|
$template->{'VARS'}->{'contacts'} = $bookseller->contacts;
|
|
output_html_with_http_headers $input, $cookie, $template->output;
|