When a renewal and new subscription are in a single transaction the new subscription is treated as a renewal. I think it is caused by the extraction in store_transaction_load (store.module:1299) which has a database query:

$result = db_query('SELECT stp.*, r.rtxnid as rtxnid, r.rnid as rnid, p.ptype
FROM {ec_transaction_product} stp
LEFT JOIN {ec_renewal} r ON stp.txnid = r.txnid
LEFT JOIN {ec_product} p ON stp.vid = p.vid
WHERE stp.txnid = %d', $t->txnid);

which I believe should try to match the product id in stp.nid = r.rnid in the LEFT JOIN with ec_renewal as follows:

$result = db_query('SELECT stp.*, r.rtxnid as rtxnid, r.rnid as rnid, p.ptype
FROM {ec_transaction_product} stp
LEFT JOIN {ec_renewal} r ON stp.txnid = r.txnid AND stp.nid = r.rnid
LEFT JOIN {ec_product} p ON stp.vid = p.vid
WHERE stp.txnid = %d', $t->txnid);

Hope this helps.

Comments

brmassa’s picture

Status: Active » Closed (fixed)

this bug is just too old. in case it persists on eC4, please, reponen it.