Skip to content

Commit

Permalink
[REF] dev/core#2790 deprecate preProcessSingle
Browse files Browse the repository at this point in the history
This is only called from here & is short & can just be part of the main function.
  • Loading branch information
eileenmcnaughton committed Sep 1, 2021
1 parent a7a5556 commit 972171b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CRM/Contact/Form/Task/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ public function preProcess() {
// in search context 'id' is the default profile id for search display
// CRM-11227
$this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
}

if ($cid) {
CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid);
$this->_contactIds = explode(',', $cid);
// put contact display name in title for single contact mode
if (count($this->_contactIds) === 1) {
CRM_Utils_System::setTitle(ts('Print/Merge Document for %1', [1 => CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name')]));
}
$this->_single = TRUE;
}
else {
Expand All @@ -85,6 +86,8 @@ public function setDefaultValues() {

/**
* Build the form object.
*
* @throws \CRM_Core_Exception
*/
public function buildQuickForm() {
//enable form element
Expand Down
2 changes: 2 additions & 0 deletions CRM/Contact/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ public static function preProcess(&$form) {
}

/**
* @deprecated
* @param CRM_Core_Form $form
* @param int $cid
*/
public static function preProcessSingle(&$form, $cid) {
CRM_Core_Error::deprecatedFunctionWarning('no alternative');
$form->_contactIds = explode(',', $cid);
// put contact display name in title for single contact mode
if (count($form->_contactIds) === 1) {
Expand Down

0 comments on commit 972171b

Please sign in to comment.