You are here

function commerce_gc_transaction_change_status in Commerce GC 7

Given a set of transaction ids, set any that match a certain status to a target status.

Parameters

type $order:

type $status:

2 calls to commerce_gc_transaction_change_status()
commerce_gc_commerce_coupon_final_checkout_transaction_rollback in ./commerce_gc.module
commerce_gc_order_transaction_status_change in ./commerce_gc.rules.inc

File

./commerce_gc.module, line 851
Provides Giftcard coupon bundle, Giftcard Transaction entity and basic user interface elements.

Code

function commerce_gc_transaction_change_status($transaction_ids, $statuses, $target_status) {
  $transactions = commerce_gc_transaction_load_multiple($transaction_ids);

  // Save each individually so that the entity save controllers are triggered
  // in case we implement more advanced logging later. There should always be
  // a very small number of items here so performance is not an issue.
  foreach ($transactions as $transaction) {
    if (in_array($transaction->status, $statuses)) {
      $transaction->status = $target_status;
      commerce_gc_transaction_save($transaction);
    }
  }
}