Skip to content

Commit

Permalink
Merge branch 'hotfix' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed May 7, 2024
2 parents b37b3f4 + 0e24a6f commit d9722fa
Show file tree
Hide file tree
Showing 43 changed files with 424 additions and 6,755 deletions.
88 changes: 3 additions & 85 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,3 @@
---
kind: pipeline
type: docker
name: php5

steps:
- name: submodules
image: alpine/git
pull: if-not-exists
commands:
- git submodule update --init --recursive
- name: neticrm ci php 5
image: rg.netivism.com.tw/netivism/docker-neticrm-ci:drone-php5
pull: always
environment:
DRUPAL: "7"
TZ: Asia/Taipei
RUNPORT: 8080
DRUPAL_ROOT: /var/www/html
CIVICRM_TEST_DSN: "mysqli://root@localhost/neticrmci"
commands:
- /usr/bin/supervisord &
- /init.sh
- cd $DRUPAL_ROOT && drush status | grep version
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit CRM/Utils/TypeTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit CRM/Core/Payment/ALLPAYTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit CRM/Core/Payment/SPGATEWAYTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit CRM/Core/Payment/LinePayTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit CRM/Core/Payment/TapPayTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit api/v3/ContributionRecurTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit api/v3/GetOptionsTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit --group CItesting api/v3/PhoneTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit --group CItesting api/v3/ParticipantTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit --group CItesting api/v3/ActivityTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/phpunit && phpunit --group CItesting api/v3/MembershipTest.php
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/batch_action.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/page.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_contact.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_contribution_page.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/add_event.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/edit_contact.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/custom_data.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_allpay.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_allpay_atm.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_allpay_barcode.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/new_contribution.spec.js
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/advanced_search.spec.js
- 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_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
- cd $DRUPAL_ROOT/sites/all/modules/civicrm/tests/playwright/ && npx playwright test tests/contribution_booster.spec.js
- name: notify
image: drillster/drone-email
settings:
from.address:
from_secret: email_from_addr
from.name:
from_secret: email_from_name
host:
from_secret: email_host
port:
from_secret: email_port
username:
from_secret: email_username
password:
from_secret: email_password
recipients:
from_secret: email_recipients
recipients_only: true
skip_verify: true
when:
status:
- failure


---
kind: pipeline
type: docker
Expand Down Expand Up @@ -164,8 +81,6 @@ steps:
when:
status:
- failure
depends_on:
- php5

---
kind: pipeline
Expand Down Expand Up @@ -250,6 +165,8 @@ steps:
when:
status:
- failure
depends_on:
- php7

---
kind: pipeline
Expand Down Expand Up @@ -362,4 +279,5 @@ steps:
skip_verify: true
depends_on:
- php7
- php8
- php8-d10
15 changes: 15 additions & 0 deletions CRM/Contribute/BAO/Contribution/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,21 @@ public static function paymentResultType(&$form, $params, $status = NULL, $messa
$contribution->copyValues($params);
if($contribution->find(TRUE)) {
$status = $contribution->contribution_status_id;

// Check if it is tappay 3d validation
if ($contribution->payment_processor_id) {
$mode = $contribution->is_test ? 'test' : 'live';
$paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($contribution->payment_processor_id, $mode);
if ($paymentProcessor['payment_processor_type'] == 'TapPay' && $paymentProcessor['url_site'] == 1) {
$status = CRM_Utils_Request::retrieve('status', 'String', $form);
if ($status == '0') {
$status = 1;
}
else {
$status = 4;
}
}
}
}
}
}
Expand Down
28 changes: 25 additions & 3 deletions CRM/Contribute/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,31 @@ static function whereClauseSingle(&$values, &$query) {
return;

case 'contribution_status_id':
case 'contribution_status':
require_once "CRM/Core/OptionGroup.php";
$statusValues = CRM_Core_OptionGroup::values("contribution_status");
if ($name == 'contribution_status') {
$statusIndex = null;
if (is_numeric($value) || ctype_digit($value)) {
$value = CRM_Utils_Type::escape($value, 'Integer');
if (isset($statusValues[$value])) {
$statusIndex = $value;
}
}
elseif (is_string($value)) {
$value = CRM_Utils_Type::escape($value, 'String');
$statusIndex = array_search($value, $statusValues);
}

// Check contribution status exit or not
if ($statusIndex !== null && $statusIndex != false) {
$value = $statusIndex;
}
else {
$value = 0;
}
}

if (is_array($value)) {
foreach ($value as $k => $v) {
if ($v) {
Expand All @@ -472,9 +497,6 @@ static function whereClauseSingle(&$values, &$query) {
$status = $value;
}

require_once "CRM/Core/OptionGroup.php";
$statusValues = CRM_Core_OptionGroup::values("contribution_status");

$names = array();
if (is_array($val)) {
foreach ($val as $id => $dontCare) {
Expand Down
16 changes: 13 additions & 3 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ public function buildQuickForm() {
$this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE);
$this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE);

// refs #39423, donate from oid should remove some rule
// donate from oid should remove some rule
if (!empty($this->_originalId)) {
foreach($this->_rules as $fieldName => &$qfField) {
if (preg_match('/^custom_\d+/', $fieldName) && isset($this->_originalValues[$fieldName])) {
if (preg_match('/^custom_\d+/', $fieldName) && isset($this->_originalValues[$fieldName]) && strstr($params[$fieldName], CRM_Utils_String::MASK)) {
foreach($qfField as $idx => $rule) {
if ($rule['type'] != 'xssString') {
unset($qfField[$idx]);
Expand Down Expand Up @@ -356,8 +356,18 @@ public function buildQuickForm() {
$contact = $this->_params;
foreach ($fields as $name => $dontCare) {
if (isset($contact[$name])) {
// convert submit values to masks
if (!strstr($name, 'country') && !strstr($name, 'city') && !strstr($name, 'state_province') && $this->_fields[$name]['html_type'] === 'Text' && $this->get('csContactID')) {
$defaults[$name] = CRM_Utils_String::mask($contact[$name]);
// when user enter new value
// do not mask their current input
if (!strstr($contact[$name], CRM_Utils_String::MASK)) {
$defaults[$name] = $contact[$name];
}
// when user use original value
// mask their input to prevent data leak
else {
$defaults[$name] = CRM_Utils_String::mask($contact[$name]);
}
}
else {
$defaults[$name] = $contact[$name];
Expand Down
8 changes: 1 addition & 7 deletions CRM/Contribute/Form/Contribution/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,6 @@ public function buildQuickForm() {
if ($this->_ppType) {
return CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
}

$config = CRM_Core_Config::singleton();

$this->applyFilter('__ALL__', 'trim');
Expand Down Expand Up @@ -790,7 +789,6 @@ public function buildQuickForm() {
$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'],
Expand All @@ -800,12 +798,8 @@ public function buildQuickForm() {
'achieved_status' => $achievement['achieved'],
'fullwidth' => FALSE,
'display' => $achievement['goal'] ? TRUE : FALSE,
'link_display' => FALSE
);

$introTextAssigned = $template->get_template_vars('intro_text') !== null;
if ($introTextAssigned) {
$progress['link_display'] = TRUE;
}
$this->assign('progress', $progress);

// hidden track id
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/PCP/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function postProcess() {
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';
$pcpPresetFile = 'pcp_preset_'.$pcpPresetNum.'.webp';
$dest = $config->customFileUploadDir.$pcpPresetFile;
global $civicrm_root;
if (!file_exists($dest) && file_exists($civicrm_root.'packages/midjourney/'.$pcpPresetFile)) {
Expand Down
13 changes: 13 additions & 0 deletions CRM/Contribute/Page/ContributionPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,19 @@ function run() {
if ($shorten) {
$this->assign('shorten', $shorten);
}
$shorten_pcp = CRM_Core_OptionGroup::getValue('shorten_url', 'civicrm_pcp.'.$id, 'name', 'String', 'value');
if ($shorten_pcp) {
$this->assign('shorten_pcp', $shorten_pcp);
}

$this->assign('pcp_is_active', 0);
$pcpInfo = new CRM_Contribute_DAO_PCPBlock();
$pcpInfo->entity_table = 'civicrm_contribution_page';
$pcpInfo->entity_id = $id;
$pcpInfo->find(TRUE);
if (!empty($pcpInfo->is_active)) {
$this->assign('pcp_is_active', 1);
}

// statistics
CRM_Utils_System::setTitle(ts('Dashlets')." - ".$page['title']);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Page/PCPInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function run() {
'fullwidth' => TRUE,
'display' => $pcpInfo['is_thermometer'],
'current' => $totalAmount,
'achieved_percent' => floor($achieved) <= 100 ? $achieved : 100,
'achieved_percent' => floor($achieved),
'achieved_status'=> floor($achieved) >= 100 ? TRUE : FALSE,
'contribution_page_is_active' => $contributionPageInfo['is_active']
);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Page/AJAX/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getPermissionedLocation() {
CRM_Utils_System::civiExit();
}

function jqState($config) {
public static function jqState($config) {
$elements = array();
if (!isset($_GET['_value']) || empty($_GET['_value']) || !CRM_Utils_Type::validate($_GET['_value'], 'Positive', FALSE)) {
echo json_encode($elements);
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/Page/AJAX/SaveShortenURL.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ static function run() {
$pageId = CRM_Utils_Request::retrieve('page_id', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
$pageType = CRM_Utils_Request::retrieve('page_type', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
$shorten = CRM_Utils_Request::retrieve('shorten', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'REQUEST');
if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) {
if (in_array($pageType, array('civicrm_contribution_page', 'civicrm_pcp', 'civicrm_event.info', 'civicrm_event.register', 'civicrm_uf_group'))) {
$exists = CRM_Core_OptionGroup::getValue('shorten_url', $pageType.'.'.$pageId, 'name', 'String', 'id');
$groupParams = array(
'name' => 'shorten_url',
Expand Down
Loading

0 comments on commit d9722fa

Please sign in to comment.