Answers.Body: <p>Well this is not really an answer but it is a workaround. We've found that when creating the batch, if we specify the Payment Instrument (e.g. Credit Card) then it works. So we can get around this for now by doing separate batches for credit cards and checks.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-08T17:30:19.357Z
Answers.LastActivityDate: 2016-06-08T17:30:19.357Z
Answers.UserDisplayName: Laryn
Body: <p>I have imported (tens of) thousands of historic contributions to a site that uses Accounting Batches regularly. They were starting to bog down the batch assignment page so I thought I would simply create an administrative batch, drop them in via SQL directly as follows, and then be done with them.</p>
  
  <pre><code>insert into `civicrm_entity_batch` (entity_table,entity_id,batch_id) 
  select 'civicrm_financial_trxn',trxn.`id`,188 from `civicrm_financial_trxn` trxn 
  where trxn.`trxn_id` LIKE 'archive_%';
  </code></pre>
  
  <p>In the SQL above, I am inserting the string 'civicrm_financial_trxn' into the <code>entity_table</code> field, the id, and then the number 188 (which is the ID of the new batch I created). Also, all the transaction IDs for these archival records have been prepended with 'archive_' (hence the <code>where</code> clause above to choose just these contributions).</p>
  
  <p>This works for the most part (the transactions show up in the batch, and I can close it as I would expect), but there is a kicker. Now in any new batches, the bottom portion of the page where you typically assign transactions to the batch never stops "Processing":</p>
  
  <p><a href="https://i.sstatic.net/sAkEw.png" rel="noreferrer"><img src="https://i.sstatic.net/sAkEw.png" alt="Batch assign"></a></p>
  
  <p>The Drupal watchdog has a few notices:</p>
  
  <pre><code>Strict warning: Non-static method CRM_Batch_BAO_Batch::links() should not be 
  called statically in CRM_Batch_BAO_Batch::links() (line 280 of 
  /var/www/public_html/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php).
  </code></pre>
  
  <p>and </p>
  
  <pre><code>Notice: Undefined index: batch_type in 
  CRM_Batch_BAO_Batch::getBatchListSelector() (line 230 of 
  /var/www/public_html/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php).
  </code></pre>
  
  <p>Does anyone have an idea what this might mean? The archival imports were not intended to be fully integrated into the Financial/Accounting portion (they were batched and dealt with in a previous system) but were meant simply as informational background on contacts.</p>
  
  <p>How can I troubleshoot/fix this?</p>
  
Tags: <mysql><sql><batches>
Title: Dropping thousands of records into a batch via SQL
ThreadText: # Dropping thousands of records into a batch via SQL
  
  (Asked by: username_0 on 2016-06-03)
  
  I have imported (tens of) thousands of historic contributions to a site that uses Accounting Batches regularly. They were starting to bog down the batch assignment page so I thought I would simply create an administrative batch, drop them in via SQL directly as follows, and then be done with them.
  
  ```
  insert into `civicrm_entity_batch` (entity_table,entity_id,batch_id) 
  select 'civicrm_financial_trxn',trxn.`id`,188 from `civicrm_financial_trxn` trxn 
  where trxn.`trxn_id` LIKE 'archive_%';
  
  ```
  
  In the SQL above, I am inserting the string 'civicrm\_financial\_trxn' into the `entity_table` field, the id, and then the number 188 (which is the ID of the new batch I created). Also, all the transaction IDs for these archival records have been prepended with 'archive\_' (hence the `where` clause above to choose just these contributions).
  
  This works for the most part (the transactions show up in the batch, and I can close it as I would expect), but there is a kicker. Now in any new batches, the bottom portion of the page where you typically assign transactions to the batch never stops "Processing":
  
  [![Batch assign](https://i.sstatic.net/sAkEw.png)](https://i.sstatic.net/sAkEw.png)
  
  The Drupal watchdog has a few notices:
  
  ```
  Strict warning: Non-static method CRM_Batch_BAO_Batch::links() should not be 
  called statically in CRM_Batch_BAO_Batch::links() (line 280 of 
  /var/www/public_html/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php).
  
  ```
  
  and
  
  ```
  Notice: Undefined index: batch_type in 
  CRM_Batch_BAO_Batch::getBatchListSelector() (line 230 of 
  /var/www/public_html/sites/all/modules/civicrm/CRM/Batch/BAO/Batch.php).
  
  ```
  
  Does anyone have an idea what this might mean? The archival imports were not intended to be fully integrated into the Financial/Accounting portion (they were batched and dealt with in a previous system) but were meant simply as informational background on contacts.
  
  How can I troubleshoot/fix this?
  
  **Tags:** mysql, sql, batches
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-06-08. Score: 1
  
  Well this is not really an answer but it is a workaround. We've found that when creating the batch, if we specify the Payment Instrument (e.g. Credit Card) then it works. So we can get around this for now by doing separate batches for credit cards and checks.
  
  
  ---
  
  