Example #1
0
<?php

require_once '../confy.php';
require_once '../functions.php';
require_once '../functions-2.php';
require_once DIR_WS_FUNCTIONS . 'html_output.php';
tep_db_connect();
use_class('orders_waxing');
$class_ow = new orders_waxing();
$status = tep_db_prepare_input($_GET['status']);
$statusName = $class_ow->statusName();
$statusPrint = $statusName[$status];
$waxings = $class_ow->retrieveList("ow.status={$status}", "ow.status_date ASC");
//HEADER
$header = array();
$header[] = '<html>';
$header[] = '<head>';
$header[] = '<title>JULIE &amp; GRACE Waxing List</title>';
$header[] = '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />';
$header[] = '<link rel="stylesheet" type="text/css" href="waxing-list.css">';
$header[] = '</head>';
$header[] = '<body>';
$header[] = '<div class="page">';
/*
//FIRST TEMPLATE
$content = '<h1>Waxing List: '.$statusPrint.'</h1>';
foreach($waxings as $row) {
	$confitype = $class_ow->elements_type[$row['elements_id']];
	$thumb = webImage("webconfi-$confitype-$row[elements_id]-1-small.jpg",'','','Element ID: '.$row['elements_id'],'img-border img-padding');
	$class = "product-txt";
	if($row['image_id']!='') {
     //        $result = array();
     //        $result['tooltip'] = $tooltip;
     //        ajaxReturn($result);
     //        exit;
 } elseif ($_POST['me_action'] == 'UPDATEOPSTATUS') {
     $opid = tep_db_prepare_input($_POST['op_id']);
     $old_status = tep_db_prepare_input($_POST['old_status']);
     $new_status = tep_db_prepare_input($_POST['new_status']);
     $product = $class_o->retrieveProductDetail($opid);
     if ($product['status'] == $old_status) {
         $status_to_alert_success = array('3', '4');
         $class_o->updateProductStatus($opid, $new_status, $session_userinfo['username']);
         if ($new_status == '5' || $new_status == '10' || $new_status == '1' && $old_status == '10') {
             //set order waxing as new/finish/cancel following order product status
             use_class('orders_waxing');
             $class_ow = new orders_waxing();
             $ow_data = $class_ow->retrieveByOrderProducts($opid);
             $ow_status = $new_status == '10' ? '6' : $new_status;
             if (count($ow_data) > 0) {
                 foreach ($ow_data as $ow) {
                     $waxing_id = $ow['orders_waxing_id'];
                     $class_ow->updateStatus($waxing_id, $ow_status, $session_userinfo['username']);
                 }
             }
         }
         list($new_status, $sub_status) = explode('-', $new_status);
         $status_name = $sub_status != '' ? subStatusNameShort($new_status, $sub_status) : $class_o->productStatusNameShort();
         if ($sub_status == '') {
             $status_name = $status_name[$new_status];
         }
         $result = array();
<?php

use_class('orders_waxing');
$class_ow = new orders_waxing();
use_class('orders');
$class_o = new orders();
if (isset($_POST['me_action'])) {
    if ($_POST['me_action'] == 'UDPATEOWSTATUS') {
        $waxing_id = tep_db_prepare_input($_POST['ow_id']);
        $old_status = tep_db_prepare_input($_POST['old_status']);
        $new_status = tep_db_prepare_input($_POST['new_status']);
        $waxing = $class_ow->retrieveWaxingDetail($waxing_id);
        if ($waxing['status'] == $old_status) {
            $class_ow->updateStatus($waxing_id, $new_status, $session_userinfo['username']);
            if ($new_status == '5') {
                //Set order product to finish if waxing status is finish
                $set_product_status = true;
                $opid = $waxing['orders_products_id'];
                $ow_data = $class_ow->retrieveByOrderProducts($opid);
                foreach ($ow_data as $ow) {
                    if ($ow['status'] < 5) {
                        $set_product_status = false;
                        break 1;
                    }
                }
                if ($set_product_status) {
                    $op_old_status = '4';
                    $product = $class_o->retrieveProductDetail($opid);
                    if ($product['status'] == $op_old_status) {
                        $class_o->updateProductStatus($opid, $new_status, $session_userinfo['username']);
                    }