Commit 7e8c8317 authored by Seamus Lee's avatar Seamus Lee

(NFC) Update CRM/Friend CRM/Grant CRM/Group CRM/Mailing to be up to date to a future coder version

parent fb1a4c6f
......@@ -219,18 +219,17 @@ class CRM_Friend_Form extends CRM_Core_Form {
}
$this->addButtons([
[
'type' => 'submit',
'name' => ts('Send Your Message'),
'spacing' => '         ',
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'submit',
'name' => ts('Send Your Message'),
'spacing' => '         ',
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
$this->addFormRule(['CRM_Friend_Form', 'formRule']);
}
......
......@@ -33,6 +33,7 @@
*
*/
class CRM_Grant_BAO_Query extends CRM_Core_BAO_Query {
/**
* @return array
*/
......
......@@ -155,18 +155,17 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form {
if ($this->_action & CRM_Core_Action::DELETE) {
$this->addButtons([
[
'type' => 'next',
'name' => ts('Delete'),
'spacing' => '         ',
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => ts('Delete'),
'spacing' => '         ',
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
return;
}
......@@ -208,23 +207,22 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form {
// make this form an upload since we dont know if the custom data injected dynamically
// is of type file etc $uploadNames = $this->get( 'uploadNames' );
$this->addButtons([
[
'type' => 'upload',
'name' => ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'upload',
'name' => ts('Save and New'),
'js' => ['onclick' => "return verify( );"],
'subName' => 'new',
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'upload',
'name' => ts('Save'),
'isDefault' => TRUE,
],
[
'type' => 'upload',
'name' => ts('Save and New'),
'js' => ['onclick' => "return verify( );"],
'subName' => 'new',
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
if ($this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE);
......
......@@ -132,14 +132,13 @@ class CRM_Grant_Form_GrantView extends CRM_Core_Form {
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'cancel',
'name' => ts('Done'),
'spacing' => '         ',
'isDefault' => TRUE,
],
]
);
[
'type' => 'cancel',
'name' => ts('Done'),
'spacing' => '         ',
'isDefault' => TRUE,
],
]);
}
}
......@@ -59,6 +59,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
/**
* Prefix for the controller.
* @var string
*/
protected $_prefix = "grant_";
......
......@@ -138,17 +138,16 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task {
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons([
[
'type' => $nextType,
'name' => $title,
'isDefault' => TRUE,
],
[
'type' => $backType,
'name' => ts('Cancel'),
],
]
);
[
'type' => $nextType,
'name' => $title,
'isDefault' => TRUE,
],
[
'type' => $backType,
'name' => ts('Cancel'),
],
]);
}
}
......@@ -78,18 +78,17 @@ class CRM_Grant_Form_Task_Print extends CRM_Grant_Form_Task {
// just need to add a javacript to popup the window for printing
//
$this->addButtons([
[
'type' => 'next',
'name' => ts('Print Grant List'),
'js' => ['onclick' => 'window.print()'],
'isDefault' => TRUE,
],
[
'type' => 'back',
'name' => ts('Done'),
],
]
);
[
'type' => 'next',
'name' => ts('Print Grant List'),
'js' => ['onclick' => 'window.print()'],
'isDefault' => TRUE,
],
[
'type' => 'back',
'name' => ts('Done'),
],
]);
}
/**
......
......@@ -71,13 +71,12 @@ class CRM_Grant_Form_Task_Result extends CRM_Grant_Form_Task {
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]
);
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
......@@ -79,13 +79,12 @@ INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id )
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]
);
[
'type' => 'done',
'name' => ts('Done'),
'isDefault' => TRUE,
],
]);
}
}
......@@ -38,6 +38,7 @@
class CRM_Grant_Info extends CRM_Core_Component_Info {
/**
* @var string
* @inheritDoc
*/
protected $keyword = 'grant';
......@@ -57,7 +58,6 @@ class CRM_Grant_Info extends CRM_Core_Component_Info {
];
}
/**
* @inheritDoc
* @param bool $getAllUnconditionally
......
......@@ -44,7 +44,7 @@ class CRM_Grant_Page_Tab extends CRM_Contact_Page_View {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
public $_permission = NULL;
public $_contactId = NULL;
......
......@@ -46,20 +46,20 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* We use desc to remind us what that column is, name is used in the tpl
*
* @var array
*/
static $_columnHeaders;
public static $_columnHeaders;
/**
* Properties of contact we're interested in displaying
* @var array
*/
static $_properties = [
public static $_properties = [
'contact_id',
'contact_type',
'sort_name',
......
......@@ -40,11 +40,15 @@
*/
class CRM_Grant_Task extends CRM_Core_Task {
const
// Grant Tasks
UPDATE_GRANTS = 701;
/**
* Grant Tasks
*/
const UPDATE_GRANTS = 701;
static $objectType = 'grant';
/**
* @var string
*/
public static $objectType = 'grant';
/**
* These tasks are the core set of tasks that the user can perform
......
......@@ -215,17 +215,16 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
public function buildQuickForm() {
if ($this->_action == CRM_Core_Action::DELETE) {
$this->addButtons(array(
array(
'type' => 'next',
'name' => ts('Delete Group'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
),
)
);
array(
'type' => 'next',
'name' => ts('Delete Group'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
),
));
return;
}
......@@ -274,17 +273,16 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
CRM_Custom_Form_CustomData::buildQuickForm($this);
$this->addButtons(array(
array(
'type' => 'upload',
'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
),
)
);
array(
'type' => 'upload',
'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
),
));
$doParentCheck = FALSE;
if (CRM_Core_Permission::isMultisiteEnabled()) {
......
......@@ -36,6 +36,7 @@
* This class contains the functions that are called using AJAX (jQuery)
*/
class CRM_Group_Page_AJAX {
/**
* Get list of groups.
*/
......
......@@ -34,8 +34,9 @@ class CRM_Mailing_BAO_BouncePattern extends CRM_Mailing_DAO_BouncePattern {
/**
* Pseudo-constant pattern array.
* @var array
*/
static $_patterns = NULL;
public static $_patterns = NULL;
/**
* Class constructor.
......
......@@ -41,6 +41,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
* An array that holds the complete templates
* including any headers or footers that need to be prepended
* or appended to the body.
* @var array
*/
private $preparedTemplates = NULL;
......@@ -48,41 +49,49 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
* An array that holds the complete templates
* including any headers or footers that need to be prepended
* or appended to the body.
* @var array
*/
private $templates = NULL;
/**
* An array that holds the tokens that are specifically found in our text and html bodies.
* @var array
*/
private $tokens = NULL;
/**
* An array that holds the tokens that are specifically found in our text and html bodies.
* @var array
*/
private $flattenedTokens = NULL;
/**
* The header associated with this mailing.
* @var string
*/
private $header = NULL;
/**
* The footer associated with this mailing.
* @var string
*/
private $footer = NULL;
/**
* The HTML content of the message.
* @var string
*/
private $html = NULL;
/**
* The text content of the message.
* @var string
*/
private $text = NULL;
/**
* Cached BAO for the domain.
* @var int
*/
private $_domain = NULL;
......@@ -607,10 +616,10 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
$this->preparedTemplates = [];
foreach ([
'html',
'text',
'subject',
] as $key) {
'html',
'text',
'subject',
] as $key) {
if (!isset($templates[$key])) {
continue;
}
......@@ -809,14 +818,13 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
public function getTestRecipients($testParams) {
if (!empty($testParams['test_group']) && array_key_exists($testParams['test_group'], CRM_Core_PseudoConstant::group())) {
$contacts = civicrm_api('contact', 'get', [
'version' => 3,
'group' => $testParams['test_group'],
'return' => 'id',
'options' => [
'limit' => 100000000000,
],
]
);
'version' => 3,
'group' => $testParams['test_group'],
'return' => 'id',
'options' => [
'limit' => 100000000000,
],
]);
foreach (array_keys($contacts['values']) as $groupContact) {
$query = "
......@@ -1742,7 +1750,7 @@ ORDER BY civicrm_email.is_bulkmail DESC
* 'include' or 'exclude'.
* @param string $entity
* 'groups' or 'mailings'.
* @param array <int> $entityIds
* @param array $entityIds
* @throws CiviCRM_API3_Exception
*/
public static function replaceGroups($mailingId, $type, $entity, $entityIds) {
......@@ -2176,7 +2184,8 @@ ORDER BY civicrm_email.is_bulkmail DESC
break;
case 'opened':
$reportFilter .= "&distinct=0"; // do not use group by clause in report, because same report used for total and unique open
// do not use group by clause in report, because same report used for total and unique open
$reportFilter .= "&distinct=0";
case 'opened_unique':
$url = "mailing/opened";
$searchFilter .= "&mailing_open_status=Y";
......@@ -2957,7 +2966,7 @@ ORDER BY civicrm_mailing.name";
* Array of mailings for a contact
*
*/
static public function getContactMailings(&$params) {
public static function getContactMailings(&$params) {
$params['version'] = 3;
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['limit'] = $params['rp'];
......@@ -2976,7 +2985,7 @@ ORDER BY civicrm_mailing.name";
* count of mailings for a contact
*
*/
static public function getContactMailingsCount(&$params) {
public static function getContactMailingsCount(&$params) {
$params['version'] = 3;
return civicrm_api('MailingContact', 'getcount', $params);
}
......@@ -2994,17 +3003,18 @@ ORDER BY civicrm_mailing.name";
foreach ($fieldNames as $fieldName) {
if ($fieldName == 'id') {
$fieldPerms[$fieldName] = [
// OR
[
'access CiviMail',
'schedule mailings',
'approve mailings',
'create mailings',
], // OR
],
];
}
elseif (in_array($fieldName, ['scheduled_date', 'scheduled_id'])) {
$fieldPerms[$fieldName] = [
['access CiviMail', 'schedule mailings'], // OR
// OR
['access CiviMail', 'schedule mailings'],
];
}
elseif (in_array($fieldName, [
......@@ -3014,12 +3024,14 @@ ORDER BY civicrm_mailing.name";
'approval_note',
])) {
$fieldPerms[$fieldName] = [
['access CiviMail', 'approve mailings'], // OR
// OR
['access CiviMail', 'approve mailings'],
];
}
else {
$fieldPerms[$fieldName] = [
['access CiviMail', 'create mailings'], // OR
// OR
['access CiviMail', 'create mailings'],
];
}
}
......@@ -3048,9 +3060,9 @@ ORDER BY civicrm_mailing.name";
*/
public static function getPublicViewUrl($id, $absolute = TRUE) {
if ((civicrm_api3('Mailing', 'getvalue', [
'id' => $id,
'return' => 'visibility',
])) === 'Public Pages') {
'id' => $id,
'return' => 'visibility',
])) === 'Public Pages') {
return CRM_Utils_System::url('civicrm/mailing/view', ['id' => $id], $absolute, NULL, TRUE, TRUE);
}
}
......
......@@ -109,7 +109,6 @@ class CRM_Mailing_BAO_MailingAB extends CRM_Mailing_DAO_MailingAB {
return $result;
}
/**
* Delete MailingAB and all its associated records.
*
......
......@@ -45,7 +45,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
*
* @var int
*/
static $mailsProcessed = 0;
public static $mailsProcessed = 0;
/**
* Class constructor.
......@@ -62,7 +62,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
* @return \CRM_Mailing_BAO_MailingJob
* @throws \CRM_Core_Exception
*/
static public function create($params) {
public static function create($params) {
if (empty($params['id']) && empty($params['mailing_id'])) {
throw new CRM_Core_Exception("Failed to create job: Unknown mailing ID");
}
......@@ -301,7 +301,6 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
}
}
/**
* before we run jobs, we need to split the jobs
* @param int $offset
......@@ -602,9 +601,11 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
// CRM-15702: Sending bulk sms to contacts without e-mail address fails.
// Solution is to skip checking for on hold
$skipOnHold = TRUE; //do include a statement to check wether e-mail address is on hold
//do include a statement to check wether e-mail address is on hold
$skipOnHold = TRUE;
if ($mailing->sms_provider_id) {
$skipOnHold = FALSE; //do not include a statement to check wether e-mail address is on hold
//do not include a statement to check wether e-mail address is on hold
$skipOnHold = FALSE;
}
foreach ($fields as $key => $field) {
......
......@@ -32,7 +32,7 @@
*/
class CRM_Mailing_BAO_Query {
static $_mailingFields = NULL;
public static $_mailingFields = NULL;
/**
* @return array|null
......@@ -313,9 +313,9 @@ class CRM_Mailing_BAO_Query {
'bounce_type_id',
ts('Bounce type(s)'),
CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', [
'keyColumn' => 'id',
'labelColumn' => 'name',
])
'keyColumn' => 'id',
'labelColumn' => 'name',
])
);
return;
......
......@@ -88,14 +88,16 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool {
}
$job = new CRM_Mailing_BAO_MailingJob();
$job->is_test = 0; // if set to 1 it doesn't show in the UI
// if set to 1 it doesn't show in the UI
$job->is_test = 0;
$job->status = 'Complete';
$job->scheduled_date = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s'));
$job->start_date = $job->scheduled_date;
$job->end_date = $job->scheduled_date;
$job->mailing_id = $mailing->id;
$job->save();
$job_id = $job->id; // need this for parent_id below
// need this for parent_id below
$job_id = $job->id;
$job = new CRM_Mailing_BAO_MailingJob();
$job->is_test = 0;
......@@ -107,7 +109,8 @@ class CRM_Mailing_BAO_Spool extends CRM_Mailing_DAO_Spool {
$job->parent_id = $job_id;
$job->job_type = 'child';
$job->save();
$job_id = $job->id; // this is the one we want for the spool
// this is the one we want for the spool
$job_id = $job->id;
if (is_array($recipient)) {
$recipient = implode(';', $recipient);
......
......@@ -36,7 +36,8 @@ class CRM_Mailing_Config {
const OUTBOUND_OPTION_SENDMAIL = 1;
const OUTBOUND_OPTION_DISABLED = 2;
const OUTBOUND_OPTION_MAIL = 3;
const OUTBOUND_OPTION_MOCK = 4; // seems to be the same as 2, but also calls Mail's pre/post hooks? - see packages/Mail
// seems to be the same as 2, but also calls Mail's pre/post hooks? - see packages/Mail
const OUTBOUND_OPTION_MOCK = 4;
const OUTBOUND_OPTION_REDIRECT_TO_DB = 5;
// special value for mail bulk inserts to avoid
......
......@@ -371,9 +371,9 @@ SELECT civicrm_email.id as email_id
$group[$groupID]['status'] = $contactGroups[$groupID]['status'];
$status = ts('You are already subscribed in %1, your subscription is %2.', [
1 => $group[$groupID]['title'],
2 => ts($group[$groupID]['status']),
]);
1 => $group[$groupID]['title'],
2 => ts($group[$groupID]['status']),
]);
CRM_Utils_System::setUFMessage($status);
continue;
}
......
......@@ -63,17 +63,16 @@ class CRM_Mailing_Form_Browse extends CRM_Core_Form {
*/
public function buildQuickForm() {
$this->addButtons([
[
'type' => 'next',
'name' => ts('Confirm'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
[
'type' => 'next',
'name' => ts('Confirm'),
'isDefault' => TRUE,
],
[
'type' => 'cancel',
'name' => ts('Cancel'),
],
]);
}
public function postProcess() {
......
......@@ -65,9 +65,9 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
CRM_Core_DAO::getAttribute('CRM_Mailing_BAO_MailingComponent', 'name'), TRUE
);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', [
'CRM_Mailing_BAO_MailingComponent',
$this->_id,
]);
'CRM_Mailing_BAO_MailingComponent',
$this->_id,
]);
$this->add('select', 'component_type', ts('Component Type'), CRM_Core_SelectValues::mailingComponents());
......@@ -89,17 +89,16 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
$this->addFormRule(['CRM_Mailing_Form_Component', 'dataRule']);
$this->addButtons([
[
'type' => 'next',