Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # ---------------------------------------------------------------
- # Copyright (C) 2017 C/W MARS, INC.
- # Jason Stephenson <jstephenson@cwmars.org>
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- # ---------------------------------------------------------------
- # edit me for your environment:
- include "/home/opensrf/PHPSIP2/sip2client.class.php";
- $sip_params = parse_ini_file("sip.ini");
- $db_params = parse_ini_file("db.ini");
- $client = new SIP2Client();
- $client->recvTimeO = 60;
- $client->doChecksum = false;
- $query = <<<EOQ
- select card.barcode
- from actor.card
- join actor.usr on usr.card = card.id
- and not usr.deleted
- join money.open_usr_summary
- on usr.id = open_usr_summary.usr
- and open_usr_summary.balance_owed > 0
- EOQ;
- $dsn = "pgsql:host=$db_params[host];port=$db_params[port];dbname=$db_params[database]";
- $dbh = new PDO($dsn, $db_params['user'], $db_params['password']);
- if ($client->connect($sip_params['host'], $sip_params['port'], $sip_params['user'], $sip_params['password'])) {
- foreach ($dbh->query($query) as $row) {
- $info = $client->patronInformation($row['barcode']);
- $fines = intval($info['FineItems']);
- if ($fines > 0) {
- $info = $client->patronInformation($row['barcode'], null, 'Fine', 1, $fines);
- var_dump($info);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement