Exemplo n.º 1
0
 /**
  * the singleton pattern
  *
  * @return SoEventManager_Controller_SoEvent
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
 public function saveStockFlow($recordData)
 {
     return $this->_save($recordData, Billing_Controller_StockFlow::getInstance(), 'StockFlow');
 }
Exemplo n.º 3
0
 private function inspectAddOrderPosition($receipt, $oPosition)
 {
     // if its an invoice -> decrease stock amount
     if ($receipt->isInvoice() || $receipt->isCredit()) {
         $stfController = Billing_Controller_StockFlow::getInstance();
         $sf = new Billing_Model_StockFlow(null, true);
         $stockLocation = Billing_Controller_StockLocation::getInstance()->getDefaultStockLocation();
         $stockLocationId = $stockLocation->getId();
         $article = $oPosition->getForeignRecord('article_id', Billing_Controller_Article::getInstance());
         if ($article->__get('is_stock_article')) {
             $articleId = $article->getId();
             $priceNetto = $oPosition->__get('price_netto');
             $direction = 'OUT';
             $bookingDate = strftime('%Y-%m-%d');
             $amount = $oPosition->__get('amount');
             $reason = 'Lieferung';
             $sf->__set('article_id', $articleId);
             $sf->__set('stock_location_id', $stockLocationId);
             $sf->__set('price_netto', $priceNetto);
             $sf->__set('direction', $direction);
             $sf->__set('booking_date', $bookingDate);
             $sf->__set('amount', $amount);
             $sf->__set('reason', $reason);
             $stfController->create($sf);
         }
     }
 }