Acquisition module has been cut into 3 files :
*Bookseller.pm* : contains all functions dealing with bookseller. *Bookfund.pm* : contains all functions dealing with bookfund, currency & budget. *Acquisition.pm* contains all functions dealing with orders, basket & parcels.
This commit is contained in:
parent
fa9ecea842
commit
a4c279ac4e
1937
C4/Acquisition.pm
1937
C4/Acquisition.pm
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,424 @@
|
|||
package C4::Bookfund;
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
#
|
||||
# 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 2 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., 59 Temple Place,
|
||||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# $Id$
|
||||
|
||||
|
||||
use strict;
|
||||
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
# set the version for version checking
|
||||
$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
|
||||
|
||||
=head1 NAME
|
||||
|
||||
C4::Bookfund - Koha functions for dealing with bookfund, currency & money.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use C4::Bookfund;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
the functions in this modules deal with bookfund, currency and money.
|
||||
They allow to get and/or set some informations for a specific budget or currency.
|
||||
|
||||
=cut
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
&GetBookFund &GetBookFunds &GetBookFundBreakdown &GetCurrencies
|
||||
&ModBookFund &ModCurrencies
|
||||
&Countbookfund
|
||||
&ConvertCurrency
|
||||
);
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 GetBookFund
|
||||
|
||||
=over 4
|
||||
|
||||
$dataaqbookfund = &GetBookFund($bookfundid);
|
||||
|
||||
this function get the bookfundid, bookfundname, the bookfundgroup, the branchcode
|
||||
from aqbookfund table for bookfundid given on input arg.
|
||||
return:
|
||||
C<$dataaqbookfund> is a hashref full of bookfundid, bookfundname, bookfundgroup,
|
||||
and branchcode.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetBookFund {
|
||||
my $bookfundid = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT
|
||||
bookfundid,
|
||||
bookfundname,
|
||||
bookfundgroup,
|
||||
branchcode
|
||||
FROM aqbookfund
|
||||
WHERE bookfundid = ?
|
||||
";
|
||||
my $sth=$dbh->prepare($query);
|
||||
return $sth->fetchrow_hashref;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 GetBookFunds
|
||||
|
||||
=over 4
|
||||
|
||||
@results = &GetBookFunds;
|
||||
|
||||
Returns a list of all book funds.
|
||||
|
||||
C<@results> is an array of references-to-hash, whose keys are fields from the aqbookfund and aqbudget tables of the Koha database. Results are ordered
|
||||
alphabetically by book fund name.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetBookFunds {
|
||||
my ($branch) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $userenv = C4::Context->userenv;
|
||||
my $branch = $userenv->{branch};
|
||||
my $strsth;
|
||||
|
||||
if ( $branch ne '' ) {
|
||||
$strsth = "
|
||||
SELECT *
|
||||
FROM aqbookfund,aqbudget
|
||||
WHERE aqbookfund.bookfundid=aqbudget.bookfundid
|
||||
AND startdate<now()
|
||||
AND enddate>now()
|
||||
AND (aqbookfund.branchcode IS NULL OR aqbookfund.branchcode='' OR aqbookfund.branchcode= ? )
|
||||
GROUP BY aqbookfund.bookfundid ORDER BY bookfundname";
|
||||
}
|
||||
else {
|
||||
$strsth = "
|
||||
SELECT *
|
||||
FROM aqbookfund,
|
||||
aqbudget
|
||||
WHERE aqbookfund.bookfundid=aqbudget.bookfundid
|
||||
AND startdate<now()
|
||||
AND enddate>now()
|
||||
GROUP BY aqbookfund.bookfundid ORDER BY bookfundname
|
||||
";
|
||||
}
|
||||
my $sth = $dbh->prepare($strsth);
|
||||
if ( $branch ne '' ) {
|
||||
$sth->execute($branch);
|
||||
}
|
||||
else {
|
||||
$sth->execute;
|
||||
}
|
||||
my @results = ();
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
push( @results, $data );
|
||||
}
|
||||
$sth->finish;
|
||||
return @results;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 GetCurrencies
|
||||
|
||||
=over 4
|
||||
|
||||
@currencies = &GetCurrencies;
|
||||
|
||||
Returns the list of all known currencies.
|
||||
|
||||
C<$currencies> is a array; its elements are references-to-hash, whose
|
||||
keys are the fields from the currency table in the Koha database.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetCurrencies {
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT *
|
||||
FROM currency
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute;
|
||||
my @results = ();
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
push( @results, $data );
|
||||
}
|
||||
$sth->finish;
|
||||
return @results;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 GetBookFundBreakdown
|
||||
|
||||
=over 4
|
||||
|
||||
( $spent, $comtd ) = &GetBookFundBreakdown( $id, $year, $start, $end );
|
||||
|
||||
returns the total comtd & spent for a given bookfund, and a given year
|
||||
used in acqui-home.pl
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetBookFundBreakdown {
|
||||
my ( $id, $year, $start, $end ) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# if no start/end dates given defaut to everything
|
||||
if ( !$start ) {
|
||||
$start = '0000-00-00';
|
||||
$end = 'now()';
|
||||
}
|
||||
|
||||
# do a query for spent totals.
|
||||
my $query = "
|
||||
SELECT quantity,datereceived,freight,unitprice,listprice,ecost,
|
||||
quantityreceived,subscription
|
||||
FROM aqorders
|
||||
LEFT JOIN aqorderbreakdown ON aqorders.ordernumber=aqorderbreakdown.ordernumber
|
||||
WHERE bookfundid=?
|
||||
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
|
||||
AND ((datereceived >= ? and datereceived < ?) OR (budgetdate >= ? and budgetdate < ?))
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute( $id, $start, $end, $start, $end );
|
||||
|
||||
my $spent = 0;
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
if ( $data->{'subscription'} == 1 ) {
|
||||
$spent += $data->{'quantity'} * $data->{'unitprice'};
|
||||
}
|
||||
else {
|
||||
|
||||
my $leftover = $data->{'quantity'} - $data->{'quantityreceived'};
|
||||
$spent += ( $data->{'unitprice'} ) * $data->{'quantityreceived'};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# then do a seperate query for commited totals, (pervious single query was
|
||||
# returning incorrect comitted results.
|
||||
|
||||
my $query = "
|
||||
SELECT quantity,datereceived,freight,unitprice,
|
||||
listprice,ecost,quantityreceived AS qrev,
|
||||
subscription,title,itemtype,aqorders.biblionumber,
|
||||
aqorders.booksellerinvoicenumber,
|
||||
quantity-quantityreceived AS tleft,
|
||||
aqorders.ordernumber AS ordnum,entrydate,budgetdate,
|
||||
booksellerid,aqbasket.basketno
|
||||
FROM aqorderbreakdown,
|
||||
aqbasket,
|
||||
aqorders
|
||||
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=aqorders.biblioitemnumber
|
||||
WHERE bookfundid=?
|
||||
AND aqorders.ordernumber=aqorderbreakdown.ordernumber
|
||||
AND aqorders.basketno=aqbasket.basketno
|
||||
AND (budgetdate >= ? AND budgetdate < ?)
|
||||
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00')
|
||||
";
|
||||
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute( $id, $start, $end );
|
||||
|
||||
my $comtd;
|
||||
|
||||
my $total = 0;
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
my $left = $data->{'tleft'};
|
||||
if ( !$left || $left eq '' ) {
|
||||
$left = $data->{'quantity'};
|
||||
}
|
||||
if ( $left && $left > 0 ) {
|
||||
my $subtotal = $left * $data->{'ecost'};
|
||||
$data->{subtotal} = $subtotal;
|
||||
$data->{'left'} = $left;
|
||||
$comtd += $subtotal;
|
||||
}
|
||||
}
|
||||
|
||||
$sth->finish;
|
||||
return ( $spent, $comtd );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 ModBookFund
|
||||
|
||||
=over 4
|
||||
|
||||
&ModBookFund($bookfundname,$branchcode,$bookfundid);
|
||||
this function update the bookfundname and the branchcode on aqbookfund table
|
||||
on database.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub ModBookFund {
|
||||
my ($bookfundname,$branchcode,$bookfundid) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
UPDATE aqbookfund
|
||||
SET bookfundname = ?,
|
||||
branchcode = ?
|
||||
WHERE bookfundid = ?
|
||||
";
|
||||
my $sth=$dbh->prepare($query);
|
||||
$sth->execute($bookfundname,$branchcode,$bookfundid);
|
||||
# budgets depending on a bookfund must have the same branchcode
|
||||
# if the bookfund branchcode is set
|
||||
if (defined $branchcode) {
|
||||
$query = "
|
||||
UPDATE aqbudget
|
||||
SET branchcode = ?
|
||||
";
|
||||
$sth=$dbh->prepare($query);
|
||||
$sth->execute($branchcode);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 ModCurrencies
|
||||
|
||||
=over 4
|
||||
|
||||
&ModCurrencies($currency, $newrate);
|
||||
|
||||
Sets the exchange rate for C<$currency> to be C<$newrate>.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub ModCurrencies {
|
||||
my ( $currency, $rate ) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
UPDATE currency
|
||||
SET rate=?
|
||||
WHERE currency=?
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute( $rate, $currency );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 Countbookfund
|
||||
|
||||
=over 4
|
||||
|
||||
$data = Countbookfund($bookfundid);
|
||||
|
||||
this function count the number of bookfund with id given on input arg.
|
||||
return :
|
||||
the result of the SQL query as an hashref.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub Countbookfund {
|
||||
my $bookfundid = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query ="
|
||||
SELECT COUNT(*)
|
||||
FROM aqbookfund
|
||||
WHERE bookfundid = ?
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute($bookfundid);
|
||||
return $sth->fetchrow_hashref;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------#
|
||||
|
||||
=head3 ConvertCurrency
|
||||
|
||||
=over 4
|
||||
|
||||
$foreignprice = &ConvertCurrency($currency, $localprice);
|
||||
|
||||
Converts the price C<$localprice> to foreign currency C<$currency> by
|
||||
dividing by the exchange rate, and returns the result.
|
||||
|
||||
If no exchange rate is found, C<&ConvertCurrency> assumes the rate is one
|
||||
to one.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub ConvertCurrency {
|
||||
my ( $currency, $price ) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT rate
|
||||
FROM currency
|
||||
WHERE currency=?
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute($currency);
|
||||
my $cur = ( $sth->fetchrow_array() )[0];
|
||||
if ( $cur == 0 ) {
|
||||
$cur = 1;
|
||||
}
|
||||
return ( $price / $cur );
|
||||
}
|
||||
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Koha Developement team <info@koha.org>
|
||||
|
||||
=cut
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
package C4::Bookseller;
|
||||
|
||||
# Copyright 2000-2002 Katipo Communications
|
||||
#
|
||||
# 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 2 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., 59 Temple Place,
|
||||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT);
|
||||
|
||||
# set the version for version checking
|
||||
$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
&GetBookSeller &GetBooksellersWithLateOrders
|
||||
&ModBookseller
|
||||
&AddBookseller
|
||||
);
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
C4::Bookseller - Koha functions for dealing with booksellers.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use C4::Bookseller;
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The functions in this module deal with booksellers. They allow to
|
||||
add a new bookseller, to modify it or to get some informations around
|
||||
a bookseller.
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=over 2
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------#
|
||||
|
||||
=head3 GetBookSeller
|
||||
|
||||
=over 4
|
||||
|
||||
@results = &GetBookSeller($searchstring);
|
||||
|
||||
Looks up a book seller. C<$searchstring> may be either a book seller
|
||||
ID, or a string to look for in the book seller's name.
|
||||
|
||||
C<@results> is an array of references-to-hash, whose keys are the fields of of the
|
||||
aqbooksellers table in the Koha database.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetBookSeller {
|
||||
my ($searchstring) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
SELECT *
|
||||
FROM aqbooksellers
|
||||
WHERE name LIKE ? OR id = ?
|
||||
";
|
||||
my $sth =$dbh->prepare($query);
|
||||
$sth->execute("$searchstring%", $searchstring );
|
||||
my @results;
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
push( @results, $data );
|
||||
}
|
||||
$sth->finish;
|
||||
return @results ;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------#
|
||||
|
||||
=head3 GetBooksellersWithLateOrders
|
||||
|
||||
=over 4
|
||||
|
||||
%results = &GetBooksellersWithLateOrders;
|
||||
|
||||
Searches for suppliers with late orders.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub GetBooksellersWithLateOrders {
|
||||
my $delay = shift;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# FIXME NOT quite sure that this operation is valid for DBMs different from Mysql, HOPING so
|
||||
# should be tested with other DBMs
|
||||
|
||||
my $strsth;
|
||||
my $dbdriver = C4::Context->config("db_scheme") || "mysql";
|
||||
if ( $dbdriver eq "mysql" ) {
|
||||
$strsth = "
|
||||
SELECT DISTINCT aqbasket.booksellerid, aqbooksellers.name
|
||||
FROM aqorders, aqbasket
|
||||
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id
|
||||
WHERE aqorders.basketno = aqbasket.basketno
|
||||
AND (closedate < DATE_SUB(CURDATE( ),INTERVAL $delay DAY)
|
||||
AND (datereceived = '' OR datereceived IS NULL))
|
||||
";
|
||||
}
|
||||
else {
|
||||
$strsth = "
|
||||
SELECT DISTINCT aqbasket.booksellerid, aqbooksellers.name
|
||||
FROM aqorders, aqbasket
|
||||
LEFT JOIN aqbooksellers ON aqbasket.aqbooksellerid = aqbooksellers.id
|
||||
WHERE aqorders.basketno = aqbasket.basketno
|
||||
AND (closedate < (CURDATE( )-(INTERVAL $delay DAY)))
|
||||
AND (datereceived = '' OR datereceived IS NULL))
|
||||
";
|
||||
}
|
||||
|
||||
my $sth = $dbh->prepare($strsth);
|
||||
$sth->execute;
|
||||
my %supplierlist;
|
||||
while ( my ( $id, $name ) = $sth->fetchrow ) {
|
||||
$supplierlist{$id} = $name;
|
||||
}
|
||||
|
||||
return %supplierlist;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
=head3 AddBookseller
|
||||
|
||||
=over 4
|
||||
|
||||
$id = &AddBookseller($bookseller);
|
||||
|
||||
Creates a new bookseller. C<$bookseller> is a reference-to-hash whose
|
||||
keys are the fields of the aqbooksellers table in the Koha database.
|
||||
All fields must be present.
|
||||
|
||||
Returns the ID of the newly-created bookseller.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub AddBookseller {
|
||||
my ($data) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
INSERT INTO aqbooksellers
|
||||
(
|
||||
name, address1, address2, address3, address4,
|
||||
postal, phone, fax, url, contact,
|
||||
contpos, contphone, contfax, contaltphone, contemail,
|
||||
contnotes, active, listprice, invoiceprice, gstreg,
|
||||
listincgst,invoiceincgst, specialty, discount, invoicedisc,
|
||||
nocalc, notes
|
||||
)
|
||||
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute(
|
||||
$data->{'name'}, $data->{'address1'},
|
||||
$data->{'address2'}, $data->{'address3'},
|
||||
$data->{'address4'}, $data->{'postal'},
|
||||
$data->{'phone'}, $data->{'fax'},
|
||||
$data->{'url'}, $data->{'contact'},
|
||||
$data->{'contpos'}, $data->{'contphone'},
|
||||
$data->{'contfax'}, $data->{'contaltphone'},
|
||||
$data->{'contemail'}, $data->{'contnotes'},
|
||||
$data->{'active'}, $data->{'listprice'},
|
||||
$data->{'invoiceprice'}, $data->{'gstreg'},
|
||||
$data->{'listincgst'}, $data->{'invoiceincgst'},
|
||||
$data->{'specialty'}, $data->{'discount'},
|
||||
$data->{'invoicedisc'}, $data->{'nocalc'},
|
||||
$data->{'notes'}
|
||||
);
|
||||
|
||||
# return the id of this new supplier
|
||||
my $query = "
|
||||
SELECT max(id)
|
||||
FROM aqbooksellers
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute;
|
||||
return scalar($sth->fetchrow);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------#
|
||||
|
||||
=head3 ModSupplier
|
||||
|
||||
=over 4
|
||||
|
||||
&ModSupplier($bookseller);
|
||||
|
||||
Updates the information for a given bookseller. C<$bookseller> is a
|
||||
reference-to-hash whose keys are the fields of the aqbooksellers table
|
||||
in the Koha database. It must contain entries for all of the fields.
|
||||
The entry to modify is determined by C<$bookseller-E<gt>{id}>.
|
||||
|
||||
The easiest way to get all of the necessary fields is to look up a
|
||||
book seller with C<&booksellers>, modify what's necessary, then call
|
||||
C<&ModSupplier> with the result.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
sub ModBookseller {
|
||||
my ($data) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "
|
||||
UPDATE aqbooksellers
|
||||
SET name=?,address1=?,address2=?,address3=?,address4=?,
|
||||
postal=?,phone=?,fax=?,url=?,contact=?,contpos=?,
|
||||
contphone=?,contfax=?,contaltphone=?,contemail=?,
|
||||
contnotes=?,active=?,listprice=?, invoiceprice=?,
|
||||
gstreg=?, listincgst=?,invoiceincgst=?,
|
||||
specialty=?,discount=?,invoicedisc=?,nocalc=?, notes=?
|
||||
WHERE id=?
|
||||
";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute(
|
||||
$data->{'name'}, $data->{'address1'},
|
||||
$data->{'address2'}, $data->{'address3'},
|
||||
$data->{'address4'}, $data->{'postal'},
|
||||
$data->{'phone'}, $data->{'fax'},
|
||||
$data->{'url'}, $data->{'contact'},
|
||||
$data->{'contpos'}, $data->{'contphone'},
|
||||
$data->{'contfax'}, $data->{'contaltphone'},
|
||||
$data->{'contemail'}, $data->{'contnotes'},
|
||||
$data->{'active'}, $data->{'listprice'},
|
||||
$data->{'invoiceprice'}, $data->{'gstreg'},
|
||||
$data->{'listincgst'}, $data->{'invoiceincgst'},
|
||||
$data->{'specialty'}, $data->{'discount'},
|
||||
$data->{'invoicedisc'}, $data->{'nocalc'},
|
||||
$data->{'notes'}, $data->{'id'}
|
||||
);
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Koha Developement team <info@koha.org>
|
||||
|
||||
=cut
|
||||
Loading…
Reference in New Issue