Tech Blog

Charged Items for Location

  • Author: Ken Herold
  • Additional author(s):
  • Institution:
  • Year: 2008
  • License: BSD style
  • Short description: Use, modification and distribution of the code are permitted provided the copyright notice, list of conditions and disclaimer appear in all related material.
  • Link to terms: Detailed license terms
  • Skill required for using this code:
    Choose one of the following: basic, intermediate, technical. Please also add your choice as a tag at the bottom of the page.

Description

Displays materials currently circulated by a Small Collection (Location)

State

Stable

Screen captures

See working example.

Working example

http://lib.hamilton.edu:3000/arch_demo.php

Installation instructions

See authentication in require statement.

<Code sample>
<?
// This include file contains the logon username, password, and database name
require('../db-include.inc');
 
// Connect to the database by passing logon information
$iDBConn = OCIpLogon(DB_USER, DB_PASS, DB_NAME);
 
// Define your query in SQL
$query = "
    SELECT
           bib_text.bib_id, bib_text.title, bib_text.author,
           item_barcode.item_id, item_barcode.item_barcode,
           bib_item.bib_id, bib_item.item_id,
           circ_transactions.charge_location, circ_transactions.charge_date,
           circ_transactions.item_id, circ_transactions.db_id,
           circ_transactions.current_due_date,
           mfhd_master.display_call_no, mfhd_master.mfhd_id
    FROM bib_text, item_barcode, bib_item, circ_transactions, mfhd_master, mfhd_item
    WHERE bib_text.bib_id = bib_item.bib_id
        AND mfhd_master.mfhd_id = mfhd_item.mfhd_id
        AND mfhd_item.item_id = circ_transactions.item_id
        AND bib_item.item_id = item_barcode.item_id
        AND circ_transactions.item_id = bib_item.item_id
        AND circ_transactions.db_id = '<0 or your value here>'
        AND (mfhd_master.location_id = '<your choice here>'
             OR mfhd_master.location_id = '<your choice here>')
        ORDER BY mfhd_master.display_call_no
        " ;
// Get a statement identifier from the database using OCIParse
$iStatement = @OCIParse($iDBConn, $query);
 
// Verify that the SQL statement is valid
$arrError = OCIError($iStatement);
if ($arrError['code']) {
    print $arrError['message'];
    OCIRollback($iDBConn);
    exit;
}
 
// Run the query on the database
@OCIExecute($iStatement, OCI_DEFAULT);
 
// Display the select statement
 
?>
<?
// Loop through the results
$line=1;
while (OCIFetchInto($iStatement, &$array1, OCI_ASSOC+OCI_RETURN_NULLS)) {
?>
Call No:<font color=blue> <?= $array1['DISPLAY_CALL_NO'] ?></font><br>
Author:         <?= $array1['AUTHOR'] ?><br>
Title:          <?= $array1['TITLE'] ?><br>
Barcode:        <?= $array1['ITEM_BARCODE'] ?><br>
Charge Date:    <?= $array1['CHARGE_DATE'] ?><br>
Current Due Date: <?= $array1['CURRENT_DUE_DATE'] ?><br>
<hr>
<?
$line++;
}
?>
 
</Code sample>

Known issues

MUST select small collection values for location(s) due to length of report and processing time.

Comments

Especially useful for tracking circulation of normally closed stack items.

Leave a Reply