Skip to content

[PHP8.2] declare deleteMessage on entityFormTrait #25802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 15, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Php8.2 declare deleteMessage on entityFormTrait

Before

Property used in a getter but not declared. It is declared on some but not all of the classes that implement the trait

After

Declared on the trait, removed from implementing classes

Technical Details

Comments

@civibot
Copy link

civibot bot commented Mar 13, 2023

(Standard links)

@civibot civibot bot added the master label Mar 13, 2023
Php8.2 declare deleteMessage on the EntityFormTrait
@@ -66,7 +66,7 @@
{if $action eq 8}
<div class="messages status no-popup">
{icon icon="fa-info-circle"}{/icon}
{$deleteMessage}
{$deleteMessage|smarty:nodefaults}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the other tpl places have |escape so I checked & here is what is assigned

public function setDeleteMessage() {
    $this->deleteMessage = '<span class="font-red bold">'
      . ts('WARNING: Deleting this membership will also delete any related payment (contribution) records.')
      . ' '
      . ts('This action cannot be undone.')
      . '</span><p>'
      . ts('Consider modifying the membership status instead if you want to maintain an audit trail and avoid losing payment data. You can set the status to Cancelled by editing the membership and clicking the Status Override checkbox.')
      . '</p><p>'
      . ts("Click 'Delete' if you want to continue.") . '</p>';
  }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So... sometimes $deleteMessage is plain-text, and sometimes $deleteMessage is HTML? Oof.
$futureDeveloper will not expect that.

(For most of the plain-text examples in core, they'd probably work in either way. But it could make a difference when dealing with translated strings.)

We probably need an explanatory comment in the code.

@eileenmcnaughton eileenmcnaughton changed the title Php8.2 declare deleteMessage on entityFormTrait [PHP8.2] declare deleteMessage on entityFormTrait Mar 14, 2023
@totten
Copy link
Member

totten commented Mar 15, 2023

Spot-checked a few screens, and they looked OK. Tests are passing.

@totten totten merged commit 2266008 into civicrm:master Mar 15, 2023
@totten totten deleted the delete_message branch March 15, 2023 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants