Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
ca5cec67 | 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Campaign/Campaign.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:dab6fdaa9d622daab580b32ae1172bc7) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Campaign entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '3.3'; | |
d31fb4e3 | 18 | const COMPONENT = 'CiviCampaign'; |
c3fc2621 | 19 | |
e501603b | 20 | /** |
f41f0342 | 21 | * Static instance to hold the table name. |
e501603b TO |
22 | * |
23 | * @var string | |
24 | */ | |
fa45b5b9 | 25 | public static $_tableName = 'civicrm_campaign'; |
c3fc2621 | 26 | |
449c4e6b CW |
27 | /** |
28 | * Icon associated with this entity. | |
29 | * | |
30 | * @var string | |
31 | */ | |
32 | public static $_icon = 'fa-bullhorn'; | |
33 | ||
8ab43c93 CW |
34 | /** |
35 | * Field to show when displaying a record. | |
36 | * | |
37 | * @var string | |
38 | */ | |
39 | public static $_labelField = 'title'; | |
40 | ||
e501603b | 41 | /** |
f41f0342 | 42 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 43 | * |
c3fc2621 | 44 | * @var bool |
e501603b | 45 | */ |
fa45b5b9 | 46 | public static $_log = FALSE; |
c3fc2621 | 47 | |
5c385299 CW |
48 | /** |
49 | * Paths for accessing this entity in the UI. | |
50 | * | |
51 | * @var string[] | |
52 | */ | |
53 | protected static $_paths = [ | |
54 | 'add' => 'civicrm/campaign/add?reset=1', | |
55 | 'update' => 'civicrm/campaign/add?reset=1&action=update&id=[id]', | |
56 | 'delete' => 'civicrm/campaign/add?reset=1&action=delete&id=[id]', | |
57 | ]; | |
58 | ||
e501603b TO |
59 | /** |
60 | * Unique Campaign ID. | |
61 | * | |
28979d65 CW |
62 | * @var int|string|null |
63 | * (SQL type: int unsigned) | |
64 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
65 | */ |
66 | public $id; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Name of the Campaign. | |
70 | * | |
71 | * @var string | |
28979d65 CW |
72 | * (SQL type: varchar(255)) |
73 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
74 | */ |
75 | public $name; | |
c3fc2621 | 76 | |
e501603b TO |
77 | /** |
78 | * Title of the Campaign. | |
79 | * | |
28979d65 CW |
80 | * @var string|null |
81 | * (SQL type: varchar(255)) | |
82 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
83 | */ |
84 | public $title; | |
c3fc2621 | 85 | |
e501603b TO |
86 | /** |
87 | * Full description of Campaign. | |
88 | * | |
28979d65 CW |
89 | * @var string|null |
90 | * (SQL type: text) | |
91 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
92 | */ |
93 | public $description; | |
c3fc2621 | 94 | |
e501603b TO |
95 | /** |
96 | * Date and time that Campaign starts. | |
97 | * | |
28979d65 CW |
98 | * @var string|null |
99 | * (SQL type: datetime) | |
100 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
101 | */ |
102 | public $start_date; | |
c3fc2621 | 103 | |
e501603b TO |
104 | /** |
105 | * Date and time that Campaign ends. | |
106 | * | |
28979d65 CW |
107 | * @var string|null |
108 | * (SQL type: datetime) | |
109 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
110 | */ |
111 | public $end_date; | |
c3fc2621 | 112 | |
e501603b TO |
113 | /** |
114 | * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type | |
115 | * | |
28979d65 CW |
116 | * @var int|string|null |
117 | * (SQL type: int unsigned) | |
118 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
119 | */ |
120 | public $campaign_type_id; | |
c3fc2621 | 121 | |
e501603b TO |
122 | /** |
123 | * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status | |
124 | * | |
28979d65 CW |
125 | * @var int|string|null |
126 | * (SQL type: int unsigned) | |
127 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
128 | */ |
129 | public $status_id; | |
c3fc2621 | 130 | |
e501603b TO |
131 | /** |
132 | * Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations. | |
133 | * | |
28979d65 CW |
134 | * @var string|null |
135 | * (SQL type: varchar(32)) | |
136 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
137 | */ |
138 | public $external_identifier; | |
c3fc2621 | 139 | |
e501603b TO |
140 | /** |
141 | * Optional parent id for this Campaign. | |
142 | * | |
28979d65 CW |
143 | * @var int|string|null |
144 | * (SQL type: int unsigned) | |
145 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
146 | */ |
147 | public $parent_id; | |
c3fc2621 | 148 | |
e501603b TO |
149 | /** |
150 | * Is this Campaign enabled or disabled/cancelled? | |
151 | * | |
28979d65 CW |
152 | * @var bool|string|null |
153 | * (SQL type: tinyint) | |
154 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
155 | */ |
156 | public $is_active; | |
c3fc2621 | 157 | |
e501603b TO |
158 | /** |
159 | * FK to civicrm_contact, who created this Campaign. | |
160 | * | |
28979d65 CW |
161 | * @var int|string|null |
162 | * (SQL type: int unsigned) | |
163 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
164 | */ |
165 | public $created_id; | |
c3fc2621 | 166 | |
e501603b TO |
167 | /** |
168 | * Date and time that Campaign was created. | |
169 | * | |
28979d65 CW |
170 | * @var string|null |
171 | * (SQL type: datetime) | |
172 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
173 | */ |
174 | public $created_date; | |
c3fc2621 | 175 | |
e501603b TO |
176 | /** |
177 | * FK to civicrm_contact, who recently edited this Campaign. | |
178 | * | |
28979d65 CW |
179 | * @var int|string|null |
180 | * (SQL type: int unsigned) | |
181 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
182 | */ |
183 | public $last_modified_id; | |
c3fc2621 | 184 | |
e501603b TO |
185 | /** |
186 | * Date and time that Campaign was edited last time. | |
187 | * | |
28979d65 CW |
188 | * @var string|null |
189 | * (SQL type: datetime) | |
190 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
191 | */ |
192 | public $last_modified_date; | |
c3fc2621 | 193 | |
e501603b TO |
194 | /** |
195 | * General goals for Campaign. | |
196 | * | |
28979d65 CW |
197 | * @var string|null |
198 | * (SQL type: text) | |
199 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
200 | */ |
201 | public $goal_general; | |
c3fc2621 | 202 | |
e501603b TO |
203 | /** |
204 | * The target revenue for this campaign. | |
205 | * | |
28979d65 CW |
206 | * @var float|string|null |
207 | * (SQL type: decimal(20,2)) | |
208 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
209 | */ |
210 | public $goal_revenue; | |
c3fc2621 | 211 | |
e501603b | 212 | /** |
f41f0342 | 213 | * Class constructor. |
e501603b | 214 | */ |
c3fc2621 | 215 | public function __construct() { |
e501603b TO |
216 | $this->__table = 'civicrm_campaign'; |
217 | parent::__construct(); | |
218 | } | |
c3fc2621 | 219 | |
449c4e6b CW |
220 | /** |
221 | * Returns localized title of this entity. | |
7b66c3b5 AH |
222 | * |
223 | * @param bool $plural | |
224 | * Whether to return the plural version of the title. | |
449c4e6b | 225 | */ |
7b66c3b5 AH |
226 | public static function getEntityTitle($plural = FALSE) { |
227 | return $plural ? ts('Campaigns') : ts('Campaign'); | |
449c4e6b CW |
228 | } |
229 | ||
2562d09a CW |
230 | /** |
231 | * Returns user-friendly description of this entity. | |
232 | * | |
233 | * @return string | |
234 | */ | |
235 | public static function getEntityDescription() { | |
236 | return ts('Campaigns link activities, contributions, mailings, etc. that share a programmatic goal.'); | |
237 | } | |
238 | ||
e501603b | 239 | /** |
f41f0342 | 240 | * Returns foreign keys and entity references. |
e501603b TO |
241 | * |
242 | * @return array | |
243 | * [CRM_Core_Reference_Interface] | |
244 | */ | |
c3fc2621 | 245 | public static function getReferenceColumns() { |
346aaaba | 246 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 247 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
248 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_campaign', 'id'); |
249 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'created_id', 'civicrm_contact', 'id'); | |
250 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'last_modified_id', 'civicrm_contact', 'id'); | |
346aaaba | 251 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 252 | } |
346aaaba | 253 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 254 | } |
c3fc2621 | 255 | |
e501603b TO |
256 | /** |
257 | * Returns all the column names of this table | |
258 | * | |
259 | * @return array | |
260 | */ | |
c3fc2621 | 261 | public static function &fields() { |
346aaaba | 262 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
263 | Civi::$statics[__CLASS__]['fields'] = [ |
264 | 'id' => [ | |
e501603b TO |
265 | 'name' => 'id', |
266 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 267 | 'title' => ts('Campaign ID'), |
215b423e | 268 | 'description' => ts('Unique Campaign ID.'), |
c3fc2621 CW |
269 | 'required' => TRUE, |
270 | 'import' => TRUE, | |
e501603b | 271 | 'where' => 'civicrm_campaign.id', |
c3fc2621 | 272 | 'export' => TRUE, |
522a26c9 | 273 | 'table_name' => 'civicrm_campaign', |
274 | 'entity' => 'Campaign', | |
275 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 276 | 'localizable' => 0, |
2cbbebe8 A |
277 | 'html' => [ |
278 | 'type' => 'Number', | |
279 | ], | |
1fe423d6 | 280 | 'readonly' => TRUE, |
a9d0587b | 281 | 'add' => '3.3', |
c3fc2621 CW |
282 | ], |
283 | 'name' => [ | |
e501603b TO |
284 | 'name' => 'name', |
285 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 286 | 'title' => ts('Campaign Name'), |
215b423e | 287 | 'description' => ts('Name of the Campaign.'), |
c3fc2621 | 288 | 'required' => TRUE, |
e501603b TO |
289 | 'maxlength' => 255, |
290 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 291 | 'import' => TRUE, |
e501603b | 292 | 'where' => 'civicrm_campaign.name', |
c3fc2621 | 293 | 'export' => TRUE, |
522a26c9 | 294 | 'table_name' => 'civicrm_campaign', |
295 | 'entity' => 'Campaign', | |
296 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 297 | 'localizable' => 0, |
c3fc2621 | 298 | 'html' => [ |
e501603b | 299 | 'type' => 'Text', |
c3fc2621 | 300 | ], |
a9d0587b | 301 | 'add' => '3.3', |
c3fc2621 CW |
302 | ], |
303 | 'title' => [ | |
e501603b TO |
304 | 'name' => 'title', |
305 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 306 | 'title' => ts('Campaign Title'), |
215b423e | 307 | 'description' => ts('Title of the Campaign.'), |
e501603b TO |
308 | 'maxlength' => 255, |
309 | 'size' => CRM_Utils_Type::HUGE, | |
c3fc2621 | 310 | 'import' => TRUE, |
e501603b | 311 | 'where' => 'civicrm_campaign.title', |
c3fc2621 | 312 | 'export' => TRUE, |
522a26c9 | 313 | 'table_name' => 'civicrm_campaign', |
314 | 'entity' => 'Campaign', | |
315 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 316 | 'localizable' => 0, |
c3fc2621 | 317 | 'html' => [ |
e501603b | 318 | 'type' => 'Text', |
c3fc2621 | 319 | ], |
a9d0587b | 320 | 'add' => '3.3', |
c3fc2621 CW |
321 | ], |
322 | 'description' => [ | |
e501603b TO |
323 | 'name' => 'description', |
324 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 325 | 'title' => ts('Campaign Description'), |
215b423e | 326 | 'description' => ts('Full description of Campaign.'), |
e501603b TO |
327 | 'rows' => 8, |
328 | 'cols' => 60, | |
a36434b9 | 329 | 'where' => 'civicrm_campaign.description', |
522a26c9 | 330 | 'table_name' => 'civicrm_campaign', |
331 | 'entity' => 'Campaign', | |
332 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 333 | 'localizable' => 0, |
c3fc2621 | 334 | 'html' => [ |
e501603b | 335 | 'type' => 'TextArea', |
c3fc2621 | 336 | ], |
a9d0587b | 337 | 'add' => '3.3', |
c3fc2621 CW |
338 | ], |
339 | 'start_date' => [ | |
e501603b TO |
340 | 'name' => 'start_date', |
341 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 342 | 'title' => ts('Campaign Start Date'), |
215b423e | 343 | 'description' => ts('Date and time that Campaign starts.'), |
c3fc2621 | 344 | 'import' => TRUE, |
e501603b TO |
345 | 'where' => 'civicrm_campaign.start_date', |
346 | 'headerPattern' => '/^start|(s(tart\s)?date)$/i', | |
c3fc2621 | 347 | 'export' => TRUE, |
522a26c9 | 348 | 'table_name' => 'civicrm_campaign', |
349 | 'entity' => 'Campaign', | |
350 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 351 | 'localizable' => 0, |
c3fc2621 | 352 | 'html' => [ |
e501603b | 353 | 'type' => 'Select Date', |
efcda6b9 | 354 | 'formatType' => 'activityDateTime', |
c3fc2621 | 355 | ], |
a9d0587b | 356 | 'add' => '3.3', |
c3fc2621 CW |
357 | ], |
358 | 'end_date' => [ | |
e501603b TO |
359 | 'name' => 'end_date', |
360 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 361 | 'title' => ts('Campaign End Date'), |
215b423e | 362 | 'description' => ts('Date and time that Campaign ends.'), |
c3fc2621 | 363 | 'import' => TRUE, |
e501603b TO |
364 | 'where' => 'civicrm_campaign.end_date', |
365 | 'headerPattern' => '/^end|(e(nd\s)?date)$/i', | |
c3fc2621 | 366 | 'export' => TRUE, |
522a26c9 | 367 | 'table_name' => 'civicrm_campaign', |
368 | 'entity' => 'Campaign', | |
369 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 370 | 'localizable' => 0, |
c3fc2621 | 371 | 'html' => [ |
e501603b | 372 | 'type' => 'Select Date', |
efcda6b9 | 373 | 'formatType' => 'activityDateTime', |
c3fc2621 | 374 | ], |
a9d0587b | 375 | 'add' => '3.3', |
c3fc2621 CW |
376 | ], |
377 | 'campaign_type_id' => [ | |
e501603b TO |
378 | 'name' => 'campaign_type_id', |
379 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 380 | 'title' => ts('Campaign Type'), |
215b423e | 381 | 'description' => ts('Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type'), |
c3fc2621 | 382 | 'import' => TRUE, |
e501603b | 383 | 'where' => 'civicrm_campaign.campaign_type_id', |
c3fc2621 | 384 | 'export' => TRUE, |
5fb0de1f | 385 | 'default' => NULL, |
522a26c9 | 386 | 'table_name' => 'civicrm_campaign', |
387 | 'entity' => 'Campaign', | |
388 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 389 | 'localizable' => 0, |
c3fc2621 | 390 | 'html' => [ |
e501603b | 391 | 'type' => 'Select', |
c3fc2621 CW |
392 | ], |
393 | 'pseudoconstant' => [ | |
e501603b TO |
394 | 'optionGroupName' => 'campaign_type', |
395 | 'optionEditPath' => 'civicrm/admin/options/campaign_type', | |
e6ca0a57 | 396 | ], |
a9d0587b | 397 | 'add' => '3.3', |
c3fc2621 CW |
398 | ], |
399 | 'status_id' => [ | |
e501603b TO |
400 | 'name' => 'status_id', |
401 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 402 | 'title' => ts('Campaign Status'), |
215b423e | 403 | 'description' => ts('Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status'), |
c3fc2621 | 404 | 'import' => TRUE, |
e501603b | 405 | 'where' => 'civicrm_campaign.status_id', |
c3fc2621 | 406 | 'export' => TRUE, |
5fb0de1f | 407 | 'default' => NULL, |
522a26c9 | 408 | 'table_name' => 'civicrm_campaign', |
409 | 'entity' => 'Campaign', | |
410 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 411 | 'localizable' => 0, |
c3fc2621 | 412 | 'html' => [ |
e501603b | 413 | 'type' => 'Select', |
c3fc2621 CW |
414 | ], |
415 | 'pseudoconstant' => [ | |
e501603b TO |
416 | 'optionGroupName' => 'campaign_status', |
417 | 'optionEditPath' => 'civicrm/admin/options/campaign_status', | |
e6ca0a57 | 418 | ], |
a9d0587b | 419 | 'add' => '3.3', |
c3fc2621 CW |
420 | ], |
421 | 'external_identifier' => [ | |
e501603b TO |
422 | 'name' => 'external_identifier', |
423 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 424 | 'title' => ts('Campaign External ID'), |
215b423e | 425 | 'description' => ts('Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.'), |
e501603b TO |
426 | 'maxlength' => 32, |
427 | 'size' => CRM_Utils_Type::MEDIUM, | |
c3fc2621 | 428 | 'import' => TRUE, |
e501603b TO |
429 | 'where' => 'civicrm_campaign.external_identifier', |
430 | 'headerPattern' => '/external\s?id/i', | |
431 | 'dataPattern' => '/^\d{11,}$/', | |
c3fc2621 | 432 | 'export' => TRUE, |
522a26c9 | 433 | 'table_name' => 'civicrm_campaign', |
434 | 'entity' => 'Campaign', | |
435 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 436 | 'localizable' => 0, |
c3fc2621 | 437 | 'html' => [ |
e501603b | 438 | 'type' => 'Text', |
c3fc2621 | 439 | ], |
a9d0587b | 440 | 'add' => '3.3', |
c3fc2621 CW |
441 | ], |
442 | 'parent_id' => [ | |
e501603b TO |
443 | 'name' => 'parent_id', |
444 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 445 | 'title' => ts('Parent Campaign ID'), |
215b423e | 446 | 'description' => ts('Optional parent id for this Campaign.'), |
c3fc2621 | 447 | 'import' => TRUE, |
e501603b | 448 | 'where' => 'civicrm_campaign.parent_id', |
c3fc2621 | 449 | 'export' => TRUE, |
5fb0de1f | 450 | 'default' => NULL, |
522a26c9 | 451 | 'table_name' => 'civicrm_campaign', |
452 | 'entity' => 'Campaign', | |
453 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 454 | 'localizable' => 0, |
e501603b | 455 | 'FKClassName' => 'CRM_Campaign_DAO_Campaign', |
c3fc2621 | 456 | 'html' => [ |
e501603b | 457 | 'type' => 'EntityRef', |
2cbbebe8 | 458 | 'label' => ts("Parent Campaign"), |
c3fc2621 | 459 | ], |
a9d0587b | 460 | 'add' => '3.3', |
c3fc2621 CW |
461 | ], |
462 | 'is_active' => [ | |
e501603b TO |
463 | 'name' => 'is_active', |
464 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 465 | 'title' => ts('Is Campaign Active?'), |
215b423e | 466 | 'description' => ts('Is this Campaign enabled or disabled/cancelled?'), |
a36434b9 | 467 | 'where' => 'civicrm_campaign.is_active', |
e501603b | 468 | 'default' => '1', |
522a26c9 | 469 | 'table_name' => 'civicrm_campaign', |
470 | 'entity' => 'Campaign', | |
471 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 472 | 'localizable' => 0, |
c3fc2621 | 473 | 'html' => [ |
e501603b | 474 | 'type' => 'CheckBox', |
c3fc2621 | 475 | ], |
a9d0587b | 476 | 'add' => '3.3', |
c3fc2621 CW |
477 | ], |
478 | 'created_id' => [ | |
e501603b TO |
479 | 'name' => 'created_id', |
480 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 481 | 'title' => ts('Created By Contact ID'), |
215b423e | 482 | 'description' => ts('FK to civicrm_contact, who created this Campaign.'), |
a36434b9 | 483 | 'where' => 'civicrm_campaign.created_id', |
522a26c9 | 484 | 'table_name' => 'civicrm_campaign', |
485 | 'entity' => 'Campaign', | |
486 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 487 | 'localizable' => 0, |
e501603b | 488 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
489 | 'html' => [ |
490 | 'label' => ts("Created By"), | |
491 | ], | |
a9d0587b | 492 | 'add' => '3.3', |
c3fc2621 CW |
493 | ], |
494 | 'created_date' => [ | |
e501603b TO |
495 | 'name' => 'created_date', |
496 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 497 | 'title' => ts('Campaign Created Date'), |
215b423e | 498 | 'description' => ts('Date and time that Campaign was created.'), |
a36434b9 | 499 | 'where' => 'civicrm_campaign.created_date', |
522a26c9 | 500 | 'table_name' => 'civicrm_campaign', |
501 | 'entity' => 'Campaign', | |
502 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 503 | 'localizable' => 0, |
c3fc2621 | 504 | 'html' => [ |
e501603b | 505 | 'type' => 'Select Date', |
efcda6b9 | 506 | 'formatType' => 'activityDateTime', |
c3fc2621 | 507 | ], |
a9d0587b | 508 | 'add' => '3.3', |
c3fc2621 CW |
509 | ], |
510 | 'last_modified_id' => [ | |
e501603b TO |
511 | 'name' => 'last_modified_id', |
512 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 513 | 'title' => ts('Modified By Contact ID'), |
215b423e | 514 | 'description' => ts('FK to civicrm_contact, who recently edited this Campaign.'), |
a36434b9 | 515 | 'where' => 'civicrm_campaign.last_modified_id', |
522a26c9 | 516 | 'table_name' => 'civicrm_campaign', |
517 | 'entity' => 'Campaign', | |
518 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 519 | 'localizable' => 0, |
e501603b | 520 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
521 | 'html' => [ |
522 | 'label' => ts("Modified By"), | |
523 | ], | |
a9d0587b | 524 | 'add' => '3.3', |
c3fc2621 CW |
525 | ], |
526 | 'last_modified_date' => [ | |
e501603b TO |
527 | 'name' => 'last_modified_date', |
528 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 529 | 'title' => ts('Campaign Modified Date'), |
215b423e | 530 | 'description' => ts('Date and time that Campaign was edited last time.'), |
a36434b9 | 531 | 'where' => 'civicrm_campaign.last_modified_date', |
522a26c9 | 532 | 'table_name' => 'civicrm_campaign', |
533 | 'entity' => 'Campaign', | |
534 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 535 | 'localizable' => 0, |
a9d0587b | 536 | 'add' => '3.3', |
c3fc2621 CW |
537 | ], |
538 | 'goal_general' => [ | |
e501603b TO |
539 | 'name' => 'goal_general', |
540 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 541 | 'title' => ts('Campaign Goals'), |
215b423e | 542 | 'description' => ts('General goals for Campaign.'), |
a36434b9 | 543 | 'where' => 'civicrm_campaign.goal_general', |
522a26c9 | 544 | 'table_name' => 'civicrm_campaign', |
545 | 'entity' => 'Campaign', | |
546 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 547 | 'localizable' => 0, |
c3fc2621 | 548 | 'html' => [ |
e501603b | 549 | 'type' => 'RichTextEditor', |
c3fc2621 | 550 | ], |
a9d0587b | 551 | 'add' => '3.4', |
c3fc2621 CW |
552 | ], |
553 | 'goal_revenue' => [ | |
e501603b TO |
554 | 'name' => 'goal_revenue', |
555 | 'type' => CRM_Utils_Type::T_MONEY, | |
c3fc2621 | 556 | 'title' => ts('Goal Revenue'), |
215b423e | 557 | 'description' => ts('The target revenue for this campaign.'), |
c3fc2621 | 558 | 'precision' => [ |
e501603b | 559 | 20, |
fb607354 | 560 | 2, |
c3fc2621 | 561 | ], |
a36434b9 | 562 | 'where' => 'civicrm_campaign.goal_revenue', |
522a26c9 | 563 | 'table_name' => 'civicrm_campaign', |
564 | 'entity' => 'Campaign', | |
565 | 'bao' => 'CRM_Campaign_BAO_Campaign', | |
6a7e5e5d | 566 | 'localizable' => 0, |
c3fc2621 | 567 | 'html' => [ |
e501603b | 568 | 'type' => 'Text', |
c23563e3 | 569 | 'label' => ts("Goal Revenue"), |
c3fc2621 | 570 | ], |
a9d0587b | 571 | 'add' => '3.4', |
c3fc2621 CW |
572 | ], |
573 | ]; | |
346aaaba | 574 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 575 | } |
346aaaba | 576 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 577 | } |
c3fc2621 | 578 | |
e501603b | 579 | /** |
bd8e0b14 | 580 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
581 | * |
582 | * @return array | |
bd8e0b14 | 583 | * Array(string $name => string $uniqueName). |
e501603b | 584 | */ |
c3fc2621 | 585 | public static function &fieldKeys() { |
bd8e0b14 TO |
586 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
587 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 588 | } |
bd8e0b14 | 589 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 590 | } |
c3fc2621 | 591 | |
e501603b TO |
592 | /** |
593 | * Returns the names of this table | |
594 | * | |
595 | * @return string | |
596 | */ | |
c3fc2621 | 597 | public static function getTableName() { |
e501603b TO |
598 | return self::$_tableName; |
599 | } | |
c3fc2621 | 600 | |
e501603b TO |
601 | /** |
602 | * Returns if this table needs to be logged | |
603 | * | |
c3fc2621 | 604 | * @return bool |
e501603b | 605 | */ |
c3fc2621 | 606 | public function getLog() { |
e501603b TO |
607 | return self::$_log; |
608 | } | |
c3fc2621 | 609 | |
e501603b TO |
610 | /** |
611 | * Returns the list of fields that can be imported | |
612 | * | |
613 | * @param bool $prefix | |
614 | * | |
615 | * @return array | |
616 | */ | |
c3fc2621 CW |
617 | public static function &import($prefix = FALSE) { |
618 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 619 | return $r; |
e501603b | 620 | } |
c3fc2621 | 621 | |
e501603b TO |
622 | /** |
623 | * Returns the list of fields that can be exported | |
624 | * | |
625 | * @param bool $prefix | |
626 | * | |
627 | * @return array | |
628 | */ | |
c3fc2621 CW |
629 | public static function &export($prefix = FALSE) { |
630 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign', $prefix, []); | |
60808919 | 631 | return $r; |
e501603b | 632 | } |
c3fc2621 | 633 | |
e7a6b91a AS |
634 | /** |
635 | * Returns the list of indices | |
c3fc2621 CW |
636 | * |
637 | * @param bool $localize | |
638 | * | |
639 | * @return array | |
e7a6b91a AS |
640 | */ |
641 | public static function indices($localize = TRUE) { | |
c3fc2621 | 642 | $indices = [ |
4edfa3ea | 643 | 'UI_campaign_name' => [ |
644 | 'name' => 'UI_campaign_name', | |
645 | 'field' => [ | |
646 | 0 => 'name', | |
647 | ], | |
648 | 'localizable' => FALSE, | |
649 | 'sig' => 'civicrm_campaign::0::name', | |
650 | ], | |
c3fc2621 | 651 | 'UI_campaign_type_id' => [ |
e7a6b91a | 652 | 'name' => 'UI_campaign_type_id', |
c3fc2621 | 653 | 'field' => [ |
e7a6b91a | 654 | 0 => 'campaign_type_id', |
c3fc2621 CW |
655 | ], |
656 | 'localizable' => FALSE, | |
e7a6b91a | 657 | 'sig' => 'civicrm_campaign::0::campaign_type_id', |
c3fc2621 CW |
658 | ], |
659 | 'UI_campaign_status_id' => [ | |
e7a6b91a | 660 | 'name' => 'UI_campaign_status_id', |
c3fc2621 | 661 | 'field' => [ |
e7a6b91a | 662 | 0 => 'status_id', |
c3fc2621 CW |
663 | ], |
664 | 'localizable' => FALSE, | |
e7a6b91a | 665 | 'sig' => 'civicrm_campaign::0::status_id', |
c3fc2621 CW |
666 | ], |
667 | 'UI_external_identifier' => [ | |
e7a6b91a | 668 | 'name' => 'UI_external_identifier', |
c3fc2621 | 669 | 'field' => [ |
e7a6b91a | 670 | 0 => 'external_identifier', |
c3fc2621 CW |
671 | ], |
672 | 'localizable' => FALSE, | |
673 | 'unique' => TRUE, | |
e7a6b91a | 674 | 'sig' => 'civicrm_campaign::1::external_identifier', |
c3fc2621 CW |
675 | ], |
676 | ]; | |
e7a6b91a AS |
677 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
678 | } | |
c3fc2621 | 679 | |
e501603b | 680 | } |