CRM-7964 add BAO classes so that eval removals can call BAO not DAO
authoreileen <eileen@fuzion.co.nz>
Mon, 13 May 2013 23:44:12 +0000 (11:44 +1200)
committereileen <eileen@fuzion.co.nz>
Mon, 13 May 2013 23:50:10 +0000 (11:50 +1200)
CRM/Member/BAO/MembershipBlock.php
CRM/Member/BAO/MembershipPayment.php [new file with mode: 0644]

index a57d521adbabc551e2fbb4f37d5ed26ea2499b45..f66bf780c1b23790a3c5cb306652cf0ec520aba2 100644 (file)
  *
  */
 class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock {
-  // placeholder required because there's some magic code which assumes that BAOs exist
-}
\ No newline at end of file
+  /**
+   * class constructor
+   */
+  function __construct() {
+    parent::__construct();
+  }
+  /**
+   * function to add the membership Blocks
+   *
+   * @param array $params reference array contains the values submitted by the form
+   *
+   * @access public
+   * @static
+   *
+   * @return object
+   */
+  static function create(&$params) {
+    $hook = empty($params['id']) ? 'create' : 'edit';
+    CRM_Utils_Hook::pre($hook, 'MembershipBlock', CRM_Utils_Array::value('id', $params), $params);
+    $dao = new CRM_Member_DAO_MembershipBlock();
+    $dao->copyValues($params);
+    $dao->id = CRM_Utils_Array::value('id', $params);
+    CRM_Utils_Hook::post($hook, 'MembershipBlock', $dao->id, $dao);
+    return $dao;
+  }
+
+  /**
+   * Function to delete membership Blocks
+   *
+   * @param int $id
+   * @static
+   */
+  static function del($id) {
+    $dao = new CRM_Member_DAO_MembershipType();
+    $dao->id = $id;
+    $result = FALSE;
+    if ($dao->find(TRUE)) {
+      $dao->delete();
+      $result = TRUE;
+    }
+    return $result;
+  }
+
+}
diff --git a/CRM/Member/BAO/MembershipPayment.php b/CRM/Member/BAO/MembershipPayment.php
new file mode 100644 (file)
index 0000000..521066d
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.3                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2013
+ * $Id$
+ *
+ */
+class CRM_Member_BAO_MembershipPayment extends CRM_Member_DAO_MembershipPayment {
+
+
+  /**
+   * class constructor
+   */
+  function __construct() {
+    parent::__construct();
+  }
+  /**
+   * function to add the membership Payments
+   *
+   * @param array $params reference array contains the values submitted by the form
+   *
+   * @access public
+   * @static
+   *
+   * @return object
+   */
+  static function create(&$params) {
+    $hook = empty($params['id']) ? 'create' : 'edit';
+    CRM_Utils_Hook::pre($hook, 'MembershipPayment', CRM_Utils_Array::value('id', $params), $params);
+    $dao = new CRM_Member_DAO_MembershipPayment();
+    $dao->copyValues($params);
+    $dao->id = CRM_Utils_Array::value('id', $params);
+    CRM_Utils_Hook::post($hook, 'MembershipPayment', $dao->id, $dao);
+    return $dao;
+  }
+
+  /**
+   * Function to delete membership Payments
+   *
+   * @param int $id
+   * @static
+   */
+  static function del($id) {
+    $dao = new CRM_Member_DAO_MembershipPayment();
+    $dao->id = $id;
+    $result = FALSE;
+    if ($dao->find(TRUE)) {
+      $dao->delete();
+      $result = TRUE;
+    }
+    return $result;
+  }
+
+
+}
+