Skip to content

Commit

Permalink
[#115] Campaign Dashboard: Fix incompatibility with CiviCRM 5.67+
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Oct 11, 2023
1 parent c7348e7 commit f92d76d
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions CRM/CampaignManager/CampaignTree/Page/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
| written permission from the original author(s). |
+--------------------------------------------------------*/

use CRM_CampaignManager_ExtensionUtil as E;
use Civi\Api4\Campaign;
use Civi\Api4\Survey;

class CRM_CampaignManager_CampaignTree_Page_Dashboard extends CRM_Core_Page {

public function run() {
Expand Down Expand Up @@ -101,7 +105,10 @@ public function browseCampaign() {
$this->assign('campaignStatus', json_encode(NULL));

$this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
$campaignCount = CRM_Campaign_BAO_Campaign::getCampaignCount();
$campaignCount = Campaign::get(FALSE)
->selectRowCount()
->execute()
->countMatched();
//don't load find interface when no campaigns in db.
if (!$campaignCount) {
$this->assign('hasCampaigns', FALSE);
Expand Down Expand Up @@ -130,7 +137,10 @@ public function browseSurvey() {

$this->assign('addSurveyUrl', CRM_Utils_System::url('civicrm/survey/add', 'reset=1&action=add'));

$surveyCount = CRM_Campaign_BAO_Survey::getSurveyCount();
$surveyCount = Survey::get(FALSE)
->selectRowCount()
->execute()
->countMatched();
//don't load find interface when no survey in db.
if (!$surveyCount) {
$this->assign('hasSurveys', FALSE);
Expand Down Expand Up @@ -159,7 +169,11 @@ public function browsePetition() {

$this->assign('addPetitionUrl', CRM_Utils_System::url('civicrm/petition/add', 'reset=1&action=add'));

$petitionCount = CRM_Campaign_BAO_Petition::getPetitionCount();
$petitionCount = Survey::get(FALSE)
->selectRowCount()
->addWhere('activity_type_id:name', '=', 'Petition')
->execute()
->countMatched();
//don't load find interface when no petition in db.
if (!$petitionCount) {
$this->assign('hasPetitions', FALSE);
Expand Down

0 comments on commit f92d76d

Please sign in to comment.