| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.7 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2016 | |
| 7 | +--------------------------------------------------------------------+ |
| 8 | | This file is a part of CiviCRM. | |
| 9 | | | |
| 10 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 11 | | under the terms of the GNU Affero General Public License | |
| 12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 13 | | | |
| 14 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 17 | | See the GNU Affero General Public License for more details. | |
| 18 | | | |
| 19 | | You should have received a copy of the GNU Affero General Public | |
| 20 | | License and the CiviCRM Licensing Exception along | |
| 21 | | with this program; if not, contact CiviCRM LLC | |
| 22 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 23 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 25 | +--------------------------------------------------------------------+ |
| 26 | */ |
| 27 | /** |
| 28 | * @package CRM |
| 29 | * @copyright CiviCRM LLC (c) 2004-2016 |
| 30 | * |
| 31 | * Generated from xml/schema/CRM/Member/MembershipLog.xml |
| 32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 33 | * (GenCodeChecksum:0c51f7b8ad368df053d1345e0a20d33a) |
| 34 | */ |
| 35 | require_once 'CRM/Core/DAO.php'; |
| 36 | require_once 'CRM/Utils/Type.php'; |
| 37 | class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO { |
| 38 | /** |
| 39 | * static instance to hold the table name |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | static $_tableName = 'civicrm_membership_log'; |
| 44 | /** |
| 45 | * static instance to hold the field values |
| 46 | * |
| 47 | * @var array |
| 48 | */ |
| 49 | static $_fields = null; |
| 50 | /** |
| 51 | * static instance to hold the keys used in $_fields for each field. |
| 52 | * |
| 53 | * @var array |
| 54 | */ |
| 55 | static $_fieldKeys = null; |
| 56 | /** |
| 57 | * static instance to hold the FK relationships |
| 58 | * |
| 59 | * @var string |
| 60 | */ |
| 61 | static $_links = null; |
| 62 | /** |
| 63 | * static instance to hold the values that can |
| 64 | * be imported |
| 65 | * |
| 66 | * @var array |
| 67 | */ |
| 68 | static $_import = null; |
| 69 | /** |
| 70 | * static instance to hold the values that can |
| 71 | * be exported |
| 72 | * |
| 73 | * @var array |
| 74 | */ |
| 75 | static $_export = null; |
| 76 | /** |
| 77 | * static value to see if we should log any modifications to |
| 78 | * this table in the civicrm_log table |
| 79 | * |
| 80 | * @var boolean |
| 81 | */ |
| 82 | static $_log = true; |
| 83 | /** |
| 84 | * |
| 85 | * @var int unsigned |
| 86 | */ |
| 87 | public $id; |
| 88 | /** |
| 89 | * FK to Membership table |
| 90 | * |
| 91 | * @var int unsigned |
| 92 | */ |
| 93 | public $membership_id; |
| 94 | /** |
| 95 | * New status assigned to membership by this action. FK to Membership Status |
| 96 | * |
| 97 | * @var int unsigned |
| 98 | */ |
| 99 | public $status_id; |
| 100 | /** |
| 101 | * New membership period start date |
| 102 | * |
| 103 | * @var date |
| 104 | */ |
| 105 | public $start_date; |
| 106 | /** |
| 107 | * New membership period expiration date. |
| 108 | * |
| 109 | * @var date |
| 110 | */ |
| 111 | public $end_date; |
| 112 | /** |
| 113 | * FK to Contact ID of person under whose credentials this data modification was made. |
| 114 | * |
| 115 | * @var int unsigned |
| 116 | */ |
| 117 | public $modified_id; |
| 118 | /** |
| 119 | * Date this membership modification action was logged. |
| 120 | * |
| 121 | * @var date |
| 122 | */ |
| 123 | public $modified_date; |
| 124 | /** |
| 125 | * FK to Membership Type. |
| 126 | * |
| 127 | * @var int unsigned |
| 128 | */ |
| 129 | public $membership_type_id; |
| 130 | /** |
| 131 | * Maximum number of related memberships. |
| 132 | * |
| 133 | * @var int |
| 134 | */ |
| 135 | public $max_related; |
| 136 | /** |
| 137 | * class constructor |
| 138 | * |
| 139 | * @return civicrm_membership_log |
| 140 | */ |
| 141 | function __construct() { |
| 142 | $this->__table = 'civicrm_membership_log'; |
| 143 | parent::__construct(); |
| 144 | } |
| 145 | /** |
| 146 | * Returns foreign keys and entity references |
| 147 | * |
| 148 | * @return array |
| 149 | * [CRM_Core_Reference_Interface] |
| 150 | */ |
| 151 | static function getReferenceColumns() { |
| 152 | if (!self::$_links) { |
| 153 | self::$_links = static ::createReferenceColumns(__CLASS__); |
| 154 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_id', 'civicrm_membership', 'id'); |
| 155 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_membership_status', 'id'); |
| 156 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); |
| 157 | self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); |
| 158 | } |
| 159 | return self::$_links; |
| 160 | } |
| 161 | /** |
| 162 | * Returns all the column names of this table |
| 163 | * |
| 164 | * @return array |
| 165 | */ |
| 166 | static function &fields() { |
| 167 | if (!(self::$_fields)) { |
| 168 | self::$_fields = array( |
| 169 | 'id' => array( |
| 170 | 'name' => 'id', |
| 171 | 'type' => CRM_Utils_Type::T_INT, |
| 172 | 'title' => ts('Membership Log ID') , |
| 173 | 'required' => true, |
| 174 | ) , |
| 175 | 'membership_id' => array( |
| 176 | 'name' => 'membership_id', |
| 177 | 'type' => CRM_Utils_Type::T_INT, |
| 178 | 'title' => ts('Membership ID') , |
| 179 | 'description' => 'FK to Membership table', |
| 180 | 'required' => true, |
| 181 | 'FKClassName' => 'CRM_Member_DAO_Membership', |
| 182 | ) , |
| 183 | 'status_id' => array( |
| 184 | 'name' => 'status_id', |
| 185 | 'type' => CRM_Utils_Type::T_INT, |
| 186 | 'title' => ts('Membership Status') , |
| 187 | 'description' => 'New status assigned to membership by this action. FK to Membership Status', |
| 188 | 'required' => true, |
| 189 | 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', |
| 190 | ) , |
| 191 | 'start_date' => array( |
| 192 | 'name' => 'start_date', |
| 193 | 'type' => CRM_Utils_Type::T_DATE, |
| 194 | 'title' => ts('Membership Log Start Date') , |
| 195 | 'description' => 'New membership period start date', |
| 196 | ) , |
| 197 | 'end_date' => array( |
| 198 | 'name' => 'end_date', |
| 199 | 'type' => CRM_Utils_Type::T_DATE, |
| 200 | 'title' => ts('Membership Log End Date') , |
| 201 | 'description' => 'New membership period expiration date.', |
| 202 | ) , |
| 203 | 'modified_id' => array( |
| 204 | 'name' => 'modified_id', |
| 205 | 'type' => CRM_Utils_Type::T_INT, |
| 206 | 'title' => ts('Membership Log modified By') , |
| 207 | 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', |
| 208 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 209 | ) , |
| 210 | 'modified_date' => array( |
| 211 | 'name' => 'modified_date', |
| 212 | 'type' => CRM_Utils_Type::T_DATE, |
| 213 | 'title' => ts('Membership Change Date') , |
| 214 | 'description' => 'Date this membership modification action was logged.', |
| 215 | ) , |
| 216 | 'membership_type_id' => array( |
| 217 | 'name' => 'membership_type_id', |
| 218 | 'type' => CRM_Utils_Type::T_INT, |
| 219 | 'title' => ts('Membership Type ID') , |
| 220 | 'description' => 'FK to Membership Type.', |
| 221 | 'FKClassName' => 'CRM_Member_DAO_MembershipType', |
| 222 | ) , |
| 223 | 'max_related' => array( |
| 224 | 'name' => 'max_related', |
| 225 | 'type' => CRM_Utils_Type::T_INT, |
| 226 | 'title' => ts('Maximum Related Memberships') , |
| 227 | 'description' => 'Maximum number of related memberships.', |
| 228 | ) , |
| 229 | ); |
| 230 | } |
| 231 | return self::$_fields; |
| 232 | } |
| 233 | /** |
| 234 | * Returns an array containing, for each field, the arary key used for that |
| 235 | * field in self::$_fields. |
| 236 | * |
| 237 | * @return array |
| 238 | */ |
| 239 | static function &fieldKeys() { |
| 240 | if (!(self::$_fieldKeys)) { |
| 241 | self::$_fieldKeys = array( |
| 242 | 'id' => 'id', |
| 243 | 'membership_id' => 'membership_id', |
| 244 | 'status_id' => 'status_id', |
| 245 | 'start_date' => 'start_date', |
| 246 | 'end_date' => 'end_date', |
| 247 | 'modified_id' => 'modified_id', |
| 248 | 'modified_date' => 'modified_date', |
| 249 | 'membership_type_id' => 'membership_type_id', |
| 250 | 'max_related' => 'max_related', |
| 251 | ); |
| 252 | } |
| 253 | return self::$_fieldKeys; |
| 254 | } |
| 255 | /** |
| 256 | * Returns the names of this table |
| 257 | * |
| 258 | * @return string |
| 259 | */ |
| 260 | static function getTableName() { |
| 261 | return self::$_tableName; |
| 262 | } |
| 263 | /** |
| 264 | * Returns if this table needs to be logged |
| 265 | * |
| 266 | * @return boolean |
| 267 | */ |
| 268 | function getLog() { |
| 269 | return self::$_log; |
| 270 | } |
| 271 | /** |
| 272 | * Returns the list of fields that can be imported |
| 273 | * |
| 274 | * @param bool $prefix |
| 275 | * |
| 276 | * @return array |
| 277 | */ |
| 278 | static function &import($prefix = false) { |
| 279 | if (!(self::$_import)) { |
| 280 | self::$_import = array(); |
| 281 | $fields = self::fields(); |
| 282 | foreach($fields as $name => $field) { |
| 283 | if (CRM_Utils_Array::value('import', $field)) { |
| 284 | if ($prefix) { |
| 285 | self::$_import['membership_log'] = & $fields[$name]; |
| 286 | } else { |
| 287 | self::$_import[$name] = & $fields[$name]; |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | return self::$_import; |
| 293 | } |
| 294 | /** |
| 295 | * Returns the list of fields that can be exported |
| 296 | * |
| 297 | * @param bool $prefix |
| 298 | * |
| 299 | * @return array |
| 300 | */ |
| 301 | static function &export($prefix = false) { |
| 302 | if (!(self::$_export)) { |
| 303 | self::$_export = array(); |
| 304 | $fields = self::fields(); |
| 305 | foreach($fields as $name => $field) { |
| 306 | if (CRM_Utils_Array::value('export', $field)) { |
| 307 | if ($prefix) { |
| 308 | self::$_export['membership_log'] = & $fields[$name]; |
| 309 | } else { |
| 310 | self::$_export[$name] = & $fields[$name]; |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | return self::$_export; |
| 316 | } |
| 317 | } |