diff --git a/.drone.yml b/.drone.yml index 6b6c4d4ca..7ed57731a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -48,7 +48,11 @@ steps: - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_group.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js - - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/edit_mailing.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_spgateway.spec.js @@ -129,7 +133,11 @@ steps: - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_group.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js - - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/edit_mailing.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_spgateway.spec.js @@ -211,7 +219,11 @@ steps: - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_group.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js - - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js + - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/edit_mailing.spec.js - cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_spgateway.spec.js @@ -292,7 +304,11 @@ steps: - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/add_group.spec.js - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js - - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js + - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js + - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js + - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js + - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js + - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js - cd $DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/edit_mailing.spec.js - name: notify diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1649fdbbe..bd12d3bda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,8 +82,16 @@ jobs: run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js" - name: Frontend - Import Records - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js" - - name: Frontend - Event Registration - Playwright - run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js" + - name: Frontend - Event Normal Registration - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js" + - name: Frontend - Event Registration for limited participants without waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js" + - name: Frontend - Event Registration for limited participants with waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js" + - name: Frontend - Event Registration for limited participants required approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js" + - name: Frontend - Event Registration for unlimited participants require approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js" - name: Frontend - Participant Editing - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js" - name: Frontend - Mailing Editing - Playwright @@ -181,8 +189,16 @@ jobs: run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js" - name: Frontend - Import Records - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js" - - name: Frontend - Event Registration - Playwright - run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js" + - name: Frontend - Event Normal Registration - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js" + - name: Frontend - Event Registration for limited participants without waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js" + - name: Frontend - Event Registration for limited participants with waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js" + - name: Frontend - Event Registration for limited participants required approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js" + - name: Frontend - Event Registration for unlimited participants require approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js" - name: Frontend - Participant Editing - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js" - name: Frontend - Mailing Editing - Playwright @@ -280,8 +296,16 @@ jobs: run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/add_membership_type.spec.js" - name: Frontend - Import Records - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/import.spec.js" - - name: Frontend - Event Registration - Playwright - run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_register.spec.js" + - name: Frontend - Event Normal Registration - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_normal_register.spec.js" + - name: Frontend - Event Registration for limited participants without waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_nowait_register.spec.js" + - name: Frontend - Event Registration for limited participants with waitlist - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_wait_register.spec.js" + - name: Frontend - Event Registration for limited participants required approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_limit_approval_register.spec.js" + - name: Frontend - Event Registration for unlimited participants require approval - Playwright + run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_unlimit_approval_register.spec.js" - name: Frontend - Participant Editing - Playwright run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/event_participant.spec.js" - name: Frontend - Mailing Editing - Playwright @@ -290,6 +314,7 @@ jobs: run: docker exec neticrm-ci bash -c "cd \$DRUPAL_ROOT/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_booster.spec.js" + - uses: actions/upload-artifact@v3 if: always() with: diff --git a/CRM/ACL/DAO/ACL.php b/CRM/ACL/DAO/ACL.php index 3ac244bd1..3c02063ea 100644 --- a/CRM/ACL/DAO/ACL.php +++ b/CRM/ACL/DAO/ACL.php @@ -277,13 +277,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['acl'] = & $fields[$name]; + self::$_import['acl'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -300,13 +300,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['acl'] = & $fields[$name]; + self::$_export['acl'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -360,7 +360,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_ACL_DAO_ACL::getEnums(); + $enumFields = &CRM_ACL_DAO_ACL::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_ACL_DAO_ACL::tsEnum($enum, $values[$enum]); diff --git a/CRM/ACL/DAO/Cache.php b/CRM/ACL/DAO/Cache.php index 7b7529199..3a02da8b6 100644 --- a/CRM/ACL/DAO/Cache.php +++ b/CRM/ACL/DAO/Cache.php @@ -210,13 +210,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['acl_cache'] = & $fields[$name]; + self::$_import['acl_cache'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -233,13 +233,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['acl_cache'] = & $fields[$name]; + self::$_export['acl_cache'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/ACL/DAO/EntityRole.php b/CRM/ACL/DAO/EntityRole.php index c430e232f..ca09c6ae0 100644 --- a/CRM/ACL/DAO/EntityRole.php +++ b/CRM/ACL/DAO/EntityRole.php @@ -205,13 +205,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['acl_entity_role'] = & $fields[$name]; + self::$_import['acl_entity_role'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -228,13 +228,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['acl_entity_role'] = & $fields[$name]; + self::$_export['acl_entity_role'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/AI/DAO/AICompletion.php b/CRM/AI/DAO/AICompletion.php index c10b3dbb3..3296c56fb 100644 --- a/CRM/AI/DAO/AICompletion.php +++ b/CRM/AI/DAO/AICompletion.php @@ -395,13 +395,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['aicompletion'] = & $fields[$name]; + self::$_import['aicompletion'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -418,13 +418,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['aicompletion'] = & $fields[$name]; + self::$_export['aicompletion'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/AI/Page/AJAX.php b/CRM/AI/Page/AJAX.php index c428da838..678233784 100644 --- a/CRM/AI/Page/AJAX.php +++ b/CRM/AI/Page/AJAX.php @@ -58,13 +58,13 @@ public static function chat() { 'CiviContribute' => ['civicrm/admin/contribute/add', 'civicrm/admin/contribute/setting'], 'CiviEvent' => ['civicrm/event/add', 'civicrm/event/manage/eventInfo'], 'CiviMail' => ['civicrm/mailing/send'], - 'Activity' => ['civicrm/activity/add', 'civicrm/contact/view/activity'], + 'Activity' => ['civicrm/activity/add', 'civicrm/contact/view/activity', 'civicrm/contact/search'], ]; foreach ($allowPatterns as $component => $allowedUrls) { foreach ($allowedUrls as $allowedUrl) { if (strstr($url, $allowedUrl)) { - if ($component === "Activity" && strstr($jsondata['sourceUrl'], "atype=$mailTypeId")) { + if ($component === "Activity" && (strstr($jsondata['sourceUrl'], "atype=$mailTypeId") || strstr($jsondata['sourceUrl'], "_qf_Email_display"))) { $data['component'] = $component; break 2; } elseif ($component !== "Activity") { diff --git a/CRM/Activity/DAO/Activity.php b/CRM/Activity/DAO/Activity.php index af3f93b6f..1e94ce9bf 100644 --- a/CRM/Activity/DAO/Activity.php +++ b/CRM/Activity/DAO/Activity.php @@ -484,13 +484,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['activity'] = & $fields[$name]; + self::$_import['activity'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -507,13 +507,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['activity'] = & $fields[$name]; + self::$_export['activity'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Activity/DAO/ActivityAssignment.php b/CRM/Activity/DAO/ActivityAssignment.php index 940b92e3a..2598eda5c 100644 --- a/CRM/Activity/DAO/ActivityAssignment.php +++ b/CRM/Activity/DAO/ActivityAssignment.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['activity_assignment'] = & $fields[$name]; + self::$_import['activity_assignment'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['activity_assignment'] = & $fields[$name]; + self::$_export['activity_assignment'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Activity/DAO/ActivityTarget.php b/CRM/Activity/DAO/ActivityTarget.php index a40c677e3..fbf24001f 100644 --- a/CRM/Activity/DAO/ActivityTarget.php +++ b/CRM/Activity/DAO/ActivityTarget.php @@ -206,13 +206,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['activity_target'] = & $fields[$name]; + self::$_import['activity_target'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -229,13 +229,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['activity_target'] = & $fields[$name]; + self::$_export['activity_target'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Admin/Form/FromEmailAddress/Finish.php b/CRM/Admin/Form/FromEmailAddress/Finish.php index 1c18fd3ba..6517b259f 100644 --- a/CRM/Admin/Form/FromEmailAddress/Finish.php +++ b/CRM/Admin/Form/FromEmailAddress/Finish.php @@ -64,5 +64,8 @@ public function postProcess() { $this->_values['is_active'] = $this->exportValue('is_active'); $this->_values['is_default'] = $this->exportValue('is_default'); $this->saveValues(); + if (!empty($this->_values['is_active'])) { + CRM_Utils_Mail::validDKIMDomainList(TRUE, CRM_Utils_Mail::DKIM_EXTERNAL_VERIFIED_FILE); + } } } \ No newline at end of file diff --git a/CRM/Batch/DAO/Batch.php b/CRM/Batch/DAO/Batch.php index 33a17aca1..bb6db6e35 100644 --- a/CRM/Batch/DAO/Batch.php +++ b/CRM/Batch/DAO/Batch.php @@ -295,13 +295,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['batch'] = & $fields[$name]; + self::$_import['batch'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -318,13 +318,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['batch'] = & $fields[$name]; + self::$_export['batch'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Batch/DAO/EntityBatch.php b/CRM/Batch/DAO/EntityBatch.php index b06a09aea..11cfdf26a 100644 --- a/CRM/Batch/DAO/EntityBatch.php +++ b/CRM/Batch/DAO/EntityBatch.php @@ -211,13 +211,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['entity_batch'] = & $fields[$name]; + self::$_import['entity_batch'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -234,13 +234,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['entity_batch'] = & $fields[$name]; + self::$_export['entity_batch'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Campaign/DAO/Campaign.php b/CRM/Campaign/DAO/Campaign.php index 4cc74da02..4399c4134 100644 --- a/CRM/Campaign/DAO/Campaign.php +++ b/CRM/Campaign/DAO/Campaign.php @@ -390,13 +390,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['campaign'] = & $fields[$name]; + self::$_import['campaign'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -413,13 +413,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['campaign'] = & $fields[$name]; + self::$_export['campaign'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Campaign/DAO/CampaignGroup.php b/CRM/Campaign/DAO/CampaignGroup.php index 2a1797283..1bd479bf0 100644 --- a/CRM/Campaign/DAO/CampaignGroup.php +++ b/CRM/Campaign/DAO/CampaignGroup.php @@ -225,13 +225,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['campaign_group'] = & $fields[$name]; + self::$_import['campaign_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -248,13 +248,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['campaign_group'] = & $fields[$name]; + self::$_export['campaign_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -302,7 +302,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Campaign_DAO_CampaignGroup::getEnums(); + $enumFields = &CRM_Campaign_DAO_CampaignGroup::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Campaign_DAO_CampaignGroup::tsEnum($enum, $values[$enum]); diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php index cb5f1957f..c1db1dc4c 100644 --- a/CRM/Campaign/DAO/Survey.php +++ b/CRM/Campaign/DAO/Survey.php @@ -364,13 +364,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['survey'] = & $fields[$name]; + self::$_import['survey'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -387,13 +387,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['survey'] = & $fields[$name]; + self::$_export['survey'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Case/DAO/Case.php b/CRM/Case/DAO/Case.php index 6e676d293..193b2345d 100644 --- a/CRM/Case/DAO/Case.php +++ b/CRM/Case/DAO/Case.php @@ -260,13 +260,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['case'] = & $fields[$name]; + self::$_import['case'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -283,13 +283,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['case'] = & $fields[$name]; + self::$_export['case'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Case/DAO/CaseActivity.php b/CRM/Case/DAO/CaseActivity.php index 624d066d5..b81e7789e 100644 --- a/CRM/Case/DAO/CaseActivity.php +++ b/CRM/Case/DAO/CaseActivity.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['case_activity'] = & $fields[$name]; + self::$_import['case_activity'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['case_activity'] = & $fields[$name]; + self::$_export['case_activity'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Case/DAO/CaseContact.php b/CRM/Case/DAO/CaseContact.php index b02d3a9f4..e8d83b32b 100644 --- a/CRM/Case/DAO/CaseContact.php +++ b/CRM/Case/DAO/CaseContact.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['case_contact'] = & $fields[$name]; + self::$_import['case_contact'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['case_contact'] = & $fields[$name]; + self::$_export['case_contact'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/ACLContactCache.php b/CRM/Contact/DAO/ACLContactCache.php index 3a9a65c03..8ee3a8f4d 100644 --- a/CRM/Contact/DAO/ACLContactCache.php +++ b/CRM/Contact/DAO/ACLContactCache.php @@ -212,13 +212,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['acl_contact_cache'] = & $fields[$name]; + self::$_import['acl_contact_cache'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -235,13 +235,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['acl_contact_cache'] = & $fields[$name]; + self::$_export['acl_contact_cache'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -294,7 +294,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contact_DAO_ACLContactCache::getEnums(); + $enumFields = &CRM_Contact_DAO_ACLContactCache::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contact_DAO_ACLContactCache::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index 403522e07..5d2cece90 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -950,13 +950,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contact'] = & $fields[$name]; + self::$_import['contact'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -973,13 +973,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contact'] = & $fields[$name]; + self::$_export['contact'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -1028,7 +1028,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contact_DAO_Contact::getEnums(); + $enumFields = &CRM_Contact_DAO_Contact::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contact_DAO_Contact::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contact/DAO/ContactType.php b/CRM/Contact/DAO/ContactType.php index 5cb373408..efc9306e7 100644 --- a/CRM/Contact/DAO/ContactType.php +++ b/CRM/Contact/DAO/ContactType.php @@ -258,13 +258,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contact_type'] = & $fields[$name]; + self::$_import['contact_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -281,13 +281,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contact_type'] = & $fields[$name]; + self::$_export['contact_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/DashboardContact.php b/CRM/Contact/DAO/DashboardContact.php index 1e43444f6..bf1c024f7 100644 --- a/CRM/Contact/DAO/DashboardContact.php +++ b/CRM/Contact/DAO/DashboardContact.php @@ -252,13 +252,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['dashboard_contact'] = & $fields[$name]; + self::$_import['dashboard_contact'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -275,13 +275,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['dashboard_contact'] = & $fields[$name]; + self::$_export['dashboard_contact'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/GroupContact.php b/CRM/Contact/DAO/GroupContact.php index 8547e7132..aa9601e80 100644 --- a/CRM/Contact/DAO/GroupContact.php +++ b/CRM/Contact/DAO/GroupContact.php @@ -238,13 +238,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['group_contact'] = & $fields[$name]; + self::$_import['group_contact'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -261,13 +261,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['group_contact'] = & $fields[$name]; + self::$_export['group_contact'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -316,7 +316,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contact_DAO_GroupContact::getEnums(); + $enumFields = &CRM_Contact_DAO_GroupContact::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contact_DAO_GroupContact::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contact/DAO/GroupContactCache.php b/CRM/Contact/DAO/GroupContactCache.php index 9d85a9b15..c45b2f887 100644 --- a/CRM/Contact/DAO/GroupContactCache.php +++ b/CRM/Contact/DAO/GroupContactCache.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['group_contact_cache'] = & $fields[$name]; + self::$_import['group_contact_cache'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['group_contact_cache'] = & $fields[$name]; + self::$_export['group_contact_cache'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/GroupNesting.php b/CRM/Contact/DAO/GroupNesting.php index a178a5ded..0c4bd410a 100644 --- a/CRM/Contact/DAO/GroupNesting.php +++ b/CRM/Contact/DAO/GroupNesting.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['group_nesting'] = & $fields[$name]; + self::$_import['group_nesting'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['group_nesting'] = & $fields[$name]; + self::$_export['group_nesting'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/GroupOrganization.php b/CRM/Contact/DAO/GroupOrganization.php index d91694571..9ad091ec9 100644 --- a/CRM/Contact/DAO/GroupOrganization.php +++ b/CRM/Contact/DAO/GroupOrganization.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['group_organization'] = & $fields[$name]; + self::$_import['group_organization'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['group_organization'] = & $fields[$name]; + self::$_export['group_organization'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php index 7c854459d..5973c0f5d 100644 --- a/CRM/Contact/DAO/Relationship.php +++ b/CRM/Contact/DAO/Relationship.php @@ -296,13 +296,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['relationship'] = & $fields[$name]; + self::$_import['relationship'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -319,13 +319,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['relationship'] = & $fields[$name]; + self::$_export['relationship'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/RelationshipType.php b/CRM/Contact/DAO/RelationshipType.php index da6446d0c..96f1314dd 100644 --- a/CRM/Contact/DAO/RelationshipType.php +++ b/CRM/Contact/DAO/RelationshipType.php @@ -281,13 +281,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['relationship_type'] = & $fields[$name]; + self::$_import['relationship_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -304,13 +304,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['relationship_type'] = & $fields[$name]; + self::$_export['relationship_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -365,7 +365,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contact_DAO_RelationshipType::getEnums(); + $enumFields = &CRM_Contact_DAO_RelationshipType::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contact_DAO_RelationshipType::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contact/DAO/SavedSearch.php b/CRM/Contact/DAO/SavedSearch.php index 1b8c11242..85eaa98a9 100644 --- a/CRM/Contact/DAO/SavedSearch.php +++ b/CRM/Contact/DAO/SavedSearch.php @@ -244,13 +244,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['saved_search'] = & $fields[$name]; + self::$_import['saved_search'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -267,13 +267,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['saved_search'] = & $fields[$name]; + self::$_export['saved_search'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contact/DAO/SubscriptionHistory.php b/CRM/Contact/DAO/SubscriptionHistory.php index 7f5a0ecdf..60f0e13ba 100644 --- a/CRM/Contact/DAO/SubscriptionHistory.php +++ b/CRM/Contact/DAO/SubscriptionHistory.php @@ -248,13 +248,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['subscription_history'] = & $fields[$name]; + self::$_import['subscription_history'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -271,13 +271,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['subscription_history'] = & $fields[$name]; + self::$_export['subscription_history'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -333,7 +333,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contact_DAO_SubscriptionHistory::getEnums(); + $enumFields = &CRM_Contact_DAO_SubscriptionHistory::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contact_DAO_SubscriptionHistory::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index e1414fa9b..78fb54c8a 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -72,6 +72,11 @@ function preProcess() { $this->_hasError = TRUE; } + if (self::checkContactIsAdmin($cid, $oid)) { + return CRM_Core_Error::statusBounce(ts('Cannot merge with the administrator, please recheck the selected contacts.')); + $this->_hasError = TRUE; + } + // Block access if user does not have EDIT permissions for both contacts. if (!(CRM_Contact_BAO_Contact_Permission::allow($cid, CRM_Core_Permission::EDIT) && CRM_Contact_BAO_Contact_Permission::allow($oid, CRM_Core_Permission::EDIT) @@ -276,5 +281,23 @@ function validateContacts($cid, $oid) { return TRUE; } } + + function checkContactIsAdmin($cid, $oid) { + // Check contact is admin or not + $cidSql = "SELECT uf_id FROM `civicrm_uf_match` where contact_id = %1"; + $cidParams = array( 1 => array($cid, 'Integer')); + $cidUid = CRM_Core_DAO::singleValueQuery($cidSql, $cidParams); + + $oidSql = "SELECT uf_id FROM `civicrm_uf_match` where contact_id = %1"; + $oidParams = array( 1 => array($oid, 'Integer')); + $oidUid = CRM_Core_DAO::singleValueQuery($oidSql, $oidParams); + + if ($cidUid == 1 || $oidUid == 1) { + return TRUE; + } + else { + return FALSE; + } + } } diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 774d9ec19..2114b7ae4 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -66,7 +66,7 @@ static function basic(&$form) { if ($contactTags) { $form->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, - array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -')) + array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -'), 'style' => 'width:160px') ); } diff --git a/CRM/Contact/Form/Search/Custom/Group.php b/CRM/Contact/Form/Search/Custom/Group.php index f3ae17274..b8dcfc81c 100644 --- a/CRM/Contact/Form/Search/Custom/Group.php +++ b/CRM/Contact/Form/Search/Custom/Group.php @@ -99,53 +99,41 @@ function buildForm(&$form) { CRM_Utils_System::redirect($url); } - $inG = &$form->addElement('advmultiselect', 'includeGroups', + $inG = &$form->addElement('select', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, - 'style' => 'width:240px', - 'class' => 'advmultiselect', + 'style' => 'width:400px', + 'multiple' => 'multiple', ) ); - $outG = &$form->addElement('advmultiselect', 'excludeGroups', + $outG = &$form->addElement('select', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, - 'style' => 'width:240px', - 'class' => 'advmultiselect', + 'style' => 'width:400px', + 'multiple' => 'multiple', ) ); $andOr = &$form->addElement('checkbox', 'andOr', 'Search with tag (check for AND, uncheck For OR)', NULL, array('checked' => 'checked') ); - $int = &$form->addElement('advmultiselect', 'includeTags', + $int = &$form->addElement('select', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, - 'style' => 'width:240px', - 'class' => 'advmultiselect', + 'style' => 'width:400px', + 'multiple' => 'multiple', ) ); - $outt = &$form->addElement('advmultiselect', 'excludeTags', + $outt = &$form->addElement('select', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, - 'style' => 'width:240px', - 'class' => 'advmultiselect', + 'style' => 'width:400px', + 'multiple' => 'multiple', ) ); - //add/remove buttons for groups - $inG->setButtonAttributes('add', array('value' => ts('Add >>')));; - $outG->setButtonAttributes('add', array('value' => ts('Add >>')));; - $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));; - $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));; - - //add/remove buttons for tags - $int->setButtonAttributes('add', array('value' => ts('Add >>')));; - $outt->setButtonAttributes('add', array('value' => ts('Add >>')));; - $int->setButtonAttributes('remove', array('value' => ts('<< Remove')));; - $outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));; - $defaults = array( 'andOr' => empty($this->_andOr) ? 0 : 1, ); diff --git a/CRM/Contact/Form/Task/Merge.php b/CRM/Contact/Form/Task/Merge.php index 54d3749e4..c4a73b7b1 100644 --- a/CRM/Contact/Form/Task/Merge.php +++ b/CRM/Contact/Form/Task/Merge.php @@ -58,6 +58,16 @@ function preProcess() { $statusMsg = ts('Minimum two contact records are required to perform merge operation.'); } + // do check for contact is admin or not + foreach ($contactIds as $key => $id) { + $sql = "SELECT uf_id FROM `civicrm_uf_match` where contact_id = %1"; + $params = array( 1 => array($id, 'Integer')); + $uid = CRM_Core_DAO::singleValueQuery($sql, $params); + if ($uid == 1) { + $statusMsg = ts('Cannot merge with the administrator, please recheck the selected contacts.'); + } + } + // do check for same contact type. $contactTypes = array(); if (!$statusMsg) { diff --git a/CRM/Contact/Form/Task/SMSCommon.php b/CRM/Contact/Form/Task/SMSCommon.php index 2b8771f3f..80af57738 100644 --- a/CRM/Contact/Form/Task/SMSCommon.php +++ b/CRM/Contact/Form/Task/SMSCommon.php @@ -111,9 +111,11 @@ public static function buildQuickForm(&$form) { while ($mobilePhoneResult->fetch()) { if (!empty(trim($mobilePhoneResult->phone))) { $contactId = $mobilePhoneResult->contact_id; - $form->_contactDetails[$contactId]['phone_id'] = $mobilePhoneResult->phone_id; - $form->_contactDetails[$contactId]['phone'] = trim($mobilePhoneResult->phone); - $form->_contactDetails[$contactId]['phone_type_id'] = $mobilePhoneResult->phone_type_id; + if (!isset($form->_contactDetails[$contactId]['phone_id'])) { + $form->_contactDetails[$contactId]['phone_id'] = $mobilePhoneResult->phone_id; + $form->_contactDetails[$contactId]['phone'] = trim($mobilePhoneResult->phone); + $form->_contactDetails[$contactId]['phone_type_id'] = $mobilePhoneResult->phone_type_id; + } } } diff --git a/CRM/Contribute/BAO/PCP.php b/CRM/Contribute/BAO/PCP.php index 4a859f782..89429ab4e 100644 --- a/CRM/Contribute/BAO/PCP.php +++ b/CRM/Contribute/BAO/PCP.php @@ -383,32 +383,30 @@ static function deleteById($id = NULL) { } /** - * Function to Approve / Reject the campaign page + * Approve / Reject / Back to draft, enable / disable page and send email notification * * @param int $id campaign page id + * @param int|bool $statusId bool for set is_active, number for set status_id * * @return null * @access public * @static * */ - static function setIsActive($id, $is_active) { - switch ($is_active) { - case 0: - $is_active = 3; - break; + static function setIsActive($id, $statusId) { + if ($statusId === TRUE || $statusId === FALSE) { + return self::setDisable($id, $statusId); + } - case 1: - $is_active = 2; - break; + $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus(); + if (!in_array($statusId, array_keys($pcpStatus))) { + return; } - CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_PCP', $id, 'status_id', $is_active); + CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_PCP', $id, 'status_id', $statusId); - require_once 'CRM/Contribute/PseudoConstant.php'; $pcpTitle = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $id, 'title'); - $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus(); - $pcpStatus = $pcpStatus[$is_active]; + $pcpStatus = $pcpStatus[$statusId]; CRM_Core_Session::setStatus(ts("%1 status has been updated to %2.", array( 1 => $pcpTitle, @@ -416,11 +414,15 @@ static function setIsActive($id, $is_active) { ))); // send status change mail - $result = self::sendStatusUpdate($id, $is_active); + $result = self::sendStatusUpdate($id, $statusId); if ($result) { CRM_Core_Session::setStatus(ts("A notification email has been sent to the supporter.")); } + else { + $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1'); + CRM_Core_Session::setStatus(ts('The site administrator needs to enter a valid \'FROM Email Address\' in Administer CiviCRM » Configure » Domain Information. The email address used may need to be a valid mail account with your email service provider.', array(1 => $fixUrl)), TRUE, 'warning'); + } } /** @@ -438,18 +440,14 @@ static function setIsActive($id, $is_active) { * */ static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE) { - require_once 'CRM/Contribute/PseudoConstant.php'; $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus('name'); + $pcpStatusLabel = CRM_Contribute_PseudoConstant::pcpStatus(); $config = CRM_Core_Config::singleton(); if (!isset($pcpStatus[$newStatus])) { return FALSE; } - require_once 'CRM/Utils/Mail.php'; - require_once 'Mail/mime.php'; - require_once 'CRM/Contact/BAO/Contact/Location.php'; - //set loginUrl $loginUrl = $config->userFrameworkBaseURL; switch (ucfirst($config->userFramework)) { @@ -472,16 +470,12 @@ static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE) { ); //get the default domain email address. - require_once 'CRM/Core/BAO/Domain.php'; list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(); - if (!$domainEmailAddress || $domainEmailAddress == 'info@FIXME.ORG') { - require_once 'CRM/Utils/System.php'; - $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1'); - return CRM_Core_Error::statusBounce(ts('The site administrator needs to enter a valid \'FROM Email Address\' in Administer CiviCRM » Configure » Domain Information. The email address used may need to be a valid mail account with your email service provider.', array(1 => $fixUrl))); + return FALSE; } - $receiptFrom = '"' . $domainEmailName . '" <' . $domainEmailAddress . '>'; + $receiptFrom = CRM_Utils_Mail::formatRFC822Email($domainEmailName, $domainEmailAddress); // get recipient (supporter) name and email $params = array('id' => $pcpId); @@ -509,13 +503,16 @@ static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE) { TRUE, NULL, FALSE, TRUE ); $tplParams['pcpInfoURL'] = $pcpInfoURL; - $tplParams['contribPageTitle'] = $contribPageTitle; + $cc = NULL; if ($emails = CRM_Utils_Array::value('notify_email', $pcpBlockInfo)) { $emailArray = explode(',', $emails); $tplParams['pcpNotifyEmailAddress'] = $emailArray[0]; + $cc = CRM_Utils_Array::implode(',', $emailArray); } // get appropriate message based on status $tplParams['pcpStatus'] = $pcpStatus[$newStatus]; + $tplParams['pcpStatusLabel'] = $pcpStatusLabel[$newStatus]; + $tplParams['pcpTitle'] = $pcpInfo['title']; $tplName = $isInitial ? 'pcp_supporter_notify' : 'pcp_status_change'; @@ -529,6 +526,7 @@ static function sendStatusUpdate($pcpId, $newStatus, $isInitial = FALSE) { 'from' => $receiptFrom, 'toName' => $name, 'toEmail' => $address, + 'cc' => $cc, ) ); return $sent; diff --git a/CRM/Contribute/DAO/AllPay.php b/CRM/Contribute/DAO/AllPay.php index 6e995ec72..b099ae4d3 100644 --- a/CRM/Contribute/DAO/AllPay.php +++ b/CRM/Contribute/DAO/AllPay.php @@ -196,13 +196,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_allpay'] = & $fields[$name]; + self::$_import['contribution_allpay'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -219,13 +219,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_allpay'] = & $fields[$name]; + self::$_export['contribution_allpay'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/Contribution.php b/CRM/Contribute/DAO/Contribution.php index 77e55d7b8..c8a12f819 100644 --- a/CRM/Contribute/DAO/Contribution.php +++ b/CRM/Contribute/DAO/Contribution.php @@ -690,13 +690,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution'] = & $fields[$name]; + self::$_import['contribution'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -713,13 +713,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution'] = & $fields[$name]; + self::$_export['contribution'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/ContributionPage.php b/CRM/Contribute/DAO/ContributionPage.php index 840f51dfe..f00f1f947 100644 --- a/CRM/Contribute/DAO/ContributionPage.php +++ b/CRM/Contribute/DAO/ContributionPage.php @@ -736,13 +736,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_page'] = & $fields[$name]; + self::$_import['contribution_page'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -759,13 +759,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_page'] = & $fields[$name]; + self::$_export['contribution_page'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/ContributionProduct.php b/CRM/Contribute/DAO/ContributionProduct.php index f82cc5b27..177e1547c 100644 --- a/CRM/Contribute/DAO/ContributionProduct.php +++ b/CRM/Contribute/DAO/ContributionProduct.php @@ -280,13 +280,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_product'] = & $fields[$name]; + self::$_import['contribution_product'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -303,13 +303,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_product'] = & $fields[$name]; + self::$_export['contribution_product'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 6ca365031..b32c3533a 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -458,13 +458,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_recur'] = & $fields[$name]; + self::$_import['contribution_recur'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -481,13 +481,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_recur'] = & $fields[$name]; + self::$_export['contribution_recur'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -537,7 +537,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contribute_DAO_ContributionRecur::getEnums(); + $enumFields = &CRM_Contribute_DAO_ContributionRecur::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contribute_DAO_ContributionRecur::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contribute/DAO/ContributionSoft.php b/CRM/Contribute/DAO/ContributionSoft.php index ac4fc96a8..050165206 100644 --- a/CRM/Contribute/DAO/ContributionSoft.php +++ b/CRM/Contribute/DAO/ContributionSoft.php @@ -293,13 +293,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_soft'] = & $fields[$name]; + self::$_import['contribution_soft'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -316,13 +316,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_soft'] = & $fields[$name]; + self::$_export['contribution_soft'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/ContributionType.php b/CRM/Contribute/DAO/ContributionType.php index 1a3818a28..b9f2883be 100644 --- a/CRM/Contribute/DAO/ContributionType.php +++ b/CRM/Contribute/DAO/ContributionType.php @@ -247,13 +247,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_type'] = & $fields[$name]; + self::$_import['contribution_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -270,13 +270,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_type'] = & $fields[$name]; + self::$_export['contribution_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/LinePay.php b/CRM/Contribute/DAO/LinePay.php index bcd7cde2d..e403a8d93 100644 --- a/CRM/Contribute/DAO/LinePay.php +++ b/CRM/Contribute/DAO/LinePay.php @@ -292,13 +292,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_linepay'] = & $fields[$name]; + self::$_import['contribution_linepay'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -315,13 +315,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_linepay'] = & $fields[$name]; + self::$_export['contribution_linepay'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/PCP.php b/CRM/Contribute/DAO/PCP.php index eb9327164..aaad79728 100644 --- a/CRM/Contribute/DAO/PCP.php +++ b/CRM/Contribute/DAO/PCP.php @@ -327,13 +327,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['pcp'] = & $fields[$name]; + self::$_import['pcp'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -350,13 +350,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['pcp'] = & $fields[$name]; + self::$_export['pcp'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/PCPBlock.php b/CRM/Contribute/DAO/PCPBlock.php index 7ba3a4b59..c624f4b38 100644 --- a/CRM/Contribute/DAO/PCPBlock.php +++ b/CRM/Contribute/DAO/PCPBlock.php @@ -286,13 +286,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['pcp_block'] = & $fields[$name]; + self::$_import['pcp_block'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -309,13 +309,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['pcp_block'] = & $fields[$name]; + self::$_export['pcp_block'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/Premium.php b/CRM/Contribute/DAO/Premium.php index 77662c7b5..7c3aa65f1 100644 --- a/CRM/Contribute/DAO/Premium.php +++ b/CRM/Contribute/DAO/Premium.php @@ -270,13 +270,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['premiums'] = & $fields[$name]; + self::$_import['premiums'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -293,13 +293,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['premiums'] = & $fields[$name]; + self::$_export['premiums'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/PremiumsProduct.php b/CRM/Contribute/DAO/PremiumsProduct.php index 1f4518f4f..9b32340f0 100644 --- a/CRM/Contribute/DAO/PremiumsProduct.php +++ b/CRM/Contribute/DAO/PremiumsProduct.php @@ -211,13 +211,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['premiums_product'] = & $fields[$name]; + self::$_import['premiums_product'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -234,13 +234,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['premiums_product'] = & $fields[$name]; + self::$_export['premiums_product'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/Product.php b/CRM/Contribute/DAO/Product.php index 3a1186afa..1df882a73 100644 --- a/CRM/Contribute/DAO/Product.php +++ b/CRM/Contribute/DAO/Product.php @@ -396,13 +396,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['product'] = & $fields[$name]; + self::$_import['product'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -419,13 +419,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['product'] = & $fields[$name]; + self::$_export['product'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -487,7 +487,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Contribute_DAO_Product::getEnums(); + $enumFields = &CRM_Contribute_DAO_Product::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Contribute_DAO_Product::tsEnum($enum, $values[$enum]); diff --git a/CRM/Contribute/DAO/TaiwanACH.php b/CRM/Contribute/DAO/TaiwanACH.php index 818018c20..344e3c388 100644 --- a/CRM/Contribute/DAO/TaiwanACH.php +++ b/CRM/Contribute/DAO/TaiwanACH.php @@ -361,13 +361,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_taiwanach'] = & $fields[$name]; + self::$_import['contribution_taiwanach'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -384,13 +384,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_taiwanach'] = & $fields[$name]; + self::$_export['contribution_taiwanach'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/TapPay.php b/CRM/Contribute/DAO/TapPay.php index 5a2649c81..a4ab620fb 100644 --- a/CRM/Contribute/DAO/TapPay.php +++ b/CRM/Contribute/DAO/TapPay.php @@ -315,13 +315,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_tappay'] = & $fields[$name]; + self::$_import['contribution_tappay'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -338,13 +338,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_tappay'] = & $fields[$name]; + self::$_export['contribution_tappay'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/TapPayLog.php b/CRM/Contribute/DAO/TapPayLog.php index 847d5a6d4..50bcc0c9c 100644 --- a/CRM/Contribute/DAO/TapPayLog.php +++ b/CRM/Contribute/DAO/TapPayLog.php @@ -234,13 +234,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_tappay_log'] = & $fields[$name]; + self::$_import['contribution_tappay_log'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -257,13 +257,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_tappay_log'] = & $fields[$name]; + self::$_export['contribution_tappay_log'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/DAO/Widget.php b/CRM/Contribute/DAO/Widget.php index 6480ab774..0fe98a4e3 100644 --- a/CRM/Contribute/DAO/Widget.php +++ b/CRM/Contribute/DAO/Widget.php @@ -366,13 +366,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['contribution_widget'] = & $fields[$name]; + self::$_import['contribution_widget'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -389,13 +389,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['contribution_widget'] = & $fields[$name]; + self::$_export['contribution_widget'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 38a5f9d9e..d9f6aa801 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -115,7 +115,7 @@ public function preProcess() { if ($this->_values['is_internal'] > 0) { $this->assign('isInternal', TRUE); } - + // refs #29618, load contribution id and add defaultFromRequest again $this->loadDefaultFromOriginalId(); } @@ -282,7 +282,7 @@ function setDefaultValues() { $fields["email-Primary"] = 1; require_once "CRM/Core/BAO/UFGroup.php"; - + CRM_Core_BAO_UFGroup::setProfileDefaults($contactID, $fields, $this->_defaults); // refs #29618, add mask on default personal data if (!empty($this->_originalId) && empty($this->_ppType)) { @@ -551,7 +551,7 @@ function setDefaultValues() { } if (!empty($this->_defaultFromRequest['ppid'])) { $this->_defaults['payment_processor'] = $this->_defaultFromRequest['ppid']; - } + } } } @@ -786,10 +786,28 @@ public function buildQuickForm() { if(!empty($this->_submitValues['receipt_type'])){ $this->assign('receipt_type',$this->_submitValues['receipt_type']); } - + $achievement = CRM_Contribute_BAO_ContributionPage::goalAchieved($this->_id); $this->assign('achievement', $achievement); + $template = CRM_Core_Smarty::singleton(); + $progress = array( + 'type' => $achievement['type'], + 'label' => $achievement['label'], + 'goal' => $achievement['goal'], + 'current' => $achievement['current'], + 'achieved_percent' => $achievement['percent'], + 'achieved_status' => $achievement['achieved'], + 'fullwidth' => FALSE, + 'display' => $achievement['goal'] ? TRUE : FALSE, + ); + + $introTextAssigned = $template->get_template_vars('intro_text') !== null; + if ($introTextAssigned) { + $progress['link_display'] = TRUE; + } + $this->assign('progress', $progress); + // hidden track id $this->addElement('hidden', 'track', $this->get('trackId')); } @@ -802,7 +820,7 @@ public function buildQuickForm() { */ function buildAmount($separateMembershipPayment = FALSE) { $elements = array(); - $defaultFromRequestAmountId = NULL; + $defaultFromRequestAmountId = NULL; // set default display if (!empty($this->_defaultFromRequest['grouping'])) { $this->_defaultAmountGrouping = $this->_defaultFromRequest['grouping']; @@ -1068,7 +1086,7 @@ function buildRecur() { $units[$val] = ts($unitTrans[$val]); } } - + if (count($units) > 1) { $this->add('select', 'frequency_unit', ts('Frequency'), $units); $recurOptionLabel = ts('Recurring contributions'); @@ -1096,7 +1114,7 @@ function buildRecur() { 'style' => 'max-width:100px', ); $this->addNumber('installments', ts('Installments'), $attributes['installments']); - if (isset($this->_defaultFromRequest['installments'])) { + if (isset($this->_defaultFromRequest['installments'])) { $this->_defaults['installments'] = $this->_defaultFromRequest['installments']; } $this->addRule('installments', ts('Number of installments must be a whole number.'), 'integer'); @@ -1371,7 +1389,7 @@ static function formRule($fields, $files, $self) { if ((float ) $amount <= 0.0) { return $errors; } - + $self->addFieldRequiredRule($errors, $fields ,$files); // make sure that credit card number and cvv are valid diff --git a/CRM/Contribute/Form/PCP/Campaign.php b/CRM/Contribute/Form/PCP/Campaign.php index 97ce88e91..591b3fa1c 100644 --- a/CRM/Contribute/Form/PCP/Campaign.php +++ b/CRM/Contribute/Form/PCP/Campaign.php @@ -32,8 +32,6 @@ * $Id$ * */ -require_once 'CRM/Core/Form.php'; -require_once 'CRM/Contribute/BAO/PCP.php'; /** * This class generates form components for processing a ontribution @@ -42,6 +40,11 @@ class CRM_Contribute_Form_PCP_Campaign extends CRM_Core_Form { public $_context; + private $_key; + private $_pageId; + private $_contactID; + private $_contriPageId; + public function preProcess() { // we do not want to display recently viewed items, so turn off $this->assign('displayRecent', FALSE); @@ -59,10 +62,28 @@ public function preProcess() { $this->_pageId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); $this->_contactID = CRM_Utils_Request::retrieve('contactID', 'Positive', $this, FALSE); + $pcpShowPreview = CRM_Utils_Request::retrieve('preview', 'Positive', $this, FALSE); + if (!empty($pcpShowPreview)) { + $this->assign('pcp_show_preview', TRUE); + } $title = ts('Setup a Personal Campaign Page - Step 2'); if ($this->_pageId) { $title = ts('Edit Your Personal Campaign Page'); + $queryParams = array( + 'reset' => 1, + 'id' => $this->_pageId, + 'embed' => 1, + 'preview' => 1, + ); + if ($this->_key) { + $queryParams['key'] = $this->_key; + } + $pcpPagePreviewUrl = CRM_Utils_System::url("civicrm/contribute/pcp/info", http_build_query($queryParams, '', '&'), + TRUE, NULL, FALSE, + TRUE + ); + $this->assign('pcp_page_preview_url', $pcpPagePreviewUrl); } CRM_Utils_System::setTitle($title); @@ -71,7 +92,6 @@ public function preProcess() { } function setDefaultValues() { - require_once 'CRM/Contribute/DAO/PCP.php'; $dafaults = array(); $dao = new CRM_Contribute_DAO_PCP(); @@ -82,7 +102,6 @@ function setDefaultValues() { } // fix the display of the monetary value, CRM-4038 if (isset($defaults['goal_amount'])) { - require_once 'CRM/Utils/Money.php'; $defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a'); } @@ -110,42 +129,95 @@ function setDefaultValues() { * @access public */ public function buildQuickForm() { + $isManager = CRM_Core_Permission::check('administer CiviCRM'); + $pcpValues = array(); + $statusDraftId = CRM_Core_OptionGroup::getValue('pcp_status', 'Draft', 'name'); + $statusApprovedId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name')); + $statusWaitingId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Waiting Review', 'name')); + if (!empty($this->_pageId)) { + $dao = new CRM_Contribute_DAO_PCP(); + $dao->id = $this->_pageId; + if ($dao->find(TRUE)) { + CRM_Core_DAO::storeValues($dao, $pcpValues); + } + $statusId = $pcpValues['status_id']; + } + else { + $statusId = $statusDraftId; + } + + $contribPageId = !empty($pcpValues['contribution_page_id']) ? $pcpValues['contribution_page_id'] : $this->get('contribution_page_id'); + $approvalNeeded = FALSE; + if (!empty($contribPageId)) { + $approvalNeeded = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCPBlock', $contribPageId, 'is_approval_needed', 'entity_id'); + } + if ($this->_key) { $this->add('hidden', 'key', $this->_key); } - $this->add('text', 'title', ts('Title'), NULL, TRUE); - $this->add('textarea', 'intro_text', ts('Event Summary'), NULL, TRUE); - $this->add('text', 'goal_amount', ts('Your Goal'), NULL, TRUE); + + $readOnly = array(); + $readOnly[] = $this->add('text', 'title', ts('Title'), NULL, TRUE); + $readOnly[] = $this->add('textarea', 'intro_text', ts('Event Summary'), NULL, TRUE); + $readOnly[] = $this->add('text', 'goal_amount', ts('Your Goal'), NULL, TRUE); $this->addRule('goal_amount', ts('Goal Amount should be a numeric value'), 'money'); $attributes = array(); if ($this->get('action') & CRM_Core_Action::ADD) { $attributes = array('value' => ts('Donate Now'), 'onClick' => 'select();'); } + $this->add('hidden', 'preset_image', ''); + $this->addRule('preset_image', ts('The preset image value should be numeric.'), 'numeric'); + $this->add('text', 'donate_link_text', ts('Donation Button'), $attributes); $attrib = array('rows' => 8, 'cols' => 60); - $this->addWysiwyg('page_text', ts('Your Message'), $attrib); - // $this->add('textarea', 'page_text', ts('Your Message'), null, false ); + $readOnly[] = $this->addWysiwyg('page_text', ts('Your Message'), $attrib); $maxAttachments = 5; CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments, array('accept' => 'image/x-png,image/gif,image/jpeg', 'multiple' => 'multiple')); + if (CRM_Utils_Array::arrayKeyExists('attachFile[]', $this->_elementIndex)) { + $readOnly[] = $this->getElement('attachFile[]'); + } + if (CRM_Utils_Array::arrayKeyExists('is_delete_attachment', $this->_elementIndex)) { + $readOnly[] = $this->getElement('is_delete_attachment'); + } + + $readOnly[] = $this->addElement('radio', 'is_thermometer', ts('Display progress bar and amount raised'), '', '1'); + $readOnly[] = $this->addElement('radio', 'is_thermometer', ts('Display amount raised only'), '', '2'); + $readOnly[] = $this->addElement('radio', 'is_thermometer', ts('Do not display either'), '', '0'); + $readOnly[] = $this->addElement('checkbox', 'is_honor_roll', ts('Honor Roll'), NULL); + $isActive = $this->addElement('checkbox', 'is_active', ts('Active')); + $readOnly[] = $isActive; + + if (!in_array($statusId, array($statusApprovedId)) && !$isManager) { + $isActive->freeze(); + } + if (!in_array($statusId, array($statusDraftId)) && !$isManager) { + foreach($readOnly as &$element) { + $element->freeze(); + } + } - $this->addElement('checkbox', 'is_thermometer', ts('Progress Bar')); - $this->addElement('checkbox', 'is_honor_roll', ts('Honor Roll'), NULL); - $this->addElement('checkbox', 'is_active', ts('Active')); - - $this->addButtons(array( - array( - 'type' => 'upload', - 'name' => ts('Save'), - 'isDefault' => TRUE, - ), - array( - 'type' => 'cancel', - 'name' => ts('Cancel'), - ), - ) + $buttons = array(); + if ($statusId === $statusDraftId || $isManager) { + $buttons[] = array( + 'type' => 'attach', + 'name' => ts('Save and Preview'), + 'isDefault' => TRUE, + ); + } + if ($statusId === $statusDraftId) { + $submitText = !empty($approvalNeeded) ? ts('Submit').' ('.ts('Requires Approval').')' : ts('Submit'); + $buttons[] = array( + 'type' => 'upload', + 'name' => $submitText, + ); + } + $buttons[] = array( + 'type' => 'cancel', + 'name' => ts('Cancel'), ); + $this->addButtons($buttons); $this->addFormRule(array('CRM_Contribute_Form_PCP_Campaign', 'formRule'), $this); } @@ -181,6 +253,7 @@ static function formRule($fields, $files, $self) { */ public function postProcess() { $params = $this->controller->exportValues(); + $buttonName = $this->controller->getButtonName(); $checkBoxes = array('is_thermometer', 'is_honor_roll', 'is_active'); foreach ($checkBoxes as $key) { @@ -193,6 +266,9 @@ public function postProcess() { if (!$contactID) { $contactID = $this->get('contactID'); } + if (!$session->get('userID')) { + $session->set('pcpAnonymousContactId', $contactID); + } $params['contact_id'] = $contactID; $params['contribution_page_id'] = $this->get('contribution_page_id') ? $this->get('contribution_page_id') : $this->_contriPageId; @@ -202,15 +278,27 @@ public function postProcess() { $params['contribution_page_id'], 'is_approval_needed', 'entity_id' ); $approvalMessage = NULL; - if ($this->get('action') & CRM_Core_Action::ADD) { - $params['status_id'] = $approval_needed ? 1 : 2; + $statusDraftId = CRM_Core_OptionGroup::getValue('pcp_status', 'Draft', 'name'); + $statusWaitReviewId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Waiting Review', 'name')); + $statusApprovedId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name')); + if ($buttonName == '_qf_Campaign_upload') { + $params['status_id'] = $approval_needed ? $statusWaitReviewId : $statusApprovedId; $approvalMessage = $approval_needed ? ts('but requires administrator review before you can begin your fundraising efforts. You will receive an email confirmation shortly which includes a link to return to your fundraising page.') : ts('and is ready to use.'); } + else { + if ($this->get('action') & CRM_Core_Action::ADD) { + $params['status_id'] = $statusDraftId; + } + else { + // do not update status when update and button is Save and Preview + unset($params['status_id']); + } + } $params['id'] = $this->_pageId; - require_once 'CRM/Contribute/BAO/PCP.php'; $pcp = CRM_Contribute_BAO_PCP::add($params, FALSE); + $session->set('pcpAnonymousPageId', $pcp->id); // add attachments as needed $maxAttachments = 5; @@ -225,6 +313,33 @@ public function postProcess() { $notifyStatus = ""; CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCPBlock', $pcpParams, $notifyParams, array('notify_email')); + $attachmentIsExist = !empty($params['is_delete_attachment']) && !empty($params['attachFile_0']['location']); + + // If an attachment file is present, reset the 'preset_image' + // We give priority to the user-uploaded attachment file as the main image for the PCP + if ($attachmentIsExist) { + $params['preset_image'] = ''; + } + + if (!$attachmentIsExist && !empty($params['preset_image'])) { + $config = CRM_Core_Config::singleton(); + $pcpPresetNum = CRM_Utils_Type::escape($params['preset_image'], 'Integer'); + $pcpPresetFile = 'pcp_preset_'.$pcpPresetNum.'.png'; + $dest = $config->customFileUploadDir.$pcpPresetFile; + global $civicrm_root; + if (!file_exists($dest) && file_exists($civicrm_root.'packages/midjourney/'.$pcpPresetFile)) { + $src = $civicrm_root.'packages/midjourney/'.$pcpPresetFile; + copy($src, $dest); + } + $params['attachFile_0'] = array( + 'uri' => $dest, + 'location' => $dest, + 'type' => 'image/png', + 'upload_date' => '20231024025850', + ); + } + CRM_Core_BAO_File::processAttachment($params, 'civicrm_pcp', $pcp->id, $maxAttachments); + if ($emails = CRM_Utils_Array::value('notify_email', $notifyParams)) { $this->assign('pcpTitle', $pcp->title); @@ -234,7 +349,6 @@ public function postProcess() { else { $this->assign('mode', 'Add'); } - require_once 'CRM/Core/OptionGroup.php'; $pcpStatus = CRM_Core_OptionGroup::getLabel('pcp_status', $statusId); $this->assign('pcpStatus', $pcpStatus); @@ -259,56 +373,41 @@ public function postProcess() { $this->assign('contribPageTitle', $contribPageTitle); $managePCPUrl = CRM_Utils_System::url("civicrm/admin/pcp", - "reset=1", + "reset=1&contribution_page_id={$pcp->contribution_page_id}", TRUE, NULL, FALSE, FALSE ); $this->assign('managePCPUrl', $managePCPUrl); - //get the default domain email address. - require_once 'CRM/Core/BAO/Domain.php'; + // send admin notification when submit button pressed list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(); - - if (!$domainEmailAddress || $domainEmailAddress == 'info@FIXME.ORG') { - require_once 'CRM/Utils/System.php'; - $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1'); - CRM_Core_Error::fatal(ts('The site administrator needs to enter a valid \'FROM Email Address\' in Administer CiviCRM » Configure » Domain Information. The email address used may need to be a valid mail account with your email service provider.', array(1 => $fixUrl))); - } - - //if more than one email present for PCP notification , - //first email take it as To and other as CC and First email - //address should be sent in users email receipt for - //support purpose. - $emailArray = explode(',', $emails); - $to = $emailArray[0]; - unset($emailArray[0]); - $cc = CRM_Utils_Array::implode(',', $emailArray); - - require_once 'CRM/Core/BAO/MessageTemplates.php'; - list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( - array( - 'groupName' => 'msg_tpl_workflow_contribution', - 'valueName' => 'pcp_notify', - 'contactId' => $contactID, - 'from' => "$domainEmailName <$domainEmailAddress>", - 'toEmail' => $to, - 'cc' => $cc, - ) - ); - - if ($sent) { - $notifyStatus = ts('A notification email has been sent to the site administrator.'); + if ($domainEmailAddress && $domainEmailAddress != 'info@FIXME.ORG' && $buttonName == '_qf_Campaign_upload') { + $emailArray = explode(',', $emails); + $to = trim($emailArray[0]); + unset($emailArray[0]); + $cc = CRM_Utils_Array::implode(',', $emailArray); + list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate( + array( + 'groupName' => 'msg_tpl_workflow_contribution', + 'valueName' => 'pcp_notify', + 'contactId' => $contactID, + 'from' => CRM_Utils_Mail::formatRFC822Email($domainEmailName, $domainEmailAddress), + 'toEmail' => $to, + 'cc' => $cc, + ) + ); } } - CRM_Core_BAO_File::processAttachment($params, 'civicrm_pcp', $pcp->id, $maxAttachments); - // send email notification to supporter, if initial setup / add mode. + // send welcome mail to Draft user or Waiting for review user if (!$this->_pageId) { + // whatever button they press, send welcome mail to them + CRM_Contribute_BAO_PCP::sendStatusUpdate($pcp->id, $statusId, TRUE); + } + elseif (in_array($statusId, array($statusApprovedId, $statusWaitReviewId)) && $buttonName == '_qf_Campaign_upload') { + // submit button pressed, welcome again if needed CRM_Contribute_BAO_PCP::sendStatusUpdate($pcp->id, $statusId, TRUE); - if ($approvalMessage && CRM_Utils_Array::value('status_id', $params) == 1) { - $notifyStatus .= ts(' You will receive a second email as soon as the review process is complete.'); - } } //check if pcp created by anonymous user @@ -317,9 +416,14 @@ public function postProcess() { $anonymousPCP = 1; } - CRM_Core_Session::setStatus(ts("Your Personal Campaign Page has been %1 %2 %3", - array(1 => $pageStatus, 2 => $approvalMessage, 3 => $notifyStatus) - )); + if ($statusId == $statusApprovedId) { + $contributionPageTitle = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $pcp->contribution_page_id, 'title'); + CRM_Core_Session::setStatus(ts('Thanks for creating a personal campaign page in support of %1.', array(1 => $contributionPageTitle))); + CRM_Core_Session::setStatus(ts('Your Personal Campaign Page is now available for public access.').' '.ts('Congratulations!').' '.ts('You can now openly share the page to gather more donations for your fundraising campaign!')); + } + else { + CRM_Core_Session::setStatus(ts("Your Personal Campaign Page has been %1 %2 %3", array(1 => $pageStatus, 2 => $approvalMessage, 3 => $notifyStatus))); + } if ($this->_context == 'dashboard') { // $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcp->id}&ap={$anonymousPCP}")); if (!empty($params['key'])) { @@ -329,11 +433,33 @@ public function postProcess() { $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/pcp', "reset=1")); } } - elseif (!$this->_pageId) { - $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcp->id}&ap={$anonymousPCP}")); + // comes from pcp account creation and controller + elseif (is_a($this->controller, 'CRM_Contribute_Controller_PCP')) { + if ($buttonName == '_qf_Campaign_attach') { + if ($anonymousPCP) { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "action=update&reset=1&id={$pcp->id}&preview=1&key={$this->controller->_key}")); + } + else { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "action=update&reset=1&id={$pcp->id}&preview=1")); + } + } + else { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcp->id}&ap={$anonymousPCP}")); + } } - elseif ($this->_context == 'standalone') { - $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcp->id}&ap={$anonymousPCP}")); + // comes from edit page + elseif (is_a($this->controller, 'CRM_Core_Controller_Simple')) { + if ($buttonName == '_qf_Campaign_attach') { + if ($anonymousPCP) { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "action=update&reset=1&id={$pcp->id}&preview=1&key={$this->_key}")); + } + else { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "action=update&reset=1&id={$pcp->id}&preview=1")); + } + } + else { + $session->pushUserContext(CRM_Utils_System::url('civicrm/contribute/pcp/info', "reset=1&id={$pcp->id}")); + } } } } diff --git a/CRM/Contribute/Form/PCP/PCP.php b/CRM/Contribute/Form/PCP/PCP.php index 5516fa811..b1e2aac18 100644 --- a/CRM/Contribute/Form/PCP/PCP.php +++ b/CRM/Contribute/Form/PCP/PCP.php @@ -52,7 +52,7 @@ public function preProcess() { if ($this->_action & CRM_Core_Action::DELETE) { //check permission for action. if (!CRM_Core_Permission::checkActionPermission('CiviContribute', $this->_action)) { - return CRM_Core_Error::statusBounce(ts('You do not have permission to access this page')); + return CRM_Core_Error::statusBounce(ts('You do not have permission to access this page')); } $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); @@ -74,42 +74,39 @@ public function preProcess() { $userID = $session->get('userID'); //do not allow destructive actions without permissions - $permission = FALSE; if (!$userID) { CRM_Utils_System::permissionDenied(); } - if (CRM_Core_Permission::check('administer CiviCRM') || - ($userID && (CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', - $this->_id, - 'contact_id' - ) == $userID)) - ) { - $permission = TRUE; + $isManager = $isOwner = FALSE; + if (CRM_Core_Permission::check('administer CiviCRM')) { + $isManager = TRUE; } - if ($permission && $this->_id) { - - require_once 'CRM/Contribute/BAO/PCP.php'; + if ($userID && $this->_id && (CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'contact_id') == $userID)) { + $isOwner = TRUE; + } + if (($isOwner || $isManager) && $this->_id) { $this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'title'); - switch ($this->_action) { - case CRM_Core_Action::DELETE: - case 'delete': - CRM_Contribute_BAO_PCP::deleteById($this->_id); - CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title))); - break; - - case CRM_Core_Action::DISABLE: - case 'disable': - CRM_Contribute_BAO_PCP::setDisable($this->_id, '0'); - CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been disabled.", array(1 => $this->_title))); - break; - - case CRM_Core_Action::ENABLE: - case 'enable': - CRM_Contribute_BAO_PCP::setDisable($this->_id, '1'); - CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been enabled.", array(1 => $this->_title))); - break; + $statusId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'status_id'); + $statusApprovedId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name')); + if ($isManager && ($this->_action == CRM_Core_Action::DELETE || $this->_action == 'delete')) { + CRM_Contribute_BAO_PCP::deleteById($this->_id); + CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title))); + } + elseif ($isManager || ($isOwner && $statusId == $statusApprovedId)) { + switch ($this->_action) { + case CRM_Core_Action::DISABLE: + case 'disable': + CRM_Contribute_BAO_PCP::setDisable($this->_id, '0'); + CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been disabled.", array(1 => $this->_title))); + break; + + case CRM_Core_Action::ENABLE: + case 'enable': + CRM_Contribute_BAO_PCP::setDisable($this->_id, '1'); + CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been enabled.", array(1 => $this->_title))); + break; + } } - if ($context) { CRM_Utils_System::redirect($context); } @@ -160,7 +157,7 @@ public function buildQuickForm() { else { require_once 'CRM/Contribute/PseudoConstant.php'; $status = array_merge( - array(ts('- select -')), + array('' => ts('- select -')), CRM_Contribute_PseudoConstant::pcpstatus() ); $contribution_page = array_merge( @@ -178,7 +175,7 @@ public function buildQuickForm() { } $this->addSelect('status_id', ts('Status'), $status); - $this->addSelect('contribution_page_id', ts('Contribution Page'), $contribution_page); + $this->addSelect('contribution_page_id', ts('Belonging Main Contribution Page'), $contribution_page); $this->addSelect('contact_id', ts('Created by'), $contacts); $this->add('text', 'title', ts('Page Title')); $this->addButtons(array( diff --git a/CRM/Contribute/Form/PCP/PCPAccount.php b/CRM/Contribute/Form/PCP/PCPAccount.php index bdbd441a7..3b59697f2 100644 --- a/CRM/Contribute/Form/PCP/PCPAccount.php +++ b/CRM/Contribute/Form/PCP/PCPAccount.php @@ -227,6 +227,7 @@ public function buildQuickForm() { } $this->addFormRule(array('CRM_Contribute_Form_PCP_PCPAccount', 'formRule'), $this); $this->addButtons($button); + $this->assign('isPcP', TRUE); } /** diff --git a/CRM/Contribute/Page/PCP.php b/CRM/Contribute/Page/PCP.php index 295918ee8..b95227a3e 100644 --- a/CRM/Contribute/Page/PCP.php +++ b/CRM/Contribute/Page/PCP.php @@ -81,12 +81,21 @@ function &links() { 'url' => 'civicrm/admin/pcp', 'qs' => 'action=renew&id=%%id%%', 'title' => ts('Approve Personal Campaign Page'), + 'class' => 'dialog approve', ), CRM_Core_Action::REVERT => array( 'name' => ts('Reject'), 'url' => 'civicrm/admin/pcp', 'qs' => 'action=revert&id=%%id%%', 'title' => ts('Reject Personal Campaign Page'), + 'class' => 'dialog reject', + ), + CRM_Core_Action::PREVIEW => array( + 'name' => ts('Revoke to Draft'), + 'url' => 'civicrm/admin/pcp', + 'qs' => 'action=preview&id=%%id%%', + 'title' => ts('Revoke Personal Campaign Page to Draft status'), + 'class' => 'dialog revoke', ), CRM_Core_Action::DELETE => array( 'name' => ts('Delete'), @@ -95,6 +104,18 @@ function &links() { 'extra' => 'onclick = "return confirm(\'' . $deleteExtra . '\');"', 'title' => ts('Delete Personal Campaign Page'), ), + CRM_Core_Action::DISABLE => array( + 'name' => ts('Disable'), + 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_PCP' . '\',\'' . 'enable-disable' . '\' );"', + 'ref' => 'disable-action', + 'title' => ts('Disable Personal Campaign Pages'), + ), + CRM_Core_Action::ENABLE => array( + 'name' => ts('Enable'), + 'extra' => 'onclick = "enableDisable( %%id%%,\'' . 'CRM_Contribute_BAO_PCP' . '\',\'' . 'disable-enable' . '\' );"', + 'ref' => 'enable-action', + 'title' => ts('Enable Personal Campaign Pages'), + ), ); } return self::$_links; @@ -118,15 +139,24 @@ function run() { $this, FALSE, 'browse' ); + $statusApprovedId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name')); + $statusNotApprovedId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Not Approved', 'name')); + $statusDraftId = intval(CRM_Core_OptionGroup::getValue('pcp_status', 'Draft', 'name')); if ($action & CRM_Core_Action::REVERT) { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); - CRM_Contribute_BAO_PCP::setIsActive($id, 0); + CRM_Contribute_BAO_PCP::setIsActive($id, $statusNotApprovedId); $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')); } elseif ($action & CRM_Core_Action::RENEW) { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); - CRM_Contribute_BAO_PCP::setIsActive($id, 1); + CRM_Contribute_BAO_PCP::setIsActive($id, $statusApprovedId); + $session = CRM_Core_Session::singleton(); + $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')); + } + elseif ($action & CRM_Core_Action::PREVIEW) { + $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE); + CRM_Contribute_BAO_PCP::setIsActive($id, $statusDraftId); $session = CRM_Core_Session::singleton(); $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1')); } @@ -168,7 +198,8 @@ function browse($action = NULL) { $contribution_page = CRM_Contribute_PseudoConstant::contributionPage(); $whereClause = array(); - if ($status_id = CRM_Utils_Request::retrieve('status_id', 'Positive', $this)) { + $status_id = CRM_Utils_Request::retrieve('status_id', 'Integer', $this); + if (!empty($status_id) || $status_id === '0') { $whereClause[] = 'cp.status_id = %1'; $params['1'] = array($status_id, 'Integer'); } @@ -220,12 +251,36 @@ function browse($action = NULL) { } switch ($dao->status_id) { + case 0: + $action -= CRM_Core_Action::PREVIEW; + $action -= CRM_Core_Action::RENEW; + $action -= CRM_Core_Action::REVERT; + $action -= CRM_Core_Action::ENABLE; + $action -= CRM_Core_Action::DISABLE; + $action -= CRM_Core_Action::DELETE; + break; + + case 1: + $action -= CRM_Core_Action::DELETE; + $action -= CRM_Core_Action::ENABLE; + $action -= CRM_Core_Action::DISABLE; + break; + case 2: $action -= CRM_Core_Action::RENEW; + $action -= CRM_Core_Action::DELETE; + if ($dao->active == 1) { + $action -= CRM_Core_Action::ENABLE; + } else { + $action -= CRM_Core_Action::DISABLE; + } break; case 3: $action -= CRM_Core_Action::REVERT; + $action -= CRM_Core_Action::ENABLE; + $action -= CRM_Core_Action::DISABLE; + $action -= CRM_Core_Action::DELETE; break; } diff --git a/CRM/Contribute/Page/PCPInfo.php b/CRM/Contribute/Page/PCPInfo.php index 7a3ea165e..7f24d2046 100644 --- a/CRM/Contribute/Page/PCPInfo.php +++ b/CRM/Contribute/Page/PCPInfo.php @@ -33,14 +33,19 @@ * */ -require_once 'CRM/Core/Page.php'; -require_once 'CRM/Contribute/BAO/PCP.php'; /** * PCP Info Page - Summary about the PCP */ class CRM_Contribute_Page_PCPInfo extends CRM_Core_Page { + /** + * id for current pcp page + * + * @var int + */ + private $_id; + /** * Run the page. * @@ -55,73 +60,90 @@ class CRM_Contribute_Page_PCPInfo extends CRM_Core_Page { function run() { $session = CRM_Core_Session::singleton(); $config = CRM_Core_Config::singleton(); - $permissionCheck = FALSE; $statusMessage = ''; - if ($config->userFramework != 'Joomla') { - $permissionCheck = CRM_Core_Permission::check('administer CiviCRM'); - } + $permissionCheck = CRM_Core_Permission::check('administer CiviCRM'); + //get the pcp id. $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE); + $isEmbed = CRM_Utils_Request::retrieve('embed', 'Boolean', $this); + + // Convert the 'isEmbed' variable to a proper Boolean value. + // The strtobool method is used here because even if we specify 'Boolean' as the data type, + // the value retrieved from an HTTP request could still be a string (like "true", "false", "1", "0"). + // The strtobool method ensures that these string representations are correctly interpreted as Boolean values. + $isEmbed = CRM_Utils_String::strtobool($isEmbed); + + $this->assign('is_embed', $isEmbed); $prms = array('id' => $this->_id); CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_PCP', $prms, $pcpInfo); if (empty($pcpInfo)) { $statusMessage = ts('The personal campaign page you requested is currently unavailable.'); - return CRM_Core_Error::statusBounce($statusMessage, + return CRM_Core_Error::statusBounce($statusMessage, $config->userFrameworkBaseURL ); } + $contributionPageParams = array('id' => $pcpInfo['contribution_page_id']); + CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $contributionPageParams, $contributionPageInfo); + $this->assign('contribution_page', $contributionPageInfo); + CRM_Utils_System::setTitle($pcpInfo['title']); $this->assign('pcp', $pcpInfo); - require_once 'CRM/Contribute/PseudoConstant.php'; - require_once 'CRM/Core/OptionGroup.php'; + $currentUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'id=' . $this->_id . '&reset=1', ['absolute' => TRUE]); + $this->assign('currentUrl', $currentUrl); + + $shareData = array( + 'url' => urlencode($currentUrl), + 'title' => urlencode($pcpInfo['title']), + ); + $this->assign('share_data', $shareData); + $pcpStatus = CRM_Contribute_PseudoConstant::pcpStatus(); $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name'); - // check if PCP is created by anonymous user - $anonymousPCP = CRM_Utils_Request::retrieve('ap', 'Boolean', $this); - if ($anonymousPCP) { - $loginUrl = $config->userFrameworkBaseURL; - - switch (ucfirst($config->userFramework)) { - case 'Joomla': - $loginUrl = str_replace('administrator/', '', $loginUrl); - $loginUrl .= 'index.php?option=com_user&view=login'; - break; + // check if PCP has status message + if (!empty(CRM_Core_Session::singleton()->getStatus())) { + $this->assign('anonMessage', TRUE); + } + $statusMessage = ts('The personal campaign page you requested is currently unavailable. However you can still support the campaign by making a contribution here.'); - case 'Drupal': - $loginUrl .= 'user'; - break; + // check if PCP needs preview for specific user session + $userID = $session->get('userID'); + $validated = FALSE; + if (!$permissionCheck && !$userID && $pcpInfo['status_id'] != $approvedId) { + $qfKeyFromPCPController = CRM_Utils_Request::retrieve('key', 'String', $this); + $anonyContactId = $session->get('pcpAnonymousContactId'); + $validated = CRM_Core_Key::validate($qfKeyFromPCPController, 'CRM_Contribute_Controller_PCP', TRUE); + + if (empty($validated) || $anonyContactId != $pcpInfo['contact_id']) { + return CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', + "reset=1&id={$pcpInfo['contribution_page_id']}", + FALSE, NULL, FALSE, TRUE + )); } - - $anonMessage = ts('Once you\'ve received your new account welcome email, you can click here to login and promote your campaign page.', array(1 => $loginUrl)); - CRM_Core_Session::setStatus($anonMessage); - } - else { - $statusMessage = ts('The personal campaign page you requested is currently unavailable. However you can still support the campaign by making a contribution here.'); + $userID = $anonyContactId; } - - if ($pcpInfo['status_id'] != $approvedId || !$pcpInfo['is_active']) { + elseif ($pcpInfo['status_id'] != $approvedId || !$pcpInfo['is_active']) { if ($pcpInfo['contact_id'] != $session->get('userID') && !$permissionCheck) { - return CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', - "reset=1&id={$pcpInfo['contribution_page_id']}", - FALSE, NULL, FALSE, TRUE - )); + return CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', + "reset=1&id={$pcpInfo['contribution_page_id']}", + FALSE, NULL, FALSE, TRUE + )); } } else { $getStatus = CRM_Contribute_BAO_PCP::getStatus($this->_id); if (!$getStatus) { // PCP not enabled for this contribution page. Forward everyone to main contribution page - return CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', - "reset=1&id={$pcpInfo['contribution_page_id']}", - FALSE, NULL, FALSE, TRUE - )); + return CRM_Core_Error::statusBounce($statusMessage, CRM_Utils_System::url('civicrm/contribute/transact', + "reset=1&id={$pcpInfo['contribution_page_id']}", + FALSE, NULL, FALSE, TRUE + )); } } @@ -131,7 +153,6 @@ function run() { $pcpInfo['contribution_page_id'], $default, array('start_date', 'end_date') ); - require_once "CRM/Contribute/PseudoConstant.php"; $this->assign('pageName', CRM_Contribute_PseudoConstant::contributionPage($pcpInfo['contribution_page_id'], TRUE)); if ($pcpInfo['contact_id'] == $session->get('userID')) { @@ -139,15 +160,25 @@ function run() { $owner['status'] = CRM_Utils_Array::value($pcpInfo['status_id'], $pcpStatus); $this->assign('owner', $owner); - require_once 'CRM/Contribute/BAO/PCP.php'; $link = CRM_Contribute_BAO_PCP::pcpLinks(); - unset($link['all'][CRM_Core_Action::ENABLE]); + unset($link['all'][CRM_Core_Action::DELETE]); + if ($pcpInfo['status_id'] == $approvedId) { + if ($pcpInfo['is_active']) { + unset($link['all'][CRM_Core_Action::ENABLE]); + } + else { + unset($link['all'][CRM_Core_Action::DISABLE]); + } + } + else { + unset($link['all'][CRM_Core_Action::DISABLE]); + unset($link['all'][CRM_Core_Action::ENABLE]); + } $hints = array( CRM_Core_Action::UPDATE => ts('Change the content and appearance of your page'), CRM_Core_Action::DETACH => ts('Send emails inviting your friends to support your campaign!'), CRM_Core_Action::BROWSE => ts('Update your personal contact information'), CRM_Core_Action::DISABLE => ts('De-activate the page (you can re-activate it later)'), - CRM_Core_Action::DELETE => ts('Remove the page (this cannot be undone!)'), ); CRM_Core_DAO::commonRetrieveAll('CRM_Contribute_DAO_PCPBlock', $pcpInfo['contribution_page_id'], 'entity_id', $blockValues, array('is_tellfriend_enabled') @@ -183,14 +214,14 @@ function run() { ), ); CRM_Utils_System::addHTMLHead($meta); - $this->assign('pcpImageSrc', $encodedSrc); + $this->assign('pcp_image_src', $encodedSrc); } } $totalAmount = CRM_Contribute_BAO_PCP::thermoMeter($this->_id); $achieved = round($totalAmount / $pcpInfo['goal_amount'] * 100, 2); - + $linkDisplay = FALSE; if ($linkText = CRM_Contribute_BAO_PCP::getPcpBlockStatus($pcpInfo['contribution_page_id'])) { $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$pcpInfo['contribution_page_id']}", @@ -209,51 +240,57 @@ function run() { if ($achieved <= 100) { $this->assign('remaining', 100 - $achieved); } - // make sure that we are between registration start date and registration end date - $startDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('start_date', $owner)); - $endDate = CRM_Utils_Date::unixTime(CRM_Utils_Array::value('end_date', $owner)); - - $now = time(); - $validDate = TRUE; - if ($startDate && $startDate >= $now) { - $validDate = FALSE; - } - if ($endDate && $endDate < $now) { - $validDate = FALSE; + $contributionText = ts('Contribute Now'); + if (CRM_Utils_Array::value('donate_link_text', $pcpInfo)) { + $contributionText = $pcpInfo['donate_link_text']; } - $this->assign('validDate', TRUE); - if ($validDate) { - - $contributionText = ts('Contribute Now'); - if (CRM_Utils_Array::value('donate_link_text', $pcpInfo)) { - $contributionText = $pcpInfo['donate_link_text']; - } + $this->assign('contribution_text', $contributionText); - $this->assign('contributionText', $contributionText); + // we always generate urls for the front end in joomla + if ($action == CRM_Core_Action::PREVIEW) { + $contributeURL = CRM_Utils_System::url('civicrm/contribute/transact', + "id={$pcpInfo['contribution_page_id']}&pcpId={$this->_id}&reset=1&action=preview", + TRUE, NULL, TRUE, + TRUE + ); + } + else { + $contributeURL = CRM_Utils_System::url('civicrm/contribute/transact', + "id={$pcpInfo['contribution_page_id']}&pcpId={$this->_id}&reset=1", + TRUE, NULL, TRUE, + TRUE + ); + } + $this->assign('contribute_url', $contributeURL); + + $progress = array( + 'type' => 'amount', + 'label' => ts('Goal Amount'), + 'goal' => $pcpInfo['goal_amount'], + 'currency' => $pcpInfo['currency'], + 'fullwidth' => TRUE, + 'display' => $pcpInfo['is_thermometer'], + 'current' => $totalAmount, + 'achieved_percent' => floor($achieved) <= 100 ? $achieved : 100, + 'achieved_status'=> floor($achieved) >= 100 ? TRUE : FALSE, + 'contribution_page_is_active' => $contributionPageInfo['is_active'] + ); - // we always generate urls for the front end in joomla - if ($action == CRM_Core_Action::PREVIEW) { - $url = CRM_Utils_System::url('civicrm/contribute/transact', - "id={$pcpInfo['contribution_page_id']}&pcpId={$this->_id}&reset=1&action=preview", - TRUE, NULL, TRUE, - TRUE - ); - } - else { - $url = CRM_Utils_System::url('civicrm/contribute/transact', - "id={$pcpInfo['contribution_page_id']}&pcpId={$this->_id}&reset=1", - TRUE, NULL, TRUE, - TRUE - ); - } - $this->assign('contributeURL', $url); + if ($contributeURL) { + $linkDisplay = TRUE; + $progress['link_display'] = $linkDisplay; + $progress['link_url'] = $contributeURL; + $progress['link_text'] = $contributionText; } + $this->assign('progress', $progress); + $this->assign('link_display', $linkDisplay); // we do not want to display recently viewed items, so turn off $this->assign('displayRecent', FALSE); + $single = $permission = FALSE; switch ($action) { case CRM_Core_Action::BROWSE: @@ -269,16 +306,16 @@ function run() { break; } - $userID = $session->get('userID'); //make sure the user has "administer CiviCRM" permission //OR has created the PCP if (CRM_Core_Permission::check('administer CiviCRM') || - ($userID && (CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_PCP', $this->_id, 'contact_id') == $userID)) + ($userID && ($pcpInfo['contact_id'] == $userID)) || + !empty($validated) && ($pcpInfo['contact_id'] == $userID) && $pcpInfo['id'] == $session->get('pcpAnonymousPageId') ) { $permission = TRUE; } + if ($single && $permission) { - require_once 'CRM/Core/Controller/Simple.php'; $controller = new CRM_Core_Controller_Simple($form, $subForm, $action); $controller->set('id', $this->_id); $controller->set('single', TRUE); diff --git a/CRM/Core/BAO/File.php b/CRM/Core/BAO/File.php index 481c078b7..2a41bfd0b 100644 --- a/CRM/Core/BAO/File.php +++ b/CRM/Core/BAO/File.php @@ -415,16 +415,13 @@ static function formatAttachment(&$formValues, if (isset($formValues[$attachName]) && !empty($formValues[$attachName])) { for ($i = 0; $i < $numAttachments; $i++) { // ensure file is not empty - $contents = file_get_contents($formValues[$attachName][$i]['name']); - if ($contents) { - $fileParams = array( - 'uri' => $formValues[$attachName][$i]['name'], - 'type' => $formValues[$attachName][$i]['type'], - 'upload_date' => date('Ymdhis'), - 'location' => $formValues[$attachName][$i]['name'], - ); - $params['attachFile_'.$i] = $fileParams; - } + $fileParams = array( + 'uri' => $formValues[$attachName][$i]['name'], + 'type' => $formValues[$attachName][$i]['type'], + 'upload_date' => date('Ymdhis'), + 'location' => $formValues[$attachName][$i]['name'], + ); + $params['attachFile_'.$i] = $fileParams; } } } @@ -442,16 +439,18 @@ static function processAttachment(&$params, if (isset($params["attachFile_$i"]) && is_array($params["attachFile_$i"]) ) { - self::filePostProcess($params["attachFile_$i"]['location'], - NULL, - $entityTable, - $entityID, - NULL, - TRUE, - $params["attachFile_$i"], - "attachFile_$i", - $params["attachFile_$i"]['type'] - ); + if (!empty($params["attachFile_$i"]['location']) && file_exists($params["attachFile_$i"]['location'])) { + self::filePostProcess($params["attachFile_$i"]['location'], + NULL, + $entityTable, + $entityID, + NULL, + TRUE, + $params["attachFile_$i"], + "attachFile_$i", + $params["attachFile_$i"]['type'] + ); + } } } } diff --git a/CRM/Core/Config/Variables.php b/CRM/Core/Config/Variables.php index 8704caf1f..47b8f0363 100644 --- a/CRM/Core/Config/Variables.php +++ b/CRM/Core/Config/Variables.php @@ -430,7 +430,7 @@ class CRM_Core_Config_Variables extends CRM_Core_Config_Defaults { /** * The default value for Content Security Policy recover. */ - public $defaultCSP = "default-src 'self'; img-src 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://analytics.neticrm.tw https://*.googletagmanager.com https://*.google-analytics.com https://www.google.com/recaptcha/api.js https://*.facebook.net https://*.facebook.com https://*.twitter.com https://*.tappaysdk.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; frame-src 'self' https://neticrm.tw https://*.facebook.net https://*.facebook.com https://*.twitter.com https://*.youtube.com https://*.vimeo.com https://*.tappaysdk.com; object-src 'none'; connect-src 'self' https://neti.cc"; + public $defaultCSP = "default-src 'self'; img-src 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://analytics.neticrm.tw https://*.googletagmanager.com https://*.google-analytics.com https://www.google.com/recaptcha/api.js https://*.facebook.net https://*.facebook.com https://*.twitter.com https://*.tappaysdk.com https://www.gstatic.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://fonts.gstatic.com; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com; frame-src 'self' https://neticrm.tw https://*.facebook.net https://*.facebook.com https://*.twitter.com https://*.youtube.com https://*.vimeo.com https://*.tappaysdk.com https://www.google.com; object-src 'none'; connect-src 'self' https://neti.cc"; /** * The default value for Content Security Policy setting. diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index e822163df..ee8855a50 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -740,7 +740,6 @@ public function addUploadAction($uploadDir, $uploadNames) { $uploadDir = empty($config->uploadDir) ? CRM_Utils_System::cmsDir('temp') .'/' : $config->uploadDir; } - require_once 'CRM/Core/BAO/File.php'; if (empty($uploadNames)) { $uploadNames = $this->get('uploadNames'); if (!empty($uploadNames)) { @@ -753,12 +752,16 @@ public function addUploadAction($uploadDir, $uploadNames) { } } - require_once 'CRM/Core/QuickForm/Action/Upload.php'; $action = new CRM_Core_QuickForm_Action_Upload($this->_stateMachine, $uploadDir, $uploadNames ); $this->addAction('upload', $action); + $action = new CRM_Core_QuickForm_Action_Attach($this->_stateMachine, + $uploadDir, + $uploadNames + ); + $this->addAction('attach', $action); } public function setParent($parent) { diff --git a/CRM/Core/DAO/Address.php b/CRM/Core/DAO/Address.php index 6a176bb88..329a5f200 100644 --- a/CRM/Core/DAO/Address.php +++ b/CRM/Core/DAO/Address.php @@ -578,13 +578,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['address'] = & $fields[$name]; + self::$_import['address'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -604,13 +604,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['address'] = & $fields[$name]; + self::$_export['address'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/AddressFormat.php b/CRM/Core/DAO/AddressFormat.php index 1a1e70c96..78a860c63 100644 --- a/CRM/Core/DAO/AddressFormat.php +++ b/CRM/Core/DAO/AddressFormat.php @@ -156,13 +156,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['address_format'] = & $fields[$name]; + self::$_import['address_format'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -179,13 +179,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['address_format'] = & $fields[$name]; + self::$_export['address_format'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Cache.php b/CRM/Core/DAO/Cache.php index 7ddf89af9..b28326042 100644 --- a/CRM/Core/DAO/Cache.php +++ b/CRM/Core/DAO/Cache.php @@ -244,13 +244,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['cache'] = & $fields[$name]; + self::$_import['cache'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -267,13 +267,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['cache'] = & $fields[$name]; + self::$_export['cache'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Component.php b/CRM/Core/DAO/Component.php index a7440b190..f190617f9 100644 --- a/CRM/Core/DAO/Component.php +++ b/CRM/Core/DAO/Component.php @@ -173,13 +173,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['component'] = & $fields[$name]; + self::$_import['component'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -196,13 +196,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['component'] = & $fields[$name]; + self::$_export['component'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Country.php b/CRM/Core/DAO/Country.php index eb8a9ab33..bc948e4b4 100644 --- a/CRM/Core/DAO/Country.php +++ b/CRM/Core/DAO/Country.php @@ -279,13 +279,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['country'] = & $fields[$name]; + self::$_import['country'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -302,13 +302,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['country'] = & $fields[$name]; + self::$_export['country'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/County.php b/CRM/Core/DAO/County.php index f353e8eca..218b5b53f 100644 --- a/CRM/Core/DAO/County.php +++ b/CRM/Core/DAO/County.php @@ -217,13 +217,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['county'] = & $fields[$name]; + self::$_import['county'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -240,13 +240,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['county'] = & $fields[$name]; + self::$_export['county'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Currency.php b/CRM/Core/DAO/Currency.php index a8f036710..f18c6335d 100644 --- a/CRM/Core/DAO/Currency.php +++ b/CRM/Core/DAO/Currency.php @@ -207,13 +207,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['currency'] = & $fields[$name]; + self::$_import['currency'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -230,13 +230,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['currency'] = & $fields[$name]; + self::$_export['currency'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php index b57a43042..187f3a10c 100644 --- a/CRM/Core/DAO/CustomField.php +++ b/CRM/Core/DAO/CustomField.php @@ -489,13 +489,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['custom_field'] = & $fields[$name]; + self::$_import['custom_field'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -512,13 +512,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['custom_field'] = & $fields[$name]; + self::$_export['custom_field'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -595,7 +595,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Core_DAO_CustomField::getEnums(); + $enumFields = &CRM_Core_DAO_CustomField::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Core_DAO_CustomField::tsEnum($enum, $values[$enum]); diff --git a/CRM/Core/DAO/CustomGroup.php b/CRM/Core/DAO/CustomGroup.php index fe1a42c21..045d1ba7e 100644 --- a/CRM/Core/DAO/CustomGroup.php +++ b/CRM/Core/DAO/CustomGroup.php @@ -388,13 +388,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['custom_group'] = & $fields[$name]; + self::$_import['custom_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -411,13 +411,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['custom_group'] = & $fields[$name]; + self::$_export['custom_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -487,7 +487,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Core_DAO_CustomGroup::getEnums(); + $enumFields = &CRM_Core_DAO_CustomGroup::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Core_DAO_CustomGroup::tsEnum($enum, $values[$enum]); diff --git a/CRM/Core/DAO/Dashboard.php b/CRM/Core/DAO/Dashboard.php index 72d2a0855..19bbecb0f 100644 --- a/CRM/Core/DAO/Dashboard.php +++ b/CRM/Core/DAO/Dashboard.php @@ -323,13 +323,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['dashboard'] = & $fields[$name]; + self::$_import['dashboard'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -346,13 +346,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['dashboard'] = & $fields[$name]; + self::$_export['dashboard'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Discount.php b/CRM/Core/DAO/Discount.php index 489d0034a..6baabff37 100644 --- a/CRM/Core/DAO/Discount.php +++ b/CRM/Core/DAO/Discount.php @@ -238,13 +238,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['discount'] = & $fields[$name]; + self::$_import['discount'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -261,13 +261,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['discount'] = & $fields[$name]; + self::$_export['discount'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Domain.php b/CRM/Core/DAO/Domain.php index aa928c89c..e97715081 100644 --- a/CRM/Core/DAO/Domain.php +++ b/CRM/Core/DAO/Domain.php @@ -231,13 +231,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['domain'] = & $fields[$name]; + self::$_import['domain'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -254,13 +254,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['domain'] = & $fields[$name]; + self::$_export['domain'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Email.php b/CRM/Core/DAO/Email.php index 7d85d539e..7150dd801 100644 --- a/CRM/Core/DAO/Email.php +++ b/CRM/Core/DAO/Email.php @@ -322,13 +322,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['email'] = & $fields[$name]; + self::$_import['email'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -345,13 +345,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['email'] = & $fields[$name]; + self::$_export['email'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/EntityFile.php b/CRM/Core/DAO/EntityFile.php index 46188330d..6fed7a0c8 100644 --- a/CRM/Core/DAO/EntityFile.php +++ b/CRM/Core/DAO/EntityFile.php @@ -211,13 +211,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['entity_file'] = & $fields[$name]; + self::$_import['entity_file'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -234,13 +234,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['entity_file'] = & $fields[$name]; + self::$_export['entity_file'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/EntityFinancialTrxn.php b/CRM/Core/DAO/EntityFinancialTrxn.php index 7723ce86f..abd17029f 100644 --- a/CRM/Core/DAO/EntityFinancialTrxn.php +++ b/CRM/Core/DAO/EntityFinancialTrxn.php @@ -239,13 +239,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['entity_financial_trxn'] = & $fields[$name]; + self::$_import['entity_financial_trxn'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -262,13 +262,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['entity_financial_trxn'] = & $fields[$name]; + self::$_export['entity_financial_trxn'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/EntityTag.php b/CRM/Core/DAO/EntityTag.php index d68fe7f73..05a95284d 100644 --- a/CRM/Core/DAO/EntityTag.php +++ b/CRM/Core/DAO/EntityTag.php @@ -211,13 +211,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['entity_tag'] = & $fields[$name]; + self::$_import['entity_tag'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -234,13 +234,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['entity_tag'] = & $fields[$name]; + self::$_export['entity_tag'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/File.php b/CRM/Core/DAO/File.php index 491408f46..7439a70ed 100644 --- a/CRM/Core/DAO/File.php +++ b/CRM/Core/DAO/File.php @@ -216,13 +216,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['file'] = & $fields[$name]; + self::$_import['file'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -239,13 +239,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['file'] = & $fields[$name]; + self::$_export['file'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/FinancialAccount.php b/CRM/Core/DAO/FinancialAccount.php index a8e92d526..3f40c0d99 100644 --- a/CRM/Core/DAO/FinancialAccount.php +++ b/CRM/Core/DAO/FinancialAccount.php @@ -173,13 +173,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['financial_account'] = & $fields[$name]; + self::$_import['financial_account'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -196,13 +196,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['financial_account'] = & $fields[$name]; + self::$_export['financial_account'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/FinancialTrxn.php b/CRM/Core/DAO/FinancialTrxn.php index 6f4b9ae9d..8e1ac9924 100644 --- a/CRM/Core/DAO/FinancialTrxn.php +++ b/CRM/Core/DAO/FinancialTrxn.php @@ -314,13 +314,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['financial_trxn'] = & $fields[$name]; + self::$_import['financial_trxn'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -337,13 +337,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['financial_trxn'] = & $fields[$name]; + self::$_export['financial_trxn'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -391,7 +391,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Core_DAO_FinancialTrxn::getEnums(); + $enumFields = &CRM_Core_DAO_FinancialTrxn::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Core_DAO_FinancialTrxn::tsEnum($enum, $values[$enum]); diff --git a/CRM/Core/DAO/IM.php b/CRM/Core/DAO/IM.php index 19d654b3f..32a38643b 100644 --- a/CRM/Core/DAO/IM.php +++ b/CRM/Core/DAO/IM.php @@ -243,13 +243,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['im'] = & $fields[$name]; + self::$_import['im'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -266,13 +266,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['im'] = & $fields[$name]; + self::$_export['im'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Instrument.php b/CRM/Core/DAO/Instrument.php index a453523b0..a2e4421e6 100644 --- a/CRM/Core/DAO/Instrument.php +++ b/CRM/Core/DAO/Instrument.php @@ -180,13 +180,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['instrument'] = & $fields[$name]; + self::$_import['instrument'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -203,13 +203,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['instrument'] = & $fields[$name]; + self::$_export['instrument'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/LocBlock.php b/CRM/Core/DAO/LocBlock.php index 0686ef200..9c97bf463 100644 --- a/CRM/Core/DAO/LocBlock.php +++ b/CRM/Core/DAO/LocBlock.php @@ -268,13 +268,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['loc_block'] = & $fields[$name]; + self::$_import['loc_block'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -291,13 +291,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['loc_block'] = & $fields[$name]; + self::$_export['loc_block'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/LocationType.php b/CRM/Core/DAO/LocationType.php index 94d94eaf8..dd34e649d 100644 --- a/CRM/Core/DAO/LocationType.php +++ b/CRM/Core/DAO/LocationType.php @@ -227,13 +227,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['location_type'] = & $fields[$name]; + self::$_import['location_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -250,13 +250,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['location_type'] = & $fields[$name]; + self::$_export['location_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Log.php b/CRM/Core/DAO/Log.php index 6bc54728c..ee94d0e33 100644 --- a/CRM/Core/DAO/Log.php +++ b/CRM/Core/DAO/Log.php @@ -233,13 +233,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['log'] = & $fields[$name]; + self::$_import['log'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -256,13 +256,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['log'] = & $fields[$name]; + self::$_export['log'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/MailSettings.php b/CRM/Core/DAO/MailSettings.php index 7df0c6c76..9dffb8d36 100644 --- a/CRM/Core/DAO/MailSettings.php +++ b/CRM/Core/DAO/MailSettings.php @@ -304,13 +304,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mail_settings'] = & $fields[$name]; + self::$_import['mail_settings'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -327,13 +327,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mail_settings'] = & $fields[$name]; + self::$_export['mail_settings'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Mapping.php b/CRM/Core/DAO/Mapping.php index 0cd3361c0..799555e1a 100644 --- a/CRM/Core/DAO/Mapping.php +++ b/CRM/Core/DAO/Mapping.php @@ -181,13 +181,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mapping'] = & $fields[$name]; + self::$_import['mapping'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -204,13 +204,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mapping'] = & $fields[$name]; + self::$_export['mapping'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/MappingField.php b/CRM/Core/DAO/MappingField.php index 2512ad5ac..c5b91fba0 100644 --- a/CRM/Core/DAO/MappingField.php +++ b/CRM/Core/DAO/MappingField.php @@ -330,13 +330,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mapping_field'] = & $fields[$name]; + self::$_import['mapping_field'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -353,13 +353,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mapping_field'] = & $fields[$name]; + self::$_export['mapping_field'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -417,7 +417,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Core_DAO_MappingField::getEnums(); + $enumFields = &CRM_Core_DAO_MappingField::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Core_DAO_MappingField::tsEnum($enum, $values[$enum]); diff --git a/CRM/Core/DAO/Menu.php b/CRM/Core/DAO/Menu.php index eeee46708..7f190999d 100644 --- a/CRM/Core/DAO/Menu.php +++ b/CRM/Core/DAO/Menu.php @@ -410,13 +410,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['menu'] = & $fields[$name]; + self::$_import['menu'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -433,13 +433,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['menu'] = & $fields[$name]; + self::$_export['menu'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/MessageTemplates.php b/CRM/Core/DAO/MessageTemplates.php index a0f25b050..f898b44aa 100644 --- a/CRM/Core/DAO/MessageTemplates.php +++ b/CRM/Core/DAO/MessageTemplates.php @@ -244,13 +244,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['msg_template'] = & $fields[$name]; + self::$_import['msg_template'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -267,13 +267,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['msg_template'] = & $fields[$name]; + self::$_export['msg_template'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php index a2cf442a9..6d56d7be1 100644 --- a/CRM/Core/DAO/Navigation.php +++ b/CRM/Core/DAO/Navigation.php @@ -295,13 +295,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['navigation'] = & $fields[$name]; + self::$_import['navigation'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -318,13 +318,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['navigation'] = & $fields[$name]; + self::$_export['navigation'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Note.php b/CRM/Core/DAO/Note.php index 2f695b752..03a0e7ae6 100644 --- a/CRM/Core/DAO/Note.php +++ b/CRM/Core/DAO/Note.php @@ -264,13 +264,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['note'] = & $fields[$name]; + self::$_import['note'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -287,13 +287,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['note'] = & $fields[$name]; + self::$_export['note'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/OpenID.php b/CRM/Core/DAO/OpenID.php index 7531ce10f..c7cdaac82 100644 --- a/CRM/Core/DAO/OpenID.php +++ b/CRM/Core/DAO/OpenID.php @@ -230,13 +230,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['openid'] = & $fields[$name]; + self::$_import['openid'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -253,13 +253,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['openid'] = & $fields[$name]; + self::$_export['openid'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/OptionGroup.php b/CRM/Core/DAO/OptionGroup.php index eb3ac506d..73e73c757 100644 --- a/CRM/Core/DAO/OptionGroup.php +++ b/CRM/Core/DAO/OptionGroup.php @@ -206,13 +206,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['option_group'] = & $fields[$name]; + self::$_import['option_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -229,13 +229,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['option_group'] = & $fields[$name]; + self::$_export['option_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/OptionValue.php b/CRM/Core/DAO/OptionValue.php index 4b6533b8a..9c9d5d57a 100644 --- a/CRM/Core/DAO/OptionValue.php +++ b/CRM/Core/DAO/OptionValue.php @@ -359,13 +359,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['option_value'] = & $fields[$name]; + self::$_import['option_value'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -382,13 +382,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['option_value'] = & $fields[$name]; + self::$_export['option_value'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/PaymentProcessor.php b/CRM/Core/DAO/PaymentProcessor.php index 8626ac03e..8f805af64 100644 --- a/CRM/Core/DAO/PaymentProcessor.php +++ b/CRM/Core/DAO/PaymentProcessor.php @@ -397,13 +397,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['payment_processor'] = & $fields[$name]; + self::$_import['payment_processor'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -420,13 +420,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['payment_processor'] = & $fields[$name]; + self::$_export['payment_processor'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/PaymentProcessorType.php b/CRM/Core/DAO/PaymentProcessorType.php index 613f4e469..e37b0cdac 100644 --- a/CRM/Core/DAO/PaymentProcessorType.php +++ b/CRM/Core/DAO/PaymentProcessorType.php @@ -394,13 +394,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['payment_processor_type'] = & $fields[$name]; + self::$_import['payment_processor_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -417,13 +417,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['payment_processor_type'] = & $fields[$name]; + self::$_export['payment_processor_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Persistent.php b/CRM/Core/DAO/Persistent.php index 1c403b014..d8f99aeed 100644 --- a/CRM/Core/DAO/Persistent.php +++ b/CRM/Core/DAO/Persistent.php @@ -195,13 +195,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['persistent'] = & $fields[$name]; + self::$_import['persistent'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -218,13 +218,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['persistent'] = & $fields[$name]; + self::$_export['persistent'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php index 49fa9c9d6..eaf8aed71 100644 --- a/CRM/Core/DAO/Phone.php +++ b/CRM/Core/DAO/Phone.php @@ -253,13 +253,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['phone'] = & $fields[$name]; + self::$_import['phone'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -276,13 +276,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['phone'] = & $fields[$name]; + self::$_export['phone'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Preferences.php b/CRM/Core/DAO/Preferences.php index f1048c111..f41423dcd 100644 --- a/CRM/Core/DAO/Preferences.php +++ b/CRM/Core/DAO/Preferences.php @@ -403,13 +403,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['preferences'] = & $fields[$name]; + self::$_import['preferences'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -426,13 +426,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['preferences'] = & $fields[$name]; + self::$_export['preferences'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/PreferencesDate.php b/CRM/Core/DAO/PreferencesDate.php index 965e0a287..5bd62398a 100644 --- a/CRM/Core/DAO/PreferencesDate.php +++ b/CRM/Core/DAO/PreferencesDate.php @@ -221,13 +221,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['preferences_date'] = & $fields[$name]; + self::$_import['preferences_date'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -244,13 +244,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['preferences_date'] = & $fields[$name]; + self::$_export['preferences_date'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Sequence.php b/CRM/Core/DAO/Sequence.php index 5dd628de5..55252d12f 100644 --- a/CRM/Core/DAO/Sequence.php +++ b/CRM/Core/DAO/Sequence.php @@ -175,13 +175,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['sequence'] = & $fields[$name]; + self::$_import['sequence'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -198,13 +198,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['sequence'] = & $fields[$name]; + self::$_export['sequence'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/StateProvince.php b/CRM/Core/DAO/StateProvince.php index 2aa16be52..7a9bb917a 100644 --- a/CRM/Core/DAO/StateProvince.php +++ b/CRM/Core/DAO/StateProvince.php @@ -217,13 +217,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['state_province'] = & $fields[$name]; + self::$_import['state_province'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -240,13 +240,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['state_province'] = & $fields[$name]; + self::$_export['state_province'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Tag.php b/CRM/Core/DAO/Tag.php index d079a76fc..2f5eaff5d 100644 --- a/CRM/Core/DAO/Tag.php +++ b/CRM/Core/DAO/Tag.php @@ -260,13 +260,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['tag'] = & $fields[$name]; + self::$_import['tag'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -283,13 +283,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['tag'] = & $fields[$name]; + self::$_export['tag'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Timezone.php b/CRM/Core/DAO/Timezone.php index 200002aa9..4537a5ae6 100644 --- a/CRM/Core/DAO/Timezone.php +++ b/CRM/Core/DAO/Timezone.php @@ -235,13 +235,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['timezone'] = & $fields[$name]; + self::$_import['timezone'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -258,13 +258,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['timezone'] = & $fields[$name]; + self::$_export['timezone'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Track.php b/CRM/Core/DAO/Track.php index fbba69d1c..aa7ef0743 100644 --- a/CRM/Core/DAO/Track.php +++ b/CRM/Core/DAO/Track.php @@ -395,13 +395,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['track'] = & $fields[$name]; + self::$_import['track'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -418,13 +418,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['track'] = & $fields[$name]; + self::$_export['track'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/UFField.php b/CRM/Core/DAO/UFField.php index 154ebec96..2915eb0ba 100644 --- a/CRM/Core/DAO/UFField.php +++ b/CRM/Core/DAO/UFField.php @@ -369,13 +369,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['uf_field'] = & $fields[$name]; + self::$_import['uf_field'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -392,13 +392,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['uf_field'] = & $fields[$name]; + self::$_export['uf_field'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -447,7 +447,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Core_DAO_UFField::getEnums(); + $enumFields = &CRM_Core_DAO_UFField::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Core_DAO_UFField::tsEnum($enum, $values[$enum]); diff --git a/CRM/Core/DAO/UFGroup.php b/CRM/Core/DAO/UFGroup.php index 65a20d82a..118f87215 100644 --- a/CRM/Core/DAO/UFGroup.php +++ b/CRM/Core/DAO/UFGroup.php @@ -421,13 +421,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['uf_group'] = & $fields[$name]; + self::$_import['uf_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -444,13 +444,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['uf_group'] = & $fields[$name]; + self::$_export['uf_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/UFJoin.php b/CRM/Core/DAO/UFJoin.php index 22f0cbac1..a748c4608 100644 --- a/CRM/Core/DAO/UFJoin.php +++ b/CRM/Core/DAO/UFJoin.php @@ -248,13 +248,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['uf_join'] = & $fields[$name]; + self::$_import['uf_join'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -271,13 +271,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['uf_join'] = & $fields[$name]; + self::$_export['uf_join'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/UFMatch.php b/CRM/Core/DAO/UFMatch.php index e5c6aeadd..c0e67b9a8 100644 --- a/CRM/Core/DAO/UFMatch.php +++ b/CRM/Core/DAO/UFMatch.php @@ -236,13 +236,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['uf_match'] = & $fields[$name]; + self::$_import['uf_match'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -259,13 +259,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['uf_match'] = & $fields[$name]; + self::$_export['uf_match'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Website.php b/CRM/Core/DAO/Website.php index fe00c549a..7479ddd21 100644 --- a/CRM/Core/DAO/Website.php +++ b/CRM/Core/DAO/Website.php @@ -213,13 +213,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['website'] = & $fields[$name]; + self::$_import['website'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -236,13 +236,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['website'] = & $fields[$name]; + self::$_export['website'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/DAO/Worldregion.php b/CRM/Core/DAO/Worldregion.php index 47e29bfb1..60a9e869e 100644 --- a/CRM/Core/DAO/Worldregion.php +++ b/CRM/Core/DAO/Worldregion.php @@ -162,13 +162,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['worldregion'] = & $fields[$name]; + self::$_import['worldregion'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -185,13 +185,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['worldregion'] = & $fields[$name]; + self::$_export['worldregion'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Core/QuickForm/Action/Attach.php b/CRM/Core/QuickForm/Action/Attach.php new file mode 100644 index 000000000..862e921ea --- /dev/null +++ b/CRM/Core/QuickForm/Action/Attach.php @@ -0,0 +1,146 @@ +_uploadDir = $uploadDir; + $this->_uploadNames = $uploadNames; + } + + /** + * upload and move the file if valid to the uploaded directory + * + * @param object $page the CRM_Core_Form object + * @param object $data the QFC data container + * @param string $pageName the name of the page which index the data container with + * @param string $uploadName the name of the uploaded file + * + * @return void + * @access private + */ + function attach(&$page, &$data, $pageName, $uploadName) { + // make sure uploadName exists in the QF array + // else we skip, CRM-3427 + if (empty($uploadName) || + !isset($page->_elementIndex[$uploadName]) + ) { + return; + } + + // get the element containing the upload + $element = &$page->getElement($uploadName); + if ('file' == $element->getType()) { + if ($element->isUploadedFile()) { + // rename the uploaded file with a unique number at the end + $value = $element->getValue(); + + if (is_array($value['name'])) { + $newName = array(); + foreach($value['name'] as $idx => $name) { + $newName[$idx] = CRM_Utils_File::makeFileName($name); + } + } + else { + $newName = CRM_Utils_File::makeFileName($value['name']); + } + $movedFilename = $element->moveUploadedFile($this->_uploadDir, $newName); + if (!$movedFilename) { + return CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(1 => $newName, 2 => $this->_uploadDir))); + } + if (is_array($newName)) { + foreach($newName as $idx => $name) { + $data['values'][$pageName][$uploadName][$idx] = array( + 'name' => $this->_uploadDir . $name, + 'type' => $value['type'][$idx], + ); + } + } + else { + $data['values'][$pageName][$uploadName] = array( + 'name' => $this->_uploadDir . $newName, + 'type' => $value['type'], + ); + } + } + } + } + + /** + * Processes the request. + * + * @param object $page CRM_Core_Form the current form-page + * @param string $actionName Current action name, as one Action object can serve multiple actions + * + * @return void + * @access public + */ + function perform(&$page, $actionName) { + // like in Action_Next + $page->isFormBuilt() or $page->buildForm(); + + // so this is a brain-seizure moment, so hang tight (real tight!) + // the above buildForm potentially changes the action function with different args + // so basically the rug might have been pulled from us, so we actually just check + // and potentially call the right one + // this allows standalong form uploads to work nicely + $page->controller->_actions['attach']->realPerform($page, $actionName); + } + + function realPerform(&$page, $actionName) { + $pageName = $page->getAttribute('name'); + $data = &$page->controller->container(); + $data['values'][$pageName] = $page->exportValues(); + $data['valid'][$pageName] = $page->validate(); + + if (!$data['valid'][$pageName]) { + return $page->handle('display'); + } + + foreach ($this->_uploadNames as $name) { + $this->attach($page, $data, $pageName, $name); + } + + $state = &$this->_stateMachine->getState($pageName); + if (empty($state)) { + return $page->handle('display'); + } + + // the page is valid, process it before we jump to the next state + $page->mainProcess(); + + $state->handleNextState($page); + } +} + diff --git a/CRM/Core/QuickForm/Action/Upload.php b/CRM/Core/QuickForm/Action/Upload.php index 90a0dc8ca..f5faa017b 100644 --- a/CRM/Core/QuickForm/Action/Upload.php +++ b/CRM/Core/QuickForm/Action/Upload.php @@ -92,7 +92,7 @@ function upload(&$page, &$data, $pageName, $uploadName) { if ($element->isUploadedFile()) { // rename the uploaded file with a unique number at the end $value = $element->getValue(); - + if (is_array($value['name'])) { $newName = array(); foreach($value['name'] as $idx => $name) { @@ -102,9 +102,9 @@ function upload(&$page, &$data, $pageName, $uploadName) { else { $newName = CRM_Utils_File::makeFileName($value['name']); } - $status = $element->moveUploadedFile($this->_uploadDir, $newName); - if (!$status) { - return CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(1 => $oldName, 2 => $this->_uploadDir))); + $movedFilename = $element->moveUploadedFile($this->_uploadDir, $newName); + if (!$movedFilename) { + return CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(1 => $newName, 2 => $this->_uploadDir))); } if (is_array($newName)) { foreach($newName as $idx => $name) { diff --git a/CRM/Coupon/DAO/Coupon.php b/CRM/Coupon/DAO/Coupon.php index 234482d76..bfa56f84b 100644 --- a/CRM/Coupon/DAO/Coupon.php +++ b/CRM/Coupon/DAO/Coupon.php @@ -254,13 +254,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['coupon'] = & $fields[$name]; + self::$_import['coupon'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -277,13 +277,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['coupon'] = & $fields[$name]; + self::$_export['coupon'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Coupon/DAO/CouponEntity.php b/CRM/Coupon/DAO/CouponEntity.php index cd55faf4f..f9e21c71f 100644 --- a/CRM/Coupon/DAO/CouponEntity.php +++ b/CRM/Coupon/DAO/CouponEntity.php @@ -210,13 +210,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['coupon_entity'] = & $fields[$name]; + self::$_import['coupon_entity'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -233,13 +233,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['coupon_entity'] = & $fields[$name]; + self::$_export['coupon_entity'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Coupon/DAO/CouponTrack.php b/CRM/Coupon/DAO/CouponTrack.php index 408c609b5..c8877066a 100644 --- a/CRM/Coupon/DAO/CouponTrack.php +++ b/CRM/Coupon/DAO/CouponTrack.php @@ -235,13 +235,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['coupon_track'] = & $fields[$name]; + self::$_import['coupon_track'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -258,13 +258,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['coupon_track'] = & $fields[$name]; + self::$_export['coupon_track'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Dedupe/DAO/Exception.php b/CRM/Dedupe/DAO/Exception.php index 1dde3b64d..c8a635839 100644 --- a/CRM/Dedupe/DAO/Exception.php +++ b/CRM/Dedupe/DAO/Exception.php @@ -200,13 +200,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['dedupe_exception'] = & $fields[$name]; + self::$_import['dedupe_exception'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -223,13 +223,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['dedupe_exception'] = & $fields[$name]; + self::$_export['dedupe_exception'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Dedupe/DAO/Rule.php b/CRM/Dedupe/DAO/Rule.php index db5a95dce..69b16c3f9 100644 --- a/CRM/Dedupe/DAO/Rule.php +++ b/CRM/Dedupe/DAO/Rule.php @@ -237,13 +237,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['dedupe_rule'] = & $fields[$name]; + self::$_import['dedupe_rule'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -260,13 +260,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['dedupe_rule'] = & $fields[$name]; + self::$_export['dedupe_rule'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Dedupe/DAO/RuleGroup.php b/CRM/Dedupe/DAO/RuleGroup.php index 39b54cb51..db42c9389 100644 --- a/CRM/Dedupe/DAO/RuleGroup.php +++ b/CRM/Dedupe/DAO/RuleGroup.php @@ -204,13 +204,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['dedupe_rule_group'] = & $fields[$name]; + self::$_import['dedupe_rule_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -227,13 +227,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['dedupe_rule_group'] = & $fields[$name]; + self::$_export['dedupe_rule_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -287,7 +287,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Dedupe_DAO_RuleGroup::getEnums(); + $enumFields = &CRM_Dedupe_DAO_RuleGroup::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Dedupe_DAO_RuleGroup::tsEnum($enum, $values[$enum]); diff --git a/CRM/Event/DAO/Event.php b/CRM/Event/DAO/Event.php index 5831994c6..073687e4a 100644 --- a/CRM/Event/DAO/Event.php +++ b/CRM/Event/DAO/Event.php @@ -872,13 +872,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['event'] = & $fields[$name]; + self::$_import['event'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -895,13 +895,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['event'] = & $fields[$name]; + self::$_export['event'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Event/DAO/Participant.php b/CRM/Event/DAO/Participant.php index 779f26903..deca429fe 100644 --- a/CRM/Event/DAO/Participant.php +++ b/CRM/Event/DAO/Participant.php @@ -417,13 +417,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['participant'] = & $fields[$name]; + self::$_import['participant'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -440,13 +440,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['participant'] = & $fields[$name]; + self::$_export['participant'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Event/DAO/ParticipantPayment.php b/CRM/Event/DAO/ParticipantPayment.php index e75fb0693..150c5b1b6 100644 --- a/CRM/Event/DAO/ParticipantPayment.php +++ b/CRM/Event/DAO/ParticipantPayment.php @@ -202,13 +202,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['participant_payment'] = & $fields[$name]; + self::$_import['participant_payment'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -225,13 +225,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['participant_payment'] = & $fields[$name]; + self::$_export['participant_payment'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Event/DAO/ParticipantStatusType.php b/CRM/Event/DAO/ParticipantStatusType.php index f236d9975..27508c145 100644 --- a/CRM/Event/DAO/ParticipantStatusType.php +++ b/CRM/Event/DAO/ParticipantStatusType.php @@ -242,13 +242,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['participant_status_type'] = & $fields[$name]; + self::$_import['participant_status_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -265,13 +265,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['participant_status_type'] = & $fields[$name]; + self::$_export['participant_status_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -321,7 +321,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Event_DAO_ParticipantStatusType::getEnums(); + $enumFields = &CRM_Event_DAO_ParticipantStatusType::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Event_DAO_ParticipantStatusType::tsEnum($enum, $values[$enum]); diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 1936d186a..e5e883da1 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -801,7 +801,7 @@ public function buildQuickForm() { $element = $this->add('select', 'event_id', ts('Event'), array('' => ts('- select -')) + $events, TRUE, - array('onchange' => "buildFeeBlock( this.value ); buildCustomData( 'Participant', this.value, {$this->_eventNameCustomDataTypeID} ); buildParticipantRole( this.value ); buildEventTypeCustomData( this.value, {$this->_eventTypeCustomDataTypeID}, '{$eventAndTypeMapping}' );", 'class' => 'huge') + array('onchange' => "buildFeeBlock( this.value ); buildCustomData( 'Participant', this.value, {$this->_eventNameCustomDataTypeID} ); buildParticipantRole( this.value ); buildEventTypeCustomData( this.value, {$this->_eventTypeCustomDataTypeID}, '{$eventAndTypeMapping}' );") ); // CRM-6111 diff --git a/CRM/Friend/DAO/Friend.php b/CRM/Friend/DAO/Friend.php index fdee4a44d..0e0aa9092 100644 --- a/CRM/Friend/DAO/Friend.php +++ b/CRM/Friend/DAO/Friend.php @@ -270,13 +270,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['tell_friend'] = & $fields[$name]; + self::$_import['tell_friend'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -293,13 +293,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['tell_friend'] = & $fields[$name]; + self::$_export['tell_friend'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Grant/DAO/Grant.php b/CRM/Grant/DAO/Grant.php index 0a2cd5b96..677c0cfa1 100644 --- a/CRM/Grant/DAO/Grant.php +++ b/CRM/Grant/DAO/Grant.php @@ -380,13 +380,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['grant'] = & $fields[$name]; + self::$_import['grant'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -403,13 +403,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['grant'] = & $fields[$name]; + self::$_export['grant'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/DAO/BouncePattern.php b/CRM/Mailing/DAO/BouncePattern.php index b8290819d..a20b159b9 100644 --- a/CRM/Mailing/DAO/BouncePattern.php +++ b/CRM/Mailing/DAO/BouncePattern.php @@ -198,13 +198,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_bounce_pattern'] = & $fields[$name]; + self::$_import['mailing_bounce_pattern'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -221,13 +221,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_bounce_pattern'] = & $fields[$name]; + self::$_export['mailing_bounce_pattern'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/DAO/BounceType.php b/CRM/Mailing/DAO/BounceType.php index cbf8c91ae..0e2866904 100644 --- a/CRM/Mailing/DAO/BounceType.php +++ b/CRM/Mailing/DAO/BounceType.php @@ -182,13 +182,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_bounce_type'] = & $fields[$name]; + self::$_import['mailing_bounce_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -205,13 +205,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_bounce_type'] = & $fields[$name]; + self::$_export['mailing_bounce_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -269,7 +269,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Mailing_DAO_BounceType::getEnums(); + $enumFields = &CRM_Mailing_DAO_BounceType::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Mailing_DAO_BounceType::tsEnum($enum, $values[$enum]); diff --git a/CRM/Mailing/DAO/Component.php b/CRM/Mailing/DAO/Component.php index 5f90cbd5b..3dc0ae201 100644 --- a/CRM/Mailing/DAO/Component.php +++ b/CRM/Mailing/DAO/Component.php @@ -228,13 +228,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_component'] = & $fields[$name]; + self::$_import['mailing_component'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -251,13 +251,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_component'] = & $fields[$name]; + self::$_export['mailing_component'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -311,7 +311,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Mailing_DAO_Component::getEnums(); + $enumFields = &CRM_Mailing_DAO_Component::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Mailing_DAO_Component::tsEnum($enum, $values[$enum]); diff --git a/CRM/Mailing/DAO/Group.php b/CRM/Mailing/DAO/Group.php index ad8ce896b..667c9f045 100644 --- a/CRM/Mailing/DAO/Group.php +++ b/CRM/Mailing/DAO/Group.php @@ -244,13 +244,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_group'] = & $fields[$name]; + self::$_import['mailing_group'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -267,13 +267,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_group'] = & $fields[$name]; + self::$_export['mailing_group'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -322,7 +322,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Mailing_DAO_Group::getEnums(); + $enumFields = &CRM_Mailing_DAO_Group::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Mailing_DAO_Group::tsEnum($enum, $values[$enum]); diff --git a/CRM/Mailing/DAO/Job.php b/CRM/Mailing/DAO/Job.php index d230df5a5..9ec237cba 100644 --- a/CRM/Mailing/DAO/Job.php +++ b/CRM/Mailing/DAO/Job.php @@ -289,13 +289,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_job'] = & $fields[$name]; + self::$_import['mailing_job'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -312,13 +312,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_job'] = & $fields[$name]; + self::$_export['mailing_job'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -369,7 +369,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Mailing_DAO_Job::getEnums(); + $enumFields = &CRM_Mailing_DAO_Job::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Mailing_DAO_Job::tsEnum($enum, $values[$enum]); diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php index ce7542441..5095a391a 100644 --- a/CRM/Mailing/DAO/Mailing.php +++ b/CRM/Mailing/DAO/Mailing.php @@ -550,13 +550,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing'] = & $fields[$name]; + self::$_import['mailing'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -573,13 +573,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing'] = & $fields[$name]; + self::$_export['mailing'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -627,7 +627,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Mailing_DAO_Mailing::getEnums(); + $enumFields = &CRM_Mailing_DAO_Mailing::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Mailing_DAO_Mailing::tsEnum($enum, $values[$enum]); diff --git a/CRM/Mailing/DAO/Recipients.php b/CRM/Mailing/DAO/Recipients.php index 626c20213..3a2133f0a 100644 --- a/CRM/Mailing/DAO/Recipients.php +++ b/CRM/Mailing/DAO/Recipients.php @@ -213,13 +213,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_recipients'] = & $fields[$name]; + self::$_import['mailing_recipients'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -236,13 +236,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_recipients'] = & $fields[$name]; + self::$_export['mailing_recipients'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/DAO/Spool.php b/CRM/Mailing/DAO/Spool.php index 9218fdd51..ba481dccb 100644 --- a/CRM/Mailing/DAO/Spool.php +++ b/CRM/Mailing/DAO/Spool.php @@ -240,13 +240,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_spool'] = & $fields[$name]; + self::$_import['mailing_spool'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -263,13 +263,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_spool'] = & $fields[$name]; + self::$_export['mailing_spool'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/DAO/TrackableURL.php b/CRM/Mailing/DAO/TrackableURL.php index 38e68dfa5..02f5c3f9e 100644 --- a/CRM/Mailing/DAO/TrackableURL.php +++ b/CRM/Mailing/DAO/TrackableURL.php @@ -199,13 +199,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_trackable_url'] = & $fields[$name]; + self::$_import['mailing_trackable_url'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -222,13 +222,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_trackable_url'] = & $fields[$name]; + self::$_export['mailing_trackable_url'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Bounce.php b/CRM/Mailing/Event/DAO/Bounce.php index 2746658e6..31b39b4fe 100644 --- a/CRM/Mailing/Event/DAO/Bounce.php +++ b/CRM/Mailing/Event/DAO/Bounce.php @@ -218,13 +218,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_bounce'] = & $fields[$name]; + self::$_import['mailing_event_bounce'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -241,13 +241,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_bounce'] = & $fields[$name]; + self::$_export['mailing_event_bounce'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Confirm.php b/CRM/Mailing/Event/DAO/Confirm.php index f01c90337..8cefaaa1b 100644 --- a/CRM/Mailing/Event/DAO/Confirm.php +++ b/CRM/Mailing/Event/DAO/Confirm.php @@ -197,13 +197,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_confirm'] = & $fields[$name]; + self::$_import['mailing_event_confirm'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -220,13 +220,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_confirm'] = & $fields[$name]; + self::$_export['mailing_event_confirm'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Delivered.php b/CRM/Mailing/Event/DAO/Delivered.php index a8155efdd..f627ff7e7 100644 --- a/CRM/Mailing/Event/DAO/Delivered.php +++ b/CRM/Mailing/Event/DAO/Delivered.php @@ -197,13 +197,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_delivered'] = & $fields[$name]; + self::$_import['mailing_event_delivered'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -220,13 +220,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_delivered'] = & $fields[$name]; + self::$_export['mailing_event_delivered'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Forward.php b/CRM/Mailing/Event/DAO/Forward.php index f20f12c45..4f0dacd2a 100644 --- a/CRM/Mailing/Event/DAO/Forward.php +++ b/CRM/Mailing/Event/DAO/Forward.php @@ -210,13 +210,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_forward'] = & $fields[$name]; + self::$_import['mailing_event_forward'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -233,13 +233,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_forward'] = & $fields[$name]; + self::$_export['mailing_event_forward'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Opened.php b/CRM/Mailing/Event/DAO/Opened.php index 234ae8331..50b1b42f8 100644 --- a/CRM/Mailing/Event/DAO/Opened.php +++ b/CRM/Mailing/Event/DAO/Opened.php @@ -197,13 +197,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_opened'] = & $fields[$name]; + self::$_import['mailing_event_opened'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -220,13 +220,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_opened'] = & $fields[$name]; + self::$_export['mailing_event_opened'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Queue.php b/CRM/Mailing/Event/DAO/Queue.php index ff0d0e196..b68ef9cdd 100644 --- a/CRM/Mailing/Event/DAO/Queue.php +++ b/CRM/Mailing/Event/DAO/Queue.php @@ -227,13 +227,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_queue'] = & $fields[$name]; + self::$_import['mailing_event_queue'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -250,13 +250,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_queue'] = & $fields[$name]; + self::$_export['mailing_event_queue'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Reply.php b/CRM/Mailing/Event/DAO/Reply.php index df3d8e7b2..392c00227 100644 --- a/CRM/Mailing/Event/DAO/Reply.php +++ b/CRM/Mailing/Event/DAO/Reply.php @@ -197,13 +197,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_reply'] = & $fields[$name]; + self::$_import['mailing_event_reply'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -220,13 +220,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_reply'] = & $fields[$name]; + self::$_export['mailing_event_reply'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Subscribe.php b/CRM/Mailing/Event/DAO/Subscribe.php index 415054a23..5dc7f01ca 100644 --- a/CRM/Mailing/Event/DAO/Subscribe.php +++ b/CRM/Mailing/Event/DAO/Subscribe.php @@ -225,13 +225,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_subscribe'] = & $fields[$name]; + self::$_import['mailing_event_subscribe'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -248,13 +248,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_subscribe'] = & $fields[$name]; + self::$_export['mailing_event_subscribe'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/TrackableURLOpen.php b/CRM/Mailing/Event/DAO/TrackableURLOpen.php index 295dcf7ad..55ed32084 100644 --- a/CRM/Mailing/Event/DAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/DAO/TrackableURLOpen.php @@ -211,13 +211,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_trackable_url_open'] = & $fields[$name]; + self::$_import['mailing_event_trackable_url_open'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -234,13 +234,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_trackable_url_open'] = & $fields[$name]; + self::$_export['mailing_event_trackable_url_open'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Transactional.php b/CRM/Mailing/Event/DAO/Transactional.php index 0310d67eb..7f315c6da 100644 --- a/CRM/Mailing/Event/DAO/Transactional.php +++ b/CRM/Mailing/Event/DAO/Transactional.php @@ -199,13 +199,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_transactional'] = & $fields[$name]; + self::$_import['mailing_event_transactional'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -222,13 +222,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_transactional'] = & $fields[$name]; + self::$_export['mailing_event_transactional'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Mailing/Event/DAO/Unsubscribe.php b/CRM/Mailing/Event/DAO/Unsubscribe.php index 551ac8824..d0d2e2f79 100644 --- a/CRM/Mailing/Event/DAO/Unsubscribe.php +++ b/CRM/Mailing/Event/DAO/Unsubscribe.php @@ -209,13 +209,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['mailing_event_unsubscribe'] = & $fields[$name]; + self::$_import['mailing_event_unsubscribe'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -232,13 +232,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['mailing_event_unsubscribe'] = & $fields[$name]; + self::$_export['mailing_event_unsubscribe'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Member/DAO/Membership.php b/CRM/Member/DAO/Membership.php index dd21f41ad..538152f11 100644 --- a/CRM/Member/DAO/Membership.php +++ b/CRM/Member/DAO/Membership.php @@ -394,13 +394,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership'] = & $fields[$name]; + self::$_import['membership'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -417,13 +417,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership'] = & $fields[$name]; + self::$_export['membership'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Member/DAO/MembershipBlock.php b/CRM/Member/DAO/MembershipBlock.php index 9cf57c0fb..893e8f719 100644 --- a/CRM/Member/DAO/MembershipBlock.php +++ b/CRM/Member/DAO/MembershipBlock.php @@ -332,13 +332,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership_block'] = & $fields[$name]; + self::$_import['membership_block'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -355,13 +355,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership_block'] = & $fields[$name]; + self::$_export['membership_block'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Member/DAO/MembershipLog.php b/CRM/Member/DAO/MembershipLog.php index ff9a153b8..b05378196 100644 --- a/CRM/Member/DAO/MembershipLog.php +++ b/CRM/Member/DAO/MembershipLog.php @@ -257,13 +257,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership_log'] = & $fields[$name]; + self::$_import['membership_log'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -280,13 +280,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership_log'] = & $fields[$name]; + self::$_export['membership_log'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Member/DAO/MembershipPayment.php b/CRM/Member/DAO/MembershipPayment.php index a48d31c31..93d8f4ead 100644 --- a/CRM/Member/DAO/MembershipPayment.php +++ b/CRM/Member/DAO/MembershipPayment.php @@ -198,13 +198,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership_payment'] = & $fields[$name]; + self::$_import['membership_payment'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -221,13 +221,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership_payment'] = & $fields[$name]; + self::$_export['membership_payment'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Member/DAO/MembershipStatus.php b/CRM/Member/DAO/MembershipStatus.php index 11918c88a..0faa947e4 100644 --- a/CRM/Member/DAO/MembershipStatus.php +++ b/CRM/Member/DAO/MembershipStatus.php @@ -314,13 +314,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership_status'] = & $fields[$name]; + self::$_import['membership_status'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -337,13 +337,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership_status'] = & $fields[$name]; + self::$_export['membership_status'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -410,7 +410,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Member_DAO_MembershipStatus::getEnums(); + $enumFields = &CRM_Member_DAO_MembershipStatus::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Member_DAO_MembershipStatus::tsEnum($enum, $values[$enum]); diff --git a/CRM/Member/DAO/MembershipType.php b/CRM/Member/DAO/MembershipType.php index cfed6e36a..24aa1da85 100644 --- a/CRM/Member/DAO/MembershipType.php +++ b/CRM/Member/DAO/MembershipType.php @@ -423,13 +423,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['membership_type'] = & $fields[$name]; + self::$_import['membership_type'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -446,13 +446,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['membership_type'] = & $fields[$name]; + self::$_export['membership_type'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -507,7 +507,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Member_DAO_MembershipType::getEnums(); + $enumFields = &CRM_Member_DAO_MembershipType::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Member_DAO_MembershipType::tsEnum($enum, $values[$enum]); diff --git a/CRM/Pledge/DAO/Payment.php b/CRM/Pledge/DAO/Payment.php index fb680cd6d..24d4d3a62 100644 --- a/CRM/Pledge/DAO/Payment.php +++ b/CRM/Pledge/DAO/Payment.php @@ -315,13 +315,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['pledge_payment'] = & $fields[$name]; + self::$_import['pledge_payment'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -338,13 +338,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['pledge_payment'] = & $fields[$name]; + self::$_export['pledge_payment'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Pledge/DAO/Pledge.php b/CRM/Pledge/DAO/Pledge.php index ad60cac39..41c375a32 100644 --- a/CRM/Pledge/DAO/Pledge.php +++ b/CRM/Pledge/DAO/Pledge.php @@ -486,13 +486,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['pledge'] = & $fields[$name]; + self::$_import['pledge'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -509,13 +509,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['pledge'] = & $fields[$name]; + self::$_export['pledge'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -565,7 +565,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Pledge_DAO_Pledge::getEnums(); + $enumFields = &CRM_Pledge_DAO_Pledge::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Pledge_DAO_Pledge::tsEnum($enum, $values[$enum]); diff --git a/CRM/Pledge/DAO/PledgeBlock.php b/CRM/Pledge/DAO/PledgeBlock.php index 9fc7448dc..1484a2628 100644 --- a/CRM/Pledge/DAO/PledgeBlock.php +++ b/CRM/Pledge/DAO/PledgeBlock.php @@ -243,13 +243,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['pledge_block'] = & $fields[$name]; + self::$_import['pledge_block'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -266,13 +266,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['pledge_block'] = & $fields[$name]; + self::$_export['pledge_block'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Price/DAO/Field.php b/CRM/Price/DAO/Field.php index 6f9d366e6..c9089ad3b 100644 --- a/CRM/Price/DAO/Field.php +++ b/CRM/Price/DAO/Field.php @@ -380,13 +380,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['price_field'] = & $fields[$name]; + self::$_import['price_field'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -403,13 +403,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['price_field'] = & $fields[$name]; + self::$_export['price_field'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } @@ -459,7 +459,7 @@ static function tsEnum($field, $value) */ static function addDisplayEnums(&$values) { - $enumFields = & CRM_Price_DAO_Field::getEnums(); + $enumFields = &CRM_Price_DAO_Field::getEnums(); foreach($enumFields as $enum) { if (isset($values[$enum])) { $values[$enum . '_display'] = CRM_Price_DAO_Field::tsEnum($enum, $values[$enum]); diff --git a/CRM/Price/DAO/FieldValue.php b/CRM/Price/DAO/FieldValue.php index 8ffb88179..4ff519232 100644 --- a/CRM/Price/DAO/FieldValue.php +++ b/CRM/Price/DAO/FieldValue.php @@ -310,13 +310,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['price_field_value'] = & $fields[$name]; + self::$_import['price_field_value'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -333,13 +333,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['price_field_value'] = & $fields[$name]; + self::$_export['price_field_value'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Price/DAO/LineItem.php b/CRM/Price/DAO/LineItem.php index 11fb7aa6a..f642cddfe 100644 --- a/CRM/Price/DAO/LineItem.php +++ b/CRM/Price/DAO/LineItem.php @@ -288,13 +288,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['line_item'] = & $fields[$name]; + self::$_import['line_item'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -311,13 +311,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['line_item'] = & $fields[$name]; + self::$_export['line_item'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Price/DAO/Set.php b/CRM/Price/DAO/Set.php index bad5313c2..5a922c059 100644 --- a/CRM/Price/DAO/Set.php +++ b/CRM/Price/DAO/Set.php @@ -278,13 +278,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['price_set'] = & $fields[$name]; + self::$_import['price_set'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -301,13 +301,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['price_set'] = & $fields[$name]; + self::$_export['price_set'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Price/DAO/SetEntity.php b/CRM/Price/DAO/SetEntity.php index 719cbd202..9b9c529e7 100644 --- a/CRM/Price/DAO/SetEntity.php +++ b/CRM/Price/DAO/SetEntity.php @@ -212,13 +212,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['price_set_entity'] = & $fields[$name]; + self::$_import['price_set_entity'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -235,13 +235,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['price_set_entity'] = & $fields[$name]; + self::$_export['price_set_entity'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Project/DAO/Project.php b/CRM/Project/DAO/Project.php index c4e2515ba..7e9d5fbdb 100644 --- a/CRM/Project/DAO/Project.php +++ b/CRM/Project/DAO/Project.php @@ -254,13 +254,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['project'] = & $fields[$name]; + self::$_import['project'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -277,13 +277,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['project'] = & $fields[$name]; + self::$_export['project'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Project/DAO/Task.php b/CRM/Project/DAO/Task.php index 61f676c14..435dc475d 100644 --- a/CRM/Project/DAO/Task.php +++ b/CRM/Project/DAO/Task.php @@ -278,13 +278,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['task'] = & $fields[$name]; + self::$_import['task'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -301,13 +301,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['task'] = & $fields[$name]; + self::$_export['task'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Project/DAO/TaskStatus.php b/CRM/Project/DAO/TaskStatus.php index 676cddf1f..6d27e65f2 100644 --- a/CRM/Project/DAO/TaskStatus.php +++ b/CRM/Project/DAO/TaskStatus.php @@ -282,13 +282,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['task_status'] = & $fields[$name]; + self::$_import['task_status'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -305,13 +305,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['task_status'] = & $fields[$name]; + self::$_export['task_status'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Report/DAO/Instance.php b/CRM/Report/DAO/Instance.php index 0c8064c14..0e08fe78c 100644 --- a/CRM/Report/DAO/Instance.php +++ b/CRM/Report/DAO/Instance.php @@ -370,13 +370,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['report_instance'] = & $fields[$name]; + self::$_import['report_instance'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -393,13 +393,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['report_instance'] = & $fields[$name]; + self::$_export['report_instance'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/SMS/DAO/Provider.php b/CRM/SMS/DAO/Provider.php index 6e44b45db..073b7196f 100644 --- a/CRM/SMS/DAO/Provider.php +++ b/CRM/SMS/DAO/Provider.php @@ -292,13 +292,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['sms_provider'] = & $fields[$name]; + self::$_import['sms_provider'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -315,13 +315,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['sms_provider'] = & $fields[$name]; + self::$_export['sms_provider'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Standalone/OpenID/DAO/Associations.php b/CRM/Standalone/OpenID/DAO/Associations.php index b21b1ef7d..5c269a59d 100644 --- a/CRM/Standalone/OpenID/DAO/Associations.php +++ b/CRM/Standalone/OpenID/DAO/Associations.php @@ -208,13 +208,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['openid_associations'] = & $fields[$name]; + self::$_import['openid_associations'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -231,13 +231,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['openid_associations'] = & $fields[$name]; + self::$_export['openid_associations'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/Standalone/OpenID/DAO/Nonce.php b/CRM/Standalone/OpenID/DAO/Nonce.php index 41d5d26db..ee43b30e8 100644 --- a/CRM/Standalone/OpenID/DAO/Nonce.php +++ b/CRM/Standalone/OpenID/DAO/Nonce.php @@ -176,13 +176,13 @@ static function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { - self::$_import['openid_nonces'] = & $fields[$name]; + self::$_import['openid_nonces'] = &$fields[$name]; } else { - self::$_import[$name] = & $fields[$name]; + self::$_import[$name] = &$fields[$name]; } } } @@ -199,13 +199,13 @@ static function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); - $fields = & self::fields(); + $fields = &self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { - self::$_export['openid_nonces'] = & $fields[$name]; + self::$_export['openid_nonces'] = &$fields[$name]; } else { - self::$_export[$name] = & $fields[$name]; + self::$_export[$name] = &$fields[$name]; } } } diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index b9b5ec057..49a11ee3a 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -141,7 +141,7 @@ public function preProcess() { $breadcrumbs = array( array('title' => ts('Home'), 'url' => CRM_Utils_System::url()), array('title' => ts('Administer CiviCRM'), 'url' => CRM_Utils_System::url('civicrm/admin', 'reset=1')), - array('title' => ts('Profile'), 'url' => CRM_Utils_System::url('admin/uf/group', 'reset=1')), + array('title' => ts('Profile'), 'url' => CRM_Utils_System::url('civicrm/admin/uf/group', 'reset=1')), array('title' => ts('CiviCRM Profile Fields'), 'url' => $url), ); CRM_Utils_System::appendBreadCrumb($breadcrumbs); diff --git a/CRM/Utils/Image.php b/CRM/Utils/Image.php index 267fd1ad5..f8d64cdd2 100644 --- a/CRM/Utils/Image.php +++ b/CRM/Utils/Image.php @@ -3,9 +3,68 @@ * class to provide simple static functions for image handling */ class CRM_Utils_Image { + + /** + * Source file full path + * + * @var string + */ + private $_source; + + /** + * Destination file full path + * + * @var string + */ + private $_destination; + + /** + * Validation success of not + */ + private $_prepared; + + /** + * Image info + * + * @var array + */ + private $_info; + + /** + * Convert params detect by internal + * + * @var array + */ + private $_convert; + + /** + * Image resource created by GD + * + * @var GdImage + */ + private $_resource; + + /** + * Temp image resource created by GD + * + * @var GdImage + */ + private $_tmp; + + /** + * Constructor + * + * @param string $source + * @param string $destination + * @param integer $quality + * @param boolean $replace + * + * @return void + */ function __construct($source, $destination, $quality = 90, $replace = FALSE) { + $this->_prepared = FALSE; if (!is_file($source) && !is_uploaded_file($source)) { - return FALSE; + return; } if (is_file($destination) && $source !== $destination) { if (!$replace) { @@ -15,29 +74,39 @@ function __construct($source, $destination, $quality = 90, $replace = FALSE) { if (empty($quality)) { $quality = 90; } - $this->source = $source; - $this->destination = $destination; + $this->_source = $source; + $this->_destination = $destination; - $data = @getimagesize($this->source); + $data = @getimagesize($this->_source); if (isset($data) && is_array($data)) { $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png'); $extension = isset($extensions[$data[2]]) ? $extensions[$data[2]] : ''; $aspect = $data[1] / $data[0]; - $this->info = array( + $this->_info = array( 'width' => $data[0], 'height' => $data[1], 'extension' => $extension, 'mime_type' => $data['mime'], 'aspect' => $aspect ); - $this->convert = array( + $this->_convert = array( 'quality' => $quality, ); + $this->_prepared = TRUE; } } - function getConvertDimensions($width, $height, $upscale) { - $aspect = $this->info['aspect']; + /** + * Get dimension calc result of image + * + * @param int $width + * @param int $height + * @param bool $upscale + * + * @return array [width, height] + */ + private function getConvertDimensions($width, $height, $upscale) { + $aspect = $this->_info['aspect']; $widthCal = $width; $heightCal = $height; @@ -49,14 +118,14 @@ function getConvertDimensions($width, $height, $upscale) { $widthCal = (int) round($height / $aspect); } if (!$upscale) { - if ($this->info['width'] >= $width && $this->info['height'] >= $height) { + if ($this->_info['width'] >= $width && $this->_info['height'] >= $height) { $width = (int) round($widthCal); $height = (int) round($heightCal); } else { - $this->convert['skip'] = TRUE; - $width = $this->info['width']; - $height = $this->info['height']; + $this->_convert['skip'] = TRUE; + $width = $this->_info['width']; + $height = $this->_info['height']; } } else { @@ -66,38 +135,51 @@ function getConvertDimensions($width, $height, $upscale) { return array($width, $height); } - function gdCreateResource() { + /** + * Create GD resource + * + * @return void + */ + private function gdCreateResource() { // create image gd resource - $extension = str_replace('jpg', 'jpeg', $this->info['extension']); + $extension = str_replace('jpg', 'jpeg', $this->_info['extension']); $function = 'imagecreatefrom' . $extension; - if (function_exists($function) && $this->resource = $function($this->source)) { - if (!imageistruecolor($this->resource)) { + if (function_exists($function) && $this->_resource = $function($this->_source)) { + if (!imageistruecolor($this->_resource)) { // Convert indexed images to truecolor, copying the image to a new // truecolor resource, so that filters work correctly and don't result // in unnecessary dither. - $this->gdCreateTmp($this->info['width'], $this->info['height']); - if ($this->tmp) { - imagecopy($this->tmp, $this->resource, 0, 0, 0, 0, imagesx($this-tmp), imagesy($this->tmp)); - imagedestroy($this->resource); - $this->resource = $this->tmp; + $this->gdCreateTmp($this->_info['width'], $this->_info['height']); + if ($this->_tmp) { + imagecopy($this->_tmp, $this->_resource, 0, 0, 0, 0, imagesx($this->_tmp), imagesy($this->_tmp)); + imagedestroy($this->_resource); + $this->_resource = $this->_tmp; } } } } - function gdCreateTmp($width, $height) { - unset($this->tmp); + /** + * Create GD temp canvas + * + * @param int $width + * @param int $height + * + * @return void + */ + private function gdCreateTmp($width, $height) { + unset($this->_tmp); $res = @imagecreatetruecolor($width, $height); - if ($this->info['extension'] == 'gif') { + if ($this->_info['extension'] == 'gif') { // Find out if a transparent color is set, will return -1 if no // transparent color has been defined in the image. - $transparent = imagecolortransparent($this->resource); + $transparent = imagecolortransparent($this->_resource); if ($transparent >= 0) { // Find out the number of colors in the image palette. It will be 0 for // truecolor images. - $palette_size = imagecolorstotal($this->resource); + $palette_size = imagecolorstotal($this->_resource); if ($palette_size == 0 || $transparent < $palette_size) { // Set the transparent color in the new resource, either if it is a // truecolor image or if the transparent color is part of the palette. @@ -105,7 +187,7 @@ function gdCreateTmp($width, $height) { // image rather than of the palette, it is possible that an image // could be created with this index set outside the palette size (see // http://stackoverflow.com/a/3898007). - $transparent_color = imagecolorsforindex($this->resource, $transparent); + $transparent_color = imagecolorsforindex($this->_resource, $transparent); $transparent = imagecolorallocate($res, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); // Flood with our new transparent color. @@ -117,7 +199,7 @@ function gdCreateTmp($width, $height) { } } } - elseif ($this->info['extension'] == 'png') { + elseif ($this->_info['extension'] == 'png') { imagealphablending($res, FALSE); $transparency = imagecolorallocatealpha($res, 0, 0, 0, 127); imagefill($res, 0, 0, $transparency); @@ -127,74 +209,99 @@ function gdCreateTmp($width, $height) { else { imagefill($res, 0, 0, imagecolorallocate($res, 255, 255, 255)); } - $this->tmp = $res; + $this->_tmp = $res; } - function save() { - $extension = str_replace('jpg', 'jpeg', $this->info['extension']); + /** + * Save image to destination + * + * @return bool + */ + private function save() { + $extension = str_replace('jpg', 'jpeg', $this->_info['extension']); $function = 'image' . $extension; $tmpDir = CRM_Utils_System::cmsDir('temp'); $tempName = tempnam($tmpDir, 'crmgd_'); - if ($this->convert['skip']) { - @copy($this->source, $this->destination); + if ($this->_convert['skip']) { + $success = copy($this->_source, $this->_destination); return $success; } elseif (function_exists($function)) { if ($extension == 'jpeg') { - $success = $function($this->resource, $tempName, $this->convert['quality']); + $success = $function($this->_resource, $tempName, $this->_convert['quality']); } else { // Always save PNG images with full transparency. if ($extension == 'png') { - imagealphablending($this->resource, FALSE); - imagesavealpha($this->resource, TRUE); + imagealphablending($this->_resource, FALSE); + imagesavealpha($this->_resource, TRUE); } - $success = $function($this->resource, $tempName); + $success = $function($this->_resource, $tempName); } } - + if ($success) { - @copy($tempName, $this->destination); + @copy($tempName, $this->_destination); @unlink($tempName); return $success; } return FALSE; } - function resize($width, $height) { - $this->convert['width'] = (int) round($width); - $this->convert['height'] = (int) round($height); + /** + * Internal function to Resize image + * + * @param int $width + * @param int $height + * + * @return bool + */ + private function resize($width, $height) { + $this->_convert['width'] = (int) round($width); + $this->_convert['height'] = (int) round($height); // create original image and temp canvas $this->gdCreateResource(); $this->gdCreateTmp($width, $height); $result = imagecopyresampled( - $this->tmp, - $this->resource, + $this->_tmp, + $this->_resource, 0, 0, 0, 0, - $this->convert['width'], - $this->convert['height'], - $this->info['width'], - $this->info['height'] + $this->_convert['width'], + $this->_convert['height'], + $this->_info['width'], + $this->_info['height'] ); if ($result) { - imagedestroy($this->resource); - $this->resource = $this->tmp; - $this->info['width'] = $width; - $this->info['height'] = $height; + imagedestroy($this->_resource); + $this->_resource = $this->_tmp; + $this->_info['width'] = $width; + $this->_info['height'] = $height; return TRUE; } return FALSE; } - function sharpen($matrix = array()) { + /** + * Internal function to Sharpen image + * + * @param array $matrix + * [ + * [0, -2, 0] + * [-2, 11, -2] + * [0, -2, 0] + * ] + * + * @return bool + */ + private function sharpen($matrix = array()) { if (empty($matrix)) { - $matrix = array( + $matrix = array( array(0, -2, 0), array(-2, 11, -2), array(0, -2, 0), @@ -202,18 +309,27 @@ function sharpen($matrix = array()) { } $divisor = array_sum(array_map('array_sum', $matrix)); $offset = 0; - imageconvolution($this->resource, $matrix, $divisor, $offset); + imageconvolution($this->_resource, $matrix, $divisor, $offset); } - function crop($x, $y, $width, $height) { + /** + * Internal function to Crop image + * + * @param int $x + * @param int $y + * @param int $width + * @param int $height + * @return void + */ + private function crop($x, $y, $width, $height) { $width = (int) round($width); $height = (int) round($height); - $this->convert['width'] = $width; - $this->convert['height'] = $height; + $this->_convert['width'] = $width; + $this->_convert['height'] = $height; $this->gdCreateTmp($width, $height); $result = imagecopyresampled( - $this->tmp, - $this->resource, + $this->_tmp, + $this->_resource, 0, 0, $x, @@ -224,18 +340,30 @@ function crop($x, $y, $width, $height) { $height ); if ($result) { - imagedestroy($this->resource); - $this->resource = $this->tmp; - $this->info['width'] = $width; - $this->info['height'] = $height; + imagedestroy($this->_resource); + $this->_resource = $this->_tmp; + $this->_info['width'] = $width; + $this->_info['height'] = $height; return TRUE; } return FALSE; } - function scale($width, $height, $upscale = FALSE) { + /** + * Scale image and respect dimension + * + * @param int $width + * @param int $height + * @param bool $upscale + * + * @return bool + */ + public function scale($width, $height, $upscale = FALSE) { + if (!$this->_prepared) { + return FALSE; + } list($width, $height) = $this->getConvertDimensions($width, $height, $upscale); - if ($this->convert['skip']) { + if ($this->_convert['skip']) { return $this->save(); } elseif ($this->resize($width, $height)) { @@ -247,11 +375,24 @@ function scale($width, $height, $upscale = FALSE) { } } - function scaleCrop($width, $height, $upscale = FALSE) { - $scale = max($width / $this->info['width'], $height / $this->info['height']); - $x = ($this->info['width'] * $scale - $width) / 2; - $y = ($this->info['height'] * $scale - $height) / 2; - if ($this->resize($this->info['width'] * $scale, $this->info['height'] * $scale)) { + /** + * Scale and Crop image + * + * Crop will crop the center of image + * + * @param int $width + * @param int $height + * @param bool $upscale + * @return void + */ + public function scaleCrop($width, $height) { + if (!$this->_prepared) { + return FALSE; + } + $scale = max($width / $this->_info['width'], $height / $this->_info['height']); + $x = ($this->_info['width'] * $scale - $width) / 2; + $y = ($this->_info['height'] * $scale - $height) / 2; + if ($this->resize($this->_info['width'] * $scale, $this->_info['height'] * $scale)) { if ($this->crop($x, $y, $width, $height)) { $this->sharpen(); return $this->save(); @@ -261,9 +402,31 @@ function scaleCrop($width, $height, $upscale = FALSE) { } /** - * function to return proportional height and width and image url for passing modal + * Destructor + */ + function __destruct() { + if (!empty($this->_resource)) { + imagedestroy($this->_resource); + } + if (!empty($this->_tmp)) { + imagedestroy($this->_tmp); + } + } + + /** + * Get Image Info + * + * @return array + * [ + * 'url' => $file, + * 'width' => $imageWidth, + * 'height' => $imageHeight, + * 'thumb' => [ + * 'width' => $imageThumbWidth, + * 'height' => $imageThumbHeight, + * ], + * ] * - * @return Array thumb dimension of image */ public static function getImageVars($file) { list($imageWidth, $imageHeight) = @getimagesize($file); @@ -295,9 +458,9 @@ public static function getImageVars($file) { } /** - * function to return proportional height and width of the image + * Get image modal html * - * @return Array thumb dimension of image + * @return string */ public static function getImageModal($vars) { $template = CRM_Core_Smarty::singleton(); @@ -306,8 +469,4 @@ public static function getImageModal($vars) { return $template->fetch('CRM/common/modal.tpl'); } - function __destruct() { - imagedestroy($this->resource); - imagedestroy($this->tmp); - } } diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index 53dd7d1fe..1bddff8b1 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -36,6 +36,7 @@ class CRM_Utils_Mail { const DMARC_MAIL_PROVIDERS = 'yahoo.com|gmail.com|msn.com|outlook.com|hotmail.com'; + const DKIM_EXTERNAL_VERIFIED_FILE = 'verified_external_dkim.config'; /** * Wrapper function to send mail in CiviCRM. Hooks are called from this function. @@ -584,5 +585,73 @@ static function checkMailInDomains($email, $domains) { } return FALSE; } + + /** + * Get valid DKIM domain list via verified from email addr + * + * @param string $savePath if given, list will save to specify file name into system path + * @return array + */ + public static function validDKIMDomainList($externalOnly = FALSE, $saveFile = NULL) { + global $civicrm_conf; + if (empty($civicrm_conf['mailing_dkim_domain']) || empty($civicrm_conf['mailing_dkim_selector'])) { + return NULL; + } + $defaultFrom = CRM_Mailing_BAO_Mailing::defaultFromMail(); + $defaultDomain = substr($defaultFrom, strpos($defaultFrom, '@')+1); + if ($saveFile) { + $confPath = CRM_Utils_System::cmsRootPath().DIRECTORY_SEPARATOR.CRM_Utils_System::confPath().DIRECTORY_SEPARATOR; + $savePath = $confPath.basename($saveFile); + $existsDomains = array(); + if (file_exists($savePath)) { + $existsList = file_get_contents($savePath); + $existsDomains = explode("\n", $existsList); + } + } + + $validType = CRM_Admin_Form_FromEmailAddress::VALID_EMAIL | CRM_Admin_Form_FromEmailAddress::VALID_SPF | CRM_Admin_Form_FromEmailAddress::VALID_DKIM; + $verifiedDomains = CRM_Admin_Form_FromEmailAddress::getVerifiedEmail($validType, 'domain'); + foreach($verifiedDomains as $idx => $domain) { + if ($externalOnly && preg_match('/'.preg_quote($defaultDomain).'$/', $domain)) { + unset($verifiedDomains[$idx]); + } + $isValid = FALSE; + + // do not trigger dns query when list exists + if (in_array($domain, $existsDomains)) { + $isValid = TRUE; + } + // this will do dns query + else { + $isValid = self::checkDKIM($domain); + } + if (!$isValid) { + unset($verifiedDomains[$idx]); + } + } + if (!empty($verifiedDomains)) { + if ($savePath) { + $addDomains = array_diff($verifiedDomains, $existsDomains); + if (!empty($addDomains)) { + $file = fopen($savePath, 'w'); + if ($file !== FALSE) { + $written = fwrite($file, implode("\n", $verifiedDomains)); + if (!$written) { + CRM_Core_Error::debug_log_message('File save failed: '.$savePath); + } + fclose($file); + } + else { + CRM_Core_Error::debug_log_message('Could not open file to save: '.$savePath); + } + if (file_exists($savePath)) { + CRM_Utils_File::chmod($savePath, 0666); + } + } + } + return $verifiedDomains; + } + return array(); + } } diff --git a/CRM/Utils/ReCAPTCHA.php b/CRM/Utils/ReCAPTCHA.php index acb1a8be0..1cf8cac66 100644 --- a/CRM/Utils/ReCAPTCHA.php +++ b/CRM/Utils/ReCAPTCHA.php @@ -69,10 +69,13 @@ static function &singleton() { function __construct() { $require_path = 'packages/recaptcha/src/ReCaptcha'; - if(CRM_Utils_System::moduleExists('recaptcha')){ - $possible_path = drupal_get_path('module', 'recaptcha').'/recaptcha-php/src/ReCaptcha'; - if(is_file($possible_path.'/ReCaptcha.php')){ - $require_path = $possible_path; + $config = CRM_Core_Config::singleton(); + if(CRM_Utils_System::moduleExists('recaptcha') && $config->userFramework == 'Drupal') { + if ($config->userSystem->version < 8) { + $possible_path = drupal_get_path('module', 'recaptcha').'/recaptcha-php/src/ReCaptcha'; + if(is_file($possible_path.'/ReCaptcha.php')){ + $require_path = $possible_path; + } } } diff --git a/CRM/Utils/System.php b/CRM/Utils/System.php index b769d7d7b..ba8816db9 100644 --- a/CRM/Utils/System.php +++ b/CRM/Utils/System.php @@ -1577,7 +1577,7 @@ static function freeObject(&$obj, $debug = FALSE){ /** * Get CMS public or private or temp dir * - * @return boolean. + * @return string */ public static function cmsDir($type) { return CRM_Core_Config::$_userSystem->cmsDir($type); diff --git a/css/civicrm.css b/css/civicrm.css index ee94c0c97..fab51460e 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -1,3 +1,21 @@ +@charset "UTF-8"; + +/** Variables **/ +:root { + --color-error: #f44336; + --color-error-dark: #b71c1c; + --color-form-input-border: #999; + --color-crm-special-contribute-primary: var(--neticrm-color-crm-special-contribute-primary, #3f51b5); + --color-crm-special-contribute-info-link: var(--neticrm-color-crm-special-contribute-info-link, #c4ccff); + --font-sans-serif: "PingFang TC", "Heiti TC", "Noto Sans TC", "Noto Sans CJK TC", NotoSansCJKtc-Regular, source-han-sans-traditional, "Microsoft JhengHei Fixed", "Microsoft JhengHei", "微軟正黑體", sans-serif; + --font-icon-zmdi: "Material-Design-Iconic-Font"; + --header-min-height: 120px; + --pcp-progress-padding: 40px; + --pcp-progress-amount-height: 40px; + --pcp-progress-bar-height: 30px; + --pcp-leading-height: calc(100dvh - var(--header-min-height) - var(--pcp-progress-padding) - var(--pcp-progress-amount-height) - var(--pcp-progress-bar-height)); +} + /* Visually hidden helper (bootstrap 5) */ .visually-hidden, .visually-hidden-focusable:not(:focus):not(:focus-within) { @@ -1729,6 +1747,19 @@ div.block-civicrm li, .crm-container ul li, .crm-container ul.treeview li { color: #536DFE; } +/* Attachment */ +.crm-container .attachments table .current-attachments img { + max-width: 18%; +} +.crm-container .attachments-upload-your-own-image-row ~ .attachments-form-file-row, +.crm-container .crm-contribution-campaign-form-block .attachments-upload-your-own-image-row ~ .attachments-form-file-row { + display: none; +} +.crm-container .attachments-upload-your-own-image-row.is-checked ~ .attachments-form-file-row, +.crm-container .crm-contribution-campaign-form-block .attachments-upload-your-own-image-row.is-checked ~ .attachments-form-file-row { + display: table-row; +} + /* ** Style for hiding blocks or table rows */ @@ -1871,74 +1902,78 @@ table.campaign td, } .crm-container .honor-roll-wrapper { - margin: 30px auto; - text-align: center; - max-width: 768px; + margin: 40px auto; + padding: 0 12px; + text-align: center; } - -.crm-container .pcp-honor-roll-entry { - display: inline-block; - min-width: 150px; - margin: 10px 0; +.crm-container .honor-roll-title { + margin-bottom: 20px; + font-size: 32px; } - -.crm-container .pcp-leading { - min-height: 300px; - overflow:hidden; - background-repeat: no-repeat; - background-position: 50% 50%; - background-size: cover; +.crm-container .pcp-honor-roll-items { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(60%, 1fr)); + grid-gap: 15px; + grid-auto-rows: minmax(0, auto); + grid-auto-rows: 20px; + grid-auto-flow: dense; + counter-reset: waterfall-item; +} +.crm-container .pcp-honor-roll-item { + grid-column-end: span 1; + background: #f5f5f5; + transition: all .3s; } -.crm-container .thermometer-wrapper { - display: table; - width: 100%; - background: #EFEFEF; - margin-bottom: 50px; +.crm-container .pcp-honor-roll-item > .inner { + padding: 15px 20px; + text-align: left; } -.crm-container .thermometer-cell { - display: table-cell; +.crm-container .pcp-honor-roll-name { + font-size: 20px; } -.crm-container .thermometer-cell label { - font-weight: normal; +.crm-container .pcp-honor-roll-message { + font-size: 15px; + color: #333; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 8; + overflow: hidden; } -.crm-container .thermometer-cell .crmMoney { - font-weight: bold; +.crm-container .pcp-honor-roll-item:hover .pcp-honor-roll-message { + display: block; + overflow: visible; } -.crm-container .thermometer-fill-wrapper { - height: 50px; - position:relative; - width: 80%; +.crm-container .pcp-honor-roll-name + .pcp-honor-roll-message { + margin-top: 10px; } -.crm-container .thermometer-fill { - bottom:0; - left:0; - position:absolute; - height: 50px; - background: #fff73b; +.crm-container .pcp-honor-roll-item:hover { + color: #fff; + background: var(--color-crm-special-contribute-primary); } -.crm-container .thermometer-fill:after { - position: absolute; - content:''; - display: block; - width: 0; - height: 0; - right: -25px; - border-style: solid; - border-width: 25px 0 25px 25px; - border-color: transparent transparent transparent #fff73b; +.crm-container .pcp-honor-roll-item:hover .pcp-honor-roll-message { + color: #fff; } - -.crm-container .thermometer-pointer { - position:absolute; - top: 26px; - color: #777; +@media screen and (min-width: 992px) { + .crm-container .attachments > .description { + padding-left: 100px; + } + .crm-container .honor-roll-wrapper { + padding: 0; + } + .crm-container .pcp-honor-roll-items { + grid-template-columns: repeat(auto-fill, minmax(25%, 1fr)); + grid-auto-rows: 20px; + grid-gap: 30px; + } } -.crm-container .thermometer-pointer-over { - position:absolute; - top: 10px; - color: #999; - font-size: 1.2em; - font-weight: bold; + +.crm-container .pcp-leading { + height: var(--pcp-leading-height, 300px); + max-height: 50dvh; + overflow:hidden; + background-repeat: no-repeat; + background-position: 50% 50%; + background-size: cover; } .crm-container .pcp-amount-raised { position:absolute; @@ -1971,17 +2006,460 @@ table.campaign td, .crm-container .pcp-donate { text-align: center; } - +.crm-container .pcp-donate .button, +.crm-container .pcp-donate a.button, +.crm-container .pcp-donate a.button:visited, +.crm-container .pcp-donate a.button:link { + margin: 0; + padding: 16px; + width: auto; + min-width: 200px; + line-height: 1.2; + font-weight: 400; + font-size: 20px; + color: #fff; + border-radius: 2px; + background: var(--color-crm-special-contribute-primary); + box-shadow: 1px 1px 10px 1px rgba(0,0,0,.25); +} +.crm-container .pcp-donate .button.is-disabled, +.crm-container .pcp-donate a.button.is-disabled { + cursor: not-allowed !important; + color: #9e9e9e !important; + border: 1px solid #e0e0e0 !important; + outline: 0 !important; + background-color: #f5f5f5 !important; + box-shadow: 1px 1px 10px 1px rgba(0,0,0,.1); +} +.crm-container .pcp-donate .button:last-child { + margin-right: 0; +} +.crm-container .pcp-donate-desc { + margin: 12px 0; + text-align: center; + font-size: 1rem; +} +.crm-container .pcp-amount-goal-top { + position: relative; + margin: 50px 0 0 0; + padding: 0; + text-align: center; + font-weight: bold; + font-size: 20px; +} +.crm-container .pcp-amount-goal-top .counter { + color: var(--color-crm-special-contribute-primary); +} +.crm-container .pcp-amount-goal-top + .pcp-donate { + margin: 20px 0 0 0; +} +.crm-container .pcp-amount-goal-top + .pcp-donate + .pcp-donate-desc { + margin-bottom: 30px; +} +.crm-container .pcp-campaign { + padding-bottom: 40px; +} .crm-container .pcp-intro-text { - margin: 30px 50px 30px 50px; - font-size: 1.75em; - text-indent: -16px; + position: relative; + margin: 30px 0; + padding: 35px 40px; + font-size: 1.25rem; + font-style: normal; + font-family: var(--font-sans-serif); + border: 0; } -.crm-container .pcp-intro-text .zmdi{ - font-size: 30px; - color: #999; +.crm-container .pcp-intro-text::before, +.crm-container .pcp-intro-text::after { + position: absolute; + font-size: 72px; + color: var(--color-crm-special-contribute-primary,#999); + font-family: georgia; + line-height: 72px; + font-weight: 700; +} +.crm-container .pcp-intro-text::before { + content: "\201C"; + top: 0; + left: 0; + margin: -5px 0 0 0; +} +.crm-container .pcp-intro-text::after { + content: "\201D"; + right: 0; + bottom: 0; + margin: 0 0 -35px 0; +} +.crm-container .pcp-create-your-own { + clear:left; + margin:1em 0; +} +.crm-container .pcp-page-text { + margin: 0 auto 1em; + padding: 10px 12px; + font-family: var(--font-sans-serif); +} +.crm-container .pcp-parent-link { + text-align: center; + margin: 10px 0; +} +.crm-container .pcp-page-text p, +.crm-container .pcp-page-text ul, +.crm-container .pcp-page-text ol { + margin: 0 0 2.25em 0; + line-height: 1.7; + letter-spacing: .4px; + font-size: 1.125rem; + font-family: var(--font-sans-serif); +} +.crm-container .pcp-page-text li { + margin-left: 30px; +} +.crm-container .pcp-sticky-header { + opacity: 0; + visibility: hidden; + position: fixed; + z-index: -10; + top: 0; + left: 0; + right: 0; + background: #fff; + box-shadow: 0 3px 5px rgba(57, 63, 72, 0.3); + transition: .3s all; +} +.crm-container .pcp-sticky-header.is-visible { + opacity: 1; + visibility: visible; + z-index: 100; +} +.crm-container .pcp-sticky-header > .inner { + position: relative; + display: flex; + justify-content:space-between; + align-items: center; + gap: 10px 30px; + padding: 12px 20px; +} +.crm-container .pcp-sticky-header .pcp-honor-counter { + display: flex; + align-items: center; + align-self: stretch; + margin: -10px 0 -12px; + font-size: .9375rem; + border-bottom: 4px solid var(--color-crm-special-contribute-primary); +} +.crm-container .pcp-sticky-header .pcp-donate { + margin-left: auto; +} +.crm-container .pcp-sticky-header .pcp-donate .pcp-contribute-button, +.crm-container .pcp-sticky-header .pcp-donate .pcp-contribute-button:link { + margin: 0; + padding: 10px 20px; + min-width: 0; + font-size: 1rem; +} +.crm-container .pcp-sticky-header .pcp-contribute-button .mini-text { + display: none; +} +.is-mobile-mode .crm-container .pcp-sticky-header .pcp-contribute-button .normal-text { + display: none; +} +.is-mobile-mode .crm-container .pcp-sticky-header .pcp-contribute-button .mini-text { + display: block; +} +.crm-container .pcp-sticky-header .pcp-social-links { + display: none; +} +.crm-container .pcp-sticky-header .social-link { + display: flex; + justify-content: center; + align-items: center; + overflow: hidden; + width: 36px; + height: 36px; + line-height: 36px; + text-align: center; + text-decoration: none; + vertical-align: middle; + font-size: 0; + color: #fff; + transition: none; + background-size: contain; + filter: grayscale(1); +} +.crm-container .pcp-sticky-header .social-link.facebook { + background-image:url("../i/exttm/facebook_logo.png"); + filter: grayscale(1) brightness(1.6); +} +.crm-container .pcp-sticky-header .social-link.facebook:hover { + filter: unset; +} +.crm-container .pcp-sticky-header .social-link.line { + background-image:url("../i/exttm/line_app_icon.png"); +} +.crm-container .pcp-sticky-header .social-link.line:hover { + filter: unset; +} + +@media (min-width: 992px) { + .crm-container .pcp-sticky-header .pcp-honor-counter { + font-size: 1rem; + } + .crm-container .pcp-sticky-header .pcp-donate .pcp-contribute-button, + .crm-container .pcp-sticky-header .pcp-donate .pcp-contribute-button:link { + font-size: 1.25rem; + } + .crm-container .pcp-sticky-header .pcp-social-links { + display: flex; + gap: 10px; + margin: 0; + padding: 0; + list-style: none; + } +} + +/* CRM box & list */ +.crm-list, +ul.crm-list, +.block .crm-list { + --crm-list-gutter: 16px; + margin: 24px 0; + padding: 0; + list-style: none; + border-top: 1px solid #ccc; +} +.crm-list .crm-list-item { + margin: 0; + padding: 12px 0; + font-size: 15px; + border-bottom: 1px solid #ccc; +} +.crm-list .crm-list-item:hover { + background: #f5f5f5; +} +.crm-list .crm-list-item a { + color: #1976d2; + text-decoration: none; +} +.crm-list .crm-list-item a:hover { + color: #2196f3; + text-decoration: none; +} +.crm-box { + --crm-box-gutter: 12px; + --crm-box-gutter-y: 12px; + --crm-box-gutter-x: var(--crm-box-gutter); + text-align: left; + border: 1px solid #ccc; + border-radius: 5px; + background: #fff; + box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px; + transition: all .3s; +} +.crm-box:hover { + box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 8px; +} +.crm-box * { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +.crm-box-inner { + position: relative; +} +.crm-box a { + color: #1976d2; +} +.crm-box p { + margin-bottom: 1em; +} +.crm-box .message { + padding: 16px; + font-size: .9375rem; + color: #3f62b5; + border-radius: 6px; + background: #dbeaff; +} +.crm-box .message h3 { + font-weight: bold; + font-size: 1.125rem; +} +.crm-box .tip { + font-size: .9375rem; + color: #616161; +} +.crm-box-body { + padding: var(--crm-box-gutter-y) var(--crm-box-gutter-x) calc(var(--crm-box-gutter-y) * 2); + line-height: 1.6; + color: #424242; +} +@media (min-width: 992px) { + .crm-list .crm-list-item { + padding: 12px; + } + .crm-list .crm-list-item { + display: flex; + align-items: center; + flex-wrap: wrap; + } + .crm-list .crm-list-item .desc { + margin-left: auto; + } + .crm-box { + --crm-box-gutter: 24px; + --crm-box-gutter-y: 15px; + --crm-box-gutter-x: var(--crm-box-gutter); + } +} + +/* PCP backend */ +.crm-container .pcp-management { + background: #f2f5f6; +} +.crm-container .pcp-management > .inner { + padding: 12px; +} +.crm-container .pcp-preset-img-list { + display: flex; + flex-wrap: wrap; + gap: 10px; + position: relative; + margin: 0; + list-style: none; +} +.crm-container .pcp-preset-img-list .item { + position: relative; + opacity: .3; + border: 2px solid rgba(0,0,0,.15); +} +.crm-container .pcp-preset-img-list .item:hover { + cursor: not-allowed; +} +.crm-container .pcp-preset-img-list.is-active .item { + opacity: 1; +} +.crm-container .pcp-preset-img-list.is-active .item:hover { + border-color: rgba(0,0,0,.3); + cursor: pointer; +} +.crm-container .pcp-preset-img-list .item.is-selected, +.crm-container .pcp-preset-img-list .item.is-selected:hover { + border-color: rgba(0,0,0,1); +} +.crm-container .pcp-preset-img-list .item.is-selected::before, +.crm-container .pcp-preset-img-list .item.is-selected:hover::before { + content: "\f26b"; + position: absolute; + top: 0; + left: 0; + margin: 4px; + width: 20px; + height: 20px; + display: flex; + justify-content: center; + align-items: center; + font-family: var(--font-icon-zmdi); + font-size: 16px; + color: #fff; + border: 2px solid #fff; + border-radius: 50%; + background: #000; +} +.crm-container .pcp-preset-img-list .item img { + display: block; + max-width: 90px; +} +.crm-container .crm-pcp-submit-buttons-top { + position: sticky; + left: 0; + right: 0; + top: 0; + z-index: 10; + padding: 10px; + background: #fff; } +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed { + display: block; +} +.crm-container .crm-contribution-campaign-form-block .crm-accordion-wrapper { +} +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed tr { + display: block; +} +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed td, +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.label, +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.content { + display: block; + box-sizing: border-box; + width: 100%; +} +.crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.label { + width: 100%; + text-align: left; +} +.crm-container .crm-contribution-campaign-form-block .crm-form-elem, +.crm-container .crm-contribution-campaign-form-block .form-text, +.crm-container .crm-contribution-campaign-form-block .form-textarea, +.crm-container .crm-contribution-campaign-form-block .form-CKeditor, +.crm-container .crm-contribution-campaign-form-block .cke { + width: 100%; +} +.crm-container .crm-contribution-campaign-form-block .cke[style*="width"] { + width: 100% !important; + max-width: 720px; +} +@media (min-width: 992px) { + .crm-container .pcp-management > .inner { + padding: 30px 20px; + } + .crm-container .pcp-preset-img-list .item img { + max-width: 180px; + } + .crm-container .pcp-preset-img-list .item.is-selected::before, + .crm-container .pcp-preset-img-list .item.is-selected:hover::before { + margin: 4px; + width: 30px; + height: 30px; + font-size: 20px; + } + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed { + display: table; + } + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed tr { + display: table-row; + } + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed td, + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.label, + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.content { + display: table-cell; + box-sizing: content-box; + width: auto; + } + .crm-container .crm-contribution-campaign-form-block .form-layout-compressed td.label { + width: 200px; + text-align: right; + } + .crm-container .attachments-upload-your-own-image-row ~ .attachments-form-file-row, + .crm-container .crm-contribution-campaign-form-block .attachments-upload-your-own-image-row ~ .attachments-form-file-row { + display: none; + } + .crm-container .attachments-upload-your-own-image-row.is-checked ~ .attachments-form-file-row, + .crm-container .crm-contribution-campaign-form-block .attachments-upload-your-own-image-row.is-checked ~ .attachments-form-file-row { + display: table-row; + } + .crm-container .crm-contribution-campaign-form-block .crm-form-elem, + .crm-container .crm-contribution-campaign-form-block .form-text, + .crm-container .crm-contribution-campaign-form-block .form-textarea, + .crm-container .crm-contribution-campaign-form-block .form-CKeditor { + width: auto; + } + .crm-container .crm-contribution-campaign-form-block .six { + width: 7em; + } + .crm-container .crm-contribution-campaign-form-block .big { + width: 36em; + } +} .crm-container .ui-draggable { background: url("../i/draggable.png") no-repeat left 1px; @@ -2043,22 +2521,6 @@ table.campaign td, top: 15px; } -.crm-container .pcp-create-your-own { - clear:left; - margin:1em 0; -} - -.crm-container .pcp-page-text { - margin-bottom: 1em; - max-width: 768px; - margin: 0 auto; - padding: 10px; -} -.crm-container .pcp-parent-link { - text-align: center; - margin: 10px 0; -} - .crm-container table.nestedSelector { margin: 0px; width: 100%; @@ -3670,6 +4132,7 @@ table.crm-info-panel td.label { } .crm-container .form-layout td.label, +.crm-container .form-layout-compressed td.label, .crm-container form table.report .label, .crm-container form table label, .crm-container form table.report label { @@ -6554,6 +7017,12 @@ input.crm-form-textfield, clear: both; } +@media screen and (max-width: 1600px) { + .crm-container .pcp-leading { + max-height: 56.25dvw; + } +} + @media screen and (max-width: 768px) { .crm-container { margin-top: 0; @@ -6678,7 +7147,7 @@ input.crm-form-textfield, display: block; } .crm-container .pcp-leading { - min-height: 175px; + max-height: 175px; } .crm-container .thermometer-cell { display: block; @@ -6714,6 +7183,8 @@ input.crm-form-textfield, text-align: center; } .crm-container .pcp-intro-text { + margin-left: 12px; + margin-right: 12px; font-size: 1.25em; } } @@ -6782,6 +7253,9 @@ input.crm-form-textfield, .crm-container .progress-block { margin: 0 0 30px 0; } +.crm-container .progress-block .inner { + padding: 20px 12px; +} .crm-container .progress-wrapper { display: flex; justify-content: space-between; @@ -6793,8 +7267,9 @@ input.crm-form-textfield, .crm-container .progress-cell.progress-bar-wrapper { width: 80%; } -.crm-container .progress-cell.progress-button { +.crm-container .progress-cell.progress-buttons { width: 19%; + text-align: center; } .crm-container .progress-bar-wrapper { position:relative; @@ -6804,7 +7279,7 @@ input.crm-form-textfield, } .crm-container .progress-bar { height: 30px; - background: #4cb6ac; + background: var(--color-crm-special-contribute-primary); border-radius: 2px 0 0 2px; box-shadow: 0px 0px 5px 0px #aaa; } @@ -6827,33 +7302,128 @@ input.crm-form-textfield, } .crm-container .progress-amount { display: flex; + flex-wrap: wrap; justify-content: space-between; margin-bottom: 10px; } -.crm-container .progress-amount-raised { +.crm-container .progress-amount .progress-amount-raised { + font-size: .8125rem; } -.crm-container .progress-amount-raised span{ +.crm-container .progress-amount-raised span { font-weight: bold; font-size: 1.1em; - color: #4cb6ac; + color: var(--color-crm-special-contribute-primary); } -.crm-container .progress-amount-goal { +.crm-container .progress-amount .progress-amount-goal { + font-size: .8125rem; } .crm-container .progress-amount-goal span { font-weight: bold; font-size: 1.2em; - color: #3c4db7; + color: var(--color-crm-special-contribute-primary); } -.crm-container .progress-cell .button { - white-space: nowrap; - vertical-align: middle; - text-align: center; - margin: 0; - width: 100%; - background: #3f51b5; - border-radius: 2px; - box-shadow: 1px 1px 10px 1px #aaa; +.crm-container .progress-cell .button, +.crm-container .progress-cell a.button, +.crm-container .progress-cell .button:visited, +.crm-container .progress-cell a.button:link { + white-space: nowrap; + vertical-align: middle; + text-align: center; + margin: 0; + width: 100%; + background: var(--color-crm-special-contribute-primary); + border-radius: 2px; + box-shadow: 1px 1px 10px 1px #aaa; +} +.crm-container .progress-cell .button.is-disabled, +.crm-container .progress-cell a.button.is-disabled { + cursor: not-allowed !important; + color: #9e9e9e !important; + border: 1px solid #e0e0e0 !important; + outline: 0 !important; + background-color: #f5f5f5 !important; + box-shadow: 1px 1px 10px 1px rgba(0,0,0,.1) !important; } +.crm-container .progressbar-fullwidth .progress-cell .button, +.crm-container .progressbar-fullwidth .progress-cell a.button, +.crm-container .progressbar-fullwidth .progress-cell .button:visited, +.crm-container .progressbar-fullwidth .progress-cell a.button:link { + padding: 16px; + width: auto; + min-width: 200px; + line-height: 1.2; + font-weight: 400; + font-size: 20px; + color: #fff; + border-radius: 2px; + background: var(--color-crm-special-contribute-primary); + box-shadow: 1px 1px 10px 1px rgba(0,0,0,.25); +} +.crm-container .progress-desc { + margin: 12px 0; + text-align: center; + font-size: 1rem; +} +.crm-container .progressbar-fullwidth .progress-wrapper { + display: block; +} +.crm-container .progressbar-fullwidth .progress-cell.progress-bar-wrapper { + width: 100%; + margin-bottom: 30px; +} +.crm-container .progressbar-fullwidth .progress-cell.progress-buttons { + width: 100%; +} +@media (min-width: 768px) { + .crm-container .progress-amount .progress-amount-raised { + font-size: 1rem; + } + .crm-container .progress-amount .progress-amount-goal { + font-size: 1rem; + } +} +@media (min-width: 992px) { + .crm-container .progress-block .inner { + padding: 20px; + } + .crm-container .pcp-page-text { + max-width: 720px; + } +} +@media (min-width: 1200px) { + .crm-container .pcp-management > .inner, + .crm-container .progress-block > .inner { + margin-right: auto; + margin-left: auto; + max-width: 992px; + } +} +@media (min-width: 1400px) { + .crm-container .pcp-management > .inner, + .crm-container .progress-block > .inner { + max-width: 1200px; + } + .crm-container .progressbar-fullwidth .progress-cell .button, + .crm-container .progressbar-fullwidth .progress-cell a.button, + .crm-container .progressbar-fullwidth .progress-cell .button:visited, + .crm-container .progressbar-fullwidth .progress-cell a.button:link, + .crm-container .pcp-donate .button, + .crm-container .pcp-donate a.button, + .crm-container .pcp-donate a.button:visited, + .crm-container .pcp-donate a.button:link { + padding: 16px 20px; + min-width: 260px; + font-size: 24px; + } +} +@media (min-width: 1600px) { + .crm-container .pcp-management > .inner, + .crm-container .progress-block > .inner { + max-width: 1400px; + } +} + + /* CSS talk bubble */ .crm-container .bubble{ display: inline-block; @@ -6950,11 +7520,8 @@ input.crm-form-textfield, display: flex; flex-wrap: wrap; margin: 5px 0; + gap: 0 10px; } -.crm-container .flex-general > * { - margin: 0 10px; -} - .crm-container .flex-general button, .crm-container .flex-general input[type="button"], .crm-container .flex-general .button, @@ -6996,6 +7563,18 @@ input.crm-form-textfield, display: none; } +/* new personal campaign */ +.new-personal-campaign-link-wrap { + max-width: 200px; +} +html[lang="en"] .new-personal-campaign-link-wrap { + max-width: 250px; +} +.new-personal-campaign-wrap a.button.url-copy { + margin-left: 0 !important; +} + + /* RWD block */ @media screen and (max-width: 768px) { .crm-container .crm-block-rwd { @@ -7004,6 +7583,144 @@ input.crm-form-textfield, } } +/* crm preview popup */ +.crm-preview-popup { + position: relative; + margin: 40px auto; + max-width: 98%; + background: #fff; +} +.crm-preview-popup .crm-preview-toolbar { + display: flex; + justify-content: space-between; +} +.crm-preview-popup .crm-preview-toolbar { + padding: 15px 20px; +} +.crm-preview-popup .crm-preview-title { + font-size: 1.5rem; +} +.crm-preview-popup .crm-preview-close { + padding: 0; + font-size: 30px; + cursor: pointer; + border: 0; + background: none; +} +.crm-preview-popup .crm-preview-content { + padding: 0 10px 15px; +} +.crm-preview-popup .preview-content { + height: 85vh; +} +.crm-preview-popup .crm-preview-mode { + display: none; +} +.crm-preview-popup .crm-preview-mode-btn { + margin: 0 10px; + padding: 5px 15px; + font-size: 1.125rem; + color: #3F51B5; + cursor: pointer; + border-radius: 5px; + border: 1px solid #3F51B5; + background: #fff; +} +.crm-preview-popup .crm-preview-mode-btn.is-active { + color: #fff; + background: #3F51B5; +} +.crm-preview-popup .crm-preview-panel { + display: none; +} +.crm-preview-popup .crm-preview-panel.is-active { + display: block; +} +.crm-preview-popup .crm-preview-panel .preview-container { + box-sizing: content-box; +} +.crm-preview-popup .crm-preview-iframe { + width: 100%; + height: 100%; + border: 1px solid #ccc; +} +.crm-preview-popup .desktop-preview-container { + max-width: 1200px; + margin: 0 auto; +} +@media screen and (min-width: 480px) { + .crm-preview-popup { + max-width: 90%; + } + .crm-preview-popup .crm-preview-content { + padding: 15px 20px; + } + .crm-preview-popup .mobile-preview-container { + position: relative; + width: 360px; + height: 640px; + margin: auto; + border: 16px black solid; + border-top-width: 60px; + border-bottom-width: 60px; + border-radius: 36px; + } + .crm-preview-popup .mobile-preview-container:before { + content: ''; + display: block; + width: 60px; + height: 5px; + position: absolute; + top: -30px; + left: 50%; + transform: translate(-50%, -50%); + background: #333; + border-radius: 10px; + } + .crm-preview-popup .mobile-preview-container:after { + content: ''; + display: block; + width: 35px; + height: 35px; + position: absolute; + left: 50%; + bottom: -65px; + transform: translate(-50%, -50%); + background: #333; + border-radius: 50%; + } + .crm-preview-popup .mobile-preview-container .preview-content { + width: 360px; + height: 640px; + background: white; + } +} +@media screen and (min-width: 992px) { + .crm-preview-popup .crm-preview-mode { + display: block; + } +} +@media screen and (min-width: 1600px) { + .crm-preview-popup { + max-width: 1320px; + } +} +.crm-management.is-embed-mode { + display: none !important; +} +.crm-container .preview-page-title-block { + border-bottom: 1px solid #e0e0e0; + background: #fff; +} +.crm-container .preview-page-title-block > .inner { + padding: 15px 10px 10px; +} +@media screen and (min-width: 992px) { + .crm-container .preview-page-title-block > .inner { + padding: 20px; + } +} + /* debug */ .xdebug-var-dump { overflow-x: scroll; diff --git a/i/exttm/facebook_logo.png b/i/exttm/facebook_logo.png new file mode 100644 index 000000000..769926deb Binary files /dev/null and b/i/exttm/facebook_logo.png differ diff --git a/i/exttm/line_app_icon.png b/i/exttm/line_app_icon.png new file mode 100644 index 000000000..0efe0d00a Binary files /dev/null and b/i/exttm/line_app_icon.png differ diff --git a/js/ckeditor.config.js b/js/ckeditor.config.js index 0b476d970..5bc0b2c15 100644 --- a/js/ckeditor.config.js +++ b/js/ckeditor.config.js @@ -26,6 +26,7 @@ CKEDITOR.editorConfig = function(config) { ['Format'], ['RemoveFormat'], ['Bold','Italic','Underline','Strike'], + ['FontSize','TextColor','BGColor'], ['NumberedList','BulletedList'], ['Link','Unlink'],['Image'], ['Undo','Redo'] diff --git a/js/footer.js b/js/footer.js index 8e54e324f..cf534babe 100644 --- a/js/footer.js +++ b/js/footer.js @@ -1,10 +1,32 @@ (function ($) { $(document).ready(function(){ -// start here -if (document.querySelector('.crm-container select[data-parent]')) { - new crmDependentSelect('.crm-container select[data-parent]'); -} -$().crmtooltip(); -// end here + let urlParams = new URLSearchParams(window.location.search); + + /** + * This is a straightforward JavaScript workaround when 'templates/CRM/common/Embed.tpl' is not used. + * Advantages: + * - 1. Ensures consistent embedded content styles, especially in scenarios with different templates. + * - 2. Simple and convenient to use. + * Disadvantages: + * - 1. Loads the complete HTML. + * - 2. Sometimes might not be the best practice. + */ + if (urlParams.get('embed') === '1' && !$('.embed-preview-mode').length) { + let crmContainerHtml = $('.crm-container').clone().wrap('