Merge pull request #7691 from jitendrapurohit/CRM-17863
authorEileen McNaughton <eileen@mcnaughty.com>
Mon, 1 Feb 2016 20:53:13 +0000 (09:53 +1300)
committerEileen McNaughton <eileen@mcnaughty.com>
Mon, 1 Feb 2016 20:53:13 +0000 (09:53 +1300)
CRM-17863 -- Payments don't appear to be linked to Contribution when …

25 files changed:
CRM/Admin/Form/Navigation.php
CRM/Contribute/BAO/Contribution.php
CRM/Core/DAO.php
CRM/Core/I18n.php
CRM/Core/I18n/PseudoConstant.php
CRM/Dedupe/BAO/RuleGroup.php
CRM/Mailing/BAO/Mailing.php
CRM/Member/Form/Membership.php
CRM/Report/Form/Event/Income.php
CRM/Upgrade/Incremental/php/FourSeven.php
CRM/Upgrade/Incremental/sql/4.7.1.mysql.tpl
CRM/Utils/Check/Component/Security.php
Civi/API/Provider/AdhocProvider.php
Civi/API/Provider/MagicFunctionProvider.php
Civi/API/Provider/ReflectionProvider.php
ang/crmCxn/ManageCtrl.js
api/v3/Cxn.php
install/index.php
install/template.css
install/template.html
js/wysiwyg/crm.ckeditor.js
templates/CRM/Admin/Page/APIExplorer.js
tests/phpunit/CRM/Contribute/BAO/ContributionTest.php
xml/schema/Contribute/Contribution.xml
xml/templates/civicrm_state_province.tpl

index 318e5bfa8424001d3e1a6923a823d04a6a2826e9..846ab4636029471a14d44aad115527eb402f4053 100644 (file)
@@ -85,7 +85,7 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form {
     $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();
index 0835aeb00ad5d2d204c1e39870feace04ca17c94..e49d8a7b87b849940a7ca27306f52fcbd4b4a7e3 100644 (file)
@@ -4829,4 +4829,30 @@ LIMIT 1;";
     }
   }
 
+  /**
+   * 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.");
+    }
+  }
+
 }
index 76892fb6267ddcf456c598b44ef220a03cad255e..189b6c8d59a626440de68f4d23b33d6c1fdba50d 100644 (file)
@@ -1166,6 +1166,64 @@ FROM   civicrm_domain
     $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.
    *
index 59a5f7b2c7a611098affa59f9e14f959681736a3..61a932ef5652c2695597c5ddff24b8fae72cd7be 100644 (file)
@@ -542,6 +542,21 @@ class CRM_Core_I18n {
     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
index 555f2ec237f9b09faa585b95d91a513abd982b18..91d850fef0dbd013f34ff28d57f07407b4a19388 100644 (file)
@@ -78,4 +78,20 @@ class CRM_Core_I18n_PseudoConstant {
     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;
+  }
+
 }
index 1616392f6d04371c248867deb714c4586d5834a0..aaca7d84d0d24129059d8597dc1e298ee37a38e8 100644 (file)
@@ -77,6 +77,7 @@ class CRM_Dedupe_BAO_RuleGroup extends CRM_Dedupe_DAO_RuleGroup {
         '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(
index 4fcf26f6e10d9e2a471570e8f41f480f62f0dafa..330bb9c8d95f8a3d3e0d2ed609bb93338dac31d9 100644 (file)
@@ -3139,8 +3139,8 @@ AND        m.id = %1
    */
   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);
index 059d6cb70c11f0e4a11a6c0086df0a03dd30b3cd..0ddedb633a5e3b78f6f3ee51b0c791da4cba772a 100644 (file)
@@ -243,7 +243,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
 
     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];
       }
     }
index 60b4c3bec7d9cf97afc7a0acff1b9c6f354ee5d7..51e869c7077f127656063b4837d642f5cfc3589d 100644 (file)
@@ -279,7 +279,7 @@ class CRM_Report_Form_Event_Income extends CRM_Report_Form_Event {
   }
 
   /**
-   * @inheritdoc
+   * @inheritDoc
    */
   public function limit($rowCount = self::ROW_COUNT_LIMIT) {
     parent::limit($rowCount);
index 0d1dd5601f6b02f53e9c609788ed1bd436c559ca..da42435c132bd65caba3ba2b90656b2ce398d06c 100644 (file)
@@ -145,6 +145,15 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
     $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
    *
@@ -405,4 +414,17 @@ FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id";
     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;
+  }
+
 }
index 65ea99d5a178d91a14af83556bd0f5b2af8a9c80..3dc0b34d14ae7581ed815e66ddfcefb51a7c83e6 100644 (file)
@@ -1 +1,32 @@
 {* 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;
index 828ccf69d473d6a4eb7f44477efcba167c2a17b8..3d2e37ec5e579303cf43c86b26dab9b794a97167 100644 (file)
@@ -246,7 +246,7 @@ class CRM_Utils_Check_Component_Security extends CRM_Utils_Check_Component {
       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'
index 93612675405720130acce9d3fdb6058dcddc7b64..3664a17f20d66402a392530279dbed30bd15743b 100644 (file)
@@ -123,7 +123,7 @@ class AdhocProvider implements EventSubscriberInterface, ProviderInterface {
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param array $apiRequest
    * @return array|mixed
    */
@@ -132,7 +132,7 @@ class AdhocProvider implements EventSubscriberInterface, ProviderInterface {
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @return array
    */
@@ -141,7 +141,7 @@ class AdhocProvider implements EventSubscriberInterface, ProviderInterface {
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @param string $entity
    * @return array
index 5ecf8bddcabeb8561074ecf29ffd4cea9759958a..2dbe6679c1434eaf36addd31a091d6169707321d 100644 (file)
@@ -73,7 +73,7 @@ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterfa
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param array $apiRequest
    * @return array
    */
@@ -92,7 +92,7 @@ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterfa
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @return array
    */
@@ -134,7 +134,7 @@ class MagicFunctionProvider implements EventSubscriberInterface, ProviderInterfa
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @param string $entity
    * @return array
index c750ff7be1bfd61234769e3ba84ef81c646ee213..aebc8057f200592303a55c4e3b1045b74e76d5bd 100644 (file)
@@ -104,7 +104,7 @@ class ReflectionProvider implements EventSubscriberInterface, ProviderInterface
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param array $apiRequest
    * @return array
    * @throws \API_Exception
@@ -128,7 +128,7 @@ class ReflectionProvider implements EventSubscriberInterface, ProviderInterface
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @return array
    */
@@ -137,7 +137,7 @@ class ReflectionProvider implements EventSubscriberInterface, ProviderInterface
   }
 
   /**
-   * {inheritdoc}
+   * @inheritDoc
    * @param int $version
    * @param string $entity
    * @return array
index 12bba3c4e5aad7d5954e2270edd802845af68050..b23901b0cf4fc6413309efbbed114d641361e6d3 100644 (file)
@@ -98,7 +98,7 @@
     };
 
     $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':
index 25d9ee9f5a0151719c7dbf880b130c2e204a93de..c080f70761dcafef0cf76090d3f3204d5e256c34 100644 (file)
@@ -222,13 +222,14 @@ function _civicrm_api3_cxn_getlink_spec(&$spec) {
   $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'),
   );
 }
 
@@ -245,14 +246,14 @@ function civicrm_api3_cxn_getlink($params) {
   $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'],
   ));
 }
 
@@ -270,19 +271,6 @@ function civicrm_api3_cxn_getcfg($params) {
     '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'],
-  ));
 }
 
 /**
index adc88051aed2ef3faedb7c11647d495ec5a9bbcd..1cfaf0b35e755d271402777041a038bbd9714f56 100644 (file)
@@ -185,6 +185,11 @@ $GLOBALS['civicrm_default_error_scope'] = NULL;
 // 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/
index ff81f26af33e8bb1e55382bec9448c49ae504043..7c96816e54a72f86dbc65a20edf9a614f080be6a 100644 (file)
@@ -13,6 +13,10 @@ body {
   max-width: 1200px;
 }
 
+.civicrm-logo {
+  float: right;
+}
+
 form {
   margin: 0;
 }
index d63821166cd08148b3835dea78526b71adc4e727..7fcd53e4cbce32b1a9c538b5be2054305e8032a9 100644 (file)
@@ -1,15 +1,19 @@
 <!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>
 
index 4f8e9cb80d85adcd8e748035fd714912a5bea4d0..5130121f84574f52fffde179e27faf11b8166976 100644 (file)
@@ -75,6 +75,7 @@
         filebrowserUploadUrl: uploadUrl + '&type=files',
         filebrowserImageUploadUrl: uploadUrl + '&type=images',
         filebrowserFlashUploadUrl: uploadUrl + '&type=flash',
+        allowedContent: true, // For CiviMail!
         customConfig: CRM.config.CKEditorCustomConfig,
         on: {
           instanceReady: onReady
index 3696c7ce6190b1322b82422d14b71c3913ced8b7..62f2fe5b2dd677b5ed6493a593519af65899dc51 100644 (file)
@@ -82,7 +82,7 @@
         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 + '.');
       }
index 3399bfea8e7a1dad0a59fdd142dcf1d2a95a9dc4..4061b0f7bc63a4a255360361edf9fbd0cd6f9aad 100644 (file)
@@ -783,4 +783,52 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     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);
+  }
+
 }
index db883c14e63fb91a3b05fd1e676ab48c3cb092c6..ea95a36ab7024e87a7e715265e9cf0de4b967de1 100644 (file)
       <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>
index d08e1ce185ee08384e9c6fd7d3272e2b0e809762..f70829e25e6588157b54a4029841b5354cf9ca02 100644 (file)
@@ -1009,21 +1009,21 @@ INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
 (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"),
@@ -1996,12 +1996,12 @@ INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES
 (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"),