/** * Make sure all the data structures are there when the module is enabled */ public function enable() { // create snapshot database tables $this->executeSqlFile('sql/donrec.sql', true); // create/update custom groups CRM_Donrec_DataStructure::update(); // rename the custom fields according to l10. // FIXME: this is a workaround: if you do this before, the table name change, // BUT we should not be working with static table names CRM_Donrec_DataStructure::translateCustomGroups(); // make sure the template is there CRM_Donrec_Logic_Template::getDefaultTemplateID(); }
/** * get all eligable(?) templates * * @return array */ public static function getAllTemplates() { $relevant_templates = array(); $all_templates = civicrm_api3('MessageTemplate', 'get', array('is_active' => 1, 'option.limit' => 9999)); foreach ($all_templates['values'] as $template) { // TODO: filter? $relevant_templates[$template['id']] = $template['msg_title']; } // add default, if not yet in there $default_template_id = CRM_Donrec_Logic_Template::getDefaultTemplateID(); if (!empty($default_template_id) && empty($relevant_templates[$default_template_id])) { $default_template = civicrm_api3('MessageTemplate', 'getsingle', array('id' => $default_template_id)); $relevant_templates[$default_template_id] = $default_template['msg_title']; } return $relevant_templates; }
/** * create a default profile data */ public static function defaultProfileData() { return array('financial_types' => self::getAllDeductibleFinancialTypes(), 'store_original_pdf' => FALSE, 'template' => CRM_Donrec_Logic_Template::getDefaultTemplateID(), 'draft_text' => ts('DRAFT', array('domain' => 'de.systopia.donrec')), 'copy_text' => ts('COPY', array('domain' => 'de.systopia.donrec')), 'id_pattern' => '{issue_year}-{serial}', 'legal_address' => array('0'), 'postal_address' => array('0'), 'legal_address_fallback' => array('0'), 'postal_address_fallback' => array('0')); }