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
......@@ -229,8 +229,7 @@ class CRM_Friend_Form extends CRM_Core_Form {
'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
*/
......
......@@ -165,8 +165,7 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
return;
}
......@@ -223,8 +222,7 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
if ($this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE);
......
......@@ -138,8 +138,7 @@ class CRM_Grant_Form_GrantView extends CRM_Core_Form {
'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_";
......
......@@ -147,8 +147,7 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task {
'type' => $backType,
'name' => ts('Cancel'),
],
]
);
]);
}
}
......@@ -88,8 +88,7 @@ class CRM_Grant_Form_Task_Print extends CRM_Grant_Form_Task {
'type' => 'back',
'name' => ts('Done'),
],
]
);
]);
}
/**
......
......@@ -76,8 +76,7 @@ class CRM_Grant_Form_Task_Result extends CRM_Grant_Form_Task {
'name' => ts('Done'),
'isDefault' => TRUE,
],
]
);
]);
}
}
......@@ -84,8 +84,7 @@ INNER JOIN civicrm_contact ct ON ( grt.contact_id = ct.id )
'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
......
......@@ -224,8 +224,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
),
)
);
));
return;
}
......@@ -283,8 +282,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form {
'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;
......@@ -815,8 +824,7 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
'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'],
];
}
}
......
......@@ -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
......
......@@ -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
......
......@@ -72,8 +72,7 @@ class CRM_Mailing_Form_Browse extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}
public function postProcess() {
......
......@@ -98,8 +98,7 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}
/**
......@@ -135,8 +134,7 @@ class CRM_Mailing_Form_Component extends CRM_Core_Form {
$component = CRM_Mailing_BAO_MailingComponent::add($params);
CRM_Core_Session::setStatus(ts('The mailing component \'%1\' has been saved.', [
1 => $component->name,
]
), ts('Saved'), 'success');
]), ts('Saved'), 'success');
}
......
......@@ -31,6 +31,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Mailing_Form_ForwardMailing extends CRM_Core_Form {
public function preProcess() {
$job_id = CRM_Utils_Request::retrieve('jid', 'Positive',
$this, NULL
......
......@@ -135,8 +135,7 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form {
if (in_array($field, [
'mailing_from',
'mailing_to',
]) && !$params["mailing_relative"]
) {
]) && !$params["mailing_relative"]) {
$time = ($field == 'mailing_to') ? '235959' : NULL;
$parent->set($field, CRM_Utils_Date::processDate($params[$field], $time));
}
......
......@@ -163,8 +163,7 @@ ORDER BY title";
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}
/**
......
......@@ -125,8 +125,7 @@ class CRM_Mailing_Form_Task extends CRM_Core_Form_Task {
'type' => $backType,
'name' => ts('Cancel'),
],
]
);
]);
}
}
......@@ -81,8 +81,7 @@ class CRM_Mailing_Form_Task_Print extends CRM_Mailing_Form_Task {
'type' => 'back',
'name' => ts('Done'),
],
]
);
]);
}
/**
......
......@@ -36,11 +36,11 @@
class CRM_Mailing_Info extends CRM_Core_Component_Info {
/**
* @var string
* @inheritDoc
*/
protected $keyword = 'mailing';
/**
* @inheritDoc
* @return array
......@@ -78,7 +78,8 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
foreach ($reportTypes as $report) {
$result = civicrm_api3('ReportInstance', 'get', [
'sequential' => 1,
'report_id' => 'mailing/' . $report]);
'report_id' => 'mailing/' . $report,
]);
if (!empty($result['values'])) {
$reportIds[$report] = $result['values'][0]['id'];
}
......@@ -245,7 +246,6 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
return $permissions;
}
/**
* @inheritDoc
* @return null
......
......@@ -31,8 +31,11 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Mailing_MailStore {
// flag to decide whether to print debug messages
var $_debug = FALSE;
/**
* flag to decide whether to print debug messages
* @var bool
*/
public $_debug = FALSE;
/**
* Return the proper mail store implementation, based on config settings.
......
......@@ -42,7 +42,7 @@ class CRM_Mailing_Page_Component extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -31,6 +31,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Mailing_Page_Confirm extends CRM_Core_Page {
/**
* @return string
* @throws Exception
......
......@@ -31,6 +31,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Mailing_Page_Optout extends CRM_Mailing_Page_Common {
/**
* Run page.
*
......
......@@ -31,6 +31,7 @@
* @copyright CiviCRM LLC (c) 2004-2019
*/
class CRM_Mailing_Page_Resubscribe extends CRM_Mailing_Page_Common {
/**
* @return string
*/
......
......@@ -40,7 +40,7 @@ class CRM_Mailing_Page_Tab extends CRM_Contact_Page_View {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
public $_permission = NULL;
public $_contactId = NULL;
......
......@@ -75,6 +75,7 @@ class CRM_Mailing_PseudoConstant extends CRM_Core_PseudoConstant {
/**
* Default component id's, indexed by component type
* @var array
*/
private static $defaultComponent;
......
......@@ -41,14 +41,14 @@ class CRM_Mailing_Selector_Browse extends CRM_Core_Selector_Base implements CRM_
*
* @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;
protected $_parent;
......
......@@ -43,30 +43,35 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C
*
* @var array
*/