Skip to content

Commit

Permalink
Refs #42307, Fix type error in PHP 8 for string concatenation and red…
Browse files Browse the repository at this point in the history
…efine addNote title.
  • Loading branch information
apple843119 committed Dec 27, 2024
1 parent fae38e6 commit cf996ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions CRM/Contribute/BAO/TaiwanACH.php
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ static function getRegexpFromFormatString($formatString) {

static function doProcessVerification($recurId, $parsedData, $isPreview = TRUE) {
// Consider type is Bank or Post
$arrayLen = max(array_keys($parsedData))+1;
$arrayLen = !empty($parsedData) ? (intval(max(array_filter(array_keys($parsedData), 'is_numeric'))) + 1) : 0;
if ($arrayLen == 18 ) {
$processType = self::BANK;
}
Expand Down Expand Up @@ -1223,7 +1223,7 @@ static function doProcessVerification($recurId, $parsedData, $isPreview = TRUE)

static function doProcessTransaction($contributionId, $parsedData, $isPreview = TRUE) {
// Consider type is Bank or Post
$arrayLen = max(array_keys($parsedData))+1;
$arrayLen = !empty($parsedData) ? (intval(max(array_filter(array_keys($parsedData), 'is_numeric'))) + 1) : 0;
if ($arrayLen == 20 ) {
$processType = self::POST;
$errorCode = $parsedData[15];
Expand Down Expand Up @@ -1340,6 +1340,7 @@ static function doProcessTransaction($contributionId, $parsedData, $isPreview =
if($pass){
// Solve the contribution.
$result['executed'] = TRUE;
$note = '';
if ($isSuccess) {
// Run completeTrransaction.

Expand Down Expand Up @@ -1371,7 +1372,7 @@ static function doProcessTransaction($contributionId, $parsedData, $isPreview =
$note = $result['cancel_reason'];
}
// Finish or not, add note.
self::addNote($note, $objects['contribution']);
self::addNote($note, '');
}
else {
$result['executed'] = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Note.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static function &add(&$params, $ids) {
*/
static function dataExists(&$params) {
// return if no data present
if (!strlen($params['note']) && !strlen($params['subject'])) {
if (!empty($params['note']) && !empty($params['subject'])) {
return FALSE;
}
return TRUE;
Expand Down

0 comments on commit cf996ab

Please sign in to comment.