Пример #1
0
 /**
  * Edit
  *
  * @access public
  */
 public function display_edit()
 {
     $template = Template::get();
     $object = Type::get_by_id($_GET['id']);
     $template->assign('object', $object);
     if (isset($_POST['object'])) {
         $object->load_array($_POST['object']);
         $object->save();
         Session::set_sticky('updated', true);
         Session::redirect($this->get_module_path() . '?action=edit&id=' . $object->id);
     }
     $interface = \Skeleton\I18n\Config::$language_interface;
     $languages = $interface::get_all();
     $template->assign('languages', $languages);
 }
Пример #2
0
 /**
  * add_delivery
  *
  * @access public
  */
 public function display_add_delivery()
 {
     $purchase_order = \Skeleton\Package\Stock\Purchase\Order::get_by_id($_GET['id']);
     if (isset($_POST['purchase_order'])) {
         $purchase_order->load_array($_POST['purchase_order']);
         $purchase_order->save();
     }
     if (isset($_POST['delivery'])) {
         foreach ($_POST['delivery'] as $purchase_order_item_id => $amount) {
             $purchase_order_item = \Skeleton\Package\Stock\Purchase\Order\Item::get_by_id($purchase_order_item_id);
             $purchase_order_item->deliver($amount, $purchase_order, 'Delivery for PO' . $purchase_order->id);
         }
     }
     Session::redirect($this->get_module_path() . '?action=edit&id=' . $purchase_order->id);
 }
Пример #3
0
 /**
  * Logout
  *
  * @access public
  */
 public function display_logout()
 {
     Session::destroy();
     Session::redirect('/');
 }
Пример #4
0
 /**
  * Delete
  *
  * @access public
  */
 public function display_delete()
 {
     /**
      * Get the pager
      */
     $pager = $this->get_pager();
     $classname = $pager->get_classname();
     $object = $classname::get_by_id($_GET['id']);
     $object->delete();
     Session::redirect($this->get_module_path());
 }
Пример #5
0
 /**
  * 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);
 }