From: Dave Greenberg Date: Fri, 30 Aug 2013 21:55:43 +0000 (-0700) Subject: CRM-13296 fix e-notice, change cancel button text on mailing labels to Done, refactor... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=85d25c8f19b1d9b205b62f22b065e8090467e4b2;p=civicrm-core.git CRM-13296 fix e-notice, change cancel button text on mailing labels to Done, refactor to sare buildQuickForm common code. Note that more refactoring is probably needed on this (4.5?) to eliminate duplicated code in postProcess, setDefaults - making use of LabelCommon.php. ---------------------------------------- * CRM-13296: Add tasks to membership search - print labels & print pdf letter http://issues.civicrm.org/jira/browse/CRM-13296 --- diff --git a/CRM/Contact/Form/Task/Label.php b/CRM/Contact/Form/Task/Label.php index ea844bfc34..73e8c3852e 100644 --- a/CRM/Contact/Form/Task/Label.php +++ b/CRM/Contact/Form/Task/Label.php @@ -78,7 +78,17 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task { $this->add('checkbox', 'merge_same_address', ts('Merge labels for contacts with the same address'), NULL); $this->add('checkbox', 'merge_same_household', ts('Merge labels for contacts belonging to the same household'), NULL); - $this->addDefaultButtons(ts('Make Mailing Labels')); + $this->addButtons(array( + array( + 'type' => 'submit', + 'name' => ts('Make Mailing Labels'), + 'isDefault' => TRUE, + ), + array( + 'type' => 'cancel', + 'name' => ts('Done'), + ), + )); } /** diff --git a/CRM/Contact/Form/Task/PDFLetterCommon.php b/CRM/Contact/Form/Task/PDFLetterCommon.php index 1e9f3735a2..078aa20c21 100644 --- a/CRM/Contact/Form/Task/PDFLetterCommon.php +++ b/CRM/Contact/Form/Task/PDFLetterCommon.php @@ -386,7 +386,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon { ); $activityParams = array( 'subject' => $formValues['subject'], - 'campaign_id' => $formValues['campaign_id'], + 'campaign_id' => CRM_Utils_Array::value('campaign_id', $formValues), 'source_contact_id' => $userID, 'activity_type_id' => $activityTypeID, 'activity_date_time' => date('YmdHis'), diff --git a/CRM/Member/Form/Task/Label.php b/CRM/Member/Form/Task/Label.php index 6097a29f87..119efdf526 100644 --- a/CRM/Member/Form/Task/Label.php +++ b/CRM/Member/Form/Task/Label.php @@ -59,28 +59,8 @@ class CRM_Member_Form_Task_Label extends CRM_Member_Form_Task { * @return void */ function buildQuickForm() { - CRM_Utils_System::setTitle(ts('Make Mailing Labels')); - - //add select for label - $label = CRM_Core_BAO_LabelFormat::getList(TRUE); - - $this->add('select', 'label_name', ts('Select Label'), array('' => ts('- select label -')) + $label, TRUE); - - - // add select for Location Type - $this->addElement('select', 'location_type_id', ts('Select Location'), - array( - '' => ts('Primary')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'), TRUE - ); + CRM_Contact_Form_Task_Label::buildQuickForm($this); $this->addElement('checkbox', 'per_membership', ts('Print one label per Membership (rather than per contact)')); - - // checkbox for SKIP contacts with Do Not Mail privacy option - $this->addElement('checkbox', 'do_not_mail', ts('Do not print labels for contacts with "Do Not Mail" privacy option checked')); - - $this->add('checkbox', 'merge_same_address', ts('Merge labels for contacts with the same address'), NULL); - $this->add('checkbox', 'merge_same_household', ts('Merge labels for contacts belonging to the same household'), NULL); - - $this->addDefaultButtons(ts('Make Mailing Labels')); } /**