예제 #1
0
     $result['designs_id'] = $design->id;
     $result['drafts_id'] = $draft->id;
     $result['status'] = 'DELETED';
     //        $result['load_row_design'] = $need_load_row_design;
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'DELETEELEMENT') {
     $elements_id = tep_db_prepare_input($_POST['elements_id']);
     $new_status = tep_db_prepare_input($_POST['new_status']);
     $draft = new design_draft(null, null, $elements_id);
     $draft->deleteElement($elements_id, $session_userinfo['username']);
     $st_counter = '';
     if ($new_status != '') {
         $old_status = tep_db_prepare_input($_POST['old_status']);
         $design = new design($draft->designs_id);
         $design->updateStatus($old_status, $new_status, $session_userinfo['username']);
         $st_counter = designCountBySubStatus(10);
         //            $st_counter = designCountBySubStatus();
     }
     $result = array();
     $result['elements_id'] = $elements_id;
     $result['designs_id'] = $draft->designs_id;
     $result['drafts_id'] = $draft->id;
     $result['st_counter'] = $st_counter;
     $result['status'] = 'DELETED';
     ajaxReturn($result);
     exit;
 } elseif ($_POST['me_action'] == 'LOCATEDRAFT') {
     $drafts_id = tep_db_prepare_input($_POST['drafts_id']);
     /* OLD QUERY
        $q = "SELECT CASE d.status WHEN 10 THEN CONCAT('10-', de.status) ELSE d.status END AS status FROM designs d ";
예제 #2
0
 function setApproveStatus($status, $username = '')
 {
     $id = $this->id;
     if ($status == 'CLEAR') {
         //CLEAR STATUS
         $sda = array();
         $sda['approve_status'] = '0';
         $sda['approve_date'] = 'null';
         $sda['approve_by'] = 'null';
         tep_db_perform('designs_drafts', $sda, 'update', "drafts_id={$id}");
         $this->approve_status = '';
         $this->approve_date = '';
         $this->approve_by = '';
         $isReadyForSamplings = false;
     } elseif ($status == 'A' || $status == 'R') {
         //A = Approved
         //R = Rejected
         $timestamp = date('Y-m-d H:i:s');
         $sda = array();
         $sda['approve_status'] = $status;
         $sda['approve_date'] = $timestamp;
         $sda['approve_by'] = $username;
         tep_db_perform('designs_drafts', $sda, 'update', "drafts_id={$id}");
         $this->approve_status = $status;
         $this->approve_date = $timestamp;
         $this->approve_by = $username;
         if ($status == 'R') {
             //Delete All Products & Elements
             $products = $this->retrieveProducts();
             $elements = $this->retrieveElements();
             foreach ($products as $p) {
                 $this->deleteProduct($p['products_id'], 'draft-killed');
             }
             foreach ($elements as $e) {
                 $this->deleteElement($e['elements_id'], 'draft-killed');
             }
         }
         use_class('design');
         $design = new design($this->designs_id);
         if ($design->status == 4) {
             $isReadyForSamplings = $design->isReadyForSamplings();
             $new_status = $design->category == 'R' ? '5' : '10-1';
             //ONLY 'R' GOES TO SAMPLINGS, OTHER NEED TO CREATE NEW ELEMENTS
             if ($isReadyForSamplings) {
                 $design->updateStatus($design->status, $new_status, 'auto-set');
             }
         } else {
             $isReadyForSamplings = false;
         }
     }
     return $isReadyForSamplings;
 }
예제 #3
0
                 $design->uploadImage($img_no, $image_4, basename($image_4));
                 $image4_uploaded = true;
             }
             $image_uploaded = $image1_uploaded || $image2_uploaded || $image3_uploaded || $image4_uploaded;
         }
         if (!is_null($products_id) && !$image_uploaded) {
             $pids_array = explode(',', $products_id);
             use_class('products_minierp');
             $class_pm = new products_minierp();
             $product = $class_pm->retrieveDetail($pids_array[0], 'p');
             $design->uploadImage('1', DIR_WS_IMAGES . $product['p']['products_image'], basename($product['p']['products_image']));
         }
         header("Location: ?open=designs-detail&id={$design->id}" . ($hidemenuscript == '' ? '' : '&hidemenu=true'));
     }
     if (isset($_POST['status']) && $_POST['status'] == '2') {
         $design->updateStatus('1', '2', $session_userinfo['username']);
     }
     $notification_targets = $design->followers->list;
     $notification_targets[] = $design->owner_id;
     $notification_message = $obj_notifications->messageTemplateGeneral('Design', $design_copied->id, "<strong>{$session_userinfo['username']}</strong> copied", "to Design {$design->id}");
     $username = '******';
     $obj_notifications->broadcast($notification_targets, $notification_message, $username, "open=designs-detail&id={$design->id}");
     $rowListReload = true;
 } elseif ($_POST['me_action'] == 'UPDATEDESIGN') {
     $type = tep_db_prepare_input($_POST['type']);
     $cat = tep_db_prepare_input($_POST['cat']);
     $procat = tep_db_prepare_input($_POST['procat']);
     $probra = tep_db_prepare_input($_POST['probra']);
     $name = tep_db_prepare_input($_POST['name']);
     $price = tep_db_prepare_input($_POST['price']);
     $products_id = tep_db_prepare_input($_POST['products_id']);