*/
public function buildQuickForm() {
- CRM_Utils_System::setTitle( 'Wordpress Access Control' );
+ CRM_Utils_System::setTitle('Wordpress Access Control');
// Get the core permissions array
$permissionsArray = self::getPermissionArray();
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
- foreach ( $wp_roles->role_names as $role => $name ) {
+ foreach ($wp_roles->role_names as $role => $name) {
// Dont show the permissions options for administrator, as they have all permissions
if ($role !== 'administrator') {
$roleObj = $wp_roles->get_role($role);
// Compose the checkbox array for each role, to assign to form
$rolePerms[$role] = $permissionsArray;
- foreach ( $rolePerms[$role] as $key => $value) {
+ foreach ($rolePerms[$role] as $key => $value) {
$elementName = $role.'['.$key.']';
$this->add('checkbox', $elementName, $value);
}
'type' => 'next',
'name' => ts('Save'),
'spacing' => '',
- 'isDefault' => FALSE ),
+ 'isDefault' => FALSE ),
)
);
if (!isset($wp_roles)) {
$wp_roles = new WP_Roles();
}
- foreach ( $wp_roles->role_names as $role => $name ) {
+ foreach ($wp_roles->role_names as $role => $name) {
$roleObj = $wp_roles->get_role($role);
//Remove all civicrm capabilities for the role, as there may be some capabilities checkbox unticked
//Add the selected wordpress capabilities for the role
$rolePermissions = $params[$role];
if (!empty($rolePermissions)) {
- foreach ( $rolePermissions as $key => $capability ) {
+ foreach ($rolePermissions as $key => $capability) {
$roleObj->add_cap($key);
}
}
}
if (!empty($warningPermissionNames)) {
CRM_Core_Session::setStatus(
- ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array( 1 => $wp_roles->role_names[$role], 2 => implode(', ', $warningPermissionNames))),
+ ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array(1 => $wp_roles->role_names[$role], 2 => implode(', ', $warningPermissionNames))),
ts('Unsafe Permission Settings')
);
}
CRM_Core_Session::setStatus("", ts('Wordpress Access Control Updated'), "success");
// rebuild the menus to comply with the new permisssions/capabilites
- CRM_Core_Invoke::rebuildMenuAndCaches( );
+ CRM_Core_Invoke::rebuildMenuAndCaches();
CRM_Utils_System::redirect('admin.php?page=CiviCRM&q=civicrm/admin/access&reset=1');
CRM_Utils_System::civiExit();
* @return \CRM_Activity_BAO_ICalendar
@access public
*/
- public function __construct( &$act ) {
+ public function __construct(&$act) {
$this->activity = $act;
}
*
* @return string Array index of the added attachment in the $attachments array, or else null.
*/
- public function addAttachment( &$attachments, $contacts ) {
+ public function addAttachment(&$attachments, $contacts) {
// Check preferences setting
- if ( CRM_Core_BAO_Setting::getItem( CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification_ics' ) ) {
+ if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification_ics')) {
$config = &CRM_Core_Config::singleton();
- $this->icsfile = tempnam( $config->customFileUploadDir, 'ics' );
- if ( $this->icsfile !== FALSE ) {
- rename( $this->icsfile, $this->icsfile . '.ics' );
+ $this->icsfile = tempnam($config->customFileUploadDir, 'ics');
+ if ($this->icsfile !== FALSE) {
+ rename($this->icsfile, $this->icsfile . '.ics');
$this->icsfile .= '.ics';
- $icsFileName = basename( $this->icsfile );
+ $icsFileName = basename($this->icsfile);
// get logged in user's primary email
// TODO: Is there a better way to do this?
$template->assign('contacts', $contacts);
$template->assign('timezone', date_default_timezone_get());
$calendar = $template->fetch('CRM/Activity/Calendar/ICal.tpl');
- if ( file_put_contents( $this->icsfile, $calendar ) !== FALSE ) {
- if ( empty( $attachments ) ) {
+ if (file_put_contents($this->icsfile, $calendar) !== FALSE) {
+ if (empty($attachments)) {
$attachments = array();
}
$attachments['activity_ics'] = array(
}
public function cleanup() {
- if ( !empty ( $this->icsfile ) ) {
- @unlink( $this->icsfile );
+ if (!empty ($this->icsfile)) {
+ @unlink($this->icsfile);
}
}
$session = &CRM_Core_Session::singleton();
$uid = $session->get('userID');
$primary = '';
- $emails = CRM_Core_BAO_Email::allEmails( $uid );
- foreach ( $emails as $eid => $e ) {
- if ( $e['is_primary'] ) {
- if ( $e['email'] ) {
+ $emails = CRM_Core_BAO_Email::allEmails($uid);
+ foreach ($emails as $eid => $e) {
+ if ($e['is_primary']) {
+ if ($e['email']) {
$primary = $e['email'];
break;
}
}
- if ( count($emails) == 1 ) {
+ if (count($emails) == 1) {
$primary = $e['email'];
break;
}
$form->addSelect('activity_engagement_level', array('entity' => 'activity', 'context' => 'search'));
// Add survey result field.
- $optionGroups = CRM_Campaign_BAO_Survey::getResultSets( 'name' );
+ $optionGroups = CRM_Campaign_BAO_Survey::getResultSets('name');
$resultOptions = array();
- foreach ( $optionGroups as $gid => $name ) {
- if ( $name ) {
+ foreach ($optionGroups as $gid => $name) {
+ if ($name) {
$value = array();
$value = CRM_Core_OptionGroup::values($name);
if (!empty($value)) {
// Set title
if (isset($activityTName)) {
$activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName);
- $this->assign('pageTitle', ts('%1 Activity', array( 1 => $activityName)));
+ $this->assign('pageTitle', ts('%1 Activity', array(1 => $activityName)));
if ($this->_currentlyViewedContactId) {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId);
CRM_Utils_System::setTitle($displayName . ' - ' . $activityName);
}
else {
- CRM_Utils_System::setTitle(ts('%1 Activity', array( 1 => $activityName)));
+ CRM_Utils_System::setTitle(ts('%1 Activity', array(1 => $activityName)));
}
}
$urlParams .= "&qfKey=$qfKey";
}
$path = CRM_Utils_System::currentPath();
- if ($this->_compContext == 'advanced' ) {
+ if ($this->_compContext == 'advanced') {
$urlString = 'civicrm/contact/search/advanced';
}
elseif ($path == 'civicrm/group/search'
$this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, $cid);
$this->assign('openreport', $full_open_report);
- $click_thru_report = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows( $this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
+ $click_thru_report = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows($this->_mailing_id, NULL, FALSE, NULL, NULL, NULL, NULL, $cid);
$this->assign('clickreport', $click_thru_report);
}
* @static
*/
public static function formRule($fields) {
- if ( !isset($fields['with_contact']) &&
+ if (!isset($fields['with_contact']) &&
!isset($fields['assigned_to']) &&
!isset($fields['created_by'])
) {
$this->_contacts = array_unique($this->_contacts);
//bounce to pick option if no contacts to send to
- if ( empty($this->_contacts) ) {
+ if (empty($this->_contacts)) {
$urlParams = "_qf_PickOption_display=true&qfKey={$params['qfKey']}";
$urlRedirect = CRM_Utils_System::url('civicrm/activity/search', $urlParams);
CRM_Core_Error::statusBounce(
$domainID,
TRUE
);
- if ( $cacheKey ) {
+ if ($cacheKey) {
CRM_Core_BAO_Setting::flushCache($cacheKey);
}
elseif ($activityTypeName == 'Print PDF Letter') {
$updateUrl = 'civicrm/activity/pdf/add';
}
- if ( CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE) ) {
+ if (CRM_Activity_BAO_Activity::checkPermission($activityId, CRM_Core_Action::UPDATE)) {
$actionLinks += array(CRM_Core_Action::
UPDATE => array(
'name' => ts('Edit'),
$config = CRM_Core_Config::singleton();
if (in_array('CiviCase', $config->enableComponents)) {
- if ( CRM_Core_Permission::check('access all cases and activities') ||
- CRM_Core_Permission::check('access my cases and activities') ) {
+ if (CRM_Core_Permission::check('access all cases and activities') ||
+ CRM_Core_Permission::check('access my cases and activities')) {
self::$_tasks[6] = array(
'title' => ts('File on Case'),
'class' => 'CRM_Activity_Form_Task_FileOnCase',
$params = array('id' => $this->_id);
// this is needed if the form is outside the CRM name space
$baoName = $this->_BAOName;
- $baoName::retrieve($params, $this->_values );
+ $baoName::retrieve($params, $this->_values);
}
}
$this->_values = array();
$params = array('id' => $this->_id);
$baoName = $this->_BAOName;
- $baoName::retrieve($params, $this->_values );
+ $baoName::retrieve($params, $this->_values);
}
$defaults = $this->_values;
if ($this->_id) {
$this->_ppType = CRM_Utils_Request::retrieve('pp', 'String', $this, FALSE, NULL);
if (!$this->_ppType) {
- $this->_ppType = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessor',
+ $this->_ppType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor',
$this->_id,
'payment_processor_type_id'
);
}
$this->assign('ppType', $this->_ppType);
- $ppTypeName = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_PaymentProcessorType',
+ $ppTypeName = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType',
$this->_ppType,
'name'
);
- $this->assign('ppTypeName', $ppTypeName );
+ $this->assign('ppTypeName', $ppTypeName);
- $this->_ppDAO = new CRM_Financial_DAO_PaymentProcessorType( );
+ $this->_ppDAO = new CRM_Financial_DAO_PaymentProcessorType();
$this->_ppDAO->id = $this->_ppType;
if (!$this->_ppDAO->find(TRUE)) {
);
$types = CRM_Core_PseudoConstant::paymentProcessorType();
- $this->add( 'select', 'payment_processor_type_id', ts('Payment Processor Type'), $types, TRUE,
+ $this->add('select', 'payment_processor_type_id', ts('Payment Processor Type'), $types, TRUE,
array('onchange' => "reload(true)")
);
}
$domainID = CRM_Core_Config::domainID();
- $dao = new CRM_Financial_DAO_PaymentProcessor( );
+ $dao = new CRM_Financial_DAO_PaymentProcessor();
$dao->id = $this->_id;
$dao->domain_id = $domainID;
if (!$dao->find(TRUE)) {
* @return Void
*/
public function postProcess() {
- CRM_Utils_System::flushCache( 'CRM_Financial_DAO_PaymentProcessor' );
+ CRM_Utils_System::flushCache('CRM_Financial_DAO_PaymentProcessor');
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Financial_BAO_PaymentProcessor::del($this->_id);
* @return Void
*/
public function updatePaymentProcessor(&$values, $domainID, $test) {
- $dao = new CRM_Financial_DAO_PaymentProcessor( );
+ $dao = new CRM_Financial_DAO_PaymentProcessor();
$dao->id = $test ? $this->_testID : $this->_id;
$dao->domain_id = $domainID;
return;
}
- $attributes = CRM_Core_DAO::getAttribute( 'CRM_Financial_DAO_PaymentProcessorType' );
+ $attributes = CRM_Core_DAO::getAttribute('CRM_Financial_DAO_PaymentProcessorType');
foreach ($this->_fields as $field) {
$required = CRM_Utils_Array::value('required', $field, FALSE);
return $defaults;
}
- $dao = new CRM_Financial_DAO_PaymentProcessorType( );
+ $dao = new CRM_Financial_DAO_PaymentProcessorType();
$dao->id = $this->_id;
if (!$dao->find(TRUE)) {
* @return void
*/
public function postProcess() {
- CRM_Utils_System::flushCache( 'CRM_Financial_DAO_PaymentProcessorType' );
+ CRM_Utils_System::flushCache('CRM_Financial_DAO_PaymentProcessorType');
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Financial_BAO_PaymentProcessorType::del($this->_id);
CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
- $dao = new CRM_Financial_DAO_PaymentProcessorType( );
+ $dao = new CRM_Financial_DAO_PaymentProcessorType();
$dao->id = $this->_id;
$dao->is_default = CRM_Utils_Array::value('is_default', $values, 0);
if ($formValues['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED) {
CRM_Core_Session::setStatus(ts('You have selected "Disable Outbound Email". A test email can not be sent.'), ts("Email Disabled"), "error");
}
- elseif ( $formValues['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB ) {
+ elseif ($formValues['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB) {
CRM_Core_Session::setStatus(ts('You have selected "Redirect to Database". A test email can not be sent.'), ts("Email Disabled"), "error");
}
else {
// a potentially spurious message which might already have been set. This
// is a bit hackish
// CRM-10629
- $session = CRM_Core_Session::singleton( );
+ $session = CRM_Core_Session::singleton();
$session->getStatus(TRUE);
parent::postProcess();
//CRM-14179
$instances = 0;
- foreach ( $values as $valMatchType ) {
- foreach ( $valMatchType as $valPairs ) {
+ foreach ($values as $valMatchType) {
+ foreach ($valMatchType as $valPairs) {
$instances += count($valPairs);
}
}
case 'Joomla':
//condition based on Joomla version; <= 2.5 uses modal window; >= 3.0 uses full page with return value
- if (version_compare(JVERSION, '3.0', 'lt') ) {
+ if (version_compare(JVERSION, '3.0', 'lt')) {
JHTML::_('behavior.modal');
$url = $config->userFrameworkBaseURL . 'index.php?option=com_config&view=component&component=com_civicrm&tmpl=component';
$jparams = 'rel="{handler: \'iframe\', size: {x: 875, y: 550}, onClose: function() {}}" class="modal"';
*/
public function preProcess() {
CRM_Utils_System::setTitle(ts('CiviCRM Extensions'));
- $destination = CRM_Utils_System::url( 'civicrm/admin/extensions',
- 'reset=1' );
+ $destination = CRM_Utils_System::url('civicrm/admin/extensions',
+ 'reset=1');
- $destination = urlencode( $destination );
- $this->assign( 'destination', $destination );
+ $destination = urlencode($destination);
+ $this->assign('destination', $destination);
}
/**
unset($imageAlignment['C']);
$rowCount = self::FIELD_ROWCOUNT;
- for ( $i = 1; $i <= $rowCount; $i++ ) {
+ for ($i = 1; $i <= $rowCount; $i++) {
$this->add('select', "token[$i]", ts('Token'), array('' => ts('- skip -')) + $tokens);
$this->add('select', "font_name[$i]", ts('Font Name'), $fontNames);
$this->add('select', "font_size[$i]", ts('Font Size'), $fontSizes);
$batches = array();
$dao = CRM_Core_DAO::executeQuery($query);
- while ( $dao->fetch( ) ) {
+ while ($dao->fetch()) {
$batches[$dao->id] = $dao->title;
}
return $batches;
// Instantiate appropriate exporter based on user-selected format.
$exporterClass = "CRM_Financial_BAO_ExportFormat_" . self::$_exportFormat;
- if ( class_exists( $exporterClass ) ) {
+ if (class_exists($exporterClass)) {
$exporter = new $exporterClass();
}
else {
*/
public static function closeReOpen($batchIds = array(), $status) {
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
- $params['status_id'] = CRM_Utils_Array::key( $status, $batchStatus );
- $session = CRM_Core_Session::singleton( );
+ $params['status_id'] = CRM_Utils_Array::key($status, $batchStatus);
+ $session = CRM_Core_Session::singleton();
$params['modified_date'] = date('YmdHis');
- $params['modified_id'] = $session->get( 'userID' );
+ $params['modified_id'] = $session->get('userID');
foreach ($batchIds as $key => $value) {
$params['id'] = $ids['batchID'] = $value;
self::create($params, $ids);
}
// action is taken depending upon the mode
$select = 'civicrm_financial_trxn.id ';
- if (!empty( $returnValues)) {
+ if (!empty($returnValues)) {
$select .= " , ".implode(' , ', $returnValues);
}
$batches = array();
$dao = CRM_Core_DAO::executeQuery($query);
- while ( $dao->fetch( ) ) {
+ while ($dao->fetch()) {
$batches[$dao->id] = $dao->title;
}
return $batches;
$batches = array();
$dao = CRM_Core_DAO::executeQuery($query);
- while ( $dao->fetch( ) ) {
+ while ($dao->fetch()) {
$batches[$dao->id] = $dao->status_id;
}
return $batches;
else {
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
- $params['created_date'] = CRM_Utils_Date::processDate( date( "Y-m-d" ), date( "H:i:s" ) );
+ $params['created_date'] = CRM_Utils_Date::processDate(date("Y-m-d"), date("H:i:s"));
}
// always create with data entry status
// redirect to batch entry page.
$session = CRM_Core_Session::singleton();
- if ( $this->_action & CRM_Core_Action::ADD ) {
+ if ($this->_action & CRM_Core_Action::ADD) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/batch/entry', "id={$batch->id}&reset=1&action=add"));
}
else {
}
// for add mode set smart defaults
- if ( $this->_action & CRM_Core_Action::ADD ) {
- list( $currentDate, $currentTime ) = CRM_Utils_Date::setDateDefaults( NULL, 'activityDateTime' );
+ if ($this->_action & CRM_Core_Action::ADD) {
+ list($currentDate, $currentTime) = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
- $completeStatus = array_search( 'Completed', $allStatus );
+ $completeStatus = array_search('Completed', $allStatus);
$specialFields = array(
'join_date' => $currentDate,
'receive_date' => $currentDate,
);
for ($rowNumber = 1; $rowNumber <= $this->_batchInfo['item_count']; $rowNumber++) {
- foreach ($specialFields as $key => $value ) {
+ foreach ($specialFields as $key => $value) {
$defaults['field'][$rowNumber][$key] = $value;
}
}
foreach ($dates as $val) {
if (!empty($value[$val])) {
- $value[$val] = CRM_Utils_Date::processDate( $value[$val], $value[$val . '_time'], TRUE );
+ $value[$val] = CRM_Utils_Date::processDate($value[$val], $value[$val . '_time'], TRUE);
}
}
if (is_numeric($pledgeId)) {
$result = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId);
$pledgePaymentId = 0;
- foreach ($result as $key => $values ) {
+ foreach ($result as $key => $values) {
if ($values['status'] != 'Completed') {
$pledgePaymentId = $values['id'];
break;
$domainEmail = "$domainEmail[0] <$domainEmail[1]>";
$value['from_email_address'] = $domainEmail;
$value['contribution_id'] = $contribution->id;
- CRM_Contribute_Form_AdditionalInfo::emailReceipt( $this, $value );
+ CRM_Contribute_Form_AdditionalInfo::emailReceipt($this, $value);
}
}
}
}
if (!empty($value['receive_date'])) {
- $value['receive_date'] = CRM_Utils_Date::processDate( $value['receive_date'], $value['receive_date_time'], TRUE );
+ $value['receive_date'] = CRM_Utils_Date::processDate($value['receive_date'], $value['receive_date_time'], TRUE);
}
$params['actualBatchTotal'] += $value['total_amount'];
unset($value['membership_end_date']);
$value['is_renew'] = FALSE;
- if (!empty($params['member_option']) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) {
+ if (!empty($params['member_option']) && CRM_Utils_Array::value($key, $params['member_option']) == 2) {
$this->_params = $params;
$value['is_renew'] = TRUE;
$membership = CRM_Member_BAO_Membership::renewMembershipFormWrapper(
);
// make contribution entry
- CRM_Member_BAO_Membership::recordMembershipContribution( array_merge($value, array('membership_id' => $membership->id)));
+ CRM_Member_BAO_Membership::recordMembershipContribution(array_merge($value, array('membership_id' => $membership->id)));
}
else {
$membership = CRM_Member_BAO_Membership::create($value, CRM_Core_DAO::$_nullArray);
// end of premium
//send receipt mail.
- if ( $membership->id && !empty($value['send_receipt'])) {
+ if ($membership->id && !empty($value['send_receipt'])) {
// add the domain email id
$domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
$value['from_email_address'] = $domainEmail;
$value['membership_id'] = $membership->id;
$value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
- CRM_Member_Form_Membership::emailReceipt( $this, $value, $membership );
+ CRM_Member_Form_Membership::emailReceipt($this, $value, $membership);
}
}
}
* @return string
*/
public function getTemplateFileName() {
- if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0 ) {
+ if ($this->controller->getPrint() || $this->getVar('_surveyId') <= 0) {
return parent::getTemplateFileName();
}
else {
$this->_interviewerId = CRM_Utils_Array::value('survey_interviewer_id', $this->get('formValues'));
}
- if ( $this->_surveyId ) {
+ if ($this->_surveyId) {
$params = array('id' => $this->_surveyId);
CRM_Campaign_BAO_Survey::retrieve($params, $this->_surveyDetails);
}
$orderClause = FALSE;
$buttonName = $this->controller->getButtonName();
- if ( $buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) {
+ if ($buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) {
$orderByParams = CRM_Utils_Array::value('order_bys', $_POST);
}
- elseif ( CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id'] ) {
+ elseif (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
$orderByParams =
array(
1 => array(
}
$orderBy = array();
- if ( !empty($orderByParams) ) {
- foreach ( $orderByParams as $key => $val ) {
+ if (!empty($orderByParams)) {
+ foreach ($orderByParams as $key => $val) {
if (!empty($val['column'])) {
$orderBy[] = "{$val['column']} {$val['order']}";
}
}
- if ( !empty($orderBy) ) {
+ if (!empty($orderBy)) {
$orderClause = "ORDER BY " . implode(', ', $orderBy);
}
}
}
}
- if ( CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id'] ) {
+ if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
$defaults['order_bys'] =
array(
1 => array(
$params['priority_id'] = CRM_Core_OptionGroup::getValue('priority', 'Normal', 'name');
$activity->priority_id = $params['priority_id'];
- foreach ($form->_oldCaseStatus as $statuskey => $statusval ) {
+ foreach ($form->_oldCaseStatus as $statuskey => $statusval) {
if ($activity->subject == 'null') {
$activity->subject = ts('Case status changed from %1 to %2', array(
1 => CRM_Utils_Array::value($statusval, $form->_caseStatus),
$form->_caseStatusId = array_key_exists($caseStatusId, $caseStatus) ? $caseStatusId : NULL;
// Add attachments
- CRM_Core_BAO_File::buildAttachment( $form, 'civicrm_activity', $form->_activityId );
+ CRM_Core_BAO_File::buildAttachment($form, 'civicrm_activity', $form->_activityId);
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/case', 'reset=1'));
}
// Add parameters for attachments
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
- for ( $i = 1; $i <= $numAttachments; $i++ ) {
+ for ($i = 1; $i <= $numAttachments; $i++) {
$attachName = "attachFile_$i";
- if ( isset( $params[$attachName] ) && !empty( $params[$attachName] ) ) {
+ if (isset($params[$attachName]) && !empty($params[$attachName])) {
$xmlProcessorParams[$attachName] = $params[$attachName];
}
}
// 1. call begin post process
if ($this->_activityTypeFile) {
$className = "CRM_Case_Form_Activity_{$this->_activityTypeFile}";
- $className::beginPostProcess($this, $params );
+ $className::beginPostProcess($this, $params);
}
if (!empty($params['hidden_custom']) &&
// 4. call end post process
if ($this->_activityTypeFile) {
- $className::endPostProcess($this, $params );
+ $className::endPostProcess($this, $params);
}
// 5. auto populate activites
FALSE, NULL, FALSE
);
}
- elseif ($type == $pdfActivityType ) {
+ elseif ($type == $pdfActivityType) {
$url = CRM_Utils_System::url('civicrm/activity/pdf/add',
"action=add&context=standalone&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=$type",
- FALSE, NULL, FALSE );
+ FALSE, NULL, FALSE);
}
else {
$url = CRM_Utils_System::url('civicrm/case/activity',
// Add parameters for attachments
$numAttachments = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'max_attachments');
- for ( $i = 1; $i <= $numAttachments; $i++ ) {
+ for ($i = 1; $i <= $numAttachments; $i++) {
$attachName = "attachFile_$i";
- if ( isset( $params[$attachName] ) && !empty( $params[$attachName] ) ) {
+ if (isset($params[$attachName]) && !empty($params[$attachName])) {
$activityParams[$attachName] = $params[$attachName];
}
}
* @param $newValues
* @param $oldValues
*/
- public static function edit( &$newValues, &$oldValues ) {
+ public static function edit(&$newValues, &$oldValues) {
// still need to do more work on this
// CRM-10192
return;
- self::website( $newValues, $oldValues );
+ self::website($newValues, $oldValues);
}
/**
* @param $newValues
* @param $oldValues
*/
- public static function website( &$newValues, &$oldValues ) {
- $oldWebsiteValues = CRM_Utils_Array::value( 'website', $oldValues );
- $newWebsiteValues = CRM_Utils_Array::value( 'website', $newValues );
+ public static function website(&$newValues, &$oldValues) {
+ $oldWebsiteValues = CRM_Utils_Array::value('website', $oldValues);
+ $newWebsiteValues = CRM_Utils_Array::value('website', $newValues);
- if ( $oldWebsiteValues == null || $newWebsiteValues == null ) {
+ if ($oldWebsiteValues == null || $newWebsiteValues == null) {
return;
}
// check if we had a value in the old
$oldEmpty = $newEmpty = true;
- $old = $new = array( );
+ $old = $new = array();
- foreach ( $oldWebsiteValues as $idx => $value ) {
- if ( ! empty( $value['url'] ) ) {
+ foreach ($oldWebsiteValues as $idx => $value) {
+ if (! empty($value['url'])) {
$oldEmpty = false;
- $old[] = array( 'website_type_id' => $value['website_type_id'], 'url' => $value['url'] );
+ $old[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']);
}
}
- foreach ( $newWebsiteValues as $idx => $value ) {
- if ( ! empty( $value['url'] ) ) {
+ foreach ($newWebsiteValues as $idx => $value) {
+ if (! empty($value['url'])) {
$newEmpty = false;
- $new[] = array( 'website_type_id' => $value['website_type_id'], 'url' => $value['url'] );
+ $new[] = array('website_type_id' => $value['website_type_id'], 'url' => $value['url']);
}
}
// if both old and new are empty, we can delete new and avoid a write
- if ( $oldEmpty && $newEmpty ) {
- unset( $newValues['website'] );
+ if ($oldEmpty && $newEmpty) {
+ unset($newValues['website']);
}
// if different number of non-empty entries, return
- if ( count( $new ) != count( $old ) ) {
+ if (count($new) != count($old)) {
return;
}
// same number of entries, check if they are exactly the same
- foreach ( $old as $oldID => $oldValues ) {
+ foreach ($old as $oldID => $oldValues) {
$found = false;
- foreach ( $new as $newID => $newValues ) {
+ foreach ($new as $newID => $newValues) {
if (
$old['website_type_id'] == $new['website_type_id'] &&
$old['url'] == $new['url']
) {
$found = true;
- unset( $new[$newID] );
+ unset($new[$newID]);
break;
}
- if ( ! $found ) {
+ if (! $found) {
return;
}
}
// if we've come here, this means old and new are the same
// we can skip saving new and return
- unset( $newValues['website'] );
+ unset($newValues['website']);
}
/**
* @param $newValues
* @param $oldValues
*/
- public static function email( &$newValues, &$oldValues ) {
- $oldEmailValues = CRM_Utils_Array::value( 'email', $oldValues );
- $newEmailValues = CRM_Utils_Array::value( 'email', $newValues );
+ public static function email(&$newValues, &$oldValues) {
+ $oldEmailValues = CRM_Utils_Array::value('email', $oldValues);
+ $newEmailValues = CRM_Utils_Array::value('email', $newValues);
- if ( $oldEmailValues == null || $newEmailValues == null ) {
+ if ($oldEmailValues == null || $newEmailValues == null) {
return;
}
// check if we had a value in the old
$oldEmpty = $newEmpty = true;
- $old = $new = array( );
+ $old = $new = array();
- foreach ( $oldEmailValues as $idx => $value ) {
- if ( ! empty( $value['email'] ) ) {
+ foreach ($oldEmailValues as $idx => $value) {
+ if (! empty($value['email'])) {
$oldEmpty = false;
$old[] = array(
'email' => $value['email'],
}
}
- foreach ( $newEmailValues as $idx => $value ) {
- if ( ! empty( $value['email'] ) ) {
+ foreach ($newEmailValues as $idx => $value) {
+ if (! empty($value['email'])) {
$newEmpty = false;
$new[] = array(
'email' => $value['email'],
}
// if both old and new are empty, we can delete new and avoid a write
- if ( $oldEmpty && $newEmpty ) {
- unset( $newValues['email'] );
+ if ($oldEmpty && $newEmpty) {
+ unset($newValues['email']);
}
// if different number of non-empty entries, return
- if ( count( $new ) != count( $old ) ) {
+ if (count($new) != count($old)) {
return;
}
// same number of entries, check if they are exactly the same
- foreach ( $old as $oldID => $oldValues ) {
+ foreach ($old as $oldID => $oldValues) {
$found = false;
- foreach ( $new as $newID => $newValues ) {
+ foreach ($new as $newID => $newValues) {
if (
$old['email_type_id'] == $new['email_type_id'] &&
$old['url'] == $new['url']
) {
$found = true;
- unset( $new[$newID] );
+ unset($new[$newID]);
break;
}
- if ( ! $found ) {
+ if (! $found) {
return;
}
}
// if we've come here, this means old and new are the same
// we can skip saving new and return
- unset( $newValues['email'] );
+ unset($newValues['email']);
}
}
$params['group_type'] = '';
}
- $session = CRM_Core_Session::singleton( );
+ $session = CRM_Core_Session::singleton();
$cid = $session->get('userID');
// this action is add
if ($cid && empty($params['id'])) {
public static function getPermissionClause($force = FALSE) {
static $clause = 1;
static $retrieved = FALSE;
- if ((!$retrieved || $force ) && !CRM_Core_Permission::check('view all contacts') && !CRM_Core_Permission::check('edit all contacts')) {
+ if ((!$retrieved || $force) && !CRM_Core_Permission::check('view all contacts') && !CRM_Core_Permission::check('edit all contacts')) {
//get the allowed groups for the current user
$groups = CRM_ACL_API::group(CRM_ACL_API::VIEW);
if (!empty($groups)) {
// this function is expensive and should be sparingly used if groupIDs is empty
if (empty($groupIDs)) {
$groupIDClause = null;
- $groupIDs = array( );
+ $groupIDs = array();
}
else {
if (!is_array($groupIDs)) {
$prevContactID = $dao->contact_id;
if (!array_key_exists($dao->contact_id, $contactGroup)) {
$contactGroup[$dao->contact_id] =
- array( 'group' => array(), 'groupTitle' => array());
+ array('group' => array(), 'groupTitle' => array());
}
$contactGroup[$dao->contact_id]['group'][] =
$nextGroup = $this->_getNextSiblingGroup($currentGroup);
if (!$nextGroup) {
// no sibling, find an ancestor w/ a sibling
- for (;; ) {
+ for (;;) {
// since we pop this array everytime, we should be
// reasonably safe from infinite loops, I think :)
$ancestor = array_pop($this->_parentStack);
}
// instantiate the new class
- $customClass = new $customSearchClass( $formValues );
+ $customClass = new $customSearchClass($formValues);
return $customClass;
}
if (!empty($_POST['hidden_custom'])) {
$customGroupCount = CRM_Utils_Array::value('hidden_custom_group_count', $_POST);
- if ($contactSubType = CRM_Utils_Array::value( 'contact_sub_type', $_POST)) {
+ if ($contactSubType = CRM_Utils_Array::value('contact_sub_type', $_POST)) {
$paramSubType = implode(',', $contactSubType);
}
//custom field to load
if ($this->_contactSubType || isset($paramSubType)) {
$paramSubType = (isset($paramSubType)) ? $paramSubType :
- str_replace( CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_contactSubType, CRM_Core_DAO::VALUE_SEPARATOR));
+ str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_contactSubType, CRM_Core_DAO::VALUE_SEPARATOR));
$this->assign('paramSubType', $paramSubType);
}
}
//set address block defaults
- CRM_Contact_Form_Edit_Address::setDefaultValues( $defaults, $this );
+ CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this);
if (!empty($defaults['image_URL'])) {
}
}
- CRM_Contact_BAO_Contact_Optimizer::edit( $params, $this->_preEditValues );
+ CRM_Contact_BAO_Contact_Optimizer::edit($params, $this->_preEditValues);
if (!empty($params['image_URL'])) {
CRM_Contact_BAO_Contact::processImageParams($params);
// since we change element name for address custom data, we need to format the setdefault values
$addressDefaults = array();
foreach ($defaults as $key => $val) {
- if ( empty( $val ) ) {
+ if (empty($val)) {
continue;
}
*
* @static
*/
- public static function setDefaultValues( &$defaults, &$form ) {
+ public static function setDefaultValues(&$defaults, &$form) {
$addressValues = array();
if (isset($defaults['address']) && is_array($defaults['address']) &&
!CRM_Utils_System::isNull($defaults['address'])
unset($customValueCount[0]);
}
$form->_customValueCount = $customValueCount;
- $form->assign( 'customValueCount', $customValueCount);
+ $form->assign('customValueCount', $customValueCount);
}
}
}
$form->applyFilter('__ALL__', 'trim');
- if ( !$inlineEditMode || $inlineEditMode == 1 ) {
+ if (!$inlineEditMode || $inlineEditMode == 1) {
// household_name
$form->add('text', 'household_name', ts('Household Name'), $attributes['household_name']);
}
- if ( !$inlineEditMode || $inlineEditMode == 2 ) {
+ if (!$inlineEditMode || $inlineEditMode == 2) {
// nick_name
$form->addElement('text', 'nick_name', ts('Nickname'), $attributes['nick_name']);
$form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
}
- if ( !$inlineEditMode ) {
+ if (!$inlineEditMode) {
$form->add('text', 'external_identifier', ts('External ID'), $attributes['external_identifier'], FALSE);
$form->addRule('external_identifier',
ts('External ID already exists in Database.'),
public static function buildQuickForm(&$form, $inlineEditMode = NULL) {
$form->applyFilter('__ALL__', 'trim');
- if ( !$inlineEditMode || $inlineEditMode == 1 ) {
+ if (!$inlineEditMode || $inlineEditMode == 1) {
$nameFields = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_edit_options', TRUE, NULL,
FALSE, 'name', TRUE, 'AND v.filter = 2'
}
}
- if ( !$inlineEditMode || $inlineEditMode == 2 ) {
+ if (!$inlineEditMode || $inlineEditMode == 2) {
// nick_name
$form->addElement('text', 'nick_name', ts('Nickname'),
CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'nick_name')
$form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
}
- if ( !$inlineEditMode ) {
+ if (!$inlineEditMode) {
$checkSimilar = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'contact_ajax_check_similar',
NULL,
TRUE
);
- if ( $checkSimilar == null ) {
+ if ($checkSimilar == null) {
$checkSimilar = 0;
}
$form->assign('checkSimilar', $checkSimilar);
$form->applyFilter('__ALL__', 'trim');
- if ( !$inlineEditMode || $inlineEditMode == 1 ) {
+ if (!$inlineEditMode || $inlineEditMode == 1) {
// Organization_name
$form->add('text', 'organization_name', ts('Organization Name'), $attributes['organization_name']);
}
- if ( !$inlineEditMode || $inlineEditMode == 2 ) {
+ if (!$inlineEditMode || $inlineEditMode == 2) {
// legal_name
$form->addElement('text', 'legal_name', ts('Legal Name'), $attributes['legal_name']);
$form->addElement('text', 'contact_source', ts('Source'), CRM_Utils_Array::value('source', $attributes));
}
- if ( !$inlineEditMode ) {
+ if (!$inlineEditMode) {
$form->add('text', 'external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'), FALSE);
$form->addRule('external_identifier',
ts('External ID already exists in Database.'),
$groupSelect = $groupHierarchy;
}
- $groupSelect = array( '' => ts('- select group -')) + $groupSelect;
+ $groupSelect = array('' => ts('- select group -')) + $groupSelect;
if (count($groupSelect) > 1) {
$session = CRM_Core_Session::singleton();
$form->set($blockName . '_Block_Count', $instance);
$formName = 'CRM_Contact_Form_Edit_' . $blockName;
- $formName::buildQuickForm( $form );
+ $formName::buildQuickForm($form);
}
}
$params['contact_type'] = $this->_contactType;
//CRM-14904
- if ( isset($this->_defaults['contact_sub_type']) ) {
+ if (isset($this->_defaults['contact_sub_type'])) {
$params['contact_sub_type'] = $this->_defaults['contact_sub_type'];
}
$params['contact_id'] = $this->_contactId;
'select',
'relationship_type_id',
ts('Relationship Type'),
- array( '' => ts('- select -')) + $relationshipList,
+ array('' => ts('- select -')) + $relationshipList,
TRUE,
array('class' => 'crm-select2 huge')
);
$form->addRadio('relation_status', ts('Relationship Status'), $relStatusOption);
$form->setDefaults(array('relation_status' => 0));
// relation permission
- $relPermissionOption = array(ts('Any'), ts('Yes'), ts('No') );
+ $relPermissionOption = array(ts('Any'), ts('Yes'), ts('No'));
$form->addRadio('relation_permission', ts('Permissioned Relationship?'), $relPermissionOption);
$form->setDefaults(array('relation_permission' => 0));
// radio button for is_deceased
- $form->addYesNo( 'is_deceased', ts('Deceased'), TRUE);
+ $form->addYesNo('is_deceased', ts('Deceased'), TRUE);
}
/**
parent::preProcess();
// instantiate the new class
- $this->_customClass = new $this->_customSearchClass( $this->_formValues );
+ $this->_customClass = new $this->_customSearchClass($this->_formValues);
// CRM-12747
if (isset($this->_customClass->_permissionedComponent) &&
}
}
- $form->add('select', 'table', ts('Tables'), $tables );
+ $form->add('select', 'table', ts('Tables'), $tables);
$form->assign('csID', $form->get('csid'));
* @return array
*/
public function setDefaultValues() {
- $defaults = array( 'andOr' => '1' );
+ $defaults = array('andOr' => '1');
if (!empty($this->_formValues)) {
$defaults['andOr'] = CRM_Utils_Array::value('andOr', $this->_formValues, '1');
$valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers);
if (!empty($fv['location_type_id'])) {
foreach ($valuesothers as $vals) {
- if ( CRM_Utils_Array::value('location_type_id', $vals) ==
- CRM_Utils_Array::value('location_type_id', $fv ) ) {
+ if (CRM_Utils_Array::value('location_type_id', $vals) ==
+ CRM_Utils_Array::value('location_type_id', $fv)) {
foreach ($vals as $k => $v) {
if (in_array($k, array(
'email', 'phone', 'im', 'openid'))) {
$valuesothers = CRM_Core_BAO_Location::getValues($paramsothers, $valuesothers);
if ($locationTypeID) {
foreach ($valuesothers as $vals) {
- if ( CRM_Utils_Array::value('location_type_id', $vals) ==
+ if (CRM_Utils_Array::value('location_type_id', $vals) ==
$locationTypeID) {
foreach ($vals as $k => $v) {
if (in_array($k, array(
$returnP = isset($returnPropeties) ? $returnPropeties : "";
$customSearchClass = $this->get('customSearchClass');
- $selector = new $selectorName( $customSearchClass,
+ $selector = new $selectorName($customSearchClass,
$fv,
$params,
$returnP,
$this->_id = $savedSearch->id;
//CRM-14190
- if ( !empty($formValues['parents']) ) {
+ if (!empty($formValues['parents'])) {
CRM_Contact_BAO_GroupNestingCache::update();
}
}
$this->_dataSourceClassFile = str_replace('_', '/', $this->_dataSource) . ".php";
require_once $this->_dataSourceClassFile;
$this->_dataSourceClass = new $this->_dataSource;
- $this->_dataSourceClass->buildQuickForm( $this );
+ $this->_dataSourceClass->buildQuickForm($this);
}
// Get list of data sources and display them as options
$this->_params['import_table_name'] = 'civicrm_import_job_' . md5(uniqid(rand(), TRUE));
}
- $this->_dataSourceClass->postProcess( $this->_params, $db, $this );
+ $this->_dataSourceClass->postProcess($this->_params, $db, $this);
// We should have the data in the DB now, parse it
$importTableName = $this->get('importTableName');
$addressId = CRM_Utils_Request::retrieve('aid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
$address = array();
- if ( $addressId > 0 ) {
+ if ($addressId > 0) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('id' => $addressId);
}
// we just need current address block
- $currentAddressBlock['address'][$locBlockNo] = array_pop( $address );
+ $currentAddressBlock['address'][$locBlockNo] = array_pop($address);
- if ( !empty( $currentAddressBlock['address'][$locBlockNo] ) ) {
+ if (!empty($currentAddressBlock['address'][$locBlockNo])) {
// get contact name of shared contact names
$sharedAddresses = array();
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($currentAddressBlock['address']);
}
// add custom data of type address
- $groupTree = CRM_Core_BAO_CustomGroup::getTree( 'Address',
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree('Address',
$this, $currentAddressBlock['address'][$locBlockNo]['id']
);
// we setting the prefix to dnc_ below so that we don't overwrite smarty's grouptree var.
- $currentAddressBlock['address'][$locBlockNo]['custom'] = CRM_Core_BAO_CustomGroup::buildCustomDataView( $this, $groupTree, FALSE, NULL, "dnc_");
+ $currentAddressBlock['address'][$locBlockNo]['custom'] = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, "dnc_");
$this->assign("dnc_viewCustomData", NULL);
$this->assign('add', $currentAddressBlock['address'][$locBlockNo]);
$this->assign('sharedAddresses', $sharedAddresses);
}
- $contact = new CRM_Contact_BAO_Contact( );
+ $contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
- foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) {
- if ( isset( $contact->$name ) ) {
+ foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
+ if (isset($contact->$name)) {
$privacy[$name] = $contact->$name;
}
}
$params = array('id' => $contactId);
$defaults = array();
- CRM_Contact_BAO_Contact::getValues( $params, $defaults );
+ CRM_Contact_BAO_Contact::getValues($params, $defaults);
$defaults['privacy_values'] = CRM_Core_SelectValues::privacy();
$communicationStyle = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'communication_style_id');
$params = array('id' => $contactId);
$defaults = array();
- CRM_Contact_BAO_Contact::getValues( $params, $defaults );
+ CRM_Contact_BAO_Contact::getValues($params, $defaults);
//get the current employer name
if (CRM_Utils_Array::value('contact_type', $defaults) == 'Individual') {
$params = array('id' => $contactId);
$defaults = array();
- CRM_Contact_BAO_Contact::getValues( $params, $defaults );
+ CRM_Contact_BAO_Contact::getValues($params, $defaults);
if (!empty($defaults['gender_id'])) {
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
}
}
- $contact = new CRM_Contact_BAO_Contact( );
+ $contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
- foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) {
- if ( isset( $contact->$name ) ) {
+ foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
+ if (isset($contact->$name)) {
$privacy[$name] = $contact->$name;
}
}
}
}
- $contact = new CRM_Contact_BAO_Contact( );
+ $contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
- foreach ( CRM_Contact_BAO_Contact::$_commPrefs as $name ) {
- if ( isset( $contact->$name ) ) {
+ foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
+ if (isset($contact->$name)) {
$privacy[$name] = $contact->$name;
}
}
}
// ensure that the id does exist
- if ( CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $this->_contactId, 'id' ) != $this->_contactId ) {
+ if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'id') != $this->_contactId) {
CRM_Core_Error::statusBounce(
ts('A Contact with that ID does not exist: %1', array(1 => $this->_contactId)),
CRM_Utils_System::url('civicrm/dashboard', 'reset=1')
if (isset($value['customData'])) {
foreach ($defaults[$key] as $blockId => $blockVal) {
$idValue = $blockVal['id'];
- if ( $key == 'address' ) {
+ if ($key == 'address') {
if (!empty($blockVal['master_id'])) {
$idValue = $blockVal['master_id'];
}
'contact_sub_type',
'sort_name',
);
- foreach ( $doNotCareElements as $value) {
+ foreach ($doNotCareElements as $value) {
unset($this->_returnProperties[$value]);
}
}
// check for current != previous to ensure cache is not reset if paging is done without changing
// sort criteria
- if (!$pageNum || (!empty($currentSortID) && $currentSortID != $previousSortID) ) {
+ if (!$pageNum || (!empty($currentSortID) && $currentSortID != $previousSortID)) {
CRM_Core_BAO_PrevNextCache::deleteItem(NULL, $cacheKey, 'civicrm_contact');
// this means it's fresh search, so set pageNum=1
if (!$pageNum) {
else {
require_once str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php';
}
- $this->_search = new $customSearchClass( $formValues );
+ $this->_search = new $customSearchClass($formValues);
}
else {
$fnName = $ext->keyToPath;
$transaction['trxn_id'] = md5(uniqid(rand(), TRUE));
}
- if (!isset( $transaction['financial_type_id'])) {
+ if (!isset($transaction['financial_type_id'])) {
$contributionTypes = array_keys(CRM_Contribute_PseudoConstant::financialType());
$transaction['financial_type_id'] = $contributionTypes[0];
}
if ($gId) {
$email = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gId, 'notify');
if ($email) {
- $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE );
+ $val = CRM_Core_BAO_UFGroup::checkFieldsEmptyValues($gId, $contactID, CRM_Utils_Array::value($key, $params), TRUE);
CRM_Core_BAO_UFGroup::commonSendMail($contactID, $val);
}
}
$sendTemplateParams['cc'] = CRM_Utils_Array::value('cc_receipt', $values);
$sendTemplateParams['bcc'] = CRM_Utils_Array::value('bcc_receipt', $values);
//send email with pdf invoice
- $template = CRM_Core_Smarty::singleton( );
+ $template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
$invoicing = CRM_Utils_Array::value('invoicing', $prefixValue);
// Add batch select
$batches = CRM_Contribute_PseudoConstant::batch();
- if ( !empty( $batches ) ) {
+ if (!empty($batches)) {
$form->add('select', 'contribution_batch_id',
ts('Batch Name'),
array('' => ts('- any -')) + $batches,
if (isset($this->_id)) {
$params = array('id' => $this->_id);
- if (!empty( $this->_BAOName)) {
+ if (!empty($this->_BAOName)) {
$baoName = $this->_BAOName;
$baoName::retrieve($params, $defaults);
}
$form->assign('receive_date', CRM_Utils_Date::processDate($params['receive_date']));
}
- $template = CRM_Core_Smarty::singleton( );
+ $template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$eventTaxAmt = $template->get_template_vars('totalTaxAmount');
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) {
return;
}
- $defaults = array( );
+ $defaults = array();
if ($this->_mode) {
$defaults = $this->_values;
}
$type = 'next';
- if ( $this->_selfService ) {
+ if ($this->_selfService) {
$type = 'submit';
}
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
- if ( $userID && $status) {
+ if ($userID && $status) {
$session->setStatus($status, $msgTitle, $msgType);
}
elseif (!$userID) {
}
//store contribution ID if not yet set (on create)
- if ( empty($this->_id) && !empty($contribution->id) ) {
+ if (empty($this->_id) && !empty($contribution->id)) {
$this->_id = $contribution->id;
}
}
//when multiple payment processor as the user
//can toggle with payment processor selection
$billingModePaymentProcessors = 0;
- if ( !empty( $this->_paymentProcessors ) ) {
+ if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $values) {
if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
$billingModePaymentProcessors++;
if ($self->_quickConfig && ($priceField->name == 'contribution_amount' || $priceField->name == 'membership_amount')) {
$previousId = $priceField->id;
- if ($priceField->name == 'membership_amount' && !$priceField->is_active ) {
+ if ($priceField->name == 'membership_amount' && !$priceField->is_active) {
$membershipIsActive = FALSE;
}
}
if ($priceSetId = CRM_Utils_Array::value('priceSetId', $params)) {
$lineItem = array();
- $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config' );
- if ( $is_quick_config ) {
- foreach ( $this->_values['fee'] as $key => & $val ) {
- if ( $val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists( 'price_'.$key, $params ) ) {
+ $is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $priceSetId, 'is_quick_config');
+ if ($is_quick_config) {
+ foreach ($this->_values['fee'] as $key => & $val) {
+ if ($val['name'] == 'other_amount' && $val['html_type'] == 'Text' && array_key_exists('price_'.$key, $params) ) {
$params['price_'.$key] = CRM_Utils_Rule::cleanMoney($params['price_'.$key]); //Clean out any currency symbols
- if ( $params['price_'.$key] != 0 ) {
- foreach ( $val['options'] as $optionKey => & $options ) {
- $options['amount'] = CRM_Utils_Array::value( 'price_'.$key, $params );
+ if ($params['price_'.$key] != 0) {
+ foreach ($val['options'] as $optionKey => & $options) {
+ $options['amount'] = CRM_Utils_Array::value('price_'.$key, $params);
break;
}
}
}
}
- $this->assign( 'qParams', $qParams );
+ $this->assign('qParams', $qParams);
if ($membershipTypeID) {
$transactionID = $this->get('membership_trx_id');
$this->addElement('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PremiumsProduct', 'weight'));
- $financialType = CRM_Contribute_PseudoConstant::financialType( );
+ $financialType = CRM_Contribute_PseudoConstant::financialType();
$premiumFinancialType = array();
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
- foreach ($financialType as $key => $financialTypeName ) {
- if (!in_array( $key, $productFinancialType)) {
- unset( $financialType[$key] );
+ foreach ($financialType as $key => $financialTypeName) {
+ if (!in_array($key, $productFinancialType)) {
+ unset($financialType[$key]);
}
}
- if (count( $financialType ) ) {
- $this->assign( 'financialType', $financialType );
+ if (count($financialType)) {
+ $this->assign('financialType', $financialType);
}
$this->add(
'select',
'financial_type_id',
- ts( 'Financial Type' ),
+ ts('Financial Type'),
array('' => ts('- select -')) + $financialType
);
$this->addRule('weight', ts('Please enter integer value for weight'), 'integer');
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', $params['amount_label']);
}
else {
- CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $priceFieldID, 'is_required', 0 );
+ CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $priceFieldID, 'is_required', 0);
CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceFieldValue', $priceFieldValueID, 'label', 'Other Amount');
}
}
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $contributionPageID);
}
- if ($deleteAmountBlk ) {
+ if ($deleteAmountBlk) {
$priceField = !empty($params['price_field_id']) ? $params['price_field_id'] : CRM_Utils_Array::value('price_field_other', $params);
if ($priceField) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $priceField, 'price_set_id');
// ensure on-behalf-of profile meets minimum requirements
if (!empty($values['is_organization'])) {
- if (empty($values['onbehalf_profile_id']) ) {
+ if (empty($values['onbehalf_profile_id'])) {
$errors['onbehalf_profile_id'] = ts('Please select a profile to collect organization information on this contribution page.');
}
else {
* @return void
*/
public function buildQuickForm() {
- parent::buildQuickForm( );
+ parent::buildQuickForm();
$this->setPageTitle(ts('Premium Product'));
if ($this->_action & CRM_Core_Action::PREVIEW) {
$this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval'));
//Financial Type CRM-11106
- $financialType = CRM_Contribute_PseudoConstant::financialType( );
+ $financialType = CRM_Contribute_PseudoConstant::financialType();
$premiumFinancialType = array();
CRM_Core_PseudoConstant::populate(
$premiumFinancialType,
'account_relationship = 7'
);
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
- foreach ($financialType as $key => $financialTypeName ) {
- if (!in_array( $key, $productFinancialType)) {
- unset( $financialType[$key] );
+ foreach ($financialType as $key => $financialTypeName) {
+ if (!in_array($key, $productFinancialType)) {
+ unset($financialType[$key]);
}
}
- if (count( $financialType ) ) {
- $this->assign( 'financialType', $financialType );
+ if (count($financialType)) {
+ $this->assign('financialType', $financialType);
}
$this->add(
'select',
'financial_type_id',
- ts( 'Financial Type' ),
+ ts('Financial Type'),
array('' => ts('- select -')) + $financialType
);
$this->add('text', 'title', ts('Find'), $attributes);
- $financial_account = CRM_Contribute_PseudoConstant::financialType( );
+ $financial_account = CRM_Contribute_PseudoConstant::financialType();
foreach ($financial_account as $contributionId => $contributionName) {
$this->addElement('checkbox', "financial_type_id[$contributionId]", 'Financial Type', $contributionName);
}
$parent = $this->controller->getParent();
$parent->set('searchResult', 1);
if (!empty($params)) {
- $fields = array( 'title', 'financial_type_id', 'campaign_id' );
+ $fields = array('title', 'financial_type_id', 'campaign_id');
foreach ($fields as $field) {
if (isset($params[$field]) &&
!CRM_Utils_System::isNull($params[$field])
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
- $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$form->_includesSoftCredits = CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled($queryParams);
);
$this->addElement('select', 'group_by', ts('Group contributions by'), $options, array(), "<br/>", FALSE);
// this was going to be free-text but I opted for radio options in case there was a script injection risk
- $separatorOptions = array('comma' => 'Comma', 'td' => 'Table Cell' );
+ $separatorOptions = array('comma' => 'Comma', 'td' => 'Table Cell');
$this->addElement('select', 'group_by_separator', ts('Separator (grouped contributions)'), $separatorOptions);
$emailOptions = array(
'' => ts('Generate PDFs for printing (only)'),
*/
public function buildQuickForm() {
$type = 'next';
- if ( $this->_selfService ) {
+ if ($this->_selfService) {
$type = 'submit';
}
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
- if ( $userID && $status) {
+ if ($userID && $status) {
$session->setStatus($status, $msgTitle, $msgType);
}
elseif (!$userID) {
if (!$this->_paymentProcessorObj->isSupported('changeSubscriptionAmount')) {
$userAlert = "<span class='font-red'>" . ts('Updates made using this form will change the recurring contribution information stored in your CiviCRM database, but will NOT be sent to the payment processor. You must enter the same changes using the payment processor web site.',
- array( 1 => $this->_paymentProcessorObj->_processorName ) ) . '</span>';
+ array(1 => $this->_paymentProcessorObj->_processorName)) . '</span>';
CRM_Core_Session::setStatus($userAlert, ts('Warning'), 'alert');
}
}
$type = 'next';
- if ( $this->_selfService ) {
+ if ($this->_selfService) {
$type = 'submit';
}
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
- if ( $userID && $status) {
+ if ($userID && $status) {
CRM_Core_Session::setStatus($status, $msgTitle, $msgType);
}
elseif (!$userID) {
}
}
- $value = $this->get( 'financial_type_id' );
+ $value = $this->get('financial_type_id');
$val = array();
if ($value) {
if (is_array($value)) {
$dao->id
);
//Financial Type
- if (!empty( $dao->financial_type_id ) ) {
+ if (!empty($dao->financial_type_id) ) {
require_once 'CRM/Core/DAO.php';
- $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' );
+ $premiums[$dao->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name');
}
}
$this->assign('rows', $premiums);
);
//Financial Type
if (!empty($dao->financial_type_id)) {
- $premiums[$productDAO->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name' );
+ $premiums[$productDAO->id]['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $dao->financial_type_id, 'name');
}
}
}
$this->assign('task', $task);
$this->assign('result', $result);
- if ( $task == 'billing' ) {
+ if ($task == 'billing') {
$session = CRM_Core_Session::singleton();
$tplParams = $session->get('resultParams');
- foreach ( $tplParams as $key => $val ) {
+ foreach ($tplParams as $key => $val) {
$this->assign($key, $val);
}
}
if ($recurID) {
$paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj');
- if (is_object( $paymentProcessorObj) && $paymentProcessorObj->isSupported('cancelSubscription')) {
+ if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('cancelSubscription')) {
unset(self::$_links[CRM_Core_Action::DISABLE]['extra'], self::$_links[CRM_Core_Action::DISABLE]['ref']);
self::$_links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe";
self::$_links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}";
}
- if (is_object( $paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
+ if (is_object($paymentProcessorObj) && $paymentProcessorObj->isSupported('updateSubscriptionBillingInfo')) {
self::$_links[CRM_Core_Action::RENEW] = array(
'name' => ts('Change Billing Details'),
'title' => ts('Change Billing Details'),
unset(self::$_tasks[1]);
}
//CRM-12920 - check for edit permission
- if (!CRM_Core_Permission::check('edit contributions') ) {
+ if (!CRM_Core_Permission::check('edit contributions')) {
unset(self::$_tasks[4], self::$_tasks[6]);
}
if ($kkey) {
$auto = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $kkey, 'auto_renew');
}
- if ( $auto ) {
+ if ($auto) {
$vval = $statusLabel + $autoRenew;
}
else {
$contactField = 'e.contact_id';
$table = 'civicrm_membership e';
// build where clause
- if ( $status == 2 ) {
+ if ($status == 2) {
//auto-renew memberships
$where[] = "e.contribution_recur_id IS NOT NULL ";
}
- elseif ( $status == 1 ) {
+ elseif ($status == 1) {
$where[] = "e.contribution_recur_id IS NULL ";
}
return NULL;
}
$BAOString = 'CRM_Core_BAO_' . $blockName;
- $block = new $BAOString( );
+ $block = new $BAOString();
$blocks = array();
if (!isset($params['entity_table'])) {
$count = 1;
foreach ($blockIds as $blockId) {
- $block = new $BAOString( );
+ $block = new $BAOString();
$block->id = $blockId['id'];
$getBlocks = self::retrieveBlock($block, $blockName);
$blocks[$count++] = array_pop($getBlocks);
// e.g $bao = new $baoString;
// $bao->getAllBlocks()
$baoFunction = 'all' . $name . 's';
- $allBlocks = $baoString::$baoFunction( $contactId, $updateBlankLocInfo );
+ $allBlocks = $baoString::$baoFunction($contactId, $updateBlankLocInfo);
}
elseif (!empty($entityElements) && $blockName != 'openid') {
$baoFunction = 'allEntity' . $name . 's';
- $allBlocks = $baoString::$baoFunction( $entityElements );
+ $allBlocks = $baoString::$baoFunction($entityElements);
}
return $allBlocks;
}
if ($resetPrimaryId) {
$baoString = 'CRM_Core_BAO_' . $blockName;
- $block = new $baoString( );
+ $block = new $baoString();
$block->selectAdd();
$block->selectAdd("id, is_primary");
$block->id = $resetPrimaryId;
$blockFields = array_merge($value, $contactFields);
$baoString = 'CRM_Core_BAO_' . $name;
- $blocks[] = $baoString::add( $blockFields );
+ $blocks[] = $baoString::add($blockFields);
}
// we need to delete blocks that were deleted during update
}
$baoString = 'CRM_Core_DAO_' . $name;
- $block = new $baoString( );
+ $block = new $baoString();
$block->copyValues($params);
/*
* is_primary to 1
* CRM-10451
*/
- if ( $existingEntities->N == 1 && $existingEntities->id == CRM_Utils_Array::value( 'id', $params ) ) {
+ if ($existingEntities->N == 1 && $existingEntities->id == CRM_Utils_Array::value('id', $params)) {
$params['is_primary'] = 1;
return;
}
break;
case 'File':
- if ( $op == 'IS NULL' || $op == 'IS NOT NULL' || $op == 'IS EMPTY' || $op == 'IS NOT EMPTY' ) {
+ if ($op == 'IS NULL' || $op == 'IS NOT NULL' || $op == 'IS EMPTY' || $op == 'IS NOT EMPTY') {
switch ($op) {
case 'IS EMPTY':
$op = 'IS NULL';
*/
public static function del($entityId, $entityTable) {
// delete all discount records with the selected discounted id
- $discount = new CRM_Core_DAO_Discount( );
+ $discount = new CRM_Core_DAO_Discount();
$discount->entity_id = $entityId;
$discount->entity_table = $entityTable;
if ($discount->delete()) {
* @static
*/
public static function add(&$params) {
- $discount = new CRM_Core_DAO_Discount( );
+ $discount = new CRM_Core_DAO_Discount();
$discount->copyValues($params);
$discount->save();
return $discount;
*/
public static function getOptionGroup($entityId, $entityTable) {
$optionGroupIDs = array();
- $dao = new CRM_Core_DAO_Discount( );
+ $dao = new CRM_Core_DAO_Discount();
$dao->entity_id = $entityId;
$dao->entity_table = $entityTable;
$dao->find();
return NULL;
}
- $dao = new CRM_Core_DAO_Discount( );
+ $dao = new CRM_Core_DAO_Discount();
$dao->entity_id = $entityID;
$dao->entity_table = $entityTable;
$dao->find();
* @return CRM_Core_BAO_FinancialTrxn object
* @static
*/
- public static function create(&$params, $trxnEntityTable = null ) {
+ public static function create(&$params, $trxnEntityTable = null) {
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn->copyValues($params);
$fids = array();
* @return CRM_Contribute_BAO_ContributionType object
* @static
*/
- public static function retrieve( &$params, &$defaults ) {
- $financialItem = new CRM_Financial_DAO_FinancialTrxn( );
+ public static function retrieve(&$params, &$defaults) {
+ $financialItem = new CRM_Financial_DAO_FinancialTrxn();
$financialItem->copyValues($params);
if ($financialItem->find(true)) {
- CRM_Core_DAO::storeValues( $financialItem, $defaults );
+ CRM_Core_DAO::storeValues($financialItem, $defaults);
return $financialItem;
}
return null;
$query = 'SELECT COUNT(*) FROM civicrm_job_log';
$count = CRM_Core_DAO::singleValueQuery($query);
- if ( $count <= $maxEntriesToKeep) {
+ if ($count <= $maxEntriesToKeep) {
return;
}
// create location blocks.
foreach (self::$blocks as $block) {
if ($block != 'address') {
- $location[$block] = CRM_Core_BAO_Block::create( $block, $params, $entity );
+ $location[$block] = CRM_Core_BAO_Block::create($block, $params, $entity);
}
else {
$location[$block] = CRM_Core_BAO_Address::create($params, $fixAddress, $entity);
if (array_key_exists('note', $fields['Contact'])) {
$noteTitle = $fields['Contact']['note']['title'];
$fields['Contact']['note']['title'] = $noteTitle . ': ' . ts('Body and Subject');
- $fields['Contact']['note_body'] = array( 'title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body' );
- $fields['Contact']['note_subject'] = array( 'title' => $noteTitle . ': ' . ts('Subject Only'), 'name' => 'note_subject' );
+ $fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body');
+ $fields['Contact']['note_subject'] = array('title' => $noteTitle . ': ' . ts('Subject Only'), 'name' => 'note_subject');
}
}
null, null, false,
$tokens,
'CRM_Core_BAO_MessageTemplate');
- $contact = reset( $details );
+ $contact = reset($details);
// call token hook
$hookTokens = array();
$params['has_separator'] = CRM_Utils_Array::value('has_separator', $params, FALSE);
if (!isset($params['id']) ||
- (CRM_Utils_Array::value( 'parent_id', $params ) != CRM_Utils_Array::value('current_parent_id', $params))
+ (CRM_Utils_Array::value('parent_id', $params) != CRM_Utils_Array::value('current_parent_id', $params))
) {
/* re/calculate the weight, if the Parent ID changed OR create new menu */
$incrementOtherNodes = true;
$sql = "SELECT weight from civicrm_navigation WHERE {$parentClause} ORDER BY weight LIMIT %1, 1";
- $params = array(1 => array( $position, 'Positive'));
+ $params = array(1 => array($position, 'Positive'));
$newWeight = CRM_Core_DAO::singleValueQuery($sql, $params);
// this means node is moved to last position, so you need to get the weight of last element + 1
$transaction = new CRM_Core_Transaction();
// now update the existing nodes to weight + 1, if required.
- if ( $incrementOtherNodes ) {
+ if ($incrementOtherNodes) {
$query = "UPDATE civicrm_navigation SET weight = weight + 1
WHERE {$parentClause} AND weight >= {$newWeight}";
$params1[2] = array("{$cacheKey}_alphabet%", 'String');
$dao = CRM_Core_DAO::executeQuery($query, $params1);
- $val = array( );
+ $val = array();
while ($dao->fetch()) {
$val[] = $dao->data;
}
}
}
- if (!in_array($prefixName, $validProfileFields) ) {
+ if (!in_array($prefixName, $validProfileFields)) {
return;
}
FROM civicrm_word_replacement
WHERE domain_id = %1
";
- $params = array( 1 => array($id, 'Integer'));
+ $params = array(1 => array($id, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
// add archive tables here
$archiveTables = array();
- foreach ($this->tables as $name => $table ) {
- if ( $table['archive'] == 'true' ) {
+ foreach ($this->tables as $name => $table) {
+ if ($table['archive'] == 'true') {
$name = 'archive_' . $table['name'];
$table['name'] = $name;
$table['archive'] = 'false';
- if ( isset($table['foreignKey']) ) {
+ if (isset($table['foreignKey'])) {
foreach ($table['foreignKey'] as $fkName => $fkValue) {
if ($this->tables[$fkValue['table']]['archive'] == 'true') {
$table['foreignKey'][$fkName]['table'] = 'archive_' . $table['foreignKey'][$fkName]['table'];
$table['foreignKey'][$fkName]['uniqName'] =
- str_replace( 'FK_', 'FK_archive_', $table['foreignKey'][$fkName]['uniqName'] );
+ str_replace('FK_', 'FK_archive_', $table['foreignKey'][$fkName]['uniqName']);
}
}
$archiveTables[$name] = $table;
* Append to the query log (if enabled)
*/
public static function debug_query($string) {
- if ( defined( 'CIVICRM_DEBUG_LOG_QUERY' ) ) {
- if ( CIVICRM_DEBUG_LOG_QUERY == 'backtrace' ) {
- CRM_Core_Error::backtrace( $string, TRUE );
+ if (defined('CIVICRM_DEBUG_LOG_QUERY')) {
+ if (CIVICRM_DEBUG_LOG_QUERY == 'backtrace') {
+ CRM_Core_Error::backtrace($string, TRUE);
}
- elseif ( CIVICRM_DEBUG_LOG_QUERY ) {
- CRM_Core_Error::debug_var( 'Query', $string, FALSE, TRUE );
+ elseif (CIVICRM_DEBUG_LOG_QUERY) {
+ CRM_Core_Error::debug_var('Query', $string, FALSE, TRUE);
}
}
}
*/
static function buildQuickForm(
&$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE,
- $skipEntityAction = FALSE, $tagsetElementName = NULL ) {
+ $skipEntityAction = FALSE, $tagsetElementName = NULL) {
$tagset = $form->_entityTagValues = array();
$form->assign("isTagset", FALSE);
$mode = NULL;
// lets drop all triggers first
$logging = new CRM_Logging_Schema;
- $logging->dropTriggers( );
+ $logging->dropTriggers();
// turn subsequent tables singlelingual
$tables = CRM_Core_I18n_SchemaStructure::tables();
$dbLocale = '';
// now lets rebuild all triggers
- CRM_Core_DAO::triggerRebuild( );
+ CRM_Core_DAO::triggerRebuild();
}
/**
$dao->query($query, FALSE);
}
- if ( !empty($triggers)) {
+ if (!empty($triggers)) {
if (CRM_Core_Config::isUpgradeMode()) {
foreach ($triggers as $triggerInfo) {
$when = $triggerInfo['when'];
}
$title = CRM_Utils_Array::value('title', $item);
if (strstr($item['page_callback'], '_Page')) {
- $object = new $item['page_callback'] ($title, $mode );
+ $object = new $item['page_callback'] ($title, $mode);
$object->urlPath = explode('/', $_GET[$config->userFrameworkURLVar]);
}
elseif (strstr($item['page_callback'], '_Controller')) {
$addSequence = $addSequence ? 'true' : 'false';
unset($pageArgs['addSequence']);
}
- $object = new $item['page_callback'] ($title, true, $mode, null, $addSequence );
+ $object = new $item['page_callback'] ($title, true, $mode, null, $addSequence);
}
else {
CRM_Core_Error::fatal();
CRM_Utils_Hook::pageRun($this);
if ($this->_print) {
- if (in_array( $this->_print, array( CRM_Core_Smarty::PRINT_SNIPPET,
- CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON ))) {
+ if (in_array($this->_print, array(CRM_Core_Smarty::PRINT_SNIPPET,
+ CRM_Core_Smarty::PRINT_PDF, CRM_Core_Smarty::PRINT_NOFORM, CRM_Core_Smarty::PRINT_JSON))) {
$content = self::$_template->fetch('CRM/common/snippet.tpl');
}
else {
$startDate->setTimezone(new DateTimeZone(self::TIMEZONE));
}
- $template->assign( 'startDate', $startDate->format('Y-m-d') );
+ $template->assign('startDate', $startDate->format('Y-m-d'));
$installments = $this->_getParam('installments');
public function _getParam($field, $xmlSafe = FALSE) {
$value = CRM_Utils_Array::value($field, $this->_params, '');
if ($xmlSafe) {
- $value = str_replace(array( '&', '"', "'", '<', '>' ), '', $value);
+ $value = str_replace(array('&', '"', "'", '<', '>'), '', $value);
}
return $value;
}
$contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array('return' => 'contact_id, id', 'invoice_id' => $input['invoice']));
$ids['contact'] = $contributionRecur['contact_id'];
$ids['contributionRecur'] = $contributionRecur['id'];
- $result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice'] ));
+ $result = civicrm_api3('contribution', 'getsingle', array('invoice_id' => $input['invoice']));
$ids['contribution'] = $result['id'];
//@todo hard - coding 'pending' for now
*/
public function checkGroupRole($array) {
if (function_exists('user_load') && isset($array)) {
- $user = user_load( $GLOBALS['user']->uid);
+ $user = user_load($GLOBALS['user']->uid);
//if giver roles found in user roles - return true
foreach ($array as $key => $value) {
if (in_array($value, $user->roles)) {
";
$result = db_query($sql);
- foreach ( $result as $record ) {
+ foreach ($result as $record) {
$uids[] = $record->uid;
}
*/
public function checkGroupRole($array) {
if (function_exists('user_load') && isset($array)) {
- $user = user_load( $GLOBALS['user']->uid);
+ $user = user_load($GLOBALS['user']->uid);
//if giver roles found in user roles - return true
foreach ($array as $key => $value) {
if (in_array($value, $user->roles)) {
";
$result = db_query($sql);
- foreach ( $result as $record ) {
+ foreach ($result as $record) {
$uids[] = $record->uid;
}
// Make string lowercase and convert spaces into underscore
$str = CRM_Utils_String::munge(strtolower($str));
- if ( is_user_logged_in() ) {
+ if (is_user_logged_in()) {
// Check whether the logged in user has the capabilitity
if (current_user_can($str)) {
return TRUE;
return $var;
}
- $object = new $name ( );
+ $object = new $name ();
$object->selectAdd();
$object->selectAdd("$key, $retrieve");
* @return CRM_Core_Region
*/
public static function &instance($name, $autocreate = TRUE) {
- if ( $autocreate && ! isset( self::$_instances[$name] ) ) {
+ if ($autocreate && ! isset(self::$_instances[$name])) {
self::$_instances[$name] = new CRM_Core_Region($name);
}
return self::$_instances[$name];
public function __construct($name) {
// Templates injected into regions should normally be file names, but sometimes inline notation is handy.
require_once 'CRM/Core/Smarty/resources/String.php';
- civicrm_smarty_register_string_resource( );
+ civicrm_smarty_register_string_resource();
$this->_name = $name;
$this->_snippets = array();
default:
require_once 'CRM/Core/Error.php';
- CRM_Core_Error::fatal( ts( 'Snippet type %1 is unrecognized',
- array( 1 => $snippet['type'] ) ) );
+ CRM_Core_Error::fatal(ts('Snippet type %1 is unrecognized',
+ array(1 => $snippet['type'])));
}
}
return $html;
if ($saveFile) {
$print = FALSE;
}
- return self::makeCSVTable( $header, $rows, $titleHeader, $print, $outputHeader );
+ return self::makeCSVTable($header, $rows, $titleHeader, $print, $outputHeader);
}
}
);
$contactTypes = self::contactType();
$contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array();
- $profileGroupType = array_merge($contactTypes, $profileGroupType );
+ $profileGroupType = array_merge($contactTypes, $profileGroupType);
return $profileGroupType;
}
*/
public static function &singleton() {
if (!isset(self::$_singleton)) {
- self::$_singleton = new CRM_Core_Smarty( );
- self::$_singleton->initialize( );
+ self::$_singleton = new CRM_Core_Smarty();
+ self::$_singleton->initialize();
self::registerStringResource();
}
* @return bool|mixed|string
*/
public function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
- if (preg_match( '/^(\s+)?string:/', $resource_name)) {
+ if (preg_match('/^(\s+)?string:/', $resource_name)) {
$old_security = $this->security;
$this->security = TRUE;
}
* @param $path
*/
public function addTemplateDir($path) {
- if ( is_array( $this->template_dir ) ) {
- array_unshift( $this->template_dir, $path );
+ if (is_array($this->template_dir)) {
+ array_unshift($this->template_dir, $path);
}
else {
- $this->template_dir = array( $path, $this->template_dir );
+ $this->template_dir = array($path, $this->template_dir);
}
}
* we change the form name to allow multiple edits to happen
* We need a cleaner way of doing this going forward
*/
- foreach ($this->_states as $n => $s ) {
+ foreach ($this->_states as $n => $s) {
if (substr($name, 0, strlen($n)) == $n) {
return $s;
}
$form->_entityId = CRM_Utils_Request::retrieve('entityID', 'Positive', $form);
}
- $typeCheck = CRM_Utils_Request::retrieve( 'type', 'String', CRM_Core_DAO::$_nullObject );
+ $typeCheck = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
$urlGroupId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject);
- if ( isset($typeCheck) && $urlGroupId) {
+ if (isset($typeCheck) && $urlGroupId) {
$form->_groupID = $urlGroupId;
}
else {
$fields = $allFields['values'];
foreach ($fields as $id => $values) {
$datatype = CRM_Utils_Array::value('data_type', $values);
- if ( $datatype == 'File' ) {
+ if ($datatype == 'File') {
continue;
}
/* generate the key for the fields array */
$subTypes = array();
$subTypes['Activity'] = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
- $subTypes['Contribution'] = CRM_Contribute_PseudoConstant::financialType( );
+ $subTypes['Contribution'] = CRM_Contribute_PseudoConstant::financialType();
$subTypes['Membership'] = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE);
$subTypes['Event'] = CRM_Core_OptionGroup::values('event_type');
$subTypes['Grant'] = CRM_Core_OptionGroup::values('grant_type');
public static function internalFilters($rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id') {
// Add a contact id filter for dedupe by group requests and add logic
// to remove duplicate results with opposing orders, i.e. 1,2 and 2,1
- if (!empty($rg->contactIds) ) {
+ if (!empty($rg->contactIds)) {
$cids = implode(',', $rg->contactIds);
return "($strID1 IN ($cids) AND ( $strID2 NOT IN ($cids) OR ($strID2 IN ($cids) AND $strID1 < $strID2) ))";
}
FROM civicrm_email as email1
JOIN civicrm_email as email2 USING (email)
WHERE email1.contact_id < email2.contact_id
- AND " . self::internalFilters($rg, "email1.contact_id", "email2.contact_id" );
+ AND " . self::internalFilters($rg, "email1.contact_id", "email2.contact_id");
CRM_Core_DAO::executeQuery($sql);
$query = "
*/
public static function dupesInGroup($rgid, $gid) {
$cids = array_keys(CRM_Contact_BAO_Group::getMember($gid));
- if ( !empty($cids) ) {
+ if (!empty($cids)) {
return self::dupes($rgid, $cids);
}
return array();
public static function locTables() {
static $locTables;
if (!$locTables) {
- $locTables = array( 'civicrm_email', 'civicrm_address', 'civicrm_phone' );
+ $locTables = array('civicrm_email', 'civicrm_address', 'civicrm_phone');
// Allow hook_civicrm_merge() to adjust $locTables
CRM_Utils_Hook::merge('locTables', $locTables);
// move the other contact's file to main contact
//NYSS need to INSERT or UPDATE depending on whether main contact has an existing record
- if ( CRM_Core_DAO::singleValueQuery("SELECT id FROM {$tableName} WHERE entity_id = {$mainId}") ) {
+ if (CRM_Core_DAO::singleValueQuery("SELECT id FROM {$tableName} WHERE entity_id = {$mainId}")) {
$sql = "UPDATE {$tableName} SET {$columnName} = {$fileIds[$otherId]} WHERE entity_id = {$mainId}";
}
else {
}
CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
- if ( CRM_Core_DAO::singleValueQuery("
+ if (CRM_Core_DAO::singleValueQuery("
SELECT id
FROM civicrm_entity_file
- WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}") ) {
+ WHERE entity_table = '{$tableName}' AND file_id = {$fileIds[$otherId]}")) {
$sql = "
UPDATE civicrm_entity_file
SET entity_id = {$mainId}
// CRM-15681 merge sub_types
if ($other_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['other_details'])) {
if ($main_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['main_details'])) {
- $submitted['contact_sub_type'] = array_unique( array_merge($main_sub_types, $other_sub_types));
+ $submitted['contact_sub_type'] = array_unique(array_merge($main_sub_types, $other_sub_types));
}
else {
$submitted['contact_sub_type'] = $other_sub_types;
}
//CRM-14312 include prefix/suffix from mainId if not overridden for proper construction of display/sort name
- if ( !isset($submitted['prefix_id']) && !empty($migrationInfo['main_details']['prefix_id']) ) {
+ if (!isset($submitted['prefix_id']) && !empty($migrationInfo['main_details']['prefix_id'])) {
$submitted['prefix_id'] = $migrationInfo['main_details']['prefix_id'];
}
- if ( !isset($submitted['suffix_id']) && !empty($migrationInfo['main_details']['suffix_id']) ) {
+ if (!isset($submitted['suffix_id']) && !empty($migrationInfo['main_details']['suffix_id'])) {
$submitted['suffix_id'] = $migrationInfo['main_details']['suffix_id'];
}
$names = array();
foreach ($val as $id => $dontCare) {
- if (!empty($roleTypes[$id]) ) {
+ if (!empty($roleTypes[$id])) {
$names[] = $roleTypes[$id];
}
}
// CRM-13235 - leverage the Smarty path to get all templates directories
$template = CRM_Core_Smarty::singleton();
if (isset($template->template_dir) && $template->template_dir) {
- $dirs = is_array( $template->template_dir ) ? $template->template_dir : array($template->template_dir);
+ $dirs = is_array($template->template_dir) ? $template->template_dir : array($template->template_dir);
foreach ($dirs as $dir) {
- foreach (array( "$dir/$path/$eventID/$img", "$dir/$path/$img") as $imgFile) {
+ foreach (array("$dir/$path/$eventID/$img", "$dir/$path/$img") as $imgFile) {
if (file_exists($imgFile)) {
return $imgFile;
}
if ($event_in_cart->event->financial_type_id && $mer_participant->cost) {
$params['financial_type_id'] = $event_in_cart->event->financial_type_id;
$params['participant_contact_id'] = $mer_participant->contact_id;
- $contribution = $this->record_contribution($mer_participant, $params, $event_in_cart->event );
+ $contribution = $this->record_contribution($mer_participant, $params, $event_in_cart->event);
// Record civicrm_line_item
CRM_Price_BAO_LineItem::processPriceSet($mer_participant->id, $mer_participant->price_details, $contribution, $entity_table = 'civicrm_participant');
}
if ($form->_eventId) {
//get receipt text and financial type
- $returnProperities = array( 'confirm_email_text', 'financial_type_id', 'campaign_id', 'start_date' );
+ $returnProperities = array('confirm_email_text', 'financial_type_id', 'campaign_id', 'start_date');
$details = array();
CRM_Core_DAO::commonRetrieveAll('CRM_Event_DAO_Event', 'id', $form->_eventId, $details, $returnProperities);
if (!empty($details[$form->_eventId]['financial_type_id'])) {
if ($contriId = $form->get('onlinePendingContributionId')) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->id = $contriId;
- $contribution->find( TRUE );
- foreach (array('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount' ) as $f ) {
+ $contribution->find(TRUE);
+ foreach (array('financial_type_id', 'payment_instrument_id', 'contribution_status_id', 'receive_date', 'total_amount') as $f) {
if ($f == 'receive_date') {
list($defaults[$form->_pId]['receive_date']) = CRM_Utils_Date::setDateDefaults($contribution->$f);
}
);
$form->add('select', 'financial_type_id',
- ts( 'Financial Type' ),
+ ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType()
);
);
$form->addWysiwyg('footer_text', ts('Footer Text'), $footerAttribs);
- extract( self::getProfileSelectorTypes() );
+ extract(self::getProfileSelectorTypes());
//CRM-15427
- $form->addProfileSelector( 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
- $form->addProfileSelector( 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector('custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector('custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
- $form->addProfileSelector( 'additional_custom_pre_id', ts('Profile for Additional Participants') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
- $form->addProfileSelector( 'additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector('additional_custom_pre_id', ts('Profile for Additional Participants') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector('additional_custom_post_id', ts('Profile for Additional Participants') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
}
/**
* Optional, for addProfileSelector(), defaults to using getProfileSelectorTypes().
**/
public function buildMultipleProfileBottom(&$form, $count, $prefix = '', $label = 'Include Profile', $configs = NULL) {
- extract( ( is_null($configs) ) ? self::getProfileSelectorTypes() : $configs );
+ extract((is_null($configs)) ? self::getProfileSelectorTypes() : $configs);
$element = $prefix . "custom_post_id_multiple[$count]";
$label .= '<br />'.ts('(bottom of page)');
- $form->addProfileSelector( $element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
+ $form->addProfileSelector($element, $label, $allowCoreTypes, $allowSubTypes, $profileEntities, TRUE);
}
/**
$configs['allowCoreTypes'] = array_merge(array('Contact', 'Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$configs['allowCoreTypes'][] = 'Participant';
//CRM-15427
- $id = CRM_Utils_Request::retrieve( 'id', 'Integer' );
+ $id = CRM_Utils_Request::retrieve('id', 'Integer');
if ($id) {
$participantEventType = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Event", $id, 'event_type_id', 'id');
$participantRole = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'default_role_id');
$contributionParams['non_deductible_amount'] = 'null';
$contributionParams['receipt_date'] = !empty($params['send_receipt']) ? CRM_Utils_Array::value('receive_date', $params) : 'null';
- $recordContribution = array( 'contact_id', 'financial_type_id',
+ $recordContribution = array('contact_id', 'financial_type_id',
'payment_instrument_id', 'trxn_id',
'contribution_status_id', 'receive_date',
'check_number', 'campaign_id',
if (isset($contributionParams['partial_payment_total'])) {
// balance amount
$balanceAmount = $contributionParams['partial_payment_total'] - $contributionParams['partial_amount_pay'];
- $this->assign('balanceAmount', $balanceAmount );
+ $this->assign('balanceAmount', $balanceAmount);
}
$this->assign('isPrimary', 1);
$this->assign('checkNumber', CRM_Utils_Array::value('check_number', $params));
}
//send email with pdf invoice
- $template = CRM_Core_Smarty::singleton( );
+ $template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment',
$this->_id, 'contribution_id', 'participant_id'
if (property_exists($form, '_context') && ($form->_context == 'standalone'
|| $form->_context == 'participant')) {
$discountedEvent = CRM_Core_BAO_Discount::getOptionGroup($eventID, 'civicrm_event');
- if (is_array( $discountedEvent)) {
+ if (is_array($discountedEvent)) {
foreach ($discountedEvent as $key => $priceSetId) {
$priceSet = CRM_Price_BAO_PriceSet::getSetDetail($priceSetId);
$priceSet = CRM_Utils_Array::value($priceSetId, $priceSet);
// handle register date CRM-4320
if ($this->_allowConfirmation) {
- $registerDate = CRM_Utils_Array::value( 'participant_register_date', $params );
+ $registerDate = CRM_Utils_Array::value('participant_register_date', $params);
}
elseif (!empty($params['participant_register_date']) &&
is_array($params['participant_register_date']) &&
}
$form->_fields = $profileFields;
}
- if (!empty($formattedValues) ) {
+ if (!empty($formattedValues)) {
$form->assign('primaryParticipantProfile', $formattedValues[1]);
$form->set('primaryParticipantProfile', $formattedValues[1]);
if ($count > 2) {
//convert form values to clause.
$seatClause = array();
// Filter on is_test if specified in search form
- if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0' ) {
+ if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0') {
$seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
}
if (!empty($this->_formValues['participant_status_id'])) {
unset(self::$_tasks[1]);
}
//CRM-12920 - check for edit permission
- if (!CRM_Core_Permission::check('edit event participants') ) {
+ if (!CRM_Core_Permission::check('edit event participants')) {
unset(self::$_tasks[4], self::$_tasks[5], self::$_tasks[15]);
}
}
}
$className = "CRM_{$componentName[1]}_Form_Task";
- $className::preProcessCommon( $this, TRUE );
+ $className::preProcessCommon($this, TRUE);
$values = $this->controller->exportValues('Search');
}
else {
break;
default:
- CRM_Core_Session::setStatus(ts( "Unrecognized payment hook (%1) in %2::%3",
- array(1 => $method, 2 => __CLASS__ , 3 => __METHOD__) ),
+ CRM_Core_Session::setStatus(ts("Unrecognized payment hook (%1) in %2::%3",
+ array(1 => $method, 2 => __CLASS__ , 3 => __METHOD__)),
'', 'error');
}
}
* Class constructor
*/
public function __construct() {
- if ( !isset( self::$_template ) ) {
+ if (!isset(self::$_template)) {
self::$_template = CRM_Core_Smarty::singleton();
}
}
// Save the file in the public directory
$fileName = self::putFile($export);
- foreach ( self::$complementaryTables as $rct ) {
+ foreach (self::$complementaryTables as $rct) {
$func = "export{$rct}";
$this->$func();
}
WHERE eb.batch_id = ( %1 )";
$params = array(1 => array($batchId, 'String'));
- $dao = CRM_Core_DAO::executeQuery( $sql, $params );
+ $dao = CRM_Core_DAO::executeQuery($sql, $params);
return $dao;
}
* @param array $exportParams
*/
public function export($exportParams) {
- parent::export( $exportParams );
+ parent::export($exportParams);
- foreach (self::$complementaryTables as $rct ) {
+ foreach (self::$complementaryTables as $rct) {
$func = "export{$rct}";
$this->$func();
}
WHERE eb.batch_id = ( %1 )";
$params = array(1 => array($batchId, 'String'));
- $dao = CRM_Core_DAO::executeQuery( $sql, $params );
+ $dao = CRM_Core_DAO::executeQuery($sql, $params);
return $dao;
}
WHERE eft.entity_table = 'civicrm_financial_item'
AND eft.financial_trxn_id = %1";
- $itemParams = array( 1 => array( $dao->financial_trxn_id, 'Integer' ) );
+ $itemParams = array(1 => array($dao->financial_trxn_id, 'Integer'));
- $itemDAO = CRM_Core_DAO::executeQuery( $item_sql, $itemParams );
+ $itemDAO = CRM_Core_DAO::executeQuery($item_sql, $itemParams);
while ($itemDAO->fetch()) {
// add to running list of accounts
if (!empty($itemDAO->account_id) && !isset($accounts[$itemDAO->account_id])) {
}
public function exportACCNT() {
- self::assign( 'accounts', $this->_exportParams['accounts'] );
+ self::assign('accounts', $this->_exportParams['accounts']);
}
public function exportCUST() {
- self::assign( 'contacts', $this->_exportParams['contacts'] );
+ self::assign('contacts', $this->_exportParams['contacts']);
}
public function exportTRANS() {
- self::assign( 'journalEntries', $this->_exportParams['journalEntries'] );
+ self::assign('journalEntries', $this->_exportParams['journalEntries']);
}
/**
// Date handling has changed over the years. It used to only understand mm/dd/yy but I think now it might depend on your OS settings. Sometimes mm/dd/yyyy works but sometimes it wants yyyy/mm/dd, at least where I had used it.
// In all cases need to do something with tabs in the input.
- $s1 = str_replace( self::$SEPARATOR, '\t', $s );
- switch ($type ) {
+ $s1 = str_replace(self::$SEPARATOR, '\t', $s);
+ switch ($type) {
case 'date':
- $sout = date( 'Y/m/d', strtotime( $s1 ) );
+ $sout = date('Y/m/d', strtotime($s1));
break;
case 'money':
case 'string':
case 'notepad':
- $s2 = str_replace( "\n", '\n', $s1 );
- $s3 = str_replace( "\r", '', $s2 );
- $s4 = str_replace( '"', "'", $s3 );
+ $s2 = str_replace("\n", '\n', $s1);
+ $s3 = str_replace("\r", '', $s2);
+ $s4 = str_replace('"', "'", $s3);
if ($type == 'notepad') {
$sout = '"' . $s4 . '"';
}
* Class constructor
*/
public function __construct() {
- parent::__construct( );
+ parent::__construct();
}
/**
'currency' => $contribution->currency,
'entity_table' => 'civicrm_line_item',
'entity_id' => $lineItem->id,
- 'description' => ( $lineItem->qty != 1 ? $lineItem->qty . ' of ' : ''). ' ' . $lineItem->label,
+ 'description' => ($lineItem->qty != 1 ? $lineItem->qty . ' of ' : ''). ' ' . $lineItem->label,
'status_id' => $itemStatus,
);
);
$result = array();
- CRM_Financial_BAO_FinancialTypeAccount::retrieve( $searchParams, $result );
- $params['financial_account_id'] = CRM_Utils_Array::value( 'financial_account_id', $result );
+ CRM_Financial_BAO_FinancialTypeAccount::retrieve($searchParams, $result);
+ $params['financial_account_id'] = CRM_Utils_Array::value('financial_account_id', $result);
}
$trxn = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution->id, 'ASC', TRUE);
$trxnId['id'] = $trxn['financialTrxnId'];
* Class constructor
*/
public function __construct() {
- parent::__construct( );
+ parent::__construct();
}
/**
* @static
*/
public static function retrieve(&$params, &$defaults) {
- $financialType = new CRM_Financial_DAO_FinancialType( );
- $financialType->copyValues( $params );
+ $financialType = new CRM_Financial_DAO_FinancialType();
+ $financialType->copyValues($params);
if ($financialType->find(TRUE)) {
- CRM_Core_DAO::storeValues( $financialType, $defaults );
+ CRM_Core_DAO::storeValues($financialType, $defaults);
return $financialType;
}
return NULL;
* @static
*/
public static function setIsActive($id, $is_active) {
- return CRM_Core_DAO::setFieldValue( 'CRM_Financial_DAO_FinancialType', $id, 'is_active', $is_active );
+ return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialType', $id, 'is_active', $is_active);
}
/**
* @static
*/
public static function del($financialTypeId) {
- $financialType = new CRM_Financial_DAO_FinancialType( );
+ $financialType = new CRM_Financial_DAO_FinancialType();
$financialType->id = $financialTypeId;
$financialType->find(TRUE);
// tables to ingore checks for financial_type_id
//delete from financial Type table
$financialType->delete();
- $entityFinancialType = new CRM_Financial_DAO_EntityFinancialAccount( );
+ $entityFinancialType = new CRM_Financial_DAO_EntityFinancialAccount();
$entityFinancialType->entity_id = $financialTypeId;
$entityFinancialType->entity_table = 'civicrm_financial_type';
$entityFinancialType->delete();
* Class constructor
*/
public function __construct() {
- parent::__construct( );
+ parent::__construct();
}
/**
$check = FALSE;
$relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
- $financialTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id' );
+ $financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id');
//check dependencies
// FIXME more table containing financial_type_id to come
$dependancy = array(
$accountRelationShipId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'account_relationship');
CRM_Core_Session::setStatus(ts('You cannot remove an account with a %1 relationship because it is being referenced by one or more of the following types of records: Contributions, Contribution Pages, or Membership Types. Consider disabling this type instead if you no longer want it used.', array(1 => $relationValues[$accountRelationShipId])), NULL, 'error');
}
- return CRM_Utils_System::redirect( CRM_Utils_System::url( 'civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}" ));
+ return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}"));
}
//delete from financial Type table
- $financialType = new CRM_Financial_DAO_EntityFinancialAccount( );
+ $financialType = new CRM_Financial_DAO_EntityFinancialAccount();
$financialType->id = $financialTypeAccountId;
$financialType->find(TRUE);
$financialType->delete();
CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
}
- $dao = new CRM_Financial_DAO_PaymentProcessor( );
+ $dao = new CRM_Financial_DAO_PaymentProcessor();
$dao->id = $paymentProcessorID;
$dao->is_active = 1;
if (!$dao->find(TRUE)) {
}
if ($mode == 'test') {
- $testDAO = new CRM_Financial_DAO_PaymentProcessor( );
+ $testDAO = new CRM_Financial_DAO_PaymentProcessor();
$testDAO->name = $dao->name;
$testDAO->is_active = 1;
$testDAO->is_test = 1;
protected $_batchStatusId;
public function preProcess() {
- self::$_entityID = CRM_Utils_Request::retrieve( 'bid', 'Positive' ) ? CRM_Utils_Request::retrieve( 'bid', 'Positive' ) : $_POST['batch_id'];
+ self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive') ? CRM_Utils_Request::retrieve('bid', 'Positive') : $_POST['batch_id'];
$this->assign('entityID', self::$_entityID);
if (isset(self::$_entityID)) {
$this->_batchStatusId = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
}
// do not build rest of form unless it is open batch
- if ($this->_batchStatusId != 1 ) {
+ if ($this->_batchStatusId != 1) {
return;
}
CRM_Contribute_BAO_Query::buildSearchForm($this);
$this->addElement('checkbox', 'toggleSelects', NULL, NULL);
- $this->add( 'select',
+ $this->add('select',
'trans_remove',
ts('Task'),
- array( '' => ts( '- actions -' )) + array( 'Remove' => ts('Remove from Batch')));
+ array('' => ts('- actions -')) + array('Remove' => ts('Remove from Batch')));
$this->add('submit', 'rSubmit', ts('Go'),
array(
);
$this->addElement('checkbox', 'toggleSelect', NULL, NULL);
- $this->add( 'select',
+ $this->add('select',
'trans_assign',
ts('Task'),
- array( '' => ts( '- actions -' )) + array( 'Assign' => ts( 'Assign to Batch' )));
+ array('' => ts('- actions -')) + array('Assign' => ts('Assign to Batch')));
$this->add('submit', 'submit', ts('Go'),
array(
public function setDefaultValues() {
// do not setdefault unless it is open batch
- if ($this->_batchStatusId != 1 ) {
+ if ($this->_batchStatusId != 1) {
return;
}
if (isset(self::$_entityID)) {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
- if (!$this->_id ) {
+ if (!$this->_id) {
if (!empty($_GET['batch_id'])) {
//validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
//check if batch status is valid, do not allow exported batches to export again
$batchStatus = CRM_Batch_BAO_Batch::getBatchStatuses($this->_batchIds);
- foreach ($batchStatus as $batchStatusId ) {
+ foreach ($batchStatus as $batchStatusId) {
if ($batchStatusId == $this->_exportStatusId) {
CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
}
* @return void
*/
public function buildQuickForm() {
- parent::buildQuickForm( );
+ parent::buildQuickForm();
$this->setPageTitle(ts('Financial Account'));
if ($this->_action & CRM_Core_Action::DELETE) {
}
}
}
- return CRM_Utils_Array::crmIsEmptyArray( $errorMsg ) ? TRUE : $errorMsg;
+ return CRM_Utils_Array::crmIsEmptyArray($errorMsg) ? TRUE : $errorMsg;
}
/**
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Financial_BAO_FinancialAccount::del($this->_id);
- CRM_Core_Session::setStatus( ts('Selected Financial Account has been deleted.') );
+ CRM_Core_Session::setStatus(ts('Selected Financial Account has been deleted.'));
}
else {
$ids = array();
$createdID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id');
if (!empty($permissions[$this->_action])) {
- $this->checkPermissions($this->_action, $permissions[$this->_action]['permission'], $createdID, $session->get('userID'), $permissions[$this->_action]['actionName'] );
+ $this->checkPermissions($this->_action, $permissions[$this->_action]['permission'], $createdID, $session->get('userID'), $permissions[$this->_action]['actionName']);
}
}
}
parent::buildQuickForm();
$this->setPageTitle(ts('Financial Batch'));
- if (isset( $this->_id)) {
+ if (isset($this->_id)) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'title');
- CRM_Utils_System::setTitle($this->_title .' - '.ts( 'Accounting Batch'));
+ CRM_Utils_System::setTitle($this->_title .' - '.ts('Accounting Batch'));
$this->assign('batchTitle', $this->_title);
$contactID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id');
$contactName = CRM_Contact_BAO_Contact::displayName($contactID);
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
//unset exported status
- $exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus );
+ $exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus);
unset($batchStatus[$exportedStatusId]);
$this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, TRUE);
$this->freeze(array('status_id'));
$session->replaceUserContext(CRM_Utils_System::url('civicrm', 'reset=1'));
}
elseif (($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::UPDATE) ||
- ($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::ADD & $context == 1 )) {
+ ($buttonName == $this->getButtonName('next') & $this->_action == CRM_Core_Action::ADD & $context == 1)) {
$session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches',
"reset=1&batchStatus=1"));
}
$financialType = CRM_Financial_BAO_FinancialType::add($params, $ids);
if ($this->_action & CRM_Core_Action::UPDATE) {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType', 'reset=1&action=browse');
- CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array( 1 => $financialType->name)), ts('Saved'), 'success');
+ CRM_Core_Session::setStatus(ts('The financial type "%1" has been updated.', array(1 => $financialType->name)), ts('Saved'), 'success');
}
else {
$url = CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', 'reset=1&action=browse&aid=' . $financialType->id);
'status_id',
ts('Batch Status'),
array(
- '' => ts('- any -' ),
+ '' => ts('- any -'),
array_search('Open', $batchStatus) => ts('Open'),
array_search('Closed', $batchStatus) => ts('Closed'),
array_search('Exported', $batchStatus) => ts('Exported'),
'select',
'payment_instrument_id',
ts('Payment Instrument'),
- array('' => ts('- any -' )) + CRM_Contribute_PseudoConstant::paymentInstrument(),
+ array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
FALSE
);
$this->add('select',
'batch_update',
- ts('Task' ),
+ ts('Task'),
array('' => ts('- actions -')) + $batchAction);
$this->add('submit', 'submit', ts('Go'),
);
}
else {
- $response = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array( 1 => $paymentInstrument)));
+ $response = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array(1 => $paymentInstrument)));
}
break;
$status = array('status' => 'record-updated-success');
}
else {
- $status = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array( 1 => $paymentInstrument)));
+ $status = array('status' => ts("This batch is configured to include only transactions using %1 payment method. If you want to include other transactions, please edit the batch first and modify the Payment Method.", array(1 => $paymentInstrument)));
}
CRM_Utils_JSON::output($status);
}
while ($dao->fetch()) {
$contributionType[$dao->id] = array();
- CRM_Core_DAO::storeValues( $dao, $contributionType[$dao->id]);
+ CRM_Core_DAO::storeValues($dao, $contributionType[$dao->id]);
$contributionType[$dao->id]['financial_account_type_id'] = $financialAccountType[$dao->financial_account_type_id];
// form all action links
$action = array_sum(array_keys($this->links()));
while ($dao->fetch()) {
$financialType[$dao->id] = array();
- CRM_Core_DAO::storeValues( $dao, $financialType[$dao->id]);
+ CRM_Core_DAO::storeValues($dao, $financialType[$dao->id]);
$defaults = $financialAccountId = array();
$financialAccounts = CRM_Contribute_PseudoConstant::financialAccount();
$financialAccountIds = array();
foreach ($financialAccountIds as $key => $values) {
if (!empty($financialAccounts[$values['financial_account_id']])) {
$financialAccountId[$values['financial_account_id']] = CRM_Utils_Array::value(
- $values['financial_account_id'], $financialAccounts );
+ $values['financial_account_id'], $financialAccounts);
}
}
if (!empty($financialAccountId)) {
- $financialType[$dao->id]['financial_account'] = implode( ',', $financialAccountId );
+ $financialType[$dao->id]['financial_account'] = implode(',', $financialAccountId);
}
// form all action links
if ($this->_aid) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $this->_aid, 'name');
- CRM_Utils_System::setTitle($this->_title .' - '.ts( 'Assigned Financial Accounts'));
+ CRM_Utils_System::setTitle($this->_title .' - '.ts('Assigned Financial Accounts'));
$financialAccountType = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialAccount', 'financial_account_type_id');
$accountRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$dao->copyValues($params);
);
}
$this->assign('rows', $financialType);
- $this->assign( 'aid', $this->_aid );
+ $this->assign('aid', $this->_aid);
$this->assign('financialTypeTitle', $this->_title);
}
else {
- CRM_Core_Error::fatal( );
+ CRM_Core_Error::fatal();
return NULL;
}
}
*/
public function edit($action) {
// create a simple controller for editing CiviCRM Profile data
- $controller = new CRM_Core_Controller_Simple( 'CRM_Financial_Form_FinancialTypeAccount', ts('Financial Account Types'), $action );
+ $controller = new CRM_Core_Controller_Simple('CRM_Financial_Form_FinancialTypeAccount', ts('Financial Account Types'), $action);
// set the userContext stack
$session = CRM_Core_Session::singleton();
- $session->pushUserContext( CRM_Utils_System::url( 'civicrm/admin/financial/financialType/accounts',
- 'reset=1&action=browse&aid=' . $this->_aid ) );
- $controller->set( 'aid', $this->_aid );
+ $session->pushUserContext(CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts',
+ 'reset=1&action=browse&aid=' . $this->_aid));
+ $controller->set('aid', $this->_aid);
- $controller->setEmbedded( TRUE );
+ $controller->setEmbedded(TRUE);
$controller->process();
$controller->run();
}
$this->assign('linkText', $linkText);
}
}
- elseif ( $this->_entityTable == 'civicrm_event' ) {
+ elseif ($this->_entityTable == 'civicrm_event') {
// If this is tell a friend after registering for an event, give donor link to create their own fundraising page
require_once 'CRM/PCP/BAO/PCP.php';
- if ( $linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus( $defaults['entity_id'], $defaults['entity_table'] ) ) {
- $linkTextUrl = CRM_Utils_System::url( 'civicrm/contribute/campaign',
+ if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
+ $linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign',
"action=add&reset=1&pageId={$defaults['entity_id']}&component=event",
FALSE, NULL, TRUE,
- TRUE );
- $this->assign( 'linkTextUrl', $linkTextUrl );
- $this->assign( 'linkText', $linkText );
+ TRUE);
+ $this->assign('linkTextUrl', $linkTextUrl);
+ $this->assign('linkText', $linkText);
}
}
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
- $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
CRM_Contact_BAO_Query::MODE_GRANT
*/
public function postProcess(&$params, &$db, &$form) {
$importJob = new CRM_Contact_Import_ImportJob(
- CRM_Utils_Array::value( 'import_table_name', $params ),
+ CRM_Utils_Array::value('import_table_name', $params),
$params['sqlQuery'], TRUE
);
$addressCustomTables = $logging->entityCustomDataLogTables('Address');
$contactIdClause = $join = '';
- if ( $contactID ) {
+ if ($contactID) {
$params[3] = array($contactID, 'Integer');
switch ($table) {
case 'civicrm_contact':
if (empty($contactIdClause)) {
$contactIdClause = "AND contact_id = %3";
}
- if ( strpos($table, 'civicrm_value') !== false ) {
+ if (strpos($table, 'civicrm_value') !== false) {
$contactIdClause = "AND entity_id = %3";
}
}
$changedSQL = "SELECT * FROM `{$this->db}`.`log_$table` WHERE log_conn_id = %1 AND log_date >= %2 AND log_date < DATE_ADD(%2, INTERVAL {$this->interval}) AND id = %3 ORDER BY log_date DESC LIMIT 1";
$changedDAO = CRM_Core_DAO::executeQuery($changedSQL, $params);
- while ($changedDAO->fetch( )) {
+ while ($changedDAO->fetch()) {
$changed = $changedDAO->toArray();
// return early if nothing found
$values[$table]['status_id'] = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
break;
case 'civicrm_activity':
- $values[$table]['status_id'] = CRM_Core_PseudoConstant::activityStatus( );
+ $values[$table]['status_id'] = CRM_Core_PseudoConstant::activityStatus();
break;
}
// NOTE: we consider only those columns for modifications where there is a spec change, and that the column definition
// wasn't deliberately modified by fixTimeStampAndNotNullSQL() method.
foreach ($civiTableSpecs as $col => $colSpecs) {
- if (!isset($logTableSpecs[$col]) || !is_array($logTableSpecs[$col]) ) {
+ if (!isset($logTableSpecs[$col]) || !is_array($logTableSpecs[$col])) {
$logTableSpecs[$col] = array();
}
$columns = $this->columnsOf($table, $force);
// only do the change if any data has changed
- $cond = array( );
+ $cond = array();
foreach ($columns as $column) {
// ignore modified_date changes
if ($column != 'modified_date' && !in_array($column, CRM_Utils_Array::value($table, $this->exceptions, array()))) {
}
}
$suppressLoggingCond = "@civicrm_disable_logging IS NULL OR @civicrm_disable_logging = 0";
- $updateSQL = "IF ( (" . implode( ' OR ', $cond ) . ") AND ( $suppressLoggingCond ) ) THEN ";
+ $updateSQL = "IF ( (" . implode(' OR ', $cond) . ") AND ( $suppressLoggingCond ) ) THEN ";
if ($this->useDBPrefix) {
$sqlStmt = "INSERT INTO `{$this->db}`.log_{tableName} (";
*
* @static
*/
- public static function disableLoggingForThisConnection( ) {
+ public static function disableLoggingForThisConnection() {
// do this only if logging is enabled
- $config = CRM_Core_Config::singleton( );
- if ( $config->logging ) {
- CRM_Core_DAO::executeQuery( 'SET @civicrm_disable_logging = 1' );
+ $config = CRM_Core_Config::singleton();
+ if ($config->logging) {
+ CRM_Core_DAO::executeQuery('SET @civicrm_disable_logging = 1');
}
}
$job->status = 'Scheduled';
$job->is_test = 0;
- if ( !$job->find(TRUE) ) {
+ if (!$job->find(TRUE)) {
$job->scheduled_date = $params['scheduled_date'];
$job->save();
}
AND mg.group_type = 'Include'
AND m.id = %1
";
- $params = array( 1 => array( $mid, 'Integer' ) );
+ $params = array(1 => array($mid, 'Integer'));
return CRM_Core_DAO::singleValueQuery($sql, $params);
}
return;
case 'mailing_name':
- $value = strtolower( addslashes( $value ) );
- if ( $wildcard ) {
+ $value = strtolower(addslashes($value));
+ if ($wildcard) {
$value = "%$value%";
$op = 'LIKE';
}
}
$headerStr = implode("\n", $headerStr);
- if ( is_null( $job_id ) ) {
+ if (is_null($job_id)) {
// This is not a bulk mailing. Create a dummy job for it.
$session = CRM_Core_Session::singleton();
$params['scheduled_date'] = $params['created_date'];
$params['is_completed'] = 1;
$params['is_archived'] = 1;
- $params['body_html'] = htmlspecialchars( $headerStr ) . "\n\n" . $body;
+ $params['body_html'] = htmlspecialchars($headerStr) . "\n\n" . $body;
$params['subject'] = $headers['Subject'];
$params['name'] = $headers['Subject'];
$ids = array();
$mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
- if ( empty( $mailing ) || is_a( $mailing, 'CRM_Core_Error' ) ) {
- return PEAR::raiseError( 'Unable to create spooled mailing.' );
+ if (empty($mailing) || is_a($mailing, 'CRM_Core_Error')) {
+ return PEAR::raiseError('Unable to create spooled mailing.');
}
$job = new CRM_Mailing_BAO_MailingJob();
$job->save();
$job_id = $job->id; // this is the one we want for the spool
- if ( is_array( $recipient ) ) {
- $recipient = implode( ';', $recipient );
+ if (is_array($recipient)) {
+ $recipient = implode(';', $recipient);
}
}
$dao->query($query);
- while ( $dao->fetch() ) {
+ while ($dao->fetch()) {
$openedCount[$dao->mailingID] = $dao->opened;
}
return $openedCount;
$dao->query($query);
- while ( $dao->fetch() ) {
+ while ($dao->fetch()) {
$openedCount[$dao->mailingID] = $dao->opened;
}
$dao->query($query);
- while ( $dao->fetch() ) {
+ while ($dao->fetch()) {
$clickCount[$dao->mailingID] = $dao->opened;
}
return $clickCount;
$dao->query($query);
- while ( $dao->fetch() ) {
+ while ($dao->fetch()) {
$clickCount[$dao->mailingID] = $dao->opened;
}
array(1 => $values['email_confirm'])
);
- CRM_Core_Session::setStatus( $statusMsg, '', 'success' );
+ CRM_Core_Session::setStatus($statusMsg, '', 'success');
}
elseif ($result == FALSE) {
// Email address not verified
array(1 => $values['email_confirm'])
);
- CRM_Core_Session::setStatus( $statusMsg, '', 'fail' );
+ CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
}
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
- $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
$statusMsg = ts('Email: %1 has been successfully unsubscribed from this Mailing List/Group.',
array(1 => $email)
);
- CRM_Core_Session::setStatus( $statusMsg, '', 'fail' );
+ CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
$this->assign('groupExist', $groupExist);
array(1 => $values['email_confirm'])
);
- CRM_Core_Session::setStatus( $statusMsg, '', 'success' );
+ CRM_Core_Session::setStatus($statusMsg, '', 'success');
}
elseif ($result == FALSE) {
// Email address not verified
array(1 => $values['email_confirm'])
);
- CRM_Core_Session::setStatus( $statusMsg, '', 'fail' );
+ CRM_Core_Session::setStatus($statusMsg, '', 'fail');
}
));
}
$mailGrp = civicrm_api3('MailingGroup', 'get', array());
- $mailTokens = civicrm_api3('Mailing', 'get_token', array( 'usage' => 'Mailing'));
+ $mailTokens = civicrm_api3('Mailing', 'get_token', array('usage' => 'Mailing'));
$fromAddress = civicrm_api3('OptionGroup', 'get', array(
'sequential' => 1,
'name' => "from_email_address",
switch ($membershipTypeDetails['duration_unit']) {
case 'year':
//need to check if the upsell is from rolling to fixed and adjust accordingly
- if ($membershipTypeDetails['period_type'] == 'fixed' && $oldPeriodType == 'rolling' ) {
+ if ($membershipTypeDetails['period_type'] == 'fixed' && $oldPeriodType == 'rolling') {
$month = substr($membershipTypeDetails['fixed_period_start_day'], 0, strlen($membershipTypeDetails['fixed_period_start_day']) - 2);
$day = substr($membershipTypeDetails['fixed_period_start_day'], -2);
$year += 1;
$query = 'SELECT memType.id, memType.name, memType.member_of_contact_id, c.sort_name
FROM civicrm_membership_type memType INNER JOIN civicrm_contact c ON c.id = memType.member_of_contact_id
WHERE memType.is_active = 1 ';
- $dao = CRM_Core_DAO::executeQuery( $query );
+ $dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$orgs[$dao->member_of_contact_id] = $dao->sort_name;
$types[$dao->member_of_contact_id][$dao->id] = $dao->name;
if (!is_array($value)) {
$status = $value;
if (!empty($value)) {
- $value = array_flip(explode(",", str_replace(array( '(', ')' ), '', $value)));
+ $value = array_flip(explode(",", str_replace(array('(', ')'), '', $value)));
}
else {
$value = array();
if (!is_array($value)) {
$mType = $value;
if (!empty($value)) {
- $value = array_flip(explode(",", str_replace(array( '(', ')' ), '', $value)));
+ $value = array_flip(explode(",", str_replace(array('(', ')'), '', $value)));
}
else {
$value = array();
// here we store details in order to do that
if (!empty($formValues['soft_credit_contact_id'])) {
$this->_receiptContactId = $this->_contributorContactID = $formValues['soft_credit_contact_id'];
- list( $this->_contributorDisplayName,
- $this->_contributorEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $this->_contributorContactID );
+ list($this->_contributorDisplayName,
+ $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contributorContactID);
}
else {
$this->_receiptContactId = $this->_contributorContactID = $this->_contactID;
foreach ($tmp_statuses as $cur_stat) {
$status_ids[] = $cur_stat['id'];
}
- if (empty($params['status_id']) || in_array( $params['status_id'], $status_ids) == FALSE) {
+ if (empty($params['status_id']) || in_array($params['status_id'], $status_ids) == FALSE) {
$errors['status_id'] = ts('Please enter a status that does NOT represent a current membership status.');
$errors['is_override'] = ts('This must be checked because you set an End Date for a lifetime membership');
}
$form->_receiptContactId = $formValues['contact_id'];
}
}
- $template = CRM_Core_Smarty::singleton( );
+ $template = CRM_Core_Smarty::singleton();
$taxAmt = $template->get_template_vars('dataArray');
$eventTaxAmt = $template->get_template_vars('totalTaxAmount');
$prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
}
$setParams['is_quick_config'] = 1;
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
- $setParams['financial_type_id'] = CRM_Utils_Array::value( 'financial_type_id', $this->_values );
+ $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
$fieldParams['price_set_id'] = $priceSet->id;
}
elseif ($usedPriceSetId) {
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
- $setParams['financial_type_id'] = CRM_Utils_Array::value( 'financial_type_id', $this->_values );
+ $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
$setParams['id'] = $usedPriceSetId;
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
if ($priceSetID) {
$params['membership_types'] = 'null';
$params['membership_type_default'] = CRM_Utils_Array::value('membership_type_default', $params, 'null');
- $params['membership_types'] = serialize( $membershipTypes );
+ $params['membership_types'] = serialize($membershipTypes);
$params['display_min_fee'] = CRM_Utils_Array::value('display_min_fee', $params, FALSE);
$params['is_separate_payment'] = CRM_Utils_Array::value('is_separate_payment', $params, FALSE);
}
// auto renew options if enabled for the membership
$options = CRM_Core_SelectValues::memberAutoRenew();
- foreach ($allMemberships as $key => $values ) {
+ foreach ($allMemberships as $key => $values) {
if (!empty($values['is_active'])) {
$membershipType[$key] = CRM_Utils_Array::value('name', $values);
if ($this->_mode && empty($values['minimum_fee'])) {
);
}
- $now = CRM_Utils_Date::getToday( NULL, 'YmdHis');
+ $now = CRM_Utils_Date::getToday(NULL, 'YmdHis');
$this->convertDateFieldsToMySQL($formValues);
$this->assign('receive_date', $formValues['receive_date']);
const MAX_CONTACTS = 50;
public function preProcess() {
- $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0 );
+ $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
$this->_BAOName = 'CRM_Member_BAO_MembershipType';
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->assign('action', $this->_action);
CRM_Core_SelectValues::date(NULL, 'd'), FALSE
);
- $this->add('select', 'financial_type_id', ts( 'Financial Type' ),
+ $this->add('select', 'financial_type_id', ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), TRUE, array('class' => 'crm-select2')
);
$errors['name'] = ts('Please enter a membership type name.');
}
- if (($params['minimum_fee'] > 0 ) && !$params['financial_type_id'] ) {
+ if (($params['minimum_fee'] > 0) && !$params['financial_type_id']) {
$errors['financial_type_id'] = ts('Please enter the financial Type.');
}
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
- $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
CRM_Contact_BAO_Query::MODE_MEMBER
break;
}
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($key)) {
- if ( $customFields[$customFieldID]['data_type'] == 'Date' ) {
+ if ($customFields[$customFieldID]['data_type'] == 'Date') {
CRM_Contact_Import_Parser_Contact::formatCustomDate($params, $formatted, $dateType, $key);
unset($params[$key]);
}
- elseif ( $customFields[$customFieldID]['data_type'] == 'Boolean' ) {
+ elseif ($customFields[$customFieldID]['data_type'] == 'Boolean') {
$params[$key] = CRM_Utils_String::strtoboolstr($val);
}
}
$fields = CRM_Member_DAO_Membership::fields();
_civicrm_api3_store_values($fields, $params, $values);
- $customFields = CRM_Core_BAO_CustomField::getFields( 'Membership');
+ $customFields = CRM_Core_BAO_CustomField::getFields('Membership');
foreach ($params as $key => $value) {
// ignore empty values or empty arrays etc
$values[$key] = $value;
$type = $customFields[$customFieldID]['html_type'];
if ($type == 'CheckBox' || $type == 'Multi-Select' || $type == 'AdvMulti-Select') {
- $mulValues = explode( ',', $value );
+ $mulValues = explode(',', $value);
$customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
$values[$key] = array();
- foreach ($mulValues as $v1 ) {
+ foreach ($mulValues as $v1) {
foreach ($customOption as $customValueID => $customLabel) {
$customValue = $customLabel['value'];
- if (( strtolower($customLabel['label']) == strtolower(trim($v1)) ) ||
- ( strtolower($customValue) == strtolower(trim($v1)) )) {
- if ( $type == 'CheckBox' ) {
+ if ((strtolower($customLabel['label']) == strtolower(trim($v1))) ||
+ (strtolower($customValue) == strtolower(trim($v1)))) {
+ if ($type == 'CheckBox') {
$values[$key][$customValue] = 1;
}
else {
WHERE id = %1";
$dao = CRM_Core_DAO::executeQuery($query, array(1 => array($memType, 'Positive')));
- $properties = array( 'financial_type_id', 'total_amount', 'name', 'auto_renew' );
+ $properties = array('financial_type_id', 'total_amount', 'name', 'auto_renew');
while ($dao->fetch()) {
foreach ($properties as $property) {
$details[$property] = $dao->$property;
* @param int $contactId
*/
public static function setContext(&$form, $contactId = NULL) {
- $context = CRM_Utils_Request::retrieve('context', 'String', $form, FALSE, 'search' );
+ $context = CRM_Utils_Request::retrieve('context', 'String', $form, FALSE, 'search');
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $form);
if ($defaultRenewPageId) {
//CRM-14831 - check if membership type is present in contrib page
$memBlock = CRM_Member_BAO_Membership::getMembershipBlock($defaultRenewPageId);
- if ( !empty($memBlock['membership_types']) ) {
+ if (!empty($memBlock['membership_types'])) {
$memTypes = explode(',', $memBlock['membership_types']);
- if ( in_array($dao->membership_type_id, $memTypes) ) {
+ if (in_array($dao->membership_type_id, $memTypes)) {
$membership[$dao->id]['renewPageId'] = $defaultRenewPageId;
}
}
unset(self::$_tasks[1]);
}
//CRM-12920 - check for edit permission
- if (!CRM_Core_Permission::check('edit memberships') ) {
+ if (!CRM_Core_Permission::check('edit memberships')) {
unset(self::$_tasks[5]);
}
}
}
// define redirect url back to contrib page or event if needed
- $url = CRM_Utils_System::url($urlBase, "reset=1&id={$pcpBlock['entity_id']}", FALSE, NULL, FALSE, TRUE );
+ $url = CRM_Utils_System::url($urlBase, "reset=1&id={$pcpBlock['entity_id']}", FALSE, NULL, FALSE, TRUE);
if ($pcpBlock['target_entity_id'] != $entity['id']) {
$statusMessage = ts('This page is not related to the Personal Campaign Page you have just visited. However you can still make a contribution here.');
}
$attrib = array('rows' => 8, 'cols' => 60);
- $this->add('textarea', 'page_text', ts('Your Message'), NULL, FALSE );
+ $this->add('textarea', 'page_text', ts('Your Message'), NULL, FALSE);
$maxAttachments = 1;
CRM_Core_BAO_File::buildAttachment($this, 'civicrm_pcp', $this->_pageId, $maxAttachments);
* @return void
*/
public function postProcess() {
- $params = $this->controller->exportValues( $this->_name );
+ $params = $this->controller->exportValues($this->_name);
$checkBoxes = array('is_thermometer', 'is_honor_roll', 'is_active');
foreach ($checkBoxes as $key) {
// since we are allowing html input from the user
// we also need to purify it, so lets clean it up
- $htmlFields = array( 'intro_text', 'page_text', 'title' );
- foreach ( $htmlFields as $field ) {
- if ( ! empty($params[$field]) ) {
+ $htmlFields = array('intro_text', 'page_text', 'title');
+ foreach ($htmlFields as $field) {
+ if (! empty($params[$field])) {
$params[$field] = CRM_Utils_String::purifyHTML($params[$field]);
}
}
}
}
else {
- if (!empty($value) ) {
+ if (!empty($value)) {
$names[] = $statusValues[$value];
}
}
}
}
else {
- if (!empty($value) ) {
+ if (!empty($value)) {
$names[] = $statusValues[$value];
}
}
$value,
'Integer'
);
- $query->_qill[$grouping][] = ts( 'Financial Type - %1', array( 1 => $type ) );
+ $query->_qill[$grouping][] = ts('Financial Type - %1', array(1 => $type));
$query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
return;
$form->addGroup($paymentStatus, 'pledge_payment_status_id', ts('Pledge Payment Status'));
$form->add('select', 'pledge_financial_type_id',
- ts( 'Financial Type' ),
+ ts('Financial Type'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
FALSE, array('class' => 'crm-select2')
);
$defaults['max_reminders'] = 1;
$defaults['additional_reminder_day'] = 5;
$defaults['frequency_unit'] = array_search('month', $this->_freqUnits);
- $defaults['financial_type_id'] = array_search( 'Donation', CRM_Contribute_PseudoConstant::financialType() );
+ $defaults['financial_type_id'] = array_search('Donation', CRM_Contribute_PseudoConstant::financialType());
}
$pledgeStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$this->addDate('acknowledge_date', ts('Acknowledgment Date'));
$this->add('select', 'financial_type_id',
- ts( 'Financial Type' ),
- array('' => ts( '- select -' )) + CRM_Contribute_PseudoConstant::financialType( ),
+ ts('Financial Type'),
+ array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(),
TRUE
);
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
- $values['financial_type'] = CRM_Utils_Array::value( $values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType() );
+ $values['financial_type'] = CRM_Utils_Array::value($values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
$this->assign('displayName', $displayName);
$title = $displayName .
- ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format( $values['pledge_amount'] ) .
+ ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) .
' - ' . $values['financial_type'] . ')';
// add Pledge to Recent Items
else {
$queryParams = $form->get('queryParams');
$sortOrder = NULL;
- if ( $form->get( CRM_Utils_Sort::SORT_ORDER ) ) {
- $sortOrder = $form->get( CRM_Utils_Sort::SORT_ORDER );
+ if ($form->get(CRM_Utils_Sort::SORT_ORDER )) {
+ $sortOrder = $form->get(CRM_Utils_Sort::SORT_ORDER);
}
$query = new CRM_Contact_BAO_Query($queryParams, NULL, NULL, FALSE, FALSE,
CRM_Contact_BAO_Query::MODE_PLEDGE
$options['membership_num_terms'] = CRM_Utils_Array::value($index, CRM_Utils_Array::value('membership_num_terms', $params), 1);
}
- if (CRM_Utils_Array::value( $index, CRM_Utils_Array::value('option_financial_type_id', $params))) {
+ if (CRM_Utils_Array::value($index, CRM_Utils_Array::value('option_financial_type_id', $params))) {
$options['financial_type_id'] = $params['option_financial_type_id'][$index];
}
elseif (!empty($params['financial_type_id'])) {
$is_pay_later = 1;
}
elseif (isset($qf->_values)) {
- $is_pay_later = CRM_Utils_Array::value( 'is_pay_later', $qf->_values);
+ $is_pay_later = CRM_Utils_Array::value('is_pay_later', $qf->_values);
}
$otherAmount = $qf->get('values');
$useRequired && $field->is_required
);
if ($is_pay_later) {
- $qf->add( 'text', 'txt-'.$elementName, $label, array( 'size' => '4'));
+ $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
}
// CRM-6902 - Add "max" option for a price set field
$choice[$opId] = $qf->createElement('radio', NULL, '', $opt['label'], $opt['id'], $extra);
if ($is_pay_later) {
- $qf->add( 'text', 'txt-'.$elementName, $label, array( 'size' => '4'));
+ $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
}
// CRM-6902 - Add "max" option for a price set field
$selectOption[$opt['id']] = $opt['label'];
if ($is_pay_later) {
- $qf->add( 'text', 'txt-'.$elementName, $label, array( 'size' => '4'));
+ $qf->add('text', 'txt-'.$elementName, $label, array('size' => '4'));
}
}
)
);
if ($is_pay_later) {
- $txtcheck[$opId] =& $qf->createElement( 'text', $opId, $opt['label'], array( 'size' => '4' ) );
+ $txtcheck[$opId] =& $qf->createElement('text', $opId, $opt['label'], array('size' => '4'));
$qf->addGroup($txtcheck, 'txt-'.$elementName, $label);
}
// CRM-6902 - Add "max" option for a price set field
unset($autoRenew[$dontCare]);
}
}
- if (count($autoRenew) > 1 ) {
+ if (count($autoRenew) > 1) {
$params['autoRenew'] = $autoRenew;
}
}
}
elseif (!empty($this->_multiRecordFields)
- && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)) )) {
+ && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)))) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
//multirecord listing page
$multiRecordFieldListing = TRUE;
// names and titles
$links[CRM_Core_Action::VIEW] = array(
'name' => ts('View'),
- 'title' => ts('View %1', array( 1 => $this->_customGroupTitle . ' record')),
+ 'title' => ts('View %1', array(1 => $this->_customGroupTitle . ' record')),
);
$links[CRM_Core_Action::UPDATE] = array(
'name' => ts('Edit'),
- 'title' => ts('Edit %1', array( 1 => $this->_customGroupTitle . ' record')),
+ 'title' => ts('Edit %1', array(1 => $this->_customGroupTitle . ' record')),
);
$links[CRM_Core_Action::DELETE] = array(
'name' => ts('Delete'),
- 'title' => ts('Delete %1', array( 1 => $this->_customGroupTitle . ' record')),
+ 'title' => ts('Delete %1', array(1 => $this->_customGroupTitle . ' record')),
);
// urls and queryStrings
// copy action
$links[CRM_Core_Action::COPY] = array(
'name' => ts('Copy'),
- 'title' => ts('Copy %1', array( 1 => $this->_customGroupTitle . ' record')),
+ 'title' => ts('Copy %1', array(1 => $this->_customGroupTitle . ' record')),
'url' => 'civicrm/contact/view/cd/edit',
'qs' => 'reset=1&type=%%type%%&groupID=%%groupID%%&entityID=%%entityID%%&cgcount=%%newCgCount%%&multiRecordDisplay=single©ValueId=%%cgcount%%&mode=copy'
);
parent::__construct();
$logTypes = array();
- foreach ( array_keys($this->_logTables) as $table ) {
+ foreach (array_keys($this->_logTables) as $table) {
$type = $this->getLogType($table);
$logTypes[$type] = $type;
}
}
if ('Contact' == CRM_Utils_Array::value('log_type', $this->_logTables[$row['log_civicrm_entity_log_type']]) &&
- CRM_Utils_Array::value('log_civicrm_entity_log_action', $row) == 'Insert' ) {
+ CRM_Utils_Array::value('log_civicrm_entity_log_action', $row) == 'Insert') {
$row['log_civicrm_entity_log_action'] = ts('Update');
}
*/
public function from($logTable = NULL) {
static $entity = NULL;
- if ( $logTable ) {
+ if ($logTable) {
$entity = $logTable;
}
$navigationDefaults = array();
if (!isset($defaults['permission'])) {
- $permissions = array_flip(CRM_Core_Permission::basicPermissions( ));
+ $permissions = array_flip(CRM_Core_Permission::basicPermissions());
$defaults['permission'] = $permissions['CiviReport: access CiviReport'];
}
}
CRM_Core_Session::setStatus($statusMsg);
- if ( $redirect ) {
+ if ($redirect) {
CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/report/instance/{$instance->id}", "reset=1"));
}
}
static $_links = NULL;
- static $_exceptions = array( 'logging/contact/detail' );
+ static $_exceptions = array('logging/contact/detail');
/**
* Name of component if report list is filtered
public static function getInstanceList($reportUrl) {
static $instanceDetails = array();
- if (!array_key_exists($reportUrl, $instanceDetails )) {
+ if (!array_key_exists($reportUrl, $instanceDetails)) {
$instanceDetails[$reportUrl] = array();
$sql = "
$value[] = "({$optionGroupID}, 'Activity Targets', 3, 'Activity Targets', 3, 1, 1)";
}
- if (!$assigneeID || !$sourceID || !$targetID ) {
+ if (!$assigneeID || !$sourceID || !$targetID) {
$insert = "
INSERT INTO civicrm_option_value
(option_group_id, label, value, name, weight, is_reserved, is_active)
$res = CRM_Core_DAO::singleValueQuery($sql);
- if ($res <= 0 ) {
+ if ($res <= 0) {
$sql = "ALTER TABLE civicrm_report_instance ADD `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'when combined with report_id/template uniquely identifies the instance'";
$res = CRM_Core_DAO::executeQuery($sql);
}
$res = CRM_Core_DAO::singleValueQuery($sql);
- if ($res <= 0 ) {
+ if ($res <= 0) {
$sql = "ALTER TABLE civicrm_report_instance ADD `args` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'arguments that are passed in the url when invoking the instance'";
$res = CRM_Core_DAO::executeQuery($sql);
if ($isOrphanData) {
$postUpgradeMessage .= "</br> <strong>" . ts('Your database contains extraneous financial records related to deleted contacts and contributions. These records should not affect the site and will not appear in reports, search results or exports. However you may wish to clean them up. Refer to <a href="%1" target="_blank">this wiki page for details</a>.
- ', array( 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Clean+up+extraneous+financial+data+-+4.3+upgrades')) . "</strong>";
+ ', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Clean+up+extraneous+financial+data+-+4.3+upgrades')) . "</strong>";
}
}
if ($rev == '4.3.4') {
$postUpgradeMessage .= '<br />' . ts('System Administrator Alert: If you are running scheduled jobs using CLI.php, you will need to reconfigure cron tasks to include a password. Scheduled jobs will no longer run if the password is not provided (<a href="%1" target="_blank">learn more</a>).',
- array( 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'));
+ array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'));
}
if ($rev == '4.3.5') {
$postUpgradeMessage .= '<br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li><li>Events - Registration Confirmation and Receipt (off-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
WHERE ccp.financial_type_id IS NULL and cp.cost > 0');
if ($flag) {
$postUpgradeMessage .= '<br />' . ts('Your database contains one or more premiums which have a cost but are not linked to a financial type. If you are exporting transations to an accounting package, this will result in unbalanced transactions. <a href="%1" target="_blank">You can review steps to correct this situation on the wiki.</a>',
- array( 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Issues+Caused+by+Missing+Cost+of+Goods+Account+-+4.3+Upgrades'));
+ array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Fixing+Issues+Caused+by+Missing+Cost+of+Goods+Account+-+4.3+Upgrades'));
}
}
}
// CRM-10893
// fix WP access control
- $config = CRM_Core_Config::singleton( );
+ $config = CRM_Core_Config::singleton();
if ($config->userFramework == 'WordPress') {
- civicrm_wp_set_capabilities( );
+ civicrm_wp_set_capabilities();
}
// Update phones CRM-11292.
$validCurrencyCodes = implode("','", $validCurrencyCodes);
$config = CRM_Core_Config::singleton();
$defaultCurrency = $config->defaultCurrency;
- $now = date( 'YmdHis' );
+ $now = date('YmdHis');
//adding financial_trxn records and entity_financial_trxn records related to contribution
//Add temp column for easy entry in entity_financial_trxn
$invalidData = CRM_Core_DAO::executeQuery($query);
if ($invalidData->N) {
$invalidDataMessage = "<br /><strong>" . ts('The upgrade is being aborted due to data integrity issues in your database. There are multiple membership records linked to the same contribution record. This is unexpected, and some of the membership records may be duplicates. The problem record sets are listed below. Refer to <a href="%1">this wiki page for instructions on repairing your database</a> so that you can run the upgrade successfully.
- ', array( 1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC42/Repair+database+script+for+4.2+upgrades')) . "</strong>";
+ ', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC42/Repair+database+script+for+4.2+upgrades')) . "</strong>";
$membershipType = CRM_Member_PseudoConstant::membershipType();
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus();
$invalidDataMessage .= "<table border=1><tr><th>Contact-ID</th><th>Contribution-ID</th><th>Membership-ID</th><th>Membership Type</th><th>Start Date</th><th>End Date</th><th>Membership Status</th></tr>";
$addTo[2] = $dao->contribution_page_id;
$options = array(
'otherAmount' => $dao->is_allow_other_amount,
- 'membership' => $dao->membership_block_id );
+ 'membership' => $dao->membership_block_id);
self::createPriceSet($daoName, $addTo, $options);
}
// an event or contrib page has been deleted but left the option group behind - (this may be fixed in later versions?)
// we should probably delete the option group - but at least early exit here as the code following it does not fatal
// CRM-10298
- if ( empty($pageTitle)) {
+ if (empty($pageTitle)) {
return;
}
}
}
- if ( !empty($processedRecords) ) {
+ if (!empty($processedRecords)) {
CRM_Core_Error::debug_log_message("deleteInvalidPairs() - The following records have been processed. Membership records with action:");
- CRM_Core_Error::debug_log_message( "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action" );
- foreach ( $processedRecords as $record ) {
+ CRM_Core_Error::debug_log_message("Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action");
+ foreach ($processedRecords as $record) {
CRM_Core_Error::debug_log_message(implode(', ', $record));
}
}
'queue' => CRM_Upgrade_Form::buildQueue($currentVer, $latestVer, $this->get('postUpgradeMessageFile')),
'isMinimal' => TRUE,
'pathPrefix' => 'civicrm/upgrade/queue',
- 'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE ),
+ 'onEndUrl' => CRM_Utils_System::url('civicrm/upgrade', 'action=finish', FALSE, NULL, FALSE),
'buttons' => array('retry' => $config->debug, 'skip' => $config->debug),
));
$queueRunner->runAllViaWeb();
}
$className = $config->geocodeMethod;
- $className::format( $params, TRUE );
+ $className::format($params, TRUE);
// see if we got a geocode error, in this case we'll trigger a fatal
// CRM-13760
public function set($key, &$value) {
$key = $this->cleanKey($key);
if (!$this->_cache->set($key, $value, $this->_timeout)) {
- CRM_Core_Error::debug( 'Result Code: ', $this->_cache->getResultMessage());
- CRM_Core_Error::fatal("memcached set failed, wondering why?, $key", $value );
+ CRM_Core_Error::debug('Result Code: ', $this->_cache->getResultMessage());
+ CRM_Core_Error::fatal("memcached set failed, wondering why?, $key", $value);
return FALSE;
}
return TRUE;
*/
public function cleanKey($key) {
$key = preg_replace('/\s+|\W+/', '_', $this->_prefix . $key);
- if ( strlen($key) > self::MAX_KEY_LEN ) {
+ if (strlen($key) > self::MAX_KEY_LEN) {
$md5Key = md5($key); // this should be 32 characters in length
$subKeyLen = self::MAX_KEY_LEN - 1 - strlen($md5Key);
$key = substr($key, 0, $subKeyLen) . "_" . $md5Key;
if (!array_key_exists($block, $fields)) {
$className = "CRM_Core_DAO_$block";
- $fields[$block] =& $className::fields( );
+ $fields[$block] =& $className::fields();
}
$blockCnt = count($params[$name]);
// mark an entry in fields array since we want the value of custom field to be copied
$fields['Address'][$key] = NULL;
- $htmlType = CRM_Utils_Array::value( 'html_type', $customFields[$customFieldID] );
- switch ( $htmlType ) {
+ $htmlType = CRM_Utils_Array::value('html_type', $customFields[$customFieldID]);
+ switch ($htmlType) {
case 'CheckBox':
case 'AdvMulti-Select':
case 'Multi-Select':
- if ( $val ) {
- $mulValues = explode( ',', $val );
- $customOption = CRM_Core_BAO_CustomOption::getCustomOption( $customFieldID, TRUE );
+ if ($val) {
+ $mulValues = explode(',', $val);
+ $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE);
$newValues[$key] = array();
- foreach ( $mulValues as $v1 ) {
- foreach ( $customOption as $v2 ) {
- if ( ( strtolower( $v2['label'] ) == strtolower( trim( $v1 ) ) ) ||
- ( strtolower( $v2['value'] ) == strtolower( trim( $v1 ) ) ) ) {
- if ( $htmlType == 'CheckBox' ) {
+ foreach ($mulValues as $v1) {
+ foreach ($customOption as $v2) {
+ if ((strtolower($v2['label']) == strtolower(trim($v1))) ||
+ (strtolower($v2['value']) == strtolower(trim($v1)))) {
+ if ($htmlType == 'CheckBox') {
$newValues[$key][$v2['value']] = 1;
}
else {
foreach ($civiModules as $civiModule) {
if (!file_exists($civiModule['filePath'])) {
CRM_Core_Session::setStatus(
- ts( 'Error loading module file (%1). Please restore the file or disable the module.',
- array(1 => $civiModule['filePath']) ),
- ts( 'Warning'), 'error');
+ ts('Error loading module file (%1). Please restore the file or disable the module.',
+ array(1 => $civiModule['filePath'])),
+ ts('Warning'), 'error');
continue;
}
include_once $civiModule['filePath'];
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix) {
- $params = array( &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6);
+ $params = array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6);
if ($this->civiModules === NULL) {
$this->civiModules = array();
call_user_func(array($this->mockObject, $fnSuffix), $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
}
if (!empty($this->adhocHooks[$fnSuffix])) {
- call_user_func_array($this->adhocHooks[$fnSuffix], $params );
+ call_user_func_array($this->adhocHooks[$fnSuffix], $params);
}
}
}
*/
// distinguish between types of hook
- if ( ! in_array( $fnSuffix, $this->hooksThatReturn ) ) {
+ if (! in_array($fnSuffix, $this->hooksThatReturn)) {
// only pass the arguments that have values
$args = array_slice(
- array( &$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6 ),
+ array(&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6),
0,
$numParams
);
// protect from REST calls
if (function_exists('do_action_ref_array')) {
- do_action_ref_array( $fnSuffix, $args );
+ do_action_ref_array($fnSuffix, $args);
}
}
$to = array($params['toEmail']);
$result = NULL;
- $mailer =& CRM_Core_Config::getMailer( );
+ $mailer =& CRM_Core_Config::getMailer();
// Mail_smtp and Mail_sendmail mailers require Bcc anc Cc emails
// be included in both $to and $headers['Cc', 'Bcc']
//get emails from headers, since these are
//combination of name and email addresses.
if (!empty($headers['Cc'])) {
- $to[] = CRM_Utils_Array::value( 'Cc', $headers );
+ $to[] = CRM_Utils_Array::value('Cc', $headers);
}
if (!empty($headers['Bcc'])) {
- $to[] = CRM_Utils_Array::value( 'Bcc', $headers );
+ $to[] = CRM_Utils_Array::value('Bcc', $headers);
}
}
if (is_object($mailer)) {
$bars[$barCount]->set_values($yValues);
if ($barCount > 0) {
// FIXME: for bars > 2, we'll need to come out with other colors
- $bars[$barCount]->colour( '#BF3B69');
+ $bars[$barCount]->colour('#BF3B69');
}
if ($barKey = CRM_Utils_Array::value($barCount, CRM_Utils_Array::value('barKeys', $params))) {
require_once 'tcpdf/tcpdf.php';
require_once 'FPDI/fpdi.php'; // This library is only in the 'packages' area as of version 4.5
- $paper_size_arr = array( $paper_size[2], $paper_size[3]);
+ $paper_size_arr = array($paper_size[2], $paper_size[3]);
$pdf = new TCPDF($orientation, 'pt', $paper_size_arr);
$pdf->Open();
if (is_readable($stationery_path)) {
- $pdf->SetStationery( $stationery_path );
+ $pdf->SetStationery($stationery_path);
}
$pdf->SetAuthor('');
$pdf->SetKeywords('CiviCRM.org');
- $pdf->setPageUnit( $margins[0] );
+ $pdf->setPageUnit($margins[0]);
$pdf->SetMargins($margins[4], $margins[1], $margins[2], TRUE);
$pdf->setJPEGQuality('100');
$q = $r;
}
$entity = CRM_Utils_array::value('entity', $requestParams);
- if ( empty($entity) && !empty($q)) {
+ if (empty($entity) && !empty($q)) {
$args = explode('/', $q);
// If the function isn't in the civicrm namespace, reject the request.
if ($args[0] != 'civicrm') {
return $result;
}
- if ($_SERVER['REQUEST_METHOD'] == 'GET' && strtolower(substr( $args[2], 0, 3)) != 'get') {
+ if ($_SERVER['REQUEST_METHOD'] == 'GET' && strtolower(substr($args[2], 0, 3)) != 'get') {
// get only valid for non destructive methods
require_once 'api/v3/utils.php';
return civicrm_api3_create_error("SECURITY: All requests that modify the database must be http POST, not GET.",
/** used to load a template "inline", eg. for ajax, without having to build a menu for each template */
static function loadTemplate () {
- $request = CRM_Utils_Request::retrieve( 'q', 'String');
+ $request = CRM_Utils_Request::retrieve('q', 'String');
if (FALSE !== strpos($request, '..')) {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
$tplfile = _civicrm_api_get_camel_name($request[3]);
$tpl = 'CRM/'.$entity.'/Page/Inline/'.$tplfile.'.tpl';
- $smarty = CRM_Core_Smarty::singleton( );
- CRM_Utils_System::setTitle( "$entity::$tplfile inline $tpl" );
- if (!$smarty->template_exists($tpl) ) {
+ $smarty = CRM_Core_Smarty::singleton();
+ CRM_Utils_System::setTitle("$entity::$tplfile inline $tpl");
+ if (!$smarty->template_exists($tpl)) {
header("Status: 404 Not Found");
die ("Can't find the requested template file templates/$tpl");
}
if ($pos !== FALSE) {
die ("SECURITY FATAL: one of the param names contains <");
}
- $param = array_map( 'htmlentities', $_GET);
+ $param = array_map('htmlentities', $_GET);
unset($param['q']);
$smarty->assign_by_ref("request", $param);
- if ( ! array_key_exists( 'HTTP_X_REQUESTED_WITH', $_SERVER ) ||
- $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest" ) {
+ if (! array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) ||
+ $_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest" ) {
- $smarty->assign( 'tplFile', $tpl );
+ $smarty->assign('tplFile', $tpl);
$config = CRM_Core_Config::singleton();
- $content = $smarty->fetch( 'CRM/common/'. strtolower($config->userFramework) .'.tpl' );
+ $content = $smarty->fetch('CRM/common/'. strtolower($config->userFramework) .'.tpl');
if (!defined('CIVICRM_UF_HEAD') && $region = CRM_Core_Region::instance('html-header', FALSE)) {
CRM_Utils_System::addHTMLHead($region->render(''));
}
- CRM_Utils_System::appendTPLFile( $tpl, $content );
+ CRM_Utils_System::appendTPLFile($tpl, $content);
return CRM_Utils_System::theme($content);
}
else {
$content = "<!-- .tpl file embeded: $tpl -->\n";
- CRM_Utils_System::appendTPLFile( $tpl, $content );
+ CRM_Utils_System::appendTPLFile($tpl, $content);
echo $content . $smarty->fetch($tpl);
- CRM_Utils_System::civiExit( );
+ CRM_Utils_System::civiExit();
}
}
$error = NULL;
$config = CRM_Core_Config::singleton();
$useSSL = FALSE;
- if ( !function_exists( 'recaptcha_get_html' ) ) {
+ if (!function_exists('recaptcha_get_html')) {
require_once 'packages/recaptcha/recaptchalib.php';
}
}
$className = $this->ufClass;
- $result =& $className::authenticate($name, $pass, $loadCMSBootstrap );
+ $result =& $className::authenticate($name, $pass, $loadCMSBootstrap);
if (empty($result)) {
throw new SoapFault('Client', 'Invalid login');
list($userID, $ufID, $randomNumber) = $result;
if ($userID && $ufID) {
$config = CRM_Core_Config::singleton();
- $config->userSystem->setUserSession( array($userID, $ufID) );
+ $config->userSystem->setUserSession(array($userID, $ufID));
}
else {
return self::authenticateAbort(
* process typically done in CLI and cron scripts. See: CRM-12648
*/
$session = CRM_Core_Session::singleton();
- $session->set( 'civicrmInitSession', TRUE );
+ $session->set('civicrmInitSession', TRUE);
$dbDrupal = DB::connect($config->userFrameworkDSN);
return $config->userSystem->authenticate($name, $password, $loadCMSBootstrap, $realPath);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// lets capture the return stuff rather than echo
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE );
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// CRM-13227, CRM-14744: only return the SSL error status
return (curl_exec($ch) !== FALSE);
* Drupal User ID.
*/
public function og_membership_create($ogID, $drupalID) {
- og_save_subscription( $ogID, $drupalID, array( 'is_active' => 1 ) );
+ og_save_subscription($ogID, $drupalID, array('is_active' => 1));
}
/**
* Drupal User ID.
*/
public function og_membership_delete($ogID, $drupalID) {
- og_delete_subscription( $ogID, $drupalID );
+ og_delete_subscription($ogID, $drupalID);
}
/**
}
$joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
- if ( !defined('JVERSION') ) {
+ if (!defined('JVERSION')) {
require $joomlaBase . '/libraries/cms/version/version.php';
$jversion = new JVersion;
define('JVERSION', $jversion->getShortVersion());
$dbId = $row->id;
$dbEmail = $row->email;
- if ( version_compare(JVERSION, '2.5.18', 'lt') ||
- ( version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt') )
+ if (version_compare(JVERSION, '2.5.18', 'lt') ||
+ (version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt'))
) {
// now check password
if (strpos($dbPassword, ':') === FALSE) {
}
//include additional files required by Joomla 3.2.1+
- if ( version_compare(JVERSION, '3.2.1', 'ge') ) {
+ if (version_compare(JVERSION, '3.2.1', 'ge')) {
require_once $joomlaBase . '/libraries/cms/application/helper.php';
require_once $joomlaBase . '/libraries/cms/application/cms.php';
require_once $joomlaBase . '/libraries/cms/application/administrator.php';
*/
public function setUserSession($data) {
list($userID, $ufID) = $data;
- $user = new JUser( $ufID );
+ $user = new JUser($ufID);
$session = JFactory::getSession();
$session->set('user', $user);
// load BootStrap here if needed
// We are a valid Joomla entry point.
- if ( ! defined( '_JEXEC' ) && $loadDefines ) {
+ if (! defined('_JEXEC') && $loadDefines) {
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', $joomlaBase . '/administrator');
require $joomlaBase . '/configuration.php';
// Files may be in different places depending on Joomla version
- if ( !defined('JVERSION') ) {
+ if (!defined('JVERSION')) {
require $joomlaBase . '/libraries/cms/version/version.php';
$jversion = new JVersion;
define('JVERSION', $jversion->getShortVersion());
}
- if (version_compare(JVERSION, '3.0', 'lt') ) {
+ if (version_compare(JVERSION, '3.0', 'lt')) {
require $joomlaBase . '/libraries/joomla/environment/uri.php';
require $joomlaBase . '/libraries/joomla/application/component/helper.php';
}
$loginURL .= 'index.php?option=com_users&view=login';
//CRM-14872 append destination
- if ( !empty($destination) ) {
+ if (!empty($destination)) {
$loginURL .= '&return='.urlencode(base64_encode($destination));
}
return $loginURL;
// yes, set page title, depending on context
$context = civi_wp()->civicrm_context_get();
- switch ( $context ) {
+ switch ($context) {
case 'admin':
case 'shortcode':
$template = CRM_Core_Smarty::singleton();
// when shortcode is included in page
// also make sure we have valid query object
global $wp_query;
- if ( method_exists( $wp_query, 'get' ) ) {
+ if (method_exists($wp_query, 'get')) {
if (get_query_var('page_id')) {
$wpPageParam = "page_id=" . get_query_var('page_id');
}
$ufName = CRM_Utils_Type::escape($ufName, 'String');
$values = array('ID' => $ufID, 'user_email' => $ufName);
- if ($ufID ) {
- wp_update_user( $values );
+ if ($ufID) {
+ wp_update_user($values);
}
}
}
'id',
'description',
),
- 'subscribe' => array( 'group' ),
- 'unsubscribe' => array( 'group' ),
- 'resubscribe' => array( 'group' ),
- 'welcome' => array( 'group' ),
+ 'subscribe' => array('group'),
+ 'unsubscribe' => array('group'),
+ 'resubscribe' => array('group'),
+ 'welcome' => array('group'),
);
/**
$remainingTokens = self::getTokens($tokenString);
// contact related $greetingTokens not empty, there are customized or hook tokens to replace
- if (!empty($remainingTokens['contact']) ) {
+ if (!empty($remainingTokens['contact'])) {
// Fill the return properties array
$greetingTokens = $remainingTokens['contact'];
reset($greetingTokens);
}
public static function fixOrder() {
- $signature = CRM_Utils_Request::retrieve( '_sgn', 'String', CRM_Core_DAO::$_nullObject);
+ $signature = CRM_Utils_Request::retrieve('_sgn', 'String', CRM_Core_DAO::$_nullObject);
$signer = new CRM_Utils_Signer(CRM_Core_Key::privateKey(), self::$SIGNABLE_FIELDS);
// Validate $_GET values b/c subsequent code reads $_GET (via CRM_Utils_Request::retrieve)
'geo_code_1', 'geo_code_2',
);
- if ( !empty( $values['location']['email'] ) ) {
+ if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
- if ( !empty( $values['location']['phone'] ) ) {
+ if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = array(
'phone_type' => CRM_Core_OptionGroup::getLabel(
'phone_type',
);
}
- if ( !empty( $values['location']['address'] ) ) {
+ if (!empty($values['location']['address'])) {
foreach ($address_array as $value) {
$domain['domain_address'][$value] = CRM_Utils_Array::value($value,
$values['location']['address'][1]
function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) {
if (!empty($event[$event_id]['payment_processor'])) {
$processors = explode(CRM_Core_DAO::VALUE_SEPARATOR, $event[$event_id]['payment_processor']);
- if (count($processors) == 3 ) {
+ if (count($processors) == 3) {
$event[$event_id]['payment_processor_id'] = $processors[1];
}
}
CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']);
}
if (!empty($apiRequest['params']['option_group_id'])) {
- $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name') );
+ $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name'));
if (is_string($optionGroupName)) {
CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName));
}
try {
CRM_Utils_Mail_EmailProcessor::processActivities();
- $values = array( );
+ $values = array();
$lock->release();
return civicrm_api3_create_success($values, $params,'mailing','activities');
}
* @static void
* @access public
*/
-function civicrm_api3_job_cleanup( $params ) {
- $session = CRM_Utils_Array::value( 'session' , $params, true );
- $tempTable = CRM_Utils_Array::value( 'tempTables', $params, true );
- $jobLog = CRM_Utils_Array::value( 'jobLog' , $params, true );
- $prevNext = CRM_Utils_Array::value( 'prevNext' , $params, true );
- $dbCache = CRM_Utils_Array::value( 'dbCache' , $params, false );
- $memCache = CRM_Utils_Array::value( 'memCache' , $params, false );
+function civicrm_api3_job_cleanup($params) {
+ $session = CRM_Utils_Array::value('session' , $params, true );
+ $tempTable = CRM_Utils_Array::value('tempTables', $params, true );
+ $jobLog = CRM_Utils_Array::value('jobLog' , $params, true );
+ $prevNext = CRM_Utils_Array::value('prevNext' , $params, true );
+ $dbCache = CRM_Utils_Array::value('dbCache' , $params, false);
+ $memCache = CRM_Utils_Array::value('memCache' , $params, false);
- if ( $session || $tempTable || $prevNext ) {
- CRM_Core_BAO_Cache::cleanup( $session, $tempTable, $prevNext );
+ if ($session || $tempTable || $prevNext) {
+ CRM_Core_BAO_Cache::cleanup($session, $tempTable, $prevNext);
}
- if ( $jobLog ) {
- CRM_Core_BAO_Job::cleanup( );
+ if ($jobLog) {
+ CRM_Core_BAO_Job::cleanup();
}
- if ( $dbCache ) {
- CRM_Core_Config::clearDBCache( );
+ if ($dbCache) {
+ CRM_Core_Config::clearDBCache();
}
- if ( $memCache ) {
- CRM_Utils_System::flushCache( );
+ if ($memCache) {
+ CRM_Utils_System::flushCache();
}
}
return civicrm_api3_create_error('Could not acquire lock, another EmailProcessor process is running');
}
- $limit = CRM_Utils_Array::value( 'limit', $params, 0 );
+ $limit = CRM_Utils_Array::value('limit', $params, 0);
CRM_Contact_BAO_GroupContactCache::loadAll(null, $limit);
$lock->release();
function civicrm_api3_mailing_send_test($params) {
if (!array_key_exists('test_group', $params) && !array_key_exists('test_email', $params)) {
- throw new API_Exception("Mandatory key(s) missing from params array: test_group and/or test_email field are required" );
+ throw new API_Exception("Mandatory key(s) missing from params array: test_group and/or test_email field are required");
}
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingJob',
*/
function civicrm_api3_mailing_event_queue_create($params) {
if (!array_key_exists('id', $params) && !array_key_exists('email_id', $params) && !array_key_exists('phone_id', $params)) {
- throw new API_Exception("Mandatory key missing from params array: id, email_id, or phone_id field is required" );
+ throw new API_Exception("Mandatory key missing from params array: id, email_id, or phone_id field is required");
}
civicrm_api3_verify_mandatory($params,
'CRM_Mailing_DAO_MailingJob',
return civicrm_api3_create_success($membershipValues, $params, 'membership', 'get');
}
- $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID );
+ $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID);
return civicrm_api3_create_success($members, $params, 'membership', 'get');
}
// Check our field length
if (is_string($params[$fieldName]) && !empty($fieldInfo['maxlength']) && strlen($params[$fieldName]) > $fieldInfo['maxlength']
) {
- throw new API_Exception( $params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
+ throw new API_Exception($params[$fieldName] . " is " . strlen($params[$fieldName]) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength'])
);
}
// the missing piece of functionality is separating them to a separated string
// & many save incorrectly. But can we change them wholesale?
}
- if ($value ) {
+ if ($value) {
if (!CRM_Utils_Rule::xssString($value)) {
throw new Exception(ts('Illegal characters in input (potential scripting attack)'));
}
$fh = fopen('php://output', 'w');
$rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
- if ( !empty($rows)) {
+ if (!empty($rows)) {
echo "The following records have been processed. If action = Un-linked, that membership has been disconnected from the contribution record.\n";
echo "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action \n";
}
echo "Could not find any records to process.\n";
}
- foreach ( $rows as $row ) {
+ foreach ($rows as $row) {
fputcsv($fh, $row);
}
}
chdir($civicrm_root);
require_once 'civicrm.config.php';
// autoload
- if ( !class_exists('CRM_Core_ClassLoader') ) {
+ if (!class_exists('CRM_Core_ClassLoader')) {
require_once $civicrm_root . '/CRM/Core/ClassLoader.php';
}
CRM_Core_ClassLoader::singleton()->register();
require_once 'cli.class.php';
$cli = new civicrm_Cli();
-$cli->initialize() || die( 'Died during initialization' );
-$cli->callApi() || die( 'Died during callApi' );
+$cli->initialize() || die('Died during initialization');
+$cli->callApi() || die('Died during callApi');
if (stristr(PHP_OS, 'WIN')) {
define('CIVICRM_DIRECTORY_SEPARATOR', '/');
- define('CIVICRM_WINDOWS', 1 );
+ define('CIVICRM_WINDOWS', 1);
}
else {
define('CIVICRM_DIRECTORY_SEPARATOR', DIRECTORY_SEPARATOR);
- define('CIVICRM_WINDOWS', 0 );
+ define('CIVICRM_WINDOWS', 0);
}
// set installation type - drupal
// Assert $c1 not in $parent
CRM_Contact_BAO_GroupContactCache::load($parent, TRUE);
$this->assertCacheMatches(
- array( /* deceased[0], */ $deceased[1]->id, $deceased[2]->id),
+ array(/* deceased[0], */ $deceased[1]->id, $deceased[2]->id),
$parent->id
);
require_once 'CiviTest/CiviMailUtils.php';
$this->mut = new CiviMailUtils($this, TRUE);
- $this->fixtures['rolling_membership'] = array( // createTestObject
+ $this->fixtures['rolling_membership'] = array(// createTestObject
'membership_type_id' => array(
'period_type' => 'rolling',
'duration_unit' => 'month',
'is_override' => 0,
);
- $this->fixtures['rolling_membership_past'] = array( // createTestObject
+ $this->fixtures['rolling_membership_past'] = array(// createTestObject
'membership_type_id' => array(
'period_type' => 'rolling',
'duration_unit' => 'month',
'is_override' => 'NULL',
);
- $this->fixtures['phonecall'] = array( // createTestObject
+ $this->fixtures['phonecall'] = array(// createTestObject
'status_id' => 1,
'activity_type_id' => 2,
'activity_date_time' => '20120615100000',
'is_current_revision' => 1,
'is_deleted' => 0,
);
- $this->fixtures['contact'] = array( // API
+ $this->fixtures['contact'] = array(// API
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-member@example.com',
);
- $this->fixtures['contact_birthdate'] = array( // API
+ $this->fixtures['contact_birthdate'] = array(// API
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-bday@example.com',
'birth_date' => '20050707',
);
- $this->fixtures['sched_activity_1day'] = array( // create()
+ $this->fixtures['sched_activity_1day'] = array(// create()
'name' => 'One_Day_Phone_Call_Notice',
'title' => 'One Day Phone Call Notice',
'limit_to' => '1',
'start_action_unit' => 'day',
'subject' => '1-Day (repeating)',
);
- $this->fixtures['sched_membership_join_2week'] = array( // create()
+ $this->fixtures['sched_membership_join_2week'] = array(// create()
'name' => 'sched_membership_join_2week',
'title' => 'sched_membership_join_2week',
'absolute_date' => '',
'start_action_unit' => 'week',
'subject' => 'subject sched_membership_join_2week',
);
- $this->fixtures['sched_membership_end_2week'] = array( // create()
+ $this->fixtures['sched_membership_end_2week'] = array(// create()
'name' => 'sched_membership_end_2week',
'title' => 'sched_membership_end_2week',
'absolute_date' => '',
'subject' => 'subject sched_membership_end_2week',
);
- $this->fixtures['sched_membership_end_2month'] = array( // create()
+ $this->fixtures['sched_membership_end_2month'] = array(// create()
'name' => 'sched_membership_end_2month',
'title' => 'sched_membership_end_2month',
'absolute_date' => '',
'subject' => 'subject sched_membership_end_2month',
);
- $this->fixtures['sched_contact_bday_yesterday'] = array( // create()
+ $this->fixtures['sched_contact_bday_yesterday'] = array(// create()
'name' => 'sched_contact_bday_yesterday',
'title' => 'sched_contact_bday_yesterday',
'absolute_date' => '',
'subject' => 'subject sched_contact_bday_yesterday',
);
- $this->fixtures['sched_contact_bday_anniv'] = array( // create()
+ $this->fixtures['sched_contact_bday_anniv'] = array(// create()
'name' => 'sched_contact_bday_anniv',
'title' => 'sched_contact_bday_anniv',
'absolute_date' => '',
'subject' => 'subject sched_contact_bday_anniv',
);
- $this->fixtures['sched_contact_grad_tomorrow'] = array( // create()
+ $this->fixtures['sched_contact_grad_tomorrow'] = array(// create()
'name' => 'sched_contact_grad_tomorrow',
'title' => 'sched_contact_grad_tomorrow',
'absolute_date' => '',
'subject' => 'subject sched_contact_grad_tomorrow',
);
- $this->fixtures['sched_contact_grad_anniv'] = array( // create()
+ $this->fixtures['sched_contact_grad_anniv'] = array(// create()
'name' => 'sched_contact_grad_anniv',
'title' => 'sched_contact_grad_anniv',
'absolute_date' => '',
'start_action_unit' => 'week',
'subject' => 'subject sched_contact_grad_anniv',
);
- $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array( // create()
+ $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array(// create()
'name' => 'sched_membership_end_2month',
'title' => 'sched_membership_end_2month',
'absolute_date' => '',
'start_action_unit' => 'month',
'subject' => 'subject sched_membership_end_2month',
);
- $this->fixtures['sched_membership_end_limit_to_none'] = array( // create()
+ $this->fixtures['sched_membership_end_limit_to_none'] = array(// create()
'name' => 'limit to none',
'title' => 'limit to none',
'absolute_date' => '',
$activityContact->save();
$this->assertCronRuns(array(
- array( // Before the 24-hour mark, no email
+ array(// Before the 24-hour mark, no email
'time' => '2012-06-14 04:00:00',
'recipients' => array(),
),
- array( // After the 24-hour mark, an email
+ array(// After the 24-hour mark, an email
'time' => '2012-06-14 15:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array( // Run cron again; message already sent
+ array(// Run cron again; message already sent
'time' => '',
'recipients' => array(),
),
$activityContact->save();
$this->assertCronRuns(array(
- array( // Before the 24-hour mark, no email
+ array(// Before the 24-hour mark, no email
'time' => '012-06-14 04:00:00',
'recipients' => array(),
),
- array( // After the 24-hour mark, an email
+ array(// After the 24-hour mark, an email
'time' => '2012-06-14 15:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array( // Run cron 4 hours later; first message already sent
+ array(// Run cron 4 hours later; first message already sent
'time' => '2012-06-14 20:00:00',
'recipients' => array(),
),
- array( // Run cron 6 hours later; send second message
+ array(// Run cron 6 hours later; send second message
'time' => '2012-06-14 21:00:01',
'recipients' => array(array('test-member@example.com')),
),
// start_date=2012-03-15 ; schedule is 2 weeks after start_date
$this->assertCronRuns(array(
- array( // Before the 2-week mark, no email
+ array(// Before the 2-week mark, no email
'time' => '2012-03-28 01:00:00',
'recipients' => array(),
),
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-03-29 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
// start_date=2012-03-15 ; schedule is 2 weeks after start_date
$this->assertCronRuns(array(
- array( // After the 2-week mark, don't send email because we have different membership type
+ array(// After the 2-week mark, don't send email because we have different membership type
'time' => '2012-03-29 01:00:00',
'recipients' => array(),
),
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-08-15 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-09-12 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
$this->callAPISuccess('action_schedule', 'create', $actionSchedule);
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-08-15 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
//extend membership - reminder should NOT go out
$this->callAPISuccess('membership', 'create', array('id' => $membership->id, 'end_date' => '2014-01-01'));
$this->assertCronRuns(array(
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-09-12 01:00:00',
'recipients' => array(),
),
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array( // Before the 2-week mark, no email
+ array(// Before the 2-week mark, no email
'time' => '2012-05-31 01:00:00',
// 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
'recipients' => array(),
),
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2012-06-01 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array( // Before the 2-week mark, no email
+ array(// Before the 2-week mark, no email
'time' => '2012-05-31 01:00:00',
// 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
'recipients' => array(),
),
- array( // After the 2-week mark, send an email
+ array(// After the 2-week mark, send an email
'time' => '2013-05-01 01:00:00',
'recipients' => array(),
),
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array( // On the birthday, no email
+ array(// On the birthday, no email
'time' => '2005-07-07 01:00:00',
'recipients' => array(),
),
- array( // The next day, send an email
+ array(// The next day, send an email
'time' => '2005-07-08 20:00:00',
'recipients' => array(array('test-bday@example.com')),
),
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array( // On some random day, no email
+ array(// On some random day, no email
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array( // On the eve of their 9th birthday, send an email
+ array(// On the eve of their 9th birthday, send an email
'time' => '2014-07-06 20:00:00',
'recipients' => array(array('test-bday@example.com')),
),
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array( // On some random day, no email
+ array(// On some random day, no email
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array( // On the eve of their graduation, send an email
+ array(// On the eve of their graduation, send an email
'time' => '2013-12-15 20:00:00',
'recipients' => array(array('test-member@example.com')),
),
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array( // Before the 2-week mark, no email
+ array(// Before the 2-week mark, no email
'time' => '2012-05-31 01:00:00',
// 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
'recipients' => array(),
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array( // On some random day, no email
+ array(// On some random day, no email
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array( // A week after their 5th anniversary of graduation, send an email
+ array(// A week after their 5th anniversary of graduation, send an email
'time' => '2018-12-23 20:00:00',
'recipients' => array(array('test-member@example.com')),
),
try {
$result = CRM_Core_BAO_CustomValueTable::setValues($params);
}
- catch ( Exception $e ) {
+ catch (Exception $e) {
$message = $e->getMessage();
}
$errorScope = NULL;
// Check that an exception has been thrown
- $this->assertNotNull( $message, 'Verify than an exception is thrown when bad date is passed' );
+ $this->assertNotNull($message, 'Verify than an exception is thrown when bad date is passed');
$params = array(
'entityID' => $contactID,
$errorScope = NULL;
// Check that an exception has been thrown
- $this->assertNotNull( $message, 'Verify than an exception is thrown when bad boolean is passed' );
+ $this->assertNotNull($message, 'Verify than an exception is thrown when bad boolean is passed');
$params = array(
'entityID' => $contactID,
public function setUp() {
parent::setUp();
- $this->quickCleanup( array( 'civicrm_contact', 'civicrm_email' ) );
+ $this->quickCleanup(array('civicrm_contact', 'civicrm_email'));
}
/**
public function setUp() {
parent::setUp();
- $this->quickCleanup( array( 'civicrm_contact', 'civicrm_address', 'civicrm_loc_block', 'civicrm_email', 'civicrm_phone', 'civicrm_im' ) );
+ $this->quickCleanup(array('civicrm_contact', 'civicrm_address', 'civicrm_loc_block', 'civicrm_email', 'civicrm_phone', 'civicrm_im'));
}
/**
'is_contact' => 0,
'description' => NULL,
'help_text' => NULL,
- 'on_change' => array( // list of callbacks
+ 'on_change' => array(// list of callbacks
array(__CLASS__, '_testOnChange_onChangeExample')
),
),
$this->assertFalse(empty($this->objects['membership']), 'in line ' . __LINE__);
$this->assertArrayHasKey($this->_membershipTypeID, $this->objects['membership'], 'in line ' . __LINE__);
$this->assertTrue(is_a($this->objects['membership'][$this->_membershipTypeID], 'CRM_Member_BAO_Membership'));
- $this->assertTrue(is_a( $this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
+ $this->assertTrue(is_a($this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
$this->assertFalse(empty($this->objects['contributionRecur']), __LINE__);
$this->assertFalse(empty($this->objects['paymentProcessor']), __LINE__);
}
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->assertFalse(empty($this->objects['participant']), 'in line ' . __LINE__);
$this->assertTrue(is_a($this->objects['participant'], 'CRM_Event_BAO_Participant'));
- $this->assertTrue(is_a( $this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
+ $this->assertTrue(is_a($this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
$this->assertFalse(empty($this->objects['event']));
$this->assertTrue(is_a($this->objects['event'], 'CRM_Event_BAO_Event'));
$this->assertTrue(is_a($this->objects['contribution'], 'CRM_Contribute_BAO_Contribution'));
$this->_setUpParticipantObjects();
$values = array();
require_once 'CiviTest/CiviMailUtils.php';
- $mut = new CiviMailUtils( $this, true );
+ $mut = new CiviMailUtils($this, true);
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->IPN->sendMail($this->input, $this->ids, $this->objects, $values, FALSE, FALSE);
$mut->checkMailLog(array(
);
$this->quickCleanup($tablesToTruncate, FALSE);
require_once 'CiviTest/CiviMailUtils.php';
- $mut = new CiviMailUtils( $this, true );
+ $mut = new CiviMailUtils($this, true);
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->IPN->sendMail($this->input, $this->ids, $this->objects, $values, FALSE, FALSE);
$mut->assertMailLogEmpty('no mail should have been send as event set to no confirm');
$this->_setUpPledgeObjects();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, $this->_processorId);
$this->assertFalse(empty($this->objects['pledge_payment'][0]), 'in line ' . __LINE__);
- $this->assertTrue(is_a( $this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
+ $this->assertTrue(is_a($this->objects['contributionType'],'CRM_Financial_BAO_FinancialType'));
$this->assertTrue(is_a($this->objects['contribution'], 'CRM_Contribute_BAO_Contribution'));
$this->assertTrue(is_a($this->objects['pledge_payment'][0], 'CRM_Pledge_BAO_PledgePayment'));
$this->assertFalse(empty($this->objects['pledge_payment'][0]->id));
// Templates injected into regions should normally be file names, but for unit-testing it's handy to use "string:" notation
require_once 'CRM/Core/Smarty/resources/String.php';
- civicrm_smarty_register_string_resource( );
+ civicrm_smarty_register_string_resource();
}
/**
// Templates injected into regions should normally be file names, but for unit-testing it's handy to use "string:" notation
require_once 'CRM/Core/Smarty/resources/String.php';
- civicrm_smarty_register_string_resource( );
+ civicrm_smarty_register_string_resource();
}
public function testAddScriptFile() {
'location_type_id' => 1,
'version' => 3,
);
- $result = civicrm_api( 'address', 'create', $params );
+ $result = civicrm_api('address', 'create', $params);
$contactIds[$count++] = $contact['id'];
}
$financialAccountid = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialAccount', 'Donations', 'id', 'name');
CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_FinancialAccount', $financialAccountid, 'accounting_code', '4800');
$accountingCode = CRM_Financial_BAO_FinancialAccount::getAccountingCode($financialType->id);
- $this->assertEquals( $accountingCode, 4800, 'Verify accounting code.');
+ $this->assertEquals($accountingCode, 4800, 'Verify accounting code.');
}
}
'entity_id',
'Database check on added financial item record.'
);
- $this->assertEquals( $result, $price, 'Verify Amount for Financial Item');
+ $this->assertEquals($result, $price, 'Verify Amount for Financial Item');
}
/**
'entity_table' => 'civicrm_line_item',
);
$financialItem = CRM_Financial_BAO_FinancialItem::retrieve($fParams, $values);
- $this->assertEquals( $financialItem->amount, $price, 'Verify financial item amount.');
+ $this->assertEquals($financialItem->amount, $price, 'Verify financial item amount.');
}
/**
'Database check on added financial item record.'
);
- $this->assertEquals( $result, $price, 'Verify Amount for Financial Item');
+ $this->assertEquals($result, $price, 'Verify Amount for Financial Item');
$entityResult = $this->assertDBNotNull(
'CRM_Financial_DAO_EntityFinancialTrxn',
$entityId,
'entity_id',
'Database check on added entity financial trxn record.'
);
- $this->assertEquals( $entityResult, $price, 'Verify Amount for Financial Item');
+ $this->assertEquals($entityResult, $price, 'Verify Amount for Financial Item');
}
/**
'financial_trxn_id',
'Database check on added entity financial trxn record.'
);
- $this->assertEquals( $entityResult, $amount, 'Verify Amount for Financial Item');
+ $this->assertEquals($entityResult, $amount, 'Verify Amount for Financial Item');
return $entityTrxn;
}
'financial_trxn_id',
'Database check on added entity financial trxn record.'
);
- $this->assertEquals( $entityResult, $entityTrxn->amount, 'Verify Amount for Financial Item');
+ $this->assertEquals($entityResult, $entityTrxn->amount, 'Verify Amount for Financial Item');
}
}
'financial_account_id',
'Database check on added financial type record.'
);
- $this->assertEquals( $result, $financialType->id, 'Verify Account Type');
+ $this->assertEquals($result, $financialType->id, 'Verify Account Type');
}
/**
);
$financialAccountType = CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, $ids);
CRM_Financial_BAO_FinancialTypeAccount::del($financialAccountType->id);
- $params = array('id' => $financialAccountType->id );
+ $params = array('id' => $financialAccountType->id);
$result = CRM_Financial_BAO_FinancialType::retrieve($params, $defaults);
- $this->assertEquals( empty($result), TRUE, 'Verify financial types record deletion.');
+ $this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.');
}
/**
CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, $ids);
$defaults = array();
$financialAccountType = CRM_Financial_BAO_FinancialTypeAccount::retrieve($financialParams, $defaults);
- $this->assertEquals( $financialAccountType['entity_id'], $financialType->id, 'Verify Entity Id.');
- $this->assertEquals( $financialAccountType['financial_account_id'], $financialAccount->id, 'Verify Financial Account Id.');
+ $this->assertEquals($financialAccountType['entity_id'], $financialType->id, 'Verify Entity Id.');
+ $this->assertEquals($financialAccountType['financial_account_id'], $financialAccount->id, 'Verify Financial Account Id.');
}
/**
CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, $ids);
$financialAccountId = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($paymentInstrumentValue);
- $this->assertEquals( $financialAccountId, $financialAccount->id, 'Verify Payment Instrument');
+ $this->assertEquals($financialAccountId, $financialAccount->id, 'Verify Payment Instrument');
}
}
'id',
'Database check on added financial type record.'
);
- $this->assertEquals( $result, 'Donations', 'Verify Name for Financial Type');
+ $this->assertEquals($result, 'Donations', 'Verify Name for Financial Type');
}
/**
'name',
'Database check on added payment processor type record.'
);
- $this->assertEquals( $result, 'Test Payment Processor', 'Verify Payment Processor Type');
+ $this->assertEquals($result, 'Test Payment Processor', 'Verify Payment Processor Type');
}
/**
$defaults = array();
CRM_Financial_BAO_PaymentProcessorType::create($params);
$result = CRM_Financial_BAO_PaymentProcessorType::retrieve($params, $defaults);
- $this->assertEquals( $result->name, 'Test_Retrieve_Payment_Processor', 'Verify Payment Processor Type');
+ $this->assertEquals($result->name, 'Test_Retrieve_Payment_Processor', 'Verify Payment Processor Type');
}
/**
public function setUp() {
parent::setUp();
- $this->_mut = new CiviMailUtils( $this, TRUE );
+ $this->_mut = new CiviMailUtils($this, TRUE);
}
public function tearDown() {
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'contact_type' => 'Individual',
);
- $contact_id_1 = $this->individualCreate( $contact_params_1 );
+ $contact_id_1 = $this->individualCreate($contact_params_1);
$contact_params_2 = array(
'first_name' => substr(sha1(rand()), 0, 7),
'email' => substr(sha1(rand()), 0, 7) . '@example.org',
'contact_type' => 'Individual',
);
- $contact_id_2 = $this->individualCreate( $contact_params_2 );
+ $contact_id_2 = $this->individualCreate($contact_params_2);
$subject = 'Test spool';
$params = array(
- 'from' => CRM_Utils_Mail::formatRFC822Email( $contact_params_1['first_name'] . " " . $contact_params_1['last_name'], $contact_params_1['email'] ),
+ 'from' => CRM_Utils_Mail::formatRFC822Email($contact_params_1['first_name'] . " " . $contact_params_1['last_name'], $contact_params_1['email']),
'toName' => $contact_params_2['first_name'] . " " . $contact_params_2['last_name'],
'toEmail' => $contact_params_2['email'],
'subject' => $subject,
'html' => "<p>\n" . self::$bodytext . '</p>',
);
- CRM_Utils_Mail::send( $params );
+ CRM_Utils_Mail::send($params);
- $mail = $this->_mut->getMostRecentEmail( 'raw' );
- $this->assertContains( "Subject: $subject", $mail );
- $this->assertContains( self::$bodytext, $mail );
+ $mail = $this->_mut->getMostRecentEmail('raw');
+ $this->assertContains("Subject: $subject", $mail);
+ $this->assertContains(self::$bodytext, $mail);
- $mail = $this->_mut->getMostRecentEmail( 'ezc' );
+ $mail = $this->_mut->getMostRecentEmail('ezc');
- $this->assertEquals( $subject, $mail->subject );
- $this->assertContains( $contact_params_1['email'], $mail->from->email, 'From address incorrect.' );
- $this->assertContains( $contact_params_2['email'], $mail->to[0]->email, 'Recipient incorrect.' );
+ $this->assertEquals($subject, $mail->subject);
+ $this->assertContains($contact_params_1['email'], $mail->from->email, 'From address incorrect.');
+ $this->assertContains($contact_params_2['email'], $mail->to[0]->email, 'Recipient incorrect.');
- $context = new ezcMailPartWalkContext( array( get_class($this), 'mailWalkCallback' ) );
- $mail->walkParts( $context, $mail );
+ $context = new ezcMailPartWalkContext(array(get_class($this), 'mailWalkCallback'));
+ $mail->walkParts($context, $mail);
}
/**
* @param $mailPart
*/
public static function mailWalkCallback($context, $mailPart) {
- if ( $mailPart instanceof ezcMailText ) {
- switch ( $mailPart->subType ) {
+ if ($mailPart instanceof ezcMailText) {
+ switch ($mailPart->subType) {
case 'plain':
- self::assertContains( self::$bodytext, $mailPart->generateBody() );
+ self::assertContains(self::$bodytext, $mailPart->generateBody());
break;
case 'html':
- self::assertContains( self::$bodytext . '</p>', $mailPart->generateBody() );
+ self::assertContains(self::$bodytext . '</p>', $mailPart->generateBody());
break;
}
}
*
*/
public function tearDown() {
- $this->membershipTypeDelete( array( 'id' => $this->_membershipTypeID ) );
- $this->membershipStatusDelete( $this->_membershipStatusID );
- Contact::delete( $this->_contactID );
+ $this->membershipTypeDelete(array('id' => $this->_membershipTypeID));
+ $this->membershipStatusDelete($this->_membershipStatusID);
+ Contact::delete($this->_contactID);
$this->_contactID = $this->_membershipStatusID = $this->_membershipTypeID = NULL;
}
'',
array(),
);
- $cases[] = array( // missing ts
+ $cases[] = array(// missing ts
'alert("Hello world")',
array(),
);
- $cases[] = array( // basic function call
+ $cases[] = array(// basic function call
'alert(ts("Hello world"));',
array('Hello world'),
);
- $cases[] = array( // with arg
+ $cases[] = array(// with arg
'alert(ts("Hello world", {1: "whiz"}));',
array('Hello world'),
);
- $cases[] = array( // not really ts()
+ $cases[] = array(// not really ts()
'alert(clients("Hello world"));',
array(),
);
- $cases[] = array( // not really ts()
+ $cases[] = array(// not really ts()
'alert(clients("Hello world", {1: "whiz"}));',
array(),
);
- $cases[] = array( // with arg
+ $cases[] = array(// with arg
'
public function whits() {
for (a in b) {
',
array('Hello'),
);
- $cases[] = array( // duplicate
+ $cases[] = array(// duplicate
'alert(ts("Hello world") + "-" + ts("Hello world"));',
array('Hello world'),
);
- $cases[] = array( // two strings, addition
+ $cases[] = array(// two strings, addition
'alert(ts("Hello world") + "-" + ts("How do you do?"));',
array('Hello world', 'How do you do?'),
);
- $cases[] = array( // two strings, separate calls
+ $cases[] = array(// two strings, separate calls
'alert(ts("Hello world");\nalert(ts("How do you do?"));',
array('Hello world', 'How do you do?'),
);
'alert(ts(\'Single quoted\'));',
array('Single quoted'),
);
- $cases[] = array( // unclear string
+ $cases[] = array(// unclear string
'alert(ts(message));',
array(),
);
- $cases[] = array( // ts() within a string
+ $cases[] = array(// ts() within a string
'alert(ts("Does the ts(\'example\') notation work?"));',
array('Does the ts(\'example\') notation work?'),
);
class CRM_Utils_SQL_InsertTest extends CiviUnitTestCase {
public function testRow_twice() {
$insert = CRM_Utils_SQL_Insert::into('foo')
- ->row(array('first' => '1', 'second' => '2' ))
+ ->row(array('first' => '1', 'second' => '2'))
->row(array('second' => '2b', 'first' => '1b'));
$expected = '
INSERT INTO foo (`first`,`second`) VALUES
public function testRows() {
$insert = CRM_Utils_SQL_Insert::into('foo')
- ->row(array('first' => '1', 'second' => '2' ))
+ ->row(array('first' => '1', 'second' => '2'))
->rows(array(
array('second' => '2b', 'first' => '1b'),
array('first' => '1c', 'second' => '2c')
"{$GLOBALS['base_dir']}" . PATH_SEPARATOR .
"$tests_dir" . PATH_SEPARATOR .
"$civi_pkgs_dir" . PATH_SEPARATOR
- . ini_get( 'include_path') );
+ . ini_get('include_path'));
# Relying on system timezone setting produces a warning,
# doing the following prevents the warning message
-if ( file_exists( '/etc/timezone' ) ) {
- $timezone = trim( file_get_contents( '/etc/timezone' ) );
- if ( ini_set('date.timezone', $timezone ) === FALSE ) {
+if (file_exists('/etc/timezone')) {
+ $timezone = trim(file_get_contents('/etc/timezone'));
+ if (ini_set('date.timezone', $timezone) === FALSE) {
echo "ini_set( 'date.timezone', '$timezone' ) failed\n";
}
}
//--- you shouldn't have to modify anything under this line, but might want to put the compiled templates CIVICRM_TEMPLATE_COMPILEDIR in a different folder than our default location ----------
-if ( ! defined( 'CIVICRM_DSN' ) && ! empty( $GLOBALS['mysql_user'] ) ) {
- $dbName = ! empty( $GLOBALS['mysql_db'] ) ? $GLOBALS['mysql_db'] : 'civicrm_tests_dev';
- if ( empty( $GLOBALS['mysql_pass'] ) && $GLOBALS['mysql_pass_need_password'] ) {
- $GLOBALS['mysql_pass'] = PHPUnit_TextUI_Command::getPassword( 'Password' );
+if (! defined('CIVICRM_DSN') && ! empty($GLOBALS['mysql_user'])) {
+ $dbName = ! empty($GLOBALS['mysql_db']) ? $GLOBALS['mysql_db'] : 'civicrm_tests_dev';
+ if (empty($GLOBALS['mysql_pass']) && $GLOBALS['mysql_pass_need_password']) {
+ $GLOBALS['mysql_pass'] = PHPUnit_TextUI_Command::getPassword('Password');
}
- define( 'CIVICRM_DSN', "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true" );
+ define('CIVICRM_DSN', "mysql://{$GLOBALS['mysql_user']}:{$GLOBALS['mysql_pass']}@{$GLOBALS['mysql_host']}/{$dbName}?new_link=true");
}
global $civicrm_root;
if (empty($civicrm_root)) {
- $civicrm_root = dirname(dirname(dirname(dirname( __FILE__ ) )));
+ $civicrm_root = dirname(dirname(dirname(dirname(__FILE__))));
}
#$civicrm_root = '/var/www/drupal7.dev.civicrm.org/public/sites/devel.drupal7.tests.dev.civicrm.org/modules/civicrm';
if (!defined("CIVICRM_TEMPLATE_COMPILEDIR")) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
- define( 'CIVICRM_TEMPLATE_COMPILEDIR', getenv('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR );
+ define('CIVICRM_TEMPLATE_COMPILEDIR', getenv('TMP') . DIRECTORY_SEPARATOR . 'civi' . DIRECTORY_SEPARATOR);
}
else {
- define( 'CIVICRM_TEMPLATE_COMPILEDIR', '/tmp/civi/' );
+ define('CIVICRM_TEMPLATE_COMPILEDIR', '/tmp/civi/');
}
}
-define( 'CIVICRM_SITE_KEY', 'phpunittestfakekey' );
+define('CIVICRM_SITE_KEY', 'phpunittestfakekey');
/**
* Site URLs:
*
*/
if (!defined('CIVICRM_UF_BASEURL')) {
- define( 'CIVICRM_UF_BASEURL', 'http://FIX ME' );
+ define('CIVICRM_UF_BASEURL', 'http://FIX ME');
}
/**
$include_path = '.' . PATH_SEPARATOR .
$civicrm_root . PATH_SEPARATOR .
$civicrm_root . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR .
- get_include_path( );
-set_include_path( $include_path );
+ get_include_path();
+set_include_path($include_path);
-if ( function_exists( 'variable_get' ) && variable_get('clean_url', '0') != '0' ) {
- define( 'CIVICRM_CLEANURL', 1 );
+if (function_exists('variable_get') && variable_get('clean_url', '0') != '0') {
+ define('CIVICRM_CLEANURL', 1);
} else {
- define( 'CIVICRM_CLEANURL', 0 );
+ define('CIVICRM_CLEANURL', 0);
}
// force PHP to auto-detect Mac line endings
$this->clickLink('_qf_Search_refresh');
- $targetContacts = array("Summerson, ". $firstName1, "Andersonnn, ". $firstName2, "Anderson, ". $firstName3 );
+ $targetContacts = array("Summerson, ". $firstName1, "Andersonnn, ". $firstName2, "Anderson, ". $firstName3);
//check whether separate activities are created for the target contacts
foreach ($targetContacts as $contact) {
// fill in step 1 (Title and Settings)
$contributionPageTitle = "Title $contributionTitle";
$this->type('title', $contributionPageTitle);
- $this->select( 'financial_type_id', 'value=1' );
+ $this->select('financial_type_id', 'value=1');
// select campaign
$this->click("campaign_id");
public function testAdvanceSearchForLog() {
$this->webtestLogin();
- $Pdate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' )) );
- $Ndate = date('F jS, Y h:i:s A', mktime( 0, 0, 0, date( 'm' ), date( 'd' ) + 1, date( 'Y' )) );
+ $Pdate = date('F jS, Y h:i:s A', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
+ $Ndate = date('F jS, Y h:i:s A', mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')));
//create a contact and return the contact id
$firstNameSoft = "John_".substr(sha1(rand()), 0, 5);
$lastNameSoft = "Doe_".substr(sha1(rand()), 0, 5);
- $this->webtestAddContact( $firstNameSoft, $lastNameSoft );
+ $this->webtestAddContact($firstNameSoft, $lastNameSoft);
$cid = $this->urlArg('cid');
//advance search for created contacts
$this->select2('member_of_contact_id', $membershipOrganization);
$this->type('minimum_fee', '1');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', "label=year");
$this->clickLink("xpath=//div[@id='contributionSearch']//table//tbody/tr[1]/td[11]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE);
foreach ($verifyData as $label => $value) {
- if ( $label == 'sort_name' ) {
+ if ($label == 'sort_name') {
continue;
}
$this->verifyText("xpath=//form[@id='ContributionView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td",
$this->type('minimum_fee', '50');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', "label=year");
$this->createDialogContact();
// select financial type
- $this->select( "financial_type_id", "value=1" );
+ $this->select("financial_type_id", "value=1");
//Contribution status
$this->select("contribution_status_id", "label=Pending");
$this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
$lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
- $search = array( 'entity_id' => $lineItem );
- $compare = array( 'status_id' => 1 );
+ $search = array('entity_id' => $lineItem);
+ $compare = array('status_id' => 1);
$this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
$status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
// create new contact using dialog
$this->createDialogContact();
// select financial type
- $this->select( "financial_type_id", "value=1" );
+ $this->select("financial_type_id", "value=1");
// total amount
$this->type("total_amount", "100");
// fill Premium information
$this->waitForText('crm-notification-container', "The contribution record has been saved.");
//Assertions
- $search = array( 'id' => $contId );
- $compare = array( 'financial_type_id' => 3 );
+ $search = array('id' => $contId);
+ $compare = array('financial_type_id' => 3);
$this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
$lineItem = key(CRM_Price_BAO_LineItem::getLineItems($contId, 'contribution'));
$contact = $this->createDialogContact();
// select financial type
- $this->select( "financial_type_id", "value=1" );
+ $this->select("financial_type_id", "value=1");
//Contribution status
$this->select("contribution_status_id", "label=$status");
$contact = $this->createDialogContact();
// select financial type
- $this->select( "financial_type_id", "value=1" );
+ $this->select("financial_type_id", "value=1");
// fill in Received Date
$this->webtestFillDate('receive_date');
$this->type('summary', 'This is a great conference. Sign up now!');
// Type description in ckEditor (fieldname, text to type, editor)
- $this->fillRichTextField('description', $eventDescription );
+ $this->fillRichTextField('description', $eventDescription);
$this->type('max_participants', '50');
$this->click('is_map');
$this->click('_qf_EventInfo_upload-bottom');
$this->type('summary', 'This is a great conference. Sign up now!');
// Type description in ckEditor (fieldname, text to type, editor)
- $this->fillRichTextField('description', $eventDescription );
+ $this->fillRichTextField('description', $eventDescription);
// Choose Start and End dates.
// Using helper webtestFillDate function.
* @param $numberOfTrxn
*/
public function _testAssignBatch($numberOfTrxn) {
- $this->select( "xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn" );
+ $this->select("xpath=//div[@id='crm-transaction-selector-assign_length']/label/select[@name='crm-transaction-selector-assign_length']", "value=$numberOfTrxn");
// Because it tends to cause problems, all uses of sleep() must be justified in comments
// Sleep should never be used for wait for anything to load from the server
// Justification for this instance: FIXME
$this->waitForElementPresent("_qf_Fee_upload-bottom");
$this->click("CIVICRM_QFID_1_is_monetary");
$this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select( "financial_type_id", "value=4" );
+ $this->select("financial_type_id", "value=4");
$counter = 1;
foreach ($params['fee_level'] as $label => $amount) {
$this->clickLink("link=Successful Deliveries");
// check for open page
- $this->assertElementContainsText( 'page-title', "Successful Deliveries");
+ $this->assertElementContainsText('page-title', "Successful Deliveries");
// verify email
$this->verifyText("xpath=//table[@id='mailing_event']/tbody//tr/td[2]", preg_quote("mailino$firstName@mailson.co.in"));
}
elseif ($usedFor == 'Membership') {
$this->click('extends[3]');
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent('financial_type_id');
$this->select("css=select.crm-form-select", "label={$contributionType}");
}
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', "label=year");
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 2);
$this->select('duration_unit', "label=year");
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', "label=year");
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', "label=year");
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', 'label=year');
}
$i++;
}
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent('financial_type_id');
$this->select("financial_type_id", "label={$contributionType}");
$this->waitForElementPresent('_qf_Field_next-bottom');
$this->click('_qf_Field_next-bottom');
$this->select('price_set_id', "value={$sid}");
$this->waitForElementPresent('pricesetTotal');
- $i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1 );
+ $i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1);
$this->waitForElementPresent("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$this->click("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$amount = $this->getText("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/label/span[@class='crm-price-amount-amount']");
// Record contribution
$this->click('record_contribution');
- $this->waitForElementPresent( 'financial_type_id' );
- $this->select( 'financial_type_id', "label=Member Dues" );
+ $this->waitForElementPresent('financial_type_id');
+ $this->select('financial_type_id', "label=Member Dues");
$this->select('payment_instrument_id', "label=Check");
$this->waitForElementPresent('check_number');
$this->type('check_number', '1023');
}
$i++;
}
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent('financial_type_id');
$this->select("financial_type_id", "label={$contributionType}");
$this->waitForElementPresent('_qf_Field_next-bottom');
$this->clickLink('_qf_Field_next-bottom');
}
elseif ($usedFor == 'Membership') {
$this->click('extends[3]');
- $this->waitForElementPresent( 'financial_type_id' );
+ $this->waitForElementPresent('financial_type_id');
$this->select("css=select.crm-form-select", "label={$contributionType}");
}
'joinDate', 'startDate', 'endDate') as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
- $i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1 );
+ $i = ($term == 3) ? 3 : (($term == 2) ? 2 : 1);
$this->waitForElementPresent("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$this->click("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/input");
$amount = $this->getText("xpath=//div[@id='priceset']/div[2]/div[2]/div[$i]/span/label/span[@class='crm-price-amount-amount']");
$this->select2('member_of_contact_id', $title);
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', 'value=2' );
+ $this->select('financial_type_id', 'value=2');
$this->type('duration_interval', 1);
$this->select('duration_unit', 'label=year');
$this->select('period_type', 'value=rolling');
// Membership fees
$this->type('minimum_fee', '100');
- $this->select( 'financial_type_id', "value={$memTypeParams['financial_type']}" );
+ $this->select('financial_type_id', "value={$memTypeParams['financial_type']}");
// Duration for which the membership will be active
$this->type('duration_interval', 1);
$this->type("frequency_day", "2");
$this->webtestFillDate('acknowledge_date', 'now');
- $this->select( "financial_type_id", "label=Donation");
+ $this->select("financial_type_id", "label=Donation");
$this->select("contribution_page_id", "value=3");
$emailId = "$firstName.anderson@example.org";
$this->webtestAddContact($firstName, "Anderson", $emailId);
- $this->openCiviPage('report/contact/summary', 'reset=1', '_qf_Summary_submit' );
+ $this->openCiviPage('report/contact/summary', 'reset=1', '_qf_Summary_submit');
// enable email field
$this->click("fields[email]");
$this->assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../{$contactCheck}/../{$actionPath}"), "The proper record not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']}, action as {$value['action']})");
if ($value['action'] == 'Update') {
- $this->assertTrue( ($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
+ $this->assertTrue(($value['action'] == $this->getText("xpath=//table/tbody//tr/td[2][contains(text(), '{$value['log_type']}')]/../td[4]/a[contains(text(), '{$value['altered_contact']}')]/../../{$actionPath}")), "The proper record action {$value['action']} not present for (log type : {$value['log_type']}, altered contact : {$value['altered_contact']} record)");
}
}
}
//visit the logging contact summary report
$this->openCiviPage('report/logging/contact/summary', 'reset=1');
foreach ($filters as $type => $filter) {
- if ($type == 'text' ) {
+ if ($type == 'text') {
foreach ($filter as $filterName => $filterValue) {
$this->type($filterName, $filterValue);
}
// entity,action: omit apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"entity" => "Contact",
"action" => "get",
"key" => $this->settings->siteKey,
// entity,action: valid apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"entity" => "Contact",
"action" => "get",
"key" => $this->settings->siteKey,
// entity,action: bad apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"entity" => "Contact",
"action" => "get",
"key" => $this->settings->siteKey,
// entity,action: valid apiKey, invalid entity+action
$cases[] = array(
- array( // query
+ array(// query
"entity" => "Contactses",
"action" => "get",
"key" => $this->settings->siteKey,
// q=civicrm/entity/action: omit apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"q" => "civicrm/contact/get",
"key" => $this->settings->siteKey,
"json" => "1",
// q=civicrm/entity/action: valid apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"q" => "civicrm/contact/get",
"key" => $this->settings->siteKey,
"json" => "1",
// q=civicrm/entity/action: invalid apiKey, valid entity+action
$cases[] = array(
- array( // query
+ array(// query
"q" => "civicrm/contact/get",
"key" => $this->settings->siteKey,
"json" => "1",
// q=civicrm/entity/action: valid apiKey, invalid entity+action
$cases[] = array(
- array( // query
+ array(// query
"q" => "civicrm/contactses/get",
"key" => $this->settings->siteKey,
"json" => "1",
// q=civicrm/entity/action: valid apiKey, invalid entity+action
// XXX Actually Ping is valid, no?
$cases[] = array(
- array( // query
+ array(// query
"q" => "civicrm/ping",
"key" => $this->settings->siteKey,
"json" => "1",
'version' => $this->_apiversion,
'id' => $activityId,
);
- $result = $this->callAPISuccess($this->_entity, 'get', $getParams );
+ $result = $this->callAPISuccess($this->_entity, 'get', $getParams);
$assignee = $result['values'][$result['id']]['assignee_contact_id'];
$target = $result['values'][$result['id']]['target_contact_id'];
$this->assertEquals(2, count($assignee), ' in line ' . __LINE__);
$this->callAPISuccess('contribution_soft', 'getcount', array(), $expectedCount);
//check id is same as 2
- $this->assertEquals($this->_softcontribution2['id'], $this->callAPISuccess('contribution_soft', 'getvalue', array('return' => 'id' )));
+ $this->assertEquals($this->_softcontribution2['id'], $this->callAPISuccess('contribution_soft', 'getvalue', array('return' => 'id')));
$this->callAPISuccess('ContributionSoft', 'Delete', array(
'id' => $this->_softcontribution2['id'],
$this->assertEquals($p2['contribution_id'], $res['contribution_id'], 'In line ' . __LINE__);
$this->assertEquals($p2['contact_id'], $res['contact_id'], 'In line ' . __LINE__);
$this->assertEquals($p2['amount'], $res['amount'], 'In line ' . __LINE__);
- $this->assertEquals($p2['currency'], $res['currency'], 'In line ' . __LINE__ );
+ $this->assertEquals($p2['currency'], $res['currency'], 'In line ' . __LINE__);
}
}
$params = array(
'contact_id' => $this->individualStudent,
'contact_type' => 'Individual',
- "custom_{$this->IndiStudentField['id']}" => 'Test String', );
+ "custom_{$this->IndiStudentField['id']}" => 'Test String',);
$result = $this->callAPISuccess('contact', 'create', $params);
$params = array(
'contact_id' => $this->individual,
'contact_type' => 'Individual',
- "custom_" . $this->IndividualField['id'] => 'Test String', );
+ "custom_" . $this->IndividualField['id'] => 'Test String',);
$contact = $this->callAPISuccess('contact', 'create', $params);
'contact_id' => $this->individualStudent,
'contact_type' => 'Individual',
'contact_sub_type' => 'Student',
- "custom_{$this->IndiStudentField['id']}" => 'Test String', );
+ "custom_{$this->IndiStudentField['id']}" => 'Test String',);
$contact = $this->callAPISuccess('contact', 'create', $params);
$this->assertAPISuccess($contact);
array(
'title' => 'Annual CiviCRM meet',
'event_type_id' => 1,
- 'start_date' => 20081021, ),
+ 'start_date' => 20081021,),
array(
'title' => 'Annual CiviCRM meet 2',
'event_type_id' => 1,
- 'start_date' => 20101021, ),
+ 'start_date' => 20101021,),
);
$this->events = array();
public function testGetEventByIdSort() {
$params = array(
'return.sort' => 'id ASC',
- 'return.max_results' => 1, );
+ 'return.max_results' => 1,);
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertEquals(1, $result['id'], ' in line ' . __LINE__);
$params = array(
'options' => array(
'sort' => 'id DESC',
'limit' => 1,
- ), );
+ ),);
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertAPISuccess($result, ' in line ' . __LINE__);
'options' => array(
'sort' => 'id ASC',
'limit' => 1,
- ), );
+ ),);
$result = $this->callAPISuccess('Event', 'Get', $params);
$this->assertEquals(1, $result['id'], ' in line ' . __LINE__);
$params['payment_processor_id'] = 1;
$params['sequential'] = 1;
$result = $this->callAPISuccess('event', 'create', $params);
- $this->assertEquals( 1, $result['values'][0]['payment_processor'][0], "handing of payment processor compatibility");
+ $this->assertEquals(1, $result['values'][0]['payment_processor'][0], "handing of payment processor compatibility");
$result = $this->callAPISuccess('event', 'get', $params);
$this->assertEquals($result['values'][0]['payment_processor_id'], 1, "handing get payment processor compatibility");
}
*/
public function testDeleteWithEventId() {
$params = array(
- 'event_id' => $this->_eventIds[0], );
+ 'event_id' => $this->_eventIds[0],);
$result = $this->callAPISuccess('Event', 'Delete', $params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
}
public function testSearchEmptyParams() {
$event = $this->callAPISuccess('event', 'create', $this->_params[1]);
- $getparams = array( 'sequential' => 1,
+ $getparams = array( 'sequential' => 1,
);
$result = $this->callAPISuccess('event', 'get', $getparams);
$this->assertEquals($result['count'], 3, 'In line ' . __LINE__);
'event_type_id' => 1,
'return.title' => 1,
'return.id' => 1,
- 'return.start_date' => 1, );
+ 'return.start_date' => 1,);
$result = $this->callAPISuccess('event', 'get', $params);
$this->assertEquals($result['values'][$this->_eventIds[0]]['id'], $this->_eventIds[0], 'In line ' . __LINE__);
'event_type_id' => 1,
'start_date' => '2010-10-03',
'title' => 'le cake is a tie',
- 'check_permissions' => TRUE, );
+ 'check_permissions' => TRUE,);
$config = &CRM_Core_Config::singleton();
$config->userPermissionClass->permissions = array('access CiviCRM');
$result = $this->callAPIFailure('event', 'create', $params);
public function tearDown() {
foreach ($this->ids as $entity => $entities) {
foreach ($entities as $id) {
- $this->callAPISuccess($entity, 'delete', array( 'id' => $id));
+ $this->callAPISuccess($entity, 'delete', array('id' => $id));
}
}
$this->quickCleanup(array('civicrm_grant'));
public function testCreateWithoutGroupIdParams() {
$params = array(
- 'contact_id' => $this->_contactId, );
+ 'contact_id' => $this->_contactId,);
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: group_id');
public function testCreateWithoutContactIdParams() {
$params = array(
- 'group_id' => $this->_groupId1, );
+ 'group_id' => $this->_groupId1,);
$groups = $this->callAPIFailure('group_contact', 'create', $params);
$this->assertEquals($groups['error_message'], 'Mandatory key(s) missing from params array: contact_id');
}
'prefix_id' => 3,
'suffix_id' => 3,
'email' => 'amiteshwar.prasad@civicrm.org',
- 'contact_type' => 'Individual', );
+ 'contact_type' => 'Individual',);
$this->_contactId1 = $this->individualCreate($cont);
$params = array(
*/
public function testGetWithChildGroupId() {
$params = array(
- 'child_group_id' => 4, );
+ 'child_group_id' => 4,);
$result = $this->callAPISuccess('group_nesting', 'get', $params);
*/
public function testGetWithParentGroupId() {
$params = array(
- 'parent_group_id' => 1, );
+ 'parent_group_id' => 1,);
$result = $this->callAPISuccess('group_nesting', 'get', $params);
// groups id=1 and id=2 loaded in setUp
$getparams = array(
'parent_group_id' => 1,
- 'child_group_id' => 2, );
+ 'child_group_id' => 2,);
$result = $this->callAPISuccess('group_nesting', 'get', $getparams);
$params = array('id' => $result['id']);
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID,);
$result = $this->callAPISuccess('group_organization', 'create', $params);
$paramsGet = array(
'organization_id' => $result['id'],
*/
public function testGroupOrganizationGetWithInvalidKeys() {
$params = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1,);
$result = $this->callAPISuccess('group_organization', 'get', $params);
$this->assertAPISuccess($result);
public function testGroupOrganizationCreate() {
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID,);
$result = $this->callAPIAndDocument('group_organization', 'create', $params, __FUNCTION__, __FILE__);
}
public function testGroupOrganizationCreateTwice() {
$params = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID,);
$result = $this->callAPISuccess('group_organization', 'create', $params);
$result2 = $this->callAPISuccess('group_organization', 'create', $params);
$this->assertEquals($result['values'], $result2['values']);
*/
public function testGroupOrganizationCreateWithInvalidKeys() {
$params = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1,);
$result = $this->callAPIFailure('group_organization', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: group_id, organization_id');
}
public function testGroupOrganizationDelete() {
$paramsC = array(
'organization_id' => $this->_orgID,
- 'group_id' => $this->_groupID, );
+ 'group_id' => $this->_groupID,);
$result = $this->callAPISuccess('group_organization', 'create', $paramsC);
$params = array(
*/
public function testGroupOrganizationDeleteWithInvalidKey() {
$paramsDelete = array(
- 'invalid_key' => 1, );
+ 'invalid_key' => 1,);
$result = $this->callAPIFailure('group_organization', 'delete', $paramsDelete);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id');
}
'created_id' => 1,
'groups' => array('include' => array($this->_groupID)),
);
- $this->_mut = new CiviMailUtils( $this, TRUE );
+ $this->_mut = new CiviMailUtils($this, TRUE);
$this->callAPISuccess('mail_settings', 'get', array('api.mail_settings.create' => array('domain' => 'chaos.org')));
}
* @param int $groupID
*/
public function createContactsInGroup($count, $groupID) {
- for ($i = 1; $i <= $count; $i++ ) {
+ for ($i = 1; $i <= $count; $i++) {
$contactID = $this->individualCreate(array('first_name' => $count, 'email' => 'mail' . $i . '@nul.com'));
$this->callAPISuccess('group_contact', 'create', array('contact_id' => $contactID, 'group_id' => $groupID, 'status' => 'Added'));
}
*/
public function getRecipients($start, $count) {
$recipients = array();
- for ($i = $start; $i < ($start + $count); $i++ ) {
+ for ($i = $start; $i < ($start + $count); $i++) {
$recipients[][0] = 'mail' . $i . '@nul.com';
}
return $recipients;
public function testUpdate() {
$params = array(
- 'name' => 'test membership status', );
+ 'name' => 'test membership status',);
$result = $this->callAPISuccess('membership_status', 'create', $params);
$id = $result['id'];
$result = $this->callAPISuccess('membership_status', 'get', $params);
$this->assertEquals('test membership status', $result['values'][$id]['name']);
$newParams = array(
'id' => $id,
- 'name' => 'renamed', );
+ 'name' => 'renamed',);
$result = $this->callAPISuccess('membership_status', 'create', $newParams);
$result = $this->callAPISuccess('membership_status', 'get', array('id' => $id));
$this->assertEquals('renamed', $result['values'][$id]['name']);
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: financial_type_id'
'domain_id' => '1',
'minimum_fee' => '200',
'duration_interval' => '10',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'minimum_fee' => '200',
'duration_unit' => 'month',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'Mandatory key(s) missing from params array: financial_type_id, duration_interval'
'minimum_fee' => '200',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'],
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: name');
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'rolling',
- 'visibility' => 'public', );
+ 'visibility' => 'public',);
$membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
$this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id');
$newMembOrgParams = array(
'organization_name' => 'New membership organisation',
'contact_type' => 'Organization',
- 'visibility' => 1, );
+ 'visibility' => 1,);
// create a new contact to update this membership type to
$newMembOrgID = $this->organizationCreate($newMembOrgParams);
'duration_unit' => 'month',
'duration_interval' => '10',
'period_type' => 'fixed',
- 'domain_id' => 1, );
+ 'domain_id' => 1,);
$this->callAPISuccess('membership_type', 'update', $params);
'note' => 'Hello!!! m testing Note',
'contact_id' => $this->_contactID,
'modified_date' => '2011-01-31',
- 'subject' => 'Test Note', );
+ 'subject' => 'Test Note',);
$this->_note = $this->noteCreate($this->_contactID);
$this->_noteID = $this->_note['id'];
}
$this->assertArrayHasKey('id', $result);
$note = array(
- 'id' => $result['id'], );
+ 'id' => $result['id'],);
$this->noteDelete($note);
}
'contact_id' => $this->_contactID,
'modified_date' => '2011-01-31',
'subject' => "With a '",
- 'sequential' => 1, );
+ 'sequential' => 1,);
$result = $this->callAPISuccess('Note', 'Create', $params);
$this->assertAPISuccess($result, 'in line ' . __LINE__);
$this->assertEquals($result['values'][0]['note'], "Hello!!! ' testing Note", 'in line ' . __LINE__);
//CleanUP
$note = array(
- 'id' => $result['id'], );
+ 'id' => $result['id'],);
$this->noteDelete($note);
}
$this->assertAPISuccess($apiResult);
$this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($apiResult['values'][$apiResult['id']]['modified_date'])));
$this->noteDelete(array(
- 'id' => $apiResult['id'], ));
+ 'id' => $apiResult['id'],));
}
public function testUpdateWithoutContactId() {
$params = array(
'entity_id' => $this->_contactID,
- 'entity_table' => 'civicrm_contact', );
+ 'entity_table' => 'civicrm_contact',);
$note = $this->callAPIFailure('note', 'create', $params,
'Mandatory key(s) missing from params array: note'
);
'id' => $this->_noteID,
'contact_id' => $this->_contactID,
'note' => 'Note1',
- 'subject' => 'Hello World', );
+ 'subject' => 'Hello World',);
//Update Note
$this->callAPISuccess('note', 'create', $params);
public function testPaymentCreateMissingContributionId() {
//Without Payment EntityID
$params = array(
- 'participant_id' => $this->_participantID, );
+ 'participant_id' => $this->_participantID,);
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
public function testPaymentUpdateMissingParticipantId() {
//WithoutParticipantId
$params = array(
- 'contribution_id' => '3', );
+ 'contribution_id' => '3',);
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
*/
public function testPaymentUpdateMissingContributionId() {
$params = array(
- 'participant_id' => $this->_participantID, );
+ 'participant_id' => $this->_participantID,);
$participantPayment = $this->callAPIFailure('participant_payment', 'create', $params);
}
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID,);
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID,);
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
$params = array(
'id' => $this->_participantPaymentID,
'participant_id' => $this->_participantID,
- 'contribution_id' => $contributionID, );
+ 'contribution_id' => $contributionID,);
// Update Payment
$participantPayment = $this->callAPISuccess('participant_payment', 'create', $params);
*/
public function testPaymentDeleteWithWrongID() {
$params = array(
- 'id' => 0, );
+ 'id' => 0,);
$deletePayment = $this->callAPIFailure('participant_payment', 'delete', $params);
$this->assertEquals($deletePayment['error_message'], 'Error while deleting participantPayment');
}
*/
public function testGetContactIdOnly() {
$params = array(
- 'contact_id' => $this->_contactID, );
+ 'contact_id' => $this->_contactID,);
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertEquals($this->_participantID, $participant['id'],
public function testGetMultiMatchReturnFirst() {
$params = array(
'event_id' => $this->_eventID,
- 'rowCount' => 1, );
+ 'rowCount' => 1,);
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertNotNull($participant['id']);
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation',);
$participant = $this->callAPIFailure('participant', 'create', $params);
$this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id');
// Cleanup created participant records.
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation',);
$participant = $this->callAPIFailure('Participant', 'update', $params);
}
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation', );
+ 'event_level' => 'Donation',);
$participant = $this->callAPIFailure('participant', 'create', $params);
$result = $this->participantDelete($participantId);
}
*/
public function testParticipantDelete() {
$params = array(
- 'id' => $this->_participantID, );
+ 'id' => $this->_participantID,);
$participant = $this->callAPISuccess('participant', 'delete', $params);
$this->assertAPISuccess($participant);
$this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID, NULL, TRUE);
*/
public function testParticipantDeleteMissingID() {
$params = array(
- 'event_id' => $this->_eventID, );
+ 'event_id' => $this->_eventID,);
$participant = $this->callAPIFailure('participant', 'delete', $params);
$this->assertNotNull($participant['error_message']);
}
*/
public function testPaymentProcessorTypeCreateWithoutName() {
$payProcParams = array(
- 'is_active' => 1, );
+ 'is_active' => 1,);
$result = $this->callAPIFailure('payment_processor_type', 'create', $payProcParams);
$this->assertEquals($result['error_message'],
'Mandatory key(s) missing from params array: name, title, class_name, billing_mode'
'title' => 'API Test Payment Processor 2',
'class_name' => 'CRM_Core_Payment_APITest 2',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0,);
$result = $this->callAPISuccess('payment_processor_type', 'create', $params);
$this->assertNotNull($result['id']);
'title' => 'API Test Payment Processor',
'class_name' => 'CRM_Core_Payment_APITest',
'billing_mode' => 1,
- 'is_recur' => 0, );
+ 'is_recur' => 0,);
$first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
'title' => 'API Test Payment Processor 2',
'class_name' => 'CRM_Core_Payment_APITest 2',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0,);
$second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
$result = $this->callAPISuccess('payment_processor_type', 'get', array());
'title' => 'API Test Payment Processor 11',
'class_name' => 'CRM_Core_Payment_APITest_11',
'billing_mode' => 1,
- 'is_recur' => 0, );
+ 'is_recur' => 0,);
$first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
'title' => 'API Test Payment Processor 12',
'class_name' => 'CRM_Core_Payment_APITest_12',
'billing_mode' => 2,
- 'is_recur' => 0, );
+ 'is_recur' => 0,);
$second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
$params = array(
- 'name' => 'API_Test_PP_12', );
+ 'name' => 'API_Test_PP_12',);
$result = $this->callAPISuccess('payment_processor_type', 'get', $params);
$this->assertAPISuccess($result);
$this->assertEquals($pledge['pledge_next_pay_amount'], 20.00, 'in line' . __LINE__);
$params2 = array(
- 'pledge_id' => $this->_pledge['id'], );
+ 'pledge_id' => $this->_pledge['id'],);
$pledge = $this->callAPISuccess('pledge', 'delete', $params2);
}
/**
'start_date' => 'first saturday of march last year',
);
$this->_pledge = $this->callAPISuccess('pledge', 'create', array_merge($this->_params, $overdueParams));
- $params = array( 'pledge_status_id' => '6',
+ $params = array( 'pledge_status_id' => '6',
);
$result = $this->callAPISuccess('pledge', 'get', $params);
- $emptyResult = $this->callAPISuccess('pledge', 'get', array( 'pledge_status_id' => '1',
+ $emptyResult = $this->callAPISuccess('pledge', 'get', array( 'pledge_status_id' => '1',
));
$pledge = $result['values'][$this->_pledge['id']];
$this->callAPISuccess('pledge', 'delete', $pledge);
$pledgeID = $this->pledgeCreate($this->_individualId);
$old_params = array(
'id' => $pledgeID,
- 'sequential' => 1, );
+ 'sequential' => 1,);
$original = $this->callAPISuccess('pledge', 'get', $old_params);
//Make sure it came back
$this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__);
'amount' => 100,
'financial_type_id' => 1,
'start_date' => date('Ymd'),
- 'installments' => 10, );
+ 'installments' => 10,);
$pledge = $this->callAPISuccess('pledge', 'create', $params);
$new_params = array(
$pledgeID = $this->pledgeCreate($this->_individualId);
$old_params = array(
'id' => $pledgeID,
- 'sequential' => 1, );
+ 'sequential' => 1,);
$original = $this->callAPISuccess('pledge', 'get', $old_params);
//Make sure it came back
$this->assertEquals($original['values'][0]['pledge_id'], $pledgeID, 'In line ' . __LINE__);
);
$result1 = $this->callAPISuccess($this->_entity, 'create', $params1);
$result2 = $this->callAPISuccess($this->_entity, 'create', $params2);
- $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' => $this->priceFieldID1 ));
+ $result = $this->callAPISuccess($this->_entity, 'get', array('price_field_id' => $this->priceFieldID1));
$this->assertEquals(2, $result['count'], 'In line ' . __LINE__);
$this->callAPISuccess($this->_entity, 'delete', array('id' => $result1['id']));
$this->callAPISuccess($this->_entity, 'delete', array('id' => $result2['id']));
$this->assertDBQuery(1, 'SELECT is_active FROM civicrm_option_value
WHERE name = "CRM_Report_Form_Examplez"');
- $result = $this->callAPISuccess('ReportTemplate', 'delete', array( 'id' => $entityId,
+ $result = $this->callAPISuccess('ReportTemplate', 'delete', array( 'id' => $entityId,
));
$this->assertAPISuccess($result);
$this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
'is_contact' => 0,
'description' => NULL,
'help_text' => NULL,
- 'on_change' => array( // list of callbacks
+ 'on_change' => array(// list of callbacks
array(__CLASS__, '_testOnChange_onChangeExample')
),
),
$customDataEntities = array();
$invalidEntities = array('Individual', 'Organization', 'Household');
$entitiesToFix = array('Case', 'Relationship');
- foreach ($entities as $entityName => $entity ) {
+ foreach ($entities as $entityName => $entity) {
if (!in_array($entityName, $invalidEntities)
&& !in_array($entityName, $entitiesToFix)) {
if (!empty(self::$componentMap[$entityName]) && empty($enabledComponents[self::$componentMap[$entityName]])) {
$this->_ids['price_set'][] = $priceSet['id'];
}
$priceSetID = $this->_price = reset($this->_ids['price_set']);
- CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $contributionPageResult['id'], $priceSetID );
+ CRM_Price_BAO_PriceSet::addTo('civicrm_contribution_page', $contributionPageResult['id'], $priceSetID);
if (empty($this->_ids['price_field'])) {
$priceField = $this->callAPISuccess('price_field', 'create', array(
$this->_ids['contributionId'] = $contribution['id'];
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 120.00, 'In line ' . __LINE__);
- $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__ );
+ $this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], $this->financialtypeID, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['trxn_id'], 12345, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 67890, 'In line ' . __LINE__);
$this->assertEquals($contribution['values'][$contribution['id']]['source'], 'SSF', 'In line ' . __LINE__);
);
$result = array();
- CRM_Financial_BAO_FinancialTypeAccount::retrieve( $searchParams, $result );
- return CRM_Utils_Array::value( 'financial_account_id', $result );
+ CRM_Financial_BAO_FinancialTypeAccount::retrieve($searchParams, $result);
+ return CRM_Utils_Array::value('financial_account_id', $result);
}
///////////////// civicrm_contribution_delete methods
'name' => 'test_group',
'notify' => 'admin@example.org',
'post_URL' => 'http://example.org/post',
- 'title' => 'Test Group', );
+ 'title' => 'Test Group',);
$result = $this->callAPISuccess('uf_group', 'create', $params);
$params['created_date'] = date('YmdHis', strtotime($params['created_date']));
foreach ($params as $key => $value) {
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 1, );
+ 'is_active' => 1,);
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(
'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => 1, );
+ 'entity_id' => 1,);
$result = $this->callAPISuccess('uf_join', 'get', $searchParams);
foreach ($result['values'] as $key => $value) {
'entity_table' => 'civicrm_contribution_page',
'entity_id' => 1,
'weight' => 1,
- 'is_active' => 1, );
+ 'is_active' => 1,);
$result = $this->callAPIFailure('uf_join', 'create', $params);
$this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: uf_group_id', 'In line ' . __LINE__);
}
'entity_id' => 1,
'weight' => 1,
'uf_group_id' => $this->_ufGroupId,
- 'is_active' => 1, );
+ 'is_active' => 1,);
$ufJoin = $this->callAPISuccess('uf_join', 'create', $params);
$searchParams = array(