🔖 Version 1.0.0-beta
This commit is contained in:
parent
c93a06972b
commit
460a811554
26 changed files with 2480 additions and 771 deletions
|
@ -25,6 +25,12 @@ class CRM_Mailinglistsync_Form_MailingListSettings extends CRM_Core_Form {
|
|||
label: E::ts('Enable logging of synchronization'),
|
||||
extra: ['class' => 'huge'],
|
||||
);
|
||||
$this->add(
|
||||
'text',
|
||||
E::SHORT_NAME . '_domain',
|
||||
label: E::ts('Domain for mailing list email addresses'),
|
||||
extra: ['class' => 'huge'],
|
||||
);
|
||||
$this->add(
|
||||
'text',
|
||||
E::SHORT_NAME . '_mlmmj_host',
|
||||
|
|
|
@ -32,7 +32,7 @@ class CRM_Mailinglistsync_Upgrader extends \CRM_Extension_Upgrader_Base {
|
|||
// $this->ctx->log->info(E::ts('Created %1 LocationType', [1 => $location['name']]));
|
||||
}
|
||||
catch (\CRM_Core_Exception $e) {
|
||||
if ($e->getMessage() == 'DB Error: already exists') {
|
||||
if ($e->getMessage() === 'DB Error: already exists') {
|
||||
// $this->ctx->log->info(E::ts('LocationType %1 already exists', [1 => $location['name']]));
|
||||
continue;
|
||||
}
|
||||
|
@ -40,6 +40,28 @@ class CRM_Mailinglistsync_Upgrader extends \CRM_Extension_Upgrader_Base {
|
|||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
// Create activity types
|
||||
$activityTypes = require_once E::path() . '/resources/activity_types.php';
|
||||
foreach ($activityTypes as $activity) {
|
||||
try {
|
||||
\Civi\Api4\OptionValue::create(FALSE)
|
||||
->addValue('option_group_id.name', 'activity_type')
|
||||
->addValue('label', $activity['label'])
|
||||
->addValue('name', $activity['name'])
|
||||
->addValue('description', $activity['description'])
|
||||
->execute();
|
||||
// $this->ctx->log->info(E::ts('Created %1 ActivityType', [1 => $activity['name']]));
|
||||
}
|
||||
catch (\CRM_Core_Exception $e) {
|
||||
if ($e->getMessage() === 'DB Error: already exists') {
|
||||
// $this->ctx->log->info(E::ts('ActivityType %1 already exists', [1 => $activity['name']]));
|
||||
continue;
|
||||
}
|
||||
// $this->ctx->log->err(E::ts('Failed to create %1 ActivityType', [1 => $activity['name']]));
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,6 +106,16 @@ class CRM_Mailinglistsync_Upgrader extends \CRM_Extension_Upgrader_Base {
|
|||
->execute();
|
||||
// $this->ctx->log->info(E::ts('Enabled %1 CustomGroup', [1 => $customGroup]));
|
||||
}
|
||||
|
||||
// Create scheduled job
|
||||
\Civi\Api4\Job::create(FALSE)
|
||||
->addValue('run_frequency', 'Hourly')
|
||||
->addValue('name', 'Mlmmjsync')
|
||||
->addValue('api_entity', 'Mailinglistsync')
|
||||
->addValue('api_action', 'Mlmmjsync')
|
||||
->addValue('description', E::ts('Runs the synchronization between CiviCRM and mlmmj.'))
|
||||
->addValue('is_active', TRUE)
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,6 +132,11 @@ class CRM_Mailinglistsync_Upgrader extends \CRM_Extension_Upgrader_Base {
|
|||
->execute();
|
||||
// $this->ctx->log->info(E::ts('Disabled %1 CustomGroup', [1 => $customGroup]));
|
||||
}
|
||||
|
||||
// Delete scheduled job
|
||||
\Civi\Api4\Job::delete(FALSE)
|
||||
->addWhere('name', '=', 'Mlmmjsync')
|
||||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,12 +145,10 @@ class CRM_Mailinglistsync_Upgrader extends \CRM_Extension_Upgrader_Base {
|
|||
* @return TRUE on success
|
||||
* @throws CRM_Core_Exception
|
||||
*/
|
||||
// public function upgrade_4200(): bool {
|
||||
// $this->ctx->log->info('Applying update 4200');
|
||||
// CRM_Core_DAO::executeQuery('UPDATE foo SET bar = "whiz"');
|
||||
// CRM_Core_DAO::executeQuery('DELETE FROM bang WHERE willy = wonka(2)');
|
||||
// return TRUE;
|
||||
// }
|
||||
public function upgrade_4200(): bool {
|
||||
$this->install();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: Run an external SQL script.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue