dev/core#2017 remove unused SearchTaskHookSample.php
authoreileen <emcnaughton@wikimedia.org>
Mon, 14 Sep 2020 04:44:43 +0000 (16:44 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 14 Sep 2020 04:50:23 +0000 (16:50 +1200)
This appears to be unused demo code. Interested to see if any intrepid sleuths can fix any
alternate explanation

CRM/Activity/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Case/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Contribute/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Event/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Grant/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Member/Form/Task/SearchTaskHookSample.php [deleted file]
CRM/Pledge/Form/Task/SearchTaskHookSample.php [deleted file]
templates/CRM/Case/Form/Task/SearchTaskHookSample.tpl [deleted file]
templates/CRM/Contribute/Form/Task/SearchTaskHookSample.tpl [deleted file]
templates/CRM/Event/Form/Task/SearchTaskHookSample.tpl [deleted file]
templates/CRM/Grant/Form/Task/SearchTaskHookSample.tpl [deleted file]

diff --git a/CRM/Activity/Form/Task/SearchTaskHookSample.php b/CRM/Activity/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index 003dd58..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Activity_Form_Task_SearchTaskHookSample extends CRM_Activity_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and activity details of all selected contacts
-    $activityIDs = implode(',', $this->_activityHolderIds);
-
-    $activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
-    $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
-    $query = "
-    SELECT at.subject      as subject,
-           ov.label        as activity_type,
-           at.activity_date_time as activity_date,
-           ct.display_name as display_name
-      FROM civicrm_activity at
-LEFT JOIN  civicrm_activity_contact ac ON ( ac.activity_id = at.id AND ac.record_type_id = {$sourceID} )
-INNER JOIN civicrm_contact ct ON ( ac.contact_id = ct.id )
- LEFT JOIN civicrm_option_group og ON ( og.name = 'activity_type' )
- LEFT JOIN civicrm_option_value ov ON (at.activity_type_id = ov.value AND og.id = ov.option_group_id )
-     WHERE at.id IN ( $activityIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-
-    while ($dao->fetch()) {
-      $rows[] = [
-        'subject' => $dao->subject,
-        'activity_type' => $dao->activity_type,
-        'activity_date' => $dao->activity_date,
-        'display_name' => $dao->display_name,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Case/Form/Task/SearchTaskHookSample.php b/CRM/Case/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index df83772..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Case_Form_Task_SearchTaskHookSample extends CRM_Case_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and email of all contact ids
-    $caseIDs = implode(',', $this->_entityIds);
-    $statusId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'case_status', 'id', 'name');
-    $query = "
-SELECT ct.display_name as display_name,
-       cs.start_date   as start_date,
-       ov.label as status
-
-FROM  civicrm_case cs
-INNER JOIN civicrm_case_contact cc ON ( cs.id = cc.case_id)
-INNER JOIN civicrm_contact ct ON ( cc.contact_id = ct.id)
-LEFT  JOIN civicrm_option_value ov ON (cs.status_id = ov.value AND ov.option_group_id = {$statusId} )
-WHERE cs.id IN ( {$caseIDs} )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'start_date' => CRM_Utils_Date::customFormat($dao->start_date),
-        'status' => $dao->status,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Contribute/Form/Task/SearchTaskHookSample.php b/CRM/Contribute/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index 0e08164..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Contribute_Form_Task_SearchTaskHookSample extends CRM_Contribute_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and contribution details of all selected contacts
-    $contribIDs = implode(',', $this->_contributionIds);
-
-    $query = "
-    SELECT co.total_amount as amount,
-           co.receive_date as receive_date,
-           co.source       as source,
-           ct.display_name as display_name
-      FROM civicrm_contribution co
-INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )
-     WHERE co.id IN ( $contribIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'amount' => $dao->amount,
-        'source' => $dao->source,
-        'receive_date' => $dao->receive_date,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Event/Form/Task/SearchTaskHookSample.php b/CRM/Event/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index efc940e..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Event_Form_Task_SearchTaskHookSample extends CRM_Event_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and participation details of participants
-    $participantIDs = implode(',', $this->_participantIds);
-
-    $query = "
-     SELECT p.fee_amount as amount,
-            p.register_date as register_date,
-            p.source as source,
-            ct.display_name as display_name
-       FROM civicrm_participant p
- INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id )
-      WHERE p.id IN ( $participantIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'amount' => $dao->amount,
-        'register_date' => CRM_Utils_Date::customFormat($dao->register_date),
-        'source' => $dao->source,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Grant/Form/Task/SearchTaskHookSample.php b/CRM/Grant/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index 01ce981..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Grant_Form_Task_SearchTaskHookSample extends CRM_Grant_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and grant details of all selectced contacts
-    $grantIDs = implode(',', $this->_grantIds);
-
-    $query = "
-    SELECT grt.decision_date  as decision_date,
-           grt.amount_total   as amount_total,
-           grt.amount_granted as amount_granted,
-           ct.display_name    as display_name
-      FROM civicrm_grant grt
-INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id )
-     WHERE grt.id IN ( $grantIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'decision_date' => $dao->decision_date,
-        'amount_requested' => $dao->amount_total,
-        'amount_granted' => $dao->amount_granted,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Member/Form/Task/SearchTaskHookSample.php b/CRM/Member/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index d73ffc5..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Member_Form_Task_SearchTaskHookSample extends CRM_Member_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and membership details of all selected contacts
-    $memberIDs = implode(',', $this->_memberIds);
-
-    $query = "
-    SELECT mem.start_date  as start_date,
-           mem.end_date    as end_date,
-           mem.source      as source,
-           ct.display_name as display_name
-FROM       civicrm_membership mem
-INNER JOIN civicrm_contact ct ON ( mem.contact_id = ct.id )
-WHERE      mem.id IN ( $memberIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'start_date' => CRM_Utils_Date::customFormat($dao->start_date),
-        'end_date' => CRM_Utils_Date::customFormat($dao->end_date),
-        'source' => $dao->source,
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-      [
-        'type' => 'done',
-        'name' => ts('Done'),
-        'isDefault' => TRUE,
-      ],
-    ]);
-  }
-
-}
diff --git a/CRM/Pledge/Form/Task/SearchTaskHookSample.php b/CRM/Pledge/Form/Task/SearchTaskHookSample.php
deleted file mode 100644 (file)
index 5af8bf1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC. All rights reserved.                        |
- |                                                                    |
- | This work is published under the GNU AGPLv3 license with some      |
- | permitted exceptions and without any warranty. For full license    |
- | and copyright information, see https://civicrm.org/licensing       |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC https://civicrm.org/licensing
- */
-
-/**
- * This class provides the functionality to save a search
- * Saved Searches are used for saving frequently used queries
- */
-class CRM_Pledge_Form_Task_SearchTaskHookSample extends CRM_Pledge_Form_Task {
-
-  /**
-   * Build all the data structures needed to build the form.
-   */
-  public function preProcess() {
-    parent::preProcess();
-    $rows = [];
-    // display name and pledge details of all selected contacts
-    $pledgeIDs = implode(',', $this->_pledgeIds);
-
-    $query = "
-    SELECT plg.amount      as amount,
-           plg.create_date as create_date,
-           ct.display_name as display_name
-      FROM civicrm_pledge plg
-INNER JOIN civicrm_contact ct ON ( plg.contact_id = ct.id )
-     WHERE plg.id IN ( $pledgeIDs )";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-    while ($dao->fetch()) {
-      $rows[] = [
-        'display_name' => $dao->display_name,
-        'amount' => $dao->amount,
-        'create_date' => CRM_Utils_Date::customFormat($dao->create_date),
-      ];
-    }
-    $this->assign('rows', $rows);
-  }
-
-  /**
-   * Build the form object.
-   */
-  public function buildQuickForm() {
-    $this->addButtons([
-        [
-          'type' => 'done',
-          'name' => ts('Done'),
-          'isDefault' => TRUE,
-        ],
-    ]);
-  }
-
-}
diff --git a/templates/CRM/Case/Form/Task/SearchTaskHookSample.tpl b/templates/CRM/Case/Form/Task/SearchTaskHookSample.tpl
deleted file mode 100644 (file)
index cff2cc5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-{if $rows}
-<div class="crm-submit-buttons">
-     <span class="element-right">{include file="CRM/common/formButtons.tpl" location="top"}</span>
-</div>
-
-<div class="spacer"></div>
-
-<div>
-<br />
-<table>
-  <tr class="columnheader">
-    <th>{ts}Display Name{/ts}</th>
-    <th>{ts}Start Date{/ts}</th>
-    <th>{ts}Status{/ts}</th>
-  </tr>
-
-  {foreach from=$rows item=row}
-    <tr class="{cycle values="odd-row,even-row"}">
-        <td class="crm-case-searchtaskhooksample-display_name">{$row.display_name}</td>
-        <td class="crm-case-searchtaskhooksample-start_date">{$row.start_date}</td>
-        <td class="crm-case-searchtaskhooksample-status">{$row.status}</td>
-    </tr>
-  {/foreach}
-</table>
-</div>
-
-<div class="crm-submit-buttons">
-     <span class="element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</span>
-</div>
-
-{else}
-   <div class="messages status no-popup">
-      {icon icon="fa-info-circle"}{/icon}
-          {ts}There are no records selected.{/ts}
-      </div>
-{/if}
diff --git a/templates/CRM/Contribute/Form/Task/SearchTaskHookSample.tpl b/templates/CRM/Contribute/Form/Task/SearchTaskHookSample.tpl
deleted file mode 100644 (file)
index a14a183..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-{if $rows}
-<div class="form-item crm-block crm-form-block crm-contribution-form-block">
-     <span class="element-right">{$form.buttons.html}</span>
-</div>
-
-<div class="spacer"></div>
-
-<div>
-<br />
-<table>
-  <tr class="columnheader">
-    <th>{ts}Display Name{/ts}</th>
-    <th>{ts}Amount{/ts}</th>
-    <th>{ts}Source{/ts}</th>
-    <th>{ts}Receive Date{/ts}</th>
-  </tr>
-
-  {foreach from=$rows item=row}
-    <tr class="{cycle values="odd-row,even-row"}">
-        <td>{$row.display_name}</td>
-        <td>{$row.amount}</td>
-        <td>{$row.source}</td>
-        <td>{$row.receive_date}</td>
-    </tr>
-  {/foreach}
-</table>
-</div>
-
-<div class="form-item">
-     <span class="element-right">{$form.buttons.html}</span>
-</div>
-
-{else}
-   <div class="messages status no-popup">
-    {icon icon="fa-info-circle"}{/icon}
-    {ts}There are no records selected.{/ts}
-   </div>
-{/if}
diff --git a/templates/CRM/Event/Form/Task/SearchTaskHookSample.tpl b/templates/CRM/Event/Form/Task/SearchTaskHookSample.tpl
deleted file mode 100644 (file)
index 9cfdab0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-{if $rows}
-<div class="crm-submit-buttons">
-     <span class="element-right">{include file="CRM/common/formButtons.tpl" location="top"}</span>
-</div>
-
-<div class="spacer"></div>
-<div>
-<br />
-<table>
-  <tr class="columnheader">
-    <th>{ts}Display Name{/ts}</th>
-    <th>{ts}Amount{/ts}</th>
-    <th>{ts}Register Date{/ts}</th>
-    <th>{ts}Source{/ts}</th>
-  </tr>
-
-  {foreach from=$rows item=row}
-    <tr class="{cycle values="odd-row,even-row"}">
-        <td class="crm-event-searchtaskhooksample-display_name">{$row.display_name}</td>
-        <td class="crm-event-searchtaskhooksample-amount">{$row.amount}</td>
-        <td class="crm-event-searchtaskhooksample-register_date">{$row.register_date}</td>
-        <td class="crm-event-searchtaskhooksample-source">{$row.source}</td>
-    </tr>
-  {/foreach}
-</table>
-</div>
-
-<div class="crm-submit-buttons">
-     <span class="element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</span>
-</div>
-
-{else}
-   <div class="messages status no-popup">
-      {icon icon="fa-info-circle"}{/icon}{ts}There are no records selected.{/ts}
-   </div>
-{/if}
diff --git a/templates/CRM/Grant/Form/Task/SearchTaskHookSample.tpl b/templates/CRM/Grant/Form/Task/SearchTaskHookSample.tpl
deleted file mode 100644 (file)
index 144ad17..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-{if $rows}
-<div class="crm-submit-buttons element-right">{include file="CRM/common/formButtons.tpl" location="top"}</div>
-
-<div class="spacer"></div>
-
-<div>
-<br />
-<table>
-  <tr class="columnheader">
-    <td>{ts}Display Name{/ts}</td>
-    <td>{ts}Decision Date{/ts}</td>
-    <td>{ts}Amount Requested{/ts}</td>
-    <td>{ts}Amount Granted{/ts}</td>
-  </tr>
-
-  {foreach from=$rows item=row}
-    <tr class="{cycle values="odd-row,even-row"} crm-grant">
-        <td class="crm-grant-task-SearchTaskHookSample-form-block-display_name">{$row.display_name}</td>
-        <td class="crm-grant-task-SearchTaskHookSample-form-block-decision_date">{$row.decision_date}</td>
-        <td class="crm-grant-task-SearchTaskHookSample-form-block-amount_requested">{$row.amount_requested}</td>
-        <td class="crm-grant-task-SearchTaskHookSample-form-block-amount_granted">{$row.amount_granted}</td>
-    </tr>
-  {/foreach}
-</table>
-</div>
-
-<div class="crm-submit-buttons element-right">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-
-{else}
-   <div class="messages status no-popup">
-          {icon icon="fa-info-circle"}{/icon}
-            {ts}There are no records selected.{/ts}
-   </div>
-{/if}