$orders_sent = true;
            if (!in_array($item['jng_sp_orders_id'], $oids)) {
                $oids[] = $item['jng_sp_orders_id'];
            }
            $oiids[] = $item['jng_sp_orders_items_id'];
        }
        $class_jo->printCountAdd($oiids);
    } else {
        $already_sent = true;
    }
    if ($orders_sent && !$already_sent) {
        $class_jo->setShipmentDateNonEasylog($oids);
    }
} else {
    use_class('jng_sp_orders');
    $class_jo = new jng_sp_orders();
    $items = $class_jo->retrieveItems($orders_id);
    foreach ($items as $item) {
        if (in_array($item['status'], $REQUIRED_STATUS)) {
            $class_jo->updateItemStatus($item['jng_sp_orders_items_id'], $UPDATED_STATUS, $username);
            $orders_sent = true;
        } elseif ($item['status'] == $UPDATED_STATUS) {
            $already_sent = true;
        }
    }
    if ($orders_sent && !$already_sent) {
        $class_jo->setShipmentDateNonEasylog($orders_id);
    }
}
$result = array();
$result['orders_sent'] = $orders_sent || $already_sent ? '1' : '0';