RENEW = 32768,
DETACH = 65536,
REVERT = 131072,
- CLOSE = 262144,
- REOPEN = 524288,
+ CLOSE = 262144,
+ REOPEN = 524288,
MAX_ACTION = 1048575;
//make sure MAX_ACTION = 2^n - 1 ( n = total number of actions )
}
}
-
$mainLinks = $url;
if ($enclosedAllInSingleUL) {
$allLinks = '';
while ($actionSchedule->fetch()) {
$extraSelect = $extraJoin = $extraWhere = $extraOn = '';
- if ($actionSchedule->from_email)
+ if ($actionSchedule->from_email) {
$fromEmailAddress = "$actionSchedule->from_name <$actionSchedule->from_email>";
+ }
- $activityTypeID = false;
- $activityStatusID = false;
+ $activityTypeID = FALSE;
+ $activityStatusID = FALSE;
if ($actionSchedule->record_activity) {
if ($mapping->entity == 'civicrm_membership') {
$activityTypeID =
elseif ($field == 'registration_url') {
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $dao->event_id, TRUE, NULL, FALSE);
}
- elseif (in_array($field, array('start_date','end_date','join_date','activity_date_time'))) {
+ elseif (in_array($field, array('start_date', 'end_date', 'join_date', 'activity_date_time'))) {
$entityTokenParams["{$tokenEntity}." . $field] = CRM_Utils_Date::customFormat($dao->$field);
}
elseif ($field == 'balance') {
);
$status = implode(',', $status);
- $anniversary = false;
+ $anniversary = FALSE;
if (!CRM_Utils_System::isNull($mapping->entity_recipient)) {
if ($mapping->entity_recipient == 'event_contacts') {
$notINClause = self::permissionedRelationships($contactField);
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus(NULL, "(is_current_member = 1 OR name = 'Expired')", 'id');
- $mStatus = implode (',', $membershipStatus);
+ $mStatus = implode(',', $membershipStatus);
$where[] = "e.status_id IN ({$mStatus})";
}
if (in_array(2, $status_)) {
// anniversary mode:
$dateField = 'DATE_ADD(e.' . $dateDBField . ', INTERVAL ROUND(DATEDIFF(DATE(' . $now . '), e.' . $dateDBField . ') / 365) YEAR)';
- $anniversary = true;
+ $anniversary = TRUE;
}
else {
// regular mode:
if ($addWhere) {
$addWhereClause = "AND {$addWhere}";
}
- $insertAdditionalSql ="
+ $insertAdditionalSql = "
INSERT INTO civicrm_action_log (contact_id, entity_id, entity_table, action_schedule_id)
{$addSelect}
FROM ({$contactTable})
if (!empty($excludeIds)) {
$clause = "AND {$field} NOT IN ( " .implode(', ', $excludeIds) . ' ) ';
- return $clause;
+ return $clause;
}
return NULL;
}
if ($count > 1) {
foreach (array(
'state', 'state_name', 'country', 'world_region') as $fld) {
- if (isset($address->$fld))unset($address->$fld);
+ if (isset($address->$fld)) { unset($address->$fld);
+ }
}
}
$stree = $address->street_address;
if ($count > 2) {
break;
}
- if(count($first_names) == 1){
- $family = $first_names[current(array_keys($first_names))]['addressee_display'];
- }
- else {
- // collapse the tree to summarize
- $family = trim(implode(" & ", array_keys($first_names)) . " " . $last_name);
- }
- if ($count) {
- $processedNames .= "\n" . $family;
- }
- else {
- // build display_name string
- $processedNames = $family;
- }
+ if(count($first_names) == 1){
+ $family = $first_names[current(array_keys($first_names))]['addressee_display'];
+ }
+ else {
+ // collapse the tree to summarize
+ $family = trim(implode(" & ", array_keys($first_names)) . " " . $last_name);
+ }
+ if ($count) {
+ $processedNames .= "\n" . $family;
+ }
+ else {
+ // build display_name string
+ $processedNames = $family;
+ }
$count++;
}
$rows[$data['ID']]['addressee'] = $rows[$data['ID']]['addressee_display'] = $rows[$data['ID']]['display_name'] = $processedNames;
$params['condition'] = 'country_id IN (' . implode(',', (array) $props['country_id']) . ')';
}
break;
+
// Filter country list based on site defaults
case 'country_id':
if ($context != 'get' && $context != 'validate') {
}
}
break;
+
// Filter county list based on chosen state
case 'county_id':
if (!empty($props['state_province_id'])) {
$params['condition'] = 'state_province_id IN (' . implode(',', (array) $props['state_province_id']) . ')';
}
break;
+
// Not a real field in this entity
case 'world_region':
return CRM_Core_PseudoConstant::worldRegion();
- break;
+
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
uasort($locations, 'self::primaryComparison');
}
-/**
- * compare 2 locations to see which should go first based on is_primary
- * (sort function for sortPrimaryFirst)
- * @param array $location1
- * @param array $location2
- * @return number
- */
+ /**
+ * compare 2 locations to see which should go first based on is_primary
+ * (sort function for sortPrimaryFirst)
+ * @param array $location1
+ * @param array $location2
+ * @return number
+ */
public static function primaryComparison($location1, $location2){
$l1 = CRM_Utils_Array::value('is_primary', $location1);
$l2 = CRM_Utils_Array::value('is_primary', $location2);
/**
* Check if a cms user already exists.
*
- * @param Array $contact
+ * @param array $contactArray of contact-details.
* Array of contact-details.
*
* @return uid if user exists, false otherwise
public static function storeSessionToCache($names, $resetSession = TRUE) {
foreach ($names as $key => $sessionName) {
if (is_array($sessionName)) {
- $value = null;
+ $value = NULL;
if (!empty($_SESSION[$sessionName[0]][$sessionName[1]])) {
$value = $_SESSION[$sessionName[0]][$sessionName[1]];
}
self::setItem($value, 'CiviCRM Session', "{$sessionName[0]}_{$sessionName[1]}");
- if ($resetSession) {
- $_SESSION[$sessionName[0]][$sessionName[1]] = NULL;
- unset($_SESSION[$sessionName[0]][$sessionName[1]]);
- }
+ if ($resetSession) {
+ $_SESSION[$sessionName[0]][$sessionName[1]] = NULL;
+ unset($_SESSION[$sessionName[0]][$sessionName[1]]);
}
+ }
else {
- $value = null;
+ $value = NULL;
if (!empty($_SESSION[$sessionName])) {
$value = $_SESSION[$sessionName];
}
self::setItem($value, 'CiviCRM Session', $sessionName);
- if ($resetSession) {
- $_SESSION[$sessionName] = NULL;
- unset($_SESSION[$sessionName]);
- }
+ if ($resetSession) {
+ $_SESSION[$sessionName] = NULL;
+ unset($_SESSION[$sessionName]);
}
}
+ }
self::cleanup();
}
* @return void
* @static
*/
- public static function cleanup($session = false, $table = false, $prevNext = false) {
+ public static function cleanup($session = FALSE, $table = FALSE, $prevNext = FALSE) {
// clean up the session cache every $cacheCleanUpNumber probabilistically
$cleanUpNumber = 757;
$timeIntervalMins = 30;
if (mt_rand(1, 100000) % $cleanUpNumber == 0) {
- $session = $table = $prevNext = true;
+ $session = $table = $prevNext = TRUE;
}
if ( ! $session && ! $table && ! $prevNext ) {
*
* @param int $id
* Id of the database record.
- * @param boolean $is_active
+ * @param bool $is_activeValue we want to set the is_active field.
* Value we want to set the is_active field.
*
* @return Object DAO object on sucess, null otherwise
case 'Group':
$tableName = 'civicrm_group';
break;
+
// DRAFTING: Verify if we cannot make it pluggable
case 'Activity':
case 'Grant':
$tableName = 'civicrm_grant';
break;
+
// need to add cases for Location, Address
}
}
}
-
if (!isset($groupTree[$groupID]['fields'][$fieldId]['customValue'])) {
// field exists in db so populate value from "form".
$groupTree[$groupID]['fields'][$fieldId]['customValue'] = array();
$retValue = $value;
break;
}
- // note that if its not text / textarea, the code falls thru and executes
- // the below case also
+ // note that if its not text / textarea, the code falls thru and executes
+ // the below case also
case 'StateProvince':
case 'Country':
$options = array();
}
list($className) = explode('::', $callback);
- require_once(str_replace('_', DIRECTORY_SEPARATOR, $className) .
- '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $className) .
+ '.php';
$objTypes[$ovValues['value']] = call_user_func_array($callback, $args);
}
*
* @param int $fieldID
* Field whose options are needed.
- * @param boolean $inactiveNeeded
+ * @param bool $inactiveNeededDo we need inactive options ?.
* Do we need inactive options ?.
*
* @return array $customOption all active options for fieldId
$query = "
UPDATE {$dao->tableName}
SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
- $queryParams = array(1 => array($oldString, 'String'),
+ $queryParams = array(
+ 1 => array($oldString, 'String'),
2 => array($newString, 'String'),
);
break;
case 'IS EMPTY':
$op = 'IS NULL';
break;
+
case 'IS NOT EMPTY':
$op = 'IS NOT NULL';
break;
case 'Int':
return 'int';
+
// the below three are FK's, and have constraints added to them
case 'ContactReference':
if ($formatMultiRecordField) {
if($file[$tableName][$fieldID] == 'File') {
if($fileid = $dao->$fieldName) {
- $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
+ $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName, $entityID);
$result["{$dao->id}"]["{$fieldID}"] = $fileurl[$dao->$fieldName];
}
}
else {
if($file[$tableName][$fieldID] == 'File') {
if($fileid = $dao->$fieldName) {
- $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName,$entityID);
+ $fileurl = CRM_Core_BAO_File::paperIconAttachment($tableName, $entityID);
$result[$fieldID] = $fileurl[$dao->$fieldName];
}
}
case 'Country':
case 'Money':
case 'Float':
- $fieldValue['value'] = (int)0;
+ $fieldValue['value'] = (int) 0;
break;
}
}
* @return void
* @static
*/
- public static function saveDashletChanges($columns, $contactID=NULL) {
+ public static function saveDashletChanges($columns, $contactID = NULL) {
$session = CRM_Core_Session::singleton();
if (!$contactID) {
$contactID = $session->get('userID');
* @return void
* @static
*/
- public static function resetDashletCache($contactID = null) {
- $whereClause = null;
+ public static function resetDashletCache($contactID = NULL) {
+ $whereClause = NULL;
$params = array();
if ($contactID) {
$whereClause = "WHERE contact_id = %1";
* @return boolean
* @static
*/
- public static function del($entityId,$entityTable) {
+ public static function del($entityId, $entityTable) {
// delete all discount records with the selected discounted id
$discount = new CRM_Core_DAO_Discount( );
$discount->entity_id = $entityId;
* Determine whether the given table/id
* has discount associated with it
*
- * @param integer $entityId
+ * @param int $entityIdEntity id to be searched.
* Entity id to be searched.
* @param string $entityTable
* Entity table to be searched.
* @return null|object CRM_Core_BAO_Domain
* @static
*/
- public static function &getDomain($reset = null) {
+ public static function &getDomain($reset = NULL) {
static $domain = NULL;
if (!$domain || $reset) {
$domain = new CRM_Core_BAO_Domain();
return $domain;
}
- /**
- * Change active domain (ie. to perform a temporary action) such as changing
- * config for all domains
- *
- * Switching around the global domain variable is very risky business. This
- * is ONLY used as a hack to allow CRM_Core_BAO_Setting::setItems to manipulate
- * the civicrm_domain.config_backend in multiple domains. When/if config_backend
- * goes away, this hack should be removed.
- *
- * @param int $domainID
- * Id for domain you want to set as current.
- * @deprecated
- * @see http://issues.civicrm.org/jira/browse/CRM-11204
- */
+ /**
+ * Change active domain (ie. to perform a temporary action) such as changing
+ * config for all domains
+ *
+ * Switching around the global domain variable is very risky business. This
+ * is ONLY used as a hack to allow CRM_Core_BAO_Setting::setItems to manipulate
+ * the civicrm_domain.config_backend in multiple domains. When/if config_backend
+ * goes away, this hack should be removed.
+ *
+ * @param int $domainID
+ * Id for domain you want to set as current.
+ * @deprecated
+ * @see http://issues.civicrm.org/jira/browse/CRM-11204
+ */
public static function setDomain($domainID) {
CRM_Core_Config::domainID($domainID);
self::getDomain($domainID);
* @see CRM_Core_BAO_Domain::setDomain
*/
public static function resetDomain() {
- CRM_Core_Config::domainID(null, true);
- self::getDomain(null, true);
+ CRM_Core_Config::domainID(NULL, TRUE);
+ self::getDomain(NULL, TRUE);
CRM_Core_Config::singleton(TRUE, TRUE);
}
*
* @return null|string
*/
- public static function version($skipUsingCache = false) {
+ public static function version($skipUsingCache = FALSE) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
CRM_Core_Config::domainID(),
'version',
*/
public function &getLocationValues() {
if ($this->_location == NULL) {
- $domain = self::getDomain(null);
+ $domain = self::getDomain(NULL);
$params = array(
'contact_id' => $domain->contact_id
);
CRM_Core_Config::domainID(), 'name'
);
$groupID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group',
- $title, 'id', 'title', true
+ $title, 'id', 'title', TRUE
);
if (empty($groupID) && !empty($title)) {
$groupParams = array(
SET is_bulkmail = 0
WHERE contact_id = {$params['contact_id']}
";
- if($hook == 'edit'){
- $sql .= " AND id <> {$params['id']}";
- }
+ if($hook == 'edit'){
+ $sql .= " AND id <> {$params['id']}";
+ }
CRM_Core_DAO::executeQuery($sql);
}
$entityId = $entityElements['entity_id'];
$entityTable = $entityElements['entity_table'];
-
$sql = " SELECT email, ltype.name as locationType, e.is_primary as is_primary, e.on_hold as on_hold,e.id as email_id, e.location_type_id as locationTypeId
FROM civicrm_loc_block loc, civicrm_email e, civicrm_location_type ltype, {$entityTable} ev
WHERE ev.id = %1
* Name of the entity table usually 'civicrm_contact'.
*
* @return array(
- ) reference $tag array of category id's the contact belongs to.
+ ) reference $tag array of category id's the contact belongs to.
*
* @static
*/
* Merge two tags: tag B into tag A.
*/
public function mergeTags($tagAId, $tagBId) {
- $queryParams = array(1 => array($tagBId, 'Integer'),
+ $queryParams = array(
+ 1 => array($tagBId, 'Integer'),
2 => array($tagAId, 'Integer'),
);
*/
public static function getTagsUsedFor($usedFor = array('civicrm_contact'),
$buildSelect = TRUE,
- $all = FALSE,
- $parentId = NULL
+ $all = FALSE,
+ $parentId = NULL
) {
$tags = array();
*/
static function getTags($usedFor = 'civicrm_contact',
&$tags = array(),
- $parentId = NULL,
+ $parentId = NULL,
$separator = ' ',
$formatSelectable = FALSE
) {
// if we modify parent tag, then we need to update all children
if ($tag->parent_id === 'null') {
CRM_Core_DAO::executeQuery("UPDATE civicrm_tag SET used_for=%1 WHERE parent_id = %2",
- array(1 => array($params['used_for'], 'String'),
+ array(
+ 1 => array($params['used_for'], 'String'),
2 => array($tag->id, 'Integer'),
)
);
*
* TODO Why is this function in this class? It seems to be about the UFGroup.
*/
- public static function calculateProfileType($ufGroupType, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType= FALSE) {
+ public static function calculateProfileType($ufGroupType, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
// profile types
$contactTypes = array('Contact', 'Individual', 'Household', 'Organization');
$subTypes = CRM_Contact_BAO_ContactType::subTypes();
list($prefixName, $index) = CRM_Utils_System::explode('-', $key, 2);
$profileFields = civicrm_api3('uf_field', 'get', array_merge($profileFilter,
- array('is_active' => 1, 'return' => 'field_name, is_required', 'options' => array(
+ array(
+ 'is_active' => 1,
+ 'return' => 'field_name, is_required',
+ 'options' => array(
'limit' => 0,
))
));
'postal_code',
'country'
);
- $requiredBillingFields = array_diff($validBillingFields, array('middle_name','supplemental_address_1'));
+ $requiredBillingFields = array_diff($validBillingFields, array('middle_name', 'supplemental_address_1'));
$validProfileFields = array();
$requiredProfileFields = array();
elseif (array_key_exists($type, $validSubTypes)) {
$cType = CRM_Utils_Array::value('parent', $validSubTypes[$type]);
}
- if ($cType)
+ if ($cType) {
break;
+ }
}
return $cType;
if ($considerSelector) {
// drop the fields not meant for the selector
foreach ($subset as $name => $field) {
- if (!$field['in_selector']) unset($subset[$name]);
+ if (!$field['in_selector']) { unset($subset[$name]);
+ }
}
}
$fields = array_merge($fields, $subset);
// Create a unique, non-empty index for each field.
$index = $field['title'];
- if ($index === '') $index = ' ';
+ if ($index === '') { $index = ' ';
+ }
while (array_key_exists($index, $values)) {
$index .= ' ';
}
$p[2] = array($moduleName, 'String');
}
-
// add permissioning for profiles only if not registration
if (!$skipPermission) {
$permissionClause = CRM_Core_Permission::ufGroupClause($op, 'civicrm_uf_group.');
$data['location'][$loc]['email'][$loc]['email'] = $primaryEmail;
}
-
return $data;
}
* Uf id.
*
* return array $ufValues uf values.
- **
+ * *
*
* @return array
*/
* @return WordReplacement array
*/
public static function create($params) {
- if(array_key_exists("domain_id",$params) === FALSE) {
+ if(array_key_exists("domain_id", $params) === FALSE) {
$params["domain_id"] = CRM_Core_Config::domainID();
}
$wordReplacement = new CRM_Core_DAO_WordReplacement();
$overrides = array();
while ($dao->fetch()) {
- if ($dao->is_active==1) {
+ if ($dao->is_active == 1) {
$overrides['enabled'][$dao->match_type][$dao->find_word] = $dao->replace_word;
}
else {
$wordMatchArray = array();
// Traverse Language array
foreach ($localeCustomArray as $localCustomData) {
- // Traverse status array "enabled" "disabled"
+ // Traverse status array "enabled" "disabled"
foreach ($localCustomData as $status => $matchTypes) {
- $params["is_active"] = ($status == "enabled")?TRUE:FALSE;
+ $params["is_active"] = ($status == "enabled") ? TRUE : FALSE;
// Traverse Match Type array "wildcardMatch" "exactMatch"
foreach ($matchTypes as $matchType => $words) {
$params["match_type"] = $matchType;
/**
* Constructor
*/
- public function __construct() {}
+ public function __construct() {
+ }
}
* Class constructor
*
*/
- public function __construct() {}
+ public function __construct() {
+ }
/**
* Initialises the $_properties array
case self::ADD:
$defaultLocation = CRM_Core_BAO_LocationType::getDefault();
$defaultPrimaryLocationId = $defaultLocation->id;
- $values = array('postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'),
+ $values = array(
+ 'postURL' => CRM_Utils_System::url('civicrm/contact/add', 'reset=1&ct=Individual'),
'primaryLocationType' => $defaultPrimaryLocationId,
);
);
break;
- case self::LANGSWITCH:
+ case self::LANGSWITCH:
// gives the currentPath without trailing empty lcMessages to be completed
$values = array('queryString' => CRM_Utils_System::getLinksUrl('lcMessages', TRUE, FALSE, FALSE));
self::setProperty(self::LANGSWITCH, 'templateValues', $values);
break;
+
case self::FULLTEXT_SEARCH:
$urlArray = array(
'fullTextSearchID' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue',
// new email (select recipients)
$shortCuts = array_merge($shortCuts, array(
- array('path' => 'civicrm/activity/email/add',
+ array(
+ 'path' => 'civicrm/activity/email/add',
'query' => 'atype=3&action=add&reset=1&context=standalone',
'ref' => 'new-email',
'title' => ts('Email'),
if (CRM_Core_Permission::check('edit groups')) {
$shortCuts = array_merge($shortCuts, array(
- array('path' => 'civicrm/group/add',
+ array(
+ 'path' => 'civicrm/group/add',
'query' => 'reset=1',
'ref' => 'new-group',
'title' => ts('Group'),
if (CRM_Core_Permission::check('administer CiviCRM')) {
$shortCuts = array_merge($shortCuts, array(
- array('path' => 'civicrm/admin/tag',
+ array(
+ 'path' => 'civicrm/admin/tag',
'query' => 'reset=1&action=add',
'ref' => 'new-tag',
'title' => ts('Tag'),
static $dashboardLinks = array();
if (CRM_Core_Permission::check('access Contact Dashboard')) {
$dashboardLinks = array(
- array('path' => 'civicrm/user',
+ array(
+ 'path' => 'civicrm/user',
'query' => 'reset=1',
'title' => ts('My Contact Dashboard'),
));
if (!($shortCuts)) {
$shortCuts = array(
- array('path' => 'civicrm/mailing/send',
+ array(
+ 'path' => 'civicrm/mailing/send',
'query' => 'reset=1',
'title' => ts('Send Mailing'),
),
// do nothing
}
// require 'access CiviCRM' permissons, except for the language switch block
- elseif (!CRM_Core_Permission::check('access CiviCRM') && $id!=self::LANGSWITCH) {
+ elseif (!CRM_Core_Permission::check('access CiviCRM') && $id != self::LANGSWITCH) {
return NULL;
}
elseif ($id == self::ADD) {
self::getProperty($id, 'templateValues')
);
-
return $block;
}
// "require_once" is nice because it's simple and throws
// intelligible errors. The down side is that autoloaders
// down the chain cannot try to find the file if we fail.
- require_once ($file);
+ require_once $file;
}
}
}
switch ($cms) {
case 'drupal':
$candidates[] = "../drupal/civicrm.config.php.drupal";
- $candidates[] = "../../drupal/civicrm.config.php.drupal";
+ $candidates[] = "../../drupal/civicrm.config.php.drupal";
break;
+
case 'wordpress':
$candidates[] = "../../civicrm.config.php.wordpress";
$candidates[] = "../WordPress/civicrm.config.php.wordpress";
for ($i = 0; $i < count($matches[0]); $i++) {
$langs[$matches[1][$i]] = $matches[2][$i];
}
- file_put_contents('../install/langs.php', "<?php \$langs = " . var_export($langs, true) . ";");
+ file_put_contents('../install/langs.php', "<?php \$langs = " . var_export($langs, TRUE) . ";");
}
public function generateSchemaStructure() {
$this->tables = $this->orderTables($this->tables);
// add archive tables here
- $archiveTables = array( );
+ $archiveTables = array();
foreach ($this->tables as $name => $table ) {
if ( $table['archive'] == 'true' ) {
$name = 'archive_' . $table['name'];
$field['rows'] = isset($fieldXML->html) ? $this->value('rows', $fieldXML->html) : NULL;
$field['cols'] = isset($fieldXML->html) ? $this->value('cols', $fieldXML->html) : NULL;
break;
- break;
+
+ break;
case 'datetime':
$field['sqlType'] = $field['phpType'] = $type;
/** need to make sure there is a field of type name */
if (!array_key_exists($name, $fields)) {
- echo "primary key $name in $table->name does not have a field definition, ignoring\n";
+ echo "primary key $name in $table->name does not have a field definition, ignoring\n";
return;
}
$index = array();
// empty index name is fine
- $indexName = trim((string)$indexXML->name);
+ $indexName = trim((string) $indexXML->name);
$index['name'] = $indexName;
$index['field'] = array();
// populate fields
foreach ($indexXML->fieldName as $v) {
- $fieldName = (string)($v);
- $length = (string)($v['length']);
+ $fieldName = (string) ($v);
+ $length = (string) ($v['length']);
if (strlen($length) > 0) {
$fieldName = "$fieldName($length)";
}
/** need to make sure there is a field of type name */
if (!array_key_exists($name, $fields)) {
- echo "foreign $name in $currentTableName does not have a field definition, ignoring\n";
+ echo "foreign $name in $currentTableName does not have a field definition, ignoring\n";
return;
}
$cr->find(FALSE);
while ($cr->fetch()) {
$infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS;
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
$infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id);
if ($infoObject->info['name'] !== $cr->name) {
CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name}).");
$infoFile = $crmFolderDir . "/{$subDir}/" . self::COMPONENT_INFO_CLASS . '.php';
if (file_exists($infoFile)) {
$infoClass = 'CRM_' . $subDir . '_' . self::COMPONENT_INFO_CLASS;
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php';
$infoObject = new $infoClass(NULL, NULL, NULL);
$components[$infoObject->info['name']] = $infoObject;
unset($infoObject);
*/
private function _instantiate($cl) {
$className = $this->namespace . '_' . $cl;
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
return new $className();
}
}
$this->geocodeMethod = 'CRM_Utils_Geocode_' . $this->mapProvider;
}
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $this->userFrameworkClass) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $this->userFrameworkClass) . '.php';
$class = $this->userFrameworkClass;
// redundant with _setUserFrameworkConfig
$this->userSystem = new $class();
while running upgrade, to avoid any serious non-recoverable error
which might hinder the upgrade process. */
-
$args = array();
if (isset($_GET[$config->userFrameworkURLVar])) {
$args = explode('/', $_GET[$config->userFrameworkURLVar]);
* Name of session if we want unique scope, used only by Controller_Simple.
* @param bool $addSequence
* Should we add a unique sequence number to the end of the key.
- * @param bool $ignoreKey
+ * @param bool $ignoreKey
* Should we not set a qfKey for this controller (for standalone forms).
*
* @internal param bool $whether controller is modal
}
}
- // if the request has a reset value, initialize the controller session
+ // if the request has a reset value, initialize the controller session
if (!empty($_GET['reset'])) {
$this->reset();
// and created the scope etc
$this->set('qfKey', $this->_key);
-
// also retrieve and store destination in session
$this->_destination = CRM_Utils_Request::retrieve(
'civicrmDestination',
$ext = CRM_Extension_System::singleton()->getMapper();
if ($ext->isExtensionClass($className)) {
- require_once ($ext->classToPath($className));
+ require_once $ext->classToPath($className);
}
else {
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
}
$$stateName = new $className($stateMachine->find($className), $action, 'post', $formName);
if ($title) {
*
* @return void
*/
- public function process() {}
+ public function process() {
+ }
/**
* Store the variable with the value in the form scope
* The value to append.
* @param bool $merge
*/
- public function append($tpl_var, $value=NULL, $merge=FALSE) {
+ public function append($tpl_var, $value = NULL, $merge = FALSE) {
self::$_template->append($tpl_var, $value, $merge);
}
*
* @return array
*/
- public function get_template_vars($name=null) {
+ public function get_template_vars($name = NULL) {
return self::$_template->get_template_vars($name);
}
function __construct(
$path,
$title,
- $mode = NULL,
- $imageUpload = FALSE,
- $addSequence = FALSE,
- $ignoreKey = FALSE,
+ $mode = NULL,
+ $imageUpload = FALSE,
+ $addSequence = FALSE,
+ $ignoreKey = FALSE,
$attachUpload = FALSE
) {
// by definition a single page is modal :). We use the form name as the scope for this controller
$mode = $savedAction;
}
-
$this->_stateMachine->addSequentialPages($params, $mode);
$this->addPages($this->_stateMachine, $mode);
* @return object
* @static
*/
- public static function &singleton($package = NULL, $msgCallback = FALSE, $contextCallback = FALSE, $throwPEAR_Error = FALSE, $stackClass = 'PEAR_ErrorStack') {
+ public static function &singleton($package = NULL, $msgCallback = FALSE, $contextCallback = FALSE, $throwPEAR_Error = FALSE, $stackClass = 'PEAR_ErrorStack') {
if (self::$_singleton === NULL) {
self::$_singleton = new CRM_Core_Error('CiviCRM');
}
$details = 'A fatal error was triggered';
if ($message) {
$details .= ': ' . $message;
- }
+ }
throw new Exception($details, $code);
}
static function debug_var($variable_name,
$variable,
$print = TRUE,
- $log = TRUE,
- $comp = ''
+ $log = TRUE,
+ $comp = ''
) {
// check if variable is set
if (!isset($variable)) {
public static function debug_query($string) {
if ( defined( 'CIVICRM_DEBUG_LOG_QUERY' ) ) {
if ( CIVICRM_DEBUG_LOG_QUERY == 'backtrace' ) {
- CRM_Core_Error::backtrace( $string, true );
+ CRM_Core_Error::backtrace( $string, TRUE );
} else if ( CIVICRM_DEBUG_LOG_QUERY ) {
- CRM_Core_Error::debug_var( 'Query', $string, false, true );
+ CRM_Core_Error::debug_var( 'Query', $string, FALSE, TRUE );
}
}
}
$dao = CRM_Core_DAO::executeQuery($query);
$results = array();
while ($dao->fetch()) {
- $results[] = (array)$dao;
+ $results[] = (array) $dao;
}
CRM_Core_Error::debug_var('dao result', array('query' => $query, 'results' => $results));
}
foreach (self::parseBacktrace($backTrace, $showArgs, $maxArgLen) as $idx => $trace) {
$message .= sprintf("#%s %s\n", $idx, $trace);
}
- $message .= sprintf("#%s {main}\n", 1+$idx);
+ $message .= sprintf("#%s {main}\n", 1 + $idx);
return $message;
}
case 'boolean':
$args[] = $arg ? 'TRUE' : 'FALSE';
break;
+
case 'integer':
case 'double':
$args[] = $arg;
break;
+
case 'string':
$args[] = '"' . CRM_Utils_String::ellipsify(addcslashes((string) $arg, "\r\n\t\""), $maxArgLen). '"';
break;
+
case 'array':
$args[] = '(Array:'.count($arg).')';
break;
+
case 'object':
$args[] = 'Object(' . get_class($arg) . ')';
break;
+
case 'resource':
$args[] = 'Resource';
break;
+
case 'NULL':
$args[] = 'NULL';
break;
+
default:
$args[] = "($type)";
break;
$msg .= '<tbody>';
foreach (array('Type', 'Code', 'Message', 'Mode', 'UserInfo', 'DebugInfo') as $f) {
$msg .= sprintf('<tr><td>%s</td><td>%s</td></tr>', $f, call_user_func(array($ei->getCause(), "get$f")));
- }
+ }
$msg .= '</tbody></table>';
- }
+ }
$ei = $ei->getCause();
- }
+ }
$msg .= $e->toHtml();
} else {
$msg .= '<p><b>' . get_class($e) . ': "' . htmlentities($e->getMessage()) . '"</b></p>';
* @param array $errorData
* @param null $previous
*/
- public function __construct($message, $error_code = 0, $errorData = array(), $previous = null) {
+ public function __construct($message, $error_code = 0, $errorData = array(), $previous = NULL) {
parent::__construct(ts($message));
$this->errorData = $errorData + array('error_code' => $error_code);
}
* $Id$
*
*/
-Class CRM_Core_Form_Date {
+class CRM_Core_Form_Date {
/**
* Various Date Formats
array('class' => 'crm-select2')
);
- $form->addDateRange($fieldName, $from, $to, $fromLabel, $dateFormat, FALSE, $displayTime);
+ $form->addDateRange($fieldName, $from, $to, $fromLabel, $dateFormat, FALSE, $displayTime);
}
}
-<?php\r
-/*\r
- +--------------------------------------------------------------------+\r
- | CiviCRM version 4.6 |\r
- +--------------------------------------------------------------------+\r
- | Copyright CiviCRM LLC (c) 2004-2014 |\r
- +--------------------------------------------------------------------+\r
- | This file is a part of CiviCRM. |\r
- | |\r
- | CiviCRM is free software; you can copy, modify, and distribute it |\r
- | under the terms of the GNU Affero General Public License |\r
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |\r
- | |\r
- | CiviCRM is distributed in the hope that it will be useful, but |\r
- | WITHOUT ANY WARRANTY; without even the implied warranty of |\r
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |\r
- | See the GNU Affero General Public License for more details. |\r
- | |\r
- | You should have received a copy of the GNU Affero General Public |\r
- | License and the CiviCRM Licensing Exception along |\r
- | with this program; if not, contact CiviCRM LLC |\r
- | at info[AT]civicrm[DOT]org. If you have questions about the |\r
- | GNU Affero General Public License or the licensing of CiviCRM, |\r
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |\r
- +--------------------------------------------------------------------+\r
-*/\r
-\r
-/**\r
- *\r
- *\r
- * @package CRM\r
- * @copyright CiviCRM LLC (c) 2004-2014\r
- * $Id$\r
- *\r
- */\r
-/**\r
- * This class generates form components for processing Entity\r
- *\r
- */\r
-class CRM_Core_Form_RecurringEntity {\r
- /**\r
- * Current entity id\r
- */\r
- protected static $_entityId = NULL;\r
-\r
- /**\r
- * Schedule Reminder ID\r
- */\r
- protected static $_scheduleReminderID = NULL;\r
-\r
- /**\r
- * Schedule Reminder data\r
- */\r
- protected static $_scheduleReminderDetails = array();\r
-\r
- /**\r
- * Parent Entity ID\r
- */\r
- protected static $_parentEntityId = NULL;\r
-\r
- /**\r
- * Exclude date information\r
- */\r
- public static $_excludeDateInfo = array();\r
-\r
- /**\r
- * Entity Table\r
- */\r
- public static $_entityTable;\r
-\r
- /**\r
- * Checks current entityID has parent\r
- */\r
- public static $_hasParent = FALSE;\r
-\r
- public static function preProcess($entityTable) {\r
- self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');\r
- self::$_entityTable = $entityTable;\r
-\r
- if (self::$_entityId && $entityTable) {\r
- $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, $entityTable);\r
- if ($checkParentExistsForThisId) {\r
- self::$_hasParent = TRUE;\r
- self::$_parentEntityId = $checkParentExistsForThisId;\r
- self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityTable);\r
- }\r
- else {\r
- self::$_parentEntityId = self::$_entityId;\r
- self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId(self::$_entityId, $entityTable);\r
- }\r
- if (property_exists(self::$_scheduleReminderDetails, 'id')) {\r
- self::$_scheduleReminderID = self::$_scheduleReminderDetails->id;\r
- }\r
- }\r
- if ($entityTable) {\r
- CRM_Core_OptionValue::getValues(array('name' => $entityTable.'_repeat_exclude_dates_'.self::$_parentEntityId), $optionValue);\r
- $excludeOptionValues = array();\r
- if (!empty($optionValue)) {\r
- foreach($optionValue as $key => $val) {\r
- $excludeOptionValues[$val['value']] = date('m/d/Y', strtotime($val['value']));\r
- }\r
- self::$_excludeDateInfo = $excludeOptionValues;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Set default values for the form. For edit/view mode\r
- * the default values are retrieved from the database\r
- *\r
- *\r
- * @return None\r
- */\r
- public static function setDefaultValues() {\r
- $defaults = array();\r
- if (self::$_scheduleReminderID) {\r
- $defaults['repetition_frequency_unit'] = self::$_scheduleReminderDetails->repetition_frequency_unit;\r
- $defaults['repetition_frequency_interval'] = self::$_scheduleReminderDetails->repetition_frequency_interval;\r
- $defaults['start_action_condition'] = array_flip(explode(",",self::$_scheduleReminderDetails->start_action_condition));\r
- foreach($defaults['start_action_condition'] as $key => $val) {\r
- $val = 1;\r
- $defaults['start_action_condition'][$key] = $val;\r
- }\r
- $defaults['start_action_offset'] = self::$_scheduleReminderDetails->start_action_offset;\r
- if (self::$_scheduleReminderDetails->start_action_offset) {\r
- $defaults['ends'] = 1;\r
- }\r
- list($defaults['repeat_absolute_date']) = CRM_Utils_Date::setDateDefaults(self::$_scheduleReminderDetails->absolute_date);\r
- if (self::$_scheduleReminderDetails->absolute_date) {\r
- $defaults['ends'] = 2;\r
- }\r
- $defaults['limit_to'] = self::$_scheduleReminderDetails->limit_to;\r
- if (self::$_scheduleReminderDetails->limit_to) {\r
- $defaults['repeats_by'] = 1;\r
- }\r
- $explodeStartActionCondition = array();\r
- if (self::$_scheduleReminderDetails->entity_status) {\r
- $explodeStartActionCondition = explode(" ", self::$_scheduleReminderDetails->entity_status);\r
- $defaults['entity_status_1'] = $explodeStartActionCondition[0];\r
- $defaults['entity_status_2'] = $explodeStartActionCondition[1];\r
- }\r
- if (self::$_scheduleReminderDetails->entity_status) {\r
- $defaults['repeats_by'] = 2;\r
- }\r
- }\r
- return $defaults;\r
- }\r
-\r
- public static function buildQuickForm(&$form) {\r
- if (self::$_entityTable) {\r
- $entityType = explode("_", self::$_entityTable);\r
- if ($entityType[1]) {\r
- $form->assign('entityType', ucwords($entityType[1]));\r
- }\r
- }\r
- $form->assign('currentEntityId', self::$_entityId);\r
- $form->assign('entityTable', self::$_entityTable);\r
- $form->assign('scheduleReminderId', self::$_scheduleReminderID);\r
- $form->assign('hasParent', self::$_hasParent);\r
-\r
- $form->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');\r
- foreach ($form->_freqUnits as $val => $label) {\r
- if ($label == "day") {\r
- $label = "dai";\r
- }\r
- $freqUnitsDisplay[$val] = ts('%1ly', array(1 => $label));\r
- }\r
- // echo "<pre>";print_r($freqUnitsDisplay);\r
- $dayOfTheWeek = array('monday' => 'Monday',\r
- 'tuesday' => 'Tuesday',\r
- 'wednesday' => 'Wednesday',\r
- 'thursday' => 'Thursday',\r
- 'friday' => 'Friday',\r
- 'saturday' => 'Saturday',\r
- 'sunday' => 'Sunday'\r
- );\r
- $form->add('select', 'repetition_frequency_unit', ts('Repeats:'), $freqUnitsDisplay);\r
- $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);\r
- $form->add('select', 'repetition_frequency_interval', ts('Repeats every:'), $numericOptions, '', array('style' => 'width:55px;'));\r
- $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));\r
- foreach($dayOfTheWeek as $key => $val) {\r
- $startActionCondition[] = $form->createElement('checkbox', $key, NULL, substr($val." ", 0, 3));\r
- }\r
- $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));\r
- $roptionTypes = array('1' => ts('day of the month'),\r
- '2' => ts('day of the week'),\r
- );\r
- $form->addRadio('repeats_by', ts("Repeats By:"), $roptionTypes, array(), NULL);\r
- $getMonths = CRM_Core_SelectValues::getNumericOptions(1, 31);\r
- $form->add('select', 'limit_to', '', $getMonths, FALSE, array('style' => 'width:55px;'));\r
- $dayOfTheWeekNo = array('first' => 'First',\r
- 'second'=> 'Second',\r
- 'third' => 'Third',\r
- 'fourth'=> 'Fourth',\r
- 'last' => 'Last'\r
- );\r
- $form->add('select', 'entity_status_1', ts(''), $dayOfTheWeekNo);\r
- $form->add('select', 'entity_status_2', ts(''), $dayOfTheWeek);\r
- $eoptionTypes = array('1' => ts('After'),\r
- '2' => ts('On'),\r
- );\r
- $form->addRadio('ends', ts("Ends:"), $eoptionTypes, array(), NULL);\r
- $form->add('text', 'start_action_offset', ts(''), array('size' => 3, 'maxlength' => 2));\r
- $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));\r
- $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));\r
- $form->addDate('exclude_date', ts('Exclude Date(s)'), FALSE);\r
- $select = $form->add('select', 'exclude_date_list', ts(''), self::$_excludeDateInfo, FALSE, array('style' => 'width:150px;', 'size' => 4));\r
- $select->setMultiple(TRUE);\r
- $form->addElement('button','add_to_exclude_list','>>','onClick="addToExcludeList(document.getElementById(\'exclude_date\').value);"');\r
- $form->addElement('button','remove_from_exclude_list', '<<', 'onClick="removeFromExcludeList(\'exclude_date_list\')"');\r
- $form->addElement('hidden', 'copyExcludeDates', '', array('id' => 'copyExcludeDates'));\r
- $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));\r
- $form->addButtons(array(\r
- array(\r
- 'type' => 'submit',\r
- 'name' => ts('Save'),\r
- 'isDefault' => TRUE,\r
- ),\r
- array(\r
- 'type' => 'cancel',\r
- 'name' => ts('Cancel')\r
- ),\r
- )\r
- );\r
- }\r
-\r
- /**\r
- * Global validation rules for the form\r
- *\r
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6 |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM. |
+ | |
+ | CiviCRM is free software; you can copy, modify, and distribute it |
+ | under the terms of the GNU Affero General Public License |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
+ | |
+ | CiviCRM is distributed in the hope that it will be useful, but |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
+ | See the GNU Affero General Public License for more details. |
+ | |
+ | You should have received a copy of the GNU Affero General Public |
+ | License and the CiviCRM Licensing Exception along |
+ | with this program; if not, contact CiviCRM LLC |
+ | at info[AT]civicrm[DOT]org. If you have questions about the |
+ | GNU Affero General Public License or the licensing of CiviCRM, |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+*/
+
+/**
+ *
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2014
+ * $Id$
+ *
+ */
+/**
+ * This class generates form components for processing Entity
+ *
+ */
+class CRM_Core_Form_RecurringEntity {
+ /**
+ * Current entity id
+ */
+ protected static $_entityId = NULL;
+
+ /**
+ * Schedule Reminder ID
+ */
+ protected static $_scheduleReminderID = NULL;
+
+ /**
+ * Schedule Reminder data
+ */
+ protected static $_scheduleReminderDetails = array();
+
+ /**
+ * Parent Entity ID
+ */
+ protected static $_parentEntityId = NULL;
+
+ /**
+ * Exclude date information
+ */
+ public static $_excludeDateInfo = array();
+
+ /**
+ * Entity Table
+ */
+ public static $_entityTable;
+
+ /**
+ * Checks current entityID has parent
+ */
+ public static $_hasParent = FALSE;
+
+ public static function preProcess($entityTable) {
+ self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');
+ self::$_entityTable = $entityTable;
+
+ if (self::$_entityId && $entityTable) {
+ $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, $entityTable);
+ if ($checkParentExistsForThisId) {
+ self::$_hasParent = TRUE;
+ self::$_parentEntityId = $checkParentExistsForThisId;
+ self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityTable);
+ }
+ else {
+ self::$_parentEntityId = self::$_entityId;
+ self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId(self::$_entityId, $entityTable);
+ }
+ if (property_exists(self::$_scheduleReminderDetails, 'id')) {
+ self::$_scheduleReminderID = self::$_scheduleReminderDetails->id;
+ }
+ }
+ if ($entityTable) {
+ CRM_Core_OptionValue::getValues(array('name' => $entityTable.'_repeat_exclude_dates_'.self::$_parentEntityId), $optionValue);
+ $excludeOptionValues = array();
+ if (!empty($optionValue)) {
+ foreach($optionValue as $key => $val) {
+ $excludeOptionValues[$val['value']] = date('m/d/Y', strtotime($val['value']));
+ }
+ self::$_excludeDateInfo = $excludeOptionValues;
+ }
+ }
+ }
+
+ /**
+ * Set default values for the form. For edit/view mode
+ * the default values are retrieved from the database
+ *
+ *
+ * @return None
+ */
+ public static function setDefaultValues() {
+ $defaults = array();
+ if (self::$_scheduleReminderID) {
+ $defaults['repetition_frequency_unit'] = self::$_scheduleReminderDetails->repetition_frequency_unit;
+ $defaults['repetition_frequency_interval'] = self::$_scheduleReminderDetails->repetition_frequency_interval;
+ $defaults['start_action_condition'] = array_flip(explode(",", self::$_scheduleReminderDetails->start_action_condition));
+ foreach($defaults['start_action_condition'] as $key => $val) {
+ $val = 1;
+ $defaults['start_action_condition'][$key] = $val;
+ }
+ $defaults['start_action_offset'] = self::$_scheduleReminderDetails->start_action_offset;
+ if (self::$_scheduleReminderDetails->start_action_offset) {
+ $defaults['ends'] = 1;
+ }
+ list($defaults['repeat_absolute_date']) = CRM_Utils_Date::setDateDefaults(self::$_scheduleReminderDetails->absolute_date);
+ if (self::$_scheduleReminderDetails->absolute_date) {
+ $defaults['ends'] = 2;
+ }
+ $defaults['limit_to'] = self::$_scheduleReminderDetails->limit_to;
+ if (self::$_scheduleReminderDetails->limit_to) {
+ $defaults['repeats_by'] = 1;
+ }
+ $explodeStartActionCondition = array();
+ if (self::$_scheduleReminderDetails->entity_status) {
+ $explodeStartActionCondition = explode(" ", self::$_scheduleReminderDetails->entity_status);
+ $defaults['entity_status_1'] = $explodeStartActionCondition[0];
+ $defaults['entity_status_2'] = $explodeStartActionCondition[1];
+ }
+ if (self::$_scheduleReminderDetails->entity_status) {
+ $defaults['repeats_by'] = 2;
+ }
+ }
+ return $defaults;
+ }
+
+ public static function buildQuickForm(&$form) {
+ if (self::$_entityTable) {
+ $entityType = explode("_", self::$_entityTable);
+ if ($entityType[1]) {
+ $form->assign('entityType', ucwords($entityType[1]));
+ }
+ }
+ $form->assign('currentEntityId', self::$_entityId);
+ $form->assign('entityTable', self::$_entityTable);
+ $form->assign('scheduleReminderId', self::$_scheduleReminderID);
+ $form->assign('hasParent', self::$_hasParent);
+
+ $form->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');
+ foreach ($form->_freqUnits as $val => $label) {
+ if ($label == "day") {
+ $label = "dai";
+ }
+ $freqUnitsDisplay[$val] = ts('%1ly', array(1 => $label));
+ }
+ // echo "<pre>";print_r($freqUnitsDisplay);
+ $dayOfTheWeek = array(
+ 'monday' => 'Monday',
+ 'tuesday' => 'Tuesday',
+ 'wednesday' => 'Wednesday',
+ 'thursday' => 'Thursday',
+ 'friday' => 'Friday',
+ 'saturday' => 'Saturday',
+ 'sunday' => 'Sunday'
+ );
+ $form->add('select', 'repetition_frequency_unit', ts('Repeats:'), $freqUnitsDisplay);
+ $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
+ $form->add('select', 'repetition_frequency_interval', ts('Repeats every:'), $numericOptions, '', array('style' => 'width:55px;'));
+ $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
+ foreach($dayOfTheWeek as $key => $val) {
+ $startActionCondition[] = $form->createElement('checkbox', $key, NULL, substr($val." ", 0, 3));
+ }
+ $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
+ $roptionTypes = array(
+ '1' => ts('day of the month'),
+ '2' => ts('day of the week'),
+ );
+ $form->addRadio('repeats_by', ts("Repeats By:"), $roptionTypes, array(), NULL);
+ $getMonths = CRM_Core_SelectValues::getNumericOptions(1, 31);
+ $form->add('select', 'limit_to', '', $getMonths, FALSE, array('style' => 'width:55px;'));
+ $dayOfTheWeekNo = array(
+ 'first' => 'First',
+ 'second' => 'Second',
+ 'third' => 'Third',
+ 'fourth' => 'Fourth',
+ 'last' => 'Last'
+ );
+ $form->add('select', 'entity_status_1', ts(''), $dayOfTheWeekNo);
+ $form->add('select', 'entity_status_2', ts(''), $dayOfTheWeek);
+ $eoptionTypes = array(
+ '1' => ts('After'),
+ '2' => ts('On'),
+ );
+ $form->addRadio('ends', ts("Ends:"), $eoptionTypes, array(), NULL);
+ $form->add('text', 'start_action_offset', ts(''), array('size' => 3, 'maxlength' => 2));
+ $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
+ $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
+ $form->addDate('exclude_date', ts('Exclude Date(s)'), FALSE);
+ $select = $form->add('select', 'exclude_date_list', ts(''), self::$_excludeDateInfo, FALSE, array('style' => 'width:150px;', 'size' => 4));
+ $select->setMultiple(TRUE);
+ $form->addElement('button', 'add_to_exclude_list', '>>', 'onClick="addToExcludeList(document.getElementById(\'exclude_date\').value);"');
+ $form->addElement('button', 'remove_from_exclude_list', '<<', 'onClick="removeFromExcludeList(\'exclude_date_list\')"');
+ $form->addElement('hidden', 'copyExcludeDates', '', array('id' => 'copyExcludeDates'));
+ $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));
+ $form->addButtons(array(
+ array(
+ 'type' => 'submit',
+ 'name' => ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel')
+ ),
+ )
+ );
+ }
+
+ /**
+ * Global validation rules for the form
+ *
* @param array $fields
* Posted values of the form .
- *\r
- * @return array list of errors to be posted back to the form\r
- * @static\r
- */\r
- public static function formRule($values) {\r
- $errors = array();\r
- //Process this function only when you get this variable\r
- if ($values['allowRepeatConfigToSubmit'] == 1) {\r
- $dayOfTheWeek = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');\r
- //Repeats\r
- if (!CRM_Utils_Array::value('repetition_frequency_unit', $values)) {\r
- $errors['repetition_frequency_unit'] = ts('This is a required field');\r
- }\r
- //Repeats every\r
- if (!CRM_Utils_Array::value('repetition_frequency_interval', $values)) {\r
- $errors['repetition_frequency_interval'] = ts('This is a required field');\r
- }\r
- //Ends\r
- if (CRM_Utils_Array::value('ends', $values)) {\r
- if ($values['ends'] == 1) {\r
- if (empty($values['start_action_offset'])) {\r
- $errors['start_action_offset'] = ts('This is a required field');\r
- }\r
- else if ($values['start_action_offset'] > 30) {\r
- $errors['start_action_offset'] = ts('Occurrences should be less than or equal to 30');\r
- }\r
- }\r
- if ($values['ends'] == 2) {\r
- if (CRM_Utils_Array::value('repeat_absolute_date', $values)) {\r
- $entityStartDate = CRM_Utils_Date::processDate($values['repetition_start_date']);\r
- $end = CRM_Utils_Date::processDate($values['repeat_absolute_date']);\r
- if (($end < $entityStartDate) && ($end != 0)) {\r
- $errors['repeat_absolute_date'] = ts('End date should be after current entity\'s start date');\r
- }\r
- }\r
- else {\r
- $errors['repeat_absolute_date'] = ts('This is a required field');\r
- }\r
- }\r
- }\r
- else {\r
- $errors['ends'] = ts('This is a required field');\r
- }\r
-\r
- //Repeats BY\r
- if (CRM_Utils_Array::value('repeats_by', $values)) {\r
- if ($values['repeats_by'] == 1) {\r
- if (CRM_Utils_Array::value('limit_to', $values)) {\r
- if ($values['limit_to'] < 1 && $values['limit_to'] > 31) {\r
- $errors['limit_to'] = ts('Invalid day of the month');\r
- }\r
- }\r
- else {\r
- $errors['limit_to'] = ts('Invalid day of the month');\r
- }\r
- }\r
- if ($values['repeats_by'] == 2) {\r
- if (CRM_Utils_Array::value('entity_status_1', $values)) {\r
- $dayOfTheWeekNo = array(first, second, third, fourth, last);\r
- if (!in_array($values['entity_status_1'], $dayOfTheWeekNo)) {\r
- $errors['entity_status_1'] = ts('Invalid option');\r
- }\r
- }\r
- else {\r
- $errors['entity_status_1'] = ts('Invalid option');\r
- }\r
- if (CRM_Utils_Array::value('entity_status_2', $values)) {\r
- if (!in_array($values['entity_status_2'], $dayOfTheWeek)) {\r
- $errors['entity_status_2'] = ts('Invalid day name');\r
- }\r
- }\r
- else {\r
- $errors['entity_status_2'] = ts('Invalid day name');\r
- }\r
- }\r
- }\r
- }\r
- return $errors;\r
- }\r
-\r
- /**\r
- * Process the form submission\r
- *\r
- *\r
- * @return None\r
- */\r
- public static function postProcess($params = array(), $type, $linkedEntities = array()) {\r
- //Check entity_id not present in params take it from class variable\r
- if (!CRM_Utils_Array::value('entity_id', $params)) {\r
- $params['entity_id'] = self::$_entityId;\r
- }\r
- //Process this function only when you get this variable\r
- if ($params['allowRepeatConfigToSubmit'] == 1) {\r
- if (CRM_Utils_Array::value('entity_table', $params) && CRM_Utils_Array::value('entity_id', $params) && $type) {\r
- $params['used_for'] = $type;\r
- if (!CRM_Utils_Array::value('parent_entity_id', $params)) {\r
- $params['parent_entity_id'] = self::$_parentEntityId;\r
- }\r
- if (CRM_Utils_Array::value('schedule_reminder_id', $params)) {\r
- $params['id'] = $params['schedule_reminder_id'];\r
- }\r
- else {\r
- $params['id'] = self::$_scheduleReminderID;\r
- }\r
-\r
- //Save post params to the schedule reminder table\r
- $recurobj = new CRM_Core_BAO_RecurringEntity();\r
- $dbParams = $recurobj->mapFormValuesToDB($params);\r
-\r
- //Delete repeat configuration and rebuild\r
- if (CRM_Utils_Array::value('id', $params)) {\r
- CRM_Core_BAO_ActionSchedule::del($params['id']);\r
- unset($params['id']);\r
- }\r
- $actionScheduleObj = CRM_Core_BAO_ActionSchedule::add($dbParams);\r
-\r
- //exclude dates\r
- $excludeDateList = array();\r
- if (CRM_Utils_Array::value('copyExcludeDates', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) {\r
- //Since we get comma separated values lets get them in array\r
- $excludeDates = array();\r
- $excludeDates = explode(",", $params['copyExcludeDates']);\r
-\r
- //Check if there exists any values for this option group\r
- $optionGroupIdExists = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup',\r
- $type.'_repeat_exclude_dates_'.$params['parent_entity_id'],\r
- 'id',\r
- 'name'\r
- );\r
- if ($optionGroupIdExists) {\r
- CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);\r
- }\r
- $optionGroupParams =\r
- array(\r
- 'name' => $type.'_repeat_exclude_dates_'.$actionScheduleObj->entity_value,\r
- 'title' => $type.' recursion',\r
- 'is_reserved' => 0,\r
- 'is_active' => 1\r
- );\r
- $opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams);\r
- if ($opGroup->id) {\r
- $oldWeight= 0;\r
- $fieldValues = array('option_group_id' => $opGroup->id);\r
- foreach($excludeDates as $val) {\r
- $optionGroupValue =\r
- array(\r
- 'option_group_id' => $opGroup->id,\r
- 'label' => CRM_Utils_Date::processDate($val),\r
- 'value' => CRM_Utils_Date::processDate($val),\r
- 'name' => $opGroup->name,\r
- 'description' => 'Used for recurring '.$type,\r
- 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),\r
- 'is_active' => 1\r
- );\r
- $excludeDateList[] = $optionGroupValue['value'];\r
- CRM_Core_BAO_OptionValue::add($optionGroupValue);\r
- }\r
- }\r
- }\r
-\r
- //Set type for API\r
- $apiEntityType = array();\r
- $apiEntityType = explode("_", $type);\r
- if (!empty($apiEntityType[1])) {\r
- $apiType = $apiEntityType[1];\r
- }\r
- //Delete relations if any from recurring entity tables before inserting new relations for this entity id\r
- if ($params['entity_id']) {\r
- //If entity has any pre delete function, consider that first\r
- if (CRM_Utils_Array::value('pre_delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&\r
- CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {\r
- call_user_func(array(\r
- CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'],\r
- call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], array($params['entity_id'])))\r
- );\r
- }\r
- //Ready to execute delete on entities if it has delete function set\r
- if (CRM_Utils_Array::value('delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&\r
- CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {\r
- //Check if pre delete function has some ids to be deleted\r
- if (!empty(CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted)) {\r
- foreach (CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted as $eid) {\r
- $result = civicrm_api3(\r
- ucfirst(strtolower($apiType)),\r
- CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'],\r
- array(\r
- 'sequential' => 1,\r
- 'id' => $eid,\r
- )\r
- );\r
- if ($result['error']) {\r
- CRM_Core_Error::statusBounce('Error creating recurring list');\r
- }\r
- }\r
- }\r
- else {\r
- $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table'], FALSE);\r
- foreach ($getRelatedEntities as $key => $value) {\r
- $result = civicrm_api3(\r
- ucfirst(strtolower($apiType)),\r
- CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'],\r
- array(\r
- 'sequential' => 1,\r
- 'id' => $value['id'],\r
- )\r
- );\r
- if ($result['error']) {\r
- CRM_Core_Error::statusBounce('Error creating recurring list');\r
- }\r
- }\r
- }\r
- }\r
-\r
- // find all entities from the recurring set. At this point we 'll get entities which were not deleted \r
- // for e.g due to participants being present. We need to delete them from recurring tables anyway.\r
- $pRepeatingEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table']);\r
- foreach($pRepeatingEntities as $val) {\r
- CRM_Core_BAO_RecurringEntity::delEntity($val['id'], $val['table'], TRUE);\r
- }\r
- }\r
-\r
- $recursion = new CRM_Core_BAO_RecurringEntity();\r
- $recursion->dateColumns = $params['dateColumns'];\r
- $recursion->scheduleId = $actionScheduleObj->id;\r
-\r
- if (!empty($excludeDateList)) {\r
- $recursion->excludeDates = $excludeDateList;\r
- $recursion->excludeDateRangeColumns = $params['excludeDateRangeColumns'];\r
- }\r
- if (CRM_Utils_Array::value('intervalDateColumns', $params)) {\r
- $recursion->intervalDateColumns = $params['intervalDateColumns'];\r
- }\r
- $recursion->entity_id = $params['entity_id'];\r
- $recursion->entity_table = $params['entity_table'];\r
- if (!empty($linkedEntities)) {\r
- $recursion->linkedEntities = $linkedEntities;\r
- }\r
-\r
- $recurResult = $recursion->generate();\r
-\r
- $status = ts('Repeat Configuration has been saved');\r
- CRM_Core_Session::setStatus($status, ts('Saved'), 'success');\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Return a descriptive name for the page, used in wizard header\r
- *\r
- * @return string\r
- */\r
- public function getTitle() {\r
- return ts('Repeat Entity');\r
- }\r
-\r
-}\r
+ *
+ * @return array list of errors to be posted back to the form
+ * @static
+ */
+ public static function formRule($values) {
+ $errors = array();
+ //Process this function only when you get this variable
+ if ($values['allowRepeatConfigToSubmit'] == 1) {
+ $dayOfTheWeek = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
+ //Repeats
+ if (!CRM_Utils_Array::value('repetition_frequency_unit', $values)) {
+ $errors['repetition_frequency_unit'] = ts('This is a required field');
+ }
+ //Repeats every
+ if (!CRM_Utils_Array::value('repetition_frequency_interval', $values)) {
+ $errors['repetition_frequency_interval'] = ts('This is a required field');
+ }
+ //Ends
+ if (CRM_Utils_Array::value('ends', $values)) {
+ if ($values['ends'] == 1) {
+ if (empty($values['start_action_offset'])) {
+ $errors['start_action_offset'] = ts('This is a required field');
+ }
+ else if ($values['start_action_offset'] > 30) {
+ $errors['start_action_offset'] = ts('Occurrences should be less than or equal to 30');
+ }
+ }
+ if ($values['ends'] == 2) {
+ if (CRM_Utils_Array::value('repeat_absolute_date', $values)) {
+ $entityStartDate = CRM_Utils_Date::processDate($values['repetition_start_date']);
+ $end = CRM_Utils_Date::processDate($values['repeat_absolute_date']);
+ if (($end < $entityStartDate) && ($end != 0)) {
+ $errors['repeat_absolute_date'] = ts('End date should be after current entity\'s start date');
+ }
+ }
+ else {
+ $errors['repeat_absolute_date'] = ts('This is a required field');
+ }
+ }
+ }
+ else {
+ $errors['ends'] = ts('This is a required field');
+ }
+
+ //Repeats BY
+ if (CRM_Utils_Array::value('repeats_by', $values)) {
+ if ($values['repeats_by'] == 1) {
+ if (CRM_Utils_Array::value('limit_to', $values)) {
+ if ($values['limit_to'] < 1 && $values['limit_to'] > 31) {
+ $errors['limit_to'] = ts('Invalid day of the month');
+ }
+ }
+ else {
+ $errors['limit_to'] = ts('Invalid day of the month');
+ }
+ }
+ if ($values['repeats_by'] == 2) {
+ if (CRM_Utils_Array::value('entity_status_1', $values)) {
+ $dayOfTheWeekNo = array(first, second, third, fourth, last);
+ if (!in_array($values['entity_status_1'], $dayOfTheWeekNo)) {
+ $errors['entity_status_1'] = ts('Invalid option');
+ }
+ }
+ else {
+ $errors['entity_status_1'] = ts('Invalid option');
+ }
+ if (CRM_Utils_Array::value('entity_status_2', $values)) {
+ if (!in_array($values['entity_status_2'], $dayOfTheWeek)) {
+ $errors['entity_status_2'] = ts('Invalid day name');
+ }
+ }
+ else {
+ $errors['entity_status_2'] = ts('Invalid day name');
+ }
+ }
+ }
+ }
+ return $errors;
+ }
+
+ /**
+ * Process the form submission
+ *
+ *
+ * @return None
+ */
+ public static function postProcess($params = array(), $type, $linkedEntities = array()) {
+ //Check entity_id not present in params take it from class variable
+ if (!CRM_Utils_Array::value('entity_id', $params)) {
+ $params['entity_id'] = self::$_entityId;
+ }
+ //Process this function only when you get this variable
+ if ($params['allowRepeatConfigToSubmit'] == 1) {
+ if (CRM_Utils_Array::value('entity_table', $params) && CRM_Utils_Array::value('entity_id', $params) && $type) {
+ $params['used_for'] = $type;
+ if (!CRM_Utils_Array::value('parent_entity_id', $params)) {
+ $params['parent_entity_id'] = self::$_parentEntityId;
+ }
+ if (CRM_Utils_Array::value('schedule_reminder_id', $params)) {
+ $params['id'] = $params['schedule_reminder_id'];
+ }
+ else {
+ $params['id'] = self::$_scheduleReminderID;
+ }
+
+ //Save post params to the schedule reminder table
+ $recurobj = new CRM_Core_BAO_RecurringEntity();
+ $dbParams = $recurobj->mapFormValuesToDB($params);
+
+ //Delete repeat configuration and rebuild
+ if (CRM_Utils_Array::value('id', $params)) {
+ CRM_Core_BAO_ActionSchedule::del($params['id']);
+ unset($params['id']);
+ }
+ $actionScheduleObj = CRM_Core_BAO_ActionSchedule::add($dbParams);
+
+ //exclude dates
+ $excludeDateList = array();
+ if (CRM_Utils_Array::value('copyExcludeDates', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) {
+ //Since we get comma separated values lets get them in array
+ $excludeDates = array();
+ $excludeDates = explode(",", $params['copyExcludeDates']);
+
+ //Check if there exists any values for this option group
+ $optionGroupIdExists = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup',
+ $type.'_repeat_exclude_dates_'.$params['parent_entity_id'],
+ 'id',
+ 'name'
+ );
+ if ($optionGroupIdExists) {
+ CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);
+ }
+ $optionGroupParams =
+ array(
+ 'name' => $type.'_repeat_exclude_dates_'.$actionScheduleObj->entity_value,
+ 'title' => $type.' recursion',
+ 'is_reserved' => 0,
+ 'is_active' => 1
+ );
+ $opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams);
+ if ($opGroup->id) {
+ $oldWeight = 0;
+ $fieldValues = array('option_group_id' => $opGroup->id);
+ foreach($excludeDates as $val) {
+ $optionGroupValue =
+ array(
+ 'option_group_id' => $opGroup->id,
+ 'label' => CRM_Utils_Date::processDate($val),
+ 'value' => CRM_Utils_Date::processDate($val),
+ 'name' => $opGroup->name,
+ 'description' => 'Used for recurring '.$type,
+ 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),
+ 'is_active' => 1
+ );
+ $excludeDateList[] = $optionGroupValue['value'];
+ CRM_Core_BAO_OptionValue::add($optionGroupValue);
+ }
+ }
+ }
+
+ //Set type for API
+ $apiEntityType = array();
+ $apiEntityType = explode("_", $type);
+ if (!empty($apiEntityType[1])) {
+ $apiType = $apiEntityType[1];
+ }
+ //Delete relations if any from recurring entity tables before inserting new relations for this entity id
+ if ($params['entity_id']) {
+ //If entity has any pre delete function, consider that first
+ if (CRM_Utils_Array::value('pre_delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
+ CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
+ call_user_func(array(
+ CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['helper_class'],
+ call_user_func_array(CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['pre_delete_func'], array($params['entity_id'])))
+ );
+ }
+ //Ready to execute delete on entities if it has delete function set
+ if (CRM_Utils_Array::value('delete_func', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]) &&
+ CRM_Utils_Array::value('helper_class', CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']])) {
+ //Check if pre delete function has some ids to be deleted
+ if (!empty(CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted)) {
+ foreach (CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted as $eid) {
+ $result = civicrm_api3(
+ ucfirst(strtolower($apiType)),
+ CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'],
+ array(
+ 'sequential' => 1,
+ 'id' => $eid,
+ )
+ );
+ if ($result['error']) {
+ CRM_Core_Error::statusBounce('Error creating recurring list');
+ }
+ }
+ }
+ else {
+ $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table'], FALSE);
+ foreach ($getRelatedEntities as $key => $value) {
+ $result = civicrm_api3(
+ ucfirst(strtolower($apiType)),
+ CRM_Core_BAO_RecurringEntity::$_recurringEntityHelper[$params['entity_table']]['delete_func'],
+ array(
+ 'sequential' => 1,
+ 'id' => $value['id'],
+ )
+ );
+ if ($result['error']) {
+ CRM_Core_Error::statusBounce('Error creating recurring list');
+ }
+ }
+ }
+ }
+
+ // find all entities from the recurring set. At this point we 'll get entities which were not deleted
+ // for e.g due to participants being present. We need to delete them from recurring tables anyway.
+ $pRepeatingEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($params['entity_id'], $params['entity_table']);
+ foreach($pRepeatingEntities as $val) {
+ CRM_Core_BAO_RecurringEntity::delEntity($val['id'], $val['table'], TRUE);
+ }
+ }
+
+ $recursion = new CRM_Core_BAO_RecurringEntity();
+ $recursion->dateColumns = $params['dateColumns'];
+ $recursion->scheduleId = $actionScheduleObj->id;
+
+ if (!empty($excludeDateList)) {
+ $recursion->excludeDates = $excludeDateList;
+ $recursion->excludeDateRangeColumns = $params['excludeDateRangeColumns'];
+ }
+ if (CRM_Utils_Array::value('intervalDateColumns', $params)) {
+ $recursion->intervalDateColumns = $params['intervalDateColumns'];
+ }
+ $recursion->entity_id = $params['entity_id'];
+ $recursion->entity_table = $params['entity_table'];
+ if (!empty($linkedEntities)) {
+ $recursion->linkedEntities = $linkedEntities;
+ }
+
+ $recurResult = $recursion->generate();
+
+ $status = ts('Repeat Configuration has been saved');
+ CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
+ }
+ }
+ }
+
+ /**
+ * Return a descriptive name for the page, used in wizard header
+ *
+ * @return string
+ */
+ public function getTitle() {
+ return ts('Repeat Entity');
+ }
+
+}
self::build($menuArray);
-
$config = CRM_Core_Config::singleton();
foreach ($menuArray as $path => $item) {
'title' => $item['title'],
'desc' => CRM_Utils_Array::value('desc', $item),
'id' => strtr($item['title'], array(
- '(' => '_', ')' => '', ' ' => '',
- ',' => '_', '/' => '_',
+ '(' => '_',
+ ')' => '',
+ ' ' => '',
+ ',' => '_',
+ '/' => '_',
)
),
'url' => CRM_Utils_System::url($path, $query,
}
}
-
if (!$all) {
// remove all collapsed menu items from the array
foreach ($values as $weight => $v) {
// Once we have another example of a 'cleanup' we should generalize the clause below so it grabs string
// which follows upgrade/ and checks for existence of a function in Cleanup class.
if ($path == 'civicrm/upgrade/cleanup425') {
- $menuPath['page_callback'] = array('CRM_Upgrade_Page_Cleanup','cleanup425');
+ $menuPath['page_callback'] = array('CRM_Upgrade_Page_Cleanup', 'cleanup425');
$menuPath['access_arguments'][0][] = 'administer CiviCRM';
$menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
}
* Reference array of fieldnames we want transformed.
* Array key = 'postName' (field name submitted by form in $params).
* Array value = array(
- 'newName' => $newName, 'groupName' => $groupName).
+ 'newName' => $newName, 'groupName' => $groupName).
*
*
- * @param boolean $flip
+ * @param bool $flip
*
* @return void
*
if ($onlyActiveValue) {
$query .= " AND v.is_active = 1 ";
}
- $p = array(1 => array($groupName, 'String'),
+ $p = array(
+ 1 => array($groupName, 'String'),
2 => array($value, 'Integer'),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
static function getValue($groupName,
$label,
$labelField = 'label',
- $labelType = 'String',
+ $labelType = 'String',
$valueField = 'value'
) {
if (empty($label)) {
AND v.$labelField = %2
";
- $p = array(1 => array($groupName, 'String'),
+ $p = array(
+ 1 => array($groupName, 'String'),
2 => array($label, $labelType),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
WHERE g.id = v.option_group_id
AND g.name = %1
AND v.value = %2";
- $params = array(1 => array($groupName, 'String'),
+ $params = array(
+ 1 => array($groupName, 'String'),
2 => array($value, 'String'),
);
return CRM_Core_DAO::singleValueQuery($query, $params);
$query .= " AND v.is_active = 1";
}
- $p = array(1 => array($groupName, 'String'),
+ $p = array(
+ 1 => array($groupName, 'String'),
2 => array($fieldValue, $fieldType),
);
$dao = CRM_Core_DAO::executeQuery($query, $p);
* @param array $groupParams
* Array containing group fields whose option-values is to retrieved/saved.
* @param $action
- * @param integer $optionValueID
+ * @param int $optionValueIDHas the id of the optionValue being edited, disabled ..etc.
* Has the id of the optionValue being edited, disabled ..etc.
*
* @return CRM_Core_DAO_OptionValue
* @param string $orderBy
* For orderBy clause.
*
- * @param boolean $isActive
+ * @param bool $isActiveDo you want only active option values?.
* Do you want only active option values?.
*
* @return array of option-values
* The value to append.
* @param bool $merge
*/
- public function append($tpl_var, $value=NULL, $merge=FALSE) {
+ public function append($tpl_var, $value = NULL, $merge = FALSE) {
self::$_template->append($tpl_var, $value, $merge);
}
*
* @return array
*/
- public function get_template_vars($name=null) {
+ public function get_template_vars($name = NULL) {
return self::$_template->get_template_vars($name);
}
$wrapper->run($className);
}
break;
+
default:
CRM_Core_Error::debug_log_message('Unsupported inline request type: ' . var_export($type, TRUE));
}
// return false if $id is null and
// $context is not civicrm_event or civicrm_contribution_page
if (!$id || !in_array($context, array('civicrm_event', 'civicrm_contribution_page'))) {
- return false;
+ return FALSE;
}
$priceSetId = CRM_Price_BAO_PriceSet::getFor($context, $id, NULL);
if ($priceSetId) {
}
}
if (!$result) {
- $priceSetId = null;
+ $priceSetId = NULL;
}
CRM_Utils_JSON::output($priceSetId);
}
*
* @return bool
*/
- public static function checkAuthz($type, $className, $fnName = null) {
+ public static function checkAuthz($type, $className, $fnName = NULL) {
switch ($type) {
case 'method':
if (!preg_match('/^CRM_[a-zA-Z0-9]+_Page_AJAX$/', $className)) {
return FALSE;
}
return class_exists($className);
+
default:
return FALSE;
}
*/
public static function setJsHeaders() {
// Encourage browsers to cache for a long time - 1 year
- $year = 60*60*24*364;
+ $year = 60 * 60 * 24 * 364;
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $year));
header('Content-Type: application/javascript');
header("Cache-Control: max-age=$year, public");
* Array key to use as the key.
* @deprecated
*/
- public static function autocompleteResults($results, $val='label', $key='id') {
+ public static function autocompleteResults($results, $val = 'label', $key = 'id') {
$output = array();
if (is_array($results)) {
foreach ($results as $k => $v) {
$config = CRM_Core_Config::singleton();
$addressSequence = array_flip($config->addressSequence());
-
- $profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE,
+ $profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE,
NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
);
- $website = CRM_Core_BAO_Website::getValues($entityBlock, $values);
+ $website = CRM_Core_BAO_Website::getValues($entityBlock, $values);
- foreach ($location as $fld => $values) {
- if (is_array($values) && !empty($values)) {
- $locType = $values[1]['location_type_id'];
- if ($fld == 'email') {
- $elements["onbehalf_{$fld}-{$locType}"] = array(
+ foreach ($location as $fld => $values) {
+ if (is_array($values) && !empty($values)) {
+ $locType = $values[1]['location_type_id'];
+ if ($fld == 'email') {
+ $elements["onbehalf_{$fld}-{$locType}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
- unset($profileFields["{$fld}-{$locType}"]);
- }
- elseif ($fld == 'phone') {
- $phoneTypeId = $values[1]['phone_type_id'];
- $elements["onbehalf_{$fld}-{$locType}-{$phoneTypeId}"] = array(
+ unset($profileFields["{$fld}-{$locType}"]);
+ }
+ elseif ($fld == 'phone') {
+ $phoneTypeId = $values[1]['phone_type_id'];
+ $elements["onbehalf_{$fld}-{$locType}-{$phoneTypeId}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
- unset($profileFields["{$fld}-{$locType}-{$phoneTypeId}"]);
- }
- elseif ($fld == 'im') {
- $providerId = $values[1]['provider_id'];
- $elements["onbehalf_{$fld}-{$locType}"] = array(
+ unset($profileFields["{$fld}-{$locType}-{$phoneTypeId}"]);
+ }
+ elseif ($fld == 'im') {
+ $providerId = $values[1]['provider_id'];
+ $elements["onbehalf_{$fld}-{$locType}"] = array(
'type' => 'Text',
'value' => $location[$fld][1][$fld],
);
- $elements["onbehalf_{$fld}-{$locType}provider_id"] = array(
+ $elements["onbehalf_{$fld}-{$locType}provider_id"] = array(
'type' => 'Select',
'value' => $location[$fld][1]['provider_id'],
);
- unset($profileFields["{$fld}-{$locType}-{$providerId}"]);
- }
+ unset($profileFields["{$fld}-{$locType}-{$providerId}"]);
}
}
+ }
- if (!empty($website)) {
- foreach ($website as $key => $val) {
- $websiteTypeId = $values[1]['website_type_id'];
- $elements["onbehalf_url-1"] = array(
+ if (!empty($website)) {
+ foreach ($website as $key => $val) {
+ $websiteTypeId = $values[1]['website_type_id'];
+ $elements["onbehalf_url-1"] = array(
'type' => 'Text',
'value' => $website[1]['url'],
);
- $elements["onbehalf_url-1-website_type_id"] = array(
+ $elements["onbehalf_url-1-website_type_id"] = array(
'type' => 'Select',
'value' => $website[1]['website_type_id'],
);
- unset($profileFields["url-1"]);
- }
+ unset($profileFields["url-1"]);
}
+ }
- $locTypeId = isset($location['address'][1]) ? $location['address'][1]['location_type_id'] : NULL;
- $addressFields = array(
+ $locTypeId = isset($location['address'][1]) ? $location['address'][1]['location_type_id'] : NULL;
+ $addressFields = array(
'street_address',
'supplemental_address_1',
'supplemental_address_2',
'country',
);
- foreach ($addressFields as $field) {
- if (array_key_exists($field, $addressSequence)) {
- $addField = $field;
- $type = 'Text';
- if (in_array($field, array('state_province', 'country', 'county'))) {
- $addField = "{$field}_id";
- $type = 'Select';
- }
- $elements["onbehalf_{$field}-{$locTypeId}"] = array(
+ foreach ($addressFields as $field) {
+ if (array_key_exists($field, $addressSequence)) {
+ $addField = $field;
+ $type = 'Text';
+ if (in_array($field, array('state_province', 'country', 'county'))) {
+ $addField = "{$field}_id";
+ $type = 'Select';
+ }
+ $elements["onbehalf_{$field}-{$locTypeId}"] = array(
'type' => $type,
- 'value' => isset($location['address'][1]) ? $location['address'][1][$addField] : null,
+ 'value' => isset($location['address'][1]) ? $location['address'][1][$addField] : NULL,
);
- unset($profileFields["{$field}-{$locTypeId}"]);
- }
+ unset($profileFields["{$field}-{$locTypeId}"]);
}
+ }
- //set custom field defaults
- $defaults = array();
- CRM_Core_BAO_UFGroup::setProfileDefaults($cid, $profileFields, $defaults, TRUE, NULL, NULL, TRUE);
+ //set custom field defaults
+ $defaults = array();
+ CRM_Core_BAO_UFGroup::setProfileDefaults($cid, $profileFields, $defaults, TRUE, NULL, NULL, TRUE);
- if (!empty($defaults)) {
- foreach ($profileFields as $key => $val) {
- if (array_key_exists($key, $defaults)) {
- $htmlType = CRM_Utils_Array::value('html_type', $val);
- if ($htmlType == 'Radio') {
- $elements["onbehalf_{$key}"]['type'] = $htmlType;
- $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
- }
- elseif ($htmlType == 'CheckBox') {
- $elements["onbehalf_{$key}"]['type'] = $htmlType;
- foreach ($defaults[$key] as $k => $v) {
- $elements["onbehalf_{$key}"]['value'][$k] = $v;
- }
- }
- elseif ($htmlType == 'Multi-Select') {
- foreach ($defaults[$key] as $k => $v) {
- $elements["onbehalf_{$key}"]['type'] = $htmlType;
- $elements["onbehalf_{$key}"]['value'][$k] = $v;
- }
- }
- elseif ($htmlType == 'Autocomplete-Select') {
- $elements["onbehalf_{$key}"]['type'] = $htmlType;
- $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
- $elements["onbehalf_{$key}"]['id'] = $defaults["{$key}_id"];
- }
- elseif ($htmlType == 'Select Date') {
- $elements["onbehalf_{$key}"]['type'] = $htmlType;
- $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
- $elements["onbehalf_{$key}_display"]['value'] = $defaults[$key];
+ if (!empty($defaults)) {
+ foreach ($profileFields as $key => $val) {
+ if (array_key_exists($key, $defaults)) {
+ $htmlType = CRM_Utils_Array::value('html_type', $val);
+ if ($htmlType == 'Radio') {
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
+ }
+ elseif ($htmlType == 'CheckBox') {
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ foreach ($defaults[$key] as $k => $v) {
+ $elements["onbehalf_{$key}"]['value'][$k] = $v;
}
- else {
+ }
+ elseif ($htmlType == 'Multi-Select') {
+ foreach ($defaults[$key] as $k => $v) {
$elements["onbehalf_{$key}"]['type'] = $htmlType;
- $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
+ $elements["onbehalf_{$key}"]['value'][$k] = $v;
}
}
+ elseif ($htmlType == 'Autocomplete-Select') {
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
+ $elements["onbehalf_{$key}"]['id'] = $defaults["{$key}_id"];
+ }
+ elseif ($htmlType == 'Select Date') {
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
+ $elements["onbehalf_{$key}_display"]['value'] = $defaults[$key];
+ }
else {
- $elements["onbehalf_{$key}"]['value'] = '';
+ $elements["onbehalf_{$key}"]['type'] = $htmlType;
+ $elements["onbehalf_{$key}"]['value'] = $defaults[$key];
}
}
+ else {
+ $elements["onbehalf_{$key}"]['value'] = '';
+ }
}
+ }
CRM_Utils_JSON::output($elements);
}
-<?php\r
-\r
-/*\r
- * To change this license header, choose License Headers in Project Properties.\r
- * To change this template file, choose Tools | Templates\r
- * and open the template in the editor.\r
- */\r
-\r
-/**\r
- * Description of EntityApplyChangesTo\r
- *\r
- * @author Priyanka\r
- */\r
-\r
-class CRM_Core_Page_AJAX_RecurringEntity {\r
-\r
- public static function updateMode() {\r
- if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) {\r
-\r
- $finalResult = array();\r
- $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer');\r
- $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');\r
- $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String');\r
-\r
- if (CRM_Utils_Array::value('linkedEntityTable', $_REQUEST)) {\r
- $result = array();\r
- $result = CRM_Core_BAO_RecurringEntity::updateModeLinkedEntity($entityId, $_REQUEST['linkedEntityTable'], $entityTable);\r
- }\r
-\r
- $dao = new CRM_Core_DAO_RecurringEntity();\r
- if (!empty($result)) {\r
- $dao->entity_id = $result['entityId'];\r
- $dao->entity_table = $result['entityTable'];\r
- }\r
- else {\r
- $dao->entity_id = $entityId;\r
- $dao->entity_table = $entityTable;\r
- }\r
-\r
- if ($dao->find(TRUE)) {\r
- $dao->mode = $mode;\r
- $dao->save();\r
- $finalResult['status'] = 'Done';\r
- }\r
- else {\r
- $finalResult['status'] = 'Error';\r
- }\r
- }\r
- echo json_encode($finalResult);\r
- CRM_Utils_System::civiExit();\r
- }\r
-\r
- public static function generatePreview() {\r
- $params = $formValues = $genericResult = array();\r
- $formValues = $_REQUEST;\r
- if (!empty($formValues) &&\r
- CRM_Utils_Array::value('entity_table', $formValues)) {\r
- $startDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'][0];\r
- $endDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'][0];\r
-\r
- $recursion = new CRM_Core_BAO_RecurringEntity();\r
- if (CRM_Utils_Array::value('dateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {\r
- $recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];\r
- }\r
- $recursion->scheduleFormValues = $formValues;\r
- if (!empty($formValues['exclude_date_list'])) {\r
- $recursion->excludeDates = $formValues['exclude_date_list'];\r
- }\r
- if (CRM_Utils_Array::value('excludeDateRangeColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {\r
- $recursion->excludeDateRangeColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['excludeDateRangeColumns'];\r
- }\r
-\r
- if (CRM_Utils_Array::value('entity_id', $formValues)) {\r
- $parentEventId = CRM_Core_BAO_RecurringEntity::getParentFor($formValues['entity_id'], $formValues['entity_table']);\r
- }\r
-\r
- //Check if there is any enddate column defined to find out the interval between the two range\r
- if (CRM_Utils_Array::value('intervalDateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {\r
- $daoName = CRM_Core_BAO_RecurringEntity::$_tableDAOMapper[$formValues['entity_table']];\r
- if ($parentEventId) {\r
- $startDate = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $startDateColumnName);\r
- $endDate = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $endDateColumnName);\r
- }\r
- if ($endDate) {\r
- $interval = $recursion->getInterval($startDate, $endDate);\r
- $recursion->intervalDateColumns = array($endDateColumnName => $interval);\r
- }\r
- }\r
-\r
- $result = $recursion->generateRecursiveDates();\r
-\r
- foreach ($result as $key => $value) {\r
- if ($startDateColumnName) {\r
- $result[$key]['start_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value[$startDateColumnName]));\r
- }\r
- if ($value[$endDateColumnName]) {\r
- if ($endDateColumnName) {\r
- $result[$key]['end_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value[$endDateColumnName]));\r
- }\r
- }\r
- }\r
-\r
- //Show the list of participants registered for the events if any\r
- if ($formValues['entity_table'] == "civicrm_event" && !empty($parentEventId)) {\r
- $getConnectedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($parentEventId, 'civicrm_event', TRUE);\r
- if ($getConnectedEntities) {\r
- $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getConnectedEntities);\r
- if (!empty($participantDetails['countByName'])) {\r
- $result['participantData'] = $participantDetails['countByName'];\r
- }\r
- }\r
- }\r
- }\r
- echo json_encode($result);\r
- CRM_Utils_System::civiExit();\r
- }\r
-}\r
+<?php
+
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of EntityApplyChangesTo
+ *
+ * @author Priyanka
+ */
+
+class CRM_Core_Page_AJAX_RecurringEntity {
+
+ public static function updateMode() {
+ if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) {
+
+ $finalResult = array();
+ $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer');
+ $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');
+ $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String');
+
+ if (CRM_Utils_Array::value('linkedEntityTable', $_REQUEST)) {
+ $result = array();
+ $result = CRM_Core_BAO_RecurringEntity::updateModeLinkedEntity($entityId, $_REQUEST['linkedEntityTable'], $entityTable);
+ }
+
+ $dao = new CRM_Core_DAO_RecurringEntity();
+ if (!empty($result)) {
+ $dao->entity_id = $result['entityId'];
+ $dao->entity_table = $result['entityTable'];
+ }
+ else {
+ $dao->entity_id = $entityId;
+ $dao->entity_table = $entityTable;
+ }
+
+ if ($dao->find(TRUE)) {
+ $dao->mode = $mode;
+ $dao->save();
+ $finalResult['status'] = 'Done';
+ }
+ else {
+ $finalResult['status'] = 'Error';
+ }
+ }
+ echo json_encode($finalResult);
+ CRM_Utils_System::civiExit();
+ }
+
+ public static function generatePreview() {
+ $params = $formValues = $genericResult = array();
+ $formValues = $_REQUEST;
+ if (!empty($formValues) &&
+ CRM_Utils_Array::value('entity_table', $formValues)) {
+ $startDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'][0];
+ $endDateColumnName = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['intervalDateColumns'][0];
+
+ $recursion = new CRM_Core_BAO_RecurringEntity();
+ if (CRM_Utils_Array::value('dateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
+ $recursion->dateColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['dateColumns'];
+ }
+ $recursion->scheduleFormValues = $formValues;
+ if (!empty($formValues['exclude_date_list'])) {
+ $recursion->excludeDates = $formValues['exclude_date_list'];
+ }
+ if (CRM_Utils_Array::value('excludeDateRangeColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
+ $recursion->excludeDateRangeColumns = CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']]['excludeDateRangeColumns'];
+ }
+
+ if (CRM_Utils_Array::value('entity_id', $formValues)) {
+ $parentEventId = CRM_Core_BAO_RecurringEntity::getParentFor($formValues['entity_id'], $formValues['entity_table']);
+ }
+
+ //Check if there is any enddate column defined to find out the interval between the two range
+ if (CRM_Utils_Array::value('intervalDateColumns', CRM_Core_BAO_RecurringEntity::$_dateColumns[$formValues['entity_table']])) {
+ $daoName = CRM_Core_BAO_RecurringEntity::$_tableDAOMapper[$formValues['entity_table']];
+ if ($parentEventId) {
+ $startDate = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $startDateColumnName);
+ $endDate = CRM_Core_DAO::getFieldValue($daoName, $parentEventId, $endDateColumnName);
+ }
+ if ($endDate) {
+ $interval = $recursion->getInterval($startDate, $endDate);
+ $recursion->intervalDateColumns = array($endDateColumnName => $interval);
+ }
+ }
+
+ $result = $recursion->generateRecursiveDates();
+
+ foreach ($result as $key => $value) {
+ if ($startDateColumnName) {
+ $result[$key]['start_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value[$startDateColumnName]));
+ }
+ if ($value[$endDateColumnName]) {
+ if ($endDateColumnName) {
+ $result[$key]['end_date'] = date('M d, Y h:i:s A \o\n l', strtotime($value[$endDateColumnName]));
+ }
+ }
+ }
+
+ //Show the list of participants registered for the events if any
+ if ($formValues['entity_table'] == "civicrm_event" && !empty($parentEventId)) {
+ $getConnectedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($parentEventId, 'civicrm_event', TRUE);
+ if ($getConnectedEntities) {
+ $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getConnectedEntities);
+ if (!empty($participantDetails['countByName'])) {
+ $result['participantData'] = $participantDetails['countByName'];
+ }
+ }
+ }
+ }
+ echo json_encode($result);
+ CRM_Utils_System::civiExit();
+ }
+}
}
if (!empty($module['js'])) {
foreach ($module['js'] as $file) {
- $res->addScriptFile($module['ext'], $file, self::DEFAULT_MODULE_WEIGHT + (++$headOffset), 'html-header', TRUE);
+ $res->addScriptFile($module['ext'], $file, self::DEFAULT_MODULE_WEIGHT + (++$headOffset), 'html-header', TRUE);
}
}
}
*
* @return void
*/
- public function addValues($controller) {}
+ public function addValues($controller) {
+ }
/**
* Class constructor
// get 'id' if present
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $this->getBAOName()) . ".php");
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $this->getBAOName()) . ".php";
if ($id) {
if (!$this->checkPermission($id, NULL)) {
}
}
- if ($this->_action &
- (CRM_Core_Action::VIEW |
+ if ($this->_action & (CRM_Core_Action::VIEW |
CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
CRM_Core_Action::COPY |
return CRM_Core_DAO::$_nullObject;
}
- $cacheKey = "{$mode}_{$paymentProcessor['id']}_" . (int)isset($paymentForm);
+ $cacheKey = "{$mode}_{$paymentProcessor['id']}_" . (int) isset($paymentForm);
if (!isset(self::$_singleton[$cacheKey]) || $force) {
$config = CRM_Core_Config::singleton();
$ext = CRM_Extension_System::singleton()->getMapper();
if ($ext->isExtensionKey($paymentProcessor['class_name'])) {
$paymentClass = $ext->keyToClass($paymentProcessor['class_name'], 'payment');
- require_once ($ext->classToPath($paymentClass));
+ require_once $ext->classToPath($paymentClass);
}
else {
$paymentClass = 'CRM_Core_' . $paymentProcessor['class_name'];
if (empty($paymentClass)) {
throw new CRM_Core_Exception('no class provided');
}
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php';
}
//load the object.
//load the payment form for required processor.
//if ($paymentForm !== NULL) {
- //self::$_singleton[$cacheKey]->setForm($paymentForm);
+ //self::$_singleton[$cacheKey]->setForm($paymentForm);
//}
return self::$_singleton[$cacheKey];
$extension_instance_found = TRUE;
}
- if (!$extension_instance_found) CRM_Core_Error::fatal(
+ if (!$extension_instance_found) { CRM_Core_Error::fatal(
"No extension instances of the '{$params['processor_name']}' payment processor were found.<br />" .
"$method method is unsupported in legacy payment processors."
- );
+ );
+ }
// Exit here on web requests, allowing just the plain text response to be echoed
if ($method == 'handlePaymentNotification') {
public function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
// Set URL
switch ($action) {
- case 'cancel' :
+ case 'cancel':
$url = 'civicrm/contribute/unsubscribe';
break;
- case 'billing' :
+
+ case 'billing':
//in notify mode don't return the update billing url
if (!$this->isSupported('updateSubscriptionBillingInfo')) {
return NULL;
}
$url = 'civicrm/contribute/updatebilling';
break;
- case 'update' :
+
+ case 'update':
$url = 'civicrm/contribute/updaterecur';
break;
}
// Find related Contact
if ($entityID) {
switch ($entity) {
- case 'membership' :
+ case 'membership':
$contactID = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $entityID, "contact_id");
$entityArg = 'mid';
break;
- case 'contribution' :
+ case 'contribution':
$contactID = CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_Contribution", $entityID, "contact_id");
$entityArg = 'coid';
break;
- case 'recur' :
+ case 'recur':
$sql = "
SELECT con.contact_id
FROM civicrm_contribution_recur rec
$fields['x_customer_ip'] = $this->_getParam('ip_address');
$fields['x_email'] = $this->_getParam('email');
$fields['x_invoice_num'] = substr($this->_getParam('invoiceID'), 0, 20);
- $fields['x_amount'] = $amount;
+ $fields['x_amount'] = $amount;
$fields['x_currency_code'] = $this->_getParam('currencyID');
$fields['x_description'] = $this->_getParam('description');
$fields['x_cust_id'] = $this->_getParam('contactID');
public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
if ($errorCode) {
- $e->push($errorCode, 0, array( ), $errorMessage);
+ $e->push($errorCode, 0, array(), $errorMessage);
}
else {
- $e->push(9001, 0, array( ), 'Unknown System Error.');
+ $e->push(9001, 0, array(), 'Unknown System Error.');
}
return $e;
}
throw new CRM_Core_Exception("Could not find an entry for $name");
}
return $value;
-}
+ }
/**
* @param $ids
}
if (!empty($memberships)) {
- $membershipsUpdate = array( );
+ $membershipsUpdate = array();
foreach ($memberships as $membershipTypeIdKey => $membership) {
if ($membership) {
$format = '%Y%m%d';
(array) $membership
);
- $formatedParams = array('status_id' => CRM_Utils_Array::value('id', $calcStatus, 2),
+ $formatedParams = array(
+ 'status_id' => CRM_Utils_Array::value('id', $calcStatus, 2),
'join_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $dates), $format),
'start_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $dates), $format),
'end_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $dates), $format),
//add lineitems for recurring payments
if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) {
if ($addLineItems) {
- $input ['line_item'] = $this->addRecurLineItems($objects['contributionRecur']->id, $contribution);
+ $input['line_item'] = $this->addRecurLineItems($objects['contributionRecur']->id, $contribution);
}
else {
// this is just to prevent e-notices when we call recordFinancialAccounts - per comments on that line - intention is somewhat unclear
// it would be good if someone added some comments or refactored this
if ($contribution->id) {
$contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
- if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later &&
-- $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
- $input['payment_processor'] = $paymentProcessorId;
+ if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && - $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
+ $input['payment_processor'] = $paymentProcessorId;
}
$input['contribution_status_id'] = $contributionStatuses['Completed'];
$input['total_amount'] = $input['amount'];
$contribution = &$objects['contribution'];
- $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name','flip' => 1));
+ $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array('labelColumn' => 'name', 'flip' => 1));
$input['skipComponentSync'] = CRM_Utils_Array::value('skipComponentSync', $params);
if ($statusId == $contributionStatuses['Cancelled']) {
$baseIPN->cancelled($objects, $transaction, $input);
$requestFields['ssl_customer_code'] = '1111';
$requestFields['ssl_salestax'] = 0.0;
-
/************************************************************************************
* Fields available from civiCRM not implemented for Elavon
*
$errorDesc = curl_error($ch);
// Paranoia - in the unlikley event that 'curl' errno fails
- if ($errorNum == 0)
- $errorNum = 9005;
+ if ($errorNum == 0) {
+ $errorNum = 9005;
+ }
// Paranoia - in the unlikley event that 'curl' error fails
- if (strlen($errorDesc) == 0)
- $errorDesc = "Connection to payment gateway failed";
+ if (strlen($errorDesc) == 0) {
+ $errorDesc = "Connection to payment gateway failed";
+ }
if ($errorNum = 60) {
return self::errorExit($errorNum, "Curl error - " . $errorDesc . " Try this link for more information http://curl.haxx.se/docs/sslcerts.html");
}
* fix for CRM-2566
**********************************************************/
-
if ($processorResponse['errorCode']) {
return self::errorExit(9010, "Error: [" . $processorResponse['errorCode'] . " " . $processorResponse['errorName'] . " " . $processorResponse['errorMessage'] . "] - from payment processor");
}
$port = "1129";
$host = $this->_paymentProcessor['url_site'] . ":" . $port . "/LSGSXML";
-
//----------------------------------------------------------------------------------------------------
// Check to see if we have a duplicate before we send
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
$requestxml = lphp::buildXML($requestFields);
-
-
/*----------------------------------------------------------------------------------------------------
// Send to the payment information using cURL
/----------------------------------------------------------------------------------------------------
*/
-
$ch = curl_init($host);
if (!$ch) {
return self::errorExit(9004, 'Could not initiate connection to payment gateway');
}
-
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestxml);
curl_setopt($ch, CURLOPT_SSLCERT, $key);
$errorDesc = curl_error($ch);
// Paranoia - in the unlikley event that 'curl' errno fails
- if ($errorNum == 0)
- $errorNum = 9005;
+ if ($errorNum == 0) {
+ $errorNum = 9005;
+ }
// Paranoia - in the unlikley event that 'curl' error fails
- if (strlen($errorDesc) == 0)
- $errorDesc = "Connection to payment gateway failed";
+ if (strlen($errorDesc) == 0) {
+ $errorDesc = "Connection to payment gateway failed";
+ }
if ($errorNum == 60) {
return self::errorExit($errorNum, "Curl error - " . $errorDesc . " Try this link for more information http://curl.haxx.se/docs/sslcerts.html");
}
$ids['related_contact'] = NULL;
$ids['onbehalf_dupe_alert'] = NULL;
if ($contribution->trxn_id) {
- list($ids['membership'], $ids['related_contact'], $ids['onbehalf_dupe_alert']) = explode(CRM_Core_DAO::VALUE_SEPARATOR,
+ list($ids['membership'], $ids['related_contact'], $ids['onbehalf_dupe_alert']) = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$contribution->trxn_id
- );
+ );
}
foreach (array(
'membership', 'related_contact', 'onbehalf_dupe_alert') as $fld) {
// lets retrieve the private-data & order-no
$privateData = NULL;
if (array_key_exists('shopping-cart', $data[$root])) {
- $privateData = $data[$root]['shopping-cart']['merchant-private-data']['VALUE'];
+ $privateData = $data[$root]['shopping-cart']['merchant-private-data']['VALUE'];
}
if (empty($privateData) && array_key_exists('order-summary', $data[$root])
&& array_key_exists('shopping-cart', $data[$root]['order-summary'])) {
case "merchant-calculation-callback":
break;
- case "new-order-notification": {
- $response->SendAck($serial, FALSE);
- $ipn->newOrderNotify($data[$root], $privateData, $module);
- break;
+ case "new-order-notification":{
+ $response->SendAck($serial, FALSE);
+ $ipn->newOrderNotify($data[$root], $privateData, $module);
+ break;
}
- case "order-state-change-notification": {
- $response->SendAck($serial, FALSE);
- $new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
- $new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
+ case "order-state-change-notification":{
+ $response->SendAck($serial, FALSE);
+ $new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
+ $new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
- switch ($new_financial_state) {
- case 'CHARGEABLE':
- break;
+ switch ($new_financial_state) {
+ case 'CHARGEABLE':
+ break;
- case 'CHARGED':
- case 'PAYMENT_DECLINED':
- case 'CANCELLED':
- case 'CANCELLED_BY_GOOGLE':
- $ipn->orderStateChange($new_financial_state, $data[$root], $privateData, $module);
- break;
+ case 'CHARGED':
+ case 'PAYMENT_DECLINED':
+ case 'CANCELLED':
+ case 'CANCELLED_BY_GOOGLE':
+ $ipn->orderStateChange($new_financial_state, $data[$root], $privateData, $module);
+ break;
- case 'REVIEWING':
- case 'CHARGING':
- break;
+ case 'REVIEWING':
+ case 'CHARGING':
+ break;
- default:
- break;
- }
- break;
+ default:
+ break;
+ }
+ break;
}
- case "authorization-amount-notification": {
- $response->SendAck($serial, FALSE);
- $new_financial_state = $data[$root]['order-summary']['financial-order-state']['VALUE'];
- $new_fulfillment_order = $data[$root]['order-summary']['fulfillment-order-state']['VALUE'];
-
- switch ($new_financial_state) {
- case 'CHARGEABLE':
- // For google-handled subscriptions chargeorder needn't be initiated,
- // assuming auto-charging is turned on.
- //$request->SendProcessOrder($data[$root]['google-order-number']['VALUE']);
- //$request->SendChargeOrder($data[$root]['google-order-number']['VALUE'],'');
- break;
-
- case 'CHARGED':
- case 'PAYMENT_DECLINED':
- case 'CANCELLED':
- break;
-
- case 'REVIEWING':
- case 'CHARGING':
- case 'CANCELLED_BY_GOOGLE':
- break;
-
- default:
- break;
- }
- break;
+ case "authorization-amount-notification":{
+ $response->SendAck($serial, FALSE);
+ $new_financial_state = $data[$root]['order-summary']['financial-order-state']['VALUE'];
+ $new_fulfillment_order = $data[$root]['order-summary']['fulfillment-order-state']['VALUE'];
+
+ switch ($new_financial_state) {
+ case 'CHARGEABLE':
+ // For google-handled subscriptions chargeorder needn't be initiated,
+ // assuming auto-charging is turned on.
+ //$request->SendProcessOrder($data[$root]['google-order-number']['VALUE']);
+ //$request->SendChargeOrder($data[$root]['google-order-number']['VALUE'],'');
+ break;
+
+ case 'CHARGED':
+ case 'PAYMENT_DECLINED':
+ case 'CANCELLED':
+ break;
+
+ case 'REVIEWING':
+ case 'CHARGING':
+ case 'CANCELLED_BY_GOOGLE':
+ break;
+
+ default:
+ break;
+ }
+ break;
}
case "charge-amount-notification":
foreach ($lookup as $name => $googleName) {
if (array_key_exists($googleName, $dataRoot['buyer-billing-address'])) {
- $value = $dataRoot['buyer-billing-address'][$googleName]['VALUE'];
+ $value = $dataRoot['buyer-billing-address'][$googleName]['VALUE'];
}
$input[$name] = $value ? $value : NULL;
}
// beginning of modified sample code from IATS php api include IATS supplied api library
if ($isRecur) {
- include_once ('Services/IATS/iats_reoccur.php');
+ include_once 'Services/IATS/iats_reoccur.php';
$iatslink1 = new iatslinkReoccur;
}
else {
- include_once ('Services/IATS/iatslink.php');
+ include_once 'Services/IATS/iatslink.php';
$iatslink1 = new iatslink;
}
default:
die('Invalid frequency unit!');
- break;
+ break;
}
$endDate = date('Y-m-d', $endTime);
$startDate = date('Y-m-d', $startTime);
* @return object
* @static
*/
- public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
if (!empty($paymentProcessor['id'])) {
$cacheKey = $paymentProcessor['id'];
}
// set customer info (level 3 data) for the transaction
$pjpgTxn->setCustInfo($pjpgCustInfo);
-
// empty installments convert to 999 because PayJunction do not allow open end donation
if ($params['installments'] == "") {
$params['installments'] = "999";
}
public function main() {
- //@todo - this could be refactored like PayPalProIPN & a test could be added
+ //@todo - this could be refactored like PayPalProIPN & a test could be added
$objects = $ids = $input = array();
$component = CRM_Utils_Array::value('module', $_GET);
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('PayPal Pro');
- $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name');
+ $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name');
if ($this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal_Standard', $paymentProcessorType)) {
$this->_processorName = ts('PayPal Standard');
*/
public function checkConfig() {
$error = array();
- $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name');
+ $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name');
if (
$this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal_Standard', $paymentProcessorType) ||
$this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal', $paymentProcessorType)
recurring_payment_suspended_due_to_max_failed_payment RP Profile Suspended due to Max Failed Payment
*/
-
//set transaction type
$txnType = $this->retrieve('txn_type', 'String');
//Changes for paypal pro recurring payment
$contributionStatuses = $contributionStatuses['values'];
switch ($txnType) {
case 'recurring_payment_profile_created':
- if(in_array($recur->contribution_status_id, array(array_search('Pending',$contributionStatuses), array_search('In Progress',$contributionStatuses)))
+ if(in_array($recur->contribution_status_id, array(array_search('Pending', $contributionStatuses), array_search('In Progress', $contributionStatuses)))
&& !empty($recur->processor_id)) {
echo "already handled";
return;
$objects['contribution'] = &$contribution;
}
// CRM-13737 - am not aware of any reason why payment_date would not be set - this if is a belt & braces
- $objects['contribution']->receive_date = !empty($input['payment_date']) ? date('YmdHis', strtotime($input['payment_date'])): $now;
+ $objects['contribution']->receive_date = !empty($input['payment_date']) ? date('YmdHis', strtotime($input['payment_date'])) : $now;
$this->single($input, $ids, $objects,
TRUE, $first
INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contribution_id = %1
WHERE m.contribution_recur_id = %2
LIMIT 1";
- $sqlParams = array(1 => array($ids['contribution'], 'Integer'),
+ $sqlParams = array(
+ 1 => array($ids['contribution'], 'Integer'),
2 => array($ids['contributionRecur'], 'Integer'),
);
if ($membershipId = CRM_Core_DAO::singleValueQuery($sql, $sqlParams)) {
* only contribute is handled
*/
public function handlePaymentExpress() {
- //@todo - loads of copy & paste / code duplication but as this not going into core need to try to
- // keep discreet
- // also note that a lot of the complexity above could be removed if we used
- // http://stackoverflow.com/questions/4848227/validate-that-ipn-call-is-from-paypal
- // as membership id etc can be derived by the load objects fn
+ //@todo - loads of copy & paste / code duplication but as this not going into core need to try to
+ // keep discreet
+ // also note that a lot of the complexity above could be removed if we used
+ // http://stackoverflow.com/questions/4848227/validate-that-ipn-call-is-from-paypal
+ // as membership id etc can be derived by the load objects fn
$objects = $ids = $input = array();
$isFirst = FALSE;
$input['txnType'] = $this->retrieve('txn_type', 'String');
- if($input['txnType'] != 'recurring_payment') {
+ if($input['txnType'] != 'recurring_payment') {
throw new CRM_Core_Exception('Paypal IPNS not handled other than recurring_payments');
}
$input['invoice'] = self::getValue('i', FALSE);
$contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array('return' => 'contact_id, id', 'invoice_id' => $input['invoice']));
$ids['contact'] = $contributionRecur['contact_id'];
$ids['contributionRecur'] = $contributionRecur['id'];
- $result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice'], ));
+ $result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice'] ));
$ids['contribution'] = $result['id'];
//@todo hard - coding 'pending' for now
if($result['contribution_status_id'] == 2) {
- $isFirst = True;
+ $isFirst = TRUE;
}
// arg api won't get this - fix it
$ids['contributionPage'] = CRM_Core_DAO::singleValueQuery("SELECT contribution_page_id FROM civicrm_contribution WHERE invoice_id = %1", array(1 => array($ids['contribution'], 'Integer')));
case '2 weeks':
$params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m"), date("d") + 14, date("Y"));
- $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (14 * $payflow_query_array['TERM'])
- , date("Y ")
+ $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (14 * $payflow_query_array['TERM']), date("Y ")
);
$payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']);
$payflow_query_array['PAYPERIOD'] = "BIWK";
case '4 weeks':
$params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m"), date("d") + 28, date("Y")
);
- $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (28 * $payflow_query_array['TERM'])
- , date("Y")
+ $params['end_date'] = mktime(0, 0, 0, date("m"), date("d") + (28 * $payflow_query_array['TERM']), date("Y")
);
$payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']);
$payflow_query_array['PAYPERIOD'] = "FRWK";
break;
case '3 months':
- $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m") + 3, date("d")
- , date("Y")
+ $params['next_sched_contribution_date'] = mktime(0, 0, 0, date("m") + 3, date("d"), date("Y")
);
$params['end_date'] = mktime(0, 0, 0, date("m") +
(3 * $payflow_query_array['TERM']),
(6 * $payflow_query_array['TERM']),
date("d"), date("Y")
);
- $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date'
- ]
+ $payflow_query_array['START'] = date('mdY', $params['next_sched_contribution_date']
);
$payflow_query_array['PAYPERIOD'] = "SMYR";
$params['frequency_unit'] = "month";
$errorDesc = curl_error($ch);
//Paranoia - in the unlikley event that 'curl' errno fails
- if ($errorNum == 0)
- $errorNum = 9005;
+ if ($errorNum == 0) {
+ $errorNum = 9005;
+ }
// Paranoia - in the unlikley event that 'curl' error fails
- if (strlen($errorDesc) == 0)
- $errorDesc = "Connection to payment gateway failed";
+ if (strlen($errorDesc) == 0) {
+ $errorDesc = "Connection to payment gateway failed";
+ }
if ($errorNum = 60) {
return self::errorExit($errorNum, "Curl error - " . $errorDesc .
" Try this link for more information http://curl.haxx.se/d
//$recurringProfileID = "RT0000000001";
// c $trythis = $this->getRecurringTransactionStatus($recurringProfileID,17);
-
/*
*Create the array of variables to be sent to the processor from the $params array
* passed into this function
);
}
-
/*
* Build the private data string to pass to DPS, which they will give back to us with the
*
$privateData = "a={$params['contactID']},b={$params['contributionID']},c={$params['contributionTypeID']},d={$params['invoiceID']}";
if ($component == 'event') {
- $merchantRef = substr($params['contactID'] . "-" . $params['contributionID'] . " " . substr($params['description'], 27, 20), 0, 24);
+ $merchantRef = substr($params['contactID'] . "-" . $params['contributionID'] . " " . substr($params['description'], 27, 20), 0, 24);
$privateData .= ",f={$params['participantID']},g={$params['eventID']}";
}
elseif ($component == 'contribute') {
* determine whether method is pxaccess or pxpay by whether signature (mac key) is defined
*/
-
if (empty($this->_paymentProcessor['signature'])) {
/*
* Processor is pxpay
}
else {
$processortype = "pxaccess";
- require_once ('PaymentExpress/pxaccess.inc.php');
+ require_once 'PaymentExpress/pxaccess.inc.php';
// URL
$PxAccess_Url = $this->_paymentProcessor['url_site'];
// User ID
/**
- /**
+ /**
* The function returns the component(Event/Contribute..)and whether it is Test or not
*
* @param array $privateData
}
return array($isTest, $component, $duplicateTransaction);
- }
+ }
/**
* This method is handles the response that will be invoked by the
* notification or request sent by the payment processor.
- *hex string from paymentexpress is passed to this function as hex string. Code based on googleIPN
+ * hex string from paymentexpress is passed to this function as hex string. Code based on googleIPN
* mac_key is only passed if the processor is pxaccess as it is used for decryption
* $dps_method is either pxaccess or pxpay
*/
$DPStxnRef = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, 'DpsTxnRef');
$qfKey = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData1");
$privateData = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData2");
- list($component,$paymentProcessorID,) =explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
+ list($component, $paymentProcessorID,) = explode(',', CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "TxnData3"));
$amount = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "AmountSettlement");
$merchantReference = CRM_Core_Payment_PaymentExpressUtils::_xmlElement($response, "MerchantReference");
}
}
elseif ($dps_method == "pxaccess") {
- require_once ('PaymentExpress/pxaccess.inc.php');
+ require_once 'PaymentExpress/pxaccess.inc.php';
global $pxaccess;
$pxaccess = new PxAccess($dps_url, $dps_user, $dps_key, $mac_key);
#getResponse method in PxAccess object returns PxPayResponse object
$qfKey = $rsp->getTxnData1();
$privateData = $rsp->getTxnData2();
- list($component,$paymentProcessorID) = explode(',',$rsp->getTxnData3());
+ list($component, $paymentProcessorID) = explode(',', $rsp->getTxnData3());
$success = $rsp->getSuccess();
$authCode = $rsp->getAuthCode();
$DPStxnRef = $rsp->getDpsTxnRef();
list($mode, $component, $duplicateTransaction) = self::getContext($privateData, $transactionReference);
$mode = $mode ? 'test' : 'live';
-
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID,
$mode
);
$ipn = self::singleton($mode, $component, $paymentProcessor);
-
//Check status and take appropriate action
if ($success == 1) {
if (is_array($element)) {
$xml = '';
foreach ($element as $elem => $value) {
- $xml .= self::_valueXml($elem, $value);
+ $xml .= self::_valueXml($elem, $value);
}
return $xml;
}
*
* @throws Exception
*/
- public static function preProcess(&$form, $type = NULL, $mode = NULL ) {
+ public static function preProcess(&$form, $type = NULL, $mode = NULL) {
if ($type) {
$form->_type = $type;
}
// saving the country/state list in the session (which could be huge)
CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor);
-
$form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
// check if this is a paypal auto return and redirect accordingly
* @return object
* @static
*/
- public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
if (!empty($paymentProcessor['id'])) {
$cacheKey = $paymentProcessor['id'];
}
$hashme = "$sha1hash.{$this->_getParam('secret')}";
$sha1hash = sha1($hashme);
-
// Generate the request xml that is send to Realex Payments.
$request_xml = "<request type='auth' timestamp='{$this->_getParam('timestamp')}'>
<merchantid>{$this->_getParam('merchant_ref')}</merchantid>
* Format the params from the form ready for sending to Realex. Also perform some validation
*/
public function setRealexFields(&$params) {
- if ((int)$params['amount'] <= 0) {
+ if ((int) $params['amount'] <= 0) {
return self::error(9001, ts('Amount must be positive'));
}
$this->_setParam('currency', $config->defaultCurrency);
// Format the expiry date to MMYY
- $expmonth = (string)$params['month'];
+ $expmonth = (string) $params['month'];
$expmonth = (strlen($expmonth) === 1) ? '0' . $expmonth : $expmonth;
- $expyear = substr((string)$params['year'], 2, 2);
+ $expyear = substr((string) $params['year'], 2, 2);
$this->_setParam('exp_date', $expmonth . $expyear);
if (isset($params['credit_card_start_date']) && (strlen($params['credit_card_start_date']['M']) !== 0) &&
(strlen($params['credit_card_start_date']['Y']) !== 0)
) {
- $startmonth = (string)$params['credit_card_start_date']['M'];
+ $startmonth = (string) $params['credit_card_start_date']['M'];
$startmonth = (strlen($startmonth) === 1) ? '0' . $startmonth : $startmonth;
- $startyear = substr((string)$params['credit_card_start_date']['Y'], 2, 2);
+ $startyear = substr((string) $params['credit_card_start_date']['Y'], 2, 2);
$this->_setParam('start_date', $startmonth . $startyear);
}
* @return object
* @static
*/
- public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = false) {
+ public static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
if (!empty($paymentProcessor['id'])) {
$cacheKey = $paymentProcessor['id'];
}
$country = $params['country'];
*/
-
//-------------------------------------------------------------
// Prepare some composite data from _paymentProcessor fields
//-------------------------------------------------------------
$errorDesc = curl_error($submit);
// Paranoia - in the unlikley event that 'curl' errno fails
- if ($errorNum == 0)
- $errorNum = 9005;
+ if ($errorNum == 0) {
+ $errorNum = 9005;
+ }
// Paranoia - in the unlikley event that 'curl' error fails
- if (strlen($errorDesc) == 0)
- $errorDesc = "Connection to eWAY payment gateway failed";
+ if (strlen($errorDesc) == 0) {
+ $errorDesc = "Connection to eWAY payment gateway failed";
+ }
return self::errorExit($errorNum, $errorDesc);
}
}
*/
-
//=============
// Success !
//=============
// Initialization call is required to use CiviCRM APIs.
civicrm_initialize(TRUE);
-
list($fromName, $fromEmail) = CRM_Core_BAO_Domain::getNameAndEmail();
$from = "$fromName <$fromEmail>";
list ($civiPrefix, $name) = CRM_Utils_String::parsePrefix(':', $perm, NULL);
switch ($civiPrefix) {
case $nativePrefix:
- return $name; // pass through
+ return $name;
+
+ // pass through
case 'cms':
return CRM_Utils_Array::value($name, $map, CRM_Core_Permission::ALWAYS_DENY_PERMISSION);
+
case NULL:
return $name;
+
default:
return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
}
$query = db_query($sql);
while ($result = db_fetch_object($query)) {
- $uids[] = $result->uid;
- }
+ $uids[] = $result->uid;
+ }
$_cache[$roleName] = self::getContactEmails($uids);
return $_cache[$roleName];
$query = db_query($sql);
while ($result = db_fetch_object($query)) {
- $uids[] = $result->uid;
- }
+ $uids[] = $result->uid;
+ }
- $_cache[$permissionName] = self::getContactEmails($uids);
- return $_cache[$permissionName];
+ $_cache[$permissionName] = self::getContactEmails($uids);
+ return $_cache[$permissionName];
}
/**
$this->_viewPermissionedGroups[$groupKey] = $groups;
}
-
$ids = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_saved_search', $groups);
if (!empty($ids)) {
foreach (array_values($ids) as $id) {
$emails = array();
while ($dao->fetch()) {
- $emails[] = $dao->email;
+ $emails[] = $dao->email;
}
return implode(', ', $emails);
switch($civiPrefix) {
case 'Joomla':
return explode(':', $name);
+
case 'cms':
// FIXME: This needn't be DENY, but we don't currently have any translations.
return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
+
case NULL:
return array('civicrm.' . CRM_Utils_String::munge(strtolower($name)), 'com_civicrm');
+
default:
return CRM_Core_Permission::ALWAYS_DENY_PERMISSION;
}
*/
public static function &visibility($column = 'label') {
if (!isset(self::$visibility)) {
- self::$visibility = array( );
+ self::$visibility = array();
}
if (!isset(self::$visibility[$column])) {
self::$visibility[$column] = CRM_Core_OptionGroup::values('visibility', FALSE, FALSE, FALSE, NULL, $column);
- }
+ }
return self::$visibility[$column];
}
*
* @return array - array reference of all Option Group Name
*/
- public static function accountOptionValues($optionGroupName, $id = null, $condition = null) {
+ public static function accountOptionValues($optionGroupName, $id = NULL, $condition = NULL) {
$cacheKey = $optionGroupName . '_' . $condition;
if (empty(self::$accountOptionValues[$cacheKey])) {
- self::$accountOptionValues[$cacheKey] = CRM_Core_OptionGroup::values($optionGroupName, false, false, false, $condition);
+ self::$accountOptionValues[$cacheKey] = CRM_Core_OptionGroup::values($optionGroupName, FALSE, FALSE, FALSE, $condition);
}
if ($id) {
return CRM_Utils_Array::value($id, self::$accountOptionValues[$cacheKey]);
$data['values'][$pageName] = $page->exportValues();
$data['valid'][$pageName] = $page->validate();
-
// Modal form and page is invalid: don't go further
if ($page->controller->isModal() && !$data['valid'][$pageName]) {
return $page->handle('display');
}
}
- if (is_array($this->_values) && in_array((string)$option['attr']['value'], $this->_values)) {
+ if (is_array($this->_values) && in_array((string) $option['attr']['value'], $this->_values)) {
// The items is *selected*
$checked = ' checked="checked"';
}
foreach ($this->_options as $option) {
if (is_array($this->_values) &&
- in_array((string)$option['attr']['value'], $this->_values)
+ in_array((string) $option['attr']['value'], $this->_values)
) {
// Get the post order
$key = array_search($option['attr']['value'], $this->_values);
if (!isset($snippet['name'])) {
$snippet['name'] = count($this->_snippets);
}
- $this->_snippets[ $snippet['name'] ] = $snippet;
+ $this->_snippets[$snippet['name']] = $snippet;
$this->_isSorted = FALSE;
return $snippet;
}
case 'markup':
$html .= $snippet['markup'];
break;
+
case 'template':
$tmp = $smarty->get_template_vars('snippet');
$smarty->assign('snippet', $snippet);
$html .= $smarty->fetch($snippet['template']);
$smarty->assign('snippet', $tmp);
break;
+
case 'callback':
$args = isset($snippet['arguments']) ? $snippet['arguments'] : array(&$snippet, &$html);
$html .= call_user_func_array($snippet['callback'], $args);
break;
+
case 'scriptUrl':
if (!$allowCmsOverride || !$cms->addScriptUrl($snippet['scriptUrl'], $this->_name)) {
$html .= sprintf("<script type=\"text/javascript\" src=\"%s\">\n</script>\n", $snippet['scriptUrl']);
}
break;
+
case 'jquery':
$snippet['script'] = sprintf("CRM.\$(function(\$) {\n%s\n});", $snippet['jquery']);
// no break - continue processing as script
$html .= sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $snippet['script']);
}
break;
+
case 'styleUrl':
if (!$allowCmsOverride || !$cms->addStyleUrl($snippet['styleUrl'], $this->_name)) {
$html .= sprintf("<link href=\"%s\" rel=\"stylesheet\" type=\"text/css\"/>\n", $snippet['styleUrl']);
}
break;
+
case 'style':
if (!$allowCmsOverride || !$cms->addStyle($snippet['style'], $this->_name)) {
$html .= sprintf("<style type=\"text/css\">\n%s\n</style>\n", $snippet['style']);
}
break;
+
default:
require_once 'CRM/Core/Error.php';
CRM_Core_Error::fatal( ts( 'Snippet type %1 is unrecognized',
* @return int
*/
public static function _cmpSnippet($a, $b) {
- if ($a['weight'] < $b['weight']) return -1;
- if ($a['weight'] > $b['weight']) return 1;
+ if ($a['weight'] < $b['weight']) { return -1;
+ }
+ if ($a['weight'] > $b['weight']) { return 1;
+ }
// fallback to name sort; don't really want to do this, but it makes results more stable
- if ($a['name'] < $b['name']) return -1;
- if ($a['name'] > $b['name']) return 1;
+ if ($a['name'] < $b['name']) { return -1;
+ }
+ if ($a['name'] > $b['name']) { return 1;
+ }
return 0;
}
* HTML.
*
public function addMarkup($markup) {
- return $this->add(array(
- 'type' => 'markup',
- 'markup' => $markup,
- ));
+ return $this->add(array(
+ 'type' => 'markup',
+ 'markup' => $markup,
+ ));
}
/**
* Path to the Smarty template file.
*
public function addTemplate($template) {
- return $this->add(array(
- 'type' => 'template',
- 'template' => $template,
- ));
+ return $this->add(array(
+ 'type' => 'template',
+ 'template' => $template,
+ ));
}
/**
* Optional, array of parameters for callback; if omitted, the default arguments are ($snippetSpec, $html).
*
public function addCallback($callback, $arguments = FALSE) {
- return $this->add(array(
- 'type' => 'callback',
- 'callback' => $callback,
- 'arguments' => $arguments,
- ));
+ return $this->add(array(
+ 'type' => 'callback',
+ 'callback' => $callback,
+ 'arguments' => $arguments,
+ ));
}
*/
}
* @param string $rows
* (reference ) result set rows.
* @param null $titleHeader
- * @param boolean $print
+ * @param bool $printShould the output be printed.
* Should the output be printed.
*
* @param bool $outputHeader
$region = self::isAjaxMode() ? 'ajax-snippet' : 'html-header';
$resources = $this;
CRM_Core_Region::instance($region)->add(array(
- 'callback' => function(&$snippet, &$html) use ($resources) {
- $html .= "\n" . $resources->renderSetting();
- },
+ 'callback' => function(&$snippet, &$html) use ($resources) {
+ $html .= "\n" . $resources->renderSetting();
+ },
'weight' => -100000,
));
$this->addedSettings = TRUE;
$this->addScriptUrl(CRM_Utils_System::url('civicrm/ajax/l10n-js/' . $config->lcMessages, array('r' => $this->getCacheCode())), $jsWeight++, $region);
// Add global settings
- $settings = array('config' => array(
+ $settings = array(
+ 'config' => array(
'ajaxPopupsEnabled' => $this->ajaxPopupsEnabled,
'isFrontend' => $config->userFrameworkFrontend,
));
$filters['event'] = array(
array('key' => 'event_type_id', 'value' => ts('Event Type')),
- array('key' => 'start_date', 'value' => ts('Start Date'), 'options' => array(
+ array(
+ 'key' => 'start_date',
+ 'value' => ts('Start Date'),
+ 'options' => array(
array('key' => '{">":"now"}', 'value' => ts('Upcoming')),
array('key' => '{"BETWEEN":["now - 3 month","now"]}', 'value' => ts('Past 3 Months')),
array('key' => '{"BETWEEN":["now - 6 month","now"]}', 'value' => ts('Past 6 Months')),
return FALSE;
}
- public function __destruct() {}
+ public function __destruct() {
+ }
}
* Membership type unit
* @static
*/
- public static function membershipTypeUnitList( ) {
+ public static function membershipTypeUnitList() {
return self::unitList('duration');
}
* return array
*/
public static function mailingComponents() {
- return array('Header' => ts('Header'),
+ return array(
+ 'Header' => ts('Header'),
'Footer' => ts('Footer'),
'Reply' => ts('Reply Auto-responder'),
'OptOut' => ts('Opt-out Message'),
public static function contactTokens() {
static $tokens = NULL;
if (!$tokens) {
- $additionalFields = array('checksum' => array('title' => ts('Checksum')),
+ $additionalFields = array(
+ 'checksum' => array('title' => ts('Checksum')),
'contact_id' => array('title' => ts('Internal Contact ID')),
);
$exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields);
gives proper result
*/
-
return $dateInputFormats;
}
public static function getNumericOptions($start = 0, $end = 10) {
$numericOptions = array();
for ($i = $start; $i <= $end; $i++) {
- $numericOptions[$i] = $i;
+ $numericOptions[$i] = $i;
}
return $numericOptions;
}
* Extension types
*/
public static function getExtensionTypes() {
- return array(
+ return array(
'payment' => ts('Payment'),
'search' => ts('Search'),
'report' => ts('Report'),
self::$_template->assign("{$this->_prefix}summary", $summary);
}
-
// always store the current pageID and sortID
$this->_store->set($this->_prefix . CRM_Utils_Pager::PAGE_ID,
$this->_pager->getCurrentPageID()
* @return CRM_Core_Session
*/
public function __construct() {
- $this->_session = null;
+ $this->_session = NULL;
}
/**
// FIXME: This belongs in CRM_Utils_System_*
if ($config->userSystem->is_drupal && function_exists('drupal_session_start')) {
// https://issues.civicrm.org/jira/browse/CRM-14356
- if (! (isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == true)) {
+ if (! (isset($GLOBALS['lazy_session']) && $GLOBALS['lazy_session'] == TRUE)) {
drupal_session_start();
}
$_SESSION = array();
$this->createScope($prefix, TRUE);
if (empty($this->_session) || empty($this->_session[$this->_key])) {
- return null;
+ return NULL;
}
if (empty($prefix)) {
}
else {
if (empty($this->_session[$this->_key][$prefix])) {
- return null;
+ return NULL;
}
$session =& $this->_session[$this->_key][$prefix];
}
$this->set($name, time(), 'timer');
return $ts ? $ts : 'not set';
}
- return false;
+ return FALSE;
}
/**
parent::__construct();
}
- private function initialize( ) {
+ private function initialize() {
$config = CRM_Core_Config::singleton();
if (isset($config->customTemplateDir) && $config->customTemplateDir) {
*/
function smarty_block_crmRegion($params, $content, &$smarty, &$repeat)
{
- if ($repeat) return;
+ if ($repeat) { return;
+ }
require_once 'CRM/Core/Region.php';
$region = CRM_Core_Region::instance($params['name'], FALSE);
if ($region) {
if (!array_key_exists('file', $params)) {
$params['file'] = NULL;
}
- return $res->getUrl($params['ext'], $params['file'], $params['addCacheCode']);
+ return $res->getUrl($params['ext'], $params['file'], $params['addCacheCode']);
}
// concatenate with pipes to build the right key
$totalsKey = implode(CRM_Core_DAO::VALUE_SEPARATOR, $sectionValues);
-
// return the corresponding total
return $smarty->_tpl_vars['sectionTotals'][$totalsKey];
}
return $substr($string, 0, $length) . $etc;
}
- else return $string;
+ else { return $string;
+ }
}
/* vim: set expandtab: */
* @param string $tpl_name
* @param $smarty_obj
*/
-function civicrm_smarty_resource_string_get_trusted($tpl_name, &$smarty_obj) {}
+function civicrm_smarty_resource_string_get_trusted($tpl_name, &$smarty_obj) {
+
+}
function civicrm_smarty_register_string_resource() {
$template = CRM_Core_Smarty::singleton();
*/
public function &getState($name) {
if (isset($this->_states[$name])) {
- return $this->_states[$name];
- }
+ return $this->_states[$name];
+ }
/*
* This is a gross hack for ajax driven requests where
}
}
- return null;
+ return NULL;
}
/**
*/
public function shouldReset() {
return TRUE;
-}
+ }
}
public static function getActive() {
return array(
'_PEAR_default_error_mode' => $GLOBALS['_PEAR_default_error_mode'],
- '_PEAR_default_error_options' =>$GLOBALS['_PEAR_default_error_options'],
+ '_PEAR_default_error_options' => $GLOBALS['_PEAR_default_error_options'],
'modeException' => CRM_Core_Error::$modeException,
);
}
* See php manual call_user_func_array for details.
* @param int $id
*/
- static public function addCallback($phase, $callback, $params = null, $id = NULL) {
+ static public function addCallback($phase, $callback, $params = NULL, $id = NULL) {
$frame = \Civi\Core\Transaction\Manager::singleton()->getBaseFrame();
$frame->addCallback($phase, $callback, $params, $id);
}