src/ShopBundle/objects/db/TShopArticle.class.php
public function CheckActivateOrDeactivate($dNewStockValue = null)
    {
        if (null === $dNewStockValue) {
            $dNewStockValue = $this->getAvailableStock();
        }
        $isActive = 0;
        if ($this->fieldActive) {
            $isActive = 1;
        }
        $oStockMessage = &$this->GetFieldShopStockMessage();
        if ($oStockMessage) {
            if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) {
                $isActive = 1;
            }
            if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) {
                $isActive = 0;
            }
        }

        return $isActive;
    }
public function CheckActivateOrDeactivate($dNewStockValue = null)
    {
        if (null === $dNewStockValue) {
            $dNewStockValue = $this->getAvailableStock();
        }
        $isActive = 0;
        if ($this->fieldActive) {
            $isActive = 1;
        }
        $oStockMessage = &$this->GetFieldShopStockMessage();
        if ($oStockMessage) {
            if ($oStockMessage->fieldAutoActivateOnStock && $dNewStockValue > 0) {
                $isActive = 1;
            }
            if ($oStockMessage->fieldAutoDeactivateOnZeroStock && $dNewStockValue < 1) {
                $isActive = 0;
            }
        }

        return $isActive;
    }
public function CheckActivateOrDeactivate ( $ dNewStockValue = null ) { if ( null === $ dNewStockValue ) { $ dNewStockValue = $ this -> getAvailableStock ( ) ; } $ isActive = 0 ; if ( $ this -> fieldActive ) { $ isActive = 1 ; } $ oStockMessage = & $ this -> GetFieldShopStockMessage ( ) ; if ( $ oStockMessage ) { if ( $ oStockMessage -> fieldAutoActivateOnStock && $ dNewStockValue > 0 ) { $ isActive = 1 ; } if ( $ oStockMessage -> fieldAutoDeactivateOnZeroStock && $ dNewStockValue < 1 ) { $ isActive = 0 ; } } return $ isActive ; }
checks if we would deactivate the article if the stock of the article was dNewStockValue
returns 1 if the article remains active, 0 if it would be deactivated.

@param float $dNewStockValue - the stock we want to check the state of the article for

@return int
checks if we would deactivate the article if the stock of the article was dNewStockValue returns 1 if the article remains active 0 if it would be deactivated .