$this->addElement('textarea', 'approval_note', ts('Approve/Reject Note'));
- $mailApprovalStatus = CRM_Mailing_PseudoConstant::approvalStatus();
+ $mailApprovalStatus = CRM_Core_OptionGroup::values('mail_approval_status');
// eliminate the none option
$noneOptionID = CRM_Core_OptionGroup::getValue('mail_approval_status',
*/
class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
- /**
- * mailing approval status
- * @var array
- * @static
- */
- private static $approvalStatus;
-
/**
* mailing templates
* @var array
return self::$completed;
}
- /**
- * Get all mail approval status.
- *
- * The static array approvalStatus is returned
- *
- * @access public
- * @static
- *
- * @return array - array reference of all mail approval statuses
- *
- */
- public static function &approvalStatus() {
- if (!self::$approvalStatus) {
- self::$approvalStatus = CRM_Core_OptionGroup::values('mail_approval_status');
- }
- return self::$approvalStatus;
- }
-
/**
* Labels for advanced search against mailing summary.
*
/**
* Flush given pseudoconstant so it can be reread from db
- * nex time it's requested.
+ * next time it's requested.
*
* @access public
* @static
* @param boolean $name pseudoconstant to be flushed
*
*/
- public static function flush($name) {
+ public static function flush($name = 'template') {
if (isset(self::$$name)) {
self::$$name = NULL;
}
/**
* Function to check if give array is empty
- * @param array $array array that needs to be check for empty condition
+ * @param array $array array to check for empty condition
*
* @return boolean true is array is empty else false
* @static
*/
- static function crmIsEmptyArray($array = array(
- )) {
+ static function crmIsEmptyArray($array = array()) {
if (!is_array($array)) {
return TRUE;
}
* Convenient way to unset a bunch of items from an array
*
* @param array $items (reference)
- * @param string/int/array $itemN: other params to this function will be treated as keys (or arrays of keys) to unset
+ * @param string/int/array $itemN: other params to this function will be treated as keys
+ * (or arrays of keys) to unset
*/
static function remove(&$items) {
foreach (func_get_args() as $n => $key) {
break;
case 'approvalStatus':
- $mailApprovalStatus = CRM_Mailing_PseudoConstant::approvalStatus();
- $value = $mailApprovalStatus[$mailing->approval_status_id];
+ $value = CRM_Core_PseudoConstant::getValue('CRM_Mailing_DAO_Mailing', 'approval_status_id', $mailing->approval_status_id);
break;
case 'approvalNote':
'fieldName' => 'status_id',
'sample' => 'New',
),
+ ),
+ 'CRM_Mailing_DAO_Mailing' => array(
array(
- 'fieldName' => 'membership_type_id',
- 'sample' => 'Lifetime',
+ 'fieldName' => 'approval_status_id',
+ 'sample' => 'Approved',
),
),
);
// Ensure sample value is contained in the returned optionValues.
$this->assertContains($field['sample'], $optionValues, $message);
- // Exclude test
+ // Ensure exclude value is not contained in the optionValues
if (!empty($field['exclude'])) {
$this->assertNotContains($field['exclude'], $optionValues, $message);
}
<type>int unsigned</type>
<title>Approval Status</title>
<comment>The status of this mailing. Values: none, approved, rejected</comment>
+ <pseudoconstant>
+ <optionGroupName>mail_approval_status</optionGroupName>
+ </pseudoconstant>
<add>3.3</add>
</field>
<field>
<pseudoconstant>
<table>civicrm_membership_type</table>
<keyColumn>id</keyColumn>
- <labelColumn>label</labelColumn>
+ <labelColumn>name</labelColumn>
</pseudoconstant>
<add>1.5</add>
</field>