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 1265-1275
sub GetCancelledOrders {
Link Here
|
1265 |
|
1268 |
|
1266 |
my $dbh = C4::Context->dbh; |
1269 |
my $dbh = C4::Context->dbh; |
1267 |
my $query = " |
1270 |
my $query = " |
1268 |
SELECT biblio.*, biblioitems.*, aqorders.*, aqbudgets.* |
1271 |
SELECT |
|
|
1272 |
biblio.*, |
1273 |
biblioitems.*, |
1274 |
aqorders.*, |
1275 |
aqbudgets.*, |
1276 |
aqorders_transfers.ordernumber_to AS transferred_to, |
1277 |
aqorders_transfers.timestamp AS transferred_to_timestamp |
1269 |
FROM aqorders |
1278 |
FROM aqorders |
1270 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
1279 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
1271 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
1280 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
1272 |
LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber |
1281 |
LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber |
|
|
1282 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_from = aqorders.ordernumber |
1273 |
WHERE basketno = ? |
1283 |
WHERE basketno = ? |
1274 |
AND (datecancellationprinted IS NOT NULL |
1284 |
AND (datecancellationprinted IS NOT NULL |
1275 |
AND datecancellationprinted <> '0000-00-00') |
1285 |
AND datecancellationprinted <> '0000-00-00') |
Lines 1616-1657
sub TransferOrder {
Link Here
|
1616 |
|
1626 |
|
1617 |
my $order = GetOrder( $ordernumber ); |
1627 |
my $order = GetOrder( $ordernumber ); |
1618 |
return if $order->{datereceived}; |
1628 |
return if $order->{datereceived}; |
|
|
1629 |
my $basket = GetBasket($basketno); |
1630 |
return unless $basket; |
1619 |
|
1631 |
|
1620 |
my $today = C4::Dates->new()->output("iso"); |
|
|
1621 |
my $query = qq{ |
1622 |
SELECT aqbooksellers.name |
1623 |
FROM aqorders |
1624 |
LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno |
1625 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1626 |
WHERE aqorders.ordernumber = ? |
1627 |
}; |
1628 |
my $dbh = C4::Context->dbh; |
1632 |
my $dbh = C4::Context->dbh; |
1629 |
my $sth = $dbh->prepare($query); |
1633 |
my ($query, $sth, $rv); |
1630 |
$sth->execute($ordernumber); |
|
|
1631 |
my ($booksellerfromname) = $sth->fetchrow_array; |
1632 |
|
1633 |
$query = qq{ |
1634 |
SELECT aqbooksellers.name |
1635 |
FROM aqbasket |
1636 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1637 |
WHERE aqbasket.basketno = ? |
1638 |
}; |
1639 |
$sth = $dbh->prepare($query); |
1640 |
$sth->execute($basketno); |
1641 |
my ($booksellertoname) = $sth->fetchrow_array; |
1642 |
|
1634 |
|
1643 |
$query = qq{ |
1635 |
$query = qq{ |
1644 |
UPDATE aqorders |
1636 |
UPDATE aqorders |
1645 |
SET datecancellationprinted = CAST(NOW() AS date), |
1637 |
SET datecancellationprinted = CAST(NOW() AS date) |
1646 |
internalnotes = ? |
|
|
1647 |
WHERE ordernumber = ? |
1638 |
WHERE ordernumber = ? |
1648 |
}; |
1639 |
}; |
1649 |
$sth = $dbh->prepare($query); |
1640 |
$sth = $dbh->prepare($query); |
1650 |
$sth->execute("Cancelled and transfered to $booksellertoname on $today", $ordernumber); |
1641 |
$rv = $sth->execute($ordernumber); |
1651 |
|
1642 |
|
1652 |
delete $order->{'ordernumber'}; |
1643 |
delete $order->{'ordernumber'}; |
1653 |
$order->{'basketno'} = $basketno; |
1644 |
$order->{'basketno'} = $basketno; |
1654 |
$order->{'internalnotes'} = "Transfered from $booksellerfromname on $today"; |
|
|
1655 |
my $newordernumber; |
1645 |
my $newordernumber; |
1656 |
(undef, $newordernumber) = NewOrder($order); |
1646 |
(undef, $newordernumber) = NewOrder($order); |
1657 |
|
1647 |
|
Lines 1663-1668
sub TransferOrder {
Link Here
|
1663 |
$sth = $dbh->prepare($query); |
1653 |
$sth = $dbh->prepare($query); |
1664 |
$sth->execute($newordernumber, $ordernumber); |
1654 |
$sth->execute($newordernumber, $ordernumber); |
1665 |
|
1655 |
|
|
|
1656 |
$query = q{ |
1657 |
INSERT INTO aqorders_transfers (ordernumber_from, ordernumber_to) |
1658 |
VALUES (?, ?) |
1659 |
}; |
1660 |
$sth = $dbh->prepare($query); |
1661 |
$sth->execute($ordernumber, $newordernumber); |
1662 |
|
1666 |
return $newordernumber; |
1663 |
return $newordernumber; |
1667 |
} |
1664 |
} |
1668 |
|
1665 |
|