Esempio n. 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_slot_delete($params)
{
    if (CRM_Booking_BAO_Slot::del($params['id'])) {
        return civicrm_api3_create_success($params, $params, 'slot', 'delete');
    } else {
        return civicrm_api3_create_error('Could not delete slot.');
    }
}
Esempio n. 2
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());
     }
 }