Beispiel #1
0
 /**
  * Get fines from the ILS for a user based on username and password.
  *
  * Parameters:
  * <ul>
  * <li>username - The barcode of the user.  Can be truncated to the last 7 or 9 digits.</li>
  * <li>password - The pin number for the user.</li>
  * <li>includeMessages - Whether or not messages to the user should be included within list of fines. (optional, defaults to false)</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/UserAPI?method=getPatronFines&username=23025003575917&password=7604
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{
  *   "success":true,
  *   "fines":[
  *     {"reason":"Privacy - Family permission",
  *      "amount":"$0.00",
  *      "message":"",
  *      "date":"09\/27\/2005"
  *     },
  *     {"reason":"Charges Misc. Fees",
  *      "amount":"$5.00",
  *      "message":"",
  *      "date":"04\/14\/2011"
  *     }
  *   ]
  * }}
  * </code>
  *
  * @author Mark Noble <*****@*****.**>
  */
 function getPatronFines()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     global $user;
     $includeMessages = isset($_REQUEST['includeMessages']) ? $_REQUEST['includeMessages'] : false;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $fines = $this->catalog->getMyFines($user, $includeMessages);
         return array('success' => true, 'fines' => $fines);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }