Upon viewing my Order History, Watchdog lists these two errors, one for each line in the order history:
Location http://shop.rifftrax.com/user/6/orders?sort=asc&order=Status
Referrer http://shop.rifftrax.com/user/6/orders
Message strtr() [function.strtr]: The second argument is not an array. in /var/www/vhosts/rifftrax.com/subdomains/shop/httpdocs/includes/common.inc on line 749.
Location http://shop.rifftrax.com/user/6/orders?sort=asc&order=Status
Referrer http://shop.rifftrax.com/user/6/orders
Message Invalid argument supplied for foreach() in /var/www/vhosts/rifftrax.com/subdomains/shop/httpdocs/includes/common.inc on line 734.
These are the two referenced functions:
<?php
file: common.inc
function t($string, $args = 0) {
global $locale;
if (function_exists('locale') && $locale != 'en') {
$string = locale($string);
}
if (!$args) {
return $string;
}
else {
// Transform arguments before inserting them
foreach ($args as $key => $value) {
switch ($key[0]) {
// Escaped only
case '@':
$args[$key] = check_plain($value);
break;
// Escaped and placeholder
case '%':
default:
$args[$key] = theme('placeholder', $value);
break;
// Pass-through
case '!':
}
}
return strtr($string, $args);
}
}
?><?php
file: uc_order.module
function uc_order_history($uid) {
drupal_set_title(t('My order history'));
$breadcrumb = drupal_get_breadcrumb();
$breadcrumb[] = l(t('My account'), 'user/'. arg(1));
drupal_set_breadcrumb($breadcrumb);
$header = array(
array('data' => t('Date'), 'field' => 'o.created', 'sort' => 'desc'),
array('data' => t('Order #'), 'field' => 'o.order_id'),
array('data' => t('Status'), 'field' => 'os.title'),
array('data' => t('Products'), 'field' => 'products'),
array('data' => t('Total'), 'field' => 'o.order_total')
);
$result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $uid);
// Build a table based on the customer's orders.
while ($order = db_fetch_object($result)){
$link = l($order->order_id, 'user/'. $uid .'/order/'. $order->order_id);
if (user_access('view all orders')){
$link .= '<span class="order-admin-icons">'. uc_order_actions($order, TRUE) .'</span>';
}
$rows[] = array(
array('data' => date('m/d/Y', $order->created)),
array('data' => $link, 'nowrap' => 'nowrap'),
array('data' => $order->title),
array('data' => (!is_null($order->products) ? $order->products : 0), 'align' => 'center'),
array('data' => uc_currency_format($order->total, TRUE), 'align' => 'right'),
);
}
$output = theme('table', $header, $rows) . theme('pager', NULL, 20, 0);
return
$output;
}
?>The errors look like they have to do with returning a message using the t('') function. Not sure where else to look at this point. I would hate to have these errors clogging up our database since we have thousands of users with dozens of orders each. It'd make cleaning out the watchdog table a chore!
Anyway - I haven't changed anything in the order module, except for how the order_id is created (it is now based on unix timestamp and not just the next incremental integer in the db). Using drupal5.2 and Alpha7e (latest bzr update).


