From e501603bcc6d86d85326809a48ce758cacaaa793 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 27 Jul 2016 01:26:52 -0700 Subject: [PATCH] CRM-14885 - Import DAO's --- .gitignore | 107 -- CRM/ACL/DAO/ACL.php | 364 +++++ CRM/ACL/DAO/Cache.php | 250 +++ CRM/ACL/DAO/EntityRole.php | 263 ++++ CRM/Activity/DAO/Activity.php | 661 ++++++++ CRM/Activity/DAO/ActivityContact.php | 262 ++++ CRM/Batch/DAO/Batch.php | 477 ++++++ CRM/Batch/DAO/EntityBatch.php | 251 ++++ CRM/Campaign/DAO/Campaign.php | 528 +++++++ CRM/Campaign/DAO/CampaignGroup.php | 279 ++++ CRM/Campaign/DAO/Survey.php | 508 +++++++ CRM/Case/DAO/Case.php | 363 +++++ CRM/Case/DAO/CaseActivity.php | 237 +++ CRM/Case/DAO/CaseContact.php | 240 +++ CRM/Case/DAO/CaseType.php | 294 ++++ CRM/Contact/DAO/ACLContactCache.php | 258 ++++ CRM/Contact/DAO/Contact.php | 1311 ++++++++++++++++ CRM/Contact/DAO/ContactType.php | 315 ++++ CRM/Contact/DAO/DashboardContact.php | 327 ++++ CRM/Contact/DAO/Group.php | 484 ++++++ CRM/Contact/DAO/GroupContact.php | 296 ++++ CRM/Contact/DAO/GroupContactCache.php | 245 +++ CRM/Contact/DAO/GroupNesting.php | 237 +++ CRM/Contact/DAO/GroupOrganization.php | 245 +++ CRM/Contact/DAO/Relationship.php | 380 +++++ CRM/Contact/DAO/RelationshipType.php | 394 +++++ CRM/Contact/DAO/SavedSearch.php | 290 ++++ CRM/Contact/DAO/SubscriptionHistory.php | 312 ++++ CRM/Contribute/DAO/Contribution.php | 841 +++++++++++ CRM/Contribute/DAO/ContributionPage.php | 879 +++++++++++ CRM/Contribute/DAO/ContributionProduct.php | 346 +++++ CRM/Contribute/DAO/ContributionRecur.php | 675 +++++++++ CRM/Contribute/DAO/ContributionSoft.php | 373 +++++ CRM/Contribute/DAO/Premium.php | 345 +++++ CRM/Contribute/DAO/PremiumsProduct.php | 270 ++++ CRM/Contribute/DAO/Product.php | 515 +++++++ CRM/Contribute/DAO/Widget.php | 423 ++++++ CRM/Core/DAO/ActionLog.php | 330 ++++ CRM/Core/DAO/ActionMapping.php | 311 ++++ CRM/Core/DAO/ActionSchedule.php | 771 ++++++++++ CRM/Core/DAO/Address.php | 786 ++++++++++ CRM/Core/DAO/AddressFormat.php | 206 +++ CRM/Core/DAO/Cache.php | 294 ++++ CRM/Core/DAO/Component.php | 226 +++ CRM/Core/DAO/Country.php | 329 ++++ CRM/Core/DAO/County.php | 256 ++++ CRM/Core/DAO/CustomField.php | 629 ++++++++ CRM/Core/DAO/CustomGroup.php | 487 ++++++ CRM/Core/DAO/Dashboard.php | 393 +++++ CRM/Core/DAO/Discount.php | 281 ++++ CRM/Core/DAO/Domain.php | 320 ++++ CRM/Core/DAO/Email.php | 394 +++++ CRM/Core/DAO/EntityFile.php | 251 ++++ CRM/Core/DAO/EntityTag.php | 263 ++++ CRM/Core/DAO/Extension.php | 323 ++++ CRM/Core/DAO/File.php | 277 ++++ CRM/Core/DAO/IM.php | 310 ++++ CRM/Core/DAO/Job.php | 368 +++++ CRM/Core/DAO/JobLog.php | 310 ++++ CRM/Core/DAO/LocBlock.php | 309 ++++ CRM/Core/DAO/LocationType.php | 292 ++++ CRM/Core/DAO/Log.php | 277 ++++ CRM/Core/DAO/MailSettings.php | 407 +++++ CRM/Core/DAO/Managed.php | 275 ++++ CRM/Core/DAO/Mapping.php | 243 +++ CRM/Core/DAO/MappingField.php | 417 +++++ CRM/Core/DAO/Menu.php | 497 ++++++ CRM/Core/DAO/MessageTemplate.php | 336 +++++ CRM/Core/DAO/Navigation.php | 358 +++++ CRM/Core/DAO/Note.php | 327 ++++ CRM/Core/DAO/OpenID.php | 281 ++++ CRM/Core/DAO/OptionGroup.php | 279 ++++ CRM/Core/DAO/OptionValue.php | 449 ++++++ CRM/Core/DAO/Persistent.php | 252 ++++ CRM/Core/DAO/Phone.php | 361 +++++ CRM/Core/DAO/PreferencesDate.php | 280 ++++ CRM/Core/DAO/PrevNextCache.php | 273 ++++ CRM/Core/DAO/PrintLabel.php | 358 +++++ CRM/Core/DAO/RecurringEntity.php | 249 +++ CRM/Core/DAO/Setting.php | 331 ++++ CRM/Core/DAO/StateProvince.php | 256 ++++ CRM/Core/DAO/StatusPreference.php | 318 ++++ CRM/Core/DAO/SystemLog.php | 280 ++++ CRM/Core/DAO/Tag.php | 337 +++++ CRM/Core/DAO/Timezone.php | 277 ++++ CRM/Core/DAO/UFField.php | 472 ++++++ CRM/Core/DAO/UFGroup.php | 527 +++++++ CRM/Core/DAO/UFJoin.php | 319 ++++ CRM/Core/DAO/UFMatch.php | 285 ++++ CRM/Core/DAO/Website.php | 263 ++++ CRM/Core/DAO/WordReplacement.php | 289 ++++ CRM/Core/DAO/Worldregion.php | 212 +++ CRM/Cxn/DAO/Cxn.php | 334 ++++ CRM/Dedupe/DAO/Exception.php | 235 +++ CRM/Dedupe/DAO/Rule.php | 286 ++++ CRM/Dedupe/DAO/RuleGroup.php | 305 ++++ CRM/Event/Cart/DAO/Cart.php | 231 +++ CRM/Event/Cart/DAO/EventInCart.php | 235 +++ CRM/Event/DAO/Event.php | 1422 ++++++++++++++++++ CRM/Event/DAO/Participant.php | 577 +++++++ CRM/Event/DAO/ParticipantPayment.php | 237 +++ CRM/Event/DAO/ParticipantStatusType.php | 323 ++++ CRM/Financial/DAO/Currency.php | 272 ++++ CRM/Financial/DAO/EntityFinancialAccount.php | 286 ++++ CRM/Financial/DAO/EntityFinancialTrxn.php | 275 ++++ CRM/Financial/DAO/FinancialAccount.php | 456 ++++++ CRM/Financial/DAO/FinancialItem.php | 389 +++++ CRM/Financial/DAO/FinancialTrxn.php | 468 ++++++ CRM/Financial/DAO/FinancialType.php | 269 ++++ CRM/Financial/DAO/PaymentProcessor.php | 487 ++++++ CRM/Financial/DAO/PaymentProcessorType.php | 498 ++++++ CRM/Financial/DAO/PaymentToken.php | 383 +++++ CRM/Friend/DAO/Friend.php | 355 +++++ CRM/Grant/DAO/Grant.php | 520 +++++++ CRM/Mailing/DAO/BouncePattern.php | 234 +++ CRM/Mailing/DAO/BounceType.php | 236 +++ CRM/Mailing/DAO/Component.php | 302 ++++ CRM/Mailing/DAO/Mailing.php | 824 ++++++++++ CRM/Mailing/DAO/MailingAB.php | 390 +++++ CRM/Mailing/DAO/MailingGroup.php | 300 ++++ CRM/Mailing/DAO/MailingJob.php | 349 +++++ CRM/Mailing/DAO/Recipients.php | 267 ++++ CRM/Mailing/DAO/Spool.php | 284 ++++ CRM/Mailing/DAO/TrackableURL.php | 233 +++ CRM/Mailing/Event/DAO/Bounce.php | 269 ++++ CRM/Mailing/Event/DAO/Confirm.php | 233 +++ CRM/Mailing/Event/DAO/Delivered.php | 233 +++ CRM/Mailing/Event/DAO/Forward.php | 248 +++ CRM/Mailing/Event/DAO/Opened.php | 233 +++ CRM/Mailing/Event/DAO/Queue.php | 283 ++++ CRM/Mailing/Event/DAO/Reply.php | 233 +++ CRM/Mailing/Event/DAO/Subscribe.php | 273 ++++ CRM/Mailing/Event/DAO/TrackableURLOpen.php | 249 +++ CRM/Mailing/Event/DAO/Unsubscribe.php | 247 +++ CRM/Member/DAO/Membership.php | 513 +++++++ CRM/Member/DAO/MembershipBlock.php | 377 +++++ CRM/Member/DAO/MembershipLog.php | 317 ++++ CRM/Member/DAO/MembershipPayment.php | 234 +++ CRM/Member/DAO/MembershipStatus.php | 415 +++++ CRM/Member/DAO/MembershipType.php | 533 +++++++ CRM/PCP/DAO/PCP.php | 459 ++++++ CRM/PCP/DAO/PCPBlock.php | 389 +++++ CRM/Pledge/DAO/Pledge.php | 641 ++++++++ CRM/Pledge/DAO/PledgeBlock.php | 348 +++++ CRM/Pledge/DAO/PledgePayment.php | 384 +++++ CRM/Price/DAO/LineItem.php | 449 ++++++ CRM/Price/DAO/PriceField.php | 489 ++++++ CRM/Price/DAO/PriceFieldValue.php | 496 ++++++ CRM/Price/DAO/PriceSet.php | 417 +++++ CRM/Price/DAO/PriceSetEntity.php | 252 ++++ CRM/Queue/DAO/QueueItem.php | 271 ++++ CRM/Report/DAO/ReportInstance.php | 557 +++++++ CRM/SMS/DAO/Provider.php | 335 +++++ 153 files changed, 56178 insertions(+), 107 deletions(-) create mode 100644 CRM/ACL/DAO/ACL.php create mode 100644 CRM/ACL/DAO/Cache.php create mode 100644 CRM/ACL/DAO/EntityRole.php create mode 100644 CRM/Activity/DAO/Activity.php create mode 100644 CRM/Activity/DAO/ActivityContact.php create mode 100644 CRM/Batch/DAO/Batch.php create mode 100644 CRM/Batch/DAO/EntityBatch.php create mode 100644 CRM/Campaign/DAO/Campaign.php create mode 100644 CRM/Campaign/DAO/CampaignGroup.php create mode 100644 CRM/Campaign/DAO/Survey.php create mode 100644 CRM/Case/DAO/Case.php create mode 100644 CRM/Case/DAO/CaseActivity.php create mode 100644 CRM/Case/DAO/CaseContact.php create mode 100644 CRM/Case/DAO/CaseType.php create mode 100644 CRM/Contact/DAO/ACLContactCache.php create mode 100644 CRM/Contact/DAO/Contact.php create mode 100644 CRM/Contact/DAO/ContactType.php create mode 100644 CRM/Contact/DAO/DashboardContact.php create mode 100644 CRM/Contact/DAO/Group.php create mode 100644 CRM/Contact/DAO/GroupContact.php create mode 100644 CRM/Contact/DAO/GroupContactCache.php create mode 100644 CRM/Contact/DAO/GroupNesting.php create mode 100644 CRM/Contact/DAO/GroupOrganization.php create mode 100644 CRM/Contact/DAO/Relationship.php create mode 100644 CRM/Contact/DAO/RelationshipType.php create mode 100644 CRM/Contact/DAO/SavedSearch.php create mode 100644 CRM/Contact/DAO/SubscriptionHistory.php create mode 100644 CRM/Contribute/DAO/Contribution.php create mode 100644 CRM/Contribute/DAO/ContributionPage.php create mode 100644 CRM/Contribute/DAO/ContributionProduct.php create mode 100644 CRM/Contribute/DAO/ContributionRecur.php create mode 100644 CRM/Contribute/DAO/ContributionSoft.php create mode 100644 CRM/Contribute/DAO/Premium.php create mode 100644 CRM/Contribute/DAO/PremiumsProduct.php create mode 100644 CRM/Contribute/DAO/Product.php create mode 100644 CRM/Contribute/DAO/Widget.php create mode 100644 CRM/Core/DAO/ActionLog.php create mode 100644 CRM/Core/DAO/ActionMapping.php create mode 100644 CRM/Core/DAO/ActionSchedule.php create mode 100644 CRM/Core/DAO/Address.php create mode 100644 CRM/Core/DAO/AddressFormat.php create mode 100644 CRM/Core/DAO/Cache.php create mode 100644 CRM/Core/DAO/Component.php create mode 100644 CRM/Core/DAO/Country.php create mode 100644 CRM/Core/DAO/County.php create mode 100644 CRM/Core/DAO/CustomField.php create mode 100644 CRM/Core/DAO/CustomGroup.php create mode 100644 CRM/Core/DAO/Dashboard.php create mode 100644 CRM/Core/DAO/Discount.php create mode 100644 CRM/Core/DAO/Domain.php create mode 100644 CRM/Core/DAO/Email.php create mode 100644 CRM/Core/DAO/EntityFile.php create mode 100644 CRM/Core/DAO/EntityTag.php create mode 100644 CRM/Core/DAO/Extension.php create mode 100644 CRM/Core/DAO/File.php create mode 100644 CRM/Core/DAO/IM.php create mode 100644 CRM/Core/DAO/Job.php create mode 100644 CRM/Core/DAO/JobLog.php create mode 100644 CRM/Core/DAO/LocBlock.php create mode 100644 CRM/Core/DAO/LocationType.php create mode 100644 CRM/Core/DAO/Log.php create mode 100644 CRM/Core/DAO/MailSettings.php create mode 100644 CRM/Core/DAO/Managed.php create mode 100644 CRM/Core/DAO/Mapping.php create mode 100644 CRM/Core/DAO/MappingField.php create mode 100644 CRM/Core/DAO/Menu.php create mode 100644 CRM/Core/DAO/MessageTemplate.php create mode 100644 CRM/Core/DAO/Navigation.php create mode 100644 CRM/Core/DAO/Note.php create mode 100644 CRM/Core/DAO/OpenID.php create mode 100644 CRM/Core/DAO/OptionGroup.php create mode 100644 CRM/Core/DAO/OptionValue.php create mode 100644 CRM/Core/DAO/Persistent.php create mode 100644 CRM/Core/DAO/Phone.php create mode 100644 CRM/Core/DAO/PreferencesDate.php create mode 100644 CRM/Core/DAO/PrevNextCache.php create mode 100644 CRM/Core/DAO/PrintLabel.php create mode 100644 CRM/Core/DAO/RecurringEntity.php create mode 100644 CRM/Core/DAO/Setting.php create mode 100644 CRM/Core/DAO/StateProvince.php create mode 100644 CRM/Core/DAO/StatusPreference.php create mode 100644 CRM/Core/DAO/SystemLog.php create mode 100644 CRM/Core/DAO/Tag.php create mode 100644 CRM/Core/DAO/Timezone.php create mode 100644 CRM/Core/DAO/UFField.php create mode 100644 CRM/Core/DAO/UFGroup.php create mode 100644 CRM/Core/DAO/UFJoin.php create mode 100644 CRM/Core/DAO/UFMatch.php create mode 100644 CRM/Core/DAO/Website.php create mode 100644 CRM/Core/DAO/WordReplacement.php create mode 100644 CRM/Core/DAO/Worldregion.php create mode 100644 CRM/Cxn/DAO/Cxn.php create mode 100644 CRM/Dedupe/DAO/Exception.php create mode 100644 CRM/Dedupe/DAO/Rule.php create mode 100644 CRM/Dedupe/DAO/RuleGroup.php create mode 100644 CRM/Event/Cart/DAO/Cart.php create mode 100644 CRM/Event/Cart/DAO/EventInCart.php create mode 100644 CRM/Event/DAO/Event.php create mode 100644 CRM/Event/DAO/Participant.php create mode 100644 CRM/Event/DAO/ParticipantPayment.php create mode 100644 CRM/Event/DAO/ParticipantStatusType.php create mode 100644 CRM/Financial/DAO/Currency.php create mode 100644 CRM/Financial/DAO/EntityFinancialAccount.php create mode 100644 CRM/Financial/DAO/EntityFinancialTrxn.php create mode 100644 CRM/Financial/DAO/FinancialAccount.php create mode 100644 CRM/Financial/DAO/FinancialItem.php create mode 100644 CRM/Financial/DAO/FinancialTrxn.php create mode 100644 CRM/Financial/DAO/FinancialType.php create mode 100644 CRM/Financial/DAO/PaymentProcessor.php create mode 100644 CRM/Financial/DAO/PaymentProcessorType.php create mode 100644 CRM/Financial/DAO/PaymentToken.php create mode 100644 CRM/Friend/DAO/Friend.php create mode 100644 CRM/Grant/DAO/Grant.php create mode 100644 CRM/Mailing/DAO/BouncePattern.php create mode 100644 CRM/Mailing/DAO/BounceType.php create mode 100644 CRM/Mailing/DAO/Component.php create mode 100644 CRM/Mailing/DAO/Mailing.php create mode 100644 CRM/Mailing/DAO/MailingAB.php create mode 100644 CRM/Mailing/DAO/MailingGroup.php create mode 100644 CRM/Mailing/DAO/MailingJob.php create mode 100644 CRM/Mailing/DAO/Recipients.php create mode 100644 CRM/Mailing/DAO/Spool.php create mode 100644 CRM/Mailing/DAO/TrackableURL.php create mode 100644 CRM/Mailing/Event/DAO/Bounce.php create mode 100644 CRM/Mailing/Event/DAO/Confirm.php create mode 100644 CRM/Mailing/Event/DAO/Delivered.php create mode 100644 CRM/Mailing/Event/DAO/Forward.php create mode 100644 CRM/Mailing/Event/DAO/Opened.php create mode 100644 CRM/Mailing/Event/DAO/Queue.php create mode 100644 CRM/Mailing/Event/DAO/Reply.php create mode 100644 CRM/Mailing/Event/DAO/Subscribe.php create mode 100644 CRM/Mailing/Event/DAO/TrackableURLOpen.php create mode 100644 CRM/Mailing/Event/DAO/Unsubscribe.php create mode 100644 CRM/Member/DAO/Membership.php create mode 100644 CRM/Member/DAO/MembershipBlock.php create mode 100644 CRM/Member/DAO/MembershipLog.php create mode 100644 CRM/Member/DAO/MembershipPayment.php create mode 100644 CRM/Member/DAO/MembershipStatus.php create mode 100644 CRM/Member/DAO/MembershipType.php create mode 100644 CRM/PCP/DAO/PCP.php create mode 100644 CRM/PCP/DAO/PCPBlock.php create mode 100644 CRM/Pledge/DAO/Pledge.php create mode 100644 CRM/Pledge/DAO/PledgeBlock.php create mode 100644 CRM/Pledge/DAO/PledgePayment.php create mode 100644 CRM/Price/DAO/LineItem.php create mode 100644 CRM/Price/DAO/PriceField.php create mode 100644 CRM/Price/DAO/PriceFieldValue.php create mode 100644 CRM/Price/DAO/PriceSet.php create mode 100644 CRM/Price/DAO/PriceSetEntity.php create mode 100644 CRM/Queue/DAO/QueueItem.php create mode 100644 CRM/Report/DAO/ReportInstance.php create mode 100644 CRM/SMS/DAO/Provider.php diff --git a/.gitignore b/.gitignore index 4a5a379e1b..01bef6bf88 100644 --- a/.gitignore +++ b/.gitignore @@ -2,116 +2,11 @@ *.bak backdrop/ bower_components -CRM/ACL/DAO -CRM/Activity/DAO -CRM/Auction/DAO -CRM/Campaign/DAO -CRM/Case/DAO CRM/Case/xml/configuration -CRM/Contact/DAO/ACLContactCache.php -CRM/Contact/DAO/Contact.php -CRM/Contact/DAO/ContactType.php -CRM/Contact/DAO/DashboardContact.php -CRM/Contact/DAO/Group.php -CRM/Contact/DAO/GroupContact.php -CRM/Contact/DAO/GroupContactCache.php -CRM/Contact/DAO/GroupNesting.php -CRM/Contact/DAO/GroupOrganization.php -CRM/Contact/DAO/Relationship.php -CRM/Contact/DAO/RelationshipType.php -CRM/Contact/DAO/SavedSearch.php -CRM/Contact/DAO/SubscriptionHistory.php -CRM/Contribute/DAO CRM/Core/DAO/AllCoreTables.php CRM/Core/DAO/.listAll.php CRM/Core/DAO/listAll.php -CRM/Core/DAO/ActionLog.php -CRM/Core/DAO/ActionMapping.php -CRM/Core/DAO/ActionSchedule.php -CRM/Core/DAO/Address.php -CRM/Core/DAO/AddressFormat.php -CRM/Core/DAO/Batch.php -CRM/Core/DAO/Cache.php -CRM/Core/DAO/Component.php -CRM/Core/DAO/Country.php -CRM/Core/DAO/County.php -CRM/Core/DAO/Currency.php -CRM/Core/DAO/CustomField.php -CRM/Core/DAO/CustomGroup.php -CRM/Core/DAO/Dashboard.php -CRM/Core/DAO/Discount.php -CRM/Core/DAO/Domain.php -CRM/Core/DAO/Email.php -CRM/Core/DAO/EntityBatch.php -CRM/Core/DAO/EntityFile.php -CRM/Core/DAO/EntityFinancialTrxn.php -CRM/Core/DAO/EntityTag.php -CRM/Core/DAO/Extension.php -CRM/Core/DAO/File.php -CRM/Core/DAO/FinancialAccount.php -CRM/Core/DAO/FinancialTrxn.php -CRM/Core/DAO/IM.php -CRM/Core/DAO/Job.php -CRM/Core/DAO/JobLog.php -CRM/Core/DAO/LineItem.php -CRM/Core/DAO/LocBlock.php -CRM/Core/DAO/LocationType.php -CRM/Core/DAO/Log.php -CRM/Core/DAO/MailSettings.php -CRM/Core/DAO/Managed.php -CRM/Core/DAO/Mapping.php -CRM/Core/DAO/MappingField.php -CRM/Core/DAO/Menu.php -CRM/Core/DAO/MessageTemplate.php -CRM/Core/DAO/MessageTemplates.php -CRM/Core/DAO/Navigation.php -CRM/Core/DAO/Note.php -CRM/Core/DAO/OpenID.php -CRM/Core/DAO/OptionGroup.php -CRM/Core/DAO/OptionValue.php -CRM/Core/DAO/PaymentProcessor.php -CRM/Core/DAO/PaymentProcessorType.php -CRM/Core/DAO/Persistent.php -CRM/Core/DAO/Phone.php -CRM/Core/DAO/Preferences.php -CRM/Core/DAO/PreferencesDate.php -CRM/Core/DAO/PrevNextCache.php -CRM/Core/DAO/PriceField.php -CRM/Core/DAO/PriceSet.php -CRM/Core/DAO/PriceSetEntity.php -CRM/Core/DAO/PrintLabel.php -CRM/Core/DAO/RecurringEntity.php -CRM/Core/DAO/Setting.php -CRM/Core/DAO/StateProvince.php -CRM/Core/DAO/StatusPreference.php -CRM/Core/DAO/SystemLog.php -CRM/Core/DAO/Tag.php -CRM/Core/DAO/Timezone.php -CRM/Core/DAO/UFField.php -CRM/Core/DAO/UFGroup.php -CRM/Core/DAO/UFJoin.php -CRM/Core/DAO/UFMatch.php -CRM/Core/DAO/Website.php -CRM/Core/DAO/WordReplacement.php -CRM/Core/DAO/Worldregion.php CRM/Core/I18n/SchemaStructure.php -CRM/Cxn/DAO -CRM/Dedupe/DAO -CRM/Event/Cart/DAO -CRM/Event/DAO -CRM/Friend/DAO -CRM/Grant/DAO -CRM/Mailing/DAO -CRM/Mailing/Event/DAO -CRM/Member/DAO -CRM/PCP/DAO -CRM/Pledge/DAO -CRM/Price/DAO -CRM/Project/DAO -CRM/Queue/DAO -CRM/Report/DAO -CRM/SMS/DAO -CRM/Standalone/OpenID/DAO bin/setup.conf civicrm-version.php civicrm-version.txt @@ -143,8 +38,6 @@ tests/phpunit/CiviTest/CiviSeleniumSettings.php tests/phpunit/CiviTest/civicrm.settings.php tools/stats/config.php authors.txt -CRM/Batch/DAO/ -CRM/Financial/DAO/ drupal/ WordPress joomla diff --git a/CRM/ACL/DAO/ACL.php b/CRM/ACL/DAO/ACL.php new file mode 100644 index 0000000000..d438855872 --- /dev/null +++ b/CRM/ACL/DAO/ACL.php @@ -0,0 +1,364 @@ +__table = 'civicrm_acl'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL ID') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ACL Name') , + 'description' => 'ACL Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'deny' => array( + 'name' => 'deny', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Deny ACL?') , + 'description' => 'Is this ACL entry Allow (0) or Deny (1) ?', + 'required' => true, + 'html' => array( + 'type' => 'Radio', + ) , + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ACL Entity') , + 'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'ID of the object possessing this ACL', + ) , + 'operation' => array( + 'name' => 'operation', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ACL Operation') , + 'description' => 'What operation does this ACL entry control?', + 'required' => true, + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_ACL_BAO_ACL::operation', + ) + ) , + 'object_table' => array( + 'name' => 'object_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ACL Object') , + 'description' => 'The table of the object controlled by this ACL entry', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'object_id' => array( + 'name' => 'object_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL Object ID') , + 'description' => 'The ID of the object controlled by this ACL entry', + ) , + 'acl_table' => array( + 'name' => 'acl_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ACL Table') , + 'description' => 'If this is a grant/revoke entry, what table are we granting?', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'acl_id' => array( + 'name' => 'acl_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL Group ID') , + 'description' => 'ID of the ACL or ACL group being granted/revoked', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('ACL Is Active?') , + 'description' => 'Is this property active?', + 'html' => array( + 'type' => 'Checkbox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'deny' => 'deny', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'operation' => 'operation', + 'object_table' => 'object_table', + 'object_id' => 'object_id', + 'acl_table' => 'acl_table', + 'acl_id' => 'acl_id', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['acl'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['acl'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/ACL/DAO/Cache.php b/CRM/ACL/DAO/Cache.php new file mode 100644 index 0000000000..55af19a53c --- /dev/null +++ b/CRM/ACL/DAO/Cache.php @@ -0,0 +1,250 @@ +__table = 'civicrm_acl_cache'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'acl_id', 'civicrm_acl', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cache ID') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cache Contact') , + 'description' => 'Foreign Key to Contact', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'acl_id' => array( + 'name' => 'acl_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cache ACL') , + 'description' => 'Foreign Key to ACL', + 'required' => true, + 'FKClassName' => 'CRM_ACL_DAO_ACL', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Cache Modified Date') , + 'description' => 'When was this cache entry last modified', + 'required' => false, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'acl_id' => 'acl_id', + 'modified_date' => 'modified_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['acl_cache'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['acl_cache'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/ACL/DAO/EntityRole.php b/CRM/ACL/DAO/EntityRole.php new file mode 100644 index 0000000000..847b1fae48 --- /dev/null +++ b/CRM/ACL/DAO/EntityRole.php @@ -0,0 +1,263 @@ +__table = 'civicrm_acl_entity_role'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity Role') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'acl_role_id' => array( + 'name' => 'acl_role_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL Role ID') , + 'description' => 'Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Table of the object joined to the ACL Role (Contact or Group)', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL Entity ID') , + 'description' => 'ID of the group/contact object being joined', + 'required' => true, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('ACL Entity Role is Active') , + 'description' => 'Is this property active?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'acl_role_id' => 'acl_role_id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['acl_entity_role'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['acl_entity_role'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Activity/DAO/Activity.php b/CRM/Activity/DAO/Activity.php new file mode 100644 index 0000000000..eb8c980aea --- /dev/null +++ b/CRM/Activity/DAO/Activity.php @@ -0,0 +1,661 @@ +__table = 'civicrm_activity'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_activity', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_id', 'civicrm_relationship', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'original_id', 'civicrm_activity', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'activity_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity ID') , + 'description' => 'Unique Other Activity ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_activity.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'source_record_id' => array( + 'name' => 'source_record_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Source Record') , + 'description' => 'Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry.', + ) , + 'activity_type_id' => array( + 'name' => 'activity_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity Type ID') , + 'description' => 'FK to civicrm_option_value.id, that has to be valid, registered activity type.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_activity.activity_type_id', + 'headerPattern' => '/(activity.)?type(.id$)/i', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_type', + 'optionEditPath' => 'civicrm/admin/options/activity_type', + ) + ) , + 'activity_subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Subject') , + 'description' => 'The subject/purpose/short description of the activity.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_activity.subject', + 'headerPattern' => '/(activity.)?subject/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'activity_date_time' => array( + 'name' => 'activity_date_time', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Activity Date') , + 'description' => 'Date and time this activity is scheduled to occur. Formerly named scheduled_date_time.', + 'import' => true, + 'where' => 'civicrm_activity.activity_date_time', + 'headerPattern' => '/(activity.)?date(.time$)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'activity_duration' => array( + 'name' => 'duration', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Duration') , + 'description' => 'Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes.', + 'import' => true, + 'where' => 'civicrm_activity.duration', + 'headerPattern' => '/(activity.)?duration(s)?$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'activity_location' => array( + 'name' => 'location', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Location') , + 'description' => 'Location of the activity (optional, open text).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_activity.location', + 'headerPattern' => '/(activity.)?location$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'phone_id' => array( + 'name' => 'phone_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone (called) ID') , + 'description' => 'Phone ID of the number called (optional - used if an existing phone number is selected).', + 'FKClassName' => 'CRM_Core_DAO_Phone', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'phone_number' => array( + 'name' => 'phone_number', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Phone (called) Number') , + 'description' => 'Phone number in case the number does not exist in the civicrm_phone table.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'activity_details' => array( + 'name' => 'details', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Details') , + 'description' => 'Details about the activity (agenda, notes, etc).', + 'import' => true, + 'where' => 'civicrm_activity.details', + 'headerPattern' => '/(activity.)?detail(s)?$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'activity_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity Status') , + 'description' => 'ID of the status this activity is currently in. Foreign key to civicrm_option_value.', + 'import' => true, + 'where' => 'civicrm_activity.status_id', + 'headerPattern' => '/(activity.)?status(.label$)?/i', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_status', + 'optionEditPath' => 'civicrm/admin/options/activity_status', + ) + ) , + 'priority_id' => array( + 'name' => 'priority_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Priority') , + 'description' => 'ID of the priority given to this activity. Foreign key to civicrm_option_value.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'priority', + 'optionEditPath' => 'civicrm/admin/options/priority', + ) + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent Activity Id') , + 'description' => 'Parent meeting ID (if this is a follow-up item). This is not currently implemented', + 'FKClassName' => 'CRM_Activity_DAO_Activity', + ) , + 'activity_is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_activity.is_test', + 'headerPattern' => '/(is.)?test(.activity)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'activity_medium_id' => array( + 'name' => 'medium_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity Medium') , + 'description' => 'Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium.', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'encounter_medium', + 'optionEditPath' => 'civicrm/admin/options/encounter_medium', + ) + ) , + 'is_auto' => array( + 'name' => 'is_auto', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Auto') , + ) , + 'relationship_id' => array( + 'name' => 'relationship_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship Id') , + 'description' => 'FK to Relationship ID', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Contact_DAO_Relationship', + ) , + 'is_current_revision' => array( + 'name' => 'is_current_revision', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is this activity a current revision in versioning chain?') , + 'import' => true, + 'where' => 'civicrm_activity.is_current_revision', + 'headerPattern' => '/(is.)?(current.)?(revision|version(ing)?)/i', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'original_id' => array( + 'name' => 'original_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Original Activity ID ') , + 'description' => 'Activity ID of the first activity record in versioning chain.', + 'FKClassName' => 'CRM_Activity_DAO_Activity', + ) , + 'activity_result' => array( + 'name' => 'result', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Result') , + 'description' => 'Currently being used to store result id for survey activity, FK to option value.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'activity_is_deleted' => array( + 'name' => 'is_deleted', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Activity is in the Trash') , + 'import' => true, + 'where' => 'civicrm_activity.is_deleted', + 'headerPattern' => '/(activity.)?(trash|deleted)/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'activity_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this activity has been triggered.', + 'import' => true, + 'where' => 'civicrm_activity.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'CheckBox', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'activity_engagement_level' => array( + 'name' => 'engagement_level', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Engagement Index') , + 'description' => 'Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement.', + 'import' => true, + 'where' => 'civicrm_activity.engagement_level', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'engagement_index', + 'optionEditPath' => 'civicrm/admin/options/engagement_index', + ) + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'activity_id', + 'source_record_id' => 'source_record_id', + 'activity_type_id' => 'activity_type_id', + 'subject' => 'activity_subject', + 'activity_date_time' => 'activity_date_time', + 'duration' => 'activity_duration', + 'location' => 'activity_location', + 'phone_id' => 'phone_id', + 'phone_number' => 'phone_number', + 'details' => 'activity_details', + 'status_id' => 'activity_status_id', + 'priority_id' => 'priority_id', + 'parent_id' => 'parent_id', + 'is_test' => 'activity_is_test', + 'medium_id' => 'activity_medium_id', + 'is_auto' => 'is_auto', + 'relationship_id' => 'relationship_id', + 'is_current_revision' => 'is_current_revision', + 'original_id' => 'original_id', + 'result' => 'activity_result', + 'is_deleted' => 'activity_is_deleted', + 'campaign_id' => 'activity_campaign_id', + 'engagement_level' => 'activity_engagement_level', + 'weight' => 'weight', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['activity'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['activity'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Activity/DAO/ActivityContact.php b/CRM/Activity/DAO/ActivityContact.php new file mode 100644 index 0000000000..f4c4fd1a4e --- /dev/null +++ b/CRM/Activity/DAO/ActivityContact.php @@ -0,0 +1,262 @@ +__table = 'civicrm_activity_contact'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'activity_id', 'civicrm_activity', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity Contact ID') , + 'description' => 'Activity contact id', + 'required' => true, + ) , + 'activity_id' => array( + 'name' => 'activity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity ID') , + 'description' => 'Foreign key to the activity for this record.', + 'required' => true, + 'FKClassName' => 'CRM_Activity_DAO_Activity', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID (match to contact)') , + 'description' => 'Foreign key to the contact for this record.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_activity_contact.contact_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'record_type_id' => array( + 'name' => 'record_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Record Type ID') , + 'description' => 'Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_contacts', + 'optionEditPath' => 'civicrm/admin/options/activity_contacts', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'activity_id' => 'activity_id', + 'contact_id' => 'contact_id', + 'record_type_id' => 'record_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['activity_contact'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['activity_contact'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Batch/DAO/Batch.php b/CRM/Batch/DAO/Batch.php new file mode 100644 index 0000000000..6f162d9c18 --- /dev/null +++ b/CRM/Batch/DAO/Batch.php @@ -0,0 +1,477 @@ +__table = 'civicrm_batch'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch ID') , + 'description' => 'Unique Address ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Batch Name') , + 'description' => 'Variable name/programmatic handle for this batch.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Batch Title') , + 'description' => 'Friendly Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Batch Description') , + 'description' => 'Description of this batch set.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Created By') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Batch Created Date') , + 'description' => 'When was this item created', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'modified_id' => array( + 'name' => 'modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Modified By') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Batch Modified Date') , + 'description' => 'When was this item created', + ) , + 'saved_search_id' => array( + 'name' => 'saved_search_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Smart Group') , + 'description' => 'FK to Saved Search ID', + 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Status') , + 'description' => 'fk to Batch Status options in civicrm_option_values', + 'required' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'batch_status', + 'optionEditPath' => 'civicrm/admin/options/batch_status', + ) + ) , + 'type_id' => array( + 'name' => 'type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Type') , + 'description' => 'fk to Batch Type options in civicrm_option_values', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'batch_type', + 'optionEditPath' => 'civicrm/admin/options/batch_type', + ) + ) , + 'mode_id' => array( + 'name' => 'mode_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Mode') , + 'description' => 'fk to Batch mode options in civicrm_option_values', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'batch_mode', + 'optionEditPath' => 'civicrm/admin/options/batch_mode', + ) + ) , + 'total' => array( + 'name' => 'total', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Batch Total') , + 'description' => 'Total amount for this batch.', + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'item_count' => array( + 'name' => 'item_count', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Number of Items') , + 'description' => 'Number of items in a batch.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch Payment Method') , + 'description' => 'fk to Payment Instrument options in civicrm_option_values', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + 'exported_date' => array( + 'name' => 'exported_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Batch Exported Date') , + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Batch Data') , + 'description' => 'cache entered data', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'modified_id' => 'modified_id', + 'modified_date' => 'modified_date', + 'saved_search_id' => 'saved_search_id', + 'status_id' => 'status_id', + 'type_id' => 'type_id', + 'mode_id' => 'mode_id', + 'total' => 'total', + 'item_count' => 'item_count', + 'payment_instrument_id' => 'payment_instrument_id', + 'exported_date' => 'exported_date', + 'data' => 'data', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['batch'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['batch'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Batch/DAO/EntityBatch.php b/CRM/Batch/DAO/EntityBatch.php new file mode 100644 index 0000000000..5befda0f42 --- /dev/null +++ b/CRM/Batch/DAO/EntityBatch.php @@ -0,0 +1,251 @@ +__table = 'civicrm_entity_batch'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'batch_id', 'civicrm_batch', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('EntityBatch ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('EntityBatch Table') , + 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'batch_id' => array( + 'name' => 'batch_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Batch ID') , + 'description' => 'FK to civicrm_batch', + 'required' => true, + 'FKClassName' => 'CRM_Batch_DAO_Batch', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'batch_id' => 'batch_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['entity_batch'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['entity_batch'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Campaign/DAO/Campaign.php b/CRM/Campaign/DAO/Campaign.php new file mode 100644 index 0000000000..dac96fd259 --- /dev/null +++ b/CRM/Campaign/DAO/Campaign.php @@ -0,0 +1,528 @@ +__table = 'civicrm_campaign'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign ID') , + 'description' => 'Unique Campaign ID.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_campaign.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Campaign Name') , + 'description' => 'Name of the Campaign.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_campaign.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Campaign Title') , + 'description' => 'Title of the Campaign.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_campaign.title', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Campaign Description') , + 'description' => 'Full description of Campaign.', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Campaign Start Date') , + 'description' => 'Date and time that Campaign starts.', + 'import' => true, + 'where' => 'civicrm_campaign.start_date', + 'headerPattern' => '/^start|(s(tart\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Campaign End Date') , + 'description' => 'Date and time that Campaign ends.', + 'import' => true, + 'where' => 'civicrm_campaign.end_date', + 'headerPattern' => '/^end|(e(nd\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'campaign_type_id' => array( + 'name' => 'campaign_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign Type') , + 'description' => 'Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type', + 'import' => true, + 'where' => 'civicrm_campaign.campaign_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'campaign_type', + 'optionEditPath' => 'civicrm/admin/options/campaign_type', + ) + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign Status') , + 'description' => 'Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status', + 'import' => true, + 'where' => 'civicrm_campaign.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'campaign_status', + 'optionEditPath' => 'civicrm/admin/options/campaign_status', + ) + ) , + 'external_identifier' => array( + 'name' => 'external_identifier', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Campaign External ID') , + 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'import' => true, + 'where' => 'civicrm_campaign.external_identifier', + 'headerPattern' => '/external\s?id/i', + 'dataPattern' => '/^\d{11,}$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent Campaign') , + 'description' => 'Optional parent id for this Campaign.', + 'import' => true, + 'where' => 'civicrm_campaign.parent_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Campaign Active?') , + 'description' => 'Is this Campaign enabled or disabled/cancelled?', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign Created By') , + 'description' => 'FK to civicrm_contact, who created this Campaign.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Campaign Created Date') , + 'description' => 'Date and time that Campaign was created.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'last_modified_id' => array( + 'name' => 'last_modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign Modified By') , + 'description' => 'FK to civicrm_contact, who recently edited this Campaign.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'last_modified_date' => array( + 'name' => 'last_modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Campaign Modified Date') , + 'description' => 'Date and time that Campaign was edited last time.', + ) , + 'goal_general' => array( + 'name' => 'goal_general', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Campaign Goals') , + 'description' => 'General goals for Campaign.', + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'goal_revenue' => array( + 'name' => 'goal_revenue', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Goal Revenue') , + 'description' => 'The target revenue for this campaign.', + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'campaign_type_id' => 'campaign_type_id', + 'status_id' => 'status_id', + 'external_identifier' => 'external_identifier', + 'parent_id' => 'parent_id', + 'is_active' => 'is_active', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'last_modified_id' => 'last_modified_id', + 'last_modified_date' => 'last_modified_date', + 'goal_general' => 'goal_general', + 'goal_revenue' => 'goal_revenue', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['campaign'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['campaign'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Campaign/DAO/CampaignGroup.php b/CRM/Campaign/DAO/CampaignGroup.php new file mode 100644 index 0000000000..df2216779d --- /dev/null +++ b/CRM/Campaign/DAO/CampaignGroup.php @@ -0,0 +1,279 @@ +__table = 'civicrm_campaign_group'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign Group ID') , + 'description' => 'Campaign Group id.', + 'required' => true, + ) , + 'campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'Foreign key to the activity Campaign.', + 'required' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'group_type' => array( + 'name' => 'group_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Campaign Group Type') , + 'description' => 'Type of Group.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes', + ) + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Name of table where item being referenced is stored.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'default' => 'NULL', + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'Entity id of referenced table.', + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'campaign_id' => 'campaign_id', + 'group_type' => 'group_type', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['campaign_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['campaign_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php new file mode 100644 index 0000000000..ee4e8f1dee --- /dev/null +++ b/CRM/Campaign/DAO/Survey.php @@ -0,0 +1,508 @@ +__table = 'civicrm_survey'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey ID') , + 'description' => 'Survey id.', + 'required' => true, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Survey Title') , + 'description' => 'Title of the Survey.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_survey.title', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey Campaign ID') , + 'description' => 'Foreign key to the Campaign.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'activity_type_id' => array( + 'name' => 'activity_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity Type') , + 'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type', + 'import' => true, + 'where' => 'civicrm_survey.activity_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'activity_type', + 'optionEditPath' => 'civicrm/admin/options/activity_type', + ) + ) , + 'recontact_interval' => array( + 'name' => 'recontact_interval', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Follow up Interval') , + 'description' => 'Recontact intervals for each status.', + 'rows' => 20, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'instructions' => array( + 'name' => 'instructions', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Instructions') , + 'description' => 'Script instructions for volunteers to use for the survey.', + 'rows' => 20, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'release_frequency' => array( + 'name' => 'release_frequency', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey Hold Duration') , + 'description' => 'Number of days for recurrence of release.', + 'default' => 'NULL', + ) , + 'max_number_of_contacts' => array( + 'name' => 'max_number_of_contacts', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum number of contacts') , + 'description' => 'Maximum number of contacts to allow for survey.', + 'default' => 'NULL', + ) , + 'default_number_of_contacts' => array( + 'name' => 'default_number_of_contacts', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Default number of contacts') , + 'description' => 'Default number of contacts to allow for survey.', + 'default' => 'NULL', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Survey Is Active') , + 'description' => 'Is this survey enabled or disabled/cancelled?', + 'default' => '1', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Default Survey') , + 'description' => 'Is this default survey?', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey Created By') , + 'description' => 'FK to civicrm_contact, who created this Survey.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Campaign Created Date') , + 'description' => 'Date and time that Survey was created.', + ) , + 'last_modified_id' => array( + 'name' => 'last_modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey Modified') , + 'description' => 'FK to civicrm_contact, who recently edited this Survey.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'last_modified_date' => array( + 'name' => 'last_modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Survey Modified On') , + 'description' => 'Date and time that Survey was edited last time.', + ) , + 'result_id' => array( + 'name' => 'result_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Survey Result') , + 'description' => 'Used to store option group id.', + 'default' => 'NULL', + ) , + 'bypass_confirm' => array( + 'name' => 'bypass_confirm', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('No Email Verification') , + 'description' => 'Bypass the email verification.', + ) , + 'thankyou_title' => array( + 'name' => 'thankyou_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Thank-you Title') , + 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'thankyou_text' => array( + 'name' => 'thankyou_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Thank-you Text') , + 'description' => 'text and html allowed. displayed above result on success page', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_share' => array( + 'name' => 'is_share', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is shared through social media') , + 'description' => 'Can people share the petition through social media?', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'title' => 'title', + 'campaign_id' => 'campaign_id', + 'activity_type_id' => 'activity_type_id', + 'recontact_interval' => 'recontact_interval', + 'instructions' => 'instructions', + 'release_frequency' => 'release_frequency', + 'max_number_of_contacts' => 'max_number_of_contacts', + 'default_number_of_contacts' => 'default_number_of_contacts', + 'is_active' => 'is_active', + 'is_default' => 'is_default', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'last_modified_id' => 'last_modified_id', + 'last_modified_date' => 'last_modified_date', + 'result_id' => 'result_id', + 'bypass_confirm' => 'bypass_confirm', + 'thankyou_title' => 'thankyou_title', + 'thankyou_text' => 'thankyou_text', + 'is_share' => 'is_share', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['survey'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['survey'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Case/DAO/Case.php b/CRM/Case/DAO/Case.php new file mode 100644 index 0000000000..e9e94cfbee --- /dev/null +++ b/CRM/Case/DAO/Case.php @@ -0,0 +1,363 @@ +__table = 'civicrm_case'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_type_id', 'civicrm_case_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'case_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case ID') , + 'description' => 'Unique Case ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_case.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'case_type_id' => array( + 'name' => 'case_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case Type') , + 'description' => 'FK to civicrm_case_type.id', + 'import' => true, + 'where' => 'civicrm_case.case_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'FKClassName' => 'CRM_Case_DAO_CaseType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_case_type', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'case_subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Case Subject') , + 'description' => 'Short name of the case.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_case.subject', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'case_start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Case Start Date') , + 'description' => 'Date on which given case starts.', + 'import' => true, + 'where' => 'civicrm_case.start_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'case_end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Case End Date') , + 'description' => 'Date on which given case ends.', + 'import' => true, + 'where' => 'civicrm_case.end_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'details' => array( + 'name' => 'details', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Details') , + 'description' => 'Details about the meeting (agenda, notes, etc).', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'case_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case Status') , + 'description' => 'Id of case status.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_case.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'case_status', + 'optionEditPath' => 'civicrm/admin/options/case_status', + ) + ) , + 'case_deleted' => array( + 'name' => 'is_deleted', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Case is in the Trash') , + 'import' => true, + 'where' => 'civicrm_case.is_deleted', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'case_id', + 'case_type_id' => 'case_type_id', + 'subject' => 'case_subject', + 'start_date' => 'case_start_date', + 'end_date' => 'case_end_date', + 'details' => 'details', + 'status_id' => 'case_status_id', + 'is_deleted' => 'case_deleted', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['case'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['case'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Case/DAO/CaseActivity.php b/CRM/Case/DAO/CaseActivity.php new file mode 100644 index 0000000000..119868cf76 --- /dev/null +++ b/CRM/Case/DAO/CaseActivity.php @@ -0,0 +1,237 @@ +__table = 'civicrm_case_activity'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'activity_id', 'civicrm_activity', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case Activity ID') , + 'description' => 'Unique case-activity association id', + 'required' => true, + ) , + 'case_id' => array( + 'name' => 'case_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case') , + 'description' => 'Case ID of case-activity association.', + 'required' => true, + 'FKClassName' => 'CRM_Case_DAO_Case', + ) , + 'activity_id' => array( + 'name' => 'activity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Activity ID') , + 'description' => 'Activity ID of case-activity association.', + 'required' => true, + 'FKClassName' => 'CRM_Activity_DAO_Activity', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'case_id' => 'case_id', + 'activity_id' => 'activity_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['case_activity'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['case_activity'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Case/DAO/CaseContact.php b/CRM/Case/DAO/CaseContact.php new file mode 100644 index 0000000000..f0932ef111 --- /dev/null +++ b/CRM/Case/DAO/CaseContact.php @@ -0,0 +1,240 @@ +__table = 'civicrm_case_contact'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case Contact ID') , + 'description' => 'Unique case-contact association id', + 'required' => true, + ) , + 'case_id' => array( + 'name' => 'case_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case') , + 'description' => 'Case ID of case-contact association.', + 'required' => true, + 'FKClassName' => 'CRM_Case_DAO_Case', + ) , + 'case_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Contact ID of contact record given case belongs to.', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'case_id' => 'case_id', + 'contact_id' => 'case_contact_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['case_contact'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['case_contact'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Case/DAO/CaseType.php b/CRM/Case/DAO/CaseType.php new file mode 100644 index 0000000000..ef67aa87dd --- /dev/null +++ b/CRM/Case/DAO/CaseType.php @@ -0,0 +1,294 @@ +__table = 'civicrm_case_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Case Type ID') , + 'description' => 'Autoincremented type id', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Case Type Name') , + 'description' => 'Machine name for Case Type', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Case Type Title') , + 'description' => 'Natural language name for Case Type', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Case Type Description') , + 'description' => 'Description of the Case Type', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Case Type Is Active') , + 'description' => 'Is this entry active?', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Case Type Is Reserved') , + 'description' => 'Is this case type a predefined system type?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Ordering of the case types', + 'required' => true, + 'default' => '1', + ) , + 'definition' => array( + 'name' => 'definition', + 'type' => CRM_Utils_Type::T_BLOB, + 'title' => ts('Case Type Definition') , + 'description' => 'xml definition of case type', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'is_active' => 'is_active', + 'is_reserved' => 'is_reserved', + 'weight' => 'weight', + 'definition' => 'definition', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['case_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['case_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/ACLContactCache.php b/CRM/Contact/DAO/ACLContactCache.php new file mode 100644 index 0000000000..1e53e1b82f --- /dev/null +++ b/CRM/Contact/DAO/ACLContactCache.php @@ -0,0 +1,258 @@ +__table = 'civicrm_acl_contact_cache'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'user_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ACL Contact Cache ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'user_id' => array( + 'name' => 'user_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to civicrm_contact (could be null for anon user)', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to civicrm_contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'operation' => array( + 'name' => 'operation', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Operation') , + 'description' => 'What operation does this user have permission on?', + 'required' => true, + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_ACL_BAO_ACL::operation', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'user_id' => 'user_id', + 'contact_id' => 'contact_id', + 'operation' => 'operation', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['acl_contact_cache'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['acl_contact_cache'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php new file mode 100644 index 0000000000..4379807cfe --- /dev/null +++ b/CRM/Contact/DAO/Contact.php @@ -0,0 +1,1311 @@ +__table = 'civicrm_contact'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'primary_contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'employer_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Unique Contact ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contact.id', + 'headerPattern' => '/internal|contact?|id$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'contact_type' => array( + 'name' => 'contact_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type') , + 'description' => 'Type of Contact.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'export' => true, + 'where' => 'civicrm_contact.contact_type', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ) + ) , + 'contact_sub_type' => array( + 'name' => 'contact_sub_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Subtype') , + 'description' => 'May be used to over-ride contact view and edit templates.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.contact_sub_type', + 'headerPattern' => '/C(ontact )?(subtype|sub-type|sub type)/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NOT NULL', + ) + ) , + 'do_not_email' => array( + 'name' => 'do_not_email', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Do Not Email') , + 'import' => true, + 'where' => 'civicrm_contact.do_not_email', + 'headerPattern' => '/d(o )?(not )?(email)/i', + 'dataPattern' => '/^\d{1,}$/', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'do_not_phone' => array( + 'name' => 'do_not_phone', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Do Not Phone') , + 'import' => true, + 'where' => 'civicrm_contact.do_not_phone', + 'headerPattern' => '/d(o )?(not )?(call|phone)/i', + 'dataPattern' => '/^\d{1,}$/', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'do_not_mail' => array( + 'name' => 'do_not_mail', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Do Not Mail') , + 'import' => true, + 'where' => 'civicrm_contact.do_not_mail', + 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i', + 'dataPattern' => '/^\d{1,}$/', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'do_not_sms' => array( + 'name' => 'do_not_sms', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Do Not Sms') , + 'import' => true, + 'where' => 'civicrm_contact.do_not_sms', + 'headerPattern' => '/d(o )?(not )?(sms)/i', + 'dataPattern' => '/^\d{1,}$/', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'do_not_trade' => array( + 'name' => 'do_not_trade', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Do Not Trade') , + 'import' => true, + 'where' => 'civicrm_contact.do_not_trade', + 'headerPattern' => '/d(o )?(not )?(trade)/i', + 'dataPattern' => '/^\d{1,}$/', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_opt_out' => array( + 'name' => 'is_opt_out', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('No Bulk Emails (User Opt Out)') , + 'description' => 'Has the contact opted out from receiving all bulk email from the organization or site domain?', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contact.is_opt_out', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'legal_identifier' => array( + 'name' => 'legal_identifier', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Legal Identifier') , + 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID. + ', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'import' => true, + 'where' => 'civicrm_contact.legal_identifier', + 'headerPattern' => '/legal\s?id/i', + 'dataPattern' => '/\w+?\d{5,}/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'external_identifier' => array( + 'name' => 'external_identifier', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('External Identifier') , + 'description' => 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.', + 'maxlength' => 64, + 'size' => 8, + 'import' => true, + 'where' => 'civicrm_contact.external_identifier', + 'headerPattern' => '/external\s?id/i', + 'dataPattern' => '/^\d{11,}$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'sort_name' => array( + 'name' => 'sort_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Sort Name') , + 'description' => 'Name used for sorting different contact types', + 'maxlength' => 128, + 'size' => 30, + 'export' => true, + 'where' => 'civicrm_contact.sort_name', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'display_name' => array( + 'name' => 'display_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Display Name') , + 'description' => 'Formatted name representing preferred format for display/print/other output.', + 'maxlength' => 128, + 'size' => 30, + 'export' => true, + 'where' => 'civicrm_contact.display_name', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'nick_name' => array( + 'name' => 'nick_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Nickname') , + 'description' => 'Nickname.', + 'maxlength' => 128, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.nick_name', + 'headerPattern' => '/n(ick\s)name|nick$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'legal_name' => array( + 'name' => 'legal_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Legal Name') , + 'description' => 'Legal Name.', + 'maxlength' => 128, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.legal_name', + 'headerPattern' => '/^legal|(l(egal\s)?name)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'image_URL' => array( + 'name' => 'image_URL', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Image Url') , + 'description' => 'optional URL for preferred image (photo, logo, etc.) to display for this contact.', + 'import' => true, + 'where' => 'civicrm_contact.image_URL', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'File', + ) , + ) , + 'preferred_communication_method' => array( + 'name' => 'preferred_communication_method', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Preferred Communication Method') , + 'description' => 'What is the preferred mode of communication.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.preferred_communication_method', + 'headerPattern' => '/^p(ref\w*\s)?c(omm\w*)|( meth\w*)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'preferred_communication_method', + 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', + ) + ) , + 'preferred_language' => array( + 'name' => 'preferred_language', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Preferred Language') , + 'description' => 'Which language is preferred for communication. FK to languages in civicrm_option_value.', + 'maxlength' => 5, + 'size' => CRM_Utils_Type::SIX, + 'import' => true, + 'where' => 'civicrm_contact.preferred_language', + 'headerPattern' => '/^lang/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'languages', + 'keyColumn' => 'name', + 'optionEditPath' => 'civicrm/admin/options/languages', + ) + ) , + 'preferred_mail_format' => array( + 'name' => 'preferred_mail_format', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Preferred Mail Format') , + 'description' => 'What is the preferred mode of sending an email.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'import' => true, + 'where' => 'civicrm_contact.preferred_mail_format', + 'headerPattern' => '/^p(ref\w*\s)?m(ail\s)?f(orm\w*)$/i', + 'dataPattern' => '', + 'export' => true, + 'default' => 'Both', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::pmf', + ) + ) , + 'hash' => array( + 'name' => 'hash', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Hash') , + 'description' => 'Key for validating requests related to this contact.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'export' => true, + 'where' => 'civicrm_contact.hash', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'api_key' => array( + 'name' => 'api_key', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Api Key') , + 'description' => 'API Key for validating requests related to this contact.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'contact_source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Source') , + 'description' => 'where contact come from, e.g. import, donate module insert...', + 'maxlength' => 255, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.source', + 'headerPattern' => '/(C(ontact\s)?Source)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'first_name' => array( + 'name' => 'first_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('First Name') , + 'description' => 'First Name.', + 'maxlength' => 64, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.first_name', + 'headerPattern' => '/^first|(f(irst\s)?name)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'middle_name' => array( + 'name' => 'middle_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Middle Name') , + 'description' => 'Middle Name.', + 'maxlength' => 64, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.middle_name', + 'headerPattern' => '/^middle|(m(iddle\s)?name)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'last_name' => array( + 'name' => 'last_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Last Name') , + 'description' => 'Last Name.', + 'maxlength' => 64, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.last_name', + 'headerPattern' => '/^last|(l(ast\s)?name)$/i', + 'dataPattern' => '/^\w+(\s\w+)?+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'prefix_id' => array( + 'name' => 'prefix_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Individual Prefix') , + 'description' => 'Prefix or Title for name (Ms, Mr...). FK to prefix ID', + 'import' => true, + 'where' => 'civicrm_contact.prefix_id', + 'headerPattern' => '/^(prefix|title)/i', + 'dataPattern' => '/^(mr|ms|mrs|sir|dr)\.?$/i', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_prefix', + 'optionEditPath' => 'civicrm/admin/options/individual_prefix', + ) + ) , + 'suffix_id' => array( + 'name' => 'suffix_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Individual Suffix') , + 'description' => 'Suffix for name (Jr, Sr...). FK to suffix ID', + 'import' => true, + 'where' => 'civicrm_contact.suffix_id', + 'headerPattern' => '/^suffix$/i', + 'dataPattern' => '/^(sr|jr)\.?|i{2,}$/', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'individual_suffix', + 'optionEditPath' => 'civicrm/admin/options/individual_suffix', + ) + ) , + 'formal_title' => array( + 'name' => 'formal_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Formal Title') , + 'description' => 'Formal (academic or similar) title in front of name. (Prof., Dr. etc.)', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_contact.formal_title', + 'headerPattern' => '/^title/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'communication_style_id' => array( + 'name' => 'communication_style_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Communication Style') , + 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.', + 'export' => true, + 'where' => 'civicrm_contact.communication_style_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'communication_style', + 'optionEditPath' => 'civicrm/admin/options/communication_style', + ) + ) , + 'email_greeting_id' => array( + 'name' => 'email_greeting_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email Greeting ID') , + 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.', + ) , + 'email_greeting_custom' => array( + 'name' => 'email_greeting_custom', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Email Greeting Custom') , + 'description' => 'Custom Email Greeting.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.email_greeting_custom', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'email_greeting_display' => array( + 'name' => 'email_greeting_display', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Email Greeting') , + 'description' => 'Cache Email Greeting.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'postal_greeting_id' => array( + 'name' => 'postal_greeting_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Postal Greeting ID') , + 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'postal_greeting_custom' => array( + 'name' => 'postal_greeting_custom', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Postal Greeting Custom') , + 'description' => 'Custom Postal greeting.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.postal_greeting_custom', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'postal_greeting_display' => array( + 'name' => 'postal_greeting_display', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Postal Greeting') , + 'description' => 'Cache Postal greeting.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'addressee_id' => array( + 'name' => 'addressee_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Addressee ID') , + 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.', + ) , + 'addressee_custom' => array( + 'name' => 'addressee_custom', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Addressee Custom') , + 'description' => 'Custom Addressee.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.addressee_custom', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'addressee_display' => array( + 'name' => 'addressee_display', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Addressee') , + 'description' => 'Cache Addressee.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'job_title' => array( + 'name' => 'job_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Job Title') , + 'description' => 'Job Title', + 'maxlength' => 255, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.job_title', + 'headerPattern' => '/^job|(j(ob\s)?title)$/i', + 'dataPattern' => '//', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'gender_id' => array( + 'name' => 'gender_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Gender') , + 'description' => 'FK to gender ID', + 'import' => true, + 'where' => 'civicrm_contact.gender_id', + 'headerPattern' => '/^gender$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'gender', + 'optionEditPath' => 'civicrm/admin/options/gender', + ) + ) , + 'birth_date' => array( + 'name' => 'birth_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Birth Date') , + 'description' => 'Date of birth', + 'import' => true, + 'where' => 'civicrm_contact.birth_date', + 'headerPattern' => '/^birth|(b(irth\s)?date)|D(\W*)O(\W*)B(\W*)$/i', + 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'is_deceased' => array( + 'name' => 'is_deceased', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Deceased') , + 'import' => true, + 'where' => 'civicrm_contact.is_deceased', + 'headerPattern' => '/i(s\s)?d(eceased)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'deceased_date' => array( + 'name' => 'deceased_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Deceased Date') , + 'description' => 'Date of deceased', + 'import' => true, + 'where' => 'civicrm_contact.deceased_date', + 'headerPattern' => '/^deceased|(d(eceased\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'household_name' => array( + 'name' => 'household_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Household Name') , + 'description' => 'Household Name.', + 'maxlength' => 128, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.household_name', + 'headerPattern' => '/^household|(h(ousehold\s)?name)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'primary_contact_id' => array( + 'name' => 'primary_contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Household Primary Contact ID') , + 'description' => 'Optional FK to Primary Contact for this household.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'organization_name' => array( + 'name' => 'organization_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Organization Name') , + 'description' => 'Organization Name.', + 'maxlength' => 128, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_contact.organization_name', + 'headerPattern' => '/^organization|(o(rganization\s)?name)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'sic_code' => array( + 'name' => 'sic_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Sic Code') , + 'description' => 'Standard Industry Classification Code.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'import' => true, + 'where' => 'civicrm_contact.sic_code', + 'headerPattern' => '/^sic|(s(ic\s)?code)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'user_unique_id' => array( + 'name' => 'user_unique_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Unique ID (OpenID)') , + 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contact.user_unique_id', + 'headerPattern' => '/^Open\s?ID|u(niq\w*)?\s?ID/i', + 'dataPattern' => '/^[\w\/\:\.]+$/', + 'export' => true, + 'rule' => 'url', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'current_employer_id' => array( + 'name' => 'employer_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Current Employer') , + 'description' => 'OPTIONAL FK to civicrm_contact record.', + 'export' => true, + 'where' => 'civicrm_contact.employer_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'contact_is_deleted' => array( + 'name' => 'is_deleted', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Contact is in Trash') , + 'required' => true, + 'export' => true, + 'where' => 'civicrm_contact.is_deleted', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Created Date') , + 'description' => 'When was the contact was created.', + 'required' => false, + 'export' => true, + 'where' => 'civicrm_contact.created_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'default' => 'NULL', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Modified Date') , + 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.', + 'required' => false, + 'export' => true, + 'where' => 'civicrm_contact.modified_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_type' => 'contact_type', + 'contact_sub_type' => 'contact_sub_type', + 'do_not_email' => 'do_not_email', + 'do_not_phone' => 'do_not_phone', + 'do_not_mail' => 'do_not_mail', + 'do_not_sms' => 'do_not_sms', + 'do_not_trade' => 'do_not_trade', + 'is_opt_out' => 'is_opt_out', + 'legal_identifier' => 'legal_identifier', + 'external_identifier' => 'external_identifier', + 'sort_name' => 'sort_name', + 'display_name' => 'display_name', + 'nick_name' => 'nick_name', + 'legal_name' => 'legal_name', + 'image_URL' => 'image_URL', + 'preferred_communication_method' => 'preferred_communication_method', + 'preferred_language' => 'preferred_language', + 'preferred_mail_format' => 'preferred_mail_format', + 'hash' => 'hash', + 'api_key' => 'api_key', + 'source' => 'contact_source', + 'first_name' => 'first_name', + 'middle_name' => 'middle_name', + 'last_name' => 'last_name', + 'prefix_id' => 'prefix_id', + 'suffix_id' => 'suffix_id', + 'formal_title' => 'formal_title', + 'communication_style_id' => 'communication_style_id', + 'email_greeting_id' => 'email_greeting_id', + 'email_greeting_custom' => 'email_greeting_custom', + 'email_greeting_display' => 'email_greeting_display', + 'postal_greeting_id' => 'postal_greeting_id', + 'postal_greeting_custom' => 'postal_greeting_custom', + 'postal_greeting_display' => 'postal_greeting_display', + 'addressee_id' => 'addressee_id', + 'addressee_custom' => 'addressee_custom', + 'addressee_display' => 'addressee_display', + 'job_title' => 'job_title', + 'gender_id' => 'gender_id', + 'birth_date' => 'birth_date', + 'is_deceased' => 'is_deceased', + 'deceased_date' => 'deceased_date', + 'household_name' => 'household_name', + 'primary_contact_id' => 'primary_contact_id', + 'organization_name' => 'organization_name', + 'sic_code' => 'sic_code', + 'user_unique_id' => 'user_unique_id', + 'employer_id' => 'current_employer_id', + 'is_deleted' => 'contact_is_deleted', + 'created_date' => 'created_date', + 'modified_date' => 'modified_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contact'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contact'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/ContactType.php b/CRM/Contact/DAO/ContactType.php new file mode 100644 index 0000000000..3a6e37cb83 --- /dev/null +++ b/CRM/Contact/DAO/ContactType.php @@ -0,0 +1,315 @@ +__table = 'civicrm_contact_type'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_contact_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact Type ID') , + 'description' => 'Contact Type ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Internal name of Contact Type (or Subtype).', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type Label') , + 'description' => 'localized Name of Contact Type.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Contact Type Description') , + 'description' => 'localized Optional verbose description of the type.', + 'rows' => 2, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'image_URL' => array( + 'name' => 'image_URL', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type Image URL') , + 'description' => 'URL of image if any.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact Type Parent') , + 'description' => 'Optional FK to parent contact type.', + 'FKClassName' => 'CRM_Contact_DAO_ContactType', + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'id', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Contact Type Is Active?') , + 'description' => 'Is this entry active?', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Contact Type is Reserved?') , + 'description' => 'Is this contact type a predefined system type', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'label' => 'label', + 'description' => 'description', + 'image_URL' => 'image_URL', + 'parent_id' => 'parent_id', + 'is_active' => 'is_active', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contact_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contact_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/DashboardContact.php b/CRM/Contact/DAO/DashboardContact.php new file mode 100644 index 0000000000..a43c3df781 --- /dev/null +++ b/CRM/Contact/DAO/DashboardContact.php @@ -0,0 +1,327 @@ +__table = 'civicrm_dashboard_contact'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'dashboard_id', 'civicrm_dashboard', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dashboard Contact ID') , + 'required' => true, + ) , + 'dashboard_id' => array( + 'name' => 'dashboard_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dashboard') , + 'description' => 'Dashboard ID', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Dashboard', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dashboard Contact') , + 'description' => 'Contact ID', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'column_no' => array( + 'name' => 'column_no', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Column No') , + 'description' => 'column no for this widget', + ) , + 'is_minimized' => array( + 'name' => 'is_minimized', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Dashlet is Minimized?') , + 'description' => 'Is Minimized?', + ) , + 'is_fullscreen' => array( + 'name' => 'is_fullscreen', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Dashlet is FullScreen?') , + 'description' => 'Is Fullscreen?', + 'default' => '1', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Dashlet is Active?') , + 'description' => 'Is this widget active?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Ordering of the widgets.', + ) , + 'content' => array( + 'name' => 'content', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Content') , + 'description' => 'dashlet content', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Dashlet Created On') , + 'description' => 'When was content populated', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'dashboard_id' => 'dashboard_id', + 'contact_id' => 'contact_id', + 'column_no' => 'column_no', + 'is_minimized' => 'is_minimized', + 'is_fullscreen' => 'is_fullscreen', + 'is_active' => 'is_active', + 'weight' => 'weight', + 'content' => 'content', + 'created_date' => 'created_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['dashboard_contact'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['dashboard_contact'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/Group.php b/CRM/Contact/DAO/Group.php new file mode 100644 index 0000000000..879b2ac439 --- /dev/null +++ b/CRM/Contact/DAO/Group.php @@ -0,0 +1,484 @@ +__table = 'civicrm_group'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'saved_search_id', 'civicrm_saved_search', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group ID') , + 'description' => 'Group ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Name') , + 'description' => 'Internal name of Group.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Title') , + 'description' => 'Name of Group.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Group Description') , + 'description' => 'Optional verbose description of the group.', + 'rows' => 2, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Source') , + 'description' => 'Module or process which created this group.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'saved_search_id' => array( + 'name' => 'saved_search_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Saved Search ID') , + 'description' => 'FK to saved search table.', + 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Group Enabled') , + 'description' => 'Is this entry active?', + ) , + 'visibility' => array( + 'name' => 'visibility', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Visibility Setting') , + 'description' => 'In what context(s) is this field visible.', + 'maxlength' => 24, + 'size' => CRM_Utils_Type::MEDIUM, + 'default' => 'User and User Admin Only', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::groupVisibility', + ) + ) , + 'where_clause' => array( + 'name' => 'where_clause', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Group Where Clause') , + 'description' => 'the sql where clause if a saved search acl', + ) , + 'select_tables' => array( + 'name' => 'select_tables', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Tables For Select Clause') , + 'description' => 'the tables to be included in a select data', + ) , + 'where_tables' => array( + 'name' => 'where_tables', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Tables For Where Clause') , + 'description' => 'the tables to be included in the count statement', + ) , + 'group_type' => array( + 'name' => 'group_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Type') , + 'description' => 'FK to group type', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'pseudoconstant' => array( + 'optionGroupName' => 'group_type', + 'optionEditPath' => 'civicrm/admin/options/group_type', + ) + ) , + 'cache_date' => array( + 'name' => 'cache_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Group Cache Date') , + 'description' => 'Date when we created the cache for a smart group', + 'required' => false, + ) , + 'refresh_date' => array( + 'name' => 'refresh_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Next Group Refresh Time') , + 'description' => 'Date and time when we need to refresh the cache next.', + 'required' => false, + ) , + 'parents' => array( + 'name' => 'parents', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Group Parents') , + 'description' => 'IDs of the parent(s)', + ) , + 'children' => array( + 'name' => 'children', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Group Children') , + 'description' => 'IDs of the child(ren)', + ) , + 'is_hidden' => array( + 'name' => 'is_hidden', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Group is Hidden') , + 'description' => 'Is this group hidden?', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Group is Reserved') , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Created By') , + 'description' => 'FK to contact table.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'modified_id' => array( + 'name' => 'modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Modified By') , + 'description' => 'FK to contact table.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'source' => 'source', + 'saved_search_id' => 'saved_search_id', + 'is_active' => 'is_active', + 'visibility' => 'visibility', + 'where_clause' => 'where_clause', + 'select_tables' => 'select_tables', + 'where_tables' => 'where_tables', + 'group_type' => 'group_type', + 'cache_date' => 'cache_date', + 'refresh_date' => 'refresh_date', + 'parents' => 'parents', + 'children' => 'children', + 'is_hidden' => 'is_hidden', + 'is_reserved' => 'is_reserved', + 'created_id' => 'created_id', + 'modified_id' => 'modified_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/GroupContact.php b/CRM/Contact/DAO/GroupContact.php new file mode 100644 index 0000000000..5e50b7a663 --- /dev/null +++ b/CRM/Contact/DAO/GroupContact.php @@ -0,0 +1,296 @@ +__table = 'civicrm_group_contact'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_id', 'civicrm_loc_block', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Contact ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group ID') , + 'description' => 'FK to civicrm_group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to civicrm_contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'status' => array( + 'name' => 'status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Contact Status') , + 'description' => 'status of contact relative to membership in group', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::groupContactStatus', + ) + ) , + 'location_id' => array( + 'name' => 'location_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Contact Location') , + 'description' => 'Optional location to associate with this membership', + 'FKClassName' => 'CRM_Core_DAO_LocBlock', + ) , + 'email_id' => array( + 'name' => 'email_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Contact Email') , + 'description' => 'Optional email to associate with this membership', + 'FKClassName' => 'CRM_Core_DAO_Email', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'group_id' => 'group_id', + 'contact_id' => 'contact_id', + 'status' => 'status', + 'location_id' => 'location_id', + 'email_id' => 'email_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['group_contact'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['group_contact'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/GroupContactCache.php b/CRM/Contact/DAO/GroupContactCache.php new file mode 100644 index 0000000000..f011bbf53e --- /dev/null +++ b/CRM/Contact/DAO/GroupContactCache.php @@ -0,0 +1,245 @@ +__table = 'civicrm_group_contact_cache'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Contact Cache ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group') , + 'description' => 'FK to civicrm_group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to civicrm_contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'group_id' => 'group_id', + 'contact_id' => 'contact_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['group_contact_cache'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['group_contact_cache'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/GroupNesting.php b/CRM/Contact/DAO/GroupNesting.php new file mode 100644 index 0000000000..de78086671 --- /dev/null +++ b/CRM/Contact/DAO/GroupNesting.php @@ -0,0 +1,237 @@ +__table = 'civicrm_group_nesting'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'child_group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_group_id', 'civicrm_group', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Nesting ID') , + 'description' => 'Relationship ID', + 'required' => true, + ) , + 'child_group_id' => array( + 'name' => 'child_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Child Group') , + 'description' => 'ID of the child group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + ) , + 'parent_group_id' => array( + 'name' => 'parent_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent Group') , + 'description' => 'ID of the parent group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'child_group_id' => 'child_group_id', + 'parent_group_id' => 'parent_group_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['group_nesting'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['group_nesting'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/GroupOrganization.php b/CRM/Contact/DAO/GroupOrganization.php new file mode 100644 index 0000000000..4acd24fa48 --- /dev/null +++ b/CRM/Contact/DAO/GroupOrganization.php @@ -0,0 +1,245 @@ +__table = 'civicrm_group_organization'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'organization_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Organization ID') , + 'description' => 'Relationship ID', + 'required' => true, + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group') , + 'description' => 'ID of the group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'organization_id' => array( + 'name' => 'organization_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Organization') , + 'description' => 'ID of the Organization Contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'group_id' => 'group_id', + 'organization_id' => 'organization_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['group_organization'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['group_organization'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php new file mode 100644 index 0000000000..507da66ed9 --- /dev/null +++ b/CRM/Contact/DAO/Relationship.php @@ -0,0 +1,380 @@ +__table = 'civicrm_relationship'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_a', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id_b', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship ID') , + 'description' => 'Relationship ID', + 'required' => true, + ) , + 'contact_id_a' => array( + 'name' => 'contact_id_a', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact A') , + 'description' => 'id of the first contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'contact_id_b' => array( + 'name' => 'contact_id_b', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact B') , + 'description' => 'id of the second contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'relationship_type_id' => array( + 'name' => 'relationship_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship Type') , + 'description' => 'id of the relationship', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Relationship Start Date') , + 'description' => 'date when the relationship started', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Relationship End Date') , + 'description' => 'date when the relationship ended', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Relationship Is Active') , + 'description' => 'is the relationship active ?', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Description') , + 'description' => 'Optional verbose description for the relationship.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_permission_a_b' => array( + 'name' => 'is_permission_a_b', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Contact A has Permission Over Contact B') , + 'description' => 'is contact a has permission to view / edit contact and + related data for contact b ? + ', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_permission_b_a' => array( + 'name' => 'is_permission_b_a', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Contact B has Permission Over Contact A') , + 'description' => 'is contact b has permission to view / edit contact and + related data for contact a ? + ', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'case_id' => array( + 'name' => 'case_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship Case') , + 'description' => 'FK to civicrm_case', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Case_DAO_Case', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id_a' => 'contact_id_a', + 'contact_id_b' => 'contact_id_b', + 'relationship_type_id' => 'relationship_type_id', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'is_active' => 'is_active', + 'description' => 'description', + 'is_permission_a_b' => 'is_permission_a_b', + 'is_permission_b_a' => 'is_permission_b_a', + 'case_id' => 'case_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['relationship'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['relationship'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/RelationshipType.php b/CRM/Contact/DAO/RelationshipType.php new file mode 100644 index 0000000000..a3a53f12c5 --- /dev/null +++ b/CRM/Contact/DAO/RelationshipType.php @@ -0,0 +1,394 @@ +__table = 'civicrm_relationship_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship Type ID') , + 'description' => 'Primary key', + 'required' => true, + ) , + 'name_a_b' => array( + 'name' => 'name_a_b', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Type Name A to B') , + 'description' => 'name for relationship of contact_a to contact_b.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'label_a_b' => array( + 'name' => 'label_a_b', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Type Label A to B') , + 'description' => 'label for relationship of contact_a to contact_b.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'name_b_a' => array( + 'name' => 'name_b_a', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Type Name B to A') , + 'description' => 'Optional name for relationship of contact_b to contact_a.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'label_b_a' => array( + 'name' => 'label_b_a', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Type Label B to A') , + 'description' => 'Optional label for relationship of contact_b to contact_a.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Description') , + 'description' => 'Optional verbose description of the relationship type.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'contact_type_a' => array( + 'name' => 'contact_type_a', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type for Contact A') , + 'description' => 'If defined, contact_a in a relationship of this type must be a specific contact_type.', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ) + ) , + 'contact_type_b' => array( + 'name' => 'contact_type_b', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type for Contact B') , + 'description' => 'If defined, contact_b in a relationship of this type must be a specific contact_type.', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ) + ) , + 'contact_sub_type_a' => array( + 'name' => 'contact_sub_type_a', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Subtype A') , + 'description' => 'If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type. + ', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NOT NULL', + ) + ) , + 'contact_sub_type_b' => array( + 'name' => 'contact_sub_type_b', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Subtype B') , + 'description' => 'If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type. + ', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NOT NULL', + ) + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Relationship Type is Reserved') , + 'description' => 'Is this relationship type a predefined system type (can not be changed or de-activated)?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Relationship Type is Active') , + 'description' => 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)? + ', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name_a_b' => 'name_a_b', + 'label_a_b' => 'label_a_b', + 'name_b_a' => 'name_b_a', + 'label_b_a' => 'label_b_a', + 'description' => 'description', + 'contact_type_a' => 'contact_type_a', + 'contact_type_b' => 'contact_type_b', + 'contact_sub_type_a' => 'contact_sub_type_a', + 'contact_sub_type_b' => 'contact_sub_type_b', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['relationship_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['relationship_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/SavedSearch.php b/CRM/Contact/DAO/SavedSearch.php new file mode 100644 index 0000000000..45f3ae2ec0 --- /dev/null +++ b/CRM/Contact/DAO/SavedSearch.php @@ -0,0 +1,290 @@ +__table = 'civicrm_saved_search'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Saved Search ID') , + 'description' => 'Saved Search ID', + 'required' => true, + ) , + 'form_values' => array( + 'name' => 'form_values', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Submitted Form Values') , + 'description' => 'Submitted form values for this search', + 'import' => true, + 'where' => 'civicrm_saved_search.form_values', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'mapping_id' => array( + 'name' => 'mapping_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mapping ID') , + 'description' => 'Foreign key to civicrm_mapping used for saved search-builder searches.', + 'FKClassName' => 'CRM_Core_DAO_Mapping', + ) , + 'search_custom_id' => array( + 'name' => 'search_custom_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Value ID') , + 'description' => 'Foreign key to civicrm_option value table used for saved custom searches.', + ) , + 'where_clause' => array( + 'name' => 'where_clause', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Where Clause') , + 'description' => 'the sql where clause if a saved search acl', + ) , + 'select_tables' => array( + 'name' => 'select_tables', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Select Tables') , + 'description' => 'the tables to be included in a select data', + ) , + 'where_tables' => array( + 'name' => 'where_tables', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Where Tables') , + 'description' => 'the tables to be included in the count statement', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'form_values' => 'form_values', + 'mapping_id' => 'mapping_id', + 'search_custom_id' => 'search_custom_id', + 'where_clause' => 'where_clause', + 'select_tables' => 'select_tables', + 'where_tables' => 'where_tables', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['saved_search'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['saved_search'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contact/DAO/SubscriptionHistory.php b/CRM/Contact/DAO/SubscriptionHistory.php new file mode 100644 index 0000000000..aba3fe6379 --- /dev/null +++ b/CRM/Contact/DAO/SubscriptionHistory.php @@ -0,0 +1,312 @@ +__table = 'civicrm_subscription_history'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Membership History ID') , + 'description' => 'Internal Id', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Contact Id', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group') , + 'description' => 'Group Id', + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'date' => array( + 'name' => 'date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Group Membership Action Date') , + 'description' => 'Date of the (un)subscription', + 'required' => true, + ) , + 'method' => array( + 'name' => 'method', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Membership Action') , + 'description' => 'How the (un)subscription was triggered', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods', + ) + ) , + 'status' => array( + 'name' => 'status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Membership Status') , + 'description' => 'The state of the contact within the group', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::groupContactStatus', + ) + ) , + 'tracking' => array( + 'name' => 'tracking', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Membership Tracking') , + 'description' => 'IP address or other tracking info', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'group_id' => 'group_id', + 'date' => 'date', + 'method' => 'method', + 'status' => 'status', + 'tracking' => 'tracking', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['subscription_history'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['subscription_history'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/Contribution.php b/CRM/Contribute/DAO/Contribution.php new file mode 100644 index 0000000000..a3ee81057a --- /dev/null +++ b/CRM/Contribute/DAO/Contribution.php @@ -0,0 +1,841 @@ +__table = 'civicrm_contribution'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'contribution_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution ID') , + 'description' => 'Contribution ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contribution.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'contribution_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contribution.contact_id', + 'headerPattern' => '/contact(.?id)?/i', + 'dataPattern' => '/^\d+$/', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type for (total_amount - non_deductible_amount).', + 'export' => false, + 'where' => 'civicrm_contribution.financial_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'contribution_page_id' => array( + 'name' => 'contribution_page_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page ID') , + 'description' => 'The Contribution Page which triggered this contribution', + 'import' => true, + 'where' => 'civicrm_contribution.contribution_page_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contribution_page', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Method') , + 'description' => 'FK to Payment Instrument', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + 'receive_date' => array( + 'name' => 'receive_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Date Received') , + 'description' => 'Date contribution was received - not necessarily the creation date of the record', + 'import' => true, + 'where' => 'civicrm_contribution.receive_date', + 'headerPattern' => '/receive(.?date)?/i', + 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'non_deductible_amount' => array( + 'name' => 'non_deductible_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Non-deductible Amount') , + 'description' => 'Portion of total amount which is NOT tax deductible. Equal to total_amount for non-deductible financial types.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution.non_deductible_amount', + 'headerPattern' => '/non?.?deduct/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'total_amount' => array( + 'name' => 'total_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Total Amount') , + 'description' => 'Total amount of this contribution. Use market value for non-monetary gifts.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution.total_amount', + 'headerPattern' => '/^total|(.?^am(ou)?nt)/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'fee_amount' => array( + 'name' => 'fee_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Fee Amount') , + 'description' => 'actual processor fee if known - may be 0.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution.fee_amount', + 'headerPattern' => '/fee(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'net_amount' => array( + 'name' => 'net_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Net Amount') , + 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution.net_amount', + 'headerPattern' => '/net(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'trxn_id' => array( + 'name' => 'trxn_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Transaction ID') , + 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contribution.trxn_id', + 'headerPattern' => '/tr(ansactio|x)n(.?id)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'invoice_id' => array( + 'name' => 'invoice_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Invoice ID') , + 'description' => 'unique invoice id, system generated or passed in', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contribution.invoice_id', + 'headerPattern' => '/invoice(.?id)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'import' => true, + 'where' => 'civicrm_contribution.currency', + 'headerPattern' => '/cur(rency)?/i', + 'dataPattern' => '/^[A-Z]{3}$/i', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'cancel_date' => array( + 'name' => 'cancel_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Cancel Date') , + 'description' => 'when was gift cancelled', + 'import' => true, + 'where' => 'civicrm_contribution.cancel_date', + 'headerPattern' => '/cancel(.?date)?/i', + 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'cancel_reason' => array( + 'name' => 'cancel_reason', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Cancel Reason') , + 'import' => true, + 'where' => 'civicrm_contribution.cancel_reason', + 'headerPattern' => '/(cancel.?)?reason/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'receipt_date' => array( + 'name' => 'receipt_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Receipt Date') , + 'description' => 'when (if) receipt was sent. populated automatically for online donations w/ automatic receipting', + 'import' => true, + 'where' => 'civicrm_contribution.receipt_date', + 'headerPattern' => '/receipt(.?date)?/i', + 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'thankyou_date' => array( + 'name' => 'thankyou_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Thank-you Date') , + 'description' => 'when (if) was donor thanked', + 'import' => true, + 'where' => 'civicrm_contribution.thankyou_date', + 'headerPattern' => '/thank(s|(.?you))?(.?date)?/i', + 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'contribution_source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contribution Source') , + 'description' => 'Origin of this Contribution.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contribution.source', + 'headerPattern' => '/source/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'amount_level' => array( + 'name' => 'amount_level', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Amount Label') , + 'import' => true, + 'where' => 'civicrm_contribution.amount_level', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'contribution_recur_id' => array( + 'name' => 'contribution_recur_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Recurring Contribution ID') , + 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.', + 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', + ) , + 'is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_contribution.is_test', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_pay_later' => array( + 'name' => 'is_pay_later', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Pay Later') , + 'import' => true, + 'where' => 'civicrm_contribution.is_pay_later', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'contribution_status_id' => array( + 'name' => 'contribution_status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Status ID') , + 'import' => true, + 'where' => 'civicrm_contribution.contribution_status_id', + 'headerPattern' => '/status/i', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'contribution_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_status', + ) + ) , + 'address_id' => array( + 'name' => 'address_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Address') , + 'description' => 'Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data.', + 'FKClassName' => 'CRM_Core_DAO_Address', + ) , + 'check_number' => array( + 'name' => 'check_number', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Check Number') , + 'maxlength' => 255, + 'size' => 6, + 'import' => true, + 'where' => 'civicrm_contribution.check_number', + 'headerPattern' => '/check(.?number)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'contribution_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this contribution has been triggered.', + 'import' => true, + 'where' => 'civicrm_contribution.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'creditnote_id' => array( + 'name' => 'creditnote_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Credit Note ID') , + 'description' => 'unique credit note id, system generated or passed in', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_contribution.creditnote_id', + 'headerPattern' => '/creditnote(.?id)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'tax_amount' => array( + 'name' => 'tax_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Tax Amount') , + 'description' => 'Total tax amount of this contribution.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution.tax_amount', + 'headerPattern' => '/tax(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'revenue_recognition_date' => array( + 'name' => 'revenue_recognition_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Revenue Recognition Date') , + 'description' => 'Stores the date when revenue should be recognized.', + 'import' => true, + 'where' => 'civicrm_contribution.revenue_recognition_date', + 'headerPattern' => '/revenue(.?date)?/i', + 'dataPattern' => '/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'contribution_id', + 'contact_id' => 'contribution_contact_id', + 'financial_type_id' => 'financial_type_id', + 'contribution_page_id' => 'contribution_page_id', + 'payment_instrument_id' => 'payment_instrument_id', + 'receive_date' => 'receive_date', + 'non_deductible_amount' => 'non_deductible_amount', + 'total_amount' => 'total_amount', + 'fee_amount' => 'fee_amount', + 'net_amount' => 'net_amount', + 'trxn_id' => 'trxn_id', + 'invoice_id' => 'invoice_id', + 'currency' => 'currency', + 'cancel_date' => 'cancel_date', + 'cancel_reason' => 'cancel_reason', + 'receipt_date' => 'receipt_date', + 'thankyou_date' => 'thankyou_date', + 'source' => 'contribution_source', + 'amount_level' => 'amount_level', + 'contribution_recur_id' => 'contribution_recur_id', + 'is_test' => 'is_test', + 'is_pay_later' => 'is_pay_later', + 'contribution_status_id' => 'contribution_status_id', + 'address_id' => 'address_id', + 'check_number' => 'check_number', + 'campaign_id' => 'contribution_campaign_id', + 'creditnote_id' => 'creditnote_id', + 'tax_amount' => 'tax_amount', + 'revenue_recognition_date' => 'revenue_recognition_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/ContributionPage.php b/CRM/Contribute/DAO/ContributionPage.php new file mode 100644 index 0000000000..573ff2996c --- /dev/null +++ b/CRM/Contribute/DAO/ContributionPage.php @@ -0,0 +1,879 @@ +__table = 'civicrm_contribution_page'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page ID') , + 'description' => 'Contribution Id', + 'required' => true, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contribution Page Title') , + 'description' => 'Contribution Page title. For top of page display', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'intro_text' => array( + 'name' => 'intro_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Contribution Page Introduction Text') , + 'description' => 'Text and html allowed. Displayed below title.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'default financial type assigned to contributions submitted via this page, e.g. Contribution, Campaign Contribution', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'payment_processor' => array( + 'name' => 'payment_processor', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Payment Processor') , + 'description' => 'Payment Processors configured for this contribution Page', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_payment_processor', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'is_credit_card_only' => array( + 'name' => 'is_credit_card_only', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Credit Card Only?') , + 'description' => 'if true - processing logic must reject transaction at confirmation stage if pay method != credit card', + ) , + 'is_monetary' => array( + 'name' => 'is_monetary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Monetary') , + 'description' => 'if true - allows real-time monetary transactions otherwise non-monetary transactions', + 'default' => '1', + ) , + 'is_recur' => array( + 'name' => 'is_recur', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Recurring') , + 'description' => 'if true - allows recurring contributions, valid only for PayPal_Standard', + ) , + 'is_confirm_enabled' => array( + 'name' => 'is_confirm_enabled', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Confirmation Page?') , + 'description' => 'if false, the confirm page in contribution pages gets skipped', + 'default' => '1', + ) , + 'recur_frequency_unit' => array( + 'name' => 'recur_frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Recurring Frequency') , + 'description' => 'Supported recurring frequency units.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_recur_interval' => array( + 'name' => 'is_recur_interval', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Support Recurring Intervals') , + 'description' => 'if true - supports recurring intervals', + ) , + 'is_recur_installments' => array( + 'name' => 'is_recur_installments', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Recurring Installments?') , + 'description' => 'if true - asks user for recurring installments', + ) , + 'adjust_recur_start_date' => array( + 'name' => 'adjust_recur_start_date', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Adjust Recurring Start Date') , + 'description' => 'if true - user is able to adjust payment start date', + ) , + 'is_pay_later' => array( + 'name' => 'is_pay_later', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Pay Later') , + 'description' => 'if true - allows the user to send payment directly to the org later', + ) , + 'pay_later_text' => array( + 'name' => 'pay_later_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Pay Later Text') , + 'description' => 'The text displayed to the user in the main form', + ) , + 'pay_later_receipt' => array( + 'name' => 'pay_later_receipt', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Pay Later Receipt') , + 'description' => 'The receipt sent to the user instead of the normal receipt text', + ) , + 'is_partial_payment' => array( + 'name' => 'is_partial_payment', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Partial Payment') , + 'description' => 'is partial payment enabled for this online contribution page', + ) , + 'initial_amount_label' => array( + 'name' => 'initial_amount_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Initial Amount Label') , + 'description' => 'Initial amount label for partial payment', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'initial_amount_help_text' => array( + 'name' => 'initial_amount_help_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Initial Amount Help Text') , + 'description' => 'Initial amount help text for partial payment', + ) , + 'min_initial_amount' => array( + 'name' => 'min_initial_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Min Initial Amount') , + 'description' => 'Minimum initial amount for partial payment', + 'precision' => array( + 20, + 2 + ) , + ) , + 'is_allow_other_amount' => array( + 'name' => 'is_allow_other_amount', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Other Amounts') , + 'description' => 'if true, page will include an input text field where user can enter their own amount', + ) , + 'default_amount_id' => array( + 'name' => 'default_amount_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Default Amount') , + 'description' => 'FK to civicrm_option_value.', + ) , + 'min_amount' => array( + 'name' => 'min_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Minimum Amount') , + 'description' => 'if other amounts allowed, user can configure minimum allowed.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'max_amount' => array( + 'name' => 'max_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Maximum Amount') , + 'description' => 'if other amounts allowed, user can configure maximum allowed.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'goal_amount' => array( + 'name' => 'goal_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Goal Amount') , + 'description' => 'The target goal for this page, allows people to build a goal meter', + 'precision' => array( + 20, + 2 + ) , + ) , + 'thankyou_title' => array( + 'name' => 'thankyou_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Thank-you Title') , + 'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'thankyou_text' => array( + 'name' => 'thankyou_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Thank-you Text') , + 'description' => 'text and html allowed. displayed above result on success page', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'thankyou_footer' => array( + 'name' => 'thankyou_footer', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Thank-you Footer') , + 'description' => 'Text and html allowed. displayed at the bottom of the success page. Common usage is to include link(s) to other pages such as tell-a-friend, etc.', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'is_email_receipt' => array( + 'name' => 'is_email_receipt', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Send email Receipt') , + 'description' => 'if true, receipt is automatically emailed to contact on success', + ) , + 'receipt_from_name' => array( + 'name' => 'receipt_from_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Receipt From') , + 'description' => 'FROM email name used for receipts generated by contributions to this contribution page.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'receipt_from_email' => array( + 'name' => 'receipt_from_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Receipt From email') , + 'description' => 'FROM email address used for receipts generated by contributions to this contribution page.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'cc_receipt' => array( + 'name' => 'cc_receipt', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Receipt cc') , + 'description' => 'comma-separated list of email addresses to cc each time a receipt is sent', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'bcc_receipt' => array( + 'name' => 'bcc_receipt', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Receipt bcc') , + 'description' => 'comma-separated list of email addresses to bcc each time a receipt is sent', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'receipt_text' => array( + 'name' => 'receipt_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Receipt Text') , + 'description' => 'text to include above standard receipt info on receipt email. emails are text-only, so do not allow html for now', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Page Active?') , + 'description' => 'Is this property active?', + ) , + 'footer_text' => array( + 'name' => 'footer_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Footer Text') , + 'description' => 'Text and html allowed. Displayed at the bottom of the first page of the contribution wizard.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'amount_block_is_active' => array( + 'name' => 'amount_block_is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Amount Block Active?') , + 'description' => 'Is this property active?', + 'default' => '1', + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Contribution Page Start Date') , + 'description' => 'Date and time that this page starts.', + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Contribution Page End Date') , + 'description' => 'Date and time that this page ends. May be NULL if no defined end date/time', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page Created By') , + 'description' => 'FK to civicrm_contact, who created this contribution page', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Contribution Page Created Date') , + 'description' => 'Date and time that contribution page was created.', + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contribution Page Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page Campaign ID') , + 'description' => 'The campaign for which we are collecting contributions with this page.', + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'is_share' => array( + 'name' => 'is_share', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Contribution Page Shared?') , + 'description' => 'Can people share the contribution page through social media?', + 'default' => '1', + ) , + 'is_billing_required' => array( + 'name' => 'is_billing_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is billing block required') , + 'description' => 'if true - billing block is required for online contribution page', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'title' => 'title', + 'intro_text' => 'intro_text', + 'financial_type_id' => 'financial_type_id', + 'payment_processor' => 'payment_processor', + 'is_credit_card_only' => 'is_credit_card_only', + 'is_monetary' => 'is_monetary', + 'is_recur' => 'is_recur', + 'is_confirm_enabled' => 'is_confirm_enabled', + 'recur_frequency_unit' => 'recur_frequency_unit', + 'is_recur_interval' => 'is_recur_interval', + 'is_recur_installments' => 'is_recur_installments', + 'adjust_recur_start_date' => 'adjust_recur_start_date', + 'is_pay_later' => 'is_pay_later', + 'pay_later_text' => 'pay_later_text', + 'pay_later_receipt' => 'pay_later_receipt', + 'is_partial_payment' => 'is_partial_payment', + 'initial_amount_label' => 'initial_amount_label', + 'initial_amount_help_text' => 'initial_amount_help_text', + 'min_initial_amount' => 'min_initial_amount', + 'is_allow_other_amount' => 'is_allow_other_amount', + 'default_amount_id' => 'default_amount_id', + 'min_amount' => 'min_amount', + 'max_amount' => 'max_amount', + 'goal_amount' => 'goal_amount', + 'thankyou_title' => 'thankyou_title', + 'thankyou_text' => 'thankyou_text', + 'thankyou_footer' => 'thankyou_footer', + 'is_email_receipt' => 'is_email_receipt', + 'receipt_from_name' => 'receipt_from_name', + 'receipt_from_email' => 'receipt_from_email', + 'cc_receipt' => 'cc_receipt', + 'bcc_receipt' => 'bcc_receipt', + 'receipt_text' => 'receipt_text', + 'is_active' => 'is_active', + 'footer_text' => 'footer_text', + 'amount_block_is_active' => 'amount_block_is_active', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'currency' => 'currency', + 'campaign_id' => 'campaign_id', + 'is_share' => 'is_share', + 'is_billing_required' => 'is_billing_required', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution_page'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution_page'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/ContributionProduct.php b/CRM/Contribute/DAO/ContributionProduct.php new file mode 100644 index 0000000000..3e51db732a --- /dev/null +++ b/CRM/Contribute/DAO/ContributionProduct.php @@ -0,0 +1,346 @@ +__table = 'civicrm_contribution_product'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Product ID') , + 'required' => true, + ) , + 'product_id' => array( + 'name' => 'product_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Product ID') , + 'required' => true, + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution ID') , + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + 'product_option' => array( + 'name' => 'product_option', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Product Option') , + 'description' => 'Option value selected if applicable - e.g. color, size etc.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'export' => true, + 'where' => 'civicrm_contribution_product.product_option', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'quantity' => array( + 'name' => 'quantity', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Quantity') , + 'export' => true, + 'where' => 'civicrm_contribution_product.quantity', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'fulfilled_date' => array( + 'name' => 'fulfilled_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Fulfilled Date') , + 'description' => 'Optional. Can be used to record the date this product was fulfilled or shipped.', + 'export' => true, + 'where' => 'civicrm_contribution_product.fulfilled_date', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'contribution_start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Start date for premium') , + 'description' => 'Actual start date for a time-delimited premium (subscription, service or membership)', + 'export' => true, + 'where' => 'civicrm_contribution_product.start_date', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'contribution_end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('End date for premium') , + 'description' => 'Actual end date for a time-delimited premium (subscription, service or membership)', + 'export' => true, + 'where' => 'civicrm_contribution_product.end_date', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'comment' => array( + 'name' => 'comment', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Premium comment') , + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type(for membership price sets only).', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'product_id' => 'product_id', + 'contribution_id' => 'contribution_id', + 'product_option' => 'product_option', + 'quantity' => 'quantity', + 'fulfilled_date' => 'fulfilled_date', + 'start_date' => 'contribution_start_date', + 'end_date' => 'contribution_end_date', + 'comment' => 'comment', + 'financial_type_id' => 'financial_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution_product'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution_product'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php new file mode 100644 index 0000000000..3369ccdec4 --- /dev/null +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -0,0 +1,675 @@ +__table = 'civicrm_contribution_recur'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_token_id', 'civicrm_payment_token', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Recurring Contribution ID') , + 'description' => 'Contribution Recur ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Foreign key to civicrm_contact.id .', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Amount') , + 'description' => 'Amount to be contributed or charged each recurrence.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'frequency_unit' => array( + 'name' => 'frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Frequency Unit') , + 'description' => 'Time units for recurrence of payment.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'month', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'recur_frequency_units', + 'keyColumn' => 'name', + 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', + ) + ) , + 'frequency_interval' => array( + 'name' => 'frequency_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Interval (number of units)') , + 'description' => 'Number of time units for recurrence of payment.', + 'required' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'installments' => array( + 'name' => 'installments', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Number of Installments') , + 'description' => 'Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Recurring Contribution Started Date') , + 'description' => 'The date the first scheduled recurring contribution occurs.', + 'required' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'create_date' => array( + 'name' => 'create_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Recurring Contribution Created Date') , + 'description' => 'When this recurring contribution record was created.', + 'required' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Recurring Contribution Modified Date') , + 'description' => 'Last updated date for this record. mostly the last time a payment was received', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'cancel_date' => array( + 'name' => 'cancel_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Recurring Contribution Cancel Date') , + 'description' => 'Date this recurring contribution was cancelled by contributor- if we can get access to it', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Recurring Contribution End Date') , + 'description' => 'Date this recurring contribution finished successfully', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'processor_id' => array( + 'name' => 'processor_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Processor ID') , + 'description' => 'Possibly needed to store a unique identifier for this recurring payment order - if this is available from the processor??', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'payment_token_id' => array( + 'name' => 'payment_token_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Token ID') , + 'description' => 'Optionally used to store a link to a payment token used for this recurring contribution.', + 'FKClassName' => 'CRM_Financial_DAO_PaymentToken', + ) , + 'trxn_id' => array( + 'name' => 'trxn_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Transaction ID') , + 'description' => 'unique transaction id. may be processor id, bank id + trans id, or account number + check number... depending on payment_method', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'invoice_id' => array( + 'name' => 'invoice_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Invoice ID') , + 'description' => 'unique invoice id, system generated or passed in', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'contribution_status_id' => array( + 'name' => 'contribution_status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Recurring Contribution Status') , + 'import' => true, + 'where' => 'civicrm_contribution_recur.contribution_status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'pseudoconstant' => array( + 'optionGroupName' => 'contribution_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_status', + ) + ) , + 'is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_contribution_recur.is_test', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'cycle_day' => array( + 'name' => 'cycle_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Number of Cycle Day') , + 'description' => 'Day in the period when the payment should be charged e.g. 1st of month, 15th etc.', + 'required' => true, + 'default' => '1', + ) , + 'next_sched_contribution_date' => array( + 'name' => 'next_sched_contribution_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Next Scheduled Contribution Date') , + 'description' => 'Next scheduled date', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'failure_count' => array( + 'name' => 'failure_count', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Number of Failures') , + 'description' => 'Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures.', + ) , + 'failure_retry_date' => array( + 'name' => 'failure_retry_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Retry Failed Attempt Date') , + 'description' => 'Date to retry failed attempt', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'auto_renew' => array( + 'name' => 'auto_renew', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Auto Renew') , + 'description' => 'Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel.', + 'required' => true, + ) , + 'payment_processor_id' => array( + 'name' => 'payment_processor_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor') , + 'description' => 'Foreign key to civicrm_payment_processor.id', + 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type', + 'export' => false, + 'where' => 'civicrm_contribution_recur.financial_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Method') , + 'description' => 'FK to Payment Instrument', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + 'contribution_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this contribution has been triggered.', + 'import' => true, + 'where' => 'civicrm_contribution_recur.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'is_email_receipt' => array( + 'name' => 'is_email_receipt', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Send email Receipt?') , + 'description' => 'if true, receipt is automatically emailed to contact on each successful payment', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'amount' => 'amount', + 'currency' => 'currency', + 'frequency_unit' => 'frequency_unit', + 'frequency_interval' => 'frequency_interval', + 'installments' => 'installments', + 'start_date' => 'start_date', + 'create_date' => 'create_date', + 'modified_date' => 'modified_date', + 'cancel_date' => 'cancel_date', + 'end_date' => 'end_date', + 'processor_id' => 'processor_id', + 'payment_token_id' => 'payment_token_id', + 'trxn_id' => 'trxn_id', + 'invoice_id' => 'invoice_id', + 'contribution_status_id' => 'contribution_status_id', + 'is_test' => 'is_test', + 'cycle_day' => 'cycle_day', + 'next_sched_contribution_date' => 'next_sched_contribution_date', + 'failure_count' => 'failure_count', + 'failure_retry_date' => 'failure_retry_date', + 'auto_renew' => 'auto_renew', + 'payment_processor_id' => 'payment_processor_id', + 'financial_type_id' => 'financial_type_id', + 'payment_instrument_id' => 'payment_instrument_id', + 'campaign_id' => 'contribution_campaign_id', + 'is_email_receipt' => 'is_email_receipt', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution_recur'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution_recur'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/ContributionSoft.php b/CRM/Contribute/DAO/ContributionSoft.php new file mode 100644 index 0000000000..6e3b6e355e --- /dev/null +++ b/CRM/Contribute/DAO/ContributionSoft.php @@ -0,0 +1,373 @@ +__table = 'civicrm_contribution_soft'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pcp_id', 'civicrm_pcp', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'contribution_soft_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Soft Contribution ID') , + 'description' => 'Soft Contribution ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contribution_soft.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Soft Contribution - Contribution') , + 'description' => 'FK to contribution table.', + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + 'contribution_soft_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_contribution_soft.contact_id', + 'headerPattern' => '/contact(.?id)?/i', + 'dataPattern' => '/^\d+$/', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Soft Contribution Amount') , + 'description' => 'Amount of this soft contribution.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_contribution_soft.amount', + 'headerPattern' => '/total(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Soft Contribution Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'pcp_id' => array( + 'name' => 'pcp_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Soft Contribution PCP') , + 'description' => 'FK to civicrm_pcp.id', + 'default' => 'NULL', + 'FKClassName' => 'CRM_PCP_DAO_PCP', + 'pseudoconstant' => array( + 'table' => 'civicrm_pcp', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'pcp_display_in_roll' => array( + 'name' => 'pcp_display_in_roll', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Soft Contribution Display on PCP') , + ) , + 'pcp_roll_nickname' => array( + 'name' => 'pcp_roll_nickname', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Soft Contribution PCP Nickname') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + ) , + 'pcp_personal_note' => array( + 'name' => 'pcp_personal_note', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Soft Contribution PCP Note') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + ) , + 'soft_credit_type_id' => array( + 'name' => 'soft_credit_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Soft Credit Type') , + 'description' => 'Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type.', + 'default' => 'NULL', + 'pseudoconstant' => array( + 'optionGroupName' => 'soft_credit_type', + 'optionEditPath' => 'civicrm/admin/options/soft_credit_type', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'contribution_soft_id', + 'contribution_id' => 'contribution_id', + 'contact_id' => 'contribution_soft_contact_id', + 'amount' => 'amount', + 'currency' => 'currency', + 'pcp_id' => 'pcp_id', + 'pcp_display_in_roll' => 'pcp_display_in_roll', + 'pcp_roll_nickname' => 'pcp_roll_nickname', + 'pcp_personal_note' => 'pcp_personal_note', + 'soft_credit_type_id' => 'soft_credit_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution_soft'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution_soft'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/Premium.php b/CRM/Contribute/DAO/Premium.php new file mode 100644 index 0000000000..5c26f886be --- /dev/null +++ b/CRM/Contribute/DAO/Premium.php @@ -0,0 +1,345 @@ + at top of Premiums section of page. Text and HTML allowed. + * + * @var text + */ + public $premiums_intro_text; + /** + * This email address is included in receipts if it is populated and a premium has been selected. + * + * @var string + */ + public $premiums_contact_email; + /** + * This phone number is included in receipts if it is populated and a premium has been selected. + * + * @var string + */ + public $premiums_contact_phone; + /** + * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. + * + * @var boolean + */ + public $premiums_display_min_contribution; + /** + * Label displayed for No Thank-you option in premiums block (e.g. No thank you) + * + * @var string + */ + public $premiums_nothankyou_label; + /** + * + * @var int unsigned + */ + public $premiums_nothankyou_position; + /** + * class constructor + * + * @return civicrm_premiums + */ + function __construct() { + $this->__table = 'civicrm_premiums'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Premium ID') , + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Premium Entity') , + 'description' => 'Joins these premium settings to another object. Always civicrm_contribution_page for now.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Premium entity ID') , + 'required' => true, + ) , + 'premiums_active' => array( + 'name' => 'premiums_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Premium Active?') , + 'description' => 'Is the Premiums feature enabled for this page?', + 'required' => true, + ) , + 'premiums_intro_title' => array( + 'name' => 'premiums_intro_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title for Premiums section') , + 'description' => 'Title for Premiums section.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'premiums_intro_text' => array( + 'name' => 'premiums_intro_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Premium Introductory Text') , + 'description' => 'Displayed in
at top of Premiums section of page. Text and HTML allowed.', + ) , + 'premiums_contact_email' => array( + 'name' => 'premiums_contact_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Premium Contact Email') , + 'description' => 'This email address is included in receipts if it is populated and a premium has been selected.', + 'maxlength' => 100, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'premiums_contact_phone' => array( + 'name' => 'premiums_contact_phone', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Premiums Contact Phone') , + 'description' => 'This phone number is included in receipts if it is populated and a premium has been selected.', + 'maxlength' => 50, + 'size' => CRM_Utils_Type::BIG, + ) , + 'premiums_display_min_contribution' => array( + 'name' => 'premiums_display_min_contribution', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Display Minimum Contribution?') , + 'description' => 'Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.', + 'required' => true, + ) , + 'premiums_nothankyou_label' => array( + 'name' => 'premiums_nothankyou_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('No Thank-you Text') , + 'description' => 'Label displayed for No Thank-you option in premiums block (e.g. No thank you)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'premiums_nothankyou_position' => array( + 'name' => 'premiums_nothankyou_position', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('No Thank-you Position') , + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'premiums_active' => 'premiums_active', + 'premiums_intro_title' => 'premiums_intro_title', + 'premiums_intro_text' => 'premiums_intro_text', + 'premiums_contact_email' => 'premiums_contact_email', + 'premiums_contact_phone' => 'premiums_contact_phone', + 'premiums_display_min_contribution' => 'premiums_display_min_contribution', + 'premiums_nothankyou_label' => 'premiums_nothankyou_label', + 'premiums_nothankyou_position' => 'premiums_nothankyou_position', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['premiums'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['premiums'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/PremiumsProduct.php b/CRM/Contribute/DAO/PremiumsProduct.php new file mode 100644 index 0000000000..60a7593d5e --- /dev/null +++ b/CRM/Contribute/DAO/PremiumsProduct.php @@ -0,0 +1,270 @@ +__table = 'civicrm_premiums_product'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'premiums_id', 'civicrm_premiums', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'product_id', 'civicrm_product', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Premium Product ID') , + 'description' => 'Contribution ID', + 'required' => true, + ) , + 'premiums_id' => array( + 'name' => 'premiums_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Premium') , + 'description' => 'Foreign key to premiums settings record.', + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_Premium', + ) , + 'product_id' => array( + 'name' => 'product_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Product') , + 'description' => 'Foreign key to each product object.', + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_Product', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'required' => true, + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'premiums_id' => 'premiums_id', + 'product_id' => 'product_id', + 'weight' => 'weight', + 'financial_type_id' => 'financial_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['premiums_product'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['premiums_product'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/Product.php b/CRM/Contribute/DAO/Product.php new file mode 100644 index 0000000000..60c9566a5f --- /dev/null +++ b/CRM/Contribute/DAO/Product.php @@ -0,0 +1,515 @@ + we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) + * + * @var string + */ + public $period_type; + /** + * Month and day (MMDD) that fixed period type subscription or membership starts. + * + * @var int + */ + public $fixed_period_start_day; + /** + * + * @var string + */ + public $duration_unit; + /** + * Number of units for total duration of subscription, service, membership (e.g. 12 Months). + * + * @var int + */ + public $duration_interval; + /** + * Frequency unit and interval allow option to store actual delivery frequency for a subscription or service. + * + * @var string + */ + public $frequency_unit; + /** + * Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months). + * + * @var int + */ + public $frequency_interval; + /** + * class constructor + * + * @return civicrm_product + */ + function __construct() { + $this->__table = 'civicrm_product'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Product ID') , + 'required' => true, + ) , + 'product_name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Product Name') , + 'description' => 'Required product/premium name', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'export' => true, + 'where' => 'civicrm_product.name', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Description') , + 'description' => 'Optional description of the product/premium.', + ) , + 'sku' => array( + 'name' => 'sku', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SKU') , + 'description' => 'Optional product sku or code.', + 'maxlength' => 50, + 'size' => CRM_Utils_Type::BIG, + 'export' => true, + 'where' => 'civicrm_product.sku', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'options' => array( + 'name' => 'options', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Options') , + 'description' => 'Store comma-delimited list of color, size, etc. options for the product.', + ) , + 'image' => array( + 'name' => 'image', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Image') , + 'description' => 'Full or relative URL to uploaded image - fullsize.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'thumbnail' => array( + 'name' => 'thumbnail', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Thumbnail') , + 'description' => 'Full or relative URL to image thumbnail.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'price' => array( + 'name' => 'price', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Price') , + 'description' => 'Sell price or market value for premiums. For tax-deductible contributions, this will be stored as non_deductible_amount in the contribution record.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'min_contribution' => array( + 'name' => 'min_contribution', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Minimum Contribution') , + 'description' => 'Minimum contribution required to be eligible to select this premium.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'cost' => array( + 'name' => 'cost', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Cost') , + 'description' => 'Actual cost of this product. Useful to determine net return from sale or using this as an incentive.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Disabling premium removes it from the premiums_premium join table below.', + 'required' => true, + ) , + 'period_type' => array( + 'name' => 'period_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Period Type') , + 'description' => 'Rolling means we set start/end based on current day, fixed means we set start/end for current year or month + (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) ', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'rolling', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::periodType', + ) + ) , + 'fixed_period_start_day' => array( + 'name' => 'fixed_period_start_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Fixed Period Start Day') , + 'description' => 'Month and day (MMDD) that fixed period type subscription or membership starts.', + 'default' => '0101', + ) , + 'duration_unit' => array( + 'name' => 'duration_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Duration Unit') , + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'year', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', + ) + ) , + 'duration_interval' => array( + 'name' => 'duration_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Duration Interval') , + 'description' => 'Number of units for total duration of subscription, service, membership (e.g. 12 Months).', + ) , + 'frequency_unit' => array( + 'name' => 'frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Frequency Unit') , + 'description' => 'Frequency unit and interval allow option to store actual delivery frequency for a subscription or service.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'month', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', + ) + ) , + 'frequency_interval' => array( + 'name' => 'frequency_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Frequency Interval') , + 'description' => 'Number of units for delivery frequency of subscription, service, membership (e.g. every 3 Months).', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'product_name', + 'description' => 'description', + 'sku' => 'sku', + 'options' => 'options', + 'image' => 'image', + 'thumbnail' => 'thumbnail', + 'price' => 'price', + 'currency' => 'currency', + 'financial_type_id' => 'financial_type_id', + 'min_contribution' => 'min_contribution', + 'cost' => 'cost', + 'is_active' => 'is_active', + 'period_type' => 'period_type', + 'fixed_period_start_day' => 'fixed_period_start_day', + 'duration_unit' => 'duration_unit', + 'duration_interval' => 'duration_interval', + 'frequency_unit' => 'frequency_unit', + 'frequency_interval' => 'frequency_interval', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['product'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['product'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Contribute/DAO/Widget.php b/CRM/Contribute/DAO/Widget.php new file mode 100644 index 0000000000..cb78bbdf67 --- /dev/null +++ b/CRM/Contribute/DAO/Widget.php @@ -0,0 +1,423 @@ +__table = 'civicrm_contribution_widget'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Widget ID') , + 'description' => 'Contribution Id', + 'required' => true, + ) , + 'contribution_page_id' => array( + 'name' => 'contribution_page_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page') , + 'description' => 'The Contribution Page which triggered this contribution', + 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Enabled?') , + 'description' => 'Is this property active?', + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Widget Title') , + 'description' => 'Widget title.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_logo' => array( + 'name' => 'url_logo', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Widget Image Url') , + 'description' => 'URL to Widget logo', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'button_title' => array( + 'name' => 'button_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Button Title') , + 'description' => 'Button title.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'about' => array( + 'name' => 'about', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Description') , + 'description' => 'About description.', + ) , + 'url_homepage' => array( + 'name' => 'url_homepage', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Homepage Url') , + 'description' => 'URL to Homepage.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'color_title' => array( + 'name' => 'color_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title Color') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_button' => array( + 'name' => 'color_button', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Button Colour') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_bar' => array( + 'name' => 'color_bar', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Bar Color') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_main_text' => array( + 'name' => 'color_main_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Main Text Color') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_main' => array( + 'name' => 'color_main', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Main Colour') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_main_bg' => array( + 'name' => 'color_main_bg', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Backgroup Color') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_bg' => array( + 'name' => 'color_bg', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Other Backgroun Colour') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_about_link' => array( + 'name' => 'color_about_link', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('About Link Colour') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'color_homepage_link' => array( + 'name' => 'color_homepage_link', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Homepage Link Colour') , + 'maxlength' => 10, + 'size' => CRM_Utils_Type::TWELVE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contribution_page_id' => 'contribution_page_id', + 'is_active' => 'is_active', + 'title' => 'title', + 'url_logo' => 'url_logo', + 'button_title' => 'button_title', + 'about' => 'about', + 'url_homepage' => 'url_homepage', + 'color_title' => 'color_title', + 'color_button' => 'color_button', + 'color_bar' => 'color_bar', + 'color_main_text' => 'color_main_text', + 'color_main' => 'color_main', + 'color_main_bg' => 'color_main_bg', + 'color_bg' => 'color_bg', + 'color_about_link' => 'color_about_link', + 'color_homepage_link' => 'color_homepage_link', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['contribution_widget'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['contribution_widget'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/ActionLog.php b/CRM/Core/DAO/ActionLog.php new file mode 100644 index 0000000000..f1013b89d5 --- /dev/null +++ b/CRM/Core/DAO/ActionLog.php @@ -0,0 +1,330 @@ +__table = 'civicrm_action_log'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'action_schedule_id', 'civicrm_action_schedule', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Action Schedule ID') , + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Action Schedule Contact ID') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'FK to id of the entity that the action was performed on. Pseudo - FK.', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'name of the entity table for the above id, e.g. civicrm_activity, civicrm_participant', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'action_schedule_id' => array( + 'name' => 'action_schedule_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Schedule') , + 'description' => 'FK to the action schedule that this action originated from.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_ActionSchedule', + ) , + 'action_date_time' => array( + 'name' => 'action_date_time', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Action Date And Time') , + 'description' => 'date time that the action was performed on.', + ) , + 'is_error' => array( + 'name' => 'is_error', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Error?') , + 'description' => 'Was there any error sending the reminder?', + ) , + 'message' => array( + 'name' => 'message', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Message') , + 'description' => 'Description / text in case there was an error encountered.', + ) , + 'repetition_number' => array( + 'name' => 'repetition_number', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Repetition Number') , + 'description' => 'Keeps track of the sequence number of this repetition.', + ) , + 'reference_date' => array( + 'name' => 'reference_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Reference Date') , + 'description' => 'Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)', + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'entity_id' => 'entity_id', + 'entity_table' => 'entity_table', + 'action_schedule_id' => 'action_schedule_id', + 'action_date_time' => 'action_date_time', + 'is_error' => 'is_error', + 'message' => 'message', + 'repetition_number' => 'repetition_number', + 'reference_date' => 'reference_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['action_log'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['action_log'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/ActionMapping.php b/CRM/Core/DAO/ActionMapping.php new file mode 100644 index 0000000000..b5f18d6696 --- /dev/null +++ b/CRM/Core/DAO/ActionMapping.php @@ -0,0 +1,311 @@ +__table = 'civicrm_action_mapping'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Action Mapping ID') , + 'required' => true, + ) , + 'entity' => array( + 'name' => 'entity', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Action Mapping Entity') , + 'description' => 'Entity for which the reminder is created', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_value' => array( + 'name' => 'entity_value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Action Mapping Entity Value') , + 'description' => 'Entity value', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_value_label' => array( + 'name' => 'entity_value_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Value Label') , + 'description' => 'Entity value label', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_status' => array( + 'name' => 'entity_status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Status') , + 'description' => 'Entity status', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_status_label' => array( + 'name' => 'entity_status_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Status Label') , + 'description' => 'Entity status label', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_date_start' => array( + 'name' => 'entity_date_start', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Start Date') , + 'description' => 'Entity date', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_date_end' => array( + 'name' => 'entity_date_end', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity End Date') , + 'description' => 'Entity date', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_recipient' => array( + 'name' => 'entity_recipient', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Recipient') , + 'description' => 'Entity recipient', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity' => 'entity', + 'entity_value' => 'entity_value', + 'entity_value_label' => 'entity_value_label', + 'entity_status' => 'entity_status', + 'entity_status_label' => 'entity_status_label', + 'entity_date_start' => 'entity_date_start', + 'entity_date_end' => 'entity_date_end', + 'entity_recipient' => 'entity_recipient', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['action_mapping'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['action_mapping'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php new file mode 100644 index 0000000000..9a9de6460c --- /dev/null +++ b/CRM/Core/DAO/ActionSchedule.php @@ -0,0 +1,771 @@ +__table = 'civicrm_action_schedule'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_template_id', 'civicrm_msg_template', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Action Schedule ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Name of the action(reminder)', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title') , + 'description' => 'Title of the action(reminder)', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'recipient' => array( + 'name' => 'recipient', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Recipient') , + 'description' => 'Recipient', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'limit_to' => array( + 'name' => 'limit_to', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Limit To') , + 'description' => 'Is this the recipient criteria limited to OR in addition to?', + ) , + 'entity_value' => array( + 'name' => 'entity_value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Value') , + 'description' => 'Entity value', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'entity_status' => array( + 'name' => 'entity_status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Status') , + 'description' => 'Entity status', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'start_action_offset' => array( + 'name' => 'start_action_offset', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Start Action Offset') , + 'description' => 'Reminder Interval.', + ) , + 'start_action_unit' => array( + 'name' => 'start_action_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Start Action Unit') , + 'description' => 'Time units for reminder.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', + ) + ) , + 'start_action_condition' => array( + 'name' => 'start_action_condition', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Start Action Condition') , + 'description' => 'Reminder Action', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'start_action_date' => array( + 'name' => 'start_action_date', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Start Action Date') , + 'description' => 'Entity date', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'is_repeat' => array( + 'name' => 'is_repeat', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Repeat?') , + ) , + 'repetition_frequency_unit' => array( + 'name' => 'repetition_frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Repetition Frequency Unit') , + 'description' => 'Time units for repetition of reminder.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', + ) + ) , + 'repetition_frequency_interval' => array( + 'name' => 'repetition_frequency_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Repetition Frequency Interval') , + 'description' => 'Time interval for repeating the reminder.', + ) , + 'end_frequency_unit' => array( + 'name' => 'end_frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('End Frequency Unit') , + 'description' => 'Time units till repetition of reminder.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', + ) + ) , + 'end_frequency_interval' => array( + 'name' => 'end_frequency_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('End Frequency Interval') , + 'description' => 'Time interval till repeating the reminder.', + ) , + 'end_action' => array( + 'name' => 'end_action', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('End Action') , + 'description' => 'Reminder Action till repeating the reminder.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('End Date') , + 'description' => 'Entity end date', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Schedule is Active?') , + 'description' => 'Is this option active?', + 'default' => '1', + ) , + 'recipient_manual' => array( + 'name' => 'recipient_manual', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Recipient Manual') , + 'description' => 'Contact IDs to which reminder should be sent.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'recipient_listing' => array( + 'name' => 'recipient_listing', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Recipient Listing') , + 'description' => 'listing based on recipient field.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'body_text' => array( + 'name' => 'body_text', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Reminder Text') , + 'description' => 'Body of the mailing in text format.', + ) , + 'body_html' => array( + 'name' => 'body_html', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Reminder HTML') , + 'description' => 'Body of the mailing in html format.', + ) , + 'sms_body_text' => array( + 'name' => 'sms_body_text', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('SMS Reminder Text') , + 'description' => 'Content of the SMS text.', + ) , + 'subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Reminder Subject') , + 'description' => 'Subject of mailing', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'record_activity' => array( + 'name' => 'record_activity', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Record Activity for Reminder?') , + 'description' => 'Record Activity for this reminder?', + 'default' => 'NULL', + ) , + 'mapping_id' => array( + 'name' => 'mapping_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Reminder Mapping') , + 'description' => 'Name/ID of the mapping to use on this table', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Reminder Group') , + 'description' => 'FK to Group', + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'msg_template_id' => array( + 'name' => 'msg_template_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Reminder Template') , + 'description' => 'FK to the message template.', + 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', + ) , + 'sms_template_id' => array( + 'name' => 'sms_template_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('SMS Reminder Template') , + 'description' => 'FK to the message template.', + 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', + ) , + 'absolute_date' => array( + 'name' => 'absolute_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Fixed Date for Reminder') , + 'description' => 'Date on which the reminder be sent.', + ) , + 'from_name' => array( + 'name' => 'from_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Reminder from Name') , + 'description' => 'Name in "from" field', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'from_email' => array( + 'name' => 'from_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Reminder From Email') , + 'description' => 'Email address in "from" field', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'mode' => array( + 'name' => 'mode', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Message Mode') , + 'description' => 'Send the message as email or sms or both.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'Email', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'msg_mode', + 'optionEditPath' => 'civicrm/admin/options/msg_mode', + ) + ) , + 'sms_provider_id' => array( + 'name' => 'sms_provider_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('SMS Provider') , + 'FKClassName' => 'CRM_SMS_DAO_Provider', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'used_for' => array( + 'name' => 'used_for', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Used For') , + 'description' => 'Used for repeating entity', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'filter_contact_language' => array( + 'name' => 'filter_contact_language', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Filter Contact Language') , + 'description' => 'Used for multilingual installation', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'communication_language' => array( + 'name' => 'communication_language', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Communication Language') , + 'description' => 'Used for multilingual installation', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'recipient' => 'recipient', + 'limit_to' => 'limit_to', + 'entity_value' => 'entity_value', + 'entity_status' => 'entity_status', + 'start_action_offset' => 'start_action_offset', + 'start_action_unit' => 'start_action_unit', + 'start_action_condition' => 'start_action_condition', + 'start_action_date' => 'start_action_date', + 'is_repeat' => 'is_repeat', + 'repetition_frequency_unit' => 'repetition_frequency_unit', + 'repetition_frequency_interval' => 'repetition_frequency_interval', + 'end_frequency_unit' => 'end_frequency_unit', + 'end_frequency_interval' => 'end_frequency_interval', + 'end_action' => 'end_action', + 'end_date' => 'end_date', + 'is_active' => 'is_active', + 'recipient_manual' => 'recipient_manual', + 'recipient_listing' => 'recipient_listing', + 'body_text' => 'body_text', + 'body_html' => 'body_html', + 'sms_body_text' => 'sms_body_text', + 'subject' => 'subject', + 'record_activity' => 'record_activity', + 'mapping_id' => 'mapping_id', + 'group_id' => 'group_id', + 'msg_template_id' => 'msg_template_id', + 'sms_template_id' => 'sms_template_id', + 'absolute_date' => 'absolute_date', + 'from_name' => 'from_name', + 'from_email' => 'from_email', + 'mode' => 'mode', + 'sms_provider_id' => 'sms_provider_id', + 'used_for' => 'used_for', + 'filter_contact_language' => 'filter_contact_language', + 'communication_language' => 'communication_language', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['action_schedule'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['action_schedule'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Address.php b/CRM/Core/DAO/Address.php new file mode 100644 index 0000000000..7676c92a78 --- /dev/null +++ b/CRM/Core/DAO/Address.php @@ -0,0 +1,786 @@ +__table = 'civicrm_address'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'county_id', 'civicrm_county', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'state_province_id', 'civicrm_state_province', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'master_id', 'civicrm_address', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Address ID') , + 'description' => 'Unique Address ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Address Location Type') , + 'description' => 'Which Location does this address belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_location_type', + 'keyColumn' => 'id', + 'labelColumn' => 'display_name', + ) + ) , + 'is_primary' => array( + 'name' => 'is_primary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Address Primary?') , + 'description' => 'Is this the primary address.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_billing' => array( + 'name' => 'is_billing', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Billing Address') , + 'description' => 'Is this the billing address.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'street_address' => array( + 'name' => 'street_address', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Address') , + 'description' => 'Concatenation of all routable street address components (prefix, street number, street name, suffix, unit + number OR P.O. Box). Apps should be able to determine physical location with this data (for mapping, mail + delivery, etc.). + ', + 'maxlength' => 96, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_address.street_address', + 'headerPattern' => '/(street|address)/i', + 'dataPattern' => '/^(\d{1,5}( [0-9A-Za-z]+)+)$|^(P\.?O\.\? Box \d{1,5})$/i', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_number' => array( + 'name' => 'street_number', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Street Number') , + 'description' => 'Numeric portion of address number on the street, e.g. For 112A Main St, the street_number = 112.', + 'export' => true, + 'where' => 'civicrm_address.street_number', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_number_suffix' => array( + 'name' => 'street_number_suffix', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Number Suffix') , + 'description' => 'Non-numeric portion of address number on the street, e.g. For 112A Main St, the street_number_suffix = A + ', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'export' => true, + 'where' => 'civicrm_address.street_number_suffix', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_number_predirectional' => array( + 'name' => 'street_number_predirectional', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Direction Prefix') , + 'description' => 'Directional prefix, e.g. SE Main St, SE is the prefix.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_name' => array( + 'name' => 'street_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Name') , + 'description' => 'Actual street name, excluding St, Dr, Rd, Ave, e.g. For 112 Main St, the street_name = Main.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'export' => true, + 'where' => 'civicrm_address.street_name', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_type' => array( + 'name' => 'street_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Type') , + 'description' => 'St, Rd, Dr, etc.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_number_postdirectional' => array( + 'name' => 'street_number_postdirectional', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Direction Suffix') , + 'description' => 'Directional prefix, e.g. Main St S, S is the suffix.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'street_unit' => array( + 'name' => 'street_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Street Unit') , + 'description' => 'Secondary unit designator, e.g. Apt 3 or Unit # 14, or Bldg 1200', + 'maxlength' => 16, + 'size' => CRM_Utils_Type::TWELVE, + 'export' => true, + 'where' => 'civicrm_address.street_unit', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'supplemental_address_1' => array( + 'name' => 'supplemental_address_1', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Supplemental Address 1') , + 'description' => 'Supplemental Address Information, Line 1', + 'maxlength' => 96, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_address.supplemental_address_1', + 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', + 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'supplemental_address_2' => array( + 'name' => 'supplemental_address_2', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Supplemental Address 2') , + 'description' => 'Supplemental Address Information, Line 2', + 'maxlength' => 96, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_address.supplemental_address_2', + 'headerPattern' => '/(supplemental(\s)?)?address(\s\d+)?/i', + 'dataPattern' => '/unit|ap(ar)?t(ment)?\s(\d|\w)+/i', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'supplemental_address_3' => array( + 'name' => 'supplemental_address_3', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Supplemental Address 3') , + 'description' => 'Supplemental Address Information, Line 3', + 'maxlength' => 96, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'city' => array( + 'name' => 'city', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('City') , + 'description' => 'City, Town or Village Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_address.city', + 'headerPattern' => '/city/i', + 'dataPattern' => '/^[A-Za-z]+(\.?)(\s?[A-Za-z]+){0,2}$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'county_id' => array( + 'name' => 'county_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('County') , + 'description' => 'Which County does this address belong to.', + 'FKClassName' => 'CRM_Core_DAO_County', + 'html' => array( + 'type' => 'ChainSelect', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_county', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'state_province_id' => array( + 'name' => 'state_province_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('State/Province') , + 'description' => 'Which State_Province does this address belong to.', + 'FKClassName' => 'CRM_Core_DAO_StateProvince', + 'html' => array( + 'type' => 'ChainSelect', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_state_province', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'postal_code_suffix' => array( + 'name' => 'postal_code_suffix', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Postal Code Suffix') , + 'description' => 'Store the suffix, like the +4 part in the USPS system.', + 'maxlength' => 12, + 'size' => 3, + 'import' => true, + 'where' => 'civicrm_address.postal_code_suffix', + 'headerPattern' => '/p(ostal)\sc(ode)\ss(uffix)/i', + 'dataPattern' => '/\d?\d{4}(-\d{4})?/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'postal_code' => array( + 'name' => 'postal_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Postal Code') , + 'description' => 'Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.', + 'maxlength' => 64, + 'size' => 6, + 'import' => true, + 'where' => 'civicrm_address.postal_code', + 'headerPattern' => '/postal|zip/i', + 'dataPattern' => '/\d?\d{4}(-\d{4})?/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'usps_adc' => array( + 'name' => 'usps_adc', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('USPS Code') , + 'description' => 'USPS Bulk mailing code.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'country_id' => array( + 'name' => 'country_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Country') , + 'description' => 'Which Country does this address belong to.', + 'FKClassName' => 'CRM_Core_DAO_Country', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_country', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + 'nameColumn' => 'iso_code', + ) + ) , + 'geo_code_1' => array( + 'name' => 'geo_code_1', + 'type' => CRM_Utils_Type::T_FLOAT, + 'title' => ts('Latitude') , + 'description' => 'Latitude', + 'import' => true, + 'where' => 'civicrm_address.geo_code_1', + 'headerPattern' => '/geo/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'geo_code_2' => array( + 'name' => 'geo_code_2', + 'type' => CRM_Utils_Type::T_FLOAT, + 'title' => ts('Longitude') , + 'description' => 'Longitude', + 'import' => true, + 'where' => 'civicrm_address.geo_code_2', + 'headerPattern' => '/geo/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'manual_geo_code' => array( + 'name' => 'manual_geo_code', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is manually geocoded') , + 'description' => 'Is this a manually entered geo code', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'timezone' => array( + 'name' => 'timezone', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Timezone') , + 'description' => 'Timezone expressed as a UTC offset - e.g. United States CST would be written as "UTC-6".', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'address_name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Address Name') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_address.name', + 'headerPattern' => '/^location|(l(ocation\s)?name)$/i', + 'dataPattern' => '/^\w+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'master_id' => array( + 'name' => 'master_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Master Address Belongs To') , + 'description' => 'FK to Address ID', + 'import' => true, + 'where' => 'civicrm_address.master_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Core_DAO_Address', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'location_type_id' => 'location_type_id', + 'is_primary' => 'is_primary', + 'is_billing' => 'is_billing', + 'street_address' => 'street_address', + 'street_number' => 'street_number', + 'street_number_suffix' => 'street_number_suffix', + 'street_number_predirectional' => 'street_number_predirectional', + 'street_name' => 'street_name', + 'street_type' => 'street_type', + 'street_number_postdirectional' => 'street_number_postdirectional', + 'street_unit' => 'street_unit', + 'supplemental_address_1' => 'supplemental_address_1', + 'supplemental_address_2' => 'supplemental_address_2', + 'supplemental_address_3' => 'supplemental_address_3', + 'city' => 'city', + 'county_id' => 'county_id', + 'state_province_id' => 'state_province_id', + 'postal_code_suffix' => 'postal_code_suffix', + 'postal_code' => 'postal_code', + 'usps_adc' => 'usps_adc', + 'country_id' => 'country_id', + 'geo_code_1' => 'geo_code_1', + 'geo_code_2' => 'geo_code_2', + 'manual_geo_code' => 'manual_geo_code', + 'timezone' => 'timezone', + 'name' => 'address_name', + 'master_id' => 'master_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['address'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + self::$_import = array_merge(self::$_import, CRM_Core_DAO_County::import(true)); + self::$_import = array_merge(self::$_import, CRM_Core_DAO_StateProvince::import(true)); + self::$_import = array_merge(self::$_import, CRM_Core_DAO_Country::import(true)); + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['address'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + self::$_export = array_merge(self::$_export, CRM_Core_DAO_County::export(true)); + self::$_export = array_merge(self::$_export, CRM_Core_DAO_StateProvince::export(true)); + self::$_export = array_merge(self::$_export, CRM_Core_DAO_Country::export(true)); + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/AddressFormat.php b/CRM/Core/DAO/AddressFormat.php new file mode 100644 index 0000000000..12094c8ac1 --- /dev/null +++ b/CRM/Core/DAO/AddressFormat.php @@ -0,0 +1,206 @@ +__table = 'civicrm_address_format'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Address Format ID') , + 'description' => 'Address Format Id', + 'required' => true, + ) , + 'format' => array( + 'name' => 'format', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Address Format') , + 'description' => 'The format of an address', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'format' => 'format', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['address_format'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['address_format'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Cache.php b/CRM/Core/DAO/Cache.php new file mode 100644 index 0000000000..f1eb7a0a77 --- /dev/null +++ b/CRM/Core/DAO/Cache.php @@ -0,0 +1,294 @@ +__table = 'civicrm_cache'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'required' => true, + ) , + 'group_name' => array( + 'name' => 'group_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Group Name') , + 'description' => 'group name for cache element, useful in cleaning cache elements', + 'required' => true, + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'path' => array( + 'name' => 'path', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Path') , + 'description' => 'Unique path name for cache element', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Data') , + 'description' => 'data associated with this path', + ) , + 'component_id' => array( + 'name' => 'component_id', + 'type' => CRM_Utils_Type::T_INT, + 'description' => 'Component that this menu item belongs to', + 'FKClassName' => 'CRM_Core_DAO_Component', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_component', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Created Date') , + 'description' => 'When was the cache item created', + ) , + 'expired_date' => array( + 'name' => 'expired_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Expired Date') , + 'description' => 'When should the cache item expire', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'group_name' => 'group_name', + 'path' => 'path', + 'data' => 'data', + 'component_id' => 'component_id', + 'created_date' => 'created_date', + 'expired_date' => 'expired_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['cache'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['cache'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Component.php b/CRM/Core/DAO/Component.php new file mode 100644 index 0000000000..e0eec49d34 --- /dev/null +++ b/CRM/Core/DAO/Component.php @@ -0,0 +1,226 @@ +__table = 'civicrm_component'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'description' => 'Component ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Component name') , + 'description' => 'Name of the component.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'namespace' => array( + 'name' => 'namespace', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Namespace reserved for component.') , + 'description' => 'Path to components main directory in a form of a class + namespace. + ', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'namespace' => 'namespace', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['component'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['component'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Country.php b/CRM/Core/DAO/Country.php new file mode 100644 index 0000000000..5a552c75c9 --- /dev/null +++ b/CRM/Core/DAO/Country.php @@ -0,0 +1,329 @@ +__table = 'civicrm_country'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_format_id', 'civicrm_address_format', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'region_id', 'civicrm_worldregion', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Country ID') , + 'description' => 'Country Id', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Country') , + 'description' => 'Country Name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_country.name', + 'headerPattern' => '/country/i', + 'dataPattern' => '/^[A-Z][a-z]+\.?(\s+[A-Z][a-z]+){0,3}$/', + 'export' => true, + ) , + 'iso_code' => array( + 'name' => 'iso_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Country ISO Code') , + 'description' => 'ISO Code', + 'maxlength' => 2, + 'size' => CRM_Utils_Type::TWO, + ) , + 'country_code' => array( + 'name' => 'country_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Country Phone Prefix') , + 'description' => 'National prefix to be used when dialing TO this country.', + 'maxlength' => 4, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'address_format_id' => array( + 'name' => 'address_format_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Address Format') , + 'description' => 'Foreign key to civicrm_address_format.id.', + 'FKClassName' => 'CRM_Core_DAO_AddressFormat', + ) , + 'idd_prefix' => array( + 'name' => 'idd_prefix', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Outgoing Phone Prefix') , + 'description' => 'International direct dialing prefix from within the country TO another country', + 'maxlength' => 4, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'ndd_prefix' => array( + 'name' => 'ndd_prefix', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Area Code') , + 'description' => 'Access prefix to call within a country to a different area', + 'maxlength' => 4, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'region_id' => array( + 'name' => 'region_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Region') , + 'description' => 'Foreign key to civicrm_worldregion.id.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Worldregion', + ) , + 'is_province_abbreviated' => array( + 'name' => 'is_province_abbreviated', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Abbreviate Province?') , + 'description' => 'Should state/province be displayed as abbreviation for contacts from this country?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'iso_code' => 'iso_code', + 'country_code' => 'country_code', + 'address_format_id' => 'address_format_id', + 'idd_prefix' => 'idd_prefix', + 'ndd_prefix' => 'ndd_prefix', + 'region_id' => 'region_id', + 'is_province_abbreviated' => 'is_province_abbreviated', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['country'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['country'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/County.php b/CRM/Core/DAO/County.php new file mode 100644 index 0000000000..f172a246b3 --- /dev/null +++ b/CRM/Core/DAO/County.php @@ -0,0 +1,256 @@ +__table = 'civicrm_county'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'state_province_id', 'civicrm_state_province', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('County ID') , + 'description' => 'County ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('County') , + 'description' => 'Name of County', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_county.name', + 'headerPattern' => '/county/i', + 'dataPattern' => '/[A-Z]{2}/', + 'export' => true, + ) , + 'abbreviation' => array( + 'name' => 'abbreviation', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('County Abbreviation') , + 'description' => '2-4 Character Abbreviation of County', + 'maxlength' => 4, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'state_province_id' => array( + 'name' => 'state_province_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('State') , + 'description' => 'ID of State/Province that County belongs', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_StateProvince', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'abbreviation' => 'abbreviation', + 'state_province_id' => 'state_province_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['county'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['county'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php new file mode 100644 index 0000000000..695204de6d --- /dev/null +++ b/CRM/Core/DAO/CustomField.php @@ -0,0 +1,629 @@ +__table = 'civicrm_custom_field'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'custom_group_id', 'civicrm_custom_group', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Custom Field ID') , + 'description' => 'Unique Custom Field ID', + 'required' => true, + ) , + 'custom_group_id' => array( + 'name' => 'custom_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Custom Group') , + 'description' => 'FK to civicrm_custom_group.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_CustomGroup', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_custom_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Name') , + 'description' => 'Variable name/programmatic handle for this group.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Label') , + 'description' => 'Text for form field label (also friendly name for administering this custom property).', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'data_type' => array( + 'name' => 'data_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Data Type') , + 'description' => 'Controls location of data storage in extended_data table.', + 'required' => true, + 'maxlength' => 16, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_BAO_CustomField::dataType', + ) + ) , + 'html_type' => array( + 'name' => 'html_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field HTML Type') , + 'description' => 'HTML types plus several built-in extended types.', + 'required' => true, + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::customHtmlType', + ) + ) , + 'default_value' => array( + 'name' => 'default_value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Default') , + 'description' => 'Use form_options.is_default for field_types which use options.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_required' => array( + 'name' => 'is_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Custom Field Is Required?') , + 'description' => 'Is a value required for this property.', + ) , + 'is_searchable' => array( + 'name' => 'is_searchable', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Searching on Field?') , + 'description' => 'Is this property searchable.', + ) , + 'is_search_range' => array( + 'name' => 'is_search_range', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Search as a Range') , + 'description' => 'Is this property range searchable.', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Controls field display order within an extended property group.', + 'required' => true, + 'default' => '1', + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Custom Field Pre Text') , + 'description' => 'Description and/or help text to display before this field.', + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Custom Field Post Text') , + 'description' => 'Description and/or help text to display after this field.', + ) , + 'mask' => array( + 'name' => 'mask', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Formatting') , + 'description' => 'Optional format instructions for specific field types, like date types.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'attributes' => array( + 'name' => 'attributes', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Attributes') , + 'description' => 'Store collection of type-appropriate attributes, e.g. textarea needs rows/cols attributes', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'javascript' => array( + 'name' => 'javascript', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Field Javascript') , + 'description' => 'Optional scripting attributes for field.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Custom Field Is Active?') , + 'description' => 'Is this property active?', + ) , + 'is_view' => array( + 'name' => 'is_view', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Field is Viewable') , + 'description' => 'Is this property set by PHP Code? A code field is viewable but not editable', + ) , + 'options_per_line' => array( + 'name' => 'options_per_line', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Options Per Line') , + 'description' => 'number of options per line for checkbox and radio', + ) , + 'text_length' => array( + 'name' => 'text_length', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Length') , + 'description' => 'field length if alphanumeric', + ) , + 'start_date_years' => array( + 'name' => 'start_date_years', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Start Date') , + 'description' => 'Date may be up to start_date_years years prior to the current date.', + ) , + 'end_date_years' => array( + 'name' => 'end_date_years', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field End Date') , + 'description' => 'Date may be up to end_date_years years after the current date.', + ) , + 'date_format' => array( + 'name' => 'date_format', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Field Data Format') , + 'description' => 'date format for custom date', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'time_format' => array( + 'name' => 'time_format', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Time Format') , + 'description' => 'time format for custom date', + ) , + 'note_columns' => array( + 'name' => 'note_columns', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Note Columns') , + 'description' => ' Number of columns in Note Field ', + ) , + 'note_rows' => array( + 'name' => 'note_rows', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Note Rows') , + 'description' => ' Number of rows in Note Field ', + ) , + 'column_name' => array( + 'name' => 'column_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Field Column Name') , + 'description' => 'Name of the column that holds the values for this field.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'option_group_id' => array( + 'name' => 'option_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Field Option Group') , + 'description' => 'For elements with options, the option group id that is used', + ) , + 'filter' => array( + 'name' => 'filter', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Field Filter') , + 'description' => 'Stores Contact Get API params contact reference custom fields. May be used for other filters in the future.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'in_selector' => array( + 'name' => 'in_selector', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Field Display') , + 'description' => 'Should the multi-record custom field values be displayed in tab table listing', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'custom_group_id' => 'custom_group_id', + 'name' => 'name', + 'label' => 'label', + 'data_type' => 'data_type', + 'html_type' => 'html_type', + 'default_value' => 'default_value', + 'is_required' => 'is_required', + 'is_searchable' => 'is_searchable', + 'is_search_range' => 'is_search_range', + 'weight' => 'weight', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'mask' => 'mask', + 'attributes' => 'attributes', + 'javascript' => 'javascript', + 'is_active' => 'is_active', + 'is_view' => 'is_view', + 'options_per_line' => 'options_per_line', + 'text_length' => 'text_length', + 'start_date_years' => 'start_date_years', + 'end_date_years' => 'end_date_years', + 'date_format' => 'date_format', + 'time_format' => 'time_format', + 'note_columns' => 'note_columns', + 'note_rows' => 'note_rows', + 'column_name' => 'column_name', + 'option_group_id' => 'option_group_id', + 'filter' => 'filter', + 'in_selector' => 'in_selector', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['custom_field'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['custom_field'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/CustomGroup.php b/CRM/Core/DAO/CustomGroup.php new file mode 100644 index 0000000000..e5f14df362 --- /dev/null +++ b/CRM/Core/DAO/CustomGroup.php @@ -0,0 +1,487 @@ +__table = 'civicrm_custom_group'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Custom Group ID') , + 'description' => 'Unique Custom Group ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Group Name') , + 'description' => 'Variable name/programmatic handle for this group.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Group Title') , + 'description' => 'Friendly Name.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'extends' => array( + 'name' => 'extends', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Group Extends') , + 'description' => 'Type of object this group extends (can add other options later e.g. contact_address, etc.).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'Contact', + ) , + 'extends_entity_column_id' => array( + 'name' => 'extends_entity_column_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Custom Group Subtype List') , + 'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)', + 'default' => 'NULL', + ) , + 'extends_entity_column_value' => array( + 'name' => 'extends_entity_column_value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Group Subtype') , + 'description' => 'linking custom group for dynamic object', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'style' => array( + 'name' => 'style', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Custom Group Style') , + 'description' => 'Visual relationship between this form and its parent.', + 'maxlength' => 15, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::customGroupStyle', + ) + ) , + 'collapse_display' => array( + 'name' => 'collapse_display', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Collapse Custom Group?') , + 'description' => 'Will this group be in collapsed or expanded mode on initial display ?', + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Custom Group Pre Text') , + 'description' => 'Description and/or help text to display before fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Custom Group Post Text') , + 'description' => 'Description and/or help text to display after fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Controls display order when multiple extended property groups are setup for the same class.', + 'required' => true, + 'default' => '1', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Custom Group Is Active?') , + 'description' => 'Is this property active?', + ) , + 'table_name' => array( + 'name' => 'table_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Table Name') , + 'description' => 'Name of the table that holds the values for this group.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_multiple' => array( + 'name' => 'is_multiple', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Supports Multiple Records') , + 'description' => 'Does this group hold multiple values?', + ) , + 'min_multiple' => array( + 'name' => 'min_multiple', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Minimum Multiple Records') , + 'description' => 'minimum number of multiple records (typically 0?)', + ) , + 'max_multiple' => array( + 'name' => 'max_multiple', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum Multiple Records') , + 'description' => 'maximum number of multiple records, if 0 - no max', + ) , + 'collapse_adv_display' => array( + 'name' => 'collapse_adv_display', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Collapse Group Display') , + 'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Custom Group Created By') , + 'description' => 'FK to civicrm_contact, who created this custom group', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Custom Group Created Date') , + 'description' => 'Date and time this custom group was created.', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Reserved Group?') , + 'description' => 'Is this a reserved Custom Group?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'extends' => 'extends', + 'extends_entity_column_id' => 'extends_entity_column_id', + 'extends_entity_column_value' => 'extends_entity_column_value', + 'style' => 'style', + 'collapse_display' => 'collapse_display', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'weight' => 'weight', + 'is_active' => 'is_active', + 'table_name' => 'table_name', + 'is_multiple' => 'is_multiple', + 'min_multiple' => 'min_multiple', + 'max_multiple' => 'max_multiple', + 'collapse_adv_display' => 'collapse_adv_display', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['custom_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['custom_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Dashboard.php b/CRM/Core/DAO/Dashboard.php new file mode 100644 index 0000000000..d163f0c167 --- /dev/null +++ b/CRM/Core/DAO/Dashboard.php @@ -0,0 +1,393 @@ +__table = 'civicrm_dashboard'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('DashletID') , + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dashlet Domain') , + 'description' => 'Domain for dashboard', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Dashlet Name') , + 'description' => 'Internal name of dashlet.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Dashlet Title') , + 'description' => 'dashlet title', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url' => array( + 'name' => 'url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Dashlet URL') , + 'description' => 'url in case of external dashlet', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'permission' => array( + 'name' => 'permission', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Dashlet Permission') , + 'description' => 'Permission for the dashlet', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'permission_operator' => array( + 'name' => 'permission_operator', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Dashlet Permission Operator') , + 'description' => 'Permission Operator', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'column_no' => array( + 'name' => 'column_no', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Dashlet Column') , + 'description' => 'column no for this dashlet', + ) , + 'is_minimized' => array( + 'name' => 'is_minimized', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Minimize Dashlet?') , + 'description' => 'Is Minimized?', + ) , + 'fullscreen_url' => array( + 'name' => 'fullscreen_url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Fullscreen URL') , + 'description' => 'fullscreen url for dashlet', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_fullscreen' => array( + 'name' => 'is_fullscreen', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Fullscreen?') , + 'description' => 'Is Fullscreen?', + 'default' => '1', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Dashlet Active?') , + 'description' => 'Is this dashlet active?', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Dashlet Reserved?') , + 'description' => 'Is this dashlet reserved?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Ordering of the dashlets.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'name', + 'label' => 'label', + 'url' => 'url', + 'permission' => 'permission', + 'permission_operator' => 'permission_operator', + 'column_no' => 'column_no', + 'is_minimized' => 'is_minimized', + 'fullscreen_url' => 'fullscreen_url', + 'is_fullscreen' => 'is_fullscreen', + 'is_active' => 'is_active', + 'is_reserved' => 'is_reserved', + 'weight' => 'weight', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['dashboard'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['dashboard'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Discount.php b/CRM/Core/DAO/Discount.php new file mode 100644 index 0000000000..c3f97e5a93 --- /dev/null +++ b/CRM/Core/DAO/Discount.php @@ -0,0 +1,281 @@ +__table = 'civicrm_discount'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Discount ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'physical tablename for entity being joined to discount, e.g. civicrm_event', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'participant_discount_name' => array( + 'name' => 'price_set_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Discount Name') , + 'description' => 'FK to civicrm_price_set', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_discount.price_set_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Price_DAO_PriceSet', + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Discount Start Date') , + 'description' => 'Date when discount starts.', + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Discount End Date') , + 'description' => 'Date when discount ends.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'price_set_id' => 'participant_discount_name', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['discount'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['discount'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Domain.php b/CRM/Core/DAO/Domain.php new file mode 100644 index 0000000000..7d1fefdf9c --- /dev/null +++ b/CRM/Core/DAO/Domain.php @@ -0,0 +1,320 @@ +__table = 'civicrm_domain'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Domain ID') , + 'description' => 'Domain ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Domain Name') , + 'description' => 'Name of Domain / Organization', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Domain Description') , + 'description' => 'Description of Domain.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'config_backend' => array( + 'name' => 'config_backend', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Domain Configuration') , + 'description' => 'Backend configuration.', + 'rows' => 20, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'version' => array( + 'name' => 'version', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('CiviCRM Version') , + 'description' => 'The civicrm version this instance is running', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Domain Contact') , + 'description' => 'FK to Contact ID. This is specifically not an FK to avoid circular constraints', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'locales' => array( + 'name' => 'locales', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Supported Languages') , + 'description' => 'list of locales supported by the current db state (NULL for single-lang install)', + ) , + 'locale_custom_strings' => array( + 'name' => 'locale_custom_strings', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Language Customizations') , + 'description' => 'Locale specific string overrides', + 'rows' => 20, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'config_backend' => 'config_backend', + 'version' => 'version', + 'contact_id' => 'contact_id', + 'locales' => 'locales', + 'locale_custom_strings' => 'locale_custom_strings', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['domain'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['domain'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Email.php b/CRM/Core/DAO/Email.php new file mode 100644 index 0000000000..f8f20307ee --- /dev/null +++ b/CRM/Core/DAO/Email.php @@ -0,0 +1,394 @@ +__table = 'civicrm_email'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email ID') , + 'description' => 'Unique Email ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email Contact') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email Location Type') , + 'description' => 'Which Location does this email belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_location_type', + 'keyColumn' => 'id', + 'labelColumn' => 'display_name', + ) + ) , + 'email' => array( + 'name' => 'email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Email') , + 'description' => 'Email address', + 'maxlength' => 254, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_email.email', + 'headerPattern' => '/e.?mail/i', + 'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/', + 'export' => true, + 'rule' => 'email', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_primary' => array( + 'name' => 'is_primary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Primary email') , + 'description' => 'Is this the primary?', + ) , + 'is_billing' => array( + 'name' => 'is_billing', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Billing Email?') , + 'description' => 'Is this the billing?', + ) , + 'on_hold' => array( + 'name' => 'on_hold', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('On Hold') , + 'description' => 'Is this address on bounce hold?', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_email.on_hold', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_bulkmail' => array( + 'name' => 'is_bulkmail', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Use for Bulk Mail') , + 'description' => 'Is this address for bulk mail ?', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_email.is_bulkmail', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'hold_date' => array( + 'name' => 'hold_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Hold Date') , + 'description' => 'When the address went on bounce hold', + ) , + 'reset_date' => array( + 'name' => 'reset_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Reset Date') , + 'description' => 'When the address bounce status was last reset', + ) , + 'signature_text' => array( + 'name' => 'signature_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Signature Text') , + 'description' => 'Text formatted signature for the email.', + 'import' => true, + 'where' => 'civicrm_email.signature_text', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + ) , + 'signature_html' => array( + 'name' => 'signature_html', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Signature Html') , + 'description' => 'HTML formatted signature for the email.', + 'import' => true, + 'where' => 'civicrm_email.signature_html', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'location_type_id' => 'location_type_id', + 'email' => 'email', + 'is_primary' => 'is_primary', + 'is_billing' => 'is_billing', + 'on_hold' => 'on_hold', + 'is_bulkmail' => 'is_bulkmail', + 'hold_date' => 'hold_date', + 'reset_date' => 'reset_date', + 'signature_text' => 'signature_text', + 'signature_html' => 'signature_html', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['email'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['email'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/EntityFile.php b/CRM/Core/DAO/EntityFile.php new file mode 100644 index 0000000000..6b20317f42 --- /dev/null +++ b/CRM/Core/DAO/EntityFile.php @@ -0,0 +1,251 @@ +__table = 'civicrm_entity_file'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'file_id', 'civicrm_file', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity File ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'file_id' => array( + 'name' => 'file_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('File') , + 'description' => 'FK to civicrm_file', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_File', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'file_id' => 'file_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['entity_file'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['entity_file'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/EntityTag.php b/CRM/Core/DAO/EntityTag.php new file mode 100644 index 0000000000..8a7ca8f4f8 --- /dev/null +++ b/CRM/Core/DAO/EntityTag.php @@ -0,0 +1,263 @@ +__table = 'civicrm_entity_tag'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'tag_id', 'civicrm_tag', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity Tag ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'physical tablename for entity being joined to file, e.g. civicrm_contact', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'pseudoconstant' => array( + 'optionGroupName' => 'tag_used_for', + 'optionEditPath' => 'civicrm/admin/options/tag_used_for', + ) + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'tag_id' => array( + 'name' => 'tag_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Tag') , + 'description' => 'FK to civicrm_tag', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Tag', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_tag', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'tag_id' => 'tag_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['entity_tag'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['entity_tag'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Extension.php b/CRM/Core/DAO/Extension.php new file mode 100644 index 0000000000..30b00015e7 --- /dev/null +++ b/CRM/Core/DAO/Extension.php @@ -0,0 +1,323 @@ +__table = 'civicrm_extension'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Extension ID') , + 'description' => 'Local Extension ID', + 'required' => true, + ) , + 'type' => array( + 'name' => 'type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Type') , + 'required' => true, + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getExtensionTypes', + ) + ) , + 'full_name' => array( + 'name' => 'full_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Key') , + 'description' => 'Fully qualified extension name', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Short name', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_extension.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label') , + 'description' => 'Short, printable name', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_extension.label', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'file' => array( + 'name' => 'file', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('File') , + 'description' => 'Primary PHP file', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_extension.file', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'schema_version' => array( + 'name' => 'schema_version', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Schema Version') , + 'description' => 'Revision code of the database schema; the format is module-defined', + 'maxlength' => 63, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_extension.schema_version', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Extension is Active?') , + 'description' => 'Is this extension active?', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'type' => 'type', + 'full_name' => 'full_name', + 'name' => 'name', + 'label' => 'label', + 'file' => 'file', + 'schema_version' => 'schema_version', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['extension'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['extension'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/File.php b/CRM/Core/DAO/File.php new file mode 100644 index 0000000000..ff1960bd99 --- /dev/null +++ b/CRM/Core/DAO/File.php @@ -0,0 +1,277 @@ +__table = 'civicrm_file'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('File ID') , + 'description' => 'Unique ID', + 'required' => true, + ) , + 'file_type_id' => array( + 'name' => 'file_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('File Type') , + 'description' => 'Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value.', + ) , + 'mime_type' => array( + 'name' => 'mime_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mime Type') , + 'description' => 'mime type of the document', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'uri' => array( + 'name' => 'uri', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Path') , + 'description' => 'uri of the file on disk', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'document' => array( + 'name' => 'document', + 'type' => CRM_Utils_Type::T_MEDIUMBLOB, + 'title' => ts('File Contents') , + 'description' => 'contents of the document', + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('File Description') , + 'description' => 'Additional descriptive text regarding this attachment (optional).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'upload_date' => array( + 'name' => 'upload_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('File Upload Date') , + 'description' => 'Date and time that this attachment was uploaded or written to server.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'file_type_id' => 'file_type_id', + 'mime_type' => 'mime_type', + 'uri' => 'uri', + 'document' => 'document', + 'description' => 'description', + 'upload_date' => 'upload_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['file'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['file'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/IM.php b/CRM/Core/DAO/IM.php new file mode 100644 index 0000000000..20ed47481a --- /dev/null +++ b/CRM/Core/DAO/IM.php @@ -0,0 +1,310 @@ +__table = 'civicrm_im'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Instant Messenger ID') , + 'description' => 'Unique IM ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('IM Contact') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('IM Location Type') , + 'description' => 'Which Location does this email belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_location_type', + 'keyColumn' => 'id', + 'labelColumn' => 'display_name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('IM Screen Name') , + 'description' => 'IM screen name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_im.name', + 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i', + 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'provider_id' => array( + 'name' => 'provider_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('IM Provider') , + 'description' => 'Which IM Provider does this screen name belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'instant_messenger_service', + 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', + ) + ) , + 'is_primary' => array( + 'name' => 'is_primary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is IM Primary?') , + 'description' => 'Is this the primary IM for this contact and location.', + ) , + 'is_billing' => array( + 'name' => 'is_billing', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is IM Billing?') , + 'description' => 'Is this the billing?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'location_type_id' => 'location_type_id', + 'name' => 'name', + 'provider_id' => 'provider_id', + 'is_primary' => 'is_primary', + 'is_billing' => 'is_billing', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['im'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['im'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Job.php b/CRM/Core/DAO/Job.php new file mode 100644 index 0000000000..0cc365b766 --- /dev/null +++ b/CRM/Core/DAO/Job.php @@ -0,0 +1,368 @@ +__table = 'civicrm_job'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Job ID') , + 'description' => 'Job Id', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Job Domain') , + 'description' => 'Which Domain is this scheduled job for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'run_frequency' => array( + 'name' => 'run_frequency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Job Frequency') , + 'description' => 'Scheduled job run frequency.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'Daily', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getJobFrequency', + ) + ) , + 'last_run' => array( + 'name' => 'last_run', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Last Run') , + 'description' => 'When was this cron entry last run', + 'default' => 'NULL', + ) , + 'scheduled_run_date' => array( + 'name' => 'scheduled_run_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Scheduled Run Date') , + 'description' => 'When is this cron entry scheduled to run', + 'required' => false, + 'default' => 'NULL', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Job Name') , + 'description' => 'Title of the job', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Job Description') , + 'description' => 'Description of the job', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'api_entity' => array( + 'name' => 'api_entity', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('API Entity') , + 'description' => 'Entity of the job api call', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'api_action' => array( + 'name' => 'api_action', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('API Action') , + 'description' => 'Action of the job api call', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'parameters' => array( + 'name' => 'parameters', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('API Parameters') , + 'description' => 'List of parameters to the command.', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Job Is Active?') , + 'description' => 'Is this job active?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'run_frequency' => 'run_frequency', + 'last_run' => 'last_run', + 'scheduled_run_date' => 'scheduled_run_date', + 'name' => 'name', + 'description' => 'description', + 'api_entity' => 'api_entity', + 'api_action' => 'api_action', + 'parameters' => 'parameters', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['job'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['job'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/JobLog.php b/CRM/Core/DAO/JobLog.php new file mode 100644 index 0000000000..ea8bcba10e --- /dev/null +++ b/CRM/Core/DAO/JobLog.php @@ -0,0 +1,310 @@ +__table = 'civicrm_job_log'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Job Log ID') , + 'description' => 'Job log entry Id', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Domain ID') , + 'description' => 'Which Domain is this scheduled job for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'run_time' => array( + 'name' => 'run_time', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Timestamp') , + 'description' => 'Log entry date', + ) , + 'job_id' => array( + 'name' => 'job_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Job ID') , + 'description' => 'Pointer to job id - not a FK though, just for logging purposes', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Job Name') , + 'description' => 'Title of the job', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'command' => array( + 'name' => 'command', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Command') , + 'description' => 'Full path to file containing job script', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Title line of log entry', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Extended Data') , + 'description' => 'Potential extended data for specific job run (e.g. tracebacks).', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'run_time' => 'run_time', + 'job_id' => 'job_id', + 'name' => 'name', + 'command' => 'command', + 'description' => 'description', + 'data' => 'data', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['job_log'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['job_log'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/LocBlock.php b/CRM/Core/DAO/LocBlock.php new file mode 100644 index 0000000000..c25b84b8f8 --- /dev/null +++ b/CRM/Core/DAO/LocBlock.php @@ -0,0 +1,309 @@ +__table = 'civicrm_loc_block'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_id', 'civicrm_im', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_2_id', 'civicrm_address', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_2_id', 'civicrm_email', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_2_id', 'civicrm_phone', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_2_id', 'civicrm_im', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block ID') , + 'description' => 'Unique ID', + 'required' => true, + ) , + 'address_id' => array( + 'name' => 'address_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block Address') , + 'FKClassName' => 'CRM_Core_DAO_Address', + ) , + 'email_id' => array( + 'name' => 'email_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block Email') , + 'FKClassName' => 'CRM_Core_DAO_Email', + ) , + 'phone_id' => array( + 'name' => 'phone_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block Phone') , + 'FKClassName' => 'CRM_Core_DAO_Phone', + ) , + 'im_id' => array( + 'name' => 'im_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block IM') , + 'FKClassName' => 'CRM_Core_DAO_IM', + ) , + 'address_2_id' => array( + 'name' => 'address_2_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block IM 2') , + 'FKClassName' => 'CRM_Core_DAO_Address', + ) , + 'email_2_id' => array( + 'name' => 'email_2_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email 2') , + 'FKClassName' => 'CRM_Core_DAO_Email', + ) , + 'phone_2_id' => array( + 'name' => 'phone_2_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone 2') , + 'FKClassName' => 'CRM_Core_DAO_Phone', + ) , + 'im_2_id' => array( + 'name' => 'im_2_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Instant Messenger 2') , + 'FKClassName' => 'CRM_Core_DAO_IM', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'address_id' => 'address_id', + 'email_id' => 'email_id', + 'phone_id' => 'phone_id', + 'im_id' => 'im_id', + 'address_2_id' => 'address_2_id', + 'email_2_id' => 'email_2_id', + 'phone_2_id' => 'phone_2_id', + 'im_2_id' => 'im_2_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['loc_block'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['loc_block'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/LocationType.php b/CRM/Core/DAO/LocationType.php new file mode 100644 index 0000000000..df94a41905 --- /dev/null +++ b/CRM/Core/DAO/LocationType.php @@ -0,0 +1,292 @@ +__table = 'civicrm_location_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Type ID') , + 'description' => 'Location Type ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Location Type') , + 'description' => 'Location Type Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'display_name' => array( + 'name' => 'display_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Display Name') , + 'description' => 'Location Type Display Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'vcard_name' => array( + 'name' => 'vcard_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('vCard Location Type') , + 'description' => 'vCard Location Type Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Location Type Description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Location Type is Reserved?') , + 'description' => 'Is this location type a predefined system location?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Location Type is Active?') , + 'description' => 'Is this property active?', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Default Location Type?') , + 'description' => 'Is this location type the default?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'display_name' => 'display_name', + 'vcard_name' => 'vcard_name', + 'description' => 'description', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + 'is_default' => 'is_default', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['location_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['location_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Log.php b/CRM/Core/DAO/Log.php new file mode 100644 index 0000000000..a2344c4dd2 --- /dev/null +++ b/CRM/Core/DAO/Log.php @@ -0,0 +1,277 @@ +__table = 'civicrm_log'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Log ID') , + 'description' => 'Log ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Name of table where item being referenced is stored.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID ') , + 'description' => 'Foreign key to the referenced item.', + 'required' => true, + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Data') , + 'description' => 'Updates does to this object if any.', + ) , + 'modified_id' => array( + 'name' => 'modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Modified By') , + 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Modified Date') , + 'description' => 'When was the referenced entity created or modified or deleted.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'data' => 'data', + 'modified_id' => 'modified_id', + 'modified_date' => 'modified_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['log'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['log'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/MailSettings.php b/CRM/Core/DAO/MailSettings.php new file mode 100644 index 0000000000..bc80a1e50e --- /dev/null +++ b/CRM/Core/DAO/MailSettings.php @@ -0,0 +1,407 @@ +__table = 'civicrm_mail_settings'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mail Settings ID') , + 'description' => 'primary key', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mail Settings Domain') , + 'description' => 'Which Domain is this match entry for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mail Settings Name') , + 'description' => 'name of this group of settings', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Default Mail Settings?') , + 'description' => 'whether this is the default set of settings for this domain', + ) , + 'domain' => array( + 'name' => 'domain', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('email Domain') , + 'description' => 'email address domain (the part after @)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'localpart' => array( + 'name' => 'localpart', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('email Local Part') , + 'description' => 'optional local part (like civimail+ for addresses like civimail+s.1.2@example.com)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'return_path' => array( + 'name' => 'return_path', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Return Path') , + 'description' => 'contents of the Return-Path header', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'protocol' => array( + 'name' => 'protocol', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Protocol') , + 'description' => 'name of the protocol to use for polling (like IMAP, POP3 or Maildir)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'mail_protocol', + 'optionEditPath' => 'civicrm/admin/options/mail_protocol', + ) + ) , + 'server' => array( + 'name' => 'server', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mail Server') , + 'description' => 'server to use when polling', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'port' => array( + 'name' => 'port', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mail Port') , + 'description' => 'port to use when polling', + ) , + 'username' => array( + 'name' => 'username', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mail Account Username') , + 'description' => 'username to use when polling', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'password' => array( + 'name' => 'password', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mail Account Password') , + 'description' => 'password to use when polling', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_ssl' => array( + 'name' => 'is_ssl', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Mail Account Uses SSL') , + 'description' => 'whether to use SSL or not', + ) , + 'source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mail Folder') , + 'description' => 'folder to poll from when using IMAP, path to poll from when using Maildir, etc.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'name', + 'is_default' => 'is_default', + 'domain' => 'domain', + 'localpart' => 'localpart', + 'return_path' => 'return_path', + 'protocol' => 'protocol', + 'server' => 'server', + 'port' => 'port', + 'username' => 'username', + 'password' => 'password', + 'is_ssl' => 'is_ssl', + 'source' => 'source', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mail_settings'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mail_settings'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Managed.php b/CRM/Core/DAO/Managed.php new file mode 100644 index 0000000000..2122d65cce --- /dev/null +++ b/CRM/Core/DAO/Managed.php @@ -0,0 +1,275 @@ +__table = 'civicrm_managed'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Managed ID') , + 'description' => 'Surrogate Key', + 'required' => true, + ) , + 'module' => array( + 'name' => 'module', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Module') , + 'description' => 'Name of the module which declared this object', + 'required' => true, + 'maxlength' => 127, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Symbolic name used by the module to identify the object', + 'maxlength' => 127, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'entity_type' => array( + 'name' => 'entity_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Type') , + 'description' => 'API entity type', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'Foreign key to the referenced item.', + 'required' => true, + ) , + 'cleanup' => array( + 'name' => 'cleanup', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Cleanup Setting') , + 'description' => 'Policy on when to cleanup entity (always, never, unused)', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'module' => 'module', + 'name' => 'name', + 'entity_type' => 'entity_type', + 'entity_id' => 'entity_id', + 'cleanup' => 'cleanup', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['managed'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['managed'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Mapping.php b/CRM/Core/DAO/Mapping.php new file mode 100644 index 0000000000..b71a3ac604 --- /dev/null +++ b/CRM/Core/DAO/Mapping.php @@ -0,0 +1,243 @@ +__table = 'civicrm_mapping'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mapping ID') , + 'description' => 'Mapping ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Name of Mapping', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Description of Mapping.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'mapping_type_id' => array( + 'name' => 'mapping_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mapping Type') , + 'description' => 'Mapping Type', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'mapping_type', + 'optionEditPath' => 'civicrm/admin/options/mapping_type', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'mapping_type_id' => 'mapping_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mapping'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mapping'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/MappingField.php b/CRM/Core/DAO/MappingField.php new file mode 100644 index 0000000000..d0276f8795 --- /dev/null +++ b/CRM/Core/DAO/MappingField.php @@ -0,0 +1,417 @@ +__table = 'civicrm_mapping_field'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mapping_id', 'civicrm_mapping', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mapping Field ID') , + 'description' => 'Mapping Field ID', + 'required' => true, + ) , + 'mapping_id' => array( + 'name' => 'mapping_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mapping ID') , + 'description' => 'Mapping to which this field belongs', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Mapping', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Mapping field key', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'contact_type' => array( + 'name' => 'contact_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type') , + 'description' => 'Contact Type in mapping', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'column_number' => array( + 'name' => 'column_number', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Column Number') , + 'description' => 'Column number for mapping set', + 'required' => true, + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location type ID') , + 'description' => 'Location type of this mapping, if required', + 'FKClassName' => 'CRM_Core_DAO_LocationType', + ) , + 'phone_type_id' => array( + 'name' => 'phone_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone type ID') , + 'description' => 'Which type of phone does this number belongs.', + ) , + 'im_provider_id' => array( + 'name' => 'im_provider_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('IM provider ID') , + 'description' => 'Which type of IM Provider does this name belong.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'instant_messenger_service', + 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', + ) + ) , + 'website_type_id' => array( + 'name' => 'website_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Website type ID') , + 'description' => 'Which type of website does this site belong', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'website_type', + 'optionEditPath' => 'civicrm/admin/options/website_type', + ) + ) , + 'relationship_type_id' => array( + 'name' => 'relationship_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Relationship type ID') , + 'description' => 'Relationship type, if required', + 'FKClassName' => 'CRM_Contact_DAO_RelationshipType', + ) , + 'relationship_direction' => array( + 'name' => 'relationship_direction', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Direction') , + 'maxlength' => 6, + 'size' => CRM_Utils_Type::SIX, + ) , + 'grouping' => array( + 'name' => 'grouping', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Grouping') , + 'description' => 'Used to group mapping_field records into related sets (e.g. for criteria sets in search builder + mappings). + ', + 'default' => '1', + ) , + 'operator' => array( + 'name' => 'operator', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Operator') , + 'description' => 'SQL WHERE operator for search-builder mapping fields (search criteria).', + 'maxlength' => 16, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators', + ) + ) , + 'value' => array( + 'name' => 'value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Value') , + 'description' => 'SQL WHERE value for search-builder mapping fields.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'mapping_id' => 'mapping_id', + 'name' => 'name', + 'contact_type' => 'contact_type', + 'column_number' => 'column_number', + 'location_type_id' => 'location_type_id', + 'phone_type_id' => 'phone_type_id', + 'im_provider_id' => 'im_provider_id', + 'website_type_id' => 'website_type_id', + 'relationship_type_id' => 'relationship_type_id', + 'relationship_direction' => 'relationship_direction', + 'grouping' => 'grouping', + 'operator' => 'operator', + 'value' => 'value', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mapping_field'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mapping_field'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Menu.php b/CRM/Core/DAO/Menu.php new file mode 100644 index 0000000000..9e516f064c --- /dev/null +++ b/CRM/Core/DAO/Menu.php @@ -0,0 +1,497 @@ +__table = 'civicrm_menu'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Menu ID') , + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Domain') , + 'description' => 'Which Domain is this menu item for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'path' => array( + 'name' => 'path', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Path') , + 'description' => 'Path Name', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'path_arguments' => array( + 'name' => 'path_arguments', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Arguments') , + 'description' => 'Arguments to pass to the url', + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Menu Title') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'access_callback' => array( + 'name' => 'access_callback', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Access Callback') , + 'description' => 'Function to call to check access permissions', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'access_arguments' => array( + 'name' => 'access_arguments', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Access Arguments') , + 'description' => 'Arguments to pass to access callback', + ) , + 'page_callback' => array( + 'name' => 'page_callback', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Page Callback') , + 'description' => 'function to call for this url', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'page_arguments' => array( + 'name' => 'page_arguments', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Page Arguments') , + 'description' => 'Arguments to pass to page callback', + ) , + 'breadcrumb' => array( + 'name' => 'breadcrumb', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Breadcrumb') , + 'description' => 'Breadcrumb for the path.', + ) , + 'return_url' => array( + 'name' => 'return_url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Return Url') , + 'description' => 'Url where a page should redirected to, if next url not known.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'return_url_args' => array( + 'name' => 'return_url_args', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Return Url Args') , + 'description' => 'Arguments to pass to return_url', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'component_id' => array( + 'name' => 'component_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Component') , + 'description' => 'Component that this menu item belongs to', + 'FKClassName' => 'CRM_Core_DAO_Component', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_component', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Enabled?') , + 'description' => 'Is this menu item active?', + ) , + 'is_public' => array( + 'name' => 'is_public', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Public?') , + 'description' => 'Is this menu accessible to the public?', + ) , + 'is_exposed' => array( + 'name' => 'is_exposed', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Exposed?') , + 'description' => 'Is this menu exposed to the navigation system?', + ) , + 'is_ssl' => array( + 'name' => 'is_ssl', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Use SSL?') , + 'description' => 'Should this menu be exposed via SSL if enabled?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Ordering of the menu items in various blocks.', + 'required' => true, + 'default' => '1', + ) , + 'type' => array( + 'name' => 'type', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Type') , + 'description' => 'Drupal menu type.', + 'required' => true, + 'default' => '1', + ) , + 'page_type' => array( + 'name' => 'page_type', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Page Type') , + 'description' => 'CiviCRM menu type.', + 'required' => true, + 'default' => '1', + ) , + 'skipBreadcrumb' => array( + 'name' => 'skipBreadcrumb', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Hide Breadcrumb?') , + 'description' => 'skip this url being exposed to breadcrumb', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'path' => 'path', + 'path_arguments' => 'path_arguments', + 'title' => 'title', + 'access_callback' => 'access_callback', + 'access_arguments' => 'access_arguments', + 'page_callback' => 'page_callback', + 'page_arguments' => 'page_arguments', + 'breadcrumb' => 'breadcrumb', + 'return_url' => 'return_url', + 'return_url_args' => 'return_url_args', + 'component_id' => 'component_id', + 'is_active' => 'is_active', + 'is_public' => 'is_public', + 'is_exposed' => 'is_exposed', + 'is_ssl' => 'is_ssl', + 'weight' => 'weight', + 'type' => 'type', + 'page_type' => 'page_type', + 'skipBreadcrumb' => 'skipBreadcrumb', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['menu'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['menu'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/MessageTemplate.php b/CRM/Core/DAO/MessageTemplate.php new file mode 100644 index 0000000000..11d09c787e --- /dev/null +++ b/CRM/Core/DAO/MessageTemplate.php @@ -0,0 +1,336 @@ +__table = 'civicrm_msg_template'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Message Template ID') , + 'description' => 'Message Template ID', + 'required' => true, + ) , + 'msg_title' => array( + 'name' => 'msg_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Message Template Title') , + 'description' => 'Descriptive title of message', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'msg_subject' => array( + 'name' => 'msg_subject', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Message Template Subject') , + 'description' => 'Subject for email message.', + ) , + 'msg_text' => array( + 'name' => 'msg_text', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Message Template Text') , + 'description' => 'Text formatted message', + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'msg_html' => array( + 'name' => 'msg_html', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Message Template HTML') , + 'description' => 'HTML formatted message', + 'html' => array( + 'type' => 'RichTextEditor', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'default' => '1', + ) , + 'workflow_id' => array( + 'name' => 'workflow_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Message Template Workflow') , + 'description' => 'a pseudo-FK to civicrm_option_value', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Message Template Is Default?') , + 'description' => 'is this the default message template for the workflow referenced by workflow_id?', + 'default' => '1', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Message Template Is Reserved?') , + 'description' => 'is this the reserved message template which we ship for the workflow referenced by workflow_id?', + ) , + 'is_sms' => array( + 'name' => 'is_sms', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Message Template is used for SMS?') , + 'description' => 'Is this message template used for sms?', + ) , + 'pdf_format_id' => array( + 'name' => 'pdf_format_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Message Template Format') , + 'description' => 'a pseudo-FK to civicrm_option_value containing PDF Page Format.', + 'pseudoconstant' => array( + 'optionGroupName' => 'pdf_format', + 'keyColumn' => 'id', + 'optionEditPath' => 'civicrm/admin/options/pdf_format', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'msg_title' => 'msg_title', + 'msg_subject' => 'msg_subject', + 'msg_text' => 'msg_text', + 'msg_html' => 'msg_html', + 'is_active' => 'is_active', + 'workflow_id' => 'workflow_id', + 'is_default' => 'is_default', + 'is_reserved' => 'is_reserved', + 'is_sms' => 'is_sms', + 'pdf_format_id' => 'pdf_format_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['msg_template'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['msg_template'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php new file mode 100644 index 0000000000..e5c330acec --- /dev/null +++ b/CRM/Core/DAO/Navigation.php @@ -0,0 +1,358 @@ +__table = 'civicrm_navigation'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_navigation', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Navigation ID') , + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Navigation Domain') , + 'description' => 'Which Domain is this navigation item for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Navigation Item Label') , + 'description' => 'Navigation Title', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Navigation Item Machine Name') , + 'description' => 'Internal Name', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url' => array( + 'name' => 'url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Url') , + 'description' => 'url in case of custom navigation link', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'permission' => array( + 'name' => 'permission', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Required Permission') , + 'description' => 'Permission for menu item', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'permission_operator' => array( + 'name' => 'permission_operator', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Permission Operator') , + 'description' => 'Permission Operator', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Navigation parent ID') , + 'description' => 'Parent navigation item, used for grouping', + 'FKClassName' => 'CRM_Core_DAO_Navigation', + 'pseudoconstant' => array( + 'table' => 'civicrm_navigation', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is this navigation item active?', + ) , + 'has_separator' => array( + 'name' => 'has_separator', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Use separator') , + 'description' => 'If separator needs to be added after this menu item', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Ordering of the navigation items in various blocks.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'label' => 'label', + 'name' => 'name', + 'url' => 'url', + 'permission' => 'permission', + 'permission_operator' => 'permission_operator', + 'parent_id' => 'parent_id', + 'is_active' => 'is_active', + 'has_separator' => 'has_separator', + 'weight' => 'weight', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['navigation'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['navigation'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Note.php b/CRM/Core/DAO/Note.php new file mode 100644 index 0000000000..3706b0ca64 --- /dev/null +++ b/CRM/Core/DAO/Note.php @@ -0,0 +1,327 @@ +__table = 'civicrm_note'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Note ID') , + 'description' => 'Note ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Note Entity') , + 'description' => 'Name of table where item being referenced is stored.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_BAO_Note::entityTables', + ) + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Note Entity ID') , + 'description' => 'Foreign key to the referenced item.', + 'required' => true, + ) , + 'note' => array( + 'name' => 'note', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Note') , + 'description' => 'Note and/or Comment.', + 'rows' => 4, + 'cols' => 60, + 'import' => true, + 'where' => 'civicrm_note.note', + 'headerPattern' => '/Note|Comment/i', + 'dataPattern' => '//', + 'export' => true, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Note Created By') , + 'description' => 'FK to Contact ID creator', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Note Modified By') , + 'description' => 'When was this note last modified/edited', + ) , + 'subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Subject') , + 'description' => 'subject of note description', + 'maxlength' => 255, + 'size' => 60, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'privacy' => array( + 'name' => 'privacy', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Privacy') , + 'description' => 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'pseudoconstant' => array( + 'optionGroupName' => 'note_privacy', + 'optionEditPath' => 'civicrm/admin/options/note_privacy', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'note' => 'note', + 'contact_id' => 'contact_id', + 'modified_date' => 'modified_date', + 'subject' => 'subject', + 'privacy' => 'privacy', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['note'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['note'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/OpenID.php b/CRM/Core/DAO/OpenID.php new file mode 100644 index 0000000000..a5a97b4584 --- /dev/null +++ b/CRM/Core/DAO/OpenID.php @@ -0,0 +1,281 @@ +__table = 'civicrm_openid'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Open ID identifier') , + 'description' => 'Unique OpenID ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('OpenID Contact') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('OpenID Location Type') , + 'description' => 'Which Location does this email belong to.', + ) , + 'openid' => array( + 'name' => 'openid', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('OpenID') , + 'description' => 'the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_openid.openid', + 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i', + 'dataPattern' => '/^[\w\/\:\.]+$/', + 'export' => true, + 'rule' => 'url', + ) , + 'allowed_to_login' => array( + 'name' => 'allowed_to_login', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allowed to login?') , + 'description' => 'Whether or not this user is allowed to login', + 'required' => true, + ) , + 'is_primary' => array( + 'name' => 'is_primary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is OpenID Primary?') , + 'description' => 'Is this the primary email for this contact and location.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'location_type_id' => 'location_type_id', + 'openid' => 'openid', + 'allowed_to_login' => 'allowed_to_login', + 'is_primary' => 'is_primary', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['openid'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['openid'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/OptionGroup.php b/CRM/Core/DAO/OptionGroup.php new file mode 100644 index 0000000000..dd423b5365 --- /dev/null +++ b/CRM/Core/DAO/OptionGroup.php @@ -0,0 +1,279 @@ +__table = 'civicrm_option_group'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Group ID') , + 'description' => 'Option Group ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Group Name') , + 'description' => 'Option group name. Used as selection key by class properties which lookup options in civicrm_option_value.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Group title') , + 'description' => 'Option Group title.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Group Description') , + 'description' => 'Option group description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option Group Is Reserved?') , + 'description' => 'Is this a predefined system option group (i.e. it can not be deleted)?', + 'default' => '1', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option Group Is Active?') , + 'description' => 'Is this option group active?', + ) , + 'is_locked' => array( + 'name' => 'is_locked', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option Group Is Locked') , + 'description' => 'A lock to remove the ability to add new options via the UI.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + 'is_locked' => 'is_locked', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['option_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['option_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/OptionValue.php b/CRM/Core/DAO/OptionValue.php new file mode 100644 index 0000000000..eccecaf898 --- /dev/null +++ b/CRM/Core/DAO/OptionValue.php @@ -0,0 +1,449 @@ +__table = 'civicrm_option_value'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'option_group_id', 'civicrm_option_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Value ID') , + 'description' => 'Option ID', + 'required' => true, + ) , + 'option_group_id' => array( + 'name' => 'option_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Group ID') , + 'description' => 'Group which this option belongs to.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_OptionGroup', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_option_group', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Label') , + 'description' => 'Option string as displayed to users - e.g. the label in an HTML OPTION tag.', + 'required' => true, + 'maxlength' => 512, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'value' => array( + 'name' => 'value', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Value') , + 'description' => 'The actual value stored (as a foreign key) in the data record. Functions which need lookup option_value.title should use civicrm_option_value.option_group_id plus civicrm_option_value.value as the key.', + 'required' => true, + 'maxlength' => 512, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Name') , + 'description' => 'Stores a fixed (non-translated) name for this option value. Lookup functions should use the name as the key for the option value row.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_option_value.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'grouping' => array( + 'name' => 'grouping', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Option Grouping Name') , + 'description' => 'Use to sort and/or set display properties for sub-set(s) of options within an option group. EXAMPLE: Use for college_interest field, to differentiate partners from non-partners.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'filter' => array( + 'name' => 'filter', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Filter') , + 'description' => 'Bitwise logic can be used to create subsets of options within an option_group for different uses.', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option is Default?') , + 'description' => 'Is this the default option for the group?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Controls display sort order.', + 'required' => true, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Option Description') , + 'description' => 'Optional description.', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_optgroup' => array( + 'name' => 'is_optgroup', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option is Header?') , + 'description' => 'Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options?', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option Is Reserved?') , + 'description' => 'Is this a predefined system object?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Option Is Active') , + 'description' => 'Is this option active?', + 'default' => '1', + ) , + 'component_id' => array( + 'name' => 'component_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Component') , + 'description' => 'Component that this option value belongs/caters to.', + 'FKClassName' => 'CRM_Core_DAO_Component', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_component', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Domain') , + 'description' => 'Which Domain is this option value for', + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'visibility_id' => array( + 'name' => 'visibility_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Option Visibility') , + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'option_group_id' => 'option_group_id', + 'label' => 'label', + 'value' => 'value', + 'name' => 'name', + 'grouping' => 'grouping', + 'filter' => 'filter', + 'is_default' => 'is_default', + 'weight' => 'weight', + 'description' => 'description', + 'is_optgroup' => 'is_optgroup', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + 'component_id' => 'component_id', + 'domain_id' => 'domain_id', + 'visibility_id' => 'visibility_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['option_value'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['option_value'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Persistent.php b/CRM/Core/DAO/Persistent.php new file mode 100644 index 0000000000..1388258712 --- /dev/null +++ b/CRM/Core/DAO/Persistent.php @@ -0,0 +1,252 @@ +__table = 'civicrm_persistent'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Persistent ID') , + 'description' => 'Persistent Record Id', + 'required' => true, + ) , + 'context' => array( + 'name' => 'context', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Context') , + 'description' => 'Context for which name data pair is to be stored', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Name of Context', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Data') , + 'description' => 'data associated with name', + ) , + 'is_config' => array( + 'name' => 'is_config', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Configuration?') , + 'description' => 'Config Settings', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'context' => 'context', + 'name' => 'name', + 'data' => 'data', + 'is_config' => 'is_config', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['persistent'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['persistent'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php new file mode 100644 index 0000000000..cfbc653c61 --- /dev/null +++ b/CRM/Core/DAO/Phone.php @@ -0,0 +1,361 @@ +__table = 'civicrm_phone'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone ID') , + 'description' => 'Unique Phone ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone Contact') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone Location Type') , + 'description' => 'Which Location does this phone belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_location_type', + 'keyColumn' => 'id', + 'labelColumn' => 'display_name', + ) + ) , + 'is_primary' => array( + 'name' => 'is_primary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Phone Primary?') , + 'description' => 'Is this the primary phone for this contact and location.', + ) , + 'is_billing' => array( + 'name' => 'is_billing', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Billing Phone') , + 'description' => 'Is this the billing?', + ) , + 'mobile_provider_id' => array( + 'name' => 'mobile_provider_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mobile Provider') , + 'description' => 'Which Mobile Provider does this phone belong to.', + ) , + 'phone' => array( + 'name' => 'phone', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Phone') , + 'description' => 'Complete phone number.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'import' => true, + 'where' => 'civicrm_phone.phone', + 'headerPattern' => '/phone/i', + 'dataPattern' => '/^[\d\(\)\-\.\s]+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'phone_ext' => array( + 'name' => 'phone_ext', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Phone Extension') , + 'description' => 'Optional extension for a phone number.', + 'maxlength' => 16, + 'size' => 4, + 'import' => true, + 'where' => 'civicrm_phone.phone_ext', + 'headerPattern' => '/extension/i', + 'dataPattern' => '/^\d+$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'phone_numeric' => array( + 'name' => 'phone_numeric', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Phone Numeric') , + 'description' => 'Phone number stripped of all whitespace, letters, and punctuation.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'phone_type_id' => array( + 'name' => 'phone_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone Type') , + 'description' => 'Which type of phone does this number belongs.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'phone_type', + 'optionEditPath' => 'civicrm/admin/options/phone_type', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'location_type_id' => 'location_type_id', + 'is_primary' => 'is_primary', + 'is_billing' => 'is_billing', + 'mobile_provider_id' => 'mobile_provider_id', + 'phone' => 'phone', + 'phone_ext' => 'phone_ext', + 'phone_numeric' => 'phone_numeric', + 'phone_type_id' => 'phone_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['phone'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['phone'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/PreferencesDate.php b/CRM/Core/DAO/PreferencesDate.php new file mode 100644 index 0000000000..2c18ba1737 --- /dev/null +++ b/CRM/Core/DAO/PreferencesDate.php @@ -0,0 +1,280 @@ +__table = 'civicrm_preferences_date'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Date Preference ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Date Preference Name') , + 'description' => 'The meta name for this date (fixed in code)', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Description of this date type.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'start' => array( + 'name' => 'start', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Start') , + 'description' => 'The start offset relative to current year', + 'required' => true, + ) , + 'end' => array( + 'name' => 'end', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('End Offset') , + 'description' => 'The end offset relative to current year, can be negative', + 'required' => true, + ) , + 'date_format' => array( + 'name' => 'date_format', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Date Format') , + 'description' => 'The date type', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'time_format' => array( + 'name' => 'time_format', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Time Format') , + 'description' => 'time format', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'start' => 'start', + 'end' => 'end', + 'date_format' => 'date_format', + 'time_format' => 'time_format', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['preferences_date'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['preferences_date'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/PrevNextCache.php b/CRM/Core/DAO/PrevNextCache.php new file mode 100644 index 0000000000..71fc3f212e --- /dev/null +++ b/CRM/Core/DAO/PrevNextCache.php @@ -0,0 +1,273 @@ +__table = 'civicrm_prevnext_cache'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Prev Next Cache ID') , + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Prev Next Entity Table') , + 'description' => 'physical tablename for entity being joined to discount, e.g. civicrm_event', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id1' => array( + 'name' => 'entity_id1', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Prev Next Entity ID 1') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'entity_id2' => array( + 'name' => 'entity_id2', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Prev Next Entity ID 2') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'cacheKey' => array( + 'name' => 'cacheKey', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Cache Key') , + 'description' => 'Unique path name for cache element of the searched item', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Prev Next Data') , + 'description' => 'cached snapshot of the serialized data', + ) , + 'is_selected' => array( + 'name' => 'is_selected', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Selected') , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id1' => 'entity_id1', + 'entity_id2' => 'entity_id2', + 'cacheKey' => 'cacheKey', + 'data' => 'data', + 'is_selected' => 'is_selected', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['prevnext_cache'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['prevnext_cache'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/PrintLabel.php b/CRM/Core/DAO/PrintLabel.php new file mode 100644 index 0000000000..ec289a2547 --- /dev/null +++ b/CRM/Core/DAO/PrintLabel.php @@ -0,0 +1,358 @@ +__table = 'civicrm_print_label'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Print Label ID') , + 'required' => true, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title') , + 'description' => 'User title for for this label layout', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'variable name/programmatic handle for this field.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Description') , + 'description' => 'Description of this label layout', + ) , + 'label_format_name' => array( + 'name' => 'label_format_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label Format') , + 'description' => 'This refers to name column of civicrm_option_value row in name_badge option group', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'name_badge', + 'optionEditPath' => 'civicrm/admin/options/name_badge', + ) + ) , + 'label_type_id' => array( + 'name' => 'label_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Label Type') , + 'description' => 'Implicit FK to civicrm_option_value row in NEW label_type option group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'label_type', + 'optionEditPath' => 'civicrm/admin/options/label_type', + ) + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Data') , + 'description' => 'contains json encode configurations options', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Label is Default?') , + 'description' => 'Is this default?', + 'default' => '1', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Label Is Active?') , + 'description' => 'Is this option active?', + 'default' => '1', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Label Reserved?') , + 'description' => 'Is this reserved label?', + 'default' => '1', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Label Created By') , + 'description' => 'FK to civicrm_contact, who created this label layout', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'title' => 'title', + 'name' => 'name', + 'description' => 'description', + 'label_format_name' => 'label_format_name', + 'label_type_id' => 'label_type_id', + 'data' => 'data', + 'is_default' => 'is_default', + 'is_active' => 'is_active', + 'is_reserved' => 'is_reserved', + 'created_id' => 'created_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['print_label'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['print_label'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/RecurringEntity.php b/CRM/Core/DAO/RecurringEntity.php new file mode 100644 index 0000000000..437f3e404f --- /dev/null +++ b/CRM/Core/DAO/RecurringEntity.php @@ -0,0 +1,249 @@ +__table = 'civicrm_recurring_entity'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('ID') , + 'required' => true, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent ID') , + 'description' => 'Recurring Entity Parent ID', + 'required' => true, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'Recurring Entity Child ID', + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Physical tablename for entity, e.g. civicrm_event', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'mode' => array( + 'name' => 'mode', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Cascade Type') , + 'description' => '1-this entity, 2-this and the following entities, 3-all the entities', + 'required' => true, + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'parent_id' => 'parent_id', + 'entity_id' => 'entity_id', + 'entity_table' => 'entity_table', + 'mode' => 'mode', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['recurring_entity'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['recurring_entity'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Setting.php b/CRM/Core/DAO/Setting.php new file mode 100644 index 0000000000..5c31496f0d --- /dev/null +++ b/CRM/Core/DAO/Setting.php @@ -0,0 +1,331 @@ +__table = 'civicrm_setting'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'component_id', 'civicrm_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Setting Name') , + 'description' => 'Unique name for setting', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'value' => array( + 'name' => 'value', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Value') , + 'description' => 'data associated with this group / name combo', + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting Domain') , + 'description' => 'Which Domain is this menu item for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting Contact') , + 'description' => 'FK to Contact ID if the setting is localized to a contact', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'is_domain' => array( + 'name' => 'is_domain', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Domain Setting?') , + 'description' => 'Is this setting a contact specific or site wide setting?', + ) , + 'component_id' => array( + 'name' => 'component_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting Component') , + 'description' => 'Component that this menu item belongs to', + 'FKClassName' => 'CRM_Core_DAO_Component', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_component', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Setting Created Date') , + 'description' => 'When was the setting created', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting Created By') , + 'description' => 'FK to civicrm_contact, who created this setting', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'value' => 'value', + 'domain_id' => 'domain_id', + 'contact_id' => 'contact_id', + 'is_domain' => 'is_domain', + 'component_id' => 'component_id', + 'created_date' => 'created_date', + 'created_id' => 'created_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['setting'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['setting'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/StateProvince.php b/CRM/Core/DAO/StateProvince.php new file mode 100644 index 0000000000..656e4e49e6 --- /dev/null +++ b/CRM/Core/DAO/StateProvince.php @@ -0,0 +1,256 @@ +__table = 'civicrm_state_province'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('State ID') , + 'description' => 'State/Province ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('State') , + 'description' => 'Name of State/Province', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_state_province.name', + 'headerPattern' => '/state|prov(ince)?/i', + 'dataPattern' => '/[A-Z]{2}/', + 'export' => true, + ) , + 'abbreviation' => array( + 'name' => 'abbreviation', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('State Abbreviation') , + 'description' => '2-4 Character Abbreviation of State/Province', + 'maxlength' => 4, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'country_id' => array( + 'name' => 'country_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('County') , + 'description' => 'ID of Country that State/Province belong', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Country', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'abbreviation' => 'abbreviation', + 'country_id' => 'country_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['state_province'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['state_province'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/StatusPreference.php b/CRM/Core/DAO/StatusPreference.php new file mode 100644 index 0000000000..a06a3e1023 --- /dev/null +++ b/CRM/Core/DAO/StatusPreference.php @@ -0,0 +1,318 @@ +__table = 'civicrm_status_pref'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Status Preference ID') , + 'description' => 'Unique Status Preference ID', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Setting Domain') , + 'description' => 'Which Domain is this Status Preference for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Status Check Name') , + 'description' => 'Name of the status check this preference references.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_status_pref.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'hush_until' => array( + 'name' => 'hush_until', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Snooze Status Notifications Until') , + 'description' => 'expires ignore_severity. NULL never hushes.', + 'import' => true, + 'where' => 'civicrm_status_pref.hush_until', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + ) , + 'ignore_severity' => array( + 'name' => 'ignore_severity', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Ignore Severity') , + 'description' => 'Hush messages up to and including this severity.', + 'import' => true, + 'where' => 'civicrm_status_pref.ignore_severity', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'pseudoconstant' => array( + 'callback' => 'CRM_Utils_Check::getSeverityList', + ) + ) , + 'prefs' => array( + 'name' => 'prefs', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Status Preferences') , + 'description' => 'These settings are per-check, and can\'t be compared across checks.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'check_info' => array( + 'name' => 'check_info', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Check Info') , + 'description' => 'These values are per-check, and can\'t be compared across checks.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'name', + 'hush_until' => 'hush_until', + 'ignore_severity' => 'ignore_severity', + 'prefs' => 'prefs', + 'check_info' => 'check_info', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['status_pref'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['status_pref'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/SystemLog.php b/CRM/Core/DAO/SystemLog.php new file mode 100644 index 0000000000..50400f53af --- /dev/null +++ b/CRM/Core/DAO/SystemLog.php @@ -0,0 +1,280 @@ +__table = 'civicrm_system_log'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('System Log ID') , + 'description' => 'Primary key ID', + 'required' => true, + ) , + 'message' => array( + 'name' => 'message', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('System Log Message') , + 'description' => 'Standardized message', + 'required' => true, + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'context' => array( + 'name' => 'context', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Detailed Log Data') , + 'description' => 'JSON encoded data', + ) , + 'level' => array( + 'name' => 'level', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Detailed Log Data') , + 'description' => 'error level per PSR3', + 'maxlength' => 9, + 'size' => CRM_Utils_Type::TWELVE, + 'default' => 'info', + ) , + 'timestamp' => array( + 'name' => 'timestamp', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Log Timestamp') , + 'description' => 'Timestamp of when event occurred.', + 'default' => 'CURRENT_TIMESTAMP', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Log Contact ID') , + 'description' => 'Optional Contact ID that created the log. Not an FK as we keep this regardless', + ) , + 'hostname' => array( + 'name' => 'hostname', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Log Host') , + 'description' => 'Optional Name of logging host', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'message' => 'message', + 'context' => 'context', + 'level' => 'level', + 'timestamp' => 'timestamp', + 'contact_id' => 'contact_id', + 'hostname' => 'hostname', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['system_log'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['system_log'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Tag.php b/CRM/Core/DAO/Tag.php new file mode 100644 index 0000000000..4e08bfe57d --- /dev/null +++ b/CRM/Core/DAO/Tag.php @@ -0,0 +1,337 @@ +__table = 'civicrm_tag'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_tag', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Tag ID') , + 'description' => 'Tag ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Tag Name') , + 'description' => 'Name of Tag.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Optional verbose description of the tag.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent Tag') , + 'description' => 'Optional parent id for this tag.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Tag', + ) , + 'is_selectable' => array( + 'name' => 'is_selectable', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Display Tag?') , + 'description' => 'Is this tag selectable / displayed', + 'default' => '1', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Reserved') , + ) , + 'is_tagset' => array( + 'name' => 'is_tagset', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Tagset') , + ) , + 'used_for' => array( + 'name' => 'used_for', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Used For') , + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'tag_used_for', + 'optionEditPath' => 'civicrm/admin/options/tag_used_for', + ) + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Tag Created By') , + 'description' => 'FK to civicrm_contact, who created this tag', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Tag Created Date') , + 'description' => 'Date and time that tag was created.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'parent_id' => 'parent_id', + 'is_selectable' => 'is_selectable', + 'is_reserved' => 'is_reserved', + 'is_tagset' => 'is_tagset', + 'used_for' => 'used_for', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['tag'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['tag'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Timezone.php b/CRM/Core/DAO/Timezone.php new file mode 100644 index 0000000000..f172028d29 --- /dev/null +++ b/CRM/Core/DAO/Timezone.php @@ -0,0 +1,277 @@ +__table = 'civicrm_timezone'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'country_id', 'civicrm_country', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Timezone ID') , + 'description' => 'Timezone Id', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Timezone Name') , + 'description' => 'Timezone full name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'abbreviation' => array( + 'name' => 'abbreviation', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Timezone Abbreviation') , + 'description' => 'ISO Code for timezone abbreviation', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + ) , + 'gmt' => array( + 'name' => 'gmt', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('GMT Name of Timezone') , + 'description' => 'GMT name of the timezone', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'offset' => array( + 'name' => 'offset', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('GMT Offset') , + ) , + 'country_id' => array( + 'name' => 'country_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Country') , + 'description' => 'Country Id', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Country', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'abbreviation' => 'abbreviation', + 'gmt' => 'gmt', + 'offset' => 'offset', + 'country_id' => 'country_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['timezone'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['timezone'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/UFField.php b/CRM/Core/DAO/UFField.php new file mode 100644 index 0000000000..a3fb313bde --- /dev/null +++ b/CRM/Core/DAO/UFField.php @@ -0,0 +1,472 @@ +__table = 'civicrm_uf_field'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Field ID') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'uf_group_id' => array( + 'name' => 'uf_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile ID') , + 'description' => 'Which form does this field belong to.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_UFGroup', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_uf_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'field_name' => array( + 'name' => 'field_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Field Name') , + 'description' => 'Name for CiviCRM field which is being exposed for sharing.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Is Active') , + 'description' => 'Is this field currently shareable? If false, hide the field for all sharing contexts.', + 'default' => '1', + ) , + 'is_view' => array( + 'name' => 'is_view', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Is View Only') , + 'description' => 'the field is view only and not editable in user forms.', + ) , + 'is_required' => array( + 'name' => 'is_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Is Required') , + 'description' => 'Is this field required when included in a user or registration form?', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Controls field display order when user framework fields are displayed in registration and account editing forms.', + 'required' => true, + 'default' => '1', + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Profile Field Post Help') , + 'description' => 'Description and/or help text to display after this field.', + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Profile Field Pre Help') , + 'description' => 'Description and/or help text to display before this field.', + ) , + 'visibility' => array( + 'name' => 'visibility', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Field Visibility') , + 'description' => 'In what context(s) is this field visible.', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'default' => 'User and User Admin Only', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::ufVisibility', + ) + ) , + 'in_selector' => array( + 'name' => 'in_selector', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Is a Filter') , + 'description' => 'Is this field included as a column in the selector table?', + ) , + 'is_searchable' => array( + 'name' => 'is_searchable', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Is Searchable') , + 'description' => 'Is this field included search form of profile?', + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Field Location Type') , + 'description' => 'Location type of this mapping, if required', + 'FKClassName' => 'CRM_Core_DAO_LocationType', + ) , + 'phone_type_id' => array( + 'name' => 'phone_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Field Phone Type') , + 'description' => 'Phone Type Id, if required', + ) , + 'website_type_id' => array( + 'name' => 'website_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Field Website Type') , + 'description' => 'Website Type Id, if required', + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Field Label') , + 'description' => 'To save label for fields.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'field_type' => array( + 'name' => 'field_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Field Type') , + 'description' => 'This field saves field type (ie individual,household.. field etc).', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Is Reserved') , + 'description' => 'Is this field reserved for use by some other CiviCRM functionality?', + ) , + 'is_multi_summary' => array( + 'name' => 'is_multi_summary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Field Supports Multiple') , + 'description' => 'Include in multi-record listing?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'uf_group_id' => 'uf_group_id', + 'field_name' => 'field_name', + 'is_active' => 'is_active', + 'is_view' => 'is_view', + 'is_required' => 'is_required', + 'weight' => 'weight', + 'help_post' => 'help_post', + 'help_pre' => 'help_pre', + 'visibility' => 'visibility', + 'in_selector' => 'in_selector', + 'is_searchable' => 'is_searchable', + 'location_type_id' => 'location_type_id', + 'phone_type_id' => 'phone_type_id', + 'website_type_id' => 'website_type_id', + 'label' => 'label', + 'field_type' => 'field_type', + 'is_reserved' => 'is_reserved', + 'is_multi_summary' => 'is_multi_summary', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['uf_field'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['uf_field'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/UFGroup.php b/CRM/Core/DAO/UFGroup.php new file mode 100644 index 0000000000..f5b9ac159a --- /dev/null +++ b/CRM/Core/DAO/UFGroup.php @@ -0,0 +1,527 @@ +__table = 'civicrm_uf_group'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'limit_listings_group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'add_to_group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile ID') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Is Active') , + 'description' => 'Is this form currently active? If false, hide all related fields for all sharing contexts.', + 'default' => '1', + ) , + 'group_type' => array( + 'name' => 'group_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Group Type') , + 'description' => 'This column will store a comma separated list of the type(s) of profile fields.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_uf_group.group_type', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title') , + 'description' => 'Form title.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Profile Description') , + 'description' => 'Optional verbose description of the profile.', + 'rows' => 2, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Help Pre') , + 'description' => 'Description and/or help text to display before fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Profile Post Text') , + 'description' => 'Description and/or help text to display after fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'limit_listings_group_id' => array( + 'name' => 'limit_listings_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Search Limit Group') , + 'description' => 'Group id, foreign key from civicrm_group', + 'FKClassName' => 'CRM_Contact_DAO_Group', + ) , + 'post_URL' => array( + 'name' => 'post_URL', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Post Url') , + 'description' => 'Redirect to URL.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'add_to_group_id' => array( + 'name' => 'add_to_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Add Contact To Group') , + 'description' => 'foreign key to civicrm_group_id', + 'FKClassName' => 'CRM_Contact_DAO_Group', + ) , + 'add_captcha' => array( + 'name' => 'add_captcha', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Show Captcha On Profile') , + 'description' => 'Should a CAPTCHA widget be included this Profile form.', + ) , + 'is_map' => array( + 'name' => 'is_map', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Map Profile') , + 'description' => 'Do we want to map results from this profile.', + ) , + 'is_edit_link' => array( + 'name' => 'is_edit_link', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Show Edit Link?') , + 'description' => 'Should edit link display in profile selector', + ) , + 'is_uf_link' => array( + 'name' => 'is_uf_link', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Show Link to CMS User') , + 'description' => 'Should we display a link to the website profile in profile selector', + ) , + 'is_update_dupe' => array( + 'name' => 'is_update_dupe', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Update on Duplicate') , + 'description' => 'Should we update the contact record if we find a duplicate', + ) , + 'cancel_URL' => array( + 'name' => 'cancel_URL', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Cancel URL') , + 'description' => 'Redirect to URL when Cancle button clik .', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_cms_user' => array( + 'name' => 'is_cms_user', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Create CMS User?') , + 'description' => 'Should we create a cms user for this profile ', + ) , + 'notify' => array( + 'name' => 'notify', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Notify on Profile Submit') , + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Is Reserved') , + 'description' => 'Is this group reserved for use by some other CiviCRM functionality?', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Name') , + 'description' => 'Name of the UF group for directly addressing it in the codebase', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Created By') , + 'description' => 'FK to civicrm_contact, who created this UF group', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('UF Group Created Date') , + 'description' => 'Date and time this UF group was created.', + ) , + 'is_proximity_search' => array( + 'name' => 'is_proximity_search', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Include Proximity Search?') , + 'description' => 'Should we include proximity search feature in this profile search form?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'is_active' => 'is_active', + 'group_type' => 'group_type', + 'title' => 'title', + 'description' => 'description', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'limit_listings_group_id' => 'limit_listings_group_id', + 'post_URL' => 'post_URL', + 'add_to_group_id' => 'add_to_group_id', + 'add_captcha' => 'add_captcha', + 'is_map' => 'is_map', + 'is_edit_link' => 'is_edit_link', + 'is_uf_link' => 'is_uf_link', + 'is_update_dupe' => 'is_update_dupe', + 'cancel_URL' => 'cancel_URL', + 'is_cms_user' => 'is_cms_user', + 'notify' => 'notify', + 'is_reserved' => 'is_reserved', + 'name' => 'name', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'is_proximity_search' => 'is_proximity_search', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['uf_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['uf_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/UFJoin.php b/CRM/Core/DAO/UFJoin.php new file mode 100644 index 0000000000..298c017858 --- /dev/null +++ b/CRM/Core/DAO/UFJoin.php @@ -0,0 +1,319 @@ +__table = 'civicrm_uf_join'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'uf_group_id', 'civicrm_uf_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('UF Join ID') , + 'description' => 'Unique table ID', + 'required' => true, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Profile Use is active') , + 'description' => 'Is this join currently active?', + 'default' => '1', + ) , + 'module' => array( + 'name' => 'module', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Module') , + 'description' => 'Module which owns this uf_join instance, e.g. User Registration, CiviDonate, etc.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Profile Entity Table') , + 'description' => 'Name of table where item being referenced is stored. Modules which only need a single collection of uf_join instances may choose not to populate entity_table and entity_id.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_BAO_UFJoin::entityTables', + ) + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile Entity ID') , + 'description' => 'Foreign key to the referenced item.', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Controls display order when multiple user framework groups are setup for concurrent display.', + 'required' => true, + 'default' => '1', + ) , + 'uf_group_id' => array( + 'name' => 'uf_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Profile ID') , + 'description' => 'Which form does this field belong to.', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_UFGroup', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_uf_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'module_data' => array( + 'name' => 'module_data', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Profile Use Data') , + 'description' => 'Json serialized array of data used by the ufjoin.module', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'is_active' => 'is_active', + 'module' => 'module', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'weight' => 'weight', + 'uf_group_id' => 'uf_group_id', + 'module_data' => 'module_data', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['uf_join'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['uf_join'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/UFMatch.php b/CRM/Core/DAO/UFMatch.php new file mode 100644 index 0000000000..0ddfb85e4f --- /dev/null +++ b/CRM/Core/DAO/UFMatch.php @@ -0,0 +1,285 @@ +__table = 'civicrm_uf_match'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('UF Match ID') , + 'description' => 'System generated ID.', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('UF Match Domain ID') , + 'description' => 'Which Domain is this match entry for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'uf_id' => array( + 'name' => 'uf_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('CMS ID') , + 'description' => 'UF ID', + 'required' => true, + ) , + 'uf_name' => array( + 'name' => 'uf_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('CMS Unique Identifier') , + 'description' => 'UF Name', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('CiviCRM Contact ID') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'language' => array( + 'name' => 'language', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Preferred Language') , + 'description' => 'UI language preferred by the given user/contact', + 'maxlength' => 5, + 'size' => CRM_Utils_Type::SIX, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'uf_id' => 'uf_id', + 'uf_name' => 'uf_name', + 'contact_id' => 'contact_id', + 'language' => 'language', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['uf_match'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['uf_match'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Website.php b/CRM/Core/DAO/Website.php new file mode 100644 index 0000000000..d2eb9b6c0c --- /dev/null +++ b/CRM/Core/DAO/Website.php @@ -0,0 +1,263 @@ +__table = 'civicrm_website'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Website ID') , + 'description' => 'Unique Website ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'url' => array( + 'name' => 'url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Website') , + 'description' => 'Website', + 'maxlength' => 128, + 'size' => 30, + 'import' => true, + 'where' => 'civicrm_website.url', + 'headerPattern' => '/Website/i', + 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'website_type_id' => array( + 'name' => 'website_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Website Type') , + 'description' => 'Which Website type does this website belong to.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'website_type', + 'optionEditPath' => 'civicrm/admin/options/website_type', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id' => 'contact_id', + 'url' => 'url', + 'website_type_id' => 'website_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['website'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['website'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/WordReplacement.php b/CRM/Core/DAO/WordReplacement.php new file mode 100644 index 0000000000..b1567ee55a --- /dev/null +++ b/CRM/Core/DAO/WordReplacement.php @@ -0,0 +1,289 @@ +__table = 'civicrm_word_replacement'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Word Replacement ID') , + 'description' => 'Word replacement ID', + 'required' => true, + ) , + 'find_word' => array( + 'name' => 'find_word', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Replaced Word') , + 'description' => 'Word which need to be replaced', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'replace_word' => array( + 'name' => 'replace_word', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Replacement Word') , + 'description' => 'Word which will replace the word in find', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Word Replacement is Active') , + 'description' => 'Is this entry active?', + 'default' => '1', + ) , + 'match_type' => array( + 'name' => 'match_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Word Replacement Match Type') , + 'maxlength' => 16, + 'size' => CRM_Utils_Type::TWELVE, + 'default' => 'wildcardMatch', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType', + ) + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Word Replacement Domain ID') , + 'description' => 'FK to Domain ID. This is for Domain specific word replacement', + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'find_word' => 'find_word', + 'replace_word' => 'replace_word', + 'is_active' => 'is_active', + 'match_type' => 'match_type', + 'domain_id' => 'domain_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['word_replacement'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['word_replacement'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Core/DAO/Worldregion.php b/CRM/Core/DAO/Worldregion.php new file mode 100644 index 0000000000..e9a9db5765 --- /dev/null +++ b/CRM/Core/DAO/Worldregion.php @@ -0,0 +1,212 @@ +__table = 'civicrm_worldregion'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('World Region ID') , + 'description' => 'Country Id', + 'required' => true, + ) , + 'world_region' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('World Region') , + 'description' => 'Region name to be associated with countries', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'export' => true, + 'where' => 'civicrm_worldregion.name', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'world_region', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['worldregion'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['worldregion'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Cxn/DAO/Cxn.php b/CRM/Cxn/DAO/Cxn.php new file mode 100644 index 0000000000..dbad7857f9 --- /dev/null +++ b/CRM/Cxn/DAO/Cxn.php @@ -0,0 +1,334 @@ +__table = 'civicrm_cxn'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Connection ID') , + 'description' => 'Connection ID', + 'required' => true, + ) , + 'app_guid' => array( + 'name' => 'app_guid', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Application GUID') , + 'description' => 'Application GUID', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'app_meta' => array( + 'name' => 'app_meta', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Application Metadata (JSON)') , + 'description' => 'Application Metadata (JSON)', + ) , + 'cxn_guid' => array( + 'name' => 'cxn_guid', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Connection GUID') , + 'description' => 'Connection GUID', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'secret' => array( + 'name' => 'secret', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Secret') , + 'description' => 'Shared secret', + ) , + 'perm' => array( + 'name' => 'perm', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Perm') , + 'description' => 'Permissions approved for the service (JSON)', + ) , + 'options' => array( + 'name' => 'options', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Options') , + 'description' => 'Options for the service (JSON)', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is connection currently enabled?', + 'default' => '1', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Created Date') , + 'description' => 'When was the connection was created.', + 'required' => false, + 'default' => 'NULL', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Modified Date') , + 'description' => 'When the connection was created or modified.', + 'required' => false, + 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', + ) , + 'fetched_date' => array( + 'name' => 'fetched_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Fetched Date') , + 'description' => 'The last time the application metadata was fetched.', + 'required' => false, + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'app_guid' => 'app_guid', + 'app_meta' => 'app_meta', + 'cxn_guid' => 'cxn_guid', + 'secret' => 'secret', + 'perm' => 'perm', + 'options' => 'options', + 'is_active' => 'is_active', + 'created_date' => 'created_date', + 'modified_date' => 'modified_date', + 'fetched_date' => 'fetched_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['cxn'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['cxn'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Dedupe/DAO/Exception.php b/CRM/Dedupe/DAO/Exception.php new file mode 100644 index 0000000000..6e81cfbac8 --- /dev/null +++ b/CRM/Dedupe/DAO/Exception.php @@ -0,0 +1,235 @@ +__table = 'civicrm_dedupe_exception'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id1', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id2', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dedupe Exception ID') , + 'description' => 'Unique dedupe exception id', + 'required' => true, + ) , + 'contact_id1' => array( + 'name' => 'contact_id1', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('First Dupe Contact ID') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'contact_id2' => array( + 'name' => 'contact_id2', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Second Dupe Contact ID') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_id1' => 'contact_id1', + 'contact_id2' => 'contact_id2', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['dedupe_exception'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['dedupe_exception'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Dedupe/DAO/Rule.php b/CRM/Dedupe/DAO/Rule.php new file mode 100644 index 0000000000..01cfb006d0 --- /dev/null +++ b/CRM/Dedupe/DAO/Rule.php @@ -0,0 +1,286 @@ +__table = 'civicrm_dedupe_rule'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dedupe Rule ID') , + 'description' => 'Unique dedupe rule id', + 'required' => true, + ) , + 'dedupe_rule_group_id' => array( + 'name' => 'dedupe_rule_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dedupe Rule Group') , + 'description' => 'The id of the rule group this rule belongs to', + 'required' => true, + 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', + ) , + 'rule_table' => array( + 'name' => 'rule_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Rule Table') , + 'description' => 'The name of the table this rule is about', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'rule_field' => array( + 'name' => 'rule_field', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Rule Field') , + 'description' => 'The name of the field of the table referenced in rule_table', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'rule_length' => array( + 'name' => 'rule_length', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Rule Length') , + 'description' => 'The length of the matching substring', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'rule_weight' => array( + 'name' => 'rule_weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'The weight of the rule', + 'required' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'dedupe_rule_group_id' => 'dedupe_rule_group_id', + 'rule_table' => 'rule_table', + 'rule_field' => 'rule_field', + 'rule_length' => 'rule_length', + 'rule_weight' => 'rule_weight', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['dedupe_rule'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['dedupe_rule'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Dedupe/DAO/RuleGroup.php b/CRM/Dedupe/DAO/RuleGroup.php new file mode 100644 index 0000000000..7f699f547c --- /dev/null +++ b/CRM/Dedupe/DAO/RuleGroup.php @@ -0,0 +1,305 @@ +__table = 'civicrm_dedupe_rule_group'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Rule Group ID') , + 'description' => 'Unique dedupe rule group id', + 'required' => true, + ) , + 'contact_type' => array( + 'name' => 'contact_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Contact Type') , + 'description' => 'The type of contacts this group applies to', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_contact_type', + 'keyColumn' => 'name', + 'labelColumn' => 'label', + 'condition' => 'parent_id IS NULL', + ) + ) , + 'threshold' => array( + 'name' => 'threshold', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Threshold') , + 'description' => 'The weight threshold the sum of the rule weights has to cross to consider two contacts the same', + 'required' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'used' => array( + 'name' => 'used', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Length') , + 'description' => 'Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)', + 'required' => true, + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Radio', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Name of the rule group', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title') , + 'description' => 'Label of the rule group', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Reserved?') , + 'description' => 'Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'contact_type' => 'contact_type', + 'threshold' => 'threshold', + 'used' => 'used', + 'name' => 'name', + 'title' => 'title', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['dedupe_rule_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['dedupe_rule_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/Cart/DAO/Cart.php b/CRM/Event/Cart/DAO/Cart.php new file mode 100644 index 0000000000..e43e89cca0 --- /dev/null +++ b/CRM/Event/Cart/DAO/Cart.php @@ -0,0 +1,231 @@ +__table = 'civicrm_event_carts'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'user_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'cart_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cart ID') , + 'description' => 'Cart Id', + 'required' => true, + ) , + 'user_id' => array( + 'name' => 'user_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Created By') , + 'description' => 'FK to civicrm_contact who created this cart', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'completed' => array( + 'name' => 'completed', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Complete?') , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'cart_id', + 'user_id' => 'user_id', + 'completed' => 'completed', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['event_carts'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['event_carts'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/Cart/DAO/EventInCart.php b/CRM/Event/Cart/DAO/EventInCart.php new file mode 100644 index 0000000000..44a43f246f --- /dev/null +++ b/CRM/Event/Cart/DAO/EventInCart.php @@ -0,0 +1,235 @@ +__table = 'civicrm_events_in_carts'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_cart_id', 'civicrm_event_carts', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'event_in_cart_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event In Cart') , + 'description' => 'Event In Cart Id', + 'required' => true, + ) , + 'event_id' => array( + 'name' => 'event_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event') , + 'description' => 'FK to Event ID', + 'FKClassName' => 'CRM_Event_DAO_Event', + ) , + 'event_cart_id' => array( + 'name' => 'event_cart_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event In Cart') , + 'description' => 'FK to Event Cart ID', + 'FKClassName' => 'CRM_Event_Cart_DAO_Cart', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'event_in_cart_id', + 'event_id' => 'event_id', + 'event_cart_id' => 'event_cart_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['events_in_carts'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['events_in_carts'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/DAO/Event.php b/CRM/Event/DAO/Event.php new file mode 100644 index 0000000000..e86ca81a07 --- /dev/null +++ b/CRM/Event/DAO/Event.php @@ -0,0 +1,1422 @@ +__table = 'civicrm_event'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'loc_block_id', 'civicrm_loc_block', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event ID') , + 'description' => 'Event', + 'required' => true, + ) , + 'event_title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Event Title') , + 'description' => 'Event Title (e.g. Fall Fundraiser Dinner)', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_event.title', + 'headerPattern' => '/(event.)?title$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'summary' => array( + 'name' => 'summary', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Event Summary') , + 'description' => 'Brief summary of event. Text and html allowed. Displayed on Event Registration form and can be used on other CMS pages which need an event summary.', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'event_description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Event Description') , + 'description' => 'Full description of event. Text and html allowed. Displayed on built-in Event Information screens.', + 'rows' => 8, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'event_type_id' => array( + 'name' => 'event_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Type') , + 'description' => 'Event Type ID.Implicit FK to civicrm_option_value where option_group = event_type.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'event_type', + 'optionEditPath' => 'civicrm/admin/options/event_type', + ) + ) , + 'participant_listing_id' => array( + 'name' => 'participant_listing_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant Listing') , + 'description' => 'Should we expose the participant list? Implicit FK to civicrm_option_value where option_group = participant_listing.', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'participant_listing', + 'optionEditPath' => 'civicrm/admin/options/participant_listing', + ) + ) , + 'is_public' => array( + 'name' => 'is_public', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Event Public') , + 'description' => 'Public events will be included in the iCal feeds. Access to private event information may be limited using ACLs.', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'event_start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Event Start Date') , + 'description' => 'Date and time that event starts.', + 'import' => true, + 'where' => 'civicrm_event.start_date', + 'headerPattern' => '/^start|(s(tart\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'event_end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Event End Date') , + 'description' => 'Date and time that event ends. May be NULL if no defined end date/time', + 'import' => true, + 'where' => 'civicrm_event.end_date', + 'headerPattern' => '/^end|(e(nd\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'is_online_registration' => array( + 'name' => 'is_online_registration', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Online Registration') , + 'description' => 'If true, include registration link on Event Info page.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'registration_link_text' => array( + 'name' => 'registration_link_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Event Registration Link Text') , + 'description' => 'Text for link to Event Registration form which is displayed on Event Information screen when is_online_registration is true.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'registration_start_date' => array( + 'name' => 'registration_start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Registration Start Date') , + 'description' => 'Date and time that online registration starts.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'registration_end_date' => array( + 'name' => 'registration_end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Registration End Date') , + 'description' => 'Date and time that online registration ends.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'max_participants' => array( + 'name' => 'max_participants', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Max Participants') , + 'description' => 'Maximum number of registered participants to allow. After max is reached, a custom Event Full message is displayed. If NULL, allow unlimited number of participants.', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'event_full_text' => array( + 'name' => 'event_full_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Event Information') , + 'description' => 'Message to display on Event Information page and INSTEAD OF Event Registration form if maximum participants are signed up. Can include email address/info about getting on a waiting list, etc. Text and html allowed.', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_monetary' => array( + 'name' => 'is_monetary', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is this a PAID event?') , + 'description' => 'If true, one or more fee amounts must be set and a Payment Processor must be configured for Online Event Registration.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'Financial type assigned to paid event registrations for this event. Required if is_monetary is true.', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'payment_processor' => array( + 'name' => 'payment_processor', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Payment Processor') , + 'description' => 'Payment Processors configured for this Event (if is_monetary is true)', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_payment_processor', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'is_map' => array( + 'name' => 'is_map', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Map Enabled') , + 'description' => 'Include a map block on the Event Information page when geocode info is available and a mapping provider has been specified?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is this Event enabled or disabled/cancelled?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'fee_label' => array( + 'name' => 'fee_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Fee Label') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_event.fee_label', + 'headerPattern' => '/^fee|(f(ee\s)?label)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_show_location' => array( + 'name' => 'is_show_location', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('show location') , + 'description' => 'If true, show event location.', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'loc_block_id' => array( + 'name' => 'loc_block_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Block ID') , + 'description' => 'FK to Location Block ID', + 'FKClassName' => 'CRM_Core_DAO_LocBlock', + ) , + 'default_role_id' => array( + 'name' => 'default_role_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Default Role') , + 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.', + 'import' => true, + 'where' => 'civicrm_event.default_role_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'participant_role', + 'optionEditPath' => 'civicrm/admin/options/participant_role', + ) + ) , + 'intro_text' => array( + 'name' => 'intro_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Introductory Message') , + 'description' => 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'footer_text' => array( + 'name' => 'footer_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Footer Message') , + 'description' => 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'confirm_title' => array( + 'name' => 'confirm_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Confirmation Title') , + 'description' => 'Title for Confirmation page.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'confirm_text' => array( + 'name' => 'confirm_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Confirm Text') , + 'description' => 'Introductory message for Event Registration page. Text and html allowed. Displayed at the top of Event Registration form.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'confirm_footer_text' => array( + 'name' => 'confirm_footer_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Footer Text') , + 'description' => 'Footer message for Event Registration page. Text and html allowed. Displayed at the bottom of Event Registration form.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_email_confirm' => array( + 'name' => 'is_email_confirm', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is confirm email') , + 'description' => 'If true, confirmation is automatically emailed to contact on successful registration.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'confirm_email_text' => array( + 'name' => 'confirm_email_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Confirmation Email Text') , + 'description' => 'text to include above standard event info on confirmation email. emails are text-only, so do not allow html for now', + 'rows' => 4, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'confirm_from_name' => array( + 'name' => 'confirm_from_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Confirm From Name') , + 'description' => 'FROM email name used for confirmation emails.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'confirm_from_email' => array( + 'name' => 'confirm_from_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Confirm From Email') , + 'description' => 'FROM email address used for confirmation emails.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'cc_confirm' => array( + 'name' => 'cc_confirm', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Cc Confirm') , + 'description' => 'comma-separated list of email addresses to cc each time a confirmation is sent', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'bcc_confirm' => array( + 'name' => 'bcc_confirm', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Bcc Confirm') , + 'description' => 'comma-separated list of email addresses to bcc each time a confirmation is sent', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'default_fee_id' => array( + 'name' => 'default_fee_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Default Fee ID') , + 'description' => 'FK to civicrm_option_value.', + ) , + 'default_discount_fee_id' => array( + 'name' => 'default_discount_fee_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Default Discount Fee ID') , + 'description' => 'FK to civicrm_option_value.', + ) , + 'thankyou_title' => array( + 'name' => 'thankyou_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('ThankYou Title') , + 'description' => 'Title for ThankYou page.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'thankyou_text' => array( + 'name' => 'thankyou_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('ThankYou Text') , + 'description' => 'ThankYou Text.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'thankyou_footer_text' => array( + 'name' => 'thankyou_footer_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Footer Text') , + 'description' => 'Footer message.', + 'rows' => 6, + 'cols' => 50, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_pay_later' => array( + 'name' => 'is_pay_later', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Pay Later Allowed') , + 'description' => 'if true - allows the user to send payment directly to the org later', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'pay_later_text' => array( + 'name' => 'pay_later_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Pay Later Text') , + 'description' => 'The text displayed to the user in the main form', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'pay_later_receipt' => array( + 'name' => 'pay_later_receipt', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Pay Later Receipt Text') , + 'description' => 'The receipt sent to the user instead of the normal receipt text', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_partial_payment' => array( + 'name' => 'is_partial_payment', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Partial Payments Enabled') , + 'description' => 'is partial payment enabled for this event', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'initial_amount_label' => array( + 'name' => 'initial_amount_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Initial Amount Label') , + 'description' => 'Initial amount label for partial payment', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'initial_amount_help_text' => array( + 'name' => 'initial_amount_help_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Initial Amount Help Text') , + 'description' => 'Initial amount help text for partial payment', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'min_initial_amount' => array( + 'name' => 'min_initial_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Minimum Initial Amount') , + 'description' => 'Minimum initial amount for partial payment', + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_multiple_registrations' => array( + 'name' => 'is_multiple_registrations', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Multiple Registrations') , + 'description' => 'if true - allows the user to register multiple participants for event', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'max_additional_participants' => array( + 'name' => 'max_additional_participants', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum number of additional participants per registration') , + 'description' => 'Maximum number of additional participants that can be registered on a single booking', + ) , + 'allow_same_participant_emails' => array( + 'name' => 'allow_same_participant_emails', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Does Event allow multiple registrations from same email address?') , + 'description' => 'if true - allows the user to register multiple registrations from same email address.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'has_waitlist' => array( + 'name' => 'has_waitlist', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Waitlist Enabled') , + 'description' => 'Whether the event has waitlist support.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'requires_approval' => array( + 'name' => 'requires_approval', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Requires Approval') , + 'description' => 'Whether participants require approval before they can finish registering.', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'expiration_time' => array( + 'name' => 'expiration_time', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Expiration Time') , + 'description' => 'Expire pending but unconfirmed registrations after this many hours.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'allow_selfcancelxfer' => array( + 'name' => 'allow_selfcancelxfer', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Self-service Cancellation or Transfer') , + 'description' => 'Allow self service cancellation or transfer for event?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'selfcancelxfer_time' => array( + 'name' => 'selfcancelxfer_time', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Self-service Cancellation or Transfer Time') , + 'description' => 'Number of hours prior to event start date to allow self-service cancellation or transfer.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'waitlist_text' => array( + 'name' => 'waitlist_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Waitlist Text') , + 'description' => 'Text to display when the event is full, but participants can signup for a waitlist.', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'approval_req_text' => array( + 'name' => 'approval_req_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Approval Req Text') , + 'description' => 'Text to display when the approval is required to complete registration for an event.', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_template' => array( + 'name' => 'is_template', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is an Event Template') , + 'description' => 'whether the event has template', + 'required' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'template_title' => array( + 'name' => 'template_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Event Template Title') , + 'description' => 'Event Template Title', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_event.template_title', + 'headerPattern' => '/(template.)?title$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Created By Contact ID') , + 'description' => 'FK to civicrm_contact, who created this event', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Event Created Date') , + 'description' => 'Date and time that event was created.', + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'import' => true, + 'where' => 'civicrm_event.currency', + 'headerPattern' => '/cur(rency)?/i', + 'dataPattern' => '/^[A-Z]{3}$/i', + 'export' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this event has been created.', + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'EntityRef', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'is_share' => array( + 'name' => 'is_share', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is shared through social media') , + 'description' => 'Can people share the event through social media?', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_confirm_enabled' => array( + 'name' => 'is_confirm_enabled', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is the booking confirmation screen enabled?') , + 'description' => 'If false, the event booking confirmation screen gets skipped', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'parent_event_id' => array( + 'name' => 'parent_event_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Parent Event ID') , + 'description' => 'Implicit FK to civicrm_event: parent event', + 'default' => 'NULL', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'slot_label_id' => array( + 'name' => 'slot_label_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Subevent Slot Label ID') , + 'description' => 'Subevent slot label. Implicit FK to civicrm_option_value where option_group = conference_slot.', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'dedupe_rule_group_id' => array( + 'name' => 'dedupe_rule_group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Dedupe Rule') , + 'description' => 'Rule to use when matching registrations for this event', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_dedupe_rule_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + 'nameColumn' => 'name', + ) + ) , + 'is_billing_required' => array( + 'name' => 'is_billing_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is billing block required') , + 'description' => 'if true than billing block is required this event', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'title' => 'event_title', + 'summary' => 'summary', + 'description' => 'event_description', + 'event_type_id' => 'event_type_id', + 'participant_listing_id' => 'participant_listing_id', + 'is_public' => 'is_public', + 'start_date' => 'event_start_date', + 'end_date' => 'event_end_date', + 'is_online_registration' => 'is_online_registration', + 'registration_link_text' => 'registration_link_text', + 'registration_start_date' => 'registration_start_date', + 'registration_end_date' => 'registration_end_date', + 'max_participants' => 'max_participants', + 'event_full_text' => 'event_full_text', + 'is_monetary' => 'is_monetary', + 'financial_type_id' => 'financial_type_id', + 'payment_processor' => 'payment_processor', + 'is_map' => 'is_map', + 'is_active' => 'is_active', + 'fee_label' => 'fee_label', + 'is_show_location' => 'is_show_location', + 'loc_block_id' => 'loc_block_id', + 'default_role_id' => 'default_role_id', + 'intro_text' => 'intro_text', + 'footer_text' => 'footer_text', + 'confirm_title' => 'confirm_title', + 'confirm_text' => 'confirm_text', + 'confirm_footer_text' => 'confirm_footer_text', + 'is_email_confirm' => 'is_email_confirm', + 'confirm_email_text' => 'confirm_email_text', + 'confirm_from_name' => 'confirm_from_name', + 'confirm_from_email' => 'confirm_from_email', + 'cc_confirm' => 'cc_confirm', + 'bcc_confirm' => 'bcc_confirm', + 'default_fee_id' => 'default_fee_id', + 'default_discount_fee_id' => 'default_discount_fee_id', + 'thankyou_title' => 'thankyou_title', + 'thankyou_text' => 'thankyou_text', + 'thankyou_footer_text' => 'thankyou_footer_text', + 'is_pay_later' => 'is_pay_later', + 'pay_later_text' => 'pay_later_text', + 'pay_later_receipt' => 'pay_later_receipt', + 'is_partial_payment' => 'is_partial_payment', + 'initial_amount_label' => 'initial_amount_label', + 'initial_amount_help_text' => 'initial_amount_help_text', + 'min_initial_amount' => 'min_initial_amount', + 'is_multiple_registrations' => 'is_multiple_registrations', + 'max_additional_participants' => 'max_additional_participants', + 'allow_same_participant_emails' => 'allow_same_participant_emails', + 'has_waitlist' => 'has_waitlist', + 'requires_approval' => 'requires_approval', + 'expiration_time' => 'expiration_time', + 'allow_selfcancelxfer' => 'allow_selfcancelxfer', + 'selfcancelxfer_time' => 'selfcancelxfer_time', + 'waitlist_text' => 'waitlist_text', + 'approval_req_text' => 'approval_req_text', + 'is_template' => 'is_template', + 'template_title' => 'template_title', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'currency' => 'currency', + 'campaign_id' => 'campaign_id', + 'is_share' => 'is_share', + 'is_confirm_enabled' => 'is_confirm_enabled', + 'parent_event_id' => 'parent_event_id', + 'slot_label_id' => 'slot_label_id', + 'dedupe_rule_group_id' => 'dedupe_rule_group_id', + 'is_billing_required' => 'is_billing_required', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['event'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['event'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/DAO/Participant.php b/CRM/Event/DAO/Participant.php new file mode 100644 index 0000000000..18775d8c47 --- /dev/null +++ b/CRM/Event/DAO/Participant.php @@ -0,0 +1,577 @@ +__table = 'civicrm_participant'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_id', 'civicrm_event', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_participant_status_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'registered_by_id', 'civicrm_participant', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'discount_id', 'civicrm_discount', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'cart_id', 'civicrm_event_carts', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'transferred_to_contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'participant_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant ID') , + 'description' => 'Participant Id', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_participant.id', + 'headerPattern' => '/(^(participant(.)?)?id$)/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_participant.contact_id', + 'headerPattern' => '/contact(.?id)?/i', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'event_id' => array( + 'name' => 'event_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event') , + 'description' => 'FK to Event ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_participant.event_id', + 'headerPattern' => '/event id$/i', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Event_DAO_Event', + ) , + 'participant_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant Status') , + 'description' => 'Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_participant.status_id', + 'headerPattern' => '/(participant.)?(status)$/i', + 'dataPattern' => '', + 'export' => true, + 'default' => '1', + 'FKClassName' => 'CRM_Event_DAO_ParticipantStatusType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_participant_status_type', + 'keyColumn' => 'id', + 'labelColumn' => 'label', + ) + ) , + 'participant_role_id' => array( + 'name' => 'role_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Participant Role') , + 'description' => 'Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_participant.role_id', + 'headerPattern' => '/(participant.)?(role)$/i', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'participant_role', + 'optionEditPath' => 'civicrm/admin/options/participant_role', + ) + ) , + 'participant_register_date' => array( + 'name' => 'register_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Register date') , + 'description' => 'When did contact register for event?', + 'import' => true, + 'where' => 'civicrm_participant.register_date', + 'headerPattern' => '/^(r(egister\s)?date)$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Participant Source') , + 'description' => 'Source of this event registration.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_participant.source', + 'headerPattern' => '/(participant.)?(source)$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_fee_level' => array( + 'name' => 'fee_level', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Fee level') , + 'description' => 'Populate with the label (text) associated with a fee level for paid events with multiple levels. Note that + we store the label value and not the key + ', + 'import' => true, + 'where' => 'civicrm_participant.fee_level', + 'headerPattern' => '/^(f(ee\s)?level)$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_participant.is_test', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_is_pay_later' => array( + 'name' => 'is_pay_later', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Pay Later') , + 'import' => true, + 'where' => 'civicrm_participant.is_pay_later', + 'headerPattern' => '/(is.)?(pay(.)?later)$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'participant_fee_amount' => array( + 'name' => 'fee_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Fee Amount') , + 'description' => 'actual processor fee if known - may be 0.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_participant.fee_amount', + 'headerPattern' => '/fee(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + ) , + 'participant_registered_by_id' => array( + 'name' => 'registered_by_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Registered By ID') , + 'description' => 'FK to Participant ID', + 'import' => true, + 'where' => 'civicrm_participant.registered_by_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'FKClassName' => 'CRM_Event_DAO_Participant', + ) , + 'participant_discount_id' => array( + 'name' => 'discount_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Discount ID') , + 'description' => 'FK to Discount ID', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Discount', + ) , + 'participant_fee_currency' => array( + 'name' => 'fee_currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Fee Currency') , + 'description' => '3 character string, value derived from config setting.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'import' => true, + 'where' => 'civicrm_participant.fee_currency', + 'headerPattern' => '/(fee)?.?cur(rency)?/i', + 'dataPattern' => '/^[A-Z]{3}$/i', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'participant_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this participant has been registered.', + 'import' => true, + 'where' => 'civicrm_participant.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'discount_amount' => array( + 'name' => 'discount_amount', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Discount Amount') , + 'description' => 'Discount Amount', + ) , + 'cart_id' => array( + 'name' => 'cart_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Cart ID') , + 'description' => 'FK to civicrm_event_carts', + 'FKClassName' => 'CRM_Event_Cart_DAO_Cart', + ) , + 'must_wait' => array( + 'name' => 'must_wait', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Must Wait on List') , + 'description' => 'On Waiting List', + ) , + 'transferred_to_contact_id' => array( + 'name' => 'transferred_to_contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Transferred to Contact ID') , + 'description' => 'FK to Contact ID', + 'import' => true, + 'where' => 'civicrm_participant.transferred_to_contact_id', + 'headerPattern' => '/transfer(.?id)?/i', + 'dataPattern' => '', + 'export' => true, + 'default' => 'NULL', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'participant_id', + 'contact_id' => 'participant_contact_id', + 'event_id' => 'event_id', + 'status_id' => 'participant_status_id', + 'role_id' => 'participant_role_id', + 'register_date' => 'participant_register_date', + 'source' => 'participant_source', + 'fee_level' => 'participant_fee_level', + 'is_test' => 'participant_is_test', + 'is_pay_later' => 'participant_is_pay_later', + 'fee_amount' => 'participant_fee_amount', + 'registered_by_id' => 'participant_registered_by_id', + 'discount_id' => 'participant_discount_id', + 'fee_currency' => 'participant_fee_currency', + 'campaign_id' => 'participant_campaign_id', + 'discount_amount' => 'discount_amount', + 'cart_id' => 'cart_id', + 'must_wait' => 'must_wait', + 'transferred_to_contact_id' => 'transferred_to_contact_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['participant'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['participant'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/DAO/ParticipantPayment.php b/CRM/Event/DAO/ParticipantPayment.php new file mode 100644 index 0000000000..791bbfcef0 --- /dev/null +++ b/CRM/Event/DAO/ParticipantPayment.php @@ -0,0 +1,237 @@ +__table = 'civicrm_participant_payment'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'participant_id', 'civicrm_participant', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment ID') , + 'description' => 'Participant Payment Id', + 'required' => true, + ) , + 'participant_id' => array( + 'name' => 'participant_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant ID') , + 'description' => 'Participant Id (FK)', + 'required' => true, + 'FKClassName' => 'CRM_Event_DAO_Participant', + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution') , + 'description' => 'FK to contribution table.', + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'participant_id' => 'participant_id', + 'contribution_id' => 'contribution_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['participant_payment'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['participant_payment'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Event/DAO/ParticipantStatusType.php b/CRM/Event/DAO/ParticipantStatusType.php new file mode 100644 index 0000000000..5de69692bc --- /dev/null +++ b/CRM/Event/DAO/ParticipantStatusType.php @@ -0,0 +1,323 @@ +__table = 'civicrm_participant_status_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant Status Type ID') , + 'description' => 'unique participant status type id', + 'required' => true, + ) , + 'participant_status' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Participant Status') , + 'description' => 'non-localized name of the status type', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_participant_status_type.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Participant Status Label') , + 'description' => 'localized label for display of this status type', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'class' => array( + 'name' => 'class', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Participant Status Class') , + 'description' => 'the general group of status type this one belongs to', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Event_PseudoConstant::participantStatusClassOptions', + ) + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Participant Status Is Reserved?>') , + 'description' => 'whether this is a status type required by the system', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Participant Status is Active') , + 'description' => 'whether this status type is active', + 'default' => '1', + ) , + 'is_counted' => array( + 'name' => 'is_counted', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Participant Status Counts?') , + 'description' => 'whether this status type is counted against event size limit', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'controls sort order', + 'required' => true, + ) , + 'visibility_id' => array( + 'name' => 'visibility_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Participant Status Visibility') , + 'description' => 'whether the status type is visible to the public, an implicit foreign key to option_value.value related to the `visibility` option_group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'visibility', + 'optionEditPath' => 'civicrm/admin/options/visibility', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'participant_status', + 'label' => 'label', + 'class' => 'class', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + 'is_counted' => 'is_counted', + 'weight' => 'weight', + 'visibility_id' => 'visibility_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['participant_status_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['participant_status_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/Currency.php b/CRM/Financial/DAO/Currency.php new file mode 100644 index 0000000000..ab3be82e8c --- /dev/null +++ b/CRM/Financial/DAO/Currency.php @@ -0,0 +1,272 @@ +__table = 'civicrm_currency'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Currency ID') , + 'description' => 'Currency Id', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => 'Currency Name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_currency.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'symbol' => array( + 'name' => 'symbol', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency Symbol') , + 'description' => 'Currency Symbol', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'numeric_code' => array( + 'name' => 'numeric_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency Numeric Code') , + 'description' => 'Numeric currency code', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'import' => true, + 'where' => 'civicrm_currency.numeric_code', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'full_name' => array( + 'name' => 'full_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Full Currency Name') , + 'description' => 'Full currency name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'symbol' => 'symbol', + 'numeric_code' => 'numeric_code', + 'full_name' => 'full_name', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['currency'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['currency'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/EntityFinancialAccount.php b/CRM/Financial/DAO/EntityFinancialAccount.php new file mode 100644 index 0000000000..e68c30359d --- /dev/null +++ b/CRM/Financial/DAO/EntityFinancialAccount.php @@ -0,0 +1,286 @@ +__table = 'civicrm_entity_financial_account'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity Financial Account ID') , + 'description' => 'ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Links to an entity_table like civicrm_financial_type', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_entity_financial_account.entity_table', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'Links to an id in the entity_table, such as vid in civicrm_financial_type', + 'required' => true, + ) , + 'account_relationship' => array( + 'name' => 'account_relationship', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Account Relationship') , + 'description' => 'FK to a new civicrm_option_value (account_relationship)', + 'required' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'account_relationship', + 'optionEditPath' => 'civicrm/admin/options/account_relationship', + ) + ) , + 'financial_account_id' => array( + 'name' => 'financial_account_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Account') , + 'description' => 'FK to the financial_account_id', + 'required' => true, + 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_account', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'account_relationship' => 'account_relationship', + 'financial_account_id' => 'financial_account_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['entity_financial_account'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['entity_financial_account'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/EntityFinancialTrxn.php b/CRM/Financial/DAO/EntityFinancialTrxn.php new file mode 100644 index 0000000000..6afa8fec2d --- /dev/null +++ b/CRM/Financial/DAO/EntityFinancialTrxn.php @@ -0,0 +1,275 @@ +__table = 'civicrm_entity_financial_trxn'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_trxn_id', 'civicrm_financial_trxn', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity Financial Transaction ID') , + 'description' => 'ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'May contain civicrm_financial_item, civicrm_contribution, civicrm_financial_trxn, civicrm_grant, etc', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_entity_financial_trxn.entity_table', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'required' => true, + ) , + 'financial_trxn_id' => array( + 'name' => 'financial_trxn_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Transaction Id') , + 'FKClassName' => 'CRM_Financial_DAO_FinancialTrxn', + ) , + 'amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Amount') , + 'description' => 'allocated amount of transaction to this entity', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_entity_financial_trxn.amount', + 'headerPattern' => '/amount/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'financial_trxn_id' => 'financial_trxn_id', + 'amount' => 'amount', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['entity_financial_trxn'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['entity_financial_trxn'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/FinancialAccount.php b/CRM/Financial/DAO/FinancialAccount.php new file mode 100644 index 0000000000..9129fd7374 --- /dev/null +++ b/CRM/Financial/DAO/FinancialAccount.php @@ -0,0 +1,456 @@ +__table = 'civicrm_financial_account'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_financial_account', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Account ID') , + 'description' => 'ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Account Name') , + 'description' => 'Financial Account Name.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'financial_account_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID that is responsible for the funds in this account', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'financial_account_type_id' => array( + 'name' => 'financial_account_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Account Type') , + 'description' => 'pseudo FK into civicrm_option_value.', + 'required' => true, + 'default' => '3', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'financial_account_type', + 'optionEditPath' => 'civicrm/admin/options/financial_account_type', + ) + ) , + 'accounting_code' => array( + 'name' => 'accounting_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Accounting Code') , + 'description' => 'Optional value for mapping monies owed and received to accounting system codes.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'export' => true, + 'where' => 'civicrm_financial_account.accounting_code', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'account_type_code' => array( + 'name' => 'account_type_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Account Type Code') , + 'description' => 'Optional value for mapping account types to accounting system account categories (QuickBooks Account Type Codes for example).', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'export' => true, + 'where' => 'civicrm_financial_account.account_type_code', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Account Description') , + 'description' => 'Financial Type Description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Account Parent') , + 'description' => 'Parent ID in account hierarchy', + 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', + ) , + 'is_header_account' => array( + 'name' => 'is_header_account', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Header Financial Account?') , + 'description' => 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?', + ) , + 'is_deductible' => array( + 'name' => 'is_deductible', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Deductible Financial Account?') , + 'description' => 'Is this account tax-deductible?', + 'default' => '1', + ) , + 'is_tax' => array( + 'name' => 'is_tax', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Tax Financial Account?') , + 'description' => 'Is this account for taxes?', + ) , + 'tax_rate' => array( + 'name' => 'tax_rate', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Financial Account Tax Rate') , + 'description' => 'The percentage of the total_amount that is due for this tax.', + 'precision' => array( + 10, + 8 + ) , + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Reserved Financial Account?') , + 'description' => 'Is this a predefined system object?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Financial Account is Active') , + 'description' => 'Is this property active?', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Default Financial Account') , + 'description' => 'Is this account the default one (or default tax one) for its financial_account_type?', + ) , + 'opening_balance' => array( + 'name' => 'opening_balance', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Opening Balance') , + 'description' => 'Contains the opening balance for this financial account', + 'precision' => array( + 20, + 2 + ) , + ) , + 'current_period_opening_balance' => array( + 'name' => 'current_period_opening_balance', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Current period opening Balance') , + 'description' => 'Contains the opening balance for the current period for this financial account', + 'precision' => array( + 20, + 2 + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'contact_id' => 'financial_account_contact_id', + 'financial_account_type_id' => 'financial_account_type_id', + 'accounting_code' => 'accounting_code', + 'account_type_code' => 'account_type_code', + 'description' => 'description', + 'parent_id' => 'parent_id', + 'is_header_account' => 'is_header_account', + 'is_deductible' => 'is_deductible', + 'is_tax' => 'is_tax', + 'tax_rate' => 'tax_rate', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + 'is_default' => 'is_default', + 'opening_balance' => 'opening_balance', + 'current_period_opening_balance' => 'current_period_opening_balance', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['financial_account'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['financial_account'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/FinancialItem.php b/CRM/Financial/DAO/FinancialItem.php new file mode 100644 index 0000000000..7808d56a40 --- /dev/null +++ b/CRM/Financial/DAO/FinancialItem.php @@ -0,0 +1,389 @@ +__table = 'civicrm_financial_item'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_account_id', 'civicrm_financial_account', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Item ID') , + 'required' => true, + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Financial Item Created Date') , + 'description' => 'Date and time the item was created', + 'required' => true, + 'default' => 'CURRENT_TIMESTAMP', + ) , + 'transaction_date' => array( + 'name' => 'transaction_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Financial Item Transaction Date') , + 'description' => 'Date and time of the source transaction', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Item Contact ID') , + 'description' => 'FK to Contact ID of contact the item is from', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_financial_item.contact_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Item Description') , + 'description' => 'Human readable description of this item, to ease display without lookup of source item.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Amount') , + 'description' => 'Total amount of this item', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Item Currency') , + 'description' => 'Currency for the amount', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'export' => true, + 'where' => 'civicrm_financial_item.currency', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'financial_account_id' => array( + 'name' => 'financial_account_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Account ID') , + 'description' => 'FK to civicrm_financial_account', + 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_account', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Item Status ID') , + 'description' => 'Payment status: test, paid, part_paid, unpaid (if empty assume unpaid)', + 'export' => true, + 'where' => 'civicrm_financial_item.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'financial_item_status', + 'optionEditPath' => 'civicrm/admin/options/financial_item_status', + ) + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'The table providing the source of this item such as civicrm_line_item', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'The specific source item that is responsible for the creation of this financial_item', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'created_date' => 'created_date', + 'transaction_date' => 'transaction_date', + 'contact_id' => 'contact_id', + 'description' => 'description', + 'amount' => 'amount', + 'currency' => 'currency', + 'financial_account_id' => 'financial_account_id', + 'status_id' => 'status_id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['financial_item'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['financial_item'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/FinancialTrxn.php b/CRM/Financial/DAO/FinancialTrxn.php new file mode 100644 index 0000000000..ce636cbb7c --- /dev/null +++ b/CRM/Financial/DAO/FinancialTrxn.php @@ -0,0 +1,468 @@ +__table = 'civicrm_financial_trxn'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'from_financial_account_id', 'civicrm_financial_account', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'to_financial_account_id', 'civicrm_financial_account', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Transaction ID') , + 'required' => true, + ) , + 'from_financial_account_id' => array( + 'name' => 'from_financial_account_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Transaction From Account') , + 'description' => 'FK to financial_account table.', + 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_account', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'to_financial_account_id' => array( + 'name' => 'to_financial_account_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Transaction To Account') , + 'description' => 'FK to financial_financial_account table.', + 'FKClassName' => 'CRM_Financial_DAO_FinancialAccount', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_account', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'trxn_date' => array( + 'name' => 'trxn_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Financial Transaction Date') , + 'description' => 'date transaction occurred', + 'default' => 'NULL', + ) , + 'total_amount' => array( + 'name' => 'total_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Financial Total Amount') , + 'description' => 'amount of transaction', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + ) , + 'fee_amount' => array( + 'name' => 'fee_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Financial Fee Amount') , + 'description' => 'actual processor fee if known - may be 0.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'net_amount' => array( + 'name' => 'net_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Financial Net Amount') , + 'description' => 'actual funds transfer amount. total less fees. if processor does not report actual fee during transaction, this is set to total_amount.', + 'precision' => array( + 20, + 2 + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'import' => true, + 'where' => 'civicrm_financial_trxn.currency', + 'headerPattern' => '/cur(rency)?/i', + 'dataPattern' => '/^[A-Z]{3}$/', + 'export' => true, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'is_payment' => array( + 'name' => 'is_payment', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Payment?') , + 'description' => 'Is this entry either a payment or a reversal of a payment?', + 'import' => true, + 'where' => 'civicrm_financial_trxn.is_payment', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'trxn_id' => array( + 'name' => 'trxn_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Transaction ID') , + 'description' => 'Transaction id supplied by external processor. This may not be unique.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'trxn_result_code' => array( + 'name' => 'trxn_result_code', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Transaction Result Code') , + 'description' => 'processor result code', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Transaction Status Id') , + 'description' => 'pseudo FK to civicrm_option_value of contribution_status_id option_group', + 'import' => true, + 'where' => 'civicrm_financial_trxn.status_id', + 'headerPattern' => '/status/i', + 'dataPattern' => '', + 'export' => true, + 'pseudoconstant' => array( + 'optionGroupName' => 'contribution_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_status', + ) + ) , + 'payment_processor_id' => array( + 'name' => 'payment_processor_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor') , + 'description' => 'Payment Processor for this financial transaction', + 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', + ) , + 'financial_trxn_payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Method') , + 'description' => 'FK to payment_instrument option group values', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + 'financial_trxn_check_number' => array( + 'name' => 'check_number', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Check Number') , + 'description' => 'Check number', + 'maxlength' => 255, + 'size' => 6, + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'from_financial_account_id' => 'from_financial_account_id', + 'to_financial_account_id' => 'to_financial_account_id', + 'trxn_date' => 'trxn_date', + 'total_amount' => 'total_amount', + 'fee_amount' => 'fee_amount', + 'net_amount' => 'net_amount', + 'currency' => 'currency', + 'is_payment' => 'is_payment', + 'trxn_id' => 'trxn_id', + 'trxn_result_code' => 'trxn_result_code', + 'status_id' => 'status_id', + 'payment_processor_id' => 'payment_processor_id', + 'payment_instrument_id' => 'financial_trxn_payment_instrument_id', + 'check_number' => 'financial_trxn_check_number', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['financial_trxn'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['financial_trxn'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/FinancialType.php b/CRM/Financial/DAO/FinancialType.php new file mode 100644 index 0000000000..19b3969ce4 --- /dev/null +++ b/CRM/Financial/DAO/FinancialType.php @@ -0,0 +1,269 @@ +__table = 'civicrm_financial_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type ID') , + 'description' => 'ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp', + 'required' => true, + ) , + 'financial_type' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Financial Type') , + 'description' => 'Financial Type Name.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'import' => true, + 'where' => 'civicrm_financial_type.name', + 'headerPattern' => '/(finan(cial)?)?type/i', + 'dataPattern' => '/donation|member|campaign/i', + 'export' => true, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Description') , + 'description' => 'Financial Type Description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_deductible' => array( + 'name' => 'is_deductible', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Tax Deductible?') , + 'description' => 'Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record.', + 'default' => '1', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Financial Type is Reserved?') , + 'description' => 'Is this a predefined system object?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Financial Type Is Active?') , + 'description' => 'Is this property active?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'financial_type', + 'description' => 'description', + 'is_deductible' => 'is_deductible', + 'is_reserved' => 'is_reserved', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['financial_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['financial_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php new file mode 100644 index 0000000000..3b96cc9a41 --- /dev/null +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -0,0 +1,487 @@ +__table = 'civicrm_payment_processor'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_type_id', 'civicrm_payment_processor_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor ID') , + 'description' => 'Payment Processor ID', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor Domain') , + 'description' => 'Which Domain is this match entry for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Payment Processor') , + 'description' => 'Payment Processor Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Processor Description') , + 'description' => 'Payment Processor Description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'payment_processor_type_id' => array( + 'name' => 'payment_processor_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor Type ID') , + 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessorType', + 'pseudoconstant' => array( + 'table' => 'civicrm_payment_processor_type', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor is Active?') , + 'description' => 'Is this processor active?', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor Is Default?') , + 'description' => 'Is this processor the default?', + ) , + 'is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Test Processor?') , + 'description' => 'Is this processor for a test site?', + ) , + 'user_name' => array( + 'name' => 'user_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('User Name') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'password' => array( + 'name' => 'password', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Password') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'signature' => array( + 'name' => 'signature', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Signature') , + ) , + 'url_site' => array( + 'name' => 'url_site', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Site URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_api' => array( + 'name' => 'url_api', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('API URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_recur' => array( + 'name' => 'url_recur', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Recurring Payments URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_button' => array( + 'name' => 'url_button', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Button URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Subject') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'class_name' => array( + 'name' => 'class_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Suffix for PHP class name implementation') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'billing_mode' => array( + 'name' => 'billing_mode', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Processor Billing Mode') , + 'description' => 'Billing Mode (deprecated)', + 'required' => true, + ) , + 'is_recur' => array( + 'name' => 'is_recur', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor Supports Recurring?') , + 'description' => 'Can process recurring contributions', + ) , + 'payment_type' => array( + 'name' => 'payment_type', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Type') , + 'description' => 'Payment Type: Credit or Debit (deprecated)', + 'default' => '1', + ) , + 'payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Method') , + 'description' => 'Payment Instrument ID', + 'default' => '1', + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'name', + 'description' => 'description', + 'payment_processor_type_id' => 'payment_processor_type_id', + 'is_active' => 'is_active', + 'is_default' => 'is_default', + 'is_test' => 'is_test', + 'user_name' => 'user_name', + 'password' => 'password', + 'signature' => 'signature', + 'url_site' => 'url_site', + 'url_api' => 'url_api', + 'url_recur' => 'url_recur', + 'url_button' => 'url_button', + 'subject' => 'subject', + 'class_name' => 'class_name', + 'billing_mode' => 'billing_mode', + 'is_recur' => 'is_recur', + 'payment_type' => 'payment_type', + 'payment_instrument_id' => 'payment_instrument_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['payment_processor'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['payment_processor'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/PaymentProcessorType.php b/CRM/Financial/DAO/PaymentProcessorType.php new file mode 100644 index 0000000000..bcf121ef3c --- /dev/null +++ b/CRM/Financial/DAO/PaymentProcessorType.php @@ -0,0 +1,498 @@ +__table = 'civicrm_payment_processor_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor Type ID') , + 'description' => 'Payment Processor Type ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Payment Processor variable name to be used in code') , + 'description' => 'Payment Processor Name.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Payment Processor Title') , + 'description' => 'Payment Processor Name.', + 'maxlength' => 127, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Processor Type Description') , + 'description' => 'Payment Processor Description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor Type Is Active?') , + 'description' => 'Is this processor active?', + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor Type is Default?') , + 'description' => 'Is this processor the default?', + ) , + 'user_name_label' => array( + 'name' => 'user_name_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label for User Name if used') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'password_label' => array( + 'name' => 'password_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label for password') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'signature_label' => array( + 'name' => 'signature_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label for Signature') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'subject_label' => array( + 'name' => 'subject_label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label for Subject') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'class_name' => array( + 'name' => 'class_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Suffix for PHP class name implementation') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_site_default' => array( + 'name' => 'url_site_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Live Site URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_api_default' => array( + 'name' => 'url_api_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default API Site URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_recur_default' => array( + 'name' => 'url_recur_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Live Recurring Payments URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_button_default' => array( + 'name' => 'url_button_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Live Button URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_site_test_default' => array( + 'name' => 'url_site_test_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Test Site URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_api_test_default' => array( + 'name' => 'url_api_test_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Test API URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_recur_test_default' => array( + 'name' => 'url_recur_test_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Test Recurring Payment URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'url_button_test_default' => array( + 'name' => 'url_button_test_default', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Default Test Button URL') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'billing_mode' => array( + 'name' => 'billing_mode', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Billing Mode') , + 'description' => 'Billing Mode (deprecated)', + 'required' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::billingMode', + ) + ) , + 'is_recur' => array( + 'name' => 'is_recur', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Processor Type Supports Recurring?') , + 'description' => 'Can process recurring contributions', + ) , + 'payment_type' => array( + 'name' => 'payment_type', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Processor Type Payment Type') , + 'description' => 'Payment Type: Credit or Debit (deprecated)', + 'default' => '1', + ) , + 'payment_instrument_id' => array( + 'name' => 'payment_instrument_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Method') , + 'description' => 'Payment Instrument ID', + 'default' => '1', + 'pseudoconstant' => array( + 'optionGroupName' => 'payment_instrument', + 'optionEditPath' => 'civicrm/admin/options/payment_instrument', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'description' => 'description', + 'is_active' => 'is_active', + 'is_default' => 'is_default', + 'user_name_label' => 'user_name_label', + 'password_label' => 'password_label', + 'signature_label' => 'signature_label', + 'subject_label' => 'subject_label', + 'class_name' => 'class_name', + 'url_site_default' => 'url_site_default', + 'url_api_default' => 'url_api_default', + 'url_recur_default' => 'url_recur_default', + 'url_button_default' => 'url_button_default', + 'url_site_test_default' => 'url_site_test_default', + 'url_api_test_default' => 'url_api_test_default', + 'url_recur_test_default' => 'url_recur_test_default', + 'url_button_test_default' => 'url_button_test_default', + 'billing_mode' => 'billing_mode', + 'is_recur' => 'is_recur', + 'payment_type' => 'payment_type', + 'payment_instrument_id' => 'payment_instrument_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['payment_processor_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['payment_processor_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Financial/DAO/PaymentToken.php b/CRM/Financial/DAO/PaymentToken.php new file mode 100644 index 0000000000..ec7fa1eddc --- /dev/null +++ b/CRM/Financial/DAO/PaymentToken.php @@ -0,0 +1,383 @@ +__table = 'civicrm_payment_token'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'payment_processor_id', 'civicrm_payment_processor', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'payment_token_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Token ID') , + 'description' => 'Payment Token ID', + 'required' => true, + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID for the owner of the token', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'payment_processor_id' => array( + 'name' => 'payment_processor_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Processor ID') , + 'required' => true, + 'FKClassName' => 'CRM_Financial_DAO_PaymentProcessor', + ) , + 'token' => array( + 'name' => 'token', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Token') , + 'description' => 'Externally provided token string', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_TIMESTAMP, + 'title' => ts('Created Date') , + 'description' => 'Date created', + 'default' => 'CURRENT_TIMESTAMP', + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Created ID') , + 'description' => 'Contact ID of token creator', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'expiry_date' => array( + 'name' => 'expiry_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Expiry Date') , + 'description' => 'Date this token expires', + ) , + 'email' => array( + 'name' => 'email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Email') , + 'description' => 'Email at the time of token creation. Useful for fraud forensics', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'billing_first_name' => array( + 'name' => 'billing_first_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Billing First Name') , + 'description' => 'Billing first name at the time of token creation. Useful for fraud forensics', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'billing_middle_name' => array( + 'name' => 'billing_middle_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Billing Middle Name') , + 'description' => 'Billing middle name at the time of token creation. Useful for fraud forensics', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'billing_last_name' => array( + 'name' => 'billing_last_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Billing Last Name') , + 'description' => 'Billing last name at the time of token creation. Useful for fraud forensics', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'masked_account_number' => array( + 'name' => 'masked_account_number', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Masked Account Number') , + 'description' => 'Holds the part of the card number or account details that may be retained or displayed', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'ip_address' => array( + 'name' => 'ip_address', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('IP Address') , + 'description' => 'IP used when creating the token. Useful for fraud forensics', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'payment_token_id', + 'contact_id' => 'contact_id', + 'payment_processor_id' => 'payment_processor_id', + 'token' => 'token', + 'created_date' => 'created_date', + 'created_id' => 'created_id', + 'expiry_date' => 'expiry_date', + 'email' => 'email', + 'billing_first_name' => 'billing_first_name', + 'billing_middle_name' => 'billing_middle_name', + 'billing_last_name' => 'billing_last_name', + 'masked_account_number' => 'masked_account_number', + 'ip_address' => 'ip_address', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['payment_token'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['payment_token'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Friend/DAO/Friend.php b/CRM/Friend/DAO/Friend.php new file mode 100644 index 0000000000..1cd938ce83 --- /dev/null +++ b/CRM/Friend/DAO/Friend.php @@ -0,0 +1,355 @@ +__table = 'civicrm_tell_friend'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Friend ID') , + 'description' => 'Friend ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Name of table where item being referenced is stored.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity ID') , + 'description' => 'Foreign key to the referenced item.', + 'required' => true, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Title') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'intro' => array( + 'name' => 'intro', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Intro') , + 'description' => 'Introductory message to contributor or participant displayed on the Tell a Friend form.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'suggested_message' => array( + 'name' => 'suggested_message', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Suggested Message') , + 'description' => 'Suggested message to friends, provided as default on the Tell A Friend form.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'general_link' => array( + 'name' => 'general_link', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('General Link') , + 'description' => 'URL for general info about the organization - included in the email sent to friends.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_tell_friend.general_link', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'thankyou_title' => array( + 'name' => 'thankyou_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Thank You Title') , + 'description' => 'Text for Tell a Friend thank you page header and HTML title.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'thankyou_text' => array( + 'name' => 'thankyou_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Thank You Text') , + 'description' => 'Thank you message displayed on success page.', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Enabled?') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'title' => 'title', + 'intro' => 'intro', + 'suggested_message' => 'suggested_message', + 'general_link' => 'general_link', + 'thankyou_title' => 'thankyou_title', + 'thankyou_text' => 'thankyou_text', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['tell_friend'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['tell_friend'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Grant/DAO/Grant.php b/CRM/Grant/DAO/Grant.php new file mode 100644 index 0000000000..88eac68020 --- /dev/null +++ b/CRM/Grant/DAO/Grant.php @@ -0,0 +1,520 @@ +__table = 'civicrm_grant'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'grant_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Grant ID') , + 'description' => 'Unique Grant id', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_grant.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'grant_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Contact ID of contact record given grant belongs to.', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_grant.contact_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'application_received_date' => array( + 'name' => 'application_received_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Application received date') , + 'description' => 'Date on which grant application was received by donor.', + 'export' => true, + 'where' => 'civicrm_grant.application_received_date', + 'headerPattern' => '', + 'dataPattern' => '', + ) , + 'decision_date' => array( + 'name' => 'decision_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Decision date') , + 'description' => 'Date on which grant decision was made.', + 'import' => true, + 'where' => 'civicrm_grant.decision_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'grant_money_transfer_date' => array( + 'name' => 'money_transfer_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Grant Money transfer date') , + 'description' => 'Date on which grant money transfer was made.', + 'import' => true, + 'where' => 'civicrm_grant.money_transfer_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'grant_due_date' => array( + 'name' => 'grant_due_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Grant Due Date') , + 'description' => 'Date on which grant report is due.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'grant_report_received' => array( + 'name' => 'grant_report_received', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Grant report received') , + 'description' => 'Yes/No field stating whether grant report was received by donor.', + 'import' => true, + 'where' => 'civicrm_grant.grant_report_received', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'grant_type_id' => array( + 'name' => 'grant_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Grant Type') , + 'description' => 'Type of grant. Implicit FK to civicrm_option_value in grant_type option_group.', + 'required' => true, + 'export' => true, + 'where' => 'civicrm_grant.grant_type_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'grant_type', + 'optionEditPath' => 'civicrm/admin/options/grant_type', + ) + ) , + 'amount_total' => array( + 'name' => 'amount_total', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Total Amount') , + 'description' => 'Requested grant amount, in default currency.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_grant.amount_total', + 'headerPattern' => '', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'amount_requested' => array( + 'name' => 'amount_requested', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Amount Requested') , + 'description' => 'Requested grant amount, in original currency (optional).', + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'amount_granted' => array( + 'name' => 'amount_granted', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Amount granted') , + 'description' => 'Granted amount, in default currency.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_grant.amount_granted', + 'headerPattern' => '', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Grant Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'required' => true, + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'rationale' => array( + 'name' => 'rationale', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Grant Rationale') , + 'description' => 'Grant rationale.', + 'rows' => 4, + 'cols' => 60, + 'import' => true, + 'where' => 'civicrm_grant.rationale', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'grant_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Grant Status') , + 'description' => 'Id of Grant status.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_grant.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'grant_status', + 'optionEditPath' => 'civicrm/admin/options/grant_status', + ) + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'grant_id', + 'contact_id' => 'grant_contact_id', + 'application_received_date' => 'application_received_date', + 'decision_date' => 'decision_date', + 'money_transfer_date' => 'grant_money_transfer_date', + 'grant_due_date' => 'grant_due_date', + 'grant_report_received' => 'grant_report_received', + 'grant_type_id' => 'grant_type_id', + 'amount_total' => 'amount_total', + 'amount_requested' => 'amount_requested', + 'amount_granted' => 'amount_granted', + 'currency' => 'currency', + 'rationale' => 'rationale', + 'status_id' => 'grant_status_id', + 'financial_type_id' => 'financial_type_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['grant'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['grant'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/BouncePattern.php b/CRM/Mailing/DAO/BouncePattern.php new file mode 100644 index 0000000000..2496dab124 --- /dev/null +++ b/CRM/Mailing/DAO/BouncePattern.php @@ -0,0 +1,234 @@ +__table = 'civicrm_mailing_bounce_pattern'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'bounce_type_id', 'civicrm_mailing_bounce_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Bounce Pattern ID') , + 'required' => true, + ) , + 'bounce_type_id' => array( + 'name' => 'bounce_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Bounce Type') , + 'description' => 'Type of bounce', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_BounceType', + ) , + 'pattern' => array( + 'name' => 'pattern', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Pattern') , + 'description' => 'A regexp to match a message to a bounce type', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'bounce_type_id' => 'bounce_type_id', + 'pattern' => 'pattern', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_bounce_pattern'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_bounce_pattern'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/BounceType.php b/CRM/Mailing/DAO/BounceType.php new file mode 100644 index 0000000000..e939383eb6 --- /dev/null +++ b/CRM/Mailing/DAO/BounceType.php @@ -0,0 +1,236 @@ +__table = 'civicrm_mailing_bounce_type'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Bounce Type ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Bounce Type Name') , + 'description' => 'Type of bounce', + 'required' => true, + 'maxlength' => 24, + 'size' => CRM_Utils_Type::MEDIUM, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Bounce Type Description') , + 'description' => 'A description of this bounce type', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'hold_threshold' => array( + 'name' => 'hold_threshold', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Hold Threshold') , + 'description' => 'Number of bounces of this type required before the email address is put on bounce hold', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'description' => 'description', + 'hold_threshold' => 'hold_threshold', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_bounce_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_bounce_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/Component.php b/CRM/Mailing/DAO/Component.php new file mode 100644 index 0000000000..723b972ba7 --- /dev/null +++ b/CRM/Mailing/DAO/Component.php @@ -0,0 +1,302 @@ +__table = 'civicrm_mailing_component'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Component ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Component Name') , + 'description' => 'The name of this component', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'component_type' => array( + 'name' => 'component_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Component Type') , + 'description' => 'Type of Component.', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::mailingComponents', + ) + ) , + 'subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Subject') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'body_html' => array( + 'name' => 'body_html', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Mailing Component Body HTML') , + 'description' => 'Body of the component in html format.', + 'rows' => 8, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'body_text' => array( + 'name' => 'body_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Body Text') , + 'description' => 'Body of the component in text format.', + 'rows' => 8, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Mailing Component is Default?') , + 'description' => 'Is this the default component for this component_type?', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Mailing Component Is Active?') , + 'description' => 'Is this property active?', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'component_type' => 'component_type', + 'subject' => 'subject', + 'body_html' => 'body_html', + 'body_text' => 'body_text', + 'is_default' => 'is_default', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_component'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_component'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php new file mode 100644 index 0000000000..cb5e75c45b --- /dev/null +++ b/CRM/Mailing/DAO/Mailing.php @@ -0,0 +1,824 @@ +__table = 'civicrm_mailing'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'header_id', 'civicrm_mailing_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'footer_id', 'civicrm_mailing_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'reply_id', 'civicrm_mailing_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'unsubscribe_id', 'civicrm_mailing_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'optout_id', 'civicrm_mailing_component', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'msg_template_id', 'civicrm_msg_template', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'scheduled_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'approver_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'sms_provider_id', 'civicrm_sms_provider', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'location_type_id', 'civicrm_location_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing ID') , + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Domain') , + 'description' => 'Which site is this mailing for', + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'header_id' => array( + 'name' => 'header_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Header') , + 'description' => 'FK to the header component.', + 'FKClassName' => 'CRM_Mailing_DAO_Component', + ) , + 'footer_id' => array( + 'name' => 'footer_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Footer') , + 'description' => 'FK to the footer component.', + 'FKClassName' => 'CRM_Mailing_DAO_Component', + ) , + 'reply_id' => array( + 'name' => 'reply_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Reply') , + 'description' => 'FK to the auto-responder component.', + 'FKClassName' => 'CRM_Mailing_DAO_Component', + ) , + 'unsubscribe_id' => array( + 'name' => 'unsubscribe_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Unsubscribe') , + 'description' => 'FK to the unsubscribe component.', + 'FKClassName' => 'CRM_Mailing_DAO_Component', + ) , + 'resubscribe_id' => array( + 'name' => 'resubscribe_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Resubscribe') , + ) , + 'optout_id' => array( + 'name' => 'optout_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Opt Out') , + 'description' => 'FK to the opt-out component.', + 'FKClassName' => 'CRM_Mailing_DAO_Component', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Name') , + 'description' => 'Mailing Name.', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'mailing_type' => array( + 'name' => 'mailing_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Type') , + 'description' => 'differentiate between standalone mailings, A/B tests, and A/B final-winner', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes', + ) + ) , + 'from_name' => array( + 'name' => 'from_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing From Name') , + 'description' => 'From Header of mailing', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'from_email' => array( + 'name' => 'from_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing From Email') , + 'description' => 'From Email of mailing', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'replyto_email' => array( + 'name' => 'replyto_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Replyto Email') , + 'description' => 'Reply-To Email of mailing', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'subject' => array( + 'name' => 'subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Subject') , + 'description' => 'Subject of mailing', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'body_text' => array( + 'name' => 'body_text', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Body Text') , + 'description' => 'Body of the mailing in text format.', + ) , + 'body_html' => array( + 'name' => 'body_html', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Body Html') , + 'description' => 'Body of the mailing in html format.', + ) , + 'url_tracking' => array( + 'name' => 'url_tracking', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Url Tracking') , + 'description' => 'Should we track URL click-throughs for this mailing?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'forward_replies' => array( + 'name' => 'forward_replies', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Forward Replies') , + 'description' => 'Should we forward replies back to the author?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'auto_responder' => array( + 'name' => 'auto_responder', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Auto Responder') , + 'description' => 'Should we enable the auto-responder?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'open_tracking' => array( + 'name' => 'open_tracking', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Track Mailing?') , + 'description' => 'Should we track when recipients open/read this mailing?', + ) , + 'is_completed' => array( + 'name' => 'is_completed', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Mailing Completed') , + 'description' => 'Has at least one job associated with this mailing finished?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'msg_template_id' => array( + 'name' => 'msg_template_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Message Template') , + 'description' => 'FK to the message template.', + 'FKClassName' => 'CRM_Core_DAO_MessageTemplate', + ) , + 'override_verp' => array( + 'name' => 'override_verp', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Override Verp') , + 'description' => 'Should we overrite VERP address in Reply-To', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Creator') , + 'description' => 'FK to Contact ID who first created this mailing', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Created Date') , + 'description' => 'Date and time this mailing was created.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'scheduled_id' => array( + 'name' => 'scheduled_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Scheduled By') , + 'description' => 'FK to Contact ID who scheduled this mailing', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'scheduled_date' => array( + 'name' => 'scheduled_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Scheduled Date') , + 'description' => 'Date and time this mailing was scheduled.', + ) , + 'approver_id' => array( + 'name' => 'approver_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Approved By') , + 'description' => 'FK to Contact ID who approved this mailing', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'approval_date' => array( + 'name' => 'approval_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Approved Date') , + 'description' => 'Date and time this mailing was approved.', + ) , + 'approval_status_id' => array( + 'name' => 'approval_status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Approval Status') , + 'description' => 'The status of this mailing. Values: none, approved, rejected', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'mail_approval_status', + 'optionEditPath' => 'civicrm/admin/options/mail_approval_status', + ) + ) , + 'approval_note' => array( + 'name' => 'approval_note', + 'type' => CRM_Utils_Type::T_LONGTEXT, + 'title' => ts('Approval Note') , + 'description' => 'Note behind the decision.', + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'is_archived' => array( + 'name' => 'is_archived', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Mailing Archived?') , + 'description' => 'Is this mailing archived?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'visibility' => array( + 'name' => 'visibility', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Visibility') , + 'description' => 'In what context(s) is the mailing contents visible (online viewing)', + 'maxlength' => 40, + 'size' => CRM_Utils_Type::BIG, + 'default' => 'Public Pages', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::groupVisibility', + ) + ) , + 'campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Campaign') , + 'description' => 'The campaign for which this mailing has been initiated.', + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'dedupe_email' => array( + 'name' => 'dedupe_email', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('No Duplicate emails?') , + 'description' => 'Remove duplicate emails?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'sms_provider_id' => array( + 'name' => 'sms_provider_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing SMS Provider') , + 'FKClassName' => 'CRM_SMS_DAO_Provider', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'hash' => array( + 'name' => 'hash', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Hash') , + 'description' => 'Key for validating requests related to this mailing.', + 'maxlength' => 16, + 'size' => CRM_Utils_Type::TWELVE, + ) , + 'location_type_id' => array( + 'name' => 'location_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Location Type') , + 'description' => 'With email_selection_method, determines which email address to use', + 'FKClassName' => 'CRM_Core_DAO_LocationType', + 'pseudoconstant' => array( + 'table' => 'civicrm_location_type', + 'keyColumn' => 'id', + 'labelColumn' => 'display_name', + ) + ) , + 'email_selection_method' => array( + 'name' => 'email_selection_method', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Email Selection Method') , + 'description' => 'With location_type_id, determine how to choose the email address to use.', + 'maxlength' => 20, + 'size' => CRM_Utils_Type::MEDIUM, + 'default' => 'automatic', + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::emailSelectMethods', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'header_id' => 'header_id', + 'footer_id' => 'footer_id', + 'reply_id' => 'reply_id', + 'unsubscribe_id' => 'unsubscribe_id', + 'resubscribe_id' => 'resubscribe_id', + 'optout_id' => 'optout_id', + 'name' => 'name', + 'mailing_type' => 'mailing_type', + 'from_name' => 'from_name', + 'from_email' => 'from_email', + 'replyto_email' => 'replyto_email', + 'subject' => 'subject', + 'body_text' => 'body_text', + 'body_html' => 'body_html', + 'url_tracking' => 'url_tracking', + 'forward_replies' => 'forward_replies', + 'auto_responder' => 'auto_responder', + 'open_tracking' => 'open_tracking', + 'is_completed' => 'is_completed', + 'msg_template_id' => 'msg_template_id', + 'override_verp' => 'override_verp', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + 'scheduled_id' => 'scheduled_id', + 'scheduled_date' => 'scheduled_date', + 'approver_id' => 'approver_id', + 'approval_date' => 'approval_date', + 'approval_status_id' => 'approval_status_id', + 'approval_note' => 'approval_note', + 'is_archived' => 'is_archived', + 'visibility' => 'visibility', + 'campaign_id' => 'campaign_id', + 'dedupe_email' => 'dedupe_email', + 'sms_provider_id' => 'sms_provider_id', + 'hash' => 'hash', + 'location_type_id' => 'location_type_id', + 'email_selection_method' => 'email_selection_method', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/MailingAB.php b/CRM/Mailing/DAO/MailingAB.php new file mode 100644 index 0000000000..9b90c0c7ff --- /dev/null +++ b/CRM/Mailing/DAO/MailingAB.php @@ -0,0 +1,390 @@ +__table = 'civicrm_mailing_abtest'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('MailingAB ID') , + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Name of the A/B test', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'status' => array( + 'name' => 'status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Status') , + 'description' => 'Status', + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'pseudoconstant' => array( + 'callback' => 'CRM_Mailing_PseudoConstant::abStatus', + ) + ) , + 'mailing_id_a' => array( + 'name' => 'mailing_id_a', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing ID (A)') , + 'description' => 'The first experimental mailing ("A" condition)', + ) , + 'mailing_id_b' => array( + 'name' => 'mailing_id_b', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing ID (B)') , + 'description' => 'The second experimental mailing ("B" condition)', + ) , + 'mailing_id_c' => array( + 'name' => 'mailing_id_c', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing ID (C)') , + 'description' => 'The final, general mailing (derived from A or B)', + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Domain ID') , + 'description' => 'Which site is this mailing for', + ) , + 'testing_criteria' => array( + 'name' => 'testing_criteria', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Testing Criteria') , + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'pseudoconstant' => array( + 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria', + ) + ) , + 'winner_criteria' => array( + 'name' => 'winner_criteria', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Winner Criteria') , + 'maxlength' => 32, + 'size' => CRM_Utils_Type::MEDIUM, + 'pseudoconstant' => array( + 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria', + ) + ) , + 'specific_url' => array( + 'name' => 'specific_url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('URL for Winner Criteria') , + 'description' => 'What specific url to track', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'declare_winning_time' => array( + 'name' => 'declare_winning_time', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Declaration Time') , + 'description' => 'In how much time to declare winner', + ) , + 'group_percentage' => array( + 'name' => 'group_percentage', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Group Percentage') , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('AB Test Created By') , + 'description' => 'FK to Contact ID', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'created_date' => array( + 'name' => 'created_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('AB Test Created Date') , + 'description' => 'When was this item created', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'status' => 'status', + 'mailing_id_a' => 'mailing_id_a', + 'mailing_id_b' => 'mailing_id_b', + 'mailing_id_c' => 'mailing_id_c', + 'domain_id' => 'domain_id', + 'testing_criteria' => 'testing_criteria', + 'winner_criteria' => 'winner_criteria', + 'specific_url' => 'specific_url', + 'declare_winning_time' => 'declare_winning_time', + 'group_percentage' => 'group_percentage', + 'created_id' => 'created_id', + 'created_date' => 'created_date', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_abtest'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_abtest'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/MailingGroup.php b/CRM/Mailing/DAO/MailingGroup.php new file mode 100644 index 0000000000..1b056ae034 --- /dev/null +++ b/CRM/Mailing/DAO/MailingGroup.php @@ -0,0 +1,300 @@ +__table = 'civicrm_mailing_group'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Group ID') , + 'required' => true, + ) , + 'mailing_id' => array( + 'name' => 'mailing_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing') , + 'description' => 'The ID of a previous mailing to include/exclude recipients.', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_Mailing', + ) , + 'group_type' => array( + 'name' => 'group_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Group Type') , + 'description' => 'Are the members of the group included or excluded?.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes', + ) + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Group Entity Table') , + 'description' => 'Name of table where item being referenced is stored.', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'pseudoconstant' => array( + 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables', + ) + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Group Entity') , + 'description' => 'Foreign key to the referenced item.', + 'required' => true, + ) , + 'search_id' => array( + 'name' => 'search_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Group Search') , + 'description' => 'The filtering search. custom search id or -1 for civicrm api search', + ) , + 'search_args' => array( + 'name' => 'search_args', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Mailing Group Search Arguments') , + 'description' => 'The arguments to be sent to the search function', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'mailing_id' => 'mailing_id', + 'group_type' => 'group_type', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'search_id' => 'search_id', + 'search_args' => 'search_args', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_group'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_group'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/MailingJob.php b/CRM/Mailing/DAO/MailingJob.php new file mode 100644 index 0000000000..fa13a36463 --- /dev/null +++ b/CRM/Mailing/DAO/MailingJob.php @@ -0,0 +1,349 @@ +__table = 'civicrm_mailing_job'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_mailing_job', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Job ID') , + 'required' => true, + ) , + 'mailing_id' => array( + 'name' => 'mailing_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing') , + 'description' => 'The ID of the mailing this Job will send.', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_Mailing', + ) , + 'scheduled_date' => array( + 'name' => 'scheduled_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Scheduled Date') , + 'description' => 'date on which this job was scheduled.', + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Job Start Date') , + 'description' => 'date on which this job was started.', + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Job End Date') , + 'description' => 'date on which this job ended.', + ) , + 'status' => array( + 'name' => 'status', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Job Status') , + 'description' => 'The state of this job', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus', + ) + ) , + 'is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Mailing Job Is Test?') , + 'description' => 'Is this job for a test mail?', + ) , + 'job_type' => array( + 'name' => 'job_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Job Type') , + 'description' => 'Type of mailling job: null | child ', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'parent_id' => array( + 'name' => 'parent_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Job Parent') , + 'description' => 'Parent job id', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', + ) , + 'job_offset' => array( + 'name' => 'job_offset', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Job Offset') , + 'description' => 'Offset of the child job', + ) , + 'job_limit' => array( + 'name' => 'job_limit', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Job Limit') , + 'description' => 'Queue size limit for each child job', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'mailing_id' => 'mailing_id', + 'scheduled_date' => 'scheduled_date', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'status' => 'status', + 'is_test' => 'is_test', + 'job_type' => 'job_type', + 'parent_id' => 'parent_id', + 'job_offset' => 'job_offset', + 'job_limit' => 'job_limit', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_job'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_job'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/Recipients.php b/CRM/Mailing/DAO/Recipients.php new file mode 100644 index 0000000000..568e74fca8 --- /dev/null +++ b/CRM/Mailing/DAO/Recipients.php @@ -0,0 +1,267 @@ +__table = 'civicrm_mailing_recipients'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Recipients ID') , + 'required' => true, + ) , + 'mailing_id' => array( + 'name' => 'mailing_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing') , + 'description' => 'The ID of the mailing this Job will send.', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_Mailing', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Recipient') , + 'description' => 'FK to Contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'email_id' => array( + 'name' => 'email_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Recipient Email') , + 'description' => 'FK to Email', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Email', + ) , + 'phone_id' => array( + 'name' => 'phone_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Recipient Phone') , + 'description' => 'FK to Phone', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Phone', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'mailing_id' => 'mailing_id', + 'contact_id' => 'contact_id', + 'email_id' => 'email_id', + 'phone_id' => 'phone_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_recipients'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_recipients'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/Spool.php b/CRM/Mailing/DAO/Spool.php new file mode 100644 index 0000000000..592a437b8f --- /dev/null +++ b/CRM/Mailing/DAO/Spool.php @@ -0,0 +1,284 @@ +__table = 'civicrm_mailing_spool'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'job_id', 'civicrm_mailing_job', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Spool ID') , + 'required' => true, + ) , + 'job_id' => array( + 'name' => 'job_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Job') , + 'description' => 'The ID of the Job .', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', + ) , + 'recipient_email' => array( + 'name' => 'recipient_email', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Recipient Email') , + 'description' => 'The email of the receipients this mail is to be sent.', + ) , + 'headers' => array( + 'name' => 'headers', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Headers') , + 'description' => 'The header information of this mailing .', + ) , + 'body' => array( + 'name' => 'body', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Body') , + 'description' => 'The body of this mailing.', + ) , + 'added_at' => array( + 'name' => 'added_at', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Added') , + 'description' => 'date on which this job was added.', + ) , + 'removed_at' => array( + 'name' => 'removed_at', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Removed') , + 'description' => 'date on which this job was removed.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'job_id' => 'job_id', + 'recipient_email' => 'recipient_email', + 'headers' => 'headers', + 'body' => 'body', + 'added_at' => 'added_at', + 'removed_at' => 'removed_at', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_spool'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_spool'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/DAO/TrackableURL.php b/CRM/Mailing/DAO/TrackableURL.php new file mode 100644 index 0000000000..db66ad11a2 --- /dev/null +++ b/CRM/Mailing/DAO/TrackableURL.php @@ -0,0 +1,233 @@ +__table = 'civicrm_mailing_trackable_url'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'mailing_id', 'civicrm_mailing', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Trackable URL ID') , + 'required' => true, + ) , + 'url' => array( + 'name' => 'url', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Url') , + 'description' => 'The URL to be tracked.', + 'required' => true, + ) , + 'mailing_id' => array( + 'name' => 'mailing_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing') , + 'description' => 'FK to the mailing', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_Mailing', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'url' => 'url', + 'mailing_id' => 'mailing_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_trackable_url'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_trackable_url'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Bounce.php b/CRM/Mailing/Event/DAO/Bounce.php new file mode 100644 index 0000000000..29b0e0b1b6 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Bounce.php @@ -0,0 +1,269 @@ +__table = 'civicrm_mailing_event_bounce'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Bounce ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'bounce_type_id' => array( + 'name' => 'bounce_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Bounce Type') , + 'description' => 'What type of bounce was it?', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_mailing_bounce_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'bounce_reason' => array( + 'name' => 'bounce_reason', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Bounce Reason') , + 'description' => 'The reason the email bounced.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Timestamp') , + 'description' => 'When this bounce event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'bounce_type_id' => 'bounce_type_id', + 'bounce_reason' => 'bounce_reason', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_bounce'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_bounce'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Confirm.php b/CRM/Mailing/Event/DAO/Confirm.php new file mode 100644 index 0000000000..ba947965c4 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Confirm.php @@ -0,0 +1,233 @@ +__table = 'civicrm_mailing_event_confirm'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_subscribe_id', 'civicrm_mailing_event_subscribe', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Confirmation ID') , + 'required' => true, + ) , + 'event_subscribe_id' => array( + 'name' => 'event_subscribe_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Subscribe ID') , + 'description' => 'FK to civicrm_mailing_event_subscribe', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Subscribe', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Confirm Timestamp') , + 'description' => 'When this confirmation event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_subscribe_id' => 'event_subscribe_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_confirm'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_confirm'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Delivered.php b/CRM/Mailing/Event/DAO/Delivered.php new file mode 100644 index 0000000000..a02d49cf64 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Delivered.php @@ -0,0 +1,233 @@ +__table = 'civicrm_mailing_event_delivered'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Delivered ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Timestamp') , + 'description' => 'When this delivery event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_delivered'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_delivered'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Forward.php b/CRM/Mailing/Event/DAO/Forward.php new file mode 100644 index 0000000000..c4dccba570 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Forward.php @@ -0,0 +1,248 @@ +__table = 'civicrm_mailing_event_forward'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'dest_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Forward ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'dest_queue_id' => array( + 'name' => 'dest_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Destination Queue') , + 'description' => 'FK to EventQueue for destination', + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Timestamp') , + 'description' => 'When this forward event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'dest_queue_id' => 'dest_queue_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_forward'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_forward'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Opened.php b/CRM/Mailing/Event/DAO/Opened.php new file mode 100644 index 0000000000..c6be94bee7 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Opened.php @@ -0,0 +1,233 @@ +__table = 'civicrm_mailing_event_opened'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Opened ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Timestamp') , + 'description' => 'When this open event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_opened'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_opened'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Queue.php b/CRM/Mailing/Event/DAO/Queue.php new file mode 100644 index 0000000000..dd01ae4e97 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Queue.php @@ -0,0 +1,283 @@ +__table = 'civicrm_mailing_event_queue'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'job_id', 'civicrm_mailing_job', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Event Queue ID') , + 'required' => true, + ) , + 'job_id' => array( + 'name' => 'job_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Job ID') , + 'description' => 'FK to Job', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_MailingJob', + ) , + 'email_id' => array( + 'name' => 'email_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Email ID') , + 'description' => 'FK to Email', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Email', + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'hash' => array( + 'name' => 'hash', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Security Hash') , + 'description' => 'Security hash', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'phone_id' => array( + 'name' => 'phone_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Phone ID') , + 'description' => 'FK to Phone', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_Phone', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'job_id' => 'job_id', + 'email_id' => 'email_id', + 'contact_id' => 'contact_id', + 'hash' => 'hash', + 'phone_id' => 'phone_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_queue'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_queue'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Reply.php b/CRM/Mailing/Event/DAO/Reply.php new file mode 100644 index 0000000000..c7db2619b3 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Reply.php @@ -0,0 +1,233 @@ +__table = 'civicrm_mailing_event_reply'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Reply ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Reply Timestamp') , + 'description' => 'When this reply event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_reply'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_reply'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Subscribe.php b/CRM/Mailing/Event/DAO/Subscribe.php new file mode 100644 index 0000000000..25f2c2c084 --- /dev/null +++ b/CRM/Mailing/Event/DAO/Subscribe.php @@ -0,0 +1,273 @@ +__table = 'civicrm_mailing_event_subscribe'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'group_id', 'civicrm_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Subscribe ID') , + 'required' => true, + ) , + 'group_id' => array( + 'name' => 'group_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Subscribe Group') , + 'description' => 'FK to Group', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Group', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_group', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + 'contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Subscribe Contact') , + 'description' => 'FK to Contact', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'hash' => array( + 'name' => 'hash', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Mailing Subscribe Hash') , + 'description' => 'Security hash', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Mailing Subscribe Timestamp') , + 'description' => 'When this subscription event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'group_id' => 'group_id', + 'contact_id' => 'contact_id', + 'hash' => 'hash', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_subscribe'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_subscribe'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/TrackableURLOpen.php b/CRM/Mailing/Event/DAO/TrackableURLOpen.php new file mode 100644 index 0000000000..72b8bc3daa --- /dev/null +++ b/CRM/Mailing/Event/DAO/TrackableURLOpen.php @@ -0,0 +1,249 @@ +__table = 'civicrm_mailing_event_trackable_url_open'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'trackable_url_id', 'civicrm_mailing_trackable_url', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Trackable URL Open ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'trackable_url_id' => array( + 'name' => 'trackable_url_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Trackable Url') , + 'description' => 'FK to TrackableURL', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_DAO_TrackableURL', + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Timestamp') , + 'description' => 'When this trackable URL open occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'trackable_url_id' => 'trackable_url_id', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_trackable_url_open'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_trackable_url_open'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Mailing/Event/DAO/Unsubscribe.php b/CRM/Mailing/Event/DAO/Unsubscribe.php new file mode 100644 index 0000000000..3191e3302c --- /dev/null +++ b/CRM/Mailing/Event/DAO/Unsubscribe.php @@ -0,0 +1,247 @@ +__table = 'civicrm_mailing_event_unsubscribe'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'event_queue_id', 'civicrm_mailing_event_queue', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Unsubscribe ID') , + 'required' => true, + ) , + 'event_queue_id' => array( + 'name' => 'event_queue_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Mailing Event Queue') , + 'description' => 'FK to EventQueue', + 'required' => true, + 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue', + ) , + 'org_unsubscribe' => array( + 'name' => 'org_unsubscribe', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Unsubscribe is for Organization?') , + 'description' => 'Unsubscribe at org- or group-level', + 'required' => true, + ) , + 'time_stamp' => array( + 'name' => 'time_stamp', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Unsubscribe Timestamp') , + 'description' => 'When this delivery event occurred.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'event_queue_id' => 'event_queue_id', + 'org_unsubscribe' => 'org_unsubscribe', + 'time_stamp' => 'time_stamp', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['mailing_event_unsubscribe'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['mailing_event_unsubscribe'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/Membership.php b/CRM/Member/DAO/Membership.php new file mode 100644 index 0000000000..49530e2272 --- /dev/null +++ b/CRM/Member/DAO/Membership.php @@ -0,0 +1,513 @@ +__table = 'civicrm_membership'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_membership_status', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'owner_membership_id', 'civicrm_membership', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_recur_id', 'civicrm_contribution_recur', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'membership_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership ID') , + 'description' => 'Membership Id', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_membership.id', + 'headerPattern' => '/^(m(embership\s)?id)$/i', + 'dataPattern' => '', + 'export' => true, + ) , + 'membership_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_membership.contact_id', + 'headerPattern' => '/contact(.?id)?/i', + 'dataPattern' => '/^\d+$/', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'membership_type_id' => array( + 'name' => 'membership_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type Id') , + 'description' => 'FK to Membership Type', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_membership.membership_type_id', + 'headerPattern' => '/^(m(embership\s)?type)$/i', + 'dataPattern' => '', + 'export' => false, + 'FKClassName' => 'CRM_Member_DAO_MembershipType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_membership_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'join_date' => array( + 'name' => 'join_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Member Since') , + 'description' => 'Beginning of initial membership period (member since...).', + 'import' => true, + 'where' => 'civicrm_membership.join_date', + 'headerPattern' => '/^join|(j(oin\s)?date)$/i', + 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'membership_start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Membership Start Date') , + 'description' => 'Beginning of current uninterrupted membership period.', + 'import' => true, + 'where' => 'civicrm_membership.start_date', + 'headerPattern' => '/(member(ship)?.)?start(s)?(.date$)?/i', + 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'membership_end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Membership Expiration Date') , + 'description' => 'Current membership period expire date.', + 'import' => true, + 'where' => 'civicrm_membership.end_date', + 'headerPattern' => '/(member(ship)?.)?end(s)?(.date$)?/i', + 'dataPattern' => '/\d{4}-?\d{2}-?\d{2}/', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'membership_source' => array( + 'name' => 'source', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Source') , + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_membership.source', + 'headerPattern' => '/^(member(ship?))?source$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Status Id') , + 'description' => 'FK to Membership Status', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_membership.status_id', + 'headerPattern' => '/(member(ship|).)?(status)$/i', + 'dataPattern' => '', + 'export' => false, + 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_membership_status', + 'keyColumn' => 'id', + 'labelColumn' => 'label', + ) + ) , + 'is_override' => array( + 'name' => 'is_override', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Status Override') , + 'description' => 'Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.', + 'import' => true, + 'where' => 'civicrm_membership.is_override', + 'headerPattern' => '/override$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'owner_membership_id' => array( + 'name' => 'owner_membership_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Primary Member ID') , + 'description' => 'Optional FK to Parent Membership.', + 'export' => true, + 'where' => 'civicrm_membership.owner_membership_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'FKClassName' => 'CRM_Member_DAO_Membership', + ) , + 'max_related' => array( + 'name' => 'max_related', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Max Related') , + 'description' => 'Maximum number of related memberships (membership_type override).', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'member_is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_membership.is_test', + 'headerPattern' => '/(is.)?test(.member(ship)?)?/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'member_is_pay_later' => array( + 'name' => 'is_pay_later', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Pay Later') , + 'import' => true, + 'where' => 'civicrm_membership.is_pay_later', + 'headerPattern' => '/(is.)?(pay(.)?later)$/i', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'contribution_recur_id' => array( + 'name' => 'contribution_recur_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Recurring Contribution') , + 'description' => 'Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.', + 'FKClassName' => 'CRM_Contribute_DAO_ContributionRecur', + ) , + 'member_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this membership is attached.', + 'import' => true, + 'where' => 'civicrm_membership.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'membership_id', + 'contact_id' => 'membership_contact_id', + 'membership_type_id' => 'membership_type_id', + 'join_date' => 'join_date', + 'start_date' => 'membership_start_date', + 'end_date' => 'membership_end_date', + 'source' => 'membership_source', + 'status_id' => 'status_id', + 'is_override' => 'is_override', + 'owner_membership_id' => 'owner_membership_id', + 'max_related' => 'max_related', + 'is_test' => 'member_is_test', + 'is_pay_later' => 'member_is_pay_later', + 'contribution_recur_id' => 'contribution_recur_id', + 'campaign_id' => 'member_campaign_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/MembershipBlock.php b/CRM/Member/DAO/MembershipBlock.php new file mode 100644 index 0000000000..6400a0856f --- /dev/null +++ b/CRM/Member/DAO/MembershipBlock.php @@ -0,0 +1,377 @@ +__table = 'civicrm_membership_block'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'entity_id', 'civicrm_contribution_page', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_default', 'civicrm_membership_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Block ID') , + 'description' => 'Membership Id', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Block Entity Table') , + 'description' => 'Name for Membership Status', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Block Entity ID') , + 'description' => 'FK to civicrm_contribution_page.id', + 'required' => true, + 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', + ) , + 'membership_types' => array( + 'name' => 'membership_types', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Block Membership Types') , + 'description' => 'Membership types to be exposed by this block', + 'maxlength' => 1024, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'membership_type_default' => array( + 'name' => 'membership_type_default', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Block Default Type') , + 'description' => 'Optional foreign key to membership_type', + 'FKClassName' => 'CRM_Member_DAO_MembershipType', + ) , + 'display_min_fee' => array( + 'name' => 'display_min_fee', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Membership Block Display Minimum Fee') , + 'description' => 'Display minimum membership fee', + 'default' => '1', + ) , + 'is_separate_payment' => array( + 'name' => 'is_separate_payment', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Membership Block Is Separate Payment') , + 'description' => 'Should membership transactions be processed separately', + 'default' => '1', + ) , + 'new_title' => array( + 'name' => 'new_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Block New Title') , + 'description' => 'Title to display at top of block', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'new_text' => array( + 'name' => 'new_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Membership Block New Text') , + 'description' => 'Text to display below title', + ) , + 'renewal_title' => array( + 'name' => 'renewal_title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Block Renewal Title') , + 'description' => 'Title for renewal', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'renewal_text' => array( + 'name' => 'renewal_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Membership Block Renewal Text') , + 'description' => 'Text to display for member renewal', + ) , + 'is_required' => array( + 'name' => 'is_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Required') , + 'description' => 'Is membership sign up optional', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is this membership_block enabled', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'membership_types' => 'membership_types', + 'membership_type_default' => 'membership_type_default', + 'display_min_fee' => 'display_min_fee', + 'is_separate_payment' => 'is_separate_payment', + 'new_title' => 'new_title', + 'new_text' => 'new_text', + 'renewal_title' => 'renewal_title', + 'renewal_text' => 'renewal_text', + 'is_required' => 'is_required', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership_block'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership_block'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/MembershipLog.php b/CRM/Member/DAO/MembershipLog.php new file mode 100644 index 0000000000..b12a95353f --- /dev/null +++ b/CRM/Member/DAO/MembershipLog.php @@ -0,0 +1,317 @@ +__table = 'civicrm_membership_log'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_id', 'civicrm_membership', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'status_id', 'civicrm_membership_status', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Log ID') , + 'required' => true, + ) , + 'membership_id' => array( + 'name' => 'membership_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership ID') , + 'description' => 'FK to Membership table', + 'required' => true, + 'FKClassName' => 'CRM_Member_DAO_Membership', + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Status') , + 'description' => 'New status assigned to membership by this action. FK to Membership Status', + 'required' => true, + 'FKClassName' => 'CRM_Member_DAO_MembershipStatus', + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Membership Log Start Date') , + 'description' => 'New membership period start date', + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Membership Log End Date') , + 'description' => 'New membership period expiration date.', + ) , + 'modified_id' => array( + 'name' => 'modified_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Log modified By') , + 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE, + 'title' => ts('Membership Change Date') , + 'description' => 'Date this membership modification action was logged.', + ) , + 'membership_type_id' => array( + 'name' => 'membership_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type ID') , + 'description' => 'FK to Membership Type.', + 'FKClassName' => 'CRM_Member_DAO_MembershipType', + ) , + 'max_related' => array( + 'name' => 'max_related', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum Related Memberships') , + 'description' => 'Maximum number of related memberships.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'membership_id' => 'membership_id', + 'status_id' => 'status_id', + 'start_date' => 'start_date', + 'end_date' => 'end_date', + 'modified_id' => 'modified_id', + 'modified_date' => 'modified_date', + 'membership_type_id' => 'membership_type_id', + 'max_related' => 'max_related', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership_log'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership_log'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/MembershipPayment.php b/CRM/Member/DAO/MembershipPayment.php new file mode 100644 index 0000000000..cf04acc703 --- /dev/null +++ b/CRM/Member/DAO/MembershipPayment.php @@ -0,0 +1,234 @@ +__table = 'civicrm_membership_payment'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_id', 'civicrm_membership', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Payment ID') , + 'required' => true, + ) , + 'membership_id' => array( + 'name' => 'membership_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership') , + 'description' => 'FK to Membership table', + 'required' => true, + 'FKClassName' => 'CRM_Member_DAO_Membership', + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution') , + 'description' => 'FK to contribution table.', + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'membership_id' => 'membership_id', + 'contribution_id' => 'contribution_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership_payment'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership_payment'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/MembershipStatus.php b/CRM/Member/DAO/MembershipStatus.php new file mode 100644 index 0000000000..d42eb4708a --- /dev/null +++ b/CRM/Member/DAO/MembershipStatus.php @@ -0,0 +1,415 @@ +__table = 'civicrm_membership_status'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Status ID') , + 'description' => 'Membership Id', + 'required' => true, + ) , + 'membership_status' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Status') , + 'description' => 'Name for Membership Status', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_membership_status.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label') , + 'description' => 'Label for Membership Status', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'start_event' => array( + 'name' => 'start_event', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Start Event') , + 'description' => 'Event when this status starts.', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::eventDate', + ) + ) , + 'start_event_adjust_unit' => array( + 'name' => 'start_event_adjust_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Start Event Adjust Unit') , + 'description' => 'Unit used for adjusting from start_event.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::unitList', + ) + ) , + 'start_event_adjust_interval' => array( + 'name' => 'start_event_adjust_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Start Event Adjust Interval') , + 'description' => 'Status range begins this many units from start_event.', + ) , + 'end_event' => array( + 'name' => 'end_event', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('End Event') , + 'description' => 'Event after which this status ends.', + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::eventDate', + ) + ) , + 'end_event_adjust_unit' => array( + 'name' => 'end_event_adjust_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('End Event Adjust Unit') , + 'description' => 'Unit used for adjusting from the ending event.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::unitList', + ) + ) , + 'end_event_adjust_interval' => array( + 'name' => 'end_event_adjust_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('End Event Adjust Interval') , + 'description' => 'Status range ends this many units from end_event.', + ) , + 'is_current_member' => array( + 'name' => 'is_current_member', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Current Membership?') , + 'description' => 'Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE).', + ) , + 'is_admin' => array( + 'name' => 'is_admin', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Admin Assigned Only?') , + 'description' => 'Is this status for admin/manual assignment only.', + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Default Status?') , + 'description' => 'Assign this status to a membership record if no other status match is found.', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is this membership_status enabled.', + 'default' => '1', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Reserved') , + 'description' => 'Is this membership_status reserved.', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'membership_status', + 'label' => 'label', + 'start_event' => 'start_event', + 'start_event_adjust_unit' => 'start_event_adjust_unit', + 'start_event_adjust_interval' => 'start_event_adjust_interval', + 'end_event' => 'end_event', + 'end_event_adjust_unit' => 'end_event_adjust_unit', + 'end_event_adjust_interval' => 'end_event_adjust_interval', + 'is_current_member' => 'is_current_member', + 'is_admin' => 'is_admin', + 'weight' => 'weight', + 'is_default' => 'is_default', + 'is_active' => 'is_active', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership_status'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership_status'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Member/DAO/MembershipType.php b/CRM/Member/DAO/MembershipType.php new file mode 100644 index 0000000000..e34e30f429 --- /dev/null +++ b/CRM/Member/DAO/MembershipType.php @@ -0,0 +1,533 @@ +__table = 'civicrm_membership_type'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'member_of_contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type ID') , + 'description' => 'Membership Id', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type Domain') , + 'description' => 'Which Domain is this match entry for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'membership_type' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type') , + 'description' => 'Name of Membership Type', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'import' => true, + 'where' => 'civicrm_membership_type.name', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Description') , + 'description' => 'Description of Membership Type', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'member_of_contact_id' => array( + 'name' => 'member_of_contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type Organization') , + 'description' => 'Owner organization for this membership type. FK to Contact ID', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Financial Type') , + 'description' => 'If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id', + 'required' => true, + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'minimum_fee' => array( + 'name' => 'minimum_fee', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('membership Type Minimum Fee') , + 'description' => 'Minimum fee for this membership (0 for free/complimentary memberships).', + 'precision' => array( + 20, + 2 + ) , + ) , + 'duration_unit' => array( + 'name' => 'duration_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Duration Unit') , + 'description' => 'Unit in which membership period is expressed.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList', + ) + ) , + 'duration_interval' => array( + 'name' => 'duration_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type Duration Interval') , + 'description' => 'Number of duration units in membership period (e.g. 1 year, 12 months).', + ) , + 'period_type' => array( + 'name' => 'period_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Plan') , + 'description' => 'Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::periodType', + ) + ) , + 'fixed_period_start_day' => array( + 'name' => 'fixed_period_start_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Fixed Period Start Day') , + 'description' => 'For fixed period memberships, month and day (mmdd) on which subscription/membership will start. Period start is back-dated unless after rollover day.', + ) , + 'fixed_period_rollover_day' => array( + 'name' => 'fixed_period_rollover_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Fixed Period Rollover Day') , + 'description' => 'For fixed period memberships, signups after this day (mmdd) rollover to next period.', + ) , + 'relationship_type_id' => array( + 'name' => 'relationship_type_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Relationship') , + 'description' => 'FK to Relationship Type ID', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'relationship_direction' => array( + 'name' => 'relationship_direction', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Relationship Direction') , + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'max_related' => array( + 'name' => 'max_related', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Max Related Members for Type') , + 'description' => 'Maximum number of related memberships.', + ) , + 'visibility' => array( + 'name' => 'visibility', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Visible') , + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::memberVisibility', + ) + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + ) , + 'receipt_text_signup' => array( + 'name' => 'receipt_text_signup', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Receipt Text') , + 'description' => 'Receipt Text for membership signup', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'receipt_text_renewal' => array( + 'name' => 'receipt_text_renewal', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Membership Type Renewal Text') , + 'description' => 'Receipt Text for membership renewal', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'auto_renew' => array( + 'name' => 'auto_renew', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Auto Renew') , + 'description' => '0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required;', + 'pseudoconstant' => array( + 'callback' => 'CRM_Core_SelectValues::memberAutoRenew', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Active') , + 'description' => 'Is this membership_type enabled', + 'default' => '1', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'membership_type', + 'description' => 'description', + 'member_of_contact_id' => 'member_of_contact_id', + 'financial_type_id' => 'financial_type_id', + 'minimum_fee' => 'minimum_fee', + 'duration_unit' => 'duration_unit', + 'duration_interval' => 'duration_interval', + 'period_type' => 'period_type', + 'fixed_period_start_day' => 'fixed_period_start_day', + 'fixed_period_rollover_day' => 'fixed_period_rollover_day', + 'relationship_type_id' => 'relationship_type_id', + 'relationship_direction' => 'relationship_direction', + 'max_related' => 'max_related', + 'visibility' => 'visibility', + 'weight' => 'weight', + 'receipt_text_signup' => 'receipt_text_signup', + 'receipt_text_renewal' => 'receipt_text_renewal', + 'auto_renew' => 'auto_renew', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['membership_type'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['membership_type'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/PCP/DAO/PCP.php b/CRM/PCP/DAO/PCP.php new file mode 100644 index 0000000000..6a62028861 --- /dev/null +++ b/CRM/PCP/DAO/PCP.php @@ -0,0 +1,459 @@ +__table = 'civicrm_pcp'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'pcp_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Personal Campaign Page ID') , + 'description' => 'Personal Campaign Page ID', + 'required' => true, + ) , + 'pcp_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'FK to Contact ID', + 'required' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Personal Campaign Page Status') , + 'required' => true, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'pcp_status', + 'optionEditPath' => 'civicrm/admin/options/pcp_status', + ) + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Personal Campaign Page Title') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'intro_text' => array( + 'name' => 'intro_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Intro Text') , + 'default' => 'NULL', + 'html' => array( + 'type' => 'TexArea', + ) , + ) , + 'page_text' => array( + 'name' => 'page_text', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Page Text') , + 'default' => 'NULL', + 'html' => array( + 'type' => 'TexArea', + ) , + ) , + 'donate_link_text' => array( + 'name' => 'donate_link_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Donate Link Text') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'page_id' => array( + 'name' => 'page_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution Page') , + 'description' => 'The Contribution or Event Page which triggered this pcp', + 'required' => true, + ) , + 'page_type' => array( + 'name' => 'page_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('PCP Page Type') , + 'description' => 'The type of PCP this is: contribute or event', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'default' => 'contribute', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'pcp_block_id' => array( + 'name' => 'pcp_block_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('PCP Block') , + 'description' => 'The pcp block that this pcp page was created from', + 'required' => true, + ) , + 'is_thermometer' => array( + 'name' => 'is_thermometer', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Use Thermometer?') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_honor_roll' => array( + 'name' => 'is_honor_roll', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Show Honor Roll?') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'goal_amount' => array( + 'name' => 'goal_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Goal Amount') , + 'description' => 'Goal amount of this Personal Campaign Page.', + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Enabled?') , + 'description' => 'Is Personal Campaign Page enabled/active?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_notify' => array( + 'name' => 'is_notify', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Notify Owner?') , + 'description' => 'Notify owner via email when someone donates to page?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'pcp_id', + 'contact_id' => 'pcp_contact_id', + 'status_id' => 'status_id', + 'title' => 'title', + 'intro_text' => 'intro_text', + 'page_text' => 'page_text', + 'donate_link_text' => 'donate_link_text', + 'page_id' => 'page_id', + 'page_type' => 'page_type', + 'pcp_block_id' => 'pcp_block_id', + 'is_thermometer' => 'is_thermometer', + 'is_honor_roll' => 'is_honor_roll', + 'goal_amount' => 'goal_amount', + 'currency' => 'currency', + 'is_active' => 'is_active', + 'is_notify' => 'is_notify', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['pcp'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['pcp'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/PCP/DAO/PCPBlock.php b/CRM/PCP/DAO/PCPBlock.php new file mode 100644 index 0000000000..a5745ef32c --- /dev/null +++ b/CRM/PCP/DAO/PCPBlock.php @@ -0,0 +1,389 @@ +__table = 'civicrm_pcp_block'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'supporter_profile_id', 'civicrm_uf_group', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'target_entity_id', NULL, 'id', 'target_entity_type'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('PCP Block ID') , + 'description' => 'PCP block Id', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity') , + 'description' => 'FK to civicrm_contribution_page.id OR civicrm_event.id', + 'required' => true, + ) , + 'target_entity_type' => array( + 'name' => 'target_entity_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Target Entity') , + 'description' => 'The type of entity that this pcp targets', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'contribute', + ) , + 'target_entity_id' => array( + 'name' => 'target_entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Target Entity ID') , + 'description' => 'The entity that this pcp targets', + 'required' => true, + ) , + 'supporter_profile_id' => array( + 'name' => 'supporter_profile_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Supporter Profile') , + 'description' => 'FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Core_DAO_UFGroup', + ) , + 'owner_notify_id' => array( + 'name' => 'owner_notify_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Owner Notification') , + 'description' => 'FK to civicrm_option_group with name = PCP owner notifications', + 'html' => array( + 'type' => 'Radio', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'pcp_owner_notify', + 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify', + ) + ) , + 'is_approval_needed' => array( + 'name' => 'is_approval_needed', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Approval Required?') , + 'description' => 'Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?', + 'default' => 'NULL', + ) , + 'is_tellfriend_enabled' => array( + 'name' => 'is_tellfriend_enabled', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Tell a Friend Enabled?') , + 'description' => 'Does Personal Campaign Page allow using tell a friend?', + 'default' => 'NULL', + ) , + 'tellfriend_limit' => array( + 'name' => 'tellfriend_limit', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Tell A Friend Limit') , + 'description' => 'Maximum recipient fields allowed in tell a friend', + 'default' => 'NULL', + ) , + 'link_text' => array( + 'name' => 'link_text', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Link Text') , + 'description' => 'Link text for PCP.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Enabled?') , + 'description' => 'Is Personal Campaign Page Block enabled/active?', + 'default' => '1', + ) , + 'notify_email' => array( + 'name' => 'notify_email', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Notification Email') , + 'description' => 'If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'target_entity_type' => 'target_entity_type', + 'target_entity_id' => 'target_entity_id', + 'supporter_profile_id' => 'supporter_profile_id', + 'owner_notify_id' => 'owner_notify_id', + 'is_approval_needed' => 'is_approval_needed', + 'is_tellfriend_enabled' => 'is_tellfriend_enabled', + 'tellfriend_limit' => 'tellfriend_limit', + 'link_text' => 'link_text', + 'is_active' => 'is_active', + 'notify_email' => 'notify_email', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['pcp_block'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['pcp_block'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Pledge/DAO/Pledge.php b/CRM/Pledge/DAO/Pledge.php new file mode 100644 index 0000000000..432d5ef65a --- /dev/null +++ b/CRM/Pledge/DAO/Pledge.php @@ -0,0 +1,641 @@ +__table = 'civicrm_pledge'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_page_id', 'civicrm_contribution_page', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'pledge_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge ID') , + 'description' => 'Pledge ID', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_pledge.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_contact_id' => array( + 'name' => 'contact_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contact ID') , + 'description' => 'Foreign key to civicrm_contact.id .', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_pledge.contact_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'html' => array( + 'type' => 'EntityRef', + ) , + ) , + 'pledge_financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Type') , + 'description' => 'FK to Financial Type', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'pledge_contribution_page_id' => array( + 'name' => 'contribution_page_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge Contribution Page') , + 'description' => 'The Contribution Page which triggered this contribution', + 'FKClassName' => 'CRM_Contribute_DAO_ContributionPage', + ) , + 'pledge_amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Total Pledged') , + 'description' => 'Total pledged amount.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_pledge.amount', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'pledge_original_installment_amount' => array( + 'name' => 'original_installment_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Original Installment Amount') , + 'description' => 'Original amount for each of the installments.', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Pledge Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'pledge_frequency_unit' => array( + 'name' => 'frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Pledge Frequency Unit') , + 'description' => 'Time units for recurrence of pledge payments.', + 'maxlength' => 8, + 'size' => CRM_Utils_Type::EIGHT, + 'default' => 'month', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'recur_frequency_units', + 'keyColumn' => 'name', + 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', + ) + ) , + 'pledge_frequency_interval' => array( + 'name' => 'frequency_interval', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge Frequency Interval') , + 'description' => 'Number of time units for recurrence of pledge payments.', + 'required' => true, + 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'frequency_day' => array( + 'name' => 'frequency_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge day') , + 'description' => 'Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments.', + 'required' => true, + 'default' => '3', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'installments' => array( + 'name' => 'installments', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge Number of Installments') , + 'description' => 'Total number of payments to be made.', + 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'start_date' => array( + 'name' => 'start_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge Start Date') , + 'description' => 'The date the first scheduled pledge occurs.', + 'required' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'pledge_create_date' => array( + 'name' => 'create_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge Made') , + 'description' => 'When this pledge record was created.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_pledge.create_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'acknowledge_date' => array( + 'name' => 'acknowledge_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge Acknowledged') , + 'description' => 'When a pledge acknowledgement message was sent to the contributor.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'modified_date' => array( + 'name' => 'modified_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge Modified Date') , + 'description' => 'Last updated date for this pledge record.', + ) , + 'cancel_date' => array( + 'name' => 'cancel_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge Cancelled Date') , + 'description' => 'Date this pledge was cancelled by contributor.', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'end_date' => array( + 'name' => 'end_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Pledge End Date') , + 'description' => 'Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'max_reminders' => array( + 'name' => 'max_reminders', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum Number of Reminders') , + 'description' => 'The maximum number of payment reminders to send for any given payment.', + 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'initial_reminder_day' => array( + 'name' => 'initial_reminder_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Initial Reminder Day') , + 'description' => 'Send initial reminder this many days prior to the payment due date.', + 'default' => '5', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'additional_reminder_day' => array( + 'name' => 'additional_reminder_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Additional Reminder Days') , + 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.', + 'default' => '5', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'pledge_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge Status Id') , + 'description' => 'Implicit foreign key to civicrm_option_values in the contribution_status option group.', + 'import' => true, + 'where' => 'civicrm_pledge.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'pseudoconstant' => array( + 'optionGroupName' => 'contribution_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_status', + ) + ) , + 'pledge_is_test' => array( + 'name' => 'is_test', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Test') , + 'import' => true, + 'where' => 'civicrm_pledge.is_test', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'pledge_campaign_id' => array( + 'name' => 'campaign_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Campaign') , + 'description' => 'The campaign for which this pledge has been initiated.', + 'import' => true, + 'where' => 'civicrm_pledge.campaign_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Campaign_DAO_Campaign', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_campaign', + 'keyColumn' => 'id', + 'labelColumn' => 'title', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'pledge_id', + 'contact_id' => 'pledge_contact_id', + 'financial_type_id' => 'pledge_financial_type_id', + 'contribution_page_id' => 'pledge_contribution_page_id', + 'amount' => 'pledge_amount', + 'original_installment_amount' => 'pledge_original_installment_amount', + 'currency' => 'currency', + 'frequency_unit' => 'pledge_frequency_unit', + 'frequency_interval' => 'pledge_frequency_interval', + 'frequency_day' => 'frequency_day', + 'installments' => 'installments', + 'start_date' => 'start_date', + 'create_date' => 'pledge_create_date', + 'acknowledge_date' => 'acknowledge_date', + 'modified_date' => 'modified_date', + 'cancel_date' => 'cancel_date', + 'end_date' => 'end_date', + 'max_reminders' => 'max_reminders', + 'initial_reminder_day' => 'initial_reminder_day', + 'additional_reminder_day' => 'additional_reminder_day', + 'status_id' => 'pledge_status_id', + 'is_test' => 'pledge_is_test', + 'campaign_id' => 'pledge_campaign_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['pledge'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['pledge'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Pledge/DAO/PledgeBlock.php b/CRM/Pledge/DAO/PledgeBlock.php new file mode 100644 index 0000000000..64e1aa5bb0 --- /dev/null +++ b/CRM/Pledge/DAO/PledgeBlock.php @@ -0,0 +1,348 @@ +__table = 'civicrm_pledge_block'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge Block ID') , + 'description' => 'Pledge ID', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'physical tablename for entity being joined to pledge, e.g. civicrm_contact', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity Id') , + 'description' => 'FK to entity table specified in entity_table column.', + 'required' => true, + ) , + 'pledge_frequency_unit' => array( + 'name' => 'pledge_frequency_unit', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Pledge Frequency Unit') , + 'description' => 'Delimited list of supported frequency units', + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + ) , + 'is_pledge_interval' => array( + 'name' => 'is_pledge_interval', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Expose Frequency Interval?') , + 'description' => 'Is frequency interval exposed on the contribution form.', + ) , + 'max_reminders' => array( + 'name' => 'max_reminders', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Maximum Number of Reminders') , + 'description' => 'The maximum number of payment reminders to send for any given payment.', + 'default' => '1', + ) , + 'initial_reminder_day' => array( + 'name' => 'initial_reminder_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Initial Reminder Day') , + 'description' => 'Send initial reminder this many days prior to the payment due date.', + 'default' => '5', + ) , + 'additional_reminder_day' => array( + 'name' => 'additional_reminder_day', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Additional Reminder Days') , + 'description' => 'Send additional reminder this many days after last one sent, up to maximum number of reminders.', + 'default' => '5', + ) , + 'pledge_start_date' => array( + 'name' => 'pledge_start_date', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Pledge Start Date') , + 'description' => 'The date the first scheduled pledge occurs.', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'is_pledge_start_date_visible' => array( + 'name' => 'is_pledge_start_date_visible', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Show Recurring Donation Start Date?') , + 'description' => 'If true - recurring start date is shown.', + 'required' => true, + ) , + 'is_pledge_start_date_editable' => array( + 'name' => 'is_pledge_start_date_editable', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Allow Edits to Recurring Donation Start Date?') , + 'description' => 'If true - recurring start date is editable.', + 'required' => true, + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'pledge_frequency_unit' => 'pledge_frequency_unit', + 'is_pledge_interval' => 'is_pledge_interval', + 'max_reminders' => 'max_reminders', + 'initial_reminder_day' => 'initial_reminder_day', + 'additional_reminder_day' => 'additional_reminder_day', + 'pledge_start_date' => 'pledge_start_date', + 'is_pledge_start_date_visible' => 'is_pledge_start_date_visible', + 'is_pledge_start_date_editable' => 'is_pledge_start_date_editable', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['pledge_block'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['pledge_block'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Pledge/DAO/PledgePayment.php b/CRM/Pledge/DAO/PledgePayment.php new file mode 100644 index 0000000000..0211e40205 --- /dev/null +++ b/CRM/Pledge/DAO/PledgePayment.php @@ -0,0 +1,384 @@ +__table = 'civicrm_pledge_payment'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'pledge_id', 'civicrm_pledge', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'pledge_payment_id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment ID') , + 'required' => true, + 'import' => true, + 'where' => 'civicrm_pledge_payment.id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_id' => array( + 'name' => 'pledge_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Pledge') , + 'description' => 'FK to Pledge table', + 'required' => true, + 'FKClassName' => 'CRM_Pledge_DAO_Pledge', + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Contribution') , + 'description' => 'FK to contribution table.', + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + 'pledge_payment_scheduled_amount' => array( + 'name' => 'scheduled_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Scheduled Amount') , + 'description' => 'Pledged amount for this payment (the actual contribution amount might be different).', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_pledge_payment.scheduled_amount', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_payment_actual_amount' => array( + 'name' => 'actual_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Actual Amount') , + 'description' => 'Actual amount that is paid as the Pledged installment amount.', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_pledge_payment.actual_amount', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'currency' => array( + 'name' => 'currency', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Currency') , + 'description' => '3 character string, value from config setting or input via user.', + 'maxlength' => 3, + 'size' => CRM_Utils_Type::FOUR, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_currency', + 'keyColumn' => 'name', + 'labelColumn' => 'full_name', + 'nameColumn' => 'name', + ) + ) , + 'pledge_payment_scheduled_date' => array( + 'name' => 'scheduled_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Scheduled Date') , + 'description' => 'The date the pledge payment is supposed to happen.', + 'required' => true, + 'import' => true, + 'where' => 'civicrm_pledge_payment.scheduled_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_payment_reminder_date' => array( + 'name' => 'reminder_date', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Last Reminder') , + 'description' => 'The date that the most recent payment reminder was sent.', + 'import' => true, + 'where' => 'civicrm_pledge_payment.reminder_date', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_payment_reminder_count' => array( + 'name' => 'reminder_count', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Reminders Sent') , + 'description' => 'The number of payment reminders sent.', + 'import' => true, + 'where' => 'civicrm_pledge_payment.reminder_count', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'pledge_payment_status_id' => array( + 'name' => 'status_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Payment Status') , + 'import' => true, + 'where' => 'civicrm_pledge_payment.status_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => false, + 'pseudoconstant' => array( + 'optionGroupName' => 'contribution_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_status', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'pledge_payment_id', + 'pledge_id' => 'pledge_id', + 'contribution_id' => 'contribution_id', + 'scheduled_amount' => 'pledge_payment_scheduled_amount', + 'actual_amount' => 'pledge_payment_actual_amount', + 'currency' => 'currency', + 'scheduled_date' => 'pledge_payment_scheduled_date', + 'reminder_date' => 'pledge_payment_reminder_date', + 'reminder_count' => 'pledge_payment_reminder_count', + 'status_id' => 'pledge_payment_status_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['pledge_payment'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['pledge_payment'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Price/DAO/LineItem.php b/CRM/Price/DAO/LineItem.php new file mode 100644 index 0000000000..a89694f361 --- /dev/null +++ b/CRM/Price/DAO/LineItem.php @@ -0,0 +1,449 @@ +__table = 'civicrm_line_item'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contribution_id', 'civicrm_contribution', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_value_id', 'civicrm_price_field_value', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item ID') , + 'description' => 'Line Item', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Line Item Entity Type') , + 'description' => 'table which has the transaction', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item Entity') , + 'description' => 'entry in table', + 'required' => true, + ) , + 'contribution_id' => array( + 'name' => 'contribution_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item Contribution') , + 'description' => 'FK to civicrm_contribution', + 'FKClassName' => 'CRM_Contribute_DAO_Contribution', + ) , + 'price_field_id' => array( + 'name' => 'price_field_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item Price Field') , + 'description' => 'FK to civicrm_price_field', + 'FKClassName' => 'CRM_Price_DAO_PriceField', + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Line Item Label') , + 'description' => 'descriptive label for item - from price_field_value.label', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'qty' => array( + 'name' => 'qty', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Line Item Quantity') , + 'description' => 'How many items ordered', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'unit_price' => array( + 'name' => 'unit_price', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Unit Price') , + 'description' => 'price of each item', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'line_total' => array( + 'name' => 'line_total', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Line Item Total') , + 'description' => 'qty * unit_price', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + ) , + 'participant_count' => array( + 'name' => 'participant_count', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item Participant Count') , + 'description' => 'Participant count for field', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'price_field_value_id' => array( + 'name' => 'price_field_value_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Line Item Option') , + 'description' => 'FK to civicrm_price_field_value', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Price_DAO_PriceFieldValue', + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'deductible_amount' => array( + 'name' => 'deductible_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Deductible Amount') , + 'description' => 'Tax-deductible portion of the amount', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'default' => '0.0', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'tax_amount' => array( + 'name' => 'tax_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Tax Amount') , + 'description' => 'tax of each item', + 'precision' => array( + 20, + 2 + ) , + 'import' => true, + 'where' => 'civicrm_line_item.tax_amount', + 'headerPattern' => '/tax(.?am(ou)?nt)?/i', + 'dataPattern' => '/^\d+(\.\d{2})?$/', + 'export' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'contribution_id' => 'contribution_id', + 'price_field_id' => 'price_field_id', + 'label' => 'label', + 'qty' => 'qty', + 'unit_price' => 'unit_price', + 'line_total' => 'line_total', + 'participant_count' => 'participant_count', + 'price_field_value_id' => 'price_field_value_id', + 'financial_type_id' => 'financial_type_id', + 'deductible_amount' => 'deductible_amount', + 'tax_amount' => 'tax_amount', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['line_item'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['line_item'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Price/DAO/PriceField.php b/CRM/Price/DAO/PriceField.php new file mode 100644 index 0000000000..b7dcc7f8a4 --- /dev/null +++ b/CRM/Price/DAO/PriceField.php @@ -0,0 +1,489 @@ + 1) + * + * @var boolean + */ + public $is_required; + /** + * If non-zero, do not show this field before the date specified + * + * @var datetime + */ + public $active_on; + /** + * If non-zero, do not show this field after the date specified + * + * @var datetime + */ + public $expire_on; + /** + * Optional scripting attributes for field + * + * @var string + */ + public $javascript; + /** + * Implicit FK to civicrm_option_group with name = 'visibility' + * + * @var int unsigned + */ + public $visibility_id; + /** + * class constructor + * + * @return civicrm_price_field + */ + function __construct() { + $this->__table = 'civicrm_price_field'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Field ID') , + 'description' => 'Price Field', + 'required' => true, + ) , + 'price_set_id' => array( + 'name' => 'price_set_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Set') , + 'description' => 'FK to civicrm_price_set', + 'required' => true, + 'FKClassName' => 'CRM_Price_DAO_PriceSet', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Variable name/programmatic handle for this field.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label') , + 'description' => 'Text for form field label (also friendly name for administering this field).', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'html_type' => array( + 'name' => 'html_type', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Html Type') , + 'required' => true, + 'maxlength' => 12, + 'size' => CRM_Utils_Type::TWELVE, + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes', + ) + ) , + 'is_enter_qty' => array( + 'name' => 'is_enter_qty', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Field Quantity Required?') , + 'description' => 'Enter a quantity for this field?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Price Field Pre Text') , + 'description' => 'Description and/or help text to display before this field.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Price Field Post Text') , + 'description' => 'Description and/or help text to display after this field.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Order in which the fields should appear', + 'default' => '1', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'is_display_amounts' => array( + 'name' => 'is_display_amounts', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Field Show Amounts?') , + 'description' => 'Should the price be displayed next to the label for each option?', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'options_per_line' => array( + 'name' => 'options_per_line', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Field Options per Row') , + 'description' => 'number of options per line for checkbox and radio', + 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Field Is Active?') , + 'description' => 'Is this price field active', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_required' => array( + 'name' => 'is_required', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Field is Required?') , + 'description' => 'Is this price field required (value must be > 1)', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'active_on' => array( + 'name' => 'active_on', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Price Field Start Date') , + 'description' => 'If non-zero, do not show this field before the date specified', + 'default' => 'NULL', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'expire_on' => array( + 'name' => 'expire_on', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Price Field End Date') , + 'description' => 'If non-zero, do not show this field after the date specified', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'javascript' => array( + 'name' => 'javascript', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Price Field Javascript') , + 'description' => 'Optional scripting attributes for field', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'visibility_id' => array( + 'name' => 'visibility_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Field Visibility') , + 'description' => 'Implicit FK to civicrm_option_group with name = \'visibility\'', + 'default' => '1', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'optionGroupName' => 'visibility', + 'optionEditPath' => 'civicrm/admin/options/visibility', + ) + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'price_set_id' => 'price_set_id', + 'name' => 'name', + 'label' => 'label', + 'html_type' => 'html_type', + 'is_enter_qty' => 'is_enter_qty', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'weight' => 'weight', + 'is_display_amounts' => 'is_display_amounts', + 'options_per_line' => 'options_per_line', + 'is_active' => 'is_active', + 'is_required' => 'is_required', + 'active_on' => 'active_on', + 'expire_on' => 'expire_on', + 'javascript' => 'javascript', + 'visibility_id' => 'visibility_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['price_field'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['price_field'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Price/DAO/PriceFieldValue.php b/CRM/Price/DAO/PriceFieldValue.php new file mode 100644 index 0000000000..38014c3e8e --- /dev/null +++ b/CRM/Price/DAO/PriceFieldValue.php @@ -0,0 +1,496 @@ +Price field option description. + * + * @var text + */ + public $description; + /** + * Price field option pre help text. + * + * @var text + */ + public $help_pre; + /** + * Price field option post field help. + * + * @var text + */ + public $help_post; + /** + * Price field option amount + * + * @var string + */ + public $amount; + /** + * Number of participants per field option + * + * @var int unsigned + */ + public $count; + /** + * Max number of participants per field options + * + * @var int unsigned + */ + public $max_value; + /** + * Order in which the field options should appear + * + * @var int + */ + public $weight; + /** + * FK to Membership Type + * + * @var int unsigned + */ + public $membership_type_id; + /** + * Number of terms for this membership + * + * @var int unsigned + */ + public $membership_num_terms; + /** + * Is this default price field option + * + * @var boolean + */ + public $is_default; + /** + * Is this price field value active + * + * @var boolean + */ + public $is_active; + /** + * FK to Financial Type. + * + * @var int unsigned + */ + public $financial_type_id; + /** + * Tax-deductible portion of the amount + * + * @var float + */ + public $deductible_amount; + /** + * class constructor + * + * @return civicrm_price_field_value + */ + function __construct() { + $this->__table = 'civicrm_price_field_value'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_field_id', 'civicrm_price_field', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'membership_type_id', 'civicrm_membership_type', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Field Value ID') , + 'description' => 'Price Field Value', + 'required' => true, + ) , + 'price_field_id' => array( + 'name' => 'price_field_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Field') , + 'description' => 'FK to civicrm_price_field', + 'required' => true, + 'FKClassName' => 'CRM_Price_DAO_PriceField', + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Price field option name', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'label' => array( + 'name' => 'label', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Label') , + 'description' => 'Price field option label', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Description') , + 'description' => '>Price field option description.', + 'rows' => 2, + 'cols' => 60, + 'default' => 'NULL', + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Help Pre') , + 'description' => 'Price field option pre help text.', + 'rows' => 2, + 'cols' => 60, + 'default' => 'NULL', + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Help Post') , + 'description' => 'Price field option post field help.', + 'rows' => 2, + 'cols' => 60, + 'default' => 'NULL', + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'amount' => array( + 'name' => 'amount', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Amount') , + 'description' => 'Price field option amount', + 'required' => true, + 'maxlength' => 512, + 'size' => 8, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'count' => array( + 'name' => 'count', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Count') , + 'description' => 'Number of participants per field option', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'max_value' => array( + 'name' => 'max_value', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Max Value') , + 'description' => 'Max number of participants per field options', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'description' => 'Order in which the field options should appear', + 'default' => '1', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'membership_type_id' => array( + 'name' => 'membership_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Type') , + 'description' => 'FK to Membership Type', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Member_DAO_MembershipType', + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'membership_num_terms' => array( + 'name' => 'membership_num_terms', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Membership Num Terms') , + 'description' => 'Number of terms for this membership', + 'default' => 'NULL', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Default Price Field Option?') , + 'description' => 'Is this default price field option', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Field Value is Active') , + 'description' => 'Is this price field value active', + 'default' => '1', + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type.', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'deductible_amount' => array( + 'name' => 'deductible_amount', + 'type' => CRM_Utils_Type::T_MONEY, + 'title' => ts('Deductible Amount') , + 'description' => 'Tax-deductible portion of the amount', + 'required' => true, + 'precision' => array( + 20, + 2 + ) , + 'default' => '0.0', + 'html' => array( + 'type' => 'Text', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'price_field_id' => 'price_field_id', + 'name' => 'name', + 'label' => 'label', + 'description' => 'description', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'amount' => 'amount', + 'count' => 'count', + 'max_value' => 'max_value', + 'weight' => 'weight', + 'membership_type_id' => 'membership_type_id', + 'membership_num_terms' => 'membership_num_terms', + 'is_default' => 'is_default', + 'is_active' => 'is_active', + 'financial_type_id' => 'financial_type_id', + 'deductible_amount' => 'deductible_amount', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['price_field_value'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['price_field_value'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Price/DAO/PriceSet.php b/CRM/Price/DAO/PriceSet.php new file mode 100644 index 0000000000..27f5e89748 --- /dev/null +++ b/CRM/Price/DAO/PriceSet.php @@ -0,0 +1,417 @@ +__table = 'civicrm_price_set'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Set ID') , + 'description' => 'Price Set', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Set Domain') , + 'description' => 'Which Domain is this price-set for', + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'html' => array( + 'type' => 'Text', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Name') , + 'description' => 'Variable name/programmatic handle for this set of price fields.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Price Set Title') , + 'description' => 'Displayed title for the Price Set.', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Set Is Active?') , + 'description' => 'Is this price set active', + 'default' => '1', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'help_pre' => array( + 'name' => 'help_pre', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Price Set Pre Help') , + 'description' => 'Description and/or help text to display before fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'help_post' => array( + 'name' => 'help_post', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Price Set Post Help') , + 'description' => 'Description and/or help text to display after fields in form.', + 'rows' => 4, + 'cols' => 80, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'javascript' => array( + 'name' => 'javascript', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Price Set Javascript') , + 'description' => 'Optional Javascript script function(s) included on the form with this price_set. Can be used for conditional', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'extends' => array( + 'name' => 'extends', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Price Set Extends') , + 'description' => 'What components are using this price set?', + 'required' => true, + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_component', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'financial_type_id' => array( + 'name' => 'financial_type_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Financial Type') , + 'description' => 'FK to Financial Type(for membership price sets only).', + 'default' => 'NULL', + 'FKClassName' => 'CRM_Financial_DAO_FinancialType', + 'html' => array( + 'type' => 'Select', + ) , + 'pseudoconstant' => array( + 'table' => 'civicrm_financial_type', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'is_quick_config' => array( + 'name' => 'is_quick_config', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Is Price Set Quick Config?') , + 'description' => 'Is set if edited on Contribution or Event Page rather than through Manage Price Sets', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Price Set Is Reserved') , + 'description' => 'Is this a predefined system price set (i.e. it can not be deleted, edited)?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'name' => 'name', + 'title' => 'title', + 'is_active' => 'is_active', + 'help_pre' => 'help_pre', + 'help_post' => 'help_post', + 'javascript' => 'javascript', + 'extends' => 'extends', + 'financial_type_id' => 'financial_type_id', + 'is_quick_config' => 'is_quick_config', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return CRM_Core_DAO::getLocaleTableName(self::$_tableName); + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['price_set'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['price_set'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Price/DAO/PriceSetEntity.php b/CRM/Price/DAO/PriceSetEntity.php new file mode 100644 index 0000000000..9beb953b8b --- /dev/null +++ b/CRM/Price/DAO/PriceSetEntity.php @@ -0,0 +1,252 @@ +__table = 'civicrm_price_set_entity'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'price_set_id', 'civicrm_price_set', 'id'); + self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Set Entity ID') , + 'description' => 'Price Set Entity', + 'required' => true, + ) , + 'entity_table' => array( + 'name' => 'entity_table', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Entity Table') , + 'description' => 'Table which uses this price set', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'entity_id' => array( + 'name' => 'entity_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Entity IF') , + 'description' => 'Item in table', + 'required' => true, + ) , + 'price_set_id' => array( + 'name' => 'price_set_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Price Set') , + 'description' => 'price set being used', + 'required' => true, + 'FKClassName' => 'CRM_Price_DAO_PriceSet', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'entity_table' => 'entity_table', + 'entity_id' => 'entity_id', + 'price_set_id' => 'price_set_id', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['price_set_entity'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['price_set_entity'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Queue/DAO/QueueItem.php b/CRM/Queue/DAO/QueueItem.php new file mode 100644 index 0000000000..c373ebb52f --- /dev/null +++ b/CRM/Queue/DAO/QueueItem.php @@ -0,0 +1,271 @@ +__table = 'civicrm_queue_item'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Queue ID') , + 'required' => true, + ) , + 'queue_name' => array( + 'name' => 'queue_name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Queue Name') , + 'description' => 'Name of the queue which includes this item', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'weight' => array( + 'name' => 'weight', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Order') , + 'required' => true, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'submit_time' => array( + 'name' => 'submit_time', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Submit Time') , + 'description' => 'date on which this item was submitted to the queue', + 'required' => true, + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'release_time' => array( + 'name' => 'release_time', + 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, + 'title' => ts('Release Time') , + 'description' => 'date on which this job becomes available; null if ASAP', + 'html' => array( + 'type' => 'Select Date', + ) , + ) , + 'data' => array( + 'name' => 'data', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Queue item datas') , + 'description' => 'Serialized queue', + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'queue_name' => 'queue_name', + 'weight' => 'weight', + 'submit_time' => 'submit_time', + 'release_time' => 'release_time', + 'data' => 'data', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['queue_item'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['queue_item'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/Report/DAO/ReportInstance.php b/CRM/Report/DAO/ReportInstance.php new file mode 100644 index 0000000000..ad928535e5 --- /dev/null +++ b/CRM/Report/DAO/ReportInstance.php @@ -0,0 +1,557 @@ +__table = 'civicrm_report_instance'; + parent::__construct(); + } + /** + * Returns foreign keys and entity references + * + * @return array + * [CRM_Core_Reference_Interface] + */ + static function getReferenceColumns() { + if (!self::$_links) { + self::$_links = static ::createReferenceColumns(__CLASS__); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'owner_id', 'civicrm_contact', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'navigation_id', 'civicrm_navigation', 'id'); + self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'drilldown_id', 'civicrm_report_instance', 'id'); + } + return self::$_links; + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Report Instance ID') , + 'description' => 'Report Instance ID', + 'required' => true, + ) , + 'domain_id' => array( + 'name' => 'domain_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Report Instance Domain ID') , + 'description' => 'Which Domain is this instance for', + 'required' => true, + 'FKClassName' => 'CRM_Core_DAO_Domain', + 'pseudoconstant' => array( + 'table' => 'civicrm_domain', + 'keyColumn' => 'id', + 'labelColumn' => 'name', + ) + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance Title') , + 'description' => 'Report Instance Title.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'report_id' => array( + 'name' => 'report_id', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report template ID') , + 'description' => 'FK to civicrm_option_value for the report template', + 'required' => true, + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report instance Name') , + 'description' => 'when combined with report_id/template uniquely identifies the instance', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'args' => array( + 'name' => 'args', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance Arguments') , + 'description' => 'arguments that are passed in the url when invoking the instance', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'description' => array( + 'name' => 'description', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance description') , + 'description' => 'Report Instance description.', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'permission' => array( + 'name' => 'permission', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance Permissions') , + 'description' => 'permission required to be able to run this instance', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'grouprole' => array( + 'name' => 'grouprole', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance Assigned to Roles') , + 'description' => 'role required to be able to run this instance', + 'maxlength' => 1024, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'form_values' => array( + 'name' => 'form_values', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Submitted Form Values') , + 'description' => 'Submitted form values for this report', + 'import' => true, + 'where' => 'civicrm_report_instance.form_values', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Report Instance is Active') , + 'description' => 'Is this entry active?', + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'created_id' => array( + 'name' => 'created_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Report Instance Created By') , + 'description' => 'FK to contact table.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'owner_id' => array( + 'name' => 'owner_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Report Instance Owned By') , + 'description' => 'FK to contact table.', + 'FKClassName' => 'CRM_Contact_DAO_Contact', + ) , + 'email_subject' => array( + 'name' => 'email_subject', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('Report Instance email Subject') , + 'description' => 'Subject of email', + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'email_to' => array( + 'name' => 'email_to', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Email Report Instance To') , + 'description' => 'comma-separated list of email addresses to send the report to', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'email_cc' => array( + 'name' => 'email_cc', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('cc Email Report Instance To') , + 'description' => 'comma-separated list of email addresses to send the report to', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'header' => array( + 'name' => 'header', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Report Instance Header') , + 'description' => 'comma-separated list of email addresses to send the report to', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'footer' => array( + 'name' => 'footer', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Report Instance Footer') , + 'description' => 'comma-separated list of email addresses to send the report to', + 'rows' => 4, + 'cols' => 60, + 'html' => array( + 'type' => 'TextArea', + ) , + ) , + 'navigation_id' => array( + 'name' => 'navigation_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Navigation ID') , + 'description' => 'FK to navigation ID', + 'import' => true, + 'where' => 'civicrm_report_instance.navigation_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Core_DAO_Navigation', + ) , + 'drilldown_id' => array( + 'name' => 'drilldown_id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Drilldown Report ID') , + 'description' => 'FK to instance ID drilldown to', + 'import' => true, + 'where' => 'civicrm_report_instance.drilldown_id', + 'headerPattern' => '', + 'dataPattern' => '', + 'export' => true, + 'FKClassName' => 'CRM_Report_DAO_ReportInstance', + ) , + 'is_reserved' => array( + 'name' => 'is_reserved', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('Instance is Reserved') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'domain_id' => 'domain_id', + 'title' => 'title', + 'report_id' => 'report_id', + 'name' => 'name', + 'args' => 'args', + 'description' => 'description', + 'permission' => 'permission', + 'grouprole' => 'grouprole', + 'form_values' => 'form_values', + 'is_active' => 'is_active', + 'created_id' => 'created_id', + 'owner_id' => 'owner_id', + 'email_subject' => 'email_subject', + 'email_to' => 'email_to', + 'email_cc' => 'email_cc', + 'header' => 'header', + 'footer' => 'footer', + 'navigation_id' => 'navigation_id', + 'drilldown_id' => 'drilldown_id', + 'is_reserved' => 'is_reserved', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['report_instance'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['report_instance'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} diff --git a/CRM/SMS/DAO/Provider.php b/CRM/SMS/DAO/Provider.php new file mode 100644 index 0000000000..14e79ef35c --- /dev/null +++ b/CRM/SMS/DAO/Provider.php @@ -0,0 +1,335 @@ +__table = 'civicrm_sms_provider'; + parent::__construct(); + } + /** + * Returns all the column names of this table + * + * @return array + */ + static function &fields() { + if (!(self::$_fields)) { + self::$_fields = array( + 'id' => array( + 'name' => 'id', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('SMS Provider ID') , + 'description' => 'SMS Provider ID', + 'required' => true, + ) , + 'name' => array( + 'name' => 'name', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SMS Provider Name') , + 'description' => 'Provider internal name points to option_value of option_group sms_provider_name', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + ) , + 'title' => array( + 'name' => 'title', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SMS Provider Title') , + 'description' => 'Provider name visible to user', + 'maxlength' => 64, + 'size' => CRM_Utils_Type::BIG, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'username' => array( + 'name' => 'username', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SMS Provider Username') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'password' => array( + 'name' => 'password', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SMS Provider Password') , + 'maxlength' => 255, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'api_type' => array( + 'name' => 'api_type', + 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('SMS Provider API') , + 'description' => 'points to value in civicrm_option_value for group sms_api_type', + 'required' => true, + 'html' => array( + 'type' => 'Select', + ) , + ) , + 'api_url' => array( + 'name' => 'api_url', + 'type' => CRM_Utils_Type::T_STRING, + 'title' => ts('SMS Provider API URL') , + 'maxlength' => 128, + 'size' => CRM_Utils_Type::HUGE, + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'api_params' => array( + 'name' => 'api_params', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('SMS Provider API Params') , + 'description' => 'the api params in xml, http or smtp format', + 'html' => array( + 'type' => 'Text', + ) , + ) , + 'is_default' => array( + 'name' => 'is_default', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('SMS Provider is Default?') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + 'is_active' => array( + 'name' => 'is_active', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'title' => ts('SMS Provider is Active?') , + 'html' => array( + 'type' => 'CheckBox', + ) , + ) , + ); + } + return self::$_fields; + } + /** + * Returns an array containing, for each field, the arary key used for that + * field in self::$_fields. + * + * @return array + */ + static function &fieldKeys() { + if (!(self::$_fieldKeys)) { + self::$_fieldKeys = array( + 'id' => 'id', + 'name' => 'name', + 'title' => 'title', + 'username' => 'username', + 'password' => 'password', + 'api_type' => 'api_type', + 'api_url' => 'api_url', + 'api_params' => 'api_params', + 'is_default' => 'is_default', + 'is_active' => 'is_active', + ); + } + return self::$_fieldKeys; + } + /** + * Returns the names of this table + * + * @return string + */ + static function getTableName() { + return self::$_tableName; + } + /** + * Returns if this table needs to be logged + * + * @return boolean + */ + function getLog() { + return self::$_log; + } + /** + * Returns the list of fields that can be imported + * + * @param bool $prefix + * + * @return array + */ + static function &import($prefix = false) { + if (!(self::$_import)) { + self::$_import = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('import', $field)) { + if ($prefix) { + self::$_import['sms_provider'] = & $fields[$name]; + } else { + self::$_import[$name] = & $fields[$name]; + } + } + } + } + return self::$_import; + } + /** + * Returns the list of fields that can be exported + * + * @param bool $prefix + * + * @return array + */ + static function &export($prefix = false) { + if (!(self::$_export)) { + self::$_export = array(); + $fields = self::fields(); + foreach($fields as $name => $field) { + if (CRM_Utils_Array::value('export', $field)) { + if ($prefix) { + self::$_export['sms_provider'] = & $fields[$name]; + } else { + self::$_export[$name] = & $fields[$name]; + } + } + } + } + return self::$_export; + } +} -- 2.25.1