示例#1
0
 /**
  * Renews an item that has been checked out within the ILS.
  *
  * 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>itemBarcode - The barcode of the item to be renewed.</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/UserAPI?method=renewItem&username=23025003575917&password=7604&itemBarcode=33025021368319
  * </code>
  *
  * Sample Response (failed renewal):
  * <code>
  * {"result":{
  *   "success":true,
  *   "renewalMessage":{
  *     "itemId":"33025021368319",
  *     "result":false,
  *     "message":"This item may not be renewed - Item has been requested."
  *   }
  * }}
  * </code>
  *
  * Sample Response (successful renewal):
  * <code>
  * {"result":{
  *   "success":true,
  *   "renewalMessage":{
  *     "itemId":"33025021723869",
  *     "result":true,
  *     "message":"#Renewal successful."
  *   }
  * }}
  * </code>
  *
  * @author Mark Noble <*****@*****.**>
  */
 function renewItem()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     $itemBarcode = $_REQUEST['itemBarcode'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $renewalMessage = $this->catalog->renewItem($user->cat_username, $itemBarcode);
         return array('success' => true, 'renewalMessage' => $renewalMessage);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }