Lines 71-77
BEGIN {
Link Here
|
71 |
&SearchOrders &GetHistory &GetRecentAcqui |
71 |
&SearchOrders &GetHistory &GetRecentAcqui |
72 |
&ModReceiveOrder &CancelReceipt |
72 |
&ModReceiveOrder &CancelReceipt |
73 |
&TransferOrder |
73 |
&TransferOrder |
74 |
&GetLastOrderNotReceivedFromSubscriptionid &GetLastOrderReceivedFromSubscriptionid |
|
|
75 |
&ModItemOrder |
74 |
&ModItemOrder |
76 |
|
75 |
|
77 |
&GetParcels |
76 |
&GetParcels |
Lines 1248-1304
sub GetOrder {
Link Here
|
1248 |
return $result_set->[0]; |
1247 |
return $result_set->[0]; |
1249 |
} |
1248 |
} |
1250 |
|
1249 |
|
1251 |
=head3 GetLastOrderNotReceivedFromSubscriptionid |
|
|
1252 |
|
1253 |
$order = &GetLastOrderNotReceivedFromSubscriptionid($subscriptionid); |
1254 |
|
1255 |
Returns a reference-to-hash describing the last order not received for a subscription. |
1256 |
|
1257 |
=cut |
1258 |
|
1259 |
sub GetLastOrderNotReceivedFromSubscriptionid { |
1260 |
my ( $subscriptionid ) = @_; |
1261 |
my $dbh = C4::Context->dbh; |
1262 |
my $query = qq| |
1263 |
SELECT * FROM aqorders |
1264 |
LEFT JOIN subscription |
1265 |
ON ( aqorders.subscriptionid = subscription.subscriptionid ) |
1266 |
WHERE aqorders.subscriptionid = ? |
1267 |
AND aqorders.datereceived IS NULL |
1268 |
LIMIT 1 |
1269 |
|; |
1270 |
my $result_set = |
1271 |
$dbh->selectall_arrayref( $query, { Slice => {} }, $subscriptionid ); |
1272 |
|
1273 |
# result_set assumed to contain 1 match |
1274 |
return $result_set->[0]; |
1275 |
} |
1276 |
|
1277 |
=head3 GetLastOrderReceivedFromSubscriptionid |
1278 |
|
1279 |
$order = &GetLastOrderReceivedFromSubscriptionid($subscriptionid); |
1280 |
|
1281 |
Returns a reference-to-hash describing the last order received for a subscription. |
1282 |
|
1283 |
=cut |
1284 |
|
1285 |
sub GetLastOrderReceivedFromSubscriptionid { |
1286 |
my ( $subscriptionid ) = @_; |
1287 |
my $lastOrderReceived = Koha::Acquisition::Orders->search( |
1288 |
{ |
1289 |
subscriptionid => $subscriptionid, |
1290 |
datereceived => { '!=' => undef } |
1291 |
}, |
1292 |
{ |
1293 |
order_by => |
1294 |
[ { -desc => 'datereceived' }, { -desc => 'ordernumber' } ] |
1295 |
} |
1296 |
); |
1297 |
return $lastOrderReceived->count ? $lastOrderReceived->next->unblessed : undef; |
1298 |
} |
1299 |
|
1300 |
#------------------------------------------------------------# |
1301 |
|
1302 |
=head3 ModOrder |
1250 |
=head3 ModOrder |
1303 |
|
1251 |
|
1304 |
&ModOrder(\%hashref); |
1252 |
&ModOrder(\%hashref); |
1305 |
- |
|
|