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