if (!is_null($order_no) && !is_null($external_item_id) && !is_null($new_status)) {
     if (!is_object($order) || $order_no != $prev_order_no) {
         $order = Order::loadObjectFromSalesPartnerOrderNo($jng_sp_id, $order_no);
     }
     if (!is_object($order)) {
         $logger->write('Can not find order: ' . $order_no);
     } else {
         $item = $order->getItemFromSalesPartnerItemReferenceNo($external_item_id);
         if (!is_object($item)) {
             $logger->write('Can not find item: ' . $external_item_id);
         } else {
             $logger->write('Current status: ' . $item->status);
             $status_update_valid = false;
             if ($item->status != $new_status) {
                 if ($new_status == OrderItem::STATUS_CANCEL) {
                     if (OrderItem::isStatusOpen($item->status) && !OrderItem::isStatusCancelConfirmed($item->status)) {
                         $status_update_valid = true;
                     }
                 } elseif ($new_status == OrderItem::STATUS_SENT_TO_CUSTOMER) {
                     if ((OrderItem::isStatusOpen($item->status) || OrderItem::isStatusCancel($item->status)) && !OrderItem::isStatusReturn($item->status)) {
                         $status_update_valid = true;
                     }
                 }
             }
             if ($status_update_valid) {
                 $item->updateStatus($new_status, $session_userinfo['username']);
                 $item_updated++;
                 $logger->write('Status updated!');
             }
             if (!is_null($tracking_code) && $tracking_code != '' && $order->getTrackingCodeShipment() != $tracking_code) {
                 $order->setTrackingCodeShipment($tracking_code);
     $value .= '<div>No Shipping Window</div>';
 } else {
     $value .= '<div>';
     $value .= '<abbr title="Shipping Window">Ship-Win</abbr>: ' . date('d.m', strtotime($i['shipping_window_open'])) . '-';
     $value .= !is_null($i['shipping_window_close']) ? date('d.m', strtotime($i['shipping_window_close'])) : 'N/A';
     $value .= '</div>';
 }
 $value .= '<div class="notice" style="margin-top:10px;">';
 $value .= '<div><abbr title="Lead Time">LT</abbr> Start: ' . date('d.m.Y H:i', strtotime($i['leadtime_start_date'])) . '</div>';
 $value .= '<div>Print Count/Confirmed: ' . $i['print_count'] . '/' . $i['print_confirmed'] . '</div>';
 $value .= '<div><abbr title="Last EAN Printed">LEP</abbr>: ' . ($i['ean_printed'] != '' ? date('d.m.Y H:i', strtotime($i['ean_printed'])) : 'no log yet') . '</div>';
 $value .= '</div>';
 if ($source == Order::ORDER_TYPE_SALES_PARTNER) {
     $confirmation_time_format = 'd.m.Y H:i';
     $value .= '<div class="notice" style="margin-top:10px;">' . '<strong>Confirmation to SP:</strong>' . '<br />Recieved: ' . date($confirmation_time_format, strtotime($item_object->getSPConfirmationTimeOrderReceived()));
     if (OrderItem::isStatusCancelConfirmed($item_object->status)) {
         $value .= '<br />Canceled: ' . date($confirmation_time_format, strtotime($item_object->getSPConfirmationTimeCancelOrDelivery()));
     } else {
         $delivery_confirmation_time = $item_object->getSPConfirmationTimeCancelOrDelivery();
         if (!OrderItem::isStatusOpen($item_object->status) && $delivery_confirmation_time > 0) {
             $value .= '<br />Delivered: ' . date($confirmation_time_format, strtotime($delivery_confirmation_time));
         }
     }
     if (OrderItem::isStatusReturn($item_object->status)) {
         $return_confirmation_time = $item_object->getSPConfirmationTimeReturnAsArray();
         foreach ($return_confirmation_time as $rct) {
             if ($rct > 0) {
                 $value .= '<br />Returned: ' . date($confirmation_time_format, strtotime($rct));
             }
         }
     }