Definition

ec_anon_customer_get_name($customer)
ecommerce-5--4/ec_anon/ec_anon.module, line 262

Code

<?php
function ec_anon_customer_get_name($customer) {
  $result = db_query('SELECT sta.fullname, sta.firstname, sta.lastname FROM {ec_customer} ec INNER JOIN {ec_transaction} st ON ec.ecid = st.ecid INNER JOIN {ec_transaction_address} sta ON st.txnid = sta.txnid WHERE ec.ecid = %d AND (sta.fullname OR sta.firstname OR sta.lastname) ORDER BY st.txnid DESC, sta.type ASC LIMIT 1', $customer->ecid);
  $info = db_fetch_object($result);

  if (!empty($info->fullname)) {
    $name = $info->fullname;
  }
  else {
    $name = trim($info->firstname .' '. $info->lastname);
  }
  return $name;
}
?>