|
Lines 921-927
sub GetPendingOrders {
Link Here
|
| 921 |
|
921 |
|
| 922 |
@orders = &GetOrders($basketnumber, $orderby); |
922 |
@orders = &GetOrders($basketnumber, $orderby); |
| 923 |
|
923 |
|
| 924 |
Looks up the pending (non-cancelled) orders with the given basket |
924 |
Looks up non-cancelled orders (pending and received) with the given basket |
| 925 |
number. If C<$booksellerID> is non-empty, only orders from that seller |
925 |
number. If C<$booksellerID> is non-empty, only orders from that seller |
| 926 |
are returned. |
926 |
are returned. |
| 927 |
|
927 |
|
|
Lines 929-957
return :
Link Here
|
| 929 |
C<&basket> returns a two-element array. C<@orders> is an array of |
929 |
C<&basket> returns a two-element array. C<@orders> is an array of |
| 930 |
references-to-hash, whose keys are the fields from the aqorders, |
930 |
references-to-hash, whose keys are the fields from the aqorders, |
| 931 |
biblio, and biblioitems tables in the Koha database. |
931 |
biblio, and biblioitems tables in the Koha database. |
|
|
932 |
If the record have been suppressed, its biblionumber is only returned in deletedbiblionumber column. |
| 932 |
|
933 |
|
| 933 |
=cut |
934 |
=cut |
| 934 |
|
935 |
|
| 935 |
sub GetOrders { |
936 |
sub GetOrders { |
| 936 |
my ( $basketno, $orderby ) = @_; |
937 |
my ( $basketno, $orderby ) = @_; |
| 937 |
my $dbh = C4::Context->dbh; |
938 |
my $dbh = C4::Context->dbh; |
|
|
939 |
# get all the fields of biblio, and all of biblioitems, except marc (marc blob) and timestamp |
| 940 |
# timestamp is used in biblio and in aqorders, so rename biblio.timestamp into biblio_timestamp |
| 941 |
# notes are used in biblio, biblioitems and aqorders. Rename biblio.notes and biblio into biblio_notes and biblioitems_notes |
| 938 |
my $query =" |
942 |
my $query =" |
| 939 |
SELECT biblio.*,biblioitems.*, |
943 |
SELECT all_biblio.*, |
|
|
944 |
all_biblioitems.*, |
| 940 |
aqorders.*, |
945 |
aqorders.*, |
| 941 |
aqbudgets.*, |
946 |
aqbudgets.*, |
| 942 |
biblio.title, |
|
|
| 943 |
aqorders_transfers.ordernumber_from AS transferred_from, |
947 |
aqorders_transfers.ordernumber_from AS transferred_from, |
| 944 |
aqorders_transfers.timestamp AS transferred_from_timestamp |
948 |
aqorders_transfers.timestamp AS transferred_from_timestamp |
| 945 |
FROM aqorders |
949 |
FROM aqorders |
| 946 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
950 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
| 947 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
951 |
LEFT JOIN ( |
| 948 |
LEFT JOIN biblioitems ON biblioitems.biblionumber =biblio.biblionumber |
952 |
SELECT biblionumber, |
|
|
953 |
frameworkcode, |
| 954 |
author, |
| 955 |
title, |
| 956 |
unititle, |
| 957 |
notes AS biblio_notes, |
| 958 |
serial, |
| 959 |
seriestitle, |
| 960 |
copyrightdate, |
| 961 |
timestamp AS biblio_timestamp, |
| 962 |
datecreated, |
| 963 |
abstract |
| 964 |
FROM biblio |
| 965 |
UNION ALL |
| 966 |
SELECT biblionumber, |
| 967 |
frameworkcode, |
| 968 |
author, |
| 969 |
title, |
| 970 |
unititle, |
| 971 |
notes AS biblio_notes, |
| 972 |
serial, |
| 973 |
seriestitle, |
| 974 |
copyrightdate, |
| 975 |
timestamp AS biblio_timestamp, |
| 976 |
datecreated, |
| 977 |
abstract |
| 978 |
FROM deletedbiblio |
| 979 |
) AS all_biblio ON ((all_biblio.biblionumber=aqorders.biblionumber) OR (all_biblio.biblionumber=aqorders.deletedbiblionumber)) |
| 980 |
LEFT JOIN ( |
| 981 |
SELECT biblionumber, |
| 982 |
biblioitemnumber, |
| 983 |
volume, |
| 984 |
number, |
| 985 |
itemtype, |
| 986 |
isbn, |
| 987 |
issn, |
| 988 |
ean, |
| 989 |
publicationyear, |
| 990 |
publishercode, |
| 991 |
volumedate, |
| 992 |
volumedesc, |
| 993 |
collectiontitle, |
| 994 |
collectionissn, |
| 995 |
collectionvolume, |
| 996 |
editionstatement, |
| 997 |
editionresponsibility, |
| 998 |
illus, |
| 999 |
pages, |
| 1000 |
notes AS biblioitems_notes, |
| 1001 |
size, |
| 1002 |
place, |
| 1003 |
lccn, |
| 1004 |
marc, |
| 1005 |
url, |
| 1006 |
cn_source, |
| 1007 |
cn_class, |
| 1008 |
cn_item, |
| 1009 |
cn_suffix, |
| 1010 |
cn_sort, |
| 1011 |
agerestriction, |
| 1012 |
totalissues, |
| 1013 |
marcxml |
| 1014 |
FROM biblioitems |
| 1015 |
UNION ALL |
| 1016 |
SELECT biblionumber, |
| 1017 |
biblioitemnumber, |
| 1018 |
volume, |
| 1019 |
number, |
| 1020 |
itemtype, |
| 1021 |
isbn, |
| 1022 |
issn, |
| 1023 |
ean, |
| 1024 |
publicationyear, |
| 1025 |
publishercode, |
| 1026 |
volumedate, |
| 1027 |
volumedesc, |
| 1028 |
collectiontitle, |
| 1029 |
collectionissn, |
| 1030 |
collectionvolume, |
| 1031 |
editionstatement, |
| 1032 |
editionresponsibility, |
| 1033 |
illus, |
| 1034 |
pages, |
| 1035 |
notes AS biblioitems_notes, |
| 1036 |
size, |
| 1037 |
place, |
| 1038 |
lccn, |
| 1039 |
marc, |
| 1040 |
url, |
| 1041 |
cn_source, |
| 1042 |
cn_class, |
| 1043 |
cn_item, |
| 1044 |
cn_suffix, |
| 1045 |
cn_sort, |
| 1046 |
agerestriction, |
| 1047 |
totalissues, |
| 1048 |
marcxml |
| 1049 |
FROM deletedbiblioitems |
| 1050 |
) AS all_biblioitems ON ((all_biblioitems.biblionumber=aqorders.biblionumber) OR (all_biblioitems.biblionumber=aqorders.deletedbiblionumber)) |
| 949 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_to = aqorders.ordernumber |
1051 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_to = aqorders.ordernumber |
| 950 |
WHERE basketno=? |
1052 |
WHERE basketno=? |
| 951 |
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') |
1053 |
AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') |
| 952 |
"; |
1054 |
"; |
| 953 |
|
1055 |
$orderby = "all_biblioitems.publishercode,all_biblio.title" unless $orderby; |
| 954 |
$orderby = "biblioitems.publishercode,biblio.title" unless $orderby; |
|
|
| 955 |
$query .= " ORDER BY $orderby"; |
1056 |
$query .= " ORDER BY $orderby"; |
| 956 |
my $sth = $dbh->prepare($query); |
1057 |
my $sth = $dbh->prepare($query); |
| 957 |
$sth->execute($basketno); |
1058 |
$sth->execute($basketno); |
|
Lines 1005-1023
Looks up an order by order number.
Link Here
|
| 1005 |
|
1106 |
|
| 1006 |
Returns a reference-to-hash describing the order. The keys of |
1107 |
Returns a reference-to-hash describing the order. The keys of |
| 1007 |
C<$order> are fields from the biblio, biblioitems, aqorders tables of the Koha database. |
1108 |
C<$order> are fields from the biblio, biblioitems, aqorders tables of the Koha database. |
|
|
1109 |
If the record have been suppressed, its biblionumber is only returned in deletedbiblionumber column. |
| 1008 |
|
1110 |
|
| 1009 |
=cut |
1111 |
=cut |
| 1010 |
|
1112 |
|
| 1011 |
sub GetOrder { |
1113 |
sub GetOrder { |
| 1012 |
my ($ordernumber) = @_; |
1114 |
my ($ordernumber) = @_; |
| 1013 |
my $dbh = C4::Context->dbh; |
1115 |
my $dbh = C4::Context->dbh; |
|
|
1116 |
# get all the fields of biblio, and all of biblioitems, except marc (marc blob) and timestamp |
| 1117 |
# timestamp is used in biblio and in aqorders, so rename biblio.timestamp into biblio_timestamp |
| 1118 |
# notes are used in biblio, biblioitems and aqorders. Rename biblio.notes and biblio into biblio_notes and biblioitems_notes |
| 1014 |
my $query = " |
1119 |
my $query = " |
| 1015 |
SELECT biblioitems.*, biblio.*, aqorders.* |
1120 |
SELECT all_biblio.*, all_biblioitems.*, |
|
|
1121 |
aqorders.* |
| 1016 |
FROM aqorders |
1122 |
FROM aqorders |
| 1017 |
LEFT JOIN biblio on biblio.biblionumber=aqorders.biblionumber |
1123 |
LEFT JOIN ( |
| 1018 |
LEFT JOIN biblioitems on biblioitems.biblionumber=aqorders.biblionumber |
1124 |
SELECT biblionumber, |
|
|
1125 |
frameworkcode, |
| 1126 |
author, |
| 1127 |
title, |
| 1128 |
unititle, |
| 1129 |
notes AS biblio_notes, |
| 1130 |
serial, |
| 1131 |
seriestitle, |
| 1132 |
copyrightdate, |
| 1133 |
timestamp AS biblio_timestamp, |
| 1134 |
datecreated, |
| 1135 |
abstract |
| 1136 |
FROM biblio |
| 1137 |
UNION ALL |
| 1138 |
SELECT biblionumber, |
| 1139 |
frameworkcode, |
| 1140 |
author, |
| 1141 |
title, |
| 1142 |
unititle, |
| 1143 |
notes AS biblio_notes, |
| 1144 |
serial, |
| 1145 |
seriestitle, |
| 1146 |
copyrightdate, |
| 1147 |
timestamp AS biblio_timestamp, |
| 1148 |
datecreated, |
| 1149 |
abstract |
| 1150 |
FROM deletedbiblio |
| 1151 |
) AS all_biblio ON ((all_biblio.biblionumber=aqorders.biblionumber) OR (all_biblio.biblionumber=aqorders.deletedbiblionumber)) |
| 1152 |
LEFT JOIN ( |
| 1153 |
SELECT biblionumber, |
| 1154 |
biblioitemnumber, |
| 1155 |
volume, |
| 1156 |
number, |
| 1157 |
itemtype, |
| 1158 |
isbn, |
| 1159 |
issn, |
| 1160 |
ean, |
| 1161 |
publicationyear, |
| 1162 |
publishercode, |
| 1163 |
volumedate, |
| 1164 |
volumedesc, |
| 1165 |
collectiontitle, |
| 1166 |
collectionissn, |
| 1167 |
collectionvolume, |
| 1168 |
editionstatement, |
| 1169 |
editionresponsibility, |
| 1170 |
illus, |
| 1171 |
pages, |
| 1172 |
notes AS biblioitems_notes, |
| 1173 |
size, |
| 1174 |
place, |
| 1175 |
lccn, |
| 1176 |
marc, |
| 1177 |
url, |
| 1178 |
cn_source, |
| 1179 |
cn_class, |
| 1180 |
cn_item, |
| 1181 |
cn_suffix, |
| 1182 |
cn_sort, |
| 1183 |
agerestriction, |
| 1184 |
totalissues, |
| 1185 |
marcxml |
| 1186 |
FROM biblioitems |
| 1187 |
UNION ALL |
| 1188 |
SELECT biblionumber, |
| 1189 |
biblioitemnumber, |
| 1190 |
volume, |
| 1191 |
number, |
| 1192 |
itemtype, |
| 1193 |
isbn, |
| 1194 |
issn, |
| 1195 |
ean, |
| 1196 |
publicationyear, |
| 1197 |
publishercode, |
| 1198 |
volumedate, |
| 1199 |
volumedesc, |
| 1200 |
collectiontitle, |
| 1201 |
collectionissn, |
| 1202 |
collectionvolume, |
| 1203 |
editionstatement, |
| 1204 |
editionresponsibility, |
| 1205 |
illus, |
| 1206 |
pages, |
| 1207 |
notes AS biblioitems_notes, |
| 1208 |
size, |
| 1209 |
place, |
| 1210 |
lccn, |
| 1211 |
marc, |
| 1212 |
url, |
| 1213 |
cn_source, |
| 1214 |
cn_class, |
| 1215 |
cn_item, |
| 1216 |
cn_suffix, |
| 1217 |
cn_sort, |
| 1218 |
agerestriction, |
| 1219 |
totalissues, |
| 1220 |
marcxml |
| 1221 |
FROM deletedbiblioitems |
| 1222 |
) AS all_biblioitems ON ((all_biblioitems.biblionumber=aqorders.biblionumber) OR (all_biblioitems.biblionumber=aqorders.deletedbiblionumber)) |
| 1019 |
WHERE aqorders.ordernumber=? |
1223 |
WHERE aqorders.ordernumber=? |
| 1020 |
|
|
|
| 1021 |
"; |
1224 |
"; |
| 1022 |
my $sth= $dbh->prepare($query); |
1225 |
my $sth= $dbh->prepare($query); |
| 1023 |
$sth->execute($ordernumber); |
1226 |
$sth->execute($ordernumber); |
|
Lines 1026-1031
sub GetOrder {
Link Here
|
| 1026 |
return $data; |
1229 |
return $data; |
| 1027 |
} |
1230 |
} |
| 1028 |
|
1231 |
|
|
|
1232 |
|
| 1029 |
=head3 GetLastOrderNotReceivedFromSubscriptionid |
1233 |
=head3 GetLastOrderNotReceivedFromSubscriptionid |
| 1030 |
|
1234 |
|
| 1031 |
$order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid); |
1235 |
$order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid); |
|
Lines 1113-1120
Else, the upcoming July 1st is used.
Link Here
|
| 1113 |
|
1317 |
|
| 1114 |
=item defaults entrydate to Now |
1318 |
=item defaults entrydate to Now |
| 1115 |
|
1319 |
|
| 1116 |
The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "budget_id". |
1320 |
The following keys are used: "biblionumber", "basketno", "quantity", "notes", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "budget_id". |
| 1117 |
|
|
|
| 1118 |
=back |
1321 |
=back |
| 1119 |
|
1322 |
|
| 1120 |
=cut |
1323 |
=cut |
|
Lines 1257-1263
sub ModItemOrder {
Link Here
|
| 1257 |
|
1460 |
|
| 1258 |
my @orders = GetCancelledOrders($basketno, $orderby); |
1461 |
my @orders = GetCancelledOrders($basketno, $orderby); |
| 1259 |
|
1462 |
|
| 1260 |
Returns cancelled orders for a basket |
1463 |
Returns cancelled orders for a basket. |
|
|
1464 |
If the record have been suppressed, its biblionumber is only retuned in deletedbiblionumber column. |
| 1261 |
|
1465 |
|
| 1262 |
=cut |
1466 |
=cut |
| 1263 |
|
1467 |
|
|
Lines 1269-1285
sub GetCancelledOrders {
Link Here
|
| 1269 |
my $dbh = C4::Context->dbh; |
1473 |
my $dbh = C4::Context->dbh; |
| 1270 |
my $query = " |
1474 |
my $query = " |
| 1271 |
SELECT |
1475 |
SELECT |
| 1272 |
biblio.*, |
1476 |
all_biblio.*, |
| 1273 |
biblioitems.*, |
1477 |
all_biblioitems.*, |
| 1274 |
aqorders.*, |
1478 |
aqorders.*, |
| 1275 |
aqbudgets.*, |
1479 |
aqbudgets.*, |
| 1276 |
aqorders_transfers.ordernumber_to AS transferred_to, |
1480 |
aqorders_transfers.ordernumber_to AS transferred_to, |
| 1277 |
aqorders_transfers.timestamp AS transferred_to_timestamp |
1481 |
aqorders_transfers.timestamp AS transferred_to_timestamp |
| 1278 |
FROM aqorders |
1482 |
FROM aqorders |
| 1279 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
1483 |
LEFT JOIN aqbudgets ON aqbudgets.budget_id = aqorders.budget_id |
| 1280 |
LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber |
1484 |
LEFT JOIN ( |
| 1281 |
LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber |
1485 |
SELECT biblionumber, |
| 1282 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_from = aqorders.ordernumber |
1486 |
frameworkcode, |
|
|
1487 |
author, |
| 1488 |
title, |
| 1489 |
unititle, |
| 1490 |
notes AS biblio_notes, |
| 1491 |
serial, |
| 1492 |
seriestitle, |
| 1493 |
copyrightdate, |
| 1494 |
timestamp AS biblio_timestamp, |
| 1495 |
datecreated, |
| 1496 |
abstract |
| 1497 |
FROM biblio |
| 1498 |
UNION ALL |
| 1499 |
SELECT biblionumber, |
| 1500 |
frameworkcode, |
| 1501 |
author, |
| 1502 |
title, |
| 1503 |
unititle, |
| 1504 |
notes AS biblio_notes, |
| 1505 |
serial, |
| 1506 |
seriestitle, |
| 1507 |
copyrightdate, |
| 1508 |
timestamp AS biblio_timestamp, |
| 1509 |
datecreated, |
| 1510 |
abstract |
| 1511 |
FROM deletedbiblio |
| 1512 |
) AS all_biblio ON ((all_biblio.biblionumber=aqorders.biblionumber) OR (all_biblio.biblionumber=aqorders.deletedbiblionumber)) |
| 1513 |
LEFT JOIN ( |
| 1514 |
SELECT biblionumber, |
| 1515 |
biblioitemnumber, |
| 1516 |
volume, |
| 1517 |
number, |
| 1518 |
itemtype, |
| 1519 |
isbn, |
| 1520 |
issn, |
| 1521 |
ean, |
| 1522 |
publicationyear, |
| 1523 |
publishercode, |
| 1524 |
volumedate, |
| 1525 |
volumedesc, |
| 1526 |
collectiontitle, |
| 1527 |
collectionissn, |
| 1528 |
collectionvolume, |
| 1529 |
editionstatement, |
| 1530 |
editionresponsibility, |
| 1531 |
illus, |
| 1532 |
pages, |
| 1533 |
notes AS biblioitems_notes, |
| 1534 |
size, |
| 1535 |
place, |
| 1536 |
lccn, |
| 1537 |
marc, |
| 1538 |
url, |
| 1539 |
cn_source, |
| 1540 |
cn_class, |
| 1541 |
cn_item, |
| 1542 |
cn_suffix, |
| 1543 |
cn_sort, |
| 1544 |
agerestriction, |
| 1545 |
totalissues, |
| 1546 |
marcxml |
| 1547 |
FROM biblioitems |
| 1548 |
UNION ALL |
| 1549 |
SELECT biblionumber, |
| 1550 |
biblioitemnumber, |
| 1551 |
volume, |
| 1552 |
number, |
| 1553 |
itemtype, |
| 1554 |
isbn, |
| 1555 |
issn, |
| 1556 |
ean, |
| 1557 |
publicationyear, |
| 1558 |
publishercode, |
| 1559 |
volumedate, |
| 1560 |
volumedesc, |
| 1561 |
collectiontitle, |
| 1562 |
collectionissn, |
| 1563 |
collectionvolume, |
| 1564 |
editionstatement, |
| 1565 |
editionresponsibility, |
| 1566 |
illus, |
| 1567 |
pages, |
| 1568 |
notes AS biblioitems_notes, |
| 1569 |
size, |
| 1570 |
place, |
| 1571 |
lccn, |
| 1572 |
marc, |
| 1573 |
url, |
| 1574 |
cn_source, |
| 1575 |
cn_class, |
| 1576 |
cn_item, |
| 1577 |
cn_suffix, |
| 1578 |
cn_sort, |
| 1579 |
agerestriction, |
| 1580 |
totalissues, |
| 1581 |
marcxml |
| 1582 |
FROM deletedbiblioitems |
| 1583 |
) AS all_biblioitems ON ((all_biblioitems.biblionumber=aqorders.biblionumber) OR (all_biblioitems.biblionumber=aqorders.deletedbiblionumber)) |
| 1584 |
LEFT JOIN aqorders_transfers ON aqorders_transfers.ordernumber_from = aqorders.ordernumber |
| 1283 |
WHERE basketno = ? |
1585 |
WHERE basketno = ? |
| 1284 |
AND (datecancellationprinted IS NOT NULL |
1586 |
AND (datecancellationprinted IS NOT NULL |
| 1285 |
AND datecancellationprinted <> '0000-00-00') |
1587 |
AND datecancellationprinted <> '0000-00-00') |
|
Lines 1295-1301
sub GetCancelledOrders {
Link Here
|
| 1295 |
return @$results; |
1597 |
return @$results; |
| 1296 |
} |
1598 |
} |
| 1297 |
|
1599 |
|
| 1298 |
|
|
|
| 1299 |
#------------------------------------------------------------# |
1600 |
#------------------------------------------------------------# |
| 1300 |
|
1601 |
|
| 1301 |
=head3 ModReceiveOrder |
1602 |
=head3 ModReceiveOrder |