示例#1
0
 public function auto_make_epacket_shipped()
 {
     //echo "*************";die();
     $orders = $this->order_model->fetch_all_epacket_wait_for_shipping_label_order_ids();
     if ($orders) {
         foreach ($orders as $order) {
             echo $order->item_no . "\n";
             if ($order->order_status != 0 && $order->order_status != $this->order_statuses['wait_for_shipping_label']) {
                 $order_status = $order->item_no . lang('order_status_is') . lang(fetch_status_name('order_status', $order->order_status));
                 echo $order_status . "\n";
                 continue;
             }
             $order_id = $order->id;
             $is_register = strtoupper($order->is_register);
             /*
              * Epacket:
              */
             if (strtoupper($is_register) == 'H') {
                 $epacket_config = $this->epacket_model->get_epacket_config_by_is_register($is_register);
                 /* check if there is any available ebay transaction id, or return false */
                 $paypal_transaction_id = $order->transaction_id;
                 $item_ids = explode(',', trim($order->item_id_str, ','));
                 $item_ids = array_unique($item_ids);
                 foreach ($item_ids as $item_id) {
                     if (!$this->epacket_model->ebay_transaction_id_exists($item_id, $paypal_transaction_id)) {
                         echo $order->item_no . lang('no_ebay_transaction_id_info') . "\n";
                         continue;
                     }
                 }
                 if ($order->ship_weight && $order->ship_confirm_user) {
                     echo $order->item_no . lang('shipping_weight_exists_no_need_try_again') . "\n";
                     continue;
                 }
                 $remark = $order->sys_remark;
                 $remark .= sprintf(lang('confirm_shipped_remark'), date('Y-m-d H:i:s'), lang('program'));
                 $data = array('descript' => lang('program') . 'auto shipped!', 'ship_confirm_user' => lang('program'), 'order_status' => $this->order_statuses['wait_for_feedback'], 'ship_confirm_date' => date('Y-m-d H:i:s'), 'sys_remark' => $remark, 'ship_weight' => 0.05);
                 $this->order_model->update_order_information($order_id, $data);
                 $this->product_model->update_product_stock_count_by_order_id($order_id);
                 $data = array('order_id' => $order_id, 'transaction_id' => $paypal_transaction_id, 'input_user' => $epacket_config->user_id);
                 $this->epacket_model->save_epacket_confirm_list($data);
                 //$this->ebay_order_model->save_wait_complete_sale($order_id);
                 $this->script->fetch_epacket_track_number(array('order_id' => $order_id));
                 echo $order->item_no . " has shiped success!\n";
             } elseif (strtoupper($is_register) == 'EUB') {
                 /*线下eub*/
                 $epacket_config = $this->epacket_model->get_epacket_config_by_is_register($is_register);
                 $remark = $order->sys_remark;
                 $remark .= sprintf(lang('confirm_shipped_remark'), date('Y-m-d H:i:s'), lang('program'));
                 $data = array('descript' => lang('program') . 'auto shipped!', 'ship_confirm_user' => lang('program'), 'print_label_user' => lang('program'), 'order_status' => $this->order_statuses['wait_for_feedback'], 'ship_confirm_date' => date('Y-m-d H:i:s'), 'print_label_date' => date('Y-m-d H:i:s'), 'sys_remark' => $remark, 'ship_weight' => 0.05);
                 $this->order_model->update_order_information($order_id, $data);
                 $this->product_model->update_product_stock_count_by_order_id($order_id);
                 $this->ebay_order_model->save_wait_complete_sale($order_id);
                 $data = array('order_id' => $order_id, 'input_user' => $epacket_config->user_id);
                 $this->epacket_model->save_specification_epacket_confirm_list($data);
                 $this->script->fetch_specification_epacket_track_number(array('order_id' => $order_id));
                 echo $order->item_no . " has shiped success!\n";
             }
             /******************************************************************/
         }
     }
 }
<?php

$url = site_url('order/setting/add_bad_comment_type');
$add_button = $this->block->generate_add_icon($url);
$head = array(lang('order_bad_comment_type'), lang('order_status'), lang('person_responsible'), lang('department_responsible'), lang('is_show_sku'), lang('confirm_required'), lang('creator'), lang('created_date'), lang('options') . $add_button);
$data = array();
$code_url = site_url('order/setting/verify_bad_comment_type');
$system_names = to_js_array($system_names);
foreach ($comment_types as $comment_type) {
    $drop_button = $this->block->generate_drop_icon('order/setting/drop_bad_comment_type', "{id: {$comment_type->id}}", TRUE);
    $creator_name = $this->user_model->fetch_user_name_by_id($comment_type->creator);
    $confirm_required = $comment_type->confirm_required ? lang('yes') : lang('no');
    $default_refund_show_sku = $comment_type->default_refund_show_sku ? lang('yes') : lang('no');
    $department = lang($this->order_model->get_one('system', 'name', array('code' => $comment_type->department)));
    $data[] = array($this->block->generate_div("comment_type_{$comment_type->id}", empty($comment_type->type) ? '[edit]' : $comment_type->type), $this->block->generate_div("default_refund_type_{$comment_type->id}", empty($comment_type->default_refund_type) ? '[edit]' : lang(fetch_status_name('order_status', $comment_type->default_refund_type))), $this->block->generate_div("default_refund_duty_{$comment_type->id}", empty($comment_type->default_refund_duty) ? '[edit]' : $comment_type->default_refund_duty), $this->block->generate_div("default_refund_department_duty_{$comment_type->id}", empty($department) ? '[edit]' : $department), $this->block->generate_div("default_refund_show_sku_{$comment_type->id}", $default_refund_show_sku), $this->block->generate_div("confirm_required_{$comment_type->id}", empty($confirm_required) ? '[edit]' : $confirm_required), $creator_name, $comment_type->created_date, $drop_button);
    $order_status_collection = array('' => lang('please_select'));
    foreach ($order_status as $key => $value) {
        $order_status_collection[$key] = lang($value);
    }
    $collection = to_js_array($order_status_collection);
    echo $this->block->generate_editor("default_refund_type_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'default_refund_type'}", $collection);
    echo $this->block->generate_editor("default_refund_duty_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'default_refund_duty'}");
    echo $this->block->generate_editor("default_refund_department_duty_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'department'}", $system_names);
    echo $this->block->generate_editor("comment_type_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'type'}");
    $confirm_required = to_js_array(array('1' => lang('yes'), '0' => lang('no')));
    echo $this->block->generate_editor("confirm_required_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'confirm_required'}", $confirm_required);
    echo $this->block->generate_editor("default_refund_show_sku_{$comment_type->id}", 'comment_type_form', $code_url, "{id: {$comment_type->id}, type: 'default_refund_show_sku'}", $confirm_required);
}
$title = lang('order_bad_comment_type_setting');
echo block_header($title);
echo form_open();
示例#3
0
$config_content = array('name' => 'refund_verify_content', 'id' => 'refund_verify_content', 'value' => $order ? $order->refund_verify_content : '', 'cols' => '30', 'rows' => '4');
$data[] = array(lang('refund_verify_content'), form_textarea($config_content));
$config = array('name' => 'person_responsible', 'id' => 'person_responsible', 'value' => $order ? $order->refund_duty : '', 'maxlength' => '50', 'size' => '50');
$data[] = array(lang('person_responsible'), form_input($config));
$problem_sku_html = '';
foreach ($skus as $sku) {
    $config = array('name' => 'refund_sku[]', 'value' => $sku, 'checked' => FALSE);
    $problem_sku_html .= form_checkbox($config) . $sku;
}
$data[] = array(lang('problem_sku'), $problem_sku_html);
$config = array('name' => 'remark', 'id' => 'remark', 'value' => $order ? $order->return_remark : '', 'rows' => '3', 'clos' => '4');
$data[] = array($this->block->generate_required_mark(lang('remark')), form_textarea($config));
$back_button = $this->block->generate_back_icon(site_url('order/special_order/view_list_return_order'));
$title = lang('return_option');
if (isset($tag) && $tag == 'auditing') {
    $status_name = fetch_status_name('order_status', $order->order_status);
    $title = lang('return_and_again_auditing') . '(' . lang($status_name) . ')';
}
if (isset($action) && $action === 'no_consignment') {
    $title = lang('no_consignment_return_cost_html');
}
echo block_header($title);
$attributes = array('id' => 'return_order_form');
echo form_open(site_url('order/special_order/save_return_order'), $attributes);
echo $this->block->generate_table($head, $data);
echo form_hidden('id', $order->id);
echo form_hidden('item_no', $order->item_no);
echo form_hidden('view_return_cost', $order->return_cost);
$commit_button = lang('apply');
$url = site_url('order/special_order/save_return_order');
$config = array('name' => 'submit', 'value' => $commit_button, 'type' => 'button', 'style' => 'margin:10px', 'onclick' => "this.blur();helper.ajax('{$url}',\$('return_order_form').serialize(true), 1);");
示例#4
0
 public function verify_bad_comment_type()
 {
     $rules = array(array('field' => 'type', 'label' => '', 'rules' => 'trim|required'));
     $this->form_validation->set_rules($rules);
     if ($this->form_validation->run() == FALSE) {
         $error = validation_errors();
         echo $this->create_json(0, $error);
         return;
     }
     $id = $this->input->post('id');
     $type = $this->input->post('type');
     $value = trim($this->input->post('value'));
     $bad_comment_type = $this->order_model->fetch_bad_comment_type($id);
     try {
         if ('type' == $type) {
             if ($this->order_model->check_exists('order_bad_comment_type', array('type' => $value)) && $value != $bad_comment_type->type) {
                 echo $this->create_json(0, lang('order_bad_comment_type_exists'), $bad_comment_type->type);
                 return;
             }
             $value = strtoupper($value);
         }
         if ($type == 'default_refund_duty' && !empty($value) && strpos($value, '#') !== 0) {
             if (!$this->order_model->check_exists('user', array('name' => $value))) {
                 echo $this->create_json(0, lang('name_no_exists'));
                 return;
             }
         }
         $this->order_model->verify_bad_comment_type($id, $type, $value);
         if ($type == 'confirm_required' || $type == 'default_refund_show_sku') {
             empty($value) ? $value = lang('no') : ($value = lang("yes"));
         }
         if ($type == 'default_refund_type') {
             $value = lang(fetch_status_name('order_status', $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()));
 }