Ejemplo n.º 1
0
 public function reactivateHold($id)
 {
     global $user;
     //Check to see if there is an existing hold for the record
     $record = new EContentRecord();
     $record->id = $id;
     if ($record->find(true)) {
         $title = $record->title;
         $hold = new EContentHold();
         $hold->recordId = $id;
         $hold->userId = $user->id;
         $hold->status = 'suspended';
         $hold->find();
         if ($hold->N > 0) {
             $hold->fetch();
             $hold->status = 'active';
             $hold->dateUpdated = time();
             $ret = $hold->update();
             if ($ret == 1) {
                 $this->processHoldQueue($id);
                 return array('title' => $title, 'result' => true, 'message' => 'Your hold was activated successfully.');
             } else {
                 return array('title' => $title, 'result' => true, 'message' => 'Unable to activate your hold.');
             }
         } else {
             return array('title' => $title, 'result' => true, 'message' => 'Sorry, but we could not find a hold for you for that title.');
         }
     } else {
         return array('title' => '', 'result' => false, 'message' => 'Could not find a record with that title.');
     }
 }