=head1 FUNCTIONS
-=over 2
-
=head2 FUNCTIONS ABOUT BASKETS
-=over 2
-
=head3 GetBasket
=over 4
=back
-=back
-
=cut
sub GetBasket {
#------------------------------------------------------------#
-=back
-
=head2 FUNCTIONS ABOUT ORDERS
-=over 2
-
=cut
#------------------------------------------------------------#
=cut
sub GetPendingOrders {
- my ($supplierid,$grouped) = @_;
+ my ($supplierid,$grouped, $closed) = @_;
my $dbh = C4::Context->dbh;
my $strsth = "
SELECT ".($grouped?"count(*),":"")."aqbasket.basketno,
LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
WHERE booksellerid=?
- AND (quantity > quantityreceived OR quantityreceived is NULL)
AND datecancellationprinted IS NULL
AND (to_days(now())-to_days(closedate) < 180 OR closedate IS NULL)
";
+ if($closed){
+ $strsth .= "
+ AND (quantity > quantityreceived OR quantityreceived is NULL)
+ AND closedate IS NOT NULL ";
+ }
## FIXME Why 180 days ???
my @query_params = ( $supplierid );
if ( C4::Context->preference("IndependantBranches") ) {
my $dbh = C4::Context->dbh;
my $query ="
SELECT aqorderbreakdown.*,
- biblio.*,biblioitems.publishercode,
+ biblio.*,biblioitems.*,
aqorders.*,
aqbookfund.bookfundname,
biblio.title
$ordernumber = &GetOrderNumber($biblioitemnumber, $biblionumber);
+=back
+
Looks up the ordernumber with the given biblionumber and biblioitemnumber.
Returns the number of this order.
+=over 4
+
=item C<$ordernumber> is the order number.
=back
&NewOrder($basket, $biblionumber, $title, $quantity, $listprice,
$booksellerid, $who, $notes, $bookfund, $biblioitemnumber, $rrp,
$ecost, $gst, $budget, $unitprice, $subscription,
- $booksellerinvoicenumber, $purchaseorder);
+ $booksellerinvoicenumber, $purchaseorder, $branchcode);
Adds a new order to the database. Any argument that isn't described
below is the new value of the field with the same name in the aqorders
$listprice, $booksellerid, $authorisedby, $notes,
$bookfund, $bibitemnum, $rrp, $ecost,
$gst, $budget, $cost, $sub,
- $invoice, $sort1, $sort2, $purchaseorder
+ $invoice, $sort1, $sort2, $purchaseorder,
+ $branchcode
)
= @_;
#get ordnum MYSQL dependant, but $dbh->last_insert_id returns null
my $ordnum = $dbh->{'mysql_insertid'};
$query = "
- INSERT INTO aqorderbreakdown (ordernumber,bookfundid)
- VALUES (?,?)
+ INSERT INTO aqorderbreakdown (ordernumber,bookfundid, branchcode)
+ VALUES (?,?,?)
";
$sth = $dbh->prepare($query);
- $sth->execute( $ordnum, $bookfund );
+ $sth->execute( $ordnum, $bookfund, $branchcode );
$sth->finish;
return ( $basketno, $ordnum );
}
push( @searchterms, $search, $search, $biblionumber );
my $query;
### FIXME THIS CAN raise a problem if more THAN ONE biblioitem is linked to one biblio
- if ($id) {
+ if($id and $search){
+ @searchterms = ($id, $search);
+ $query =
+ "SELECT *,biblio.title
+ FROM aqorders
+ LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber
+ LEFT JOIN biblioitems ON biblioitems.biblionumber=biblio.biblionumber
+ LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno
+ WHERE aqbasket.booksellerid = ? AND aqorders.ordernumber = ?
+ "
+ }elsif ($id) {
$query =
"SELECT *,biblio.title
FROM aqorders
)
. ") or biblioitems.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) ";
}
+
+ if ( $biblionumber ) {
+ $query .= "AND biblio.biblionumber = ? ";
+ push (@searchterms, $biblionumber);
+ }
+
$query .= " GROUP BY aqorders.ordernumber";
### $query
my $sth = $dbh->prepare($query);
$sth->finish;
}
-
-=back
-
=head2 FUNCTIONS ABOUT PARCELS
-=over 2
-
=cut
#------------------------------------------------------------#
$results = &GetParcels($bookseller, $order, $code, $datefrom, $dateto);
get a lists of parcels.
+=back
+
* Input arg :
+=over 4
+
=item $bookseller
is the bookseller this function has to get parcels.
1;
__END__
-=back
-
=head1 AUTHOR
Koha Developement team <info@koha.org>