Beispiel #1
0
 /**
  * Activates a hold that was previously suspended within the ILS.  Only unavailable holds can be activated.
  * Note:  Horizon implements suspending and activating holds as a toggle.  If a hold is suspended, it will be activated
  * and if a hold is active it will be suspended.  Care should be taken when calling the method with holds that are in the wrong state.
  *
  * 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>waitingholdselected[] - an array of holds that are not ready for pickup that should be frozen. Each item should be specified as <bibId>:0.</li>
  * </ul>
  *
  * Returns:
  * <ul>
  * <li>success � true if the account is valid and the hold could be activated, false if the username or password were incorrect or the hold could not be activated.</li>
  * <li>holdMessage � a reason why the method failed if success is false</li>
  * </ul>
  *
  * Sample Call:
  * <code>
  * http://catalog.douglascountylibraries.org/API/UserAPI?method=activateHold&username=23025003575917&password=1234&waitingholdselected[]=1004012:0
  * </code>
  *
  * Sample Response:
  * <code>
  * {"result":{
  *   "success":true,
  *   "holdMessage":"Your hold was updated successfully."
  * }}
  * </code>
  *
  * @author Mark Noble <*****@*****.**>
  */
 function activateHold()
 {
     $username = $_REQUEST['username'];
     $password = $_REQUEST['password'];
     global $user;
     $user = UserAccount::validateAccount($username, $password);
     if ($user && !PEAR_Singleton::isError($user)) {
         $holdMessage = $this->catalog->updateHoldDetailed('', $user->cat_username, 'update', '', null, null, 'off');
         return array('success' => $holdMessage['result'], 'holdMessage' => $holdMessage['message']);
     } else {
         return array('success' => false, 'message' => 'Login unsuccessful');
     }
 }