Skip to content

Commit

Permalink
Nashville: Adds item-level holds to Holds Report
Browse files Browse the repository at this point in the history
  • Loading branch information
NashvillePublicLibrary committed Jul 11, 2024
1 parent b2588bd commit 6c040ab
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 13 deletions.
68 changes: 55 additions & 13 deletions code/web/Drivers/Nashville.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ public function getCollectionReportData($location, $date): array {
public function getHoldsReportData($location): array {
$this->initDatabaseConnection();
$sql = <<<EOT
-- getHoldsReportData, combining bib level and item level holds 2024 07 09
with holds_vs_items as (
select
t.bid
Expand All @@ -485,7 +486,7 @@ public function getHoldsReportData($location): array {
left join patron_v2 p on t.patronid = p.patronid
left join bbibmap_v2 b on t.bid = b.bid
left join bty_v2 bb on p.bty = bb.btynumber
left join branch_v2 ob on t.holdingbranch = ob.branchnumber -- Origin Branch
left join branch_v2 ob on t.holdingbranch = ob.branchnumber -- Origin/Owning Branch
left join item_v2 i on ( t.bid = i.bid and t.holdingbranch = i.branch)
left join location_v2 l on i.location = l.locnumber
left join branch_v2 pb on t.pickupbranch = pb.branchnumber -- Pickup Branch
Expand All @@ -507,18 +508,59 @@ public function getHoldsReportData($location): array {
, h.CALL_NUMBER
, h.TITLE
, h.occur_dense_rank
)
select
PATRON_NAME
, PICKUP_BRANCH
, HOME_ROOM
, GRD_LVL
, P_BARCODE
, SHELF_LOCATION
, TITLE
, CALL_NUMBER
, ITEM_ID
from fillable
),
bib_level_holds as (
select
PATRON_NAME
, PICKUP_BRANCH
, HOME_ROOM
, GRD_LVL
, P_BARCODE
, SHELF_LOCATION
, TITLE
, CALL_NUMBER
, ITEM_ID
from fillable
),
item_level_holds as (
select
pb.branchname as PICKUP_BRANCH
, p.name as PATRON_NAME
, p.sponsor as HOME_ROOM
, bb.btyname as GRD_LVL
, p.patronid as P_BARCODE
, l.locname as SHELF_LOCATION
, b.title as TITLE
, i.cn as CALL_NUMBER
, i.item as ITEM_ID
from transitem_v2 t
left join item_v2 i on t.item = i.item
left join patron_v2 p on t.patronid = p.patronid
left join bbibmap_v2 b on i.bid = b.bid
left join bty_v2 bb on p.bty = bb.btynumber
left join branch_v2 ob on t.holdingbranch = ob.branchnumber -- Origin Branch
left join location_v2 l on i.location = l.locnumber
left join branch_v2 pb on t.pickupbranch = pb.branchnumber -- Pickup Branch
where ob.branchcode = '$location'
and t.transcode = 'R*'
order by
i.bid
)
, holds as (
select
bib_level_holds.*
from bib_level_holds
union
select
item_level_holds.*
from item_level_holds
)
select * from holds
order by
SHELF_LOCATION
, CALL_NUMBER
, TITLE
;
EOT;
$stid = oci_parse($this->dbConnection, $sql);
// consider using oci_set_prefetch to improve performance
Expand Down
2 changes: 2 additions & 0 deletions code/web/release_notes/24.08.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
// lucas

// James Staub
### Reports
- Nashville-specific: Circulation Holds Report now includes item-level holds (*JStaub*)

// other

Expand Down

0 comments on commit 6c040ab

Please sign in to comment.