CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Packaging extensions/customizations
Pages: [1]

Author Topic: Packaging extensions/customizations  (Read 803 times)

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Packaging extensions/customizations
August 13, 2009, 03:27:18 pm
I have written some customizations for CiviCRM that I would like to work equally well for Joomla, Drupal or Stand-alone installations of CiviCRM.

BUT distributing/installing my stuff is a hassle. For each
installation I have to:
1) Create the appropriate folders ( e.g.  /custom_civicrm_code/CRM/Contact/Form/...)
2) In the "CiviCRM » Administer CiviCRM » Global Settings" area, set up
"Custom Templates" and "Custom PHP Path Directory" properly.
3) upload my php and tpl files into the custom code directory and custom
template folder structures
4)  Create the needed custom fields and custom relationship types (
Which need to be spelled perfectly or my custom searches break. )
5) Upload my custom search PHP files
6) Register the new custom searches

Plus I now worry about something breaking in a new version of CiviCRM.

Would like ideas to minimize these headaches.

One idea I had to address number 4:  Whenever a new custom field or custom relationship type is created, provide an "advanced" area that would allow me to assign a logical ID of my choosing.   Then when I am writing a custom search/CiviReport, I can use the logical ID to retrieve the actual table name and column name I need for my SQL statement.

Right now if I don't know ahead of time the actual table name and field name for the custom field I need, I run these preliminary queries to get the correct info:
 SELECT civicrm_custom_group.table_name as tablename from civicrm_custom_group
 where title = '$custom_field_group_label' and extends = 'Individual'

SELECT civicrm_custom_field.column_name as column_name, civicrm_custom_field.label as label
FROM  civicrm_custom_group left join civicrm_custom_field
 on civicrm_custom_group.id = civicrm_custom_field.custom_group_id
 where civicrm_custom_group.title = '$custom_field_group_label'
 and civicrm_custom_group.extends = 'Individual'
 and ( civicrm_custom_field.label = '$custom_field_birthdate_sunset_label' or
 civicrm_custom_field.label = '$custom_field_deathdate_sunset_label' )

Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Packaging extensions/customizations
August 13, 2009, 06:13:24 pm

1. In a future 3.x/4.x release we hope to make packaging and release of custom searches / custom reports and payment processors significantly easier. i.e. make them all self contained and within one directory

2. to migrate custom groups across civicrm instances, you might want to use the scripts in bin/migrate

3. isnt the group_label and field_label serve the same purpose as a Logical ID? In my client code, i use constants and always refer to the values via the constants to make future change easier

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SarahG (FountainTribe)

  • Ask me questions
  • ****
  • Posts: 782
  • Karma: 29
  • CiviCRM version: 4.4.7
  • CMS version: Drupal 6, Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Packaging extensions/customizations
August 13, 2009, 06:40:20 pm
 regarding point number 3- I already have constants for  group_label and field_label for the custom fields that I use in custom searches. But those labels are visible to the end-user in many places. A end-user in different databases could make different choices for the labels. The moment the user changes the label, my search breaks. Also if users in different installations of CiviCRM make different choices for the labels, I have to have slightly different custom searches for each.

Did I help you? Please donate to the Civi-Make-It-Happen campaign  CiviCRM for mobile devices! 

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Packaging extensions/customizations

This forum was archived on 2017-11-26.