Skip to content

Commit

Permalink
fixed Project60#60
Browse files Browse the repository at this point in the history
  • Loading branch information
bjendres committed Sep 22, 2014
1 parent db1ce46 commit 63cae5e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion extension/CRM/Banking/PluginModel/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ function openTransactionBatch($batch_id = 0) {
$this->_current_transaction_batch->tx_count = 0;
// /\

// add a (unique) default reference (see https://github.com/Project60/CiviBanking/issues/60)
$this->_current_transaction_batch->reference = 'NOREF-' . md5(microtime());
$this->_current_transaction_batch->save();
$this->_current_transaction_batch_attributes['isnew'] = TRUE;
$this->_current_transaction_batch_attributes['sum'] = 0;
Expand Down Expand Up @@ -173,8 +175,11 @@ function closeTransactionBatch($store = TRUE) {
$this->_current_transaction_batch->ending_date = $this->_current_transaction_batch_attributes['ending_date'];

// set default bank reference, if not set
if (!$this->_current_transaction_batch->reference)
if ( $this->_current_transaction_batch->reference == NULL
|| substr($this->_current_transaction_batch->reference, 0, 6) == 'NOREF-') {
// replace generic references, starting with 'NOREF-'
$this->_current_transaction_batch->reference = "{md5}";
}

// replace tokens
$reference = $this->_current_transaction_batch->reference;
Expand Down

0 comments on commit 63cae5e

Please sign in to comment.