public function setAsConfirmed() { //WE DISABLE THE ELEMENTS SOURCING INTEGRATION HERE AND WILL BE IMPLEMENT IN A NEW MODULE TO DIRECTLY CREATE A PO global $session_userinfo; use_class('stock_booking'); use_class('depot_orders'); use_class('products_minierp'); use_class('elements_preorder'); $class_pm = new products_minierp(); $class_do = new depot_orders(); $depot_orders_id = array(); $booking = new stock_booking(); $booking->create('Preorder: ' . $this->name); foreach ($this->items as $i) { $stock = $class_pm->stockRetrieveDetail(WAREHOUSE_ID_PRODUCTS_HAMBURG, $i['products_id'], $i['articles_id']); $booking->addItem($stock['products_stock_id'], $i['qty_booked']); for ($q = 1; $q <= $i['qty_preproduce']; $q++) { $depot_orders_id[] = $class_do->newOrder(SEGMENT_ID_HAMBURG, $i['products_id'], $i['articles_id'], $i['products_ean'], 1); } } $elements_sourcing = $this->getElementsNeededForOnDemand(); // foreach($elements_sourcing as $eid=>$qty) { // $epo = new elements_preorder($eid); // $epo->addOrder($qty, null, 'Preorder '.$this->id); // } $this->updateConnection($booking->id, $depot_orders_id, $elements_sourcing); $this->updateStatus($this->status, 2, $session_userinfo['username']); }
if ($_POST['me_action'] == 'LOADEXISTINGORDERS') { $existingorders = stock_booking::getOpenBookingOrders('NAME'); if (count($existingorders) == 0) { $result = 'NONE'; } else { $result = '<h3>Use Existing Order</h3>'; $result .= '<div><select id="booking_existing" class="input2">' . loadComboListFromArray($existingorders) . '</select></div>'; $result .= '<div><input id="btn-selectorder" type="button" value="Use Selected Order" /></div>'; } echo utf8_encode($result); exit; } elseif ($_POST['me_action'] == 'CREATENEWORDER') { $name = tep_db_prepare_input($_POST['booking_name']); $status = tep_db_prepare_input($_POST['booking_status']); $booking = new stock_booking(); $booking->create($name, $status); echo utf8_encode($booking->id); exit; } elseif ($_POST['me_action'] == 'LOADPRODUCT') { $booking_id = tep_db_prepare_input($_POST['booking_id']); $pid = tep_db_prepare_input($_POST['pid']); $pos = tep_db_prepare_input($_POST['pos']); use_class('products_minierp'); use_class('products_articles'); $class_pm = new products_minierp(); $class_pa = new products_articles(); $booking = new stock_booking($booking_id); $product = $class_pm->retrieveDetail($pid, 'p,pnc'); $articles = $class_pa->retrieveList($pid, "active_status='1'"); $alist = array(); $alist[0] = $product['p']['products_ean'] . ($product['pnc']['products_length'] > 0 ? ' ⋅ ' . textLength($product['pnc']['products_length']) : '');