// @TODO: Add rule to ensure that exclusion dates are not in the inclusion range
}
+ /**
+ * @return mixed
+ */
function count() {
$sql = $this->all();
return civicrm_api3_create_error("missing param return=field you want to read the value of", array('error_type' => 'mandatory_missing', 'missing_param' => 'return'));
}
+/**
+ * @param $params
+ */
function _civicrm_api3_generic_getrefcount_spec(&$params) {
$params['id']['api.required'] = 1;
}
),
);
+ /**
+ * @param $paymentProcessor
+ * @param $paymentMode
+ * @param $start
+ * @param $end
+ */
static
function paypal($paymentProcessor, $paymentMode, $start, $end) {
$url = "{$paymentProcessor['url_api']}nvp";
} while ($result['l_errorcode0'] == '11002');
}
+ /**
+ * @param $paymentProcessor
+ * @param $paymentMode
+ * @param $start
+ * @param $end
+ */
static
function google($paymentProcessor, $paymentMode, $start, $end) {
require_once "CRM/Contribute/BAO/Contribution/Utils.php";
var $_errors = array();
+ /**
+ * @return bool
+ */
public function initialize() {
if (!$this->_accessing_from_cli()) {
return FALSE;
}
}
+ /**
+ * @return bool
+ */
public function callApi() {
require_once 'api/api.php';
return TRUE;
}
+ /**
+ * @return bool
+ */
private function _parseOptions() {
$args = $_SERVER['argv'];
// remove the first argument, which is the name
return TRUE;
}
+ /**
+ * @return bool
+ */
private function _bootstrap() {
// so the configuration works with php-cli
$_SERVER['PHP_SELF'] = "/index.php";
CRM_Core_ClassLoader::singleton()->register();
$this->_config = CRM_Core_Config::singleton();
-
+
// HTTP_HOST will be 'localhost' unless overwritten with the -s argument.
// Now we have a Config object, we can set it from the Base URL.
if ($_SERVER['HTTP_HOST'] == 'localhost') {
$_SERVER['HTTP_HOST'] = preg_replace(
- '!^https?://([^/]+)/$!i',
+ '!^https?://([^/]+)/$!i',
'$1',
$this->_config->userFrameworkBaseURL);
}
return TRUE;
}
+ /**
+ * @return bool
+ */
private function _validateOptions() {
$required = $this->_required_arguments;
while (list(, $var) = each($required)) {
return TRUE;
}
+ /**
+ * @param $value
+ *
+ * @return string
+ */
private function _sanitize($value) {
// restrict user input - we should not be needing anything
// other than normal alpha numeric plus - and _.
return trim(preg_replace('#^[^a-zA-Z0-9\-_=/]$#', '', $value));
}
+ /**
+ * @return string
+ */
private function _getUsage() {
$out = "Usage: cli.php -e entity -a action [-u user] [-s site] [--output] [PARAMS]\n";
$out .= " entity is the name of the entity, e.g. Contact, Event, etc.\n";
return ts($out);
}
+ /**
+ * @param $error
+ */
private function _log($error) {
// fixme, this should call some CRM_Core_Error:: function
// that properly logs
class civicrm_cli_csv_exporter extends civicrm_cli {
var $separator = ',';
+ /**
+ *
+ */
function __construct() {
$this->_required_arguments = array('entity');
parent::initialize();
var $header;
var $separator = ',';
+ /**
+ *
+ */
function __construct() {
$this->_required_arguments = array('entity','file');
$this->_additional_arguments = array('f' => 'file');
}
/* return a params as expected */
+ /**
+ * @param $data
+ *
+ * @return array
+ */
function convertLine($data) {
$params = array();
foreach ($this->header as $i => $field) {
**/
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
+ /**
+ * @param $params
+ */
function processline($params) {
$result = civicrm_api($this->_entity, 'Create', $params);
if ($result['is_error']) {
**/
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
+ /**
+ * @param $params
+ */
function processline($params) {
$result = civicrm_api($this->_entity, 'Delete', $params);
if ($result['is_error']) {
* recipients mentioned for that report
*/
class CiviReportMail {
+ /**
+ *
+ */
function __construct() {
$this->initialize();
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
+
+/**
+ * Class CRM_ParticipantProcessor
+ */
class CRM_ParticipantProcessor {
+ /**
+ *
+ */
function __construct() {
$config = CRM_Core_Config::singleton();
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
+
+/**
+ * Class CRM_RespondentProcessor
+ */
class CRM_RespondentProcessor {
+ /**
+ *
+ */
function __construct() {
$config = CRM_Core_Config::singleton();
processContacts($config, $processGeocode, $parseStreetAddress, $start, $end);
}
+/**
+ * @param $config
+ * @param $processGeocode
+ * @param $parseStreetAddress
+ * @param null $start
+ * @param null $end
+ */
function processContacts(&$config, $processGeocode, $parseStreetAddress, $start = NULL, $end = NULL) {
// build where clause.
$clause = array('( c.id = a.contact_id )');
* IMPORTANT: You must first create valid option value before using via admin interface.
* Check option lists for Email Greetings, Postal Greetings and Addressee
*/
+
+/**
+ * Class CRM_UpdateGreeting
+ */
class CRM_UpdateGreeting {
+ /**
+ *
+ */
function __construct() {
$this->initialize();
*
* Save the file as UpdateMembershipRecord.php prior to running this script.
*/
+
+/**
+ * Class CRM_UpdateMembershipRecord
+ */
class CRM_UpdateMembershipRecord {
+ /**
+ *
+ */
function __construct() {
// you can run this program either from an apache command, or from the cli
if (php_sapi_name() == "cli") {
* This file updates the Reminder dates of all valid membership records.
*
*/
+
+/**
+ * Class CRM_UpdateMembershipReminderDate
+ */
class CRM_UpdateMembershipReminderDate {
+ /**
+ *
+ */
function __construct() {
// you can run this program either from an apache command, or from the cli
if (php_sapi_name() == "cli") {
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
+
+/**
+ * Class CRM_UpdatePledgeRecord
+ */
class CRM_UpdatePledgeRecord {
+ /**
+ *
+ */
function __construct() {
$config = CRM_Core_Config::singleton();
// this does not return on failure
CRM_Core_Error::debug_log_message('UpdatePledgeRecord.php');
}
+ /**
+ * @param bool $sendReminders
+ *
+ * @throws Exception
+ */
public function updatePledgeStatus($sendReminders = FALSE) {
// *** Uncomment the next line if you want automated reminders to be sent
/*
*/
+
+/**
+ * Class CRM_Cron_Action
+ */
class CRM_Cron_Action {
+ /**
+ *
+ */
function __construct() {
// you can run this program either from an apache command, or from the cli
if (php_sapi_name() == "cli") {
$config = CRM_Core_Config::singleton();
}
+ /**
+ * @param null $now
+ */
public function run($now = NULL) {
require_once 'CRM/Core/BAO/ActionSchedule.php';
CRM_Core_BAO_ActionSchedule::processQueue($now);
class DirStack {
protected $dirs;
+ /**
+ * @param array $dirs
+ */
function __construct($dirs = array()) {
$this->dirs = $dirs;
}
+ /**
+ * @param $dir
+ *
+ * @throws Exception
+ */
function push($dir) {
$this->dirs[] = getcwd();
if (!chdir($dir)) {
protected $data;
+ /**
+ * @return mixed
+ */
public function getNumber() {
return $this->data->number;
}
}
}
+/**
+ * Class Givi
+ */
class Givi {
/**
*/
protected $dirStack;
+ /**
+ *
+ */
function __construct() {
$this->dirStack = new DirStack();
$this->repos = array(
);
}
+ /**
+ * @param $args
+ *
+ * @throws Exception
+ */
function main($args) {
if (!$this->parseOptions($args)) {
printf("Error parsing arguments\n");
echo "local branches.\n";
}
+ /**
+ * @param null $baseBranch
+ *
+ * @return bool
+ */
function doCheckoutAll($baseBranch = NULL) {
if (!$baseBranch) {
return $this->returnError("Missing <branch>\n");
return TRUE;
}
+ /**
+ * @return bool
+ */
function doStatusAll() {
foreach ($this->repos as $repo => $relPath) {
$this->run($repo, $relPath, 'git', 'status');
return TRUE;
}
+ /**
+ * @param null $baseBranch
+ *
+ * @return bool
+ */
function doBegin($baseBranch = NULL) {
if (!$baseBranch) {
return $this->returnError("Missing <base-branch>\n");
return TRUE;
}
+ /**
+ * @param null $baseBranch
+ *
+ * @return bool
+ * @throws Exception
+ */
function doResume($baseBranch = NULL) {
if (!$baseBranch) {
return $this->returnError("Missing <base-branch>\n");
return TRUE;
}
+ /**
+ * @param null $baseBranch
+ *
+ * @return bool
+ */
function doReview($baseBranch = NULL) {
if (! $this->doCheckoutAll($baseBranch)) {
return FALSE;
}
*/
+ /**
+ * @param $newBranchRepo
+ * @param $newBranchNames
+ *
+ * @return bool
+ */
function doPush($newBranchRepo, $newBranchNames) {
if (!$newBranchRepo) {
return $this->returnError("Missing <remote>\n");
return $branches;
}
+ /**
+ * @param $repoName
+ * @param $branchName
+ *
+ * @return string
+ */
function filterBranchName($repoName, $branchName) {
if ($branchName == '') {
return '';
return $repos;
}
+ /**
+ * @param $message
+ *
+ * @return bool
+ */
function returnError($message) {
echo "\nERROR: ", $message, "\n\n";
$this->doHelp();
}
}
+/**
+ * Class HttpClient
+ */
class HttpClient {
+ /**
+ * @param $url
+ * @param $file
+ *
+ * @return bool
+ */
static function download($url, $file) {
// PHP native client is unreliable PITA for HTTPS
if (exec("which wget")) {
return TRUE;
}
+ /**
+ * @param $url
+ *
+ * @return mixed
+ */
static function getJson($url) {
$file = tempnam(sys_get_temp_dir(), 'givi-json-');
HttpClient::download($url, $file);