CRM-20312 regenerated DAO with localisation
[civicrm-core.git] / CRM / Contribute / DAO / Premium.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Contribute/Premium.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:86a5118380bd35cee851da735f699ac2)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Contribute_DAO_Premium constructor.
39 */
40 class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_premiums';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * Joins these premium settings to another object. Always civicrm_contribution_page for now.
60 *
61 * @var string
62 */
63 public $entity_table;
64 /**
65 *
66 * @var int unsigned
67 */
68 public $entity_id;
69 /**
70 * Is the Premiums feature enabled for this page?
71 *
72 * @var boolean
73 */
74 public $premiums_active;
75 /**
76 * Title for Premiums section.
77 *
78 * @var string
79 */
80 public $premiums_intro_title;
81 /**
82 * Displayed in <div> at top of Premiums section of page. Text and HTML allowed.
83 *
84 * @var text
85 */
86 public $premiums_intro_text;
87 /**
88 * This email address is included in receipts if it is populated and a premium has been selected.
89 *
90 * @var string
91 */
92 public $premiums_contact_email;
93 /**
94 * This phone number is included in receipts if it is populated and a premium has been selected.
95 *
96 * @var string
97 */
98 public $premiums_contact_phone;
99 /**
100 * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.
101 *
102 * @var boolean
103 */
104 public $premiums_display_min_contribution;
105 /**
106 * Label displayed for No Thank-you option in premiums block (e.g. No thank you)
107 *
108 * @var string
109 */
110 public $premiums_nothankyou_label;
111 /**
112 *
113 * @var int unsigned
114 */
115 public $premiums_nothankyou_position;
116 /**
117 * Class constructor.
118 */
119 function __construct() {
120 $this->__table = 'civicrm_premiums';
121 parent::__construct();
122 }
123 /**
124 * Returns foreign keys and entity references.
125 *
126 * @return array
127 * [CRM_Core_Reference_Interface]
128 */
129 static function getReferenceColumns() {
130 if (!isset(Civi::$statics[__CLASS__]['links'])) {
131 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
132 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
134 }
135 return Civi::$statics[__CLASS__]['links'];
136 }
137 /**
138 * Returns all the column names of this table
139 *
140 * @return array
141 */
142 static function &fields() {
143 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
144 Civi::$statics[__CLASS__]['fields'] = array(
145 'id' => array(
146 'name' => 'id',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('Premium ID') ,
149 'required' => true,
150 'table_name' => 'civicrm_premiums',
151 'entity' => 'Premium',
152 'bao' => 'CRM_Contribute_BAO_Premium',
153 'localizable' => 0,
154 ) ,
155 'entity_table' => array(
156 'name' => 'entity_table',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('Premium Entity') ,
159 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.',
160 'required' => true,
161 'maxlength' => 64,
162 'size' => CRM_Utils_Type::BIG,
163 'table_name' => 'civicrm_premiums',
164 'entity' => 'Premium',
165 'bao' => 'CRM_Contribute_BAO_Premium',
166 'localizable' => 0,
167 ) ,
168 'entity_id' => array(
169 'name' => 'entity_id',
170 'type' => CRM_Utils_Type::T_INT,
171 'title' => ts('Premium entity ID') ,
172 'required' => true,
173 'table_name' => 'civicrm_premiums',
174 'entity' => 'Premium',
175 'bao' => 'CRM_Contribute_BAO_Premium',
176 'localizable' => 0,
177 ) ,
178 'premiums_active' => array(
179 'name' => 'premiums_active',
180 'type' => CRM_Utils_Type::T_BOOLEAN,
181 'title' => ts('Is Premium Active?') ,
182 'description' => 'Is the Premiums feature enabled for this page?',
183 'required' => true,
184 'table_name' => 'civicrm_premiums',
185 'entity' => 'Premium',
186 'bao' => 'CRM_Contribute_BAO_Premium',
187 'localizable' => 0,
188 ) ,
189 'premiums_intro_title' => array(
190 'name' => 'premiums_intro_title',
191 'type' => CRM_Utils_Type::T_STRING,
192 'title' => ts('Title for Premiums section') ,
193 'description' => 'Title for Premiums section.',
194 'maxlength' => 255,
195 'size' => CRM_Utils_Type::HUGE,
196 'table_name' => 'civicrm_premiums',
197 'entity' => 'Premium',
198 'bao' => 'CRM_Contribute_BAO_Premium',
199 'localizable' => 1,
200 ) ,
201 'premiums_intro_text' => array(
202 'name' => 'premiums_intro_text',
203 'type' => CRM_Utils_Type::T_TEXT,
204 'title' => ts('Premium Introductory Text') ,
205 'description' => 'Displayed in <div> at top of Premiums section of page. Text and HTML allowed.',
206 'table_name' => 'civicrm_premiums',
207 'entity' => 'Premium',
208 'bao' => 'CRM_Contribute_BAO_Premium',
209 'localizable' => 1,
210 ) ,
211 'premiums_contact_email' => array(
212 'name' => 'premiums_contact_email',
213 'type' => CRM_Utils_Type::T_STRING,
214 'title' => ts('Premium Contact Email') ,
215 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.',
216 'maxlength' => 100,
217 'size' => CRM_Utils_Type::HUGE,
218 'table_name' => 'civicrm_premiums',
219 'entity' => 'Premium',
220 'bao' => 'CRM_Contribute_BAO_Premium',
221 'localizable' => 0,
222 ) ,
223 'premiums_contact_phone' => array(
224 'name' => 'premiums_contact_phone',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Premiums Contact Phone') ,
227 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.',
228 'maxlength' => 50,
229 'size' => CRM_Utils_Type::BIG,
230 'table_name' => 'civicrm_premiums',
231 'entity' => 'Premium',
232 'bao' => 'CRM_Contribute_BAO_Premium',
233 'localizable' => 0,
234 ) ,
235 'premiums_display_min_contribution' => array(
236 'name' => 'premiums_display_min_contribution',
237 'type' => CRM_Utils_Type::T_BOOLEAN,
238 'title' => ts('Display Minimum Contribution?') ,
239 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.',
240 'required' => true,
241 'table_name' => 'civicrm_premiums',
242 'entity' => 'Premium',
243 'bao' => 'CRM_Contribute_BAO_Premium',
244 'localizable' => 0,
245 ) ,
246 'premiums_nothankyou_label' => array(
247 'name' => 'premiums_nothankyou_label',
248 'type' => CRM_Utils_Type::T_STRING,
249 'title' => ts('No Thank-you Text') ,
250 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)',
251 'maxlength' => 255,
252 'size' => CRM_Utils_Type::HUGE,
253 'table_name' => 'civicrm_premiums',
254 'entity' => 'Premium',
255 'bao' => 'CRM_Contribute_BAO_Premium',
256 'localizable' => 1,
257 ) ,
258 'premiums_nothankyou_position' => array(
259 'name' => 'premiums_nothankyou_position',
260 'type' => CRM_Utils_Type::T_INT,
261 'title' => ts('No Thank-you Position') ,
262 'default' => '1',
263 'table_name' => 'civicrm_premiums',
264 'entity' => 'Premium',
265 'bao' => 'CRM_Contribute_BAO_Premium',
266 'localizable' => 0,
267 ) ,
268 );
269 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
270 }
271 return Civi::$statics[__CLASS__]['fields'];
272 }
273 /**
274 * Return a mapping from field-name to the corresponding key (as used in fields()).
275 *
276 * @return array
277 * Array(string $name => string $uniqueName).
278 */
279 static function &fieldKeys() {
280 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
281 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
282 }
283 return Civi::$statics[__CLASS__]['fieldKeys'];
284 }
285 /**
286 * Returns the names of this table
287 *
288 * @return string
289 */
290 static function getTableName() {
291 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
292 }
293 /**
294 * Returns if this table needs to be logged
295 *
296 * @return boolean
297 */
298 function getLog() {
299 return self::$_log;
300 }
301 /**
302 * Returns the list of fields that can be imported
303 *
304 * @param bool $prefix
305 *
306 * @return array
307 */
308 static function &import($prefix = false) {
309 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums', $prefix, array());
310 return $r;
311 }
312 /**
313 * Returns the list of fields that can be exported
314 *
315 * @param bool $prefix
316 *
317 * @return array
318 */
319 static function &export($prefix = false) {
320 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums', $prefix, array());
321 return $r;
322 }
323 }