Lines 939-949
sub GetOrders {
Link Here
|
939 |
SELECT biblio.*,biblioitems.*, |
939 |
SELECT biblio.*,biblioitems.*, |
940 |
aqorders.*, |
940 |
aqorders.*, |
941 |
aqbudgets.*, |
941 |
aqbudgets.*, |
942 |
biblio.title |
942 |
biblio.title, |
|
|
943 |
aqorders_transfers.ordernumber_from AS transferred_from, |
944 |
aqorders_transfers.timestamp AS transferred_from_timestamp |
943 |
FROM aqorders |
945 |
FROM aqorders |
944 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
946 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
945 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
947 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
946 |
LEFT JOIN biblioitems ON biblioitems.biblionumber =biblio.biblionumber |
948 |
LEFT JOIN biblioitems ON biblioitems.biblionumber =biblio.biblionumber |
|
|
949 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_to = aqorders.ordernumber |
947 |
WHERE basketno=? |
950 |
WHERE basketno=? |
948 |
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') |
951 |
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') |
949 |
"; |
952 |
"; |
Lines 1352-1362
sub GetCancelledOrders {
Link Here
|
1352 |
|
1355 |
|
1353 |
my $dbh = C4::Context->dbh; |
1356 |
my $dbh = C4::Context->dbh; |
1354 |
my $query = " |
1357 |
my $query = " |
1355 |
SELECT biblio.*, biblioitems.*, aqorders.*, aqbudgets.* |
1358 |
SELECT |
|
|
1359 |
biblio.*, |
1360 |
biblioitems.*, |
1361 |
aqorders.*, |
1362 |
aqbudgets.*, |
1363 |
aqorders_transfers.ordernumber_to AS transferred_to, |
1364 |
aqorders_transfers.timestamp AS tranferred_to_timestamp |
1356 |
FROM aqorders |
1365 |
FROM aqorders |
1357 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
1366 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
1358 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
1367 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
1359 |
LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber |
1368 |
LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber |
|
|
1369 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_from = aqorders.ordernumber |
1360 |
WHERE basketno = ? |
1370 |
WHERE basketno = ? |
1361 |
AND (datecancellationprinted IS NOT NULL |
1371 |
AND (datecancellationprinted IS NOT NULL |
1362 |
AND datecancellationprinted <> '0000-00-00') |
1372 |
AND datecancellationprinted <> '0000-00-00') |
Lines 1704-1745
sub TransferOrder {
Link Here
|
1704 |
|
1714 |
|
1705 |
my $order = GetOrder( $ordernumber ); |
1715 |
my $order = GetOrder( $ordernumber ); |
1706 |
return if $order->{datereceived}; |
1716 |
return if $order->{datereceived}; |
|
|
1717 |
my $basket = GetBasket($basketno); |
1718 |
return unless $basket; |
1707 |
|
1719 |
|
1708 |
my $today = C4::Dates->new()->output("iso"); |
|
|
1709 |
my $query = qq{ |
1710 |
SELECT aqbooksellers.name |
1711 |
FROM aqorders |
1712 |
LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno |
1713 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1714 |
WHERE aqorders.ordernumber = ? |
1715 |
}; |
1716 |
my $dbh = C4::Context->dbh; |
1720 |
my $dbh = C4::Context->dbh; |
1717 |
my $sth = $dbh->prepare($query); |
1721 |
my ($query, $sth, $rv); |
1718 |
$sth->execute($ordernumber); |
|
|
1719 |
my ($booksellerfromname) = $sth->fetchrow_array; |
1720 |
|
1721 |
$query = qq{ |
1722 |
SELECT aqbooksellers.name |
1723 |
FROM aqbasket |
1724 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1725 |
WHERE aqbasket.basketno = ? |
1726 |
}; |
1727 |
$sth = $dbh->prepare($query); |
1728 |
$sth->execute($basketno); |
1729 |
my ($booksellertoname) = $sth->fetchrow_array; |
1730 |
|
1722 |
|
1731 |
$query = qq{ |
1723 |
$query = qq{ |
1732 |
UPDATE aqorders |
1724 |
UPDATE aqorders |
1733 |
SET datecancellationprinted = CAST(NOW() AS date), |
1725 |
SET datecancellationprinted = CAST(NOW() AS date) |
1734 |
internalnotes = ? |
|
|
1735 |
WHERE ordernumber = ? |
1726 |
WHERE ordernumber = ? |
1736 |
}; |
1727 |
}; |
1737 |
$sth = $dbh->prepare($query); |
1728 |
$sth = $dbh->prepare($query); |
1738 |
$sth->execute("Cancelled and transfered to $booksellertoname on $today", $ordernumber); |
1729 |
$rv = $sth->execute($ordernumber); |
1739 |
|
1730 |
|
1740 |
delete $order->{'ordernumber'}; |
1731 |
delete $order->{'ordernumber'}; |
1741 |
$order->{'basketno'} = $basketno; |
1732 |
$order->{'basketno'} = $basketno; |
1742 |
$order->{'internalnotes'} = "Transfered from $booksellerfromname on $today"; |
|
|
1743 |
my $newordernumber; |
1733 |
my $newordernumber; |
1744 |
(undef, $newordernumber) = NewOrder($order); |
1734 |
(undef, $newordernumber) = NewOrder($order); |
1745 |
|
1735 |
|
Lines 1751-1756
sub TransferOrder {
Link Here
|
1751 |
$sth = $dbh->prepare($query); |
1741 |
$sth = $dbh->prepare($query); |
1752 |
$sth->execute($newordernumber, $ordernumber); |
1742 |
$sth->execute($newordernumber, $ordernumber); |
1753 |
|
1743 |
|
|
|
1744 |
$query = q{ |
1745 |
INSERT INTO aqorders_transfers (ordernumber_from, ordernumber_to) |
1746 |
VALUES (?, ?) |
1747 |
}; |
1748 |
$sth = $dbh->prepare($query); |
1749 |
$sth->execute($ordernumber, $newordernumber); |
1750 |
|
1754 |
return $newordernumber; |
1751 |
return $newordernumber; |
1755 |
} |
1752 |
} |
1756 |
|
1753 |
|