/** * Deliver * * @access public * @param string $amount * @param object $trigger * @param string $comment */ public function deliver($amount, $trigger, $comment = '') { $stock_object = $this->get_stock_object(); \Skeleton\Package\Stock\Stock::change($stock_object, $amount, $trigger, $comment); $this->delivered += $amount; $this->save(); $purchase_order = \Skeleton\Package\Stock\Purchase\Order::get_by_id($this->purchase_order_id); $purchase_order->check_delivered(); }
/** * Handle * * @access public */ public function handle() { $this->get_courier()->handle($this); /** * Manage the stock */ if (!class_exists('\\Skeleton\\Package\\Stock\\Stock')) { return; } foreach ($this->get_overview() as $item) { \Skeleton\Package\Stock\Stock::change($item['deliverable'], $item['shipped'] * -1, $this, 'Delivery ' . $this->delivery_id); } }
/** * Add a movement * * @access public */ public function display_add_movement() { $classname = \Skeleton\Package\Stock\Config::$object_stock_interface; $product = $classname::get_by_id($_GET['id']); \Skeleton\Package\Stock\Stock::change($product, $_POST['stock_movement']['movement'], $_SESSION['user'], $_POST['stock_movement']['comment']); Session::redirect('/' . $this->get_module_path() . '?action=edit&id=' . $product->id); }