In my last post I suggested in might be to do with a redirect and in trying to nail this down further so anyone with the skills/time can hopefully suggest a fix I remembered that ZC would kindly generated a myDEBUG-adm-xxx.log in the /cache folder for us :)
In my case the error message reads:
Code:
PHP Fatal error:  Call to undefined function date_diff() in /home/path/to/domain.com/public_html/admin/super_orders.php on line 123
I guess this means it's not because the redirect is wrong, it's just not completing hence no page being displayed.

These are the lines of code from 121 - 128 which should give some context to the error.
(line 123 begins with $zc_max_days = date_diff )
Code:
          if ($status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
            // adjust download_maxdays based on current date
            $zc_max_days = date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s', time())) + DOWNLOAD_MAX_DAYS;

            $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='" . $zc_max_days . "', download_count='" . DOWNLOAD_MAX_COUNT . "' where orders_id='" . (int)$oID . "'";
            $db->Execute($update_downloads_query);
          }
          $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
The note on ln 122 suggests something has been tweaked and I have no idea what date_diff is or does or even why it isn't defined.
Any ideas on what will break if I comment out line 123 ?
or is it simpler to define date_diff?

hth

Quote Originally Posted by totalsam View Post
Hi,

Having a problem with the update order when I add a new order status.

Instead of loading the order page witha note added to the message stack it is displaying a blank page.

A typical url of the problem would be:

https://mywebsite.co.uk/admin/super_...n=update_order

I have looked into the code (but not touched anything) and the action for update order at the moment seems to look like this (starting line 100 (approx) of admin/super_orders.php)

PHP Code:
case 'update_order':
        
$status zen_db_scrub_in($_POST['status'], true);
        
$comments zen_db_scrub_in($_POST['comments']);

        
$check_status $db->Execute("select customers_name, customers_email_address, orders_status,
                                      date_purchased from " 
TABLE_ORDERS "
                                      where orders_id = '" 
. (int)$oID "'");

        if ( (
$check_status->fields['orders_status'] != $status) || zen_not_null($comments)) {
                  
$db->Execute("update " TABLE_ORDERS "
                        set orders_status = '" 
zen_db_input($status) . "', last_modified = date_add(now(), INTERVAL " TIME_ZONE_OFFSET " HOUR)
                        where orders_id = '" 
. (int)$oID "'");
          
$customer_notified '0';
          if (isset(
$_POST['notify']) && ($_POST['notify'] == 'on')) {
            
$customer_notified '1';
          }

          
update_status($oID$status$customer_notified$comments);

          if (
$customer_notified == '1') {
            
email_latest_status($oID);
          }

          if (
$status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
            
// adjust download_maxdays based on current date
            
$zc_max_days date_diff($check_status->fields['date_purchased'], date('Y-m-d H:i:s'time())) + DOWNLOAD_MAX_DAYS;

            
$update_downloads_query "update " TABLE_ORDERS_PRODUCTS_DOWNLOAD " set download_maxdays='" $zc_max_days "', download_count='" DOWNLOAD_MAX_COUNT "' where orders_id='" . (int)$oID "'";
            
$db->Execute($update_downloads_query);
          }
          
$messageStack->add_session(SUCCESS_ORDER_UPDATED'success');
        }
        else {
          
$messageStack->add_session(WARNING_ORDER_NOT_UPDATED'warning');
        }

        
zen_redirect(zen_href_link(FILENAME_SUPER_ORDERSzen_get_all_get_params(array('action')) . 'action=edit''NONSSL'));
        break;
      case 
'deleteconfirm':
        
zen_remove_order($oID$_POST['restock']);
        
$so->delete_all_data();

        
zen_redirect(zen_href_link(FILENAME_SUPER_ORDERSzen_get_all_get_params(array('oID''action')), 'NONSSL'));
      break; 
Is this correct or am I missing something? If its all correct then what can I do to fix the bug?

Thanks