Closed (fixed)
Project:
e-Commerce
Version:
6.x-4.x-dev
Component:
ec_store
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jul 2010 at 06:00 UTC
Updated:
31 Aug 2010 at 13:00 UTC
This might issue might belong under ec_receipt, not ec_store.
A warning is received when reversing an allocation via ec_receipt_reverse_allocation_form [store/receipt/%ec_receipt/reverse/%]:
warning: Missing argument 3 for ec_store_alloc_allocation() in ecommerce/ec_store/ec_store.alloc.inc on line 89.
Is it possible the warning is originating in the ec_receipt.admin.inc function ec_receipt_reverse_allocation in the call to ec_receipt_alloc_invoke($alloc->type, 'allocation', $object, $total - $reversal->amount)?
/**
* Reverse Allocation.
* TODO: Convert to use drupal_write_record.
*/
function ec_receipt_reverse_allocation($receipt, $alloc) {
if ($object = ec_receipt_alloc_invoke($alloc->type, 'load', $alloc->etid)) {
if ((ec_receipt_alloc_invoke($alloc->type, 'can_reverse', $object)) === FALSE) {
return FALSE;
}
$total = ec_receipt_alloc_invoke($alloc->type, 'get_total', $object);
$reversal = drupal_clone($alloc);
$reversal->eaid = db_last_insert_id('ec_receipt_allocation', 'eaid');
$reversal->created = time();
$reversal->amount*= -1;
$reversal->reversed = $alloc->eaid;
$receipt->allocated+= $reversal->amount;
$receipt->balance-= $reversal->amount;
ec_receipt_alloc_invoke($alloc->type, 'allocation', $object, $total - $reversal->amount);
$sql = "INSERT INTO {ec_receipt_allocation} (eaid, erid, type, etid, created, amount, reversed) VALUES (%d, %d, '%s', '%s', %d, %d, %d)";
db_query($sql, (array)$reversal);
db_query('UPDATE {ec_receipt_allocation} SET reversed = %d WHERE eaid = %d', $reversal->eaid, $alloc->eaid);
ec_receipt_save($receipt);
return TRUE;
}
}
Also should the balance be checked on reversal to prevent multiple reversals?
Thank you.
Comments
Comment #1
gordon commentedThanks I have fixed this now in dev.