}
//SP CONFIRM NEW ORDERS
//except for amazon and buyvip which we will generate on demand because we have
//to upload manually the confimation file to their website
//TODO: move from manual confirmation to here
//JNG CONFIRM ORDERS CANCELLATION
//need a new function to retrieve products for cancelation,
//but think of a general way to not return an array but the database result
//so the update and confirmation is sent per row which is much more safe.
//in the future we might use this method to run a query instead of always
//returning a full list as array, we always try to run in per row
$logger->write('- Confirm cancel status of JNG orders');
$cancel_status_unconfirmed = '10';
$cancel_status_confirmed = '12';
$cancel_status_name = statusName($cancel_status_confirmed);
$items = $class_o->retrieveOrdersProducts($cancel_status_unconfirmed);
$items_total = count($items);
if ($items_total == 0) {
    $logger->write('There are no unconfirmed canceled found');
} else {
    $logger->write("There are {$items_total} items need to be confirmed");
    //Group Items per Order
    $orders_cancelled = array();
    foreach ($items as $i) {
        if (!isset($orders_cancelled[$i['orders_id']])) {
            $orders_cancelled[$i['orders_id']] = array();
        }
        $orders_cancelled[$i['orders_id']][] = $i['orders_products_id'];
    }
    $orders_total = count($orders_cancelled);
    $logger->write("Total orders are {$orders_total}, processing per order:");