Lines 474-480
sub DelBasket {
Link Here
|
474 |
my $dbh = C4::Context->dbh; |
474 |
my $dbh = C4::Context->dbh; |
475 |
my $sth = $dbh->prepare($query); |
475 |
my $sth = $dbh->prepare($query); |
476 |
$sth->execute($basketno); |
476 |
$sth->execute($basketno); |
477 |
$sth->finish; |
477 |
return; |
478 |
} |
478 |
} |
479 |
|
479 |
|
480 |
#------------------------------------------------------------# |
480 |
#------------------------------------------------------------# |
Lines 515-521
sub ModBasket {
Link Here
|
515 |
my $sth = $dbh->prepare($query); |
515 |
my $sth = $dbh->prepare($query); |
516 |
$sth->execute(@params); |
516 |
$sth->execute(@params); |
517 |
|
517 |
|
518 |
$sth->finish; |
518 |
return; |
519 |
} |
519 |
} |
520 |
|
520 |
|
521 |
#------------------------------------------------------------# |
521 |
#------------------------------------------------------------# |
Lines 564-572
sub ModBasketHeader {
Link Here
|
564 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |
564 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |
565 |
my $sth2 = $dbh->prepare($query2); |
565 |
my $sth2 = $dbh->prepare($query2); |
566 |
$sth2->execute($contractnumber,$basketno); |
566 |
$sth2->execute($contractnumber,$basketno); |
567 |
$sth2->finish; |
|
|
568 |
} |
567 |
} |
569 |
$sth->finish; |
568 |
return; |
570 |
} |
569 |
} |
571 |
|
570 |
|
572 |
#------------------------------------------------------------# |
571 |
#------------------------------------------------------------# |
Lines 609-617
sub GetBasketsByBookseller {
Link Here
|
609 |
my $dbh = C4::Context->dbh; |
608 |
my $dbh = C4::Context->dbh; |
610 |
my $sth = $dbh->prepare($query); |
609 |
my $sth = $dbh->prepare($query); |
611 |
$sth->execute($booksellerid); |
610 |
$sth->execute($booksellerid); |
612 |
my $results = $sth->fetchall_arrayref({}); |
611 |
return $sth->fetchall_arrayref({}); |
613 |
$sth->finish; |
|
|
614 |
return $results |
615 |
} |
612 |
} |
616 |
|
613 |
|
617 |
=head3 GetBasketsInfosByBookseller |
614 |
=head3 GetBasketsInfosByBookseller |
Lines 680-686
sub GetBasketUsers {
Link Here
|
680 |
my $sth = $dbh->prepare($query); |
677 |
my $sth = $dbh->prepare($query); |
681 |
$sth->execute($basketno); |
678 |
$sth->execute($basketno); |
682 |
my $results = $sth->fetchall_arrayref( {} ); |
679 |
my $results = $sth->fetchall_arrayref( {} ); |
683 |
$sth->finish(); |
|
|
684 |
|
680 |
|
685 |
my @borrowernumbers; |
681 |
my @borrowernumbers; |
686 |
foreach (@$results) { |
682 |
foreach (@$results) { |
Lines 712-718
sub ModBasketUsers {
Link Here
|
712 |
}; |
708 |
}; |
713 |
my $sth = $dbh->prepare($query); |
709 |
my $sth = $dbh->prepare($query); |
714 |
$sth->execute($basketno); |
710 |
$sth->execute($basketno); |
715 |
$sth->finish(); |
|
|
716 |
|
711 |
|
717 |
$query = qq{ |
712 |
$query = qq{ |
718 |
INSERT INTO aqbasketusers (basketno, borrowernumber) |
713 |
INSERT INTO aqbasketusers (basketno, borrowernumber) |
Lines 722-727
sub ModBasketUsers {
Link Here
|
722 |
foreach my $basketuser_id (@basketusers_ids) { |
717 |
foreach my $basketuser_id (@basketusers_ids) { |
723 |
$sth->execute($basketno, $basketuser_id); |
718 |
$sth->execute($basketno, $basketuser_id); |
724 |
} |
719 |
} |
|
|
720 |
return; |
725 |
} |
721 |
} |
726 |
|
722 |
|
727 |
=head3 CanUserManageBasket |
723 |
=head3 CanUserManageBasket |
Lines 822-830
sub GetBasketsByBasketgroup {
Link Here
|
822 |
my $dbh = C4::Context->dbh; |
818 |
my $dbh = C4::Context->dbh; |
823 |
my $sth = $dbh->prepare($query); |
819 |
my $sth = $dbh->prepare($query); |
824 |
$sth->execute($basketgroupid); |
820 |
$sth->execute($basketgroupid); |
825 |
my $results = $sth->fetchall_arrayref({}); |
821 |
return $sth->fetchall_arrayref({}); |
826 |
$sth->finish; |
|
|
827 |
return $results |
828 |
} |
822 |
} |
829 |
|
823 |
|
830 |
#------------------------------------------------------------# |
824 |
#------------------------------------------------------------# |
Lines 936-945
sub ModBasketgroup {
Link Here
|
936 |
$sth = $dbh->prepare("UPDATE aqbasket SET basketgroupid=? WHERE basketno=?"); |
930 |
$sth = $dbh->prepare("UPDATE aqbasket SET basketgroupid=? WHERE basketno=?"); |
937 |
foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) { |
931 |
foreach my $basketno (@{$basketgroupinfo->{'basketlist'}}) { |
938 |
$sth->execute($basketgroupinfo->{'id'}, $basketno); |
932 |
$sth->execute($basketgroupinfo->{'id'}, $basketno); |
939 |
$sth->finish; |
|
|
940 |
} |
933 |
} |
941 |
} |
934 |
} |
942 |
$sth->finish; |
935 |
return; |
943 |
} |
936 |
} |
944 |
|
937 |
|
945 |
#------------------------------------------------------------# |
938 |
#------------------------------------------------------------# |
Lines 965-971
sub DelBasketgroup {
Link Here
|
965 |
my $dbh = C4::Context->dbh; |
958 |
my $dbh = C4::Context->dbh; |
966 |
my $sth = $dbh->prepare($query); |
959 |
my $sth = $dbh->prepare($query); |
967 |
$sth->execute($basketgroupid); |
960 |
$sth->execute($basketgroupid); |
968 |
$sth->finish; |
961 |
return; |
969 |
} |
962 |
} |
970 |
|
963 |
|
971 |
#------------------------------------------------------------# |
964 |
#------------------------------------------------------------# |
Lines 984-996
Returns a reference to the hash containing all infermation about the basketgroup
Link Here
|
984 |
sub GetBasketgroup { |
977 |
sub GetBasketgroup { |
985 |
my $basketgroupid = shift; |
978 |
my $basketgroupid = shift; |
986 |
die "basketgroup id is required to edit a basketgroup" unless $basketgroupid; |
979 |
die "basketgroup id is required to edit a basketgroup" unless $basketgroupid; |
987 |
my $query = "SELECT * FROM aqbasketgroups WHERE id=?"; |
|
|
988 |
my $dbh = C4::Context->dbh; |
980 |
my $dbh = C4::Context->dbh; |
989 |
my $sth = $dbh->prepare($query); |
981 |
my $result_set = $dbh->selectall_arrayref( |
990 |
$sth->execute($basketgroupid); |
982 |
'SELECT * FROM aqbasketgroups WHERE id=?', |
991 |
my $result = $sth->fetchrow_hashref; |
983 |
{ Slice => {} }, |
992 |
$sth->finish; |
984 |
$basketgroupid |
993 |
return $result |
985 |
); |
|
|
986 |
return $result_set->[0]; # id is unique |
994 |
} |
987 |
} |
995 |
|
988 |
|
996 |
#------------------------------------------------------------# |
989 |
#------------------------------------------------------------# |
Lines 1053-1063
sub GetOrders {
Link Here
|
1053 |
|
1046 |
|
1054 |
$orderby = "biblioitems.publishercode,biblio.title" unless $orderby; |
1047 |
$orderby = "biblioitems.publishercode,biblio.title" unless $orderby; |
1055 |
$query .= " ORDER BY $orderby"; |
1048 |
$query .= " ORDER BY $orderby"; |
1056 |
my $sth = $dbh->prepare($query); |
1049 |
my $result_set = |
1057 |
$sth->execute($basketno); |
1050 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $basketno ); |
1058 |
my $results = $sth->fetchall_arrayref({}); |
1051 |
return @{$result_set}; |
1059 |
$sth->finish; |
1052 |
|
1060 |
return @$results; |
|
|
1061 |
} |
1053 |
} |
1062 |
|
1054 |
|
1063 |
#------------------------------------------------------------# |
1055 |
#------------------------------------------------------------# |
Lines 1088-1098
sub GetOrdersByBiblionumber {
Link Here
|
1088 |
LEFT JOIN biblioitems ON biblioitems.biblionumber =biblio.biblionumber |
1080 |
LEFT JOIN biblioitems ON biblioitems.biblionumber =biblio.biblionumber |
1089 |
WHERE aqorders.biblionumber=? |
1081 |
WHERE aqorders.biblionumber=? |
1090 |
"; |
1082 |
"; |
1091 |
my $sth = $dbh->prepare($query); |
1083 |
my $result_set = |
1092 |
$sth->execute($biblionumber); |
1084 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $biblionumber ); |
1093 |
my $results = $sth->fetchall_arrayref({}); |
1085 |
return @{$result_set}; |
1094 |
$sth->finish; |
1086 |
|
1095 |
return @$results; |
|
|
1096 |
} |
1087 |
} |
1097 |
|
1088 |
|
1098 |
#------------------------------------------------------------# |
1089 |
#------------------------------------------------------------# |
Lines 1144-1155
sub GetOrder {
Link Here
|
1144 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1135 |
LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id |
1145 |
WHERE aqorders.basketno = aqbasket.basketno |
1136 |
WHERE aqorders.basketno = aqbasket.basketno |
1146 |
AND ordernumber=?}; |
1137 |
AND ordernumber=?}; |
1147 |
my $sth= $dbh->prepare($query); |
1138 |
my $result_set = |
1148 |
$sth->execute($ordernumber); |
1139 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $ordernumber ); |
1149 |
my $data = $sth->fetchrow_hashref; |
1140 |
|
1150 |
$data->{orderdate} = format_date( $data->{orderdate} ); |
1141 |
# result_set assumed to contain 1 match |
1151 |
$sth->finish; |
1142 |
return $result_set->[0]; |
1152 |
return $data; |
|
|
1153 |
} |
1143 |
} |
1154 |
|
1144 |
|
1155 |
=head3 GetLastOrderNotReceivedFromSubscriptionid |
1145 |
=head3 GetLastOrderNotReceivedFromSubscriptionid |
Lines 1171-1180
sub GetLastOrderNotReceivedFromSubscriptionid {
Link Here
|
1171 |
AND aqorders.datereceived IS NULL |
1161 |
AND aqorders.datereceived IS NULL |
1172 |
LIMIT 1 |
1162 |
LIMIT 1 |
1173 |
|; |
1163 |
|; |
1174 |
my $sth = $dbh->prepare( $query ); |
1164 |
my $result_set = |
1175 |
$sth->execute( $subscriptionid ); |
1165 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $subscriptionid ); |
1176 |
my $order = $sth->fetchrow_hashref; |
1166 |
|
1177 |
return $order; |
1167 |
# result_set assumed to contain 1 match |
|
|
1168 |
return $result_set->[0]; |
1178 |
} |
1169 |
} |
1179 |
|
1170 |
|
1180 |
=head3 GetLastOrderReceivedFromSubscriptionid |
1171 |
=head3 GetLastOrderReceivedFromSubscriptionid |
Lines 1205-1214
sub GetLastOrderReceivedFromSubscriptionid {
Link Here
|
1205 |
ORDER BY ordernumber DESC |
1196 |
ORDER BY ordernumber DESC |
1206 |
LIMIT 1 |
1197 |
LIMIT 1 |
1207 |
|; |
1198 |
|; |
1208 |
my $sth = $dbh->prepare( $query ); |
1199 |
my $result_set = |
1209 |
$sth->execute( $subscriptionid, $subscriptionid ); |
1200 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $subscriptionid ); |
1210 |
my $order = $sth->fetchrow_hashref; |
1201 |
|
1211 |
return $order; |
1202 |
# result_set assumed to contain 1 match |
|
|
1203 |
return $result_set->[0]; |
1212 |
|
1204 |
|
1213 |
} |
1205 |
} |
1214 |
|
1206 |
|
Lines 1345-1355
sub ModOrder {
Link Here
|
1345 |
} |
1337 |
} |
1346 |
|
1338 |
|
1347 |
$query .= "timestamp=NOW() WHERE ordernumber=?"; |
1339 |
$query .= "timestamp=NOW() WHERE ordernumber=?"; |
1348 |
# push(@params, $specorderinfo{'ordernumber'}); |
|
|
1349 |
push(@params, $orderinfo->{'ordernumber'} ); |
1340 |
push(@params, $orderinfo->{'ordernumber'} ); |
1350 |
$sth = $dbh->prepare($query); |
1341 |
$sth = $dbh->prepare($query); |
1351 |
$sth->execute(@params); |
1342 |
$sth->execute(@params); |
1352 |
$sth->finish; |
1343 |
return; |
1353 |
} |
1344 |
} |
1354 |
|
1345 |
|
1355 |
#------------------------------------------------------------# |
1346 |
#------------------------------------------------------------# |
Lines 1458-1470
sub ModReceiveOrder {
Link Here
|
1458 |
); |
1449 |
); |
1459 |
} |
1450 |
} |
1460 |
|
1451 |
|
1461 |
my $sth=$dbh->prepare(" |
1452 |
my $result_set = $dbh->selectall_arrayref( |
1462 |
SELECT * FROM aqorders |
1453 |
q{SELECT * FROM aqorders WHERE biblionumber=? AND aqorders.ordernumber=?}, |
1463 |
WHERE biblionumber=? AND aqorders.ordernumber=?"); |
1454 |
{ Slice => {} }, $biblionumber, $ordernumber |
|
|
1455 |
); |
1464 |
|
1456 |
|
1465 |
$sth->execute($biblionumber,$ordernumber); |
1457 |
# we assume we have a unique order |
1466 |
my $order = $sth->fetchrow_hashref(); |
1458 |
my $order = $result_set->[0]; |
1467 |
$sth->finish(); |
|
|
1468 |
|
1459 |
|
1469 |
my $new_ordernumber = $ordernumber; |
1460 |
my $new_ordernumber = $ordernumber; |
1470 |
if ( $order->{quantity} > $quantrec ) { |
1461 |
if ( $order->{quantity} > $quantrec ) { |
Lines 1472-1478
sub ModReceiveOrder {
Link Here
|
1472 |
# without received items (the quantity is decreased), |
1463 |
# without received items (the quantity is decreased), |
1473 |
# the second part is a new order line with quantity=quantityrec |
1464 |
# the second part is a new order line with quantity=quantityrec |
1474 |
# (entirely received) |
1465 |
# (entirely received) |
1475 |
$sth=$dbh->prepare(" |
1466 |
my $sth=$dbh->prepare(" |
1476 |
UPDATE aqorders |
1467 |
UPDATE aqorders |
1477 |
SET quantity = ?, |
1468 |
SET quantity = ?, |
1478 |
orderstatus = 'partial' |
1469 |
orderstatus = 'partial' |
Lines 1481-1488
sub ModReceiveOrder {
Link Here
|
1481 |
|
1472 |
|
1482 |
$sth->execute($order->{quantity} - $quantrec, $ordernumber); |
1473 |
$sth->execute($order->{quantity} - $quantrec, $ordernumber); |
1483 |
|
1474 |
|
1484 |
$sth->finish; |
|
|
1485 |
|
1486 |
delete $order->{'ordernumber'}; |
1475 |
delete $order->{'ordernumber'}; |
1487 |
$order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} ); |
1476 |
$order->{'budget_id'} = ( $budget_id || $order->{'budget_id'} ); |
1488 |
$order->{'quantity'} = $quantrec; |
1477 |
$order->{'quantity'} = $quantrec; |
Lines 1502-1513
sub ModReceiveOrder {
Link Here
|
1502 |
} |
1491 |
} |
1503 |
} |
1492 |
} |
1504 |
} else { |
1493 |
} else { |
1505 |
$sth=$dbh->prepare("update aqorders |
1494 |
my $sth=$dbh->prepare("update aqorders |
1506 |
set quantityreceived=?,datereceived=?,invoiceid=?, |
1495 |
set quantityreceived=?,datereceived=?,invoiceid=?, |
1507 |
unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete' |
1496 |
unitprice=?,rrp=?,ecost=?,budget_id=?,orderstatus='complete' |
1508 |
where biblionumber=? and ordernumber=?"); |
1497 |
where biblionumber=? and ordernumber=?"); |
1509 |
$sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$budget_id,$biblionumber,$ordernumber); |
1498 |
$sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$ecost,$budget_id,$biblionumber,$ordernumber); |
1510 |
$sth->finish; |
|
|
1511 |
} |
1499 |
} |
1512 |
return ($datereceived, $new_ordernumber); |
1500 |
return ($datereceived, $new_ordernumber); |
1513 |
} |
1501 |
} |
Lines 1770-1781
sub DelOrder {
Link Here
|
1770 |
"; |
1758 |
"; |
1771 |
my $sth = $dbh->prepare($query); |
1759 |
my $sth = $dbh->prepare($query); |
1772 |
$sth->execute( $bibnum, $ordernumber ); |
1760 |
$sth->execute( $bibnum, $ordernumber ); |
1773 |
$sth->finish; |
|
|
1774 |
my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); |
1761 |
my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); |
1775 |
foreach my $itemnumber (@itemnumbers){ |
1762 |
foreach my $itemnumber (@itemnumbers){ |
1776 |
C4::Items::DelItem( $dbh, $bibnum, $itemnumber ); |
1763 |
C4::Items::DelItem( $dbh, $bibnum, $itemnumber ); |
1777 |
} |
1764 |
} |
1778 |
|
1765 |
return; |
1779 |
} |
1766 |
} |
1780 |
|
1767 |
|
1781 |
=head3 TransferOrder |
1768 |
=head3 TransferOrder |
Lines 1900-1915
sub GetParcel {
Link Here
|
1900 |
} |
1887 |
} |
1901 |
} |
1888 |
} |
1902 |
$strsth .= " ORDER BY aqbasket.basketno"; |
1889 |
$strsth .= " ORDER BY aqbasket.basketno"; |
1903 |
# ## parcelinformation : $strsth |
1890 |
my $result_set = $dbh->selectall_arrayref( |
1904 |
my $sth = $dbh->prepare($strsth); |
1891 |
$strsth, |
1905 |
$sth->execute( @query_params ); |
1892 |
{ Slice => {} }, |
1906 |
while ( my $data = $sth->fetchrow_hashref ) { |
1893 |
@query_params); |
1907 |
push( @results, $data ); |
|
|
1908 |
} |
1909 |
# ## countparcelbiblio: scalar(@results) |
1910 |
$sth->finish; |
1911 |
|
1894 |
|
1912 |
return @results; |
1895 |
return @{$result_set}; |
1913 |
} |
1896 |
} |
1914 |
|
1897 |
|
1915 |
#------------------------------------------------------------# |
1898 |
#------------------------------------------------------------# |
Lines 1997-2004
sub GetParcels {
Link Here
|
1997 |
|
1980 |
|
1998 |
$sth->execute( @query_params ); |
1981 |
$sth->execute( @query_params ); |
1999 |
my $results = $sth->fetchall_arrayref({}); |
1982 |
my $results = $sth->fetchall_arrayref({}); |
2000 |
$sth->finish; |
1983 |
return @{$results}; |
2001 |
return @$results; |
|
|
2002 |
} |
1984 |
} |
2003 |
|
1985 |
|
2004 |
#------------------------------------------------------------# |
1986 |
#------------------------------------------------------------# |
Lines 2402-2415
sub GetContracts {
Link Here
|
2402 |
WHERE booksellerid=? |
2384 |
WHERE booksellerid=? |
2403 |
AND contractenddate >= CURDATE( )"; |
2385 |
AND contractenddate >= CURDATE( )"; |
2404 |
} |
2386 |
} |
2405 |
my $sth = $dbh->prepare($query); |
2387 |
my $result_set = |
2406 |
$sth->execute( $booksellerid ); |
2388 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $booksellerid ); |
2407 |
my @results; |
2389 |
return @{$result_set}; |
2408 |
while (my $data = $sth->fetchrow_hashref ) { |
|
|
2409 |
push(@results, $data); |
2410 |
} |
2411 |
$sth->finish; |
2412 |
return @results; |
2413 |
} |
2390 |
} |
2414 |
|
2391 |
|
2415 |
#------------------------------------------------------------# |
2392 |
#------------------------------------------------------------# |
2416 |
- |
|
|