Answers.Body: <p>I believe the standard workflow for accounting requires a single currency per batch. At least that was all that we aimed to support. Please create an issue at lab.civicrm.org indicating that there should be a 'friendly' error message preventing transactions that have a different currency from ones already in the batch from being added. This should include an error in case of an attempt to simultaneously add transactions in more than one currency.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-24T01:16:34.083Z
Answers.Text: Posted at [link](https://lab.civicrm.org/dev/financial/issues/89)
Answers.UserDisplayName: user9611631
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-25T14:42:56.307Z
Answers.Text: Thanks, @KLeeHK. I've assigned the issue to myself, but I'm not sure when I will be able to prioritize it. Cheers.
Answers.UserDisplayName: Joe Murray
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-22T19:37:52.723Z
Answers.LastActivityDate: 2019-10-22T19:37:52.723Z
Answers.UserDisplayName: Joe Murray
Body: <p>My setup: CiviCRM 5.18.3 on Drupal 7.</p>
  
  <p>I created a Contribution batch.
  At transactions I chose two transactions of difference currencies e.g. HKD and USD and Assign them to a batch.
  Then I no longer be able to retrieve the list of batches because of fatal error:
  Dialog:
  DataTables warning: table id=crm-batch-selector-2 - Ajax error. For more information about this error, please see <a href="http://datatables.net/tn/7" rel="nofollow noreferrer">http://datatables.net/tn/7</a></p>
  
  <p>In ConfigAndLog there are lines produced e.g. CRM_Core_Exception .... Invalid currency "HKD,USD" blah blah.....</p>
  
  <p>Even I cancel the offending transaction it does not help. I had to delete the transaction in that batch to revive the batch's functioning.</p>
  
  <p>Please kindly advise.</p>
  
  <p>Best Regards,</p>
  
  <pre><code>2019-10-17 (too long to add to comments).
  I copied this from ConfigAndLog, because no on-screen backtrace is shown even I enabled backtrace at System setting.
  Oct 17 09:53:08  [debug] $backTrace = #0
  /var/www/c53/web/sites/all/modules/civicrm/CRM/Core/Error.php(463): 
   CRM_Core_Error::backtrace("backTrace", TRUE)
  
  #1 /var/www/c53/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(55): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  
  #2 /var/www/c53/web/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  
  #3 /var/www/c53/web/includes/menu.inc(527): civicrm_invoke("ajax", "batchlist")
  
  #4 /var/www/c53/web/index.php(21): menu_execute_active_handler()
  
  #5 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-16T15:06:37.733Z
Comments.Text: Did this work previously? I know contribution batches have been reworked recently.  Also - please add the full error and backtrace to your question, it helps folks to diagnose the problem!
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-17T01:56:27.130Z
Comments.Text: More info: If I put the expected amount for the batch, the error appears as soon as I assign a contribution of a different currency. If I leave the expected amount empty, the error appears when I close the batch. Then I am no longer able to retrieve a list of closed batch.
Comments.UserDisplayName: user9611631
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-17T01:59:14.057Z
Comments.Text: Added backtrace at main post.
Comments.UserDisplayName: user9611631
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-17T02:12:02.247Z
Comments.Text: @Jon G megaphone. I am still evaluating so no prior working history. But I first encountered this problem with version 5.17.4. Then I upgraded to the latest 5.18.3 just to see the same problem still there.
Comments.UserDisplayName: user9611631
Tags: <civicontribute><ajax><batches><currency>
Title: A contribution batch containing transactions of more than one currencies causes fatal error
ThreadText: # A contribution batch containing transactions of more than one currencies causes fatal error
  
  (Asked by: username_0 on 2019-10-16)
  
  My setup: CiviCRM 5.18.3 on Drupal 7.
  
  I created a Contribution batch.
  At transactions I chose two transactions of difference currencies e.g. HKD and USD and Assign them to a batch.
  Then I no longer be able to retrieve the list of batches because of fatal error:
  Dialog:
  DataTables warning: table id=crm-batch-selector-2 - Ajax error. For more information about this error, please see <http://datatables.net/tn/7>
  
  In ConfigAndLog there are lines produced e.g. CRM\_Core\_Exception .... Invalid currency "HKD,USD" blah blah.....
  
  Even I cancel the offending transaction it does not help. I had to delete the transaction in that batch to revive the batch's functioning.
  
  Please kindly advise.
  
  Best Regards,
  
  ```
  2019-10-17 (too long to add to comments).
  I copied this from ConfigAndLog, because no on-screen backtrace is shown even I enabled backtrace at System setting.
  Oct 17 09:53:08  [debug] $backTrace = #0
  /var/www/c53/web/sites/all/modules/civicrm/CRM/Core/Error.php(463): 
   CRM_Core_Error::backtrace("backTrace", TRUE)
  
  #1 /var/www/c53/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(55): CRM_Core_Error::handleUnhandledException(Object(CRM_Core_Exception))
  
  #2 /var/www/c53/web/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  
  #3 /var/www/c53/web/includes/menu.inc(527): civicrm_invoke("ajax", "batchlist")
  
  #4 /var/www/c53/web/index.php(21): menu_execute_active_handler()
  
  #5 {main}
  
  ```
  
  **Tags:** civicontribute, ajax, batches, currency
  
  > **Comments:**
  > **username_1**: Did this work previously? I know contribution batches have been reworked recently.  Also - please add the full error and backtrace to your question, it helps folks to diagnose the problem!  
  > **username_0**: More info: If I put the expected amount for the batch, the error appears as soon as I assign a contribution of a different currency. If I leave the expected amount empty, the error appears when I close the batch. Then I am no longer able to retrieve a list of closed batch.  
  > **username_0**: Added backtrace at main post.  
  > **username_0**: @Jon G megaphone. I am still evaluating so no prior working history. But I first encountered this problem with version 5.17.4. Then I upgraded to the latest 5.18.3 just to see the same problem still there.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-10-22. Score: 1 | Accepted answer
  
  I believe the standard workflow for accounting requires a single currency per batch. At least that was all that we aimed to support. Please create an issue at lab.civicrm.org indicating that there should be a 'friendly' error message preventing transactions that have a different currency from ones already in the batch from being added. This should include an error in case of an attempt to simultaneously add transactions in more than one currency.
  
  > **Comments:**
  > **username_0**: Posted at [link](https://lab.civicrm.org/dev/financial/issues/89)  
  > **username_2**: Thanks, @KLeeHK. I've assigned the issue to myself, but I'm not sure when I will be able to prioritize it. Cheers.  
  
  ---
  
  