Skip to content

Instantly share code, notes, and snippets.

View mickadoo's full-sized avatar
💭
Making bugs

Michael Devery mickadoo

💭
Making bugs
  • Ireland
View GitHub Profile
@mickadoo
mickadoo / Upgrader.php
Last active October 15, 2018 10:10
Upgrader methods for implementing upgrader steps as classes
<?php
class CRM_MyExtension_Upgrader extends CRM_MyExtension_Upgrader_Base {
/**
* @inheritdoc
*/
public function hasPendingRevisions() {
$revisions = $this->getRevisions();
$currentRevisionNum = $this->getCurrentRevision();
@mickadoo
mickadoo / webform_logging.php
Created August 29, 2018 13:02
Overview of how to log webform
<?php
// Inside civihr_employee_portal.module..
// this will enable logging before data is saved
function civihr_employee_portal_webform_submission_presave($node, &$submission) {
// todo restrict to certain nodes
$logger = Civi::container()->get(ApiChangelogWrapper::class);
$logger->setIsActive(TRUE);
}

Overview

compudeploy creates, deploys and updates CiviCRM websites

Requirements

  • The creation command should take a single repository URL
  • The host for the site should be flexible: local host, local vagrant, local docker, remote host, AWS
  • The type of site should be flexible: a profile or a "full site" repository
@mickadoo
mickadoo / upgrader_spec.md
Created June 21, 2018 15:11
Upgraders Spec
function upgrade_174() {
  $this->runAllClassesInDirectory('Upgrade_174');
}
class Upgrade_174_SetDrupalVariable implements UpgraderInterface {
 
 public function upgrade() {
@mickadoo
mickadoo / template-variables.md
Last active May 14, 2018 15:37
Options for having global template variables

Write a smarty modifier to check permission

✔️ flexible solution that can be used for any future permission
❌ the modifier format is confusing, most people would probably expect a function call instead

{if 'access CiviCRM'|permissionCheck }
  <!-- Do something -->
{/if}
@mickadoo
mickadoo / is_reserved_meaning.md
Last active March 29, 2018 11:10
Discussion on the current meaning of `is_reserved` and `is_locked` in CiviCRM. Suggestions for improvements.

DAO Definitions

These definitions are from the docblock comment on the DAO properties. A quick search for public $is_reserved showed 10 entities with this property, but I will focus on these three for now.

Option Group
  • is_reserved: Is this a predefined system option group (i.e. it can not be deleted)?
  • is_locked: A lock to remove the ability to add new options via the UI.
Option Value
@mickadoo
mickadoo / configurability_changes.md
Last active February 22, 2018 15:26
Configurability Changes

1) Lock custom groups

Overview

Some custom groups are required by CiviHR and should not be editable.

Acceptance Criteria

The following custom groups do not appear on the civicrm/admin/custom/group page:

<?php
interface FabricatorInterface {
/**
* @param array $params
*
* @return array
*/
public function fabricate($params = []);
{
"siteUrl": "compucorp.civihrhosting.co.uk",
"siteName": "Compucorp",
"lastLoginByRole": {
"civihr_staff": "2012-04-23T18:25:43+0000",
"civihr_manager": "2012-04-23T18:25:43+0000",
"civihr_admin": "2012-04-23T18:25:43+0000",
"civihr_local_admin": "2012-04-23T18:25:43+0000",
"administrator": "2012-04-23T18:25:43+0000",
"custom_role": "2012-04-23T18:25:43+0000",

Scenario 1:

  • Created user account but no email sent
  • Come back and send the email

RESULT: Welcome email received, login sucessful

Scenario 2:

  • Created user account and email sent