Skip to content

Commit

Permalink
Remove smarty isset in favour of always set
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Nov 16, 2021
1 parent 48dbcda commit c943622
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CRM/Group/Form/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function getDefaultEntity() {
* Set up variables to build the form.
*/
public function preProcess() {
// This variable does not appear to be set in core civicrm
// and is possibly obsolete? It probably relates to the multisite extension.
$this->expectedSmartyVariables[] = 'showOrgInfo';
$this->_id = $this->get('id');
if ($this->_id) {
$breadCrumb = array(
Expand Down
3 changes: 3 additions & 0 deletions CRM/Group/Form/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
class CRM_Group_Form_Search extends CRM_Core_Form {

public function preProcess() {
// This variable does not appear to be set in core civicrm
// and is possibly obsolete? It probably relates to the multisite extension.
$this->expectedSmartyVariables[] = 'showOrgInfo';
parent::preProcess();

CRM_Core_Resources::singleton()->addPermissions('edit groups');
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Group/Form/Search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
d.status = groupStatus,
d.savedSearch = $('.crm-group-search-form-block select#saved_search').val(),
d.component_mode = $(".crm-group-search-form-block select#component_mode").val(),
d.showOrgInfo = {/literal}{if isset($showOrgInfo)}"{$showOrgInfo}"{else}"0"{/if}{literal},
d.showOrgInfo = {/literal}{if $showOrgInfo}"{$showOrgInfo}"{else}"0"{/if}{literal},
d.parentsOnly = parentsOnly
}
},
Expand Down Expand Up @@ -186,7 +186,7 @@
// show hide children
var context = $('#crm-main-content-wrapper');
$('table.crm-group-selector', context).on( 'click', 'span.show-children', function(){
var showOrgInfo = {/literal}{if isset($showOrgInfo)}"{$showOrgInfo}"{else}"0"{/if}{literal};
var showOrgInfo = {/literal}{if $showOrgInfo}"{$showOrgInfo}"{else}"0"{/if}{literal};
var rowID = $(this).parents('tr').prop('id');
var parentRow = rowID.split('_');
var parent_id = parentRow[1];
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Core/Page/HookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function setUp(): void {
/**
* Make sure form hooks are only invoked once.
*/
public function testFormsCallBuildFormOnce() {
public function testFormsCallBuildFormOnce(): void {
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_buildForm', [$this, 'onBuildForm']);
CRM_Utils_Hook_UnitTests::singleton()->setHook('civicrm_preProcess', [$this, 'onPreProcess']);
$_REQUEST = ['action' => 'add'];
Expand Down

0 comments on commit c943622

Please sign in to comment.