Beispiel #1
0
/**
 * Slot.Delete API
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_sub_slot_delete($params)
{
    if (CRM_Booking_BAO_SubSlot::del($params['id'])) {
        return civicrm_api3_create_success($params, $params, 'SubSlot', 'delete');
    } else {
        return civicrm_api3_create_error('Could not delete SubSlot.');
    }
}
Beispiel #2
0
 /**
  * Function to delete Slot
  *
  * @param  int  $id     Id of the Slot to be deleted.
  *
  * @return boolean
  *
  * @access public
  * @static
  */
 static function del($id)
 {
     //make sure sub slots get deleted as well
     $subSlots = CRM_Booking_BAO_SubSlot::getSubSlotSlot($id);
     foreach ($subSlots as $subSlotId => $subSlots) {
         CRM_Booking_BAO_SubSlot::del($subSlotId);
     }
     $dao = new CRM_Booking_DAO_Slot();
     $dao->id = $id;
     $dao->is_deleted = 1;
     return $dao->save();
 }
Beispiel #3
0
 /**
  * Function to delete Booking
  *
  * @param  int  $id     Id of the Resource to be deleted.
  *
  * @return boolean
  *
  * @access public
  * @static
  */
 static function del($id)
 {
     $transaction = new CRM_Core_Transaction();
     try {
         $slots = CRM_Booking_BAO_Slot::getBookingSlot($id);
         foreach ($slots as $slotId => $slots) {
             $subSlots = CRM_Booking_BAO_SubSlot::getSubSlotSlot($slotId);
             foreach ($subSlots as $subSlotId => $subSlot) {
                 CRM_Booking_BAO_SubSlot::del($subSlotId);
             }
             CRM_Booking_BAO_Slot::del($slotId);
         }
         $dao = new CRM_Booking_DAO_Booking();
         $dao->id = $id;
         $dao->is_deleted = 1;
         return $dao->save();
     } catch (Exception $e) {
         $transaction->rollback();
         CRM_Core_Error::fatal($e->getMessage());
     }
 }