Example #1
0
 public function add_currency_code()
 {
     $user_name = get_current_user_name();
     $data = array('code' => '[edit]', 'name_en' => '[edit]', 'name_cn' => '[edit]', 'ex_rate' => '[0]', 'update_date' => date('Y-m-d h:i:s'), 'update_user' => $user_name);
     try {
         $this->rate_model->add_currency_code($data);
         echo $this->create_json(1, lang('configuration_accepted'));
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
 public function add_new_email_template()
 {
     $user_id = get_current_user_id();
     $update_time = get_current_time();
     $name = get_current_user_name();
     $created_date = get_current_time();
     $remark = $name . lang('on') . $update_time . lang('create_template') . "<br>";
     $data = array('title' => '', 'content' => '', 'code' => '', 'creator' => $user_id, 'remark' => $remark, 'created_date ' => $created_date);
     try {
         $this->edm_email_model->add_edm_email($data);
         echo $this->create_json(1, lang('configuration_accepted'));
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
 public function fetch_statistics($begin_time = NULL, $end_time = NULL, $priority = 1, $shipper = NULL)
 {
     $this->db->select('is_register, ship_confirm_date, ship_confirm_user, ship_weight, sub_ship_weight_str, qty_str');
     $this->db->from('order_list');
     $this->db->where('ship_confirm_date >=', $begin_time);
     $this->db->where('ship_confirm_date <=', $end_time);
     if ($priority <= 1) {
         $this->db->where('ship_confirm_user', get_current_user_name());
     } else {
         if (!empty($shipper)) {
             $this->db->where('ship_confirm_user', $shipper);
         }
     }
     $query = $this->db->get();
     $restult = $query->result();
     $statistics = array();
     $statistics = array('shippers' => array());
     foreach ($restult as $row) {
         $qties = array_sum(explode(',', $row->qty_str));
         $package_count = substr_count($row->sub_ship_weight_str, ',') + 1;
         if (isset($statistics[$row->is_register])) {
             if (isset($statistics[$row->is_register][$row->ship_confirm_user])) {
                 $data = $statistics[$row->is_register][$row->ship_confirm_user];
                 $new_data = array('count' => $data['count'] + 1, 'package_count' => $data['package_count'] + $package_count, 'ship_weight' => $data['ship_weight'] + $row->ship_weight, 'qty' => $qties + $data['qty']);
                 $statistics[$row->is_register][$row->ship_confirm_user] = $new_data;
             } else {
                 $data = array('count' => 1, 'package_count' => $package_count, 'ship_weight' => $row->ship_weight, 'qty' => $qties);
                 $statistics[$row->is_register][$row->ship_confirm_user] = $data;
             }
         } else {
             $statistics[$row->is_register] = array();
             $data = array('count' => 1, 'package_count' => $package_count, 'ship_weight' => $row->ship_weight, 'qty' => $qties);
             $statistics[$row->is_register][$row->ship_confirm_user] = $data;
         }
         if (!in_array($row->ship_confirm_user, $statistics['shippers'])) {
             $statistics['shippers'][] = $row->ship_confirm_user;
         }
     }
     return $statistics;
 }
Example #4
0
/**
 * This is the PNM shortcode entry point
 **/
function ifcrush_pnm()
{
    // 	global $debug;
    // 	if ($debug) echo "[ifcrush_pnm] ";
    if (!is_user_logged_in()) {
        echo "sorry you must logged in as a pnm to access this page.";
        return;
    }
    $current_user = wp_get_current_user();
    if (is_user_a_pnm($current_user)) {
        /* get the frat of the rc */
        $pnm_netID = get_pnm_netID($current_user);
    } else {
        echo "sorry you must logged in as a pnm to access this page.";
        return;
    }
    /* 
     * Now I know who I am.
     */
    $username = get_current_user_name($current_user);
    echo "Hello {$username}.  You attended these events:<br><br>";
    ifcrush_eventreg_for_pnm($pnm_netID);
    /** all done **/
}
Example #5
0
$data[] = array(lang('product_image_url'), $this->block->generate_image_input($config));
$config = array('name' => 'reference_links', 'id' => 'reference_links', 'maxlength' => '200', 'size' => '100');
$data[] = array(lang('reference_links'), form_input($config));
$config = array('name' => 'sales_strategy', 'id' => 'sales_strategy', 'maxlength' => '200', 'size' => '100');
$data[] = array(lang('sales_strategy'), form_input($config));
$config = array('name' => 'sales_statistics', 'id' => 'sales_statistics', 'maxlength' => '200', 'size' => '100');
$data[] = array(lang('sales_statistics'), form_input($config));
$config = array('name' => 'related_specifications', 'id' => 'related_specifications', 'maxlength' => '200', 'size' => '100');
$data[] = array(lang('related_specifications'), form_input($config));
$config = array('name' => 'provider', 'id' => 'provider', 'maxlength' => '200', 'size' => '100');
$data[] = array(lang('provider'), form_input($config));
$config = array('name' => 'product_description', 'id' => 'product_description', 'maxlength' => '80', 'size' => '20');
$data[] = array($this->block->generate_required_mark(lang('product_description')), form_textarea($config));
$purchasers = $this->purchase_model->purchase_apply_purchasers();
$owner_id = get_current_user_id();
$owner_name = get_current_user_name();
$options[$owner_id] = $owner_name;
foreach ($purchasers as $purchaser) {
    $options[$purchaser->u_id] = $purchaser->u_name;
}
$data[] = array($this->block->generate_required_mark(lang('purchaser')), form_dropdown('purchaser_id', $options, $owner_id));
echo $this->block->generate_tinymce(array('product_description'));
$title = lang('add_a_new_purchase_apply');
$back_button = $this->block->generate_back_icon(site_url('order/purchase_apply/manage'));
$title .= $back_button;
echo block_header($title);
$attributes = array('id' => 'purchase_apply_form');
echo form_open(site_url('order/purchase_apply/save'), $attributes);
echo $this->block->generate_table($head, $data);
$url = site_url('order/purchase_apply/save');
$config = array('name' => 'submit', 'value' => lang('purchase_apply_saved'), 'type' => 'button', 'style' => 'margin:10px', 'onclick' => "return submit_content_by_purchase_apply(this, '{$url}');");
 public function auditing_order_rejecteds($tag = NULL)
 {
     $order_id = $this->input->post('order_id');
     $order = $this->order_model->get_order_with_id($order_id);
     if (empty($order)) {
         return;
     }
     $sys_remark = $order->sys_remark;
     $sys_remark .= sprintf(lang('batch_rejected_by_sys_remark_one'), get_current_time(), get_current_user_name());
     $descript = $order->descript;
     $descript .= sprintf(lang('batch_rejected_by_sys_remark_one'), get_current_time(), get_current_user_name());
     $margin_arr = explode('|', $order->return_why);
     if (count($margin_arr) == 2) {
         $return_cost = $order->return_cost - $margin_arr[1];
     }
     $return_why = $margin_arr[0];
     try {
         $data = array('order_status' => $this->order_model->fetch_status_id('order_status', 'wait_for_feedback'), 'sys_remark' => $sys_remark, 'descript' => $descript, 'return_why' => $return_why);
         if (isset($return_cost)) {
             $data['return_cost'] = $return_cost;
         }
         $order_status_no_ship = $this->order_model->fetch_status_name('order_status', $order->order_status);
         if ($order_status_no_ship == 'not_shipped_apply_for_refund') {
             $data['order_status'] = $this->order_model->fetch_status_id('order_status', 'holded');
         }
         $this->order_model->update_order_information($order_id, $data);
         echo $this->create_json(1, 'ok');
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
 }
 public function save_return_order($tag = NULL)
 {
     $id = $this->input->post('id');
     $item_no = $this->input->post('item_no');
     //        $view_return_cost = $this ->input ->post('view_return_cost');
     $order = $this->order_model->get_order_with_id($id);
     if (!empty($order->return_cost)) {
         $return_cost = $this->input->post('return_cost') + $order->return_cost;
     } else {
         $return_cost = $this->input->post('return_cost');
     }
     $return_type = $this->input->post('return_type');
     $return_type_string = $this->order_model->fetch_status_name('order_status', $return_type);
     $sys_remark = $order->sys_remark;
     $sys_remark .= sprintf(lang('apply_action_by_sys_remark'), get_current_user_name(), get_current_time(), lang($return_type_string), $return_cost . "( {$order->currency})");
     $status_id_wfa = $this->order_model->fetch_status_id('order_status', 'wait_for_assignment');
     $status_id_wfc = $this->order_model->fetch_status_id('order_status', 'wait_for_confirmation');
     $status_id_h = $this->order_model->fetch_status_id('order_status', 'holded');
     /*
      * 当申请未发货-申请退款时(待客服分配,待客服确认,客服暂不确认), 状态直接改为未发货-申请退款。
      * **/
     if ($order->order_status == $status_id_wfa || $order->order_status == $status_id_wfc || $order->order_status == $status_id_h) {
         $return_type = $this->order_model->fetch_status_id('order_status', 'not_shipped_apply_for_refund');
         $sys_remark = $order->sys_remark;
         $sys_remark .= sprintf(lang('apply_action_by_sys_remark'), get_current_user_name(), get_current_time(), lang('not_shipped_apply_for_refund'), $return_cost . "( {$order->currency})");
     }
     $status_id = $this->order_model->get_one('order_list', 'order_status', array('id' => $id));
     $return_status = $this->order_model->fetch_status_name('order_status', $status_id);
     /**
      * 前:已发货时的几种状态, 中: 未发货时的状态 , 后:二次退款的。
      */
     $return_status_arr = array('wait_for_purchase', 'wait_for_shipping_label', 'wait_for_shipping_confirmation', 'wait_for_feedback', 'received', 'wait_for_assignment', 'wait_for_confirmation', 'holded', 'not_received_partial_refunded', 'received_partial_refunded');
     $rules = array(array('field' => 'remark', 'label' => lang('remark'), 'rules' => 'trim|required'));
     $return_type_nrar = $this->order_model->fetch_status_id('order_status', 'not_received_apply_for_partial_refund');
     $return_type_rar = $this->order_model->fetch_status_id('order_status', 'received_apply_for_partial_refund');
     $status = $this->order_model->fetch_status_name('order_status', $return_type);
     /**
      * Form 验证。
      */
     $this->form_validation->set_rules($rules);
     if ($this->form_validation->run() == FALSE) {
         $error = validation_errors();
         echo $this->create_json(0, $error);
         return;
     }
     /**
      *   这里是申请审核的。
      */
     $user_priority = $this->user_model->fetch_user_priority_by_system_code('order');
     //        if($user_priority+1 >= 2)//Test
     if ($user_priority >= 2) {
         if ($tag == 'approved') {
             $order_status_approved = $this->order_model->get_one('order_list', 'order_status', array('id' => $id));
             $return_type_string = $this->order_model->fetch_status_name('order_status', $order_status_approved);
             if ($return_type_string == 'not_received_approved_resending' || $return_type_string == 'received_approved_resending') {
                 echo $this->create_json(0, lang('review_finish'));
                 return;
             }
             switch ($return_type_string) {
                 case 'not_received_apply_for_partial_refund':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'not_received_partial_refunded');
                     break;
                 case 'not_received_apply_for_full_refund':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'not_received_full_refunded');
                     //                        $return_cost = $view_return_cost;
                     break;
                 case 'not_received_apply_for_resending':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'not_received_approved_resending');
                     break;
                 case 'received_apply_for_partial_refund':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'received_partial_refunded');
                     break;
                 case 'received_apply_for_full_refund':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'received_full_refunded');
                     //                        $return_cost = $view_return_cost;
                     break;
                 case 'received_apply_for_resending':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'received_approved_resending');
                     break;
                 case 'not_shipped_apply_for_refund':
                     $return_type = $this->order_model->fetch_status_id('order_status', 'not_shipped_agree_to_refund');
                     break;
                 default:
                     echo $this->create_json(0, lang('no_return'));
                     return;
             }
             $return_cost = $this->input->post('return_cost');
             $sys_remark = $order->sys_remark;
             //                $sys_remark .= sprintf(lang('approved_by_sys_remark'), get_current_time(), get_current_user_name());
             $sys_remark .= sprintf(lang('approved_by_sys_remark_for_one'), get_current_time(), get_current_user_name(), $return_cost . "( {$order->currency})");
             $descript = $order->descript;
             $descript .= sprintf(lang('approved_by_sys_remark_for_one'), get_current_time(), get_current_user_name(), $return_cost . "( {$order->currency})");
         } elseif ($tag == 'rejected') {
             $not_ship_id = $this->order_model->fetch_status_id('order_status', 'not_shipped_apply_for_refund');
             if ($order->order_status == $not_ship_id) {
                 $holded_id = $this->order_model->fetch_status_id('order_status', 'holded');
                 $order_status_rejected = $holded_id;
                 $sys_remark = $order->sys_remark;
                 $sys_remark .= sprintf(lang('rejected_by_sys_remark'), get_current_user_name(), get_current_time(), lang('not_shipped_apply_for_refund'), lang('holded'));
                 $descript = $order->descript;
                 $descript .= sprintf(lang('rejected_by_sys_remark'), get_current_user_name(), get_current_time(), lang('not_shipped_apply_for_refund'), lang('holded'));
             } else {
                 $apply_status = array('not_received_apply_for_partial_refund', 'not_received_apply_for_full_refund', 'not_received_apply_for_resending', 'received_apply_for_partial_refund', 'received_apply_for_full_refund', 'received_apply_for_resending', 'not_shipped_apply_for_refund');
                 $order_status_string = $this->order_model->fetch_status_name('order_status', $order->order_status);
                 if (!in_array($order_status_string, $apply_status)) {
                     echo $this->create_json(0, lang('no_rejected'));
                     return;
                 }
                 $margin_arr = explode('|', $order->return_why);
                 if (count($margin_arr) == 2) {
                     $return_cost = $order->return_cost - $margin_arr[1];
                 }
                 $return_why = $margin_arr[0];
                 $order_status_rejected = $this->order_model->fetch_status_id('order_status', 'wait_for_feedback');
                 $sys_remark = $order->sys_remark;
                 $sys_remark .= sprintf(lang('rejected_by_sys_remark'), get_current_user_name(), get_current_time(), lang($order_status_string), lang('wait_for_feedback'));
                 $descript = $order->descript;
                 $descript .= sprintf(lang('rejected_by_sys_remark'), get_current_user_name(), get_current_time(), lang($order_status_string), lang('wait_for_feedback'));
             }
         } else {
             if (!in_array($return_status, $return_status_arr)) {
                 echo $this->create_json(0, lang('no_return'));
                 return;
             }
             if (!$return_type) {
                 echo $this->create_json(0, lang('please_select_return_type'));
                 return;
             }
         }
     } else {
         if (!in_array($return_status, $return_status_arr)) {
             echo $this->create_json(0, lang('order_not_return'));
             return;
         }
     }
     $is_return = $this->input->post('is_return');
     $remark = $this->input->post('remark');
     $refund_verify_type = $this->input->post('refund_verify_type');
     $refund_verify_content = $this->input->post('refund_verify_content');
     $person_responsible = $this->input->post('person_responsible');
     $refund_sku = $this->input->post('refund_sku');
     $refund_sku_str = '';
     if (!empty($refund_sku)) {
         foreach ($refund_sku as $sku) {
             $refund_sku_str .= $sku . ',';
         }
     }
     if (!empty($person_responsible) && strpos($person_responsible, '#') !== 0) {
         if (!$this->order_model->check_exists('user', array('name' => $person_responsible))) {
             echo $this->create_json(0, lang('name_no_exists'));
             return;
         }
     }
     $data = array('return_why' => $order->order_status . '|' . $this->input->post('return_cost'), 'return_cost' => $return_cost, 'return_remark' => $remark, 'descript' => $order->descript . $remark, 'return_date' => get_current_time(), 'return_user' => get_current_user_name(), 'order_status' => $return_type, 'refund_verify_type' => $refund_verify_type, 'refund_verify_content' => $refund_verify_content, 'refund_duty' => $person_responsible, 'refund_sku_str' => trim($refund_sku_str, ','));
     if ($tag == 'approved' || $tag == 'rejected') {
         unset($data['return_date']);
     }
     if (isset($sys_remark)) {
         $data['sys_remark'] = $sys_remark;
     }
     if (isset($order_status_rejected)) {
         $data['order_status'] = $order_status_rejected;
     }
     if (isset($descript)) {
         $data['descript'] = $sys_remark;
     }
     if (isset($return_why)) {
         $data['return_why'] = $return_why;
     }
     /*
      * 未发货-申请退款时, 金额为全额。
      * **/
     if ($order->order_status == $status_id_wfa || $order->order_status == $status_id_wfc || $order->order_status == $status_id_h) {
         //            $data['return_cost'] = $order->gross;
         //            $data['return_cost'] = $order->gross && $order->gross != '0'?$order->gross:$order->net;
     }
     /**
      * 申请重发时录入订单号
      */
     if ($status == 'not_received_apply_for_resending' || $status == 'received_apply_for_resending') {
         $gross = $this->order_model->get_one('order_list', 'gross', array('id' => $id));
         $net = $this->order_model->get_one('order_list', 'net', array('id' => $id));
         $cost = 0;
         if ($gross && $gross != '0') {
             $cost = $gross;
         } else {
             $cost = $net;
         }
         if ($return_cost > $cost) {
             echo $this->create_json(0, lang('return_cost_is_too_big'));
             return;
         } else {
             $rules[] = array('field' => 'return_cost', 'label' => lang('return_cost'), 'rules' => 'trim|required|positive_numeric');
         }
         $data['return_order'] = $item_no;
         // id;
         $data['return_why'] = $order->order_status;
     }
     try {
         if ($this->order_model->check_exists('order_list', array('id' => $id, 'item_no' => $item_no))) {
             $update_tag = $this->order_model->update_order_information($id, $data);
         } else {
             //$update_tag = $this->order_model->update_order_information_from_completed($id, $data);
         }
         $stratus_array = array('not_received_apply_for_partial_refund', 'not_received_apply_for_full_refund', 'not_received_apply_for_resending', 'received_apply_for_partial_refund', 'received_apply_for_full_refund', 'received_apply_for_resending');
         /**
          * 发送申请提示。
          */
         if (in_array($status, $stratus_array)) {
             $message = $this->messages->load('apply_return');
             $this->events->trigger('apply_return_after', array('type' => 'apply_return', 'click_url' => site_url('order/special_order/view_list_return_order', array($id)), 'content' => lang($message['message']), 'owner_id' => $this->get_current_user_id()));
         }
         /**
          * 发送重发提示。
          */
         if ($status == 'not_received_approved_resending' || $status == 'received_approved_resending') {
             $message = $this->messages->load('return_apply_permit');
             $this->events->trigger('return_apply_permit_after', array('type' => 'return_apply_permit', 'click_url' => site_url('order/regular_order/view_order', array($id)), 'content' => lang($message['message']), 'owner_id' => $this->get_current_user_id()));
         }
         echo $this->create_json(1, lang('return_option_saved'));
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
 }
Example #8
0
 public function add_resource_category()
 {
     $user_name = get_current_user_name();
     $data = array('name' => '[edit]', 'creator' => $user_name);
     try {
         $this->seo_model->add_resource_category($data);
         echo $this->create_json(1, lang('configuration_accepted'));
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
Example #9
0
 public function verify_outstock_type()
 {
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'));
     try {
         if ($this->stock_model->check_exists('product_outstock_type', array('type' => $value))) {
             echo $this->create_json(0, lang('product_outstock_type_exists'));
             return;
         }
         $user_name = get_current_user_name();
         $this->stock_model->update_outstock_type($id, $type, $value, $user_name);
         if ($type == 'type') {
             echo $this->create_json(1, lang('ok'), $value);
         }
         if ($type == 'is_saled') {
             $value = empty($value) ? 0 : 1;
             echo $this->create_json(1, lang('ok'), empty($value) ? lang('no') : lang('yes'));
         }
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
Example #10
0
<?php

$head = array(lang('name'), lang('value'));
$config = array('name' => 'makeup_sku', 'id' => 'makeup_sku', 'value' => $makeup_sku ? $makeup_sku->makeup_sku : '', 'maxlength' => '20', 'size' => '20');
$data[] = array($this->block->generate_required_mark(lang('product_makeup_sku')), form_input($config));
$config = array('name' => 'sku', 'id' => 'sku', 'value' => $makeup_sku ? $makeup_sku->sku : '', 'maxlength' => '1000', 'size' => '100');
$data[] = array($this->block->generate_required_mark(lang('sku')), form_input($config));
$config = array('name' => 'qty', 'id' => 'qty', 'value' => $makeup_sku ? $makeup_sku->qty : '', 'maxlength' => '100', 'size' => '100');
$data[] = array($this->block->generate_required_mark(lang('qty_str')), form_input($config));
if (empty($makeup_sku)) {
    $add_name = get_current_user_name();
    $config = array('name' => 'user_id', 'id' => 'user_id', 'value' => $add_name, 'maxlength' => '60', 'size' => '60', 'readonly' => "readonly");
    $data[] = array($this->block->generate_required_mark(lang('editor')), form_input($config));
} else {
    $user_names = $this->user_model->get_user_name_by_id($makeup_sku->user_id);
    $data[] = array(lang('editor'), $user_names);
}
if (!isset($makeup_sku)) {
    $title = lang('add_makeup_sku');
} else {
    $title = lang('edit_makeup_sku');
}
$back_button = $this->block->generate_back_icon(site_url('sale/makeup_sku/manage'));
$title .= $back_button;
echo block_header($title);
$attributes = array('id' => 'makeup_sku_form');
$url = site_url('sale/makeup_sku/save_makeup_sku');
echo form_open($url, $attributes);
echo $this->block->generate_table($head, $data);
$config = array('name' => 'submit', 'value' => lang('save_makeup_sku'), 'type' => 'button', 'style' => 'margin:10px', 'onclick' => "this.blur();helper.ajax('{$url}',\$('makeup_sku_form').serialize(true), 1);");
echo form_hidden('makeup_sku_id', $makeup_sku ? $makeup_sku->id : '-1');
Example #11
0
 public function bad_comment_statistic()
 {
     $this->set_2column('sidebar_duty_statistics');
     $user = get_current_user_name();
     $rows = $this->ebay_model->feedback_statistics_all($user);
     $data = array('rows' => $rows);
     $this->template->write_view('content', 'myinfo/bad_comment_statistic', $data);
     $this->template->render();
 }
    public function fetch_refund_resend_by_duty($field)
    {
        $duty_user = get_current_user_name();
        $total_counts = 1000;
        $query = <<<QUERY
refund_verify_status:[1 TO *]
AND
refund_duties:{$duty_user}
QUERY;
        $this->solr_query->setQuery($query);
        $this->solr_query->setFacet(TRUE);
        $this->solr_query->setFacetSort(SolrQuery::FACET_SORT_COUNT);
        $this->solr_query->setFacetOffset('0');
        $this->solr_query->setRows('100');
        $this->solr_query->setFacetLimit($total_counts);
        $this->solr_query->addField('buyer_id');
        $this->solr_query->addField('item_no');
        $this->solr_query->addField('refund_duties');
        $this->solr_query->addField('refund_verify_content');
        $this->solr_query->addField('refund_verify_type');
        $this->solr_query->addField('refund_verify_status');
        $this->solr_query->addField($field);
        $this->solr_query->addFacetField($field);
        $this->solr_query->setFacetMinCount(1);
        $updateResponse = $this->solr_client->query($this->solr_query);
        $response_array = $updateResponse->getResponse();
        return array('facet' => $response_array->facet_counts->facet_fields->{$field}, 'query' => $response_array->response);
    }
Example #13
0
 public function save_order_remark()
 {
     if ($this->input->is_post()) {
         $order_id = $this->input->post('order_id');
         $remark_content = $this->input->post('remark_content');
         $add_user = get_current_user_name();
         $add_date = date('Y-m-d H:i:s');
     }
     try {
         $data = array('order_id' => $order_id, 'remark_content' => $remark_content, 'add_user' => $add_user, 'add_date' => $add_date);
         $this->order_model->save_order_remark($data);
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
     echo $this->create_json(1, lang('ok'));
 }
Example #14
0
 public function modification_order_status()
 {
     $item_no = $this->input->post('item_no');
     $order_status = $this->input->post('order_status');
     if (empty($item_no)) {
         echo $this->create_json(0, lang('item_no_is_null'));
         return;
     }
     $order = $this->order_model->get_order_with_item_no($item_no);
     if (!$order) {
         $order = $this->order_model->get_order_with_item_no_from_completed($item_no);
     }
     if (empty($order)) {
         echo $this->create_json(0, lang('order_not_exists'));
         return;
     } else {
         $status = $order->order_status;
     }
     $not_shipped = fetch_status_id('order_status', 'not_shipped_agree_to_refund');
     $ok_arr = array(fetch_status_id('order_status', 'not_received_partial_refunded'), fetch_status_id('order_status', 'not_received_full_refunded'), fetch_status_id('order_status', 'not_received_approved_resending'), fetch_status_id('order_status', 'received_partial_refunded'), fetch_status_id('order_status', 'received_full_refunded'), fetch_status_id('order_status', 'received_approved_resending'));
     if (empty($status)) {
         $lang_string = 'NULL';
     } else {
         $status_string = fetch_status_name('order_status', $order->order_status);
         $lang_string = lang($status_string);
     }
     $sys_remark = $order->sys_remark;
     $sys_remark .= sprintf(lang('modification_by_sys_remark'), get_current_time(), get_current_user_name(), $lang_string, lang('wait_for_feedback'));
     $data = array('order_status' => fetch_status_id('order_status', 'wait_for_feedback'), 'sys_remark' => $sys_remark);
     try {
         if (in_array($status, $ok_arr) || empty($status)) {
             $this->order_model->update_order_information_by_item_no($item_no, $data);
             $this->order_model->update_order_information_by_item_no_from_completed($item_no, $data);
             echo $this->create_json(1, lang('ok'));
         } else {
             if ($status == $not_shipped) {
                 $this->order_model->update_order_information_by_item_no($item_no, $data);
                 $this->order_model->update_order_information_by_item_no_from_completed($item_no, $data);
                 echo $this->create_json(1, lang('ok'));
             } else {
                 echo $this->create_json(0, lang('no_update_this_status_order'));
             }
         }
     } catch (Exception $ex) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
 }
Example #15
0
 public function verigy_eshop_code()
 {
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'));
     $currency_code = $this->fee_price_model->fetch_eshop_code($id);
     try {
         switch ($type) {
             case 'code':
                 if ($this->fee_price_model->check_exists('eshop_code', array('code' => $value)) && $value != $currency_code->code) {
                     echo $this->create_json(0, lang('code_exists'), $currency_code->code);
                     return;
                 }
                 break;
             case 'name':
                 if ($this->fee_price_model->check_exists('eshop_code', array('name' => $value)) && $value != $currency_code->name) {
                     echo $this->create_json(0, lang('currency_name_cn_exists'), $currency_code->name);
                     return;
                 }
                 break;
             case 'order':
                 $all_orders_object = $this->fee_price_model->fetch_all_eshop_code();
                 $all_orders = object_to_array($all_orders_object, 'order');
                 if (in_array($value, $all_orders)) {
                     echo $this->create_json(0, lang('order_exists'), $currency_code->order);
                     return;
                 }
                 break;
         }
         $user_name = get_current_user_name();
         $this->fee_price_model->verigy_eshop_code($id, $type, $value);
         echo $this->create_json(1, lang('ok'), $value);
     } catch (Exception $e) {
         $this->ajax_failed();
         echo lang('error_msg');
     }
 }
 public function give_order_back()
 {
     $order_id = $this->input->post('order_id');
     $remark = $this->input->post('remark');
     $is_customer = $this->input->post('is_customer');
     $order = $this->order_model->get_order($order_id);
     $data = array('order_status' => $this->order_statuses['holded'], 'descript' => get_current_user_name() . ' ' . lang('give_order_back') . ': ' . $remark);
     if (!in_array($order->order_status, array($this->order_statuses['wait_for_purchase'], $this->order_statuses['wait_for_shipping_label'], $this->order_statuses['not_handled']))) {
         $order_status = lang('order_status_is') . lang(fetch_status_name('order_status', $order->order_status));
         if ($is_customer) {
             echo $this->create_json(0, $order_status);
             return;
         }
     }
     // shipping department
     /*if (!$is_customer) {
                 if ($order->order_status != $this->order_statuses['wait_for_shipping_confirmation']) {
                     echo $this->create_json(0, $order_status);
     
                     return;
                 }
                 $user_name = get_current_login_name();
                 $type_extra = $user_name . '/' . date('Y-m-d H:i:s');
     
                 $this->product_model->update_product_stock_count_by_order_id($order_id, 'label_instock', $type_extra, FALSE);
             }*/
     try {
         if ($is_customer) {
             $this->order_model->update_order_information($order_id, $data);
         } else {
             $data['item_no'] = make_returned_item_no($order->item_no, $order->is_register);
             $this->order_model->renew_order($order_id, $data);
             /* remove dead data from epacket_confirm_list table */
             $this->epacket_model->remove_order_from_epacket($order_id);
         }
     } catch (Exception $e) {
         echo lang('error_msg');
         $this->ajax_failed();
     }
     echo $this->create_json(1, lang('ok'));
     $order = $this->order_model->get_order($order_id);
     $this->events->trigger('give_order_back_after', array('type' => 'give_order_back', 'click_url' => site_url('order/regular_order/view_order'), 'content' => sprintf(lang('give_order_back_notice'), $order->item_no), 'owner_id' => get_current_user_id()));
 }
<?php

$CI =& get_instance();
$head = array(lang('name'), lang('value'));
$data = array();
$config = array('name' => 'author', 'id' => 'author', 'value' => isset($work_rewards_error->author) ? $work_rewards_error->author : get_current_user_name(), 'size' => '100', 'readonly' => 'readonly');
$data[] = array($this->block->generate_required_mark(lang('author')), form_input($config));
$type = array('please_select' => lang('please_select'), 'reward' => lang('reward'), 'pulish' => lang('pulish'));
$str = form_dropdown('type', $type, isset($work_rewards_error->type) ? $work_rewards_error->type : 'please_select');
$data[] = array($this->block->generate_required_mark(lang('type')), $str);
$str = form_dropdown('department', $department, isset($work_rewards_error->department) ? $work_rewards_error->department : '0');
$data[] = array($this->block->generate_required_mark(lang('department')), $str);
$config = array('name' => 'worker_name', 'id' => 'worker_name', 'value' => $worker_id, 'size' => '100');
$data[] = array($this->block->generate_required_mark(lang('work_rewards_error_person')), form_input($config));
$config = array('name' => 'order_no', 'id' => 'order_no', 'value' => isset($work_rewards_error->order_no) ? $work_rewards_error->order_no : '', 'size' => '100');
$data[] = array(lang('order_number'), form_input($config));
$config = array('name' => 'content_item', 'id' => 'content_item', 'value' => isset($work_rewards_error->content_item) ? $work_rewards_error->content_item : '', 'cols' => '100', 'rows' => '15');
$data[] = array($this->block->generate_required_mark(lang('content')), form_textarea($config));
$priority = $this->user_model->fetch_user_priority_by_system_code('executive');
if ($CI->is_super_user() || $priority > 1) {
    $config = array('name' => 'result', 'id' => 'result', 'value' => isset($work_rewards_error->result) ? $work_rewards_error->result : '', 'cols' => '100', 'rows' => '5');
} else {
    $config = array('name' => 'result', 'id' => 'result', 'value' => isset($work_rewards_error->result) ? $work_rewards_error->result : '', 'cols' => '100', 'rows' => '5', 'readonly' => 'readonly');
}
$data[] = array(lang('processing_result'), form_textarea($config));
$title = lang('work_rewards_error');
$back_button = $this->block->generate_back_icon(site_url('myinfo/myaccount/work_rewards_error'));
echo block_header($title . $back_button);
$attributes = array('id' => 'catalog_form');
echo form_open(site_url('myinfo/myaccount/work_rewards_error_save'), $attributes);
echo $this->block->generate_table($head, $data);
Example #18
0
}
?>
    <li style="float:right; _width:120px;" class="border">
        <span>
            <?php 
if ($user) {
    ?>
            <a href="<?php 
    echo site_url('authenticate/logout');
    ?>
">
            <?php 
    echo lang('logout');
    ?>
(<?php 
    echo get_current_user_name();
    ?>
)</a>
            <?php 
} else {
    ?>
            <a href="<?php 
    echo site_url('');
    ?>
" >
                <?php 
    echo lang('login');
    ?>

            </a>
            <?php