/** * Delete the records that are associated with this participation. * * @param int $id * Id of the participation to delete. * * @return \CRM_Event_DAO_Participant */ public static function deleteParticipant($id) { CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray); $transaction = new CRM_Core_Transaction(); //delete activity record $params = array('source_record_id' => $id, 'activity_type_id' => 5); CRM_Activity_BAO_Activity::deleteActivity($params); // delete the participant payment record // we need to do this since the cascaded constraints // dont work with join tables $p = array('participant_id' => $id); CRM_Event_BAO_ParticipantPayment::deleteParticipantPayment($p); // cleanup line items. $participantsId = array(); $participantsId = self::getAdditionalParticipantIds($id); $participantsId[] = $id; CRM_Price_BAO_LineItem::deleteLineItems($participantsId, 'civicrm_participant'); //delete note when participant deleted. $note = CRM_Core_BAO_Note::getNote($id, 'civicrm_participant'); $noteId = key($note); if ($noteId) { CRM_Core_BAO_Note::del($noteId, FALSE); } $participant = new CRM_Event_DAO_Participant(); $participant->id = $id; $participant->delete(); $transaction->commit(); CRM_Utils_Hook::post('delete', 'Participant', $participant->id, $participant); // delete the recently created Participant $participantRecent = array('id' => $id, 'type' => 'Participant'); CRM_Utils_Recent::del($participantRecent); return $participant; }
/** * Deletes an existing note * * This API is used for deleting a note * * @params array $paramsarray including id of the note to be deleted * {@getfields note_delete} * * @return null * @access public */ function civicrm_api3_note_delete($params) { $result = new CRM_Core_BAO_Note(); return $result->del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error('Error while deleting Note'); }
/** * Delete the indirect records associated with this contribution first. * * @param int $id * * @return mixed|null * $results no of deleted Contribution on success, false otherwise */ public static function deleteContribution($id) { CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray); $transaction = new CRM_Core_Transaction(); $results = NULL; //delete activity record $params = array('source_record_id' => $id, 'activity_type_id' => 6); CRM_Activity_BAO_Activity::deleteActivity($params); //delete billing address if exists for this contribution. self::deleteAddress($id); //update pledge and pledge payment, CRM-3961 CRM_Pledge_BAO_PledgePayment::resetPledgePayment($id); // remove entry from civicrm_price_set_entity, CRM-5095 if (CRM_Price_BAO_PriceSet::getFor('civicrm_contribution', $id)) { CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution', $id); } // cleanup line items. $participantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $id, 'participant_id', 'contribution_id'); // delete any related entity_financial_trxn, financial_trxn and financial_item records. CRM_Core_BAO_FinancialTrxn::deleteFinancialTrxn($id); if ($participantId) { CRM_Price_BAO_LineItem::deleteLineItems($participantId, 'civicrm_participant'); } else { CRM_Price_BAO_LineItem::deleteLineItems($id, 'civicrm_contribution'); } //delete note. $note = CRM_Core_BAO_Note::getNote($id, 'civicrm_contribution'); $noteId = key($note); if ($noteId) { CRM_Core_BAO_Note::del($noteId, FALSE); } $dao = new CRM_Contribute_DAO_Contribution(); $dao->id = $id; $results = $dao->delete(); $transaction->commit(); CRM_Utils_Hook::post('delete', 'Contribution', $dao->id, $dao); // delete the recently created Contribution $contributionRecent = array('id' => $id, 'type' => 'Contribution'); CRM_Utils_Recent::del($contributionRecent); return $results; }
/** * * @access public * @return None */ public function postProcess() { // store the submitted values in an array $params = $this->exportValues(); $session =& CRM_Core_Session::singleton(); $params['contact_id'] = $session->get('userID'); $params['entity_table'] = $this->_entityTable; $params['entity_id'] = $this->_entityId; if ($this->_action & CRM_Core_Action::DELETE) { CRM_Core_BAO_Note::del($this->_id); return; } if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; } $ids = array(); require_once 'CRM/Core/BAO/Note.php'; CRM_Core_BAO_Note::add($params, $ids); CRM_Core_Session::setStatus(ts('Your Note has been saved.')); }
/** * delete the note object from the db * * @return void * @access public */ function delete() { CRM_Core_BAO_Note::del($this->_id); }
/** * * @access public * * @return void */ public function postProcess() { // store the submitted values in an array $params = $this->controller->exportValues($this->_name); $session = CRM_Core_Session::singleton(); $params['contact_id'] = $session->get('userID'); if ($params['parent_id']) { $params['entity_table'] = 'civicrm_note'; $params['entity_id'] = $params['parent_id']; } else { $params['entity_table'] = $this->_entityTable; $params['entity_id'] = $this->_entityId; } if ($this->_action & CRM_Core_Action::DELETE) { CRM_Core_BAO_Note::del($this->_id); return; } $params['id'] = null; if ($this->_action & CRM_Core_Action::UPDATE) { $params['id'] = $this->_id; } // add attachments as needed CRM_Core_BAO_File::formatAttachment($params, $params, 'civicrm_note', $params['id']); $ids = array(); $note = CRM_Core_BAO_Note::add($params, $ids); CRM_Core_Session::setStatus(ts('Your Note has been saved.'), ts('Saved'), 'success'); }
/** * * @access public * @return None */ function postProcess() { $session =& CRM_Core_Session::singleton(); // store the submitted values in an array $params = $this->exportValues(); // action is taken depending upon the mode $note =& new CRM_Core_DAO_Note(); $note->note = $params['note']; $note->contact_id = $session->get('userID'); if (!$note->contact_id) { CRM_Utils_System::statusBounce(ts('We could not find your logged in user ID')); } $note->modified_date = date("Ymd"); if ($this->_action & CRM_CORE_ACTION_DELETE) { CRM_Core_BAO_Note::del($this->_id); //CRM_Core_Session::setStatus( ts('Selected Note has been Deleted Successfuly.') ); return; } if ($this->_action & CRM_CORE_ACTION_UPDATE) { $note->id = $this->_id; } else { $note->entity_table = $this->_entityTable; $note->entity_id = $this->_entityId; } $note->save(); CRM_Core_Session::setStatus(ts('Your Note has been saved.')); }
/** * Deletes an existing note * * This API is used for deleting a note * * @param Int $noteID Id of the note to be deleted * * @return null * @access public */ function civicrm_note_delete(&$params) { _civicrm_initialize(); if (!is_array($params)) { $error = civicrm_create_error('Params is not an array'); return $error; } if (!CRM_Utils_Array::value('id', $params)) { $error = civicrm_create_error('Invalid or no value for Note ID'); return $error; } $result = new CRM_Core_BAO_Note(); return $result->del($params['id']) ? civicrm_create_success() : civicrm_create_error('Error while deleting Note'); }