$separator = array(0 => 'None', 1 => 'After Menu Element', 2 => 'Before Menu Element');
$this->add('select', 'has_separator', ts('Separator?'), $separator);
- $active = $this->add('checkbox', 'is_active', ts('Enabled?'));
+ $active = $this->add('advcheckbox', 'is_active', ts('Enabled?'));
if (CRM_Utils_Array::value('name', $this->_defaults) == 'Home') {
$active->freeze();
}
}
+ /**
+ * Function to check line items
+ *
+ * @param array $params
+ * array of order params.
+ *
+ */
+ public static function checkLineItems(&$params) {
+ $totalAmount = CRM_Utils_Array::value('total_amount', $params);
+ $lineItemAmount = 0;
+ foreach ($params['line_items'] as &$lineItems) {
+ foreach ($lineItems['line_item'] as &$item) {
+ if (empty($item['financial_type_id'])) {
+ $item['financial_type_id'] = $params['financial_type_id'];
+ }
+ $lineItemAmount += $item['line_total'];
+ }
+ }
+ if (!isset($totalAmount)) {
+ $params['total_amount'] = $lineItemAmount;
+ }
+ elseif ($totalAmount != $lineItemAmount) {
+ throw new API_Exception("Line item total doesn't match with total amount.");
+ }
+ }
+
}
$object->delete();
}
+ /**
+ * execute an unbuffered query. This is a wrapper around new functionality
+ * exposed with CRM-17748.
+ *
+ * @param string $query query to be executed
+ *
+ * @return Object CRM_Core_DAO object that points to an unbuffered result set
+ * @static
+ * @access public
+ */
+ static public function executeUnbufferedQuery(
+ $query,
+ $params = array(),
+ $abort = TRUE,
+ $daoName = NULL,
+ $freeDAO = FALSE,
+ $i18nRewrite = TRUE,
+ $trapException = FALSE
+ ) {
+ $queryStr = self::composeQuery($query, $params, $abort);
+ //CRM_Core_Error::debug( 'q', $queryStr );
+ if (!$daoName) {
+ $dao = new CRM_Core_DAO();
+ }
+ else {
+ $dao = new $daoName();
+ }
+
+ if ($trapException) {
+ CRM_Core_Error::ignoreException();
+ }
+
+ // set the DAO object to use an unbuffered query
+ $dao->setOptions(array('result_buffering' => 0));
+
+ $result = $dao->query($queryStr, $i18nRewrite);
+
+ if ($trapException) {
+ CRM_Core_Error::setCallback();
+ }
+
+ if (is_a($result, 'DB_Error')) {
+ return $result;
+ }
+
+ // since it is unbuffered, ($dao->N==0) is true. This blocks the standard fetch() mechanism.
+ $dao->N = TRUE;
+
+ if ($freeDAO ||
+ preg_match('/^(insert|update|delete|create|drop|replace)/i', $queryStr)
+ ) {
+ // we typically do this for insert/update/delete stataments OR if explicitly asked to
+ // free the dao
+ $dao->free();
+ }
+ return $dao;
+ }
+
/**
* Execute a query.
*
return (bool) $domain->locales;
}
+ /**
+ * Is the language written "right-to-left"?
+ *
+ * @param $language
+ * Language (for example 'en_US', or 'fr_CA').
+ *
+ * @return Bool
+ * True if it is an RTL language.
+ */
+ public static function isLanguageRTL($language) {
+ $rtl = CRM_Core_I18n_PseudoConstant::getRTLlanguages();
+ $short = CRM_Core_I18n_PseudoConstant::shortForLong($language);
+
+ return (in_array($short, $rtl));
+ }
/**
* Change the processing language without changing the current user language
return substr($long, 0, 2);
}
+ /**
+ * Returns a list of ISO 639-1 "right-to-left" language codes.
+ *
+ * @return array
+ */
+ public static function getRTLlanguages() {
+ $rtl = array(
+ 'ar',
+ 'fa',
+ 'he',
+ 'ur',
+ );
+
+ return $rtl;
+ }
+
}
'addressee.label' => 'civicrm_contact.addressee_id',
'email_greeting.label' => 'civicrm_contact.email_greeting_id',
'postal_greeting.label' => 'civicrm_contact.postal_greeting_id',
+ 'civicrm_phone.phone' => 'civicrm_phone.phone_numeric',
);
// the table names we support in dedupe rules - a filter for importableFields()
$supportedTables = array(
*/
public static function mailingGroupEntityTables() {
$tables = array(
- 'civicrm_group',
- 'civicrm_mailing',
+ CRM_Contact_BAO_Group::getTableName(),
+ CRM_Mailing_BAO_Mailing::getTableName(),
);
// Identical keys & values
return array_combine($tables, $tables);
if (!$this->_memType) {
$params = CRM_Utils_Request::exportValues();
- if (isset($params['membership_type_id'][1])) {
+ if (!empty($params['membership_type_id'][1])) {
$this->_memType = $params['membership_type_id'][1];
}
}
}
/**
- * @inheritdoc
+ * @inheritDoc
*/
public function limit($rowCount = self::ROW_COUNT_LIMIT) {
parent::limit($rowCount);
$this->addTask('Add Index to financial_trxn trxn_id field', 'addIndexFinancialTrxnTrxnID');
}
+ /**
+ * Upgrade function.
+ *
+ * @param string $rev
+ */
+ public function upgrade_4_7_1($rev) {
+ $this->addTask('Add Index to civicrm_contribution creditnote_id field', 'addIndexContributionCreditNoteID');
+ }
+
/**
* CRM-16354
*
return TRUE;
}
+ /**
+ * CRM-17882 Add index to civicrm_contribution.credit_note_id.
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
+ */
+ public function addIndexContributionCreditNoteID(CRM_Queue_TaskContext $ctx) {
+ $tables = array('civicrm_contribution' => array('creditnote_id'));
+ CRM_Core_BAO_SchemaHandler::createIndexes($tables);
+ return TRUE;
+ }
+
}
{* file to handle db changes in 4.7.1 during upgrade *}
+# CRM-17852 - Misspeled state names in Estonia/Lithuania
+
+#Estonia
+
+SET @EstoniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Estonia');
+
+UPDATE civicrm_state_province SET name = 'Harjumaa' where name='Harjumsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Hiiumaa' where name='Hitumea' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Ida-Virumaa' where name='Ida-Virumsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Jõgevamaa' where name='Jogevamsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Järvamaa' where name='Jarvamsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Läänemaa' where name='Lasnemsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Lääne-Virumaa' where name='Laane-Virumaa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Põlvamaa' where name='Polvamea' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Pärnumaa' where name='Parnumsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Raplamaa' where name='Raplamsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Saaremaa' where name='Saaremsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Tartumaa' where name='Tartumsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Viljandimaa' where name='Viljandimsa' AND country_id = @EstoniaCountryId;
+UPDATE civicrm_state_province SET name = 'Võrumaa' where name='Vorumaa' AND country_id = @EstoniaCountryId;
+
+#Lithuania
+
+SET @LithuaniaCountryId = (SELECT id FROM civicrm_country cc WHERE cc.name = 'Lithuania');
+
+UPDATE civicrm_state_province SET name = 'Klaipėdos Apskritis' where name='Klaipedos Apskritis' AND country_id = @LithuaniaCountryId;
+UPDATE civicrm_state_province SET name = 'Marijampolės Apskritis' where name='Marijampoles Apskritis' AND country_id = @LithuaniaCountryId;
+UPDATE civicrm_state_province SET name = 'Panevėžio Apskritis' where name='Panevezio Apskritis' AND country_id = @LithuaniaCountryId;
+UPDATE civicrm_state_province SET name = 'Šiaulių Apskritis' where name='Sisuliu Apskritis' AND country_id = @LithuaniaCountryId;
+UPDATE civicrm_state_province SET name = 'Tauragės Apskritis' where name='Taurages Apskritis' AND country_id = @LithuaniaCountryId;
+UPDATE civicrm_state_province SET name = 'Telšių Apskritis' where name='Telsiu Apskritis' AND country_id = @LithuaniaCountryId;
if (file_exists($file[0])) {
$messages[] = new CRM_Utils_Check_Message(
__FUNCTION__,
- ts('File \'%1\' presents a security risk and should be deleted.', array(1 => $file)),
+ ts('File \'%1\' presents a security risk and should be deleted.', array(1 => $file[0])),
ts('Unsafe Files'),
$file[1],
'fa-lock'
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param array $apiRequest
* @return array|mixed
*/
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @return array
*/
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @param string $entity
* @return array
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param array $apiRequest
* @return array
*/
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @return array
*/
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @param string $entity
* @return array
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param array $apiRequest
* @return array
* @throws \API_Exception
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @return array
*/
}
/**
- * {inheritdoc}
+ * @inheritDoc
* @param int $version
* @param string $entity
* @return array
};
$scope.openLink = function openLink(appMeta, page, options) {
- var promise = crmApi('Cxn', 'getlink', {app_guid: appMeta.appId, page: page}).then(function(result) {
+ var promise = crmApi('Cxn', 'getlink', {app_guid: appMeta.appId, page_name: page}).then(function(result) {
var mode = result.values.mode ? result.values.mode : 'popup';
switch (result.values.mode) {
case 'iframe':
$daoFields = CRM_Cxn_DAO_Cxn::fields();
$spec['app_guid'] = $daoFields['app_guid'];
$spec['cxn_guid'] = $daoFields['cxn_guid'];
- $spec['page'] = array(
- 'name' => 'page',
+ $spec['page_name'] = array(
+ 'name' => 'page_name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Page Type'),
'description' => 'The type of page (eg "settings")',
'maxlength' => 63,
'size' => CRM_Utils_Type::HUGE,
+ 'api.aliases' => array('page'),
);
}
$cxnId = _civicrm_api3_cxn_parseCxnId($params);
$appMeta = CRM_Cxn_BAO_Cxn::getAppMeta($cxnId);
- if (empty($params['page']) || !is_string($params['page'])) {
+ if (empty($params['page_name']) || !is_string($params['page_name'])) {
throw new API_Exception("Invalid page");
}
/** @var \Civi\Cxn\Rpc\RegistrationClient $client */
$client = \Civi::service('cxn_reg_client');
return $client->call($appMeta, 'Cxn', 'getlink', array(
- 'page' => $params['page'],
+ 'page' => $params['page_name'],
));
}
'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl(),
);
return civicrm_api3_create_success($result);
-
- $cxnId = _civicrm_api3_cxn_parseCxnId($params);
- $appMeta = CRM_Cxn_BAO_Cxn::getAppMeta($cxnId);
-
- if (empty($params['page']) || !is_string($params['page'])) {
- throw new API_Exception("Invalid page");
- }
-
- /** @var \Civi\Cxn\Rpc\RegistrationClient $client */
- $client = \Civi\Core\Container::singleton()->get('cxn_reg_client');
- return $client->call($appMeta, 'Cxn', 'getlink', array(
- 'page' => $params['page'],
- ));
}
/**
// The translation files are in the parent directory (l10n)
$i18n = CRM_Core_I18n::singleton();
+// Support for Arabic, Hebrew, Farsi, etc.
+// Used in the template.html
+$short_lang_code = CRM_Core_I18n_PseudoConstant::shortForLong($tsLocale);
+$text_direction = (CRM_Core_I18n::isLanguageRTL($tsLocale) ? 'rtl' : 'ltr');
+
global $cmsPath;
if ($installType == 'drupal') {
//CRM-6840 -don't force to install in sites/all/modules/
max-width: 1200px;
}
+.civicrm-logo {
+ float: right;
+}
+
form {
margin: 0;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $short_lang_code; ?>" lang="<?php echo $short_lang_code; ?>" dir="<?php echo $text_direction; ?>">
<head>
-<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-<title><?php echo ts('CiviCRM Installer'); ?></title>
-<link rel="stylesheet" type="text/css" href=<?php echo $installURLPath . "template.css"?> />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <title><?php echo ts('CiviCRM Installer'); ?></title>
+ <link rel="stylesheet" type="text/css" href=<?php echo $installURLPath . "template.css"?> />
+<?php
+if ($text_direction == 'rtl') {
+ echo " <link rel='stylesheet' type='text/css' href='{$installURLPath}template-rtl.css' />\n";
+}
+?>
</head>
-
<body>
<div id="All">
- <div style="float: right"><strong><?php echo ts('Version %1', array(1 => "{$civicrm_version['version']} {$civicrm_version['cms']}")); ?></strong><br/>
+ <div class="civicrm-logo"><strong><?php echo ts('Version %1', array(1 => "{$civicrm_version['version']} {$civicrm_version['cms']}")); ?></strong><br/>
<span><img src=<?php echo $installURLPath . "block_small.png"?> /></span>
</div>
filebrowserUploadUrl: uploadUrl + '&type=files',
filebrowserImageUploadUrl: uploadUrl + '&type=images',
filebrowserFlashUploadUrl: uploadUrl + '&type=flash',
+ allowedContent: true, // For CiviMail!
customConfig: CRM.config.CKEditorCustomConfig,
on: {
instanceReady: onReady
description: field.description || '',
required: !(!field['api.required'] || field['api.required'] === '0')
});
- if (joins[name]) {
+ if (typeof joins[name] === 'string') {
fields[pos].children = [];
populateFields(fields[pos].children, joins[name], 'get', name + '.');
}
return array($lineItems, $contributions);
}
+ /**
+ * checkLineItems() check if total amount matches the sum of line total
+ */
+ public function testcheckLineItems() {
+ $params = array(
+ 'contact_id' => 202,
+ 'receive_date' => '2010-01-20',
+ 'total_amount' => 100,
+ 'financial_type_id' => 3,
+ 'line_items' => array(
+ array(
+ 'line_item' => array(
+ array(
+ 'entity_table' => 'civicrm_contribution',
+ 'price_field_id' => 8,
+ 'price_field_value_id' => 16,
+ 'label' => 'test 1',
+ 'qty' => 1,
+ 'unit_price' => 100,
+ 'line_total' => 100,
+ ),
+ array(
+ 'entity_table' => 'civicrm_contribution',
+ 'price_field_id' => 8,
+ 'price_field_value_id' => 17,
+ 'label' => 'Test 2',
+ 'qty' => 1,
+ 'unit_price' => 200,
+ 'line_total' => 200,
+ 'financial_type_id' => 1,
+ ),
+ ),
+ 'params' => array(),
+ ),
+ ),
+ );
+ try {
+ $error = CRM_Contribute_BAO_Contribution::checkLineItems($params);
+ $this->fail("Missed expected exception");
+ }
+ catch (Exception $e) {
+ $this->assertEquals("Line item total doesn't match with total amount.", $e->getMessage());
+ }
+ $this->assertEquals(3, $params['line_items'][0]['line_item'][0]['financial_type_id']);
+ $params['total_amount'] = 300;
+ CRM_Contribute_BAO_Contribution::checkLineItems($params);
+ }
+
}
<type>Text</type>
</html>
</field>
+ <index>
+ <name>creditnote_id</name>
+ <fieldName>creditnote_id</fieldName>
+ <add>4.7</add>
+ </index>
<field>
<name>tax_amount</name>
<title>Tax Amount</title>
(2373, 1064, "U", "Sucumbios"),
(2374, 1064, "T", "Tungurahua"),
(2375, 1064, "Z", "Zamora-Chinchipe"),
-(2376, 1069, "37", "Harjumsa"),
-(2377, 1069, "39", "Hitumea"),
-(2378, 1069, "44", "Ida-Virumsa"),
-(2379, 1069, "49", "Jogevamsa"),
-(2380, 1069, "51", "Jarvamsa"),
-(2381, 1069, "57", "Lasnemsa"),
-(2382, 1069, "59", "Laane-Virumaa"),
-(2383, 1069, "65", "Polvamea"),
-(2384, 1069, "67", "Parnumsa"),
-(2385, 1069, "70", "Raplamsa"),
-(2386, 1069, "74", "Saaremsa"),
-(2387, 1069, "7B", "Tartumsa"),
+(2376, 1069, "37", "Harjumaa"),
+(2377, 1069, "39", "Hiiumaa"),
+(2378, 1069, "44", "Ida-Virumaa"),
+(2379, 1069, "49", "Jõgevamaa"),
+(2380, 1069, "51", "Järvamaa"),
+(2381, 1069, "57", "Läänemaa"),
+(2382, 1069, "59", "Lääne-Virumaa"),
+(2383, 1069, "65", "Põlvamaa"),
+(2384, 1069, "67", "Pärnumaa"),
+(2385, 1069, "70", "Raplamaa"),
+(2386, 1069, "74", "Saaremaa"),
+(2387, 1069, "7B", "Tartumaa"),
(2388, 1069, "82", "Valgamaa"),
-(2389, 1069, "84", "Viljandimsa"),
-(2390, 1069, "86", "Vorumaa"),
+(2389, 1069, "84", "Viljandimaa"),
+(2390, 1069, "86", "Võrumaa"),
(2391, 1065, "DK", "Ad Daqahllyah"),
(2392, 1065, "BA", "Al Bahr al Ahmar"),
(2393, 1065, "BH", "Al Buhayrah"),
(3511, 1121, "K", "Thaba-Tseka"),
(3512, 1125, "AL", "Alytaus Apskritis"),
(3513, 1125, "KU", "Kauno Apskritis"),
-(3514, 1125, "KL", "Klaipedos Apskritis"),
-(3515, 1125, "MR", "Marijampoles Apskritis"),
-(3516, 1125, "PN", "Panevezio Apskritis"),
-(3517, 1125, "SA", "Sisuliu Apskritis"),
-(3518, 1125, "TA", "Taurages Apskritis"),
-(3519, 1125, "TE", "Telsiu Apskritis"),
+(3514, 1125, "KL", "Klaipėdos Apskritis"),
+(3515, 1125, "MR", "Marijampolės Apskritis"),
+(3516, 1125, "PN", "Panevėžio Apskritis"),
+(3517, 1125, "SA", "Šiaulių Apskritis"),
+(3518, 1125, "TA", "Tauragės Apskritis"),
+(3519, 1125, "TE", "Telšių Apskritis"),
(3520, 1125, "UT", "Utenos Apskritis"),
(3521, 1125, "VL", "Vilniaus Apskritis"),
(3522, 1126, "D", "Diekirch"),