[Koha-patches] [PATCH] Cleanup, pod fix and FIXME's added.
Joe Atzberger
joe.atzberger at liblime.com
Fri Jan 23 18:57:58 CET 2009
---
misc/cronjobs/holds/build_holds_queue.pl | 65 +++++++++++++++--------------
1 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/misc/cronjobs/holds/build_holds_queue.pl b/misc/cronjobs/holds/build_holds_queue.pl
index e9054da..f00b364 100755
--- a/misc/cronjobs/holds/build_holds_queue.pl
+++ b/misc/cronjobs/holds/build_holds_queue.pl
@@ -3,6 +3,9 @@
# Script Name: build_holds_queue.pl
# Description: builds a holds queue in the tmp_holdsqueue table
#-----------------------------------
+# FIXME: add command-line options for verbosity and summary
+# FIXME: expand perldoc, explain intended logic
+# FIXME: refactor all subroutines into C4 for testability
use strict;
use warnings;
@@ -29,33 +32,33 @@ my $dbh = C4::Context->dbh;
$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info
$dbh->do("DELETE FROM hold_fill_targets");
-my $total_bibs = 0;
-my $total_requests = 0;
+my $total_bibs = 0;
+my $total_requests = 0;
my $total_available_items = 0;
-my $num_items_mapped = 0;
+my $num_items_mapped = 0;
my @branches_to_use = _get_branches_to_pull_from();
foreach my $biblionumber (@$bibs_with_pending_requests) {
$total_bibs++;
- my $hold_requests = GetPendingHoldRequestsForBib($biblionumber);
- $total_requests += scalar(@$hold_requests);
+ my $hold_requests = GetPendingHoldRequestsForBib($biblionumber);
my $available_items = GetItemsAvailableToFillHoldRequestsForBib($biblionumber, @branches_to_use);
+ $total_requests += scalar(@$hold_requests);
$total_available_items += scalar(@$available_items);
my $item_map = MapItemsToHoldRequests($hold_requests, $available_items, @branches_to_use);
- if (defined($item_map)) {
- $num_items_mapped += scalar(keys %$item_map);
- CreatePicklistFromItemMap($item_map);
- AddToHoldTargetMap($item_map);
- if ((scalar(keys %$item_map) < scalar(@$hold_requests)) and
- (scalar(keys %$item_map) < scalar(@$available_items))) {
- # DOUBLE CHECK, but this is probably OK - unfilled item-level requests
- # FIXME
- #warn "unfilled requests for $biblionumber";
- #warn Dumper($hold_requests);
- #warn Dumper($available_items);
- #warn Dumper($item_map);
- }
+
+ (defined($item_map)) or next;
+
+ my $item_map_size = scalar(keys %$item_map);
+ $num_items_mapped += $item_map_size;
+ CreatePicklistFromItemMap($item_map);
+ AddToHoldTargetMap($item_map);
+ if (($item_map_size < scalar(@$hold_requests )) and
+ ($item_map_size < scalar(@$available_items))) {
+ # DOUBLE CHECK, but this is probably OK - unfilled item-level requests
+ # FIXME
+ #warn "unfilled requests for $biblionumber";
+ #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map);
}
}
@@ -101,13 +104,13 @@ Returns an arrayref of hashrefs to pending, unfilled hold requests
on the bib identified by $biblionumber. The following keys
are present in each hashref:
-biblionumber
-borrowernumber
-itemnumber
-priority
-branchcode
-reservedate
-reservenotes
+ biblionumber
+ borrowernumber
+ itemnumber
+ priority
+ branchcode
+ reservedate
+ reservenotes
The arrayref is sorted in order of increasing priority.
@@ -144,12 +147,12 @@ Returns an arrayref of items available to fill hold requests
for the bib identified by C<$biblionumber>. An item is available
to fill a hold request if and only if:
-* it is not on loan
-* it is not withdrawn
-* it is not marked notforloan
-* it is not currently in transit
-* it is not lost
-* it is not sitting on the hold shelf
+ * it is not on loan
+ * it is not withdrawn
+ * it is not marked notforloan
+ * it is not currently in transit
+ * it is not lost
+ * it is not sitting on the hold shelf
=cut
--
1.5.5.GIT
More information about the Koha-patches
mailing list