I think this is a bug, I'vve been tracing through all the code to learn how everything works. My reports are based ont he 4.6.0 release of the e-commerce suite.

Below the $edit array is passed in to store_transaction_validate() along with $error. The output of this function overwrites $edit.

payment.module - line 387:
$edit = store_transaction_validate($edit, $error);

Looking at the code behind store_transaction_validate()

store.module - line 435:
function store_transaction_validate(&$edit) {

  switch (strtoupper($edit['section'])) {

    case 'OVERVIEW':
      store_transaction_validate_overview($edit);
      break;

    case 'ADDRESSES':
      store_transaction_validate_addresses($edit);
      break;

    case 'ITEMS':
      store_transaction_validate_item($edit);
      break;

    default:
      store_transaction_validate_overview($edit);
      store_transaction_validate_addresses($edit);
      store_transaction_validate_item($edit);
  }

  return ((form_get_errors()) ? false : true);
}

You can see that the above function is returning a BOOLEAN which in turn overwrites the $edit[] variable! Surely this can't be correct? Also, the store_transaction_validate() doesn't take a 2nd parameter, so I think the changes in payment.module should be something like:

$error = store_transaction_validate($edit);

Maybe i'm barking up the wrong tree though?

CommentFileSizeAuthor
#2 paymentmodule.diff375 bytesbudda

Comments

budda’s picture

Is store_transaction_validate() supposed to return a BOOLEAN success flag (ie. FALSE if something failed validation), or a BOOLEAN to say if there were errors (ie. TRUE if there were errors) ?

budda’s picture

StatusFileSize
new375 bytes

Attached MyFirstPatch™ to solve this problem.

matt westgate’s picture

Assigned: Unassigned » matt westgate

Patch applied to 4.6 and HEAD. Thanks!

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Méléis’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

Status: Fixed » Closed (fixed)