diff --git a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php index bc47e7d8621..27896fdb2a9 100644 --- a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php +++ b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Customergroup.php @@ -60,7 +60,7 @@ protected function _getCustomerGroups($groupId = null) $this->_customerGroups = array(); $collection = Mage::getModel('customer/group')->getCollection(); foreach ($collection as $item) { - /* @var $item Mage_Customer_Model_Group */ + /* @var Mage_Customer_Model_Group $item */ $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); } } @@ -70,6 +70,10 @@ protected function _getCustomerGroups($groupId = null) return $this->_customerGroups; } + /** + * @param string $value + * @return Mage_CatalogInventory_Block_Adminhtml_Form_Field_Customergroup + */ public function setInputName($value) { return $this->setName($value); diff --git a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php index 2cfc19c7a04..8cfad5ad7de 100644 --- a/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php +++ b/app/code/core/Mage/CatalogInventory/Block/Adminhtml/Form/Field/Minsaleqty.php @@ -47,7 +47,8 @@ protected function _getGroupRenderer() { if (!$this->_groupRenderer) { $this->_groupRenderer = $this->getLayout()->createBlock( - 'cataloginventory/adminhtml_form_field_customergroup', '', + 'cataloginventory/adminhtml_form_field_customergroup', + '', array('is_render_to_js_template' => true) ); $this->_groupRenderer->setClass('customer_group_select'); @@ -76,7 +77,7 @@ protected function _prepareToRender() /** * Prepare existing row data object * - * @param Varien_Object + * @param Varien_Object $row */ protected function _prepareArrayRow(Varien_Object $row) { diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php index db0fe8aaaf4..50ff5abd984 100644 --- a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Abstract.php @@ -96,5 +96,4 @@ public function isMsgVisible() { return ($this->getStockQty() > 0 && $this->getStockQty() <= $this->getThresholdQty()); } - } diff --git a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php index 38285df11a6..33903e31dcf 100644 --- a/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php +++ b/app/code/core/Mage/CatalogInventory/Block/Stockqty/Composite.php @@ -64,6 +64,7 @@ public function getChildProducts() /** * Retrieve product stock qty * + * @param Mage_Catalog_Model_Product $product * @return float */ public function getProductStockQty($product) diff --git a/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php index 8fcb1e090d8..9a782fae28e 100644 --- a/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php +++ b/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php @@ -51,7 +51,7 @@ protected function _serializeValue($value) if (is_numeric($value)) { $data = (float)$value; return (string)$data; - } else if (is_array($value)) { + } elseif (is_array($value)) { $data = array(); foreach ($value as $groupId => $qty) { if (!array_key_exists($groupId, $data)) { @@ -79,7 +79,7 @@ protected function _unserializeValue($value) return array( Mage_Customer_Model_Group::CUST_GROUP_ALL => $this->_fixQty($value) ); - } else if (is_string($value) && !empty($value)) { + } elseif (is_string($value) && !empty($value)) { try { return Mage::helper('core/unserializeArray')->unserialize($value); } catch (Exception $e) { @@ -93,7 +93,7 @@ protected function _unserializeValue($value) /** * Check whether value is in form retrieved by _encodeArrayFieldValue() * - * @param mixed + * @param mixed $value * @return bool */ protected function _isEncodedArrayFieldValue($value) @@ -113,7 +113,7 @@ protected function _isEncodedArrayFieldValue($value) /** * Encode value to be used in Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract * - * @param array + * @param array $value * @return array */ protected function _encodeArrayFieldValue(array $value) @@ -132,7 +132,7 @@ protected function _encodeArrayFieldValue(array $value) /** * Decode value from used in Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract * - * @param array + * @param array $value * @return array */ protected function _decodeArrayFieldValue(array $value) @@ -169,7 +169,7 @@ public function getConfigValue($customerGroupId, $store = null) if ($groupId == $customerGroupId) { $result = $qty; break; - } else if ($groupId == Mage_Customer_Model_Group::CUST_GROUP_ALL) { + } elseif ($groupId == Mage_Customer_Model_Group::CUST_GROUP_ALL) { $result = $qty; } } diff --git a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item.php index 1914f9b7dc8..d23d8fc45d6 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item.php @@ -42,7 +42,7 @@ class Mage_CatalogInventory_Model_Api2_Stock_Item extends Mage_Api2_Model_Resour */ protected function _loadStockItemById($id) { - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = Mage::getModel('cataloginventory/stock_item')->load($id); if (!$stockItem->getId()) { $this->_critical(self::RESOURCE_NOT_FOUND); diff --git a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php index d71bec67178..ed1cb1d2d0e 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php +++ b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php @@ -31,8 +31,7 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -abstract class Mage_CatalogInventory_Model_Api2_Stock_Item_Rest - extends Mage_CatalogInventory_Model_Api2_Stock_Item +abstract class Mage_CatalogInventory_Model_Api2_Stock_Item_Rest extends Mage_CatalogInventory_Model_Api2_Stock_Item { /** * Retrieve information about specified stock item @@ -42,7 +41,7 @@ abstract class Mage_CatalogInventory_Model_Api2_Stock_Item_Rest */ protected function _retrieve() { - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = $this->_loadStockItemById($this->getRequest()->getParam('id')); return $stockItem->getData(); } @@ -65,7 +64,7 @@ protected function _retrieveCollection() */ protected function _getCollectionForRetrieve() { - /* @var $collection Mage_CatalogInventory_Model_Resource_Stock_Item_Collection */ + /* @var Mage_CatalogInventory_Model_Resource_Stock_Item_Collection $collection */ $collection = Mage::getResourceModel('cataloginventory/stock_item_collection'); $this->_applyCollectionModifiers($collection); return $collection; @@ -79,10 +78,10 @@ protected function _getCollectionForRetrieve() */ protected function _update(array $data) { - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = $this->_loadStockItemById($this->getRequest()->getParam('id')); - /* @var $validator Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item */ + /* @var Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item $validator */ $validator = Mage::getModel('cataloginventory/api2_stock_item_validator_item', array( 'resource' => $this )); @@ -118,7 +117,7 @@ protected function _multiUpdate(array $data) $this->_critical(self::RESOURCE_DATA_PRE_VALIDATION_ERROR); } - /* @var $validator Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item */ + /* @var Mage_CatalogInventory_Model_Api2_Stock_Item_Validator_Item $validator */ $validator = Mage::getModel('cataloginventory/api2_stock_item_validator_item', array( 'resource' => $this )); @@ -132,7 +131,7 @@ protected function _multiUpdate(array $data) } // Existence of a item is checked in the validator - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = $this->_loadStockItemById($itemData['item_id']); unset($itemData['item_id']); // item_id is not for update diff --git a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Validator/Item.php b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Validator/Item.php index 55d09f1d139..265ce56eaa0 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Validator/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Validator/Item.php @@ -49,7 +49,7 @@ public function isValidSingleItemDataForMultiUpdate(array $data) $this->_addError('Invalid value for "item_id" in request.'); } else { // Validate Stock Item - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = Mage::getModel('cataloginventory/stock_item')->load($data['item_id']); if (!$stockItem->getId()) { $this->_addError(sprintf('StockItem #%d not found.', $data['item_id'])); diff --git a/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php index d3b72700832..26d00d5552d 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Indexer/Stock.php @@ -99,7 +99,7 @@ protected function _construct() /** * Retrieve resource instance wrapper * - * @return Mage_CatalogInventory_Model_Mysql4_Indexer_Stock + * @inheritDoc */ protected function _getResource() { @@ -142,22 +142,22 @@ public function matchEvent(Mage_Index_Model_Event $event) $entity = $event->getEntity(); if ($entity == Mage_Core_Model_Store::ENTITY) { - /* @var $store Mage_Core_Model_Store */ + /* @var Mage_Core_Model_Store $store */ $store = $event->getDataObject(); if ($store && $store->isObjectNew()) { $result = true; } else { $result = false; } - } else if ($entity == Mage_Core_Model_Store_Group::ENTITY) { - /* @var $storeGroup Mage_Core_Model_Store_Group */ + } elseif ($entity == Mage_Core_Model_Store_Group::ENTITY) { + /* @var Mage_Core_Model_Store_Group $storeGroup */ $storeGroup = $event->getDataObject(); if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) { $result = true; } else { $result = false; } - } else if ($entity == Mage_Core_Model_Config_Data::ENTITY) { + } elseif ($entity == Mage_Core_Model_Config_Data::ENTITY) { $configData = $event->getDataObject(); if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) { $result = $configData->isValueChanged(); @@ -223,6 +223,7 @@ protected function _registerCatalogProductEvent(Mage_Index_Model_Event $event) { switch ($event->getType()) { case Mage_Index_Model_Event::TYPE_SAVE: + /** @var Mage_Catalog_Model_Product $product */ $product = $event->getDataObject(); if ($product && $product->getStockData()) { $product->setForceReindexRequired(true); @@ -260,7 +261,7 @@ protected function _registerCatalogInventoryStockItemEvent(Mage_Index_Model_Even */ protected function _registerStockItemSaveEvent(Mage_Index_Model_Event $event) { - /* @var $object Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $object */ $object = $event->getDataObject(); $event->addNewData('reindex_stock', 1); @@ -273,7 +274,9 @@ protected function _registerStockItemSaveEvent(Mage_Index_Model_Event $event) $massObject->setAttributesData(array('force_reindex_required' => 1)); $massObject->setProductIds(array($object->getProductId())); Mage::getSingleton('index/indexer')->logEvent( - $massObject, Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION + $massObject, + Mage_Catalog_Model_Product::ENTITY, + Mage_Index_Model_Event::TYPE_MASS_ACTION ); } @@ -288,7 +291,7 @@ protected function _registerStockItemSaveEvent(Mage_Index_Model_Event $event) */ protected function _registerCatalogProductDeleteEvent(Mage_Index_Model_Event $event) { - /* @var $product Mage_Catalog_Model_Product */ + /* @var Mage_Catalog_Model_Product $product */ $product = $event->getDataObject(); $parentIds = $this->_getResource()->getProductParentsByChild($product->getId()); @@ -307,7 +310,7 @@ protected function _registerCatalogProductDeleteEvent(Mage_Index_Model_Event $ev */ protected function _registerCatalogProductMassActionEvent(Mage_Index_Model_Event $event) { - /* @var $actionObject Varien_Object */ + /* @var Varien_Object $actionObject */ $actionObject = $event->getDataObject(); $attributes = array( 'status' diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php index 2d6e4b7ca82..d730e3217eb 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Configurable.php @@ -32,7 +32,6 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Configurable - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Configurable +class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Configurable extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Configurable { } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php index 47e2c9a41e7..0e486dfbbc7 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Default.php @@ -32,7 +32,6 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Default - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default +class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Default extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default { } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php index d93aec9c58c..77529b89e1d 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Grouped.php @@ -32,7 +32,6 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped +class Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Grouped extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped { } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php index b17da0b1644..02962138517 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Indexer/Stock/Interface.php @@ -32,7 +32,6 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -interface Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Interface - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface +interface Mage_CatalogInventory_Model_Mysql4_Indexer_Stock_Interface extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface { } diff --git a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php index e8fe2834a96..75adb5fb16f 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php +++ b/app/code/core/Mage/CatalogInventory/Model/Mysql4/Stock/Item/Collection.php @@ -32,7 +32,6 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection - extends Mage_CatalogInventory_Model_Resource_Stock_Item_Collection +class Mage_CatalogInventory_Model_Mysql4_Stock_Item_Collection extends Mage_CatalogInventory_Model_Resource_Stock_Item_Collection { } diff --git a/app/code/core/Mage/CatalogInventory/Model/Observer.php b/app/code/core/Mage/CatalogInventory/Model/Observer.php index 3326200648f..3fa4ac3aab5 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Observer.php +++ b/app/code/core/Mage/CatalogInventory/Model/Observer.php @@ -111,6 +111,7 @@ public function removeInventoryData($observer) */ public function addStockStatusToCollection($observer) { + /** @var Mage_Catalog_Model_Resource_Product_Collection $productCollection */ $productCollection = $observer->getEvent()->getCollection(); if ($productCollection->hasFlag('require_stock_items')) { Mage::getModel('cataloginventory/stock')->addItemsToProducts($productCollection); @@ -141,6 +142,7 @@ public function addInventoryDataToCollection($observer) */ public function saveInventoryData($observer) { + /** @var Mage_Catalog_Model_Product $product */ $product = $observer->getEvent()->getProduct(); if (is_null($product->getStockData())) { @@ -241,7 +243,6 @@ protected function _prepareItemForSave($item, $product) $item->setData('use_config_qty_increments', false); } return $this; - } /** @@ -265,6 +266,7 @@ protected function _removeErrorsFromQuoteAndItem($item, $code) $quoteItems = $quote->getItemsCollection(); $canRemoveErrorFromQuote = true; + /** @var Mage_Sales_Model_Quote_Item $quoteItem */ foreach ($quoteItems as $quoteItem) { if ($quoteItem->getItemId() == $item->getItemId()) { continue; @@ -303,7 +305,7 @@ protected function _removeErrorsFromQuoteAndItem($item, $code) public function checkQuoteItemQty($observer) { $quoteItem = $observer->getEvent()->getItem(); - /* @var $quoteItem Mage_Sales_Model_Quote_Item */ + /* @var Mage_Sales_Model_Quote_Item $quoteItem */ if (!$quoteItem || !$quoteItem->getProductId() || !$quoteItem->getQuote() || $quoteItem->getQuote()->getIsSuperMode()) { return $this; @@ -376,8 +378,8 @@ public function checkQuoteItemQty($observer) $quoteItemHasErrors = false; foreach ($options as $option) { + /** @var Mage_Sales_Model_Quote_Item_Option $option */ $optionValue = $option->getValue(); - /* @var $option Mage_Sales_Model_Quote_Item_Option */ $optionQty = $qty * $optionValue; $increaseOptionQty = ($quoteItem->getQtyToAdd() ? $quoteItem->getQtyToAdd() : $qty) * $optionValue; @@ -388,7 +390,7 @@ public function checkQuoteItemQty($observer) $stockItem->setProductName($quoteItem->getName()); } - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) { Mage::throwException( Mage::helper('cataloginventory')->__('The stock item for Product in option is not valid.') @@ -457,7 +459,7 @@ public function checkQuoteItemQty($observer) $stockItem->unsIsChildItem(); } } else { - /* @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /* @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ if (!$stockItem instanceof Mage_CatalogInventory_Model_Stock_Item) { Mage::throwException(Mage::helper('cataloginventory')->__('The stock item for Product is not valid.')); } @@ -558,9 +560,10 @@ public function checkQuoteItemQty($observer) * Get product qty includes information from all quote items * Need be used only in sungleton mode * - * @deprecated after 1.4.2.0-rc1 * @param int $productId * @param float $itemQty + * @return float|mixed + * @deprecated after 1.4.2.0-rc1 */ protected function _getProductQtyForCheck($productId, $itemQty) { @@ -603,6 +606,7 @@ protected function _getQuoteItemQtyForCheck($productId, $quoteItemId, $itemQty) */ public function checkoutAllSubmitAfter(Varien_Event_Observer $observer) { + /** @var Mage_Sales_Model_Quote $quote */ $quote = $observer->getEvent()->getQuote(); if (!$quote->getInventoryProcessed()) { $this->subtractQuoteInventory($observer); @@ -618,9 +622,11 @@ public function checkoutAllSubmitAfter(Varien_Event_Observer $observer) * Also called after every successful order placement to ensure subtraction of inventory * * @param Varien_Event_Observer $observer + * @return Mage_CatalogInventory_Model_Observer|void */ public function subtractQuoteInventory(Varien_Event_Observer $observer) { + /** @var Mage_Sales_Model_Quote $quote */ $quote = $observer->getEvent()->getQuote(); // Maybe we've already processed this quote in some event during order placement @@ -641,10 +647,11 @@ public function subtractQuoteInventory(Varien_Event_Observer $observer) /** * Revert quote items inventory data (cover not success order place case) - * @param $observer + * @param Varien_Event_Observer $observer */ public function revertQuoteInventory($observer) { + /** @var Mage_Sales_Model_Quote $quote */ $quote = $observer->getEvent()->getQuote(); $items = $this->_getProductsQty($quote->getAllItems()); Mage::getSingleton('cataloginventory/stock')->revertProductsSale($items); @@ -664,13 +671,14 @@ public function revertQuoteInventory($observer) * ) * * @param Mage_Sales_Model_Quote_Item $quoteItem - * @param array &$items + * @param array $items */ protected function _addItemToQtyArray($quoteItem, &$items) { $productId = $quoteItem->getProductId(); - if (!$productId) + if (!$productId) { return; + } if (isset($items[$productId])) { $items[$productId]['qty'] += $quoteItem->getTotalQty(); } else { @@ -720,11 +728,13 @@ protected function _getProductsQty($relatedItems) /** * Refresh stock index for specific stock items after succesful order placement * - * @param $observer + * @param Varien_Event_Observer $observer + * @return Mage_CatalogInventory_Model_Observer */ public function reindexQuoteInventory($observer) { // Reindex quote ids + /** @var Mage_Sales_Model_Quote $quote */ $quote = $observer->getEvent()->getQuote(); $productIds = array(); foreach ($quote->getAllItems() as $item) { @@ -776,11 +786,11 @@ public function reindexQuoteInventory($observer) */ public function refundOrderInventory($observer) { - /* @var $creditmemo Mage_Sales_Model_Order_Creditmemo */ + /* @var Mage_Sales_Model_Order_Creditmemo $creditmemo */ $creditmemo = $observer->getEvent()->getCreditmemo(); $items = array(); foreach ($creditmemo->getAllItems() as $item) { - /* @var $item Mage_Sales_Model_Order_Creditmemo_Item */ + /* @var Mage_Sales_Model_Order_Creditmemo_Item $item */ $return = false; if ($item->hasBackToStock()) { if ($item->getBackToStock() && $item->getQty()) { @@ -791,7 +801,7 @@ public function refundOrderInventory($observer) } if ($return) { $parentOrderId = $item->getOrderItem()->getParentItemId(); - /* @var $parentItem Mage_Sales_Model_Order_Creditmemo_Item */ + /* @var Mage_Sales_Model_Order_Creditmemo_Item $parentItem */ $parentItem = $parentOrderId ? $creditmemo->getItemByOrderId($parentOrderId) : false; $qty = $item->getQty(); if (isset($items[$item->getProductId()])) { @@ -815,6 +825,7 @@ public function refundOrderInventory($observer) */ public function cancelOrderItem($observer) { + /** @var Mage_Sales_Model_Order_Item $item */ $item = $observer->getEvent()->getItem(); $children = $item->getChildrenItems(); @@ -952,6 +963,7 @@ public function addStockStatusFilterToSelect(Varien_Event_Observer $observer) */ public function lockOrderInventoryData($observer) { + /** @var Mage_Sales_Model_Order $order */ $order = $observer->getEvent()->getOrder(); $productIds = array(); @@ -984,6 +996,7 @@ public function lockOrderInventoryData($observer) */ public function createOrderItem($observer) { + /** @var Mage_Sales_Model_Order_Item $item */ $item = $observer->getEvent()->getItem(); /** * Before creating order item need subtract ordered qty from product stock @@ -1007,6 +1020,7 @@ public function createOrderItem($observer) */ public function refundOrderItem($observer) { + /** @var Mage_Sales_Model_Order_Creditmemo_Item $item */ $item = $observer->getEvent()->getCreditmemoItem(); if ($item->getId() && $item->getBackToStock() && ($productId = $item->getProductId()) && ($qty = $item->getQty()) @@ -1024,7 +1038,8 @@ public function refundOrderItem($observer) public function reindexProductsMassAction($observer) { Mage::getSingleton('index/indexer')->indexEvents( - Mage_Catalog_Model_Product::ENTITY, Mage_Index_Model_Event::TYPE_MASS_ACTION + Mage_Catalog_Model_Product::ENTITY, + Mage_Index_Model_Event::TYPE_MASS_ACTION ); } diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php index c3a0133fce6..b3d874a43b0 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Configurable.php @@ -32,8 +32,7 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Configurable - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default +class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Configurable extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default { /** * Reindex stock data for defined configurable product ids @@ -66,23 +65,28 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f ->join( array('cis' => $this->getTable('cataloginventory/stock')), '', - array('stock_id')) + array('stock_id') + ) ->joinLeft( array('cisi' => $this->getTable('cataloginventory/stock_item')), 'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id', - array()) + array() + ) ->joinLeft( array('l' => $this->getTable('catalog/product_super_link')), 'l.parent_id = e.entity_id', - array()) + array() + ) ->join( array('le' => $this->getTable('catalog/product')), 'le.entity_id = l.product_id', - array()) + array() + ) ->joinLeft( array('i' => $idxTable), 'i.product_id = l.product_id AND cw.website_id = i.website_id AND cis.stock_id = i.stock_id', - array()) + array() + ) ->columns(array('qty' => new Zend_Db_Expr('0'))) ->where('cw.website_id != 0') ->where('e.type_id = ?', $this->getTypeId()) @@ -92,11 +96,17 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f $psCond = $adapter->quoteInto($psExpr . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED); if ($this->_isManageStock()) { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, 'cisi.is_in_stock'); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', + 1, + 'cisi.is_in_stock' + ); } else { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', - 'cisi.is_in_stock', 1); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', + 'cisi.is_in_stock', + 1 + ); } $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0); diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php index 775eb96f58c..8a871e996a6 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Default.php @@ -32,9 +32,7 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default - extends Mage_Catalog_Model_Resource_Product_Indexer_Abstract - implements Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface +class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default extends Mage_Catalog_Model_Resource_Product_Indexer_Abstract implements Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface { /** * Current Product Type Id @@ -168,11 +166,13 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f ->join( array('cis' => $this->getTable('cataloginventory/stock')), '', - array('stock_id')) + array('stock_id') + ) ->joinLeft( array('cisi' => $this->getTable('cataloginventory/stock_item')), 'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id', - array()) + array() + ) ->columns(array('qty' => $qtyExpr)) ->where('cw.website_id != 0') ->where('e.type_id = ?', $this->getTypeId()); @@ -182,11 +182,17 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f $psCondition = $adapter->quoteInto($psExpr . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED); if ($this->_isManageStock()) { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, 'cisi.is_in_stock'); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', + 1, + 'cisi.is_in_stock' + ); } else { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', - 'cisi.is_in_stock', 1); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', + 'cisi.is_in_stock', + 1 + ); } $optExpr = $adapter->getCheckSql($psCondition, 1, 0); diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php index b3f0f8d140c..d5435be8401 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php @@ -32,8 +32,7 @@ * @package Mage_CatalogInventory * @author Magento Core Team */ -class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped - extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default +class Mage_CatalogInventory_Model_Resource_Indexer_Stock_Grouped extends Mage_CatalogInventory_Model_Resource_Indexer_Stock_Default { /** * Reindex stock data for defined configurable product ids @@ -66,23 +65,28 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f ->join( array('cis' => $this->getTable('cataloginventory/stock')), '', - array('stock_id')) + array('stock_id') + ) ->joinLeft( array('cisi' => $this->getTable('cataloginventory/stock_item')), 'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id', - array()) + array() + ) ->joinLeft( array('l' => $this->getTable('catalog/product_link')), 'e.entity_id = l.product_id AND l.link_type_id=' . Mage_Catalog_Model_Product_Link::LINK_TYPE_GROUPED, - array()) + array() + ) ->joinLeft( array('le' => $this->getTable('catalog/product')), 'le.entity_id = l.linked_product_id', - array()) + array() + ) ->joinLeft( array('i' => $idxTable), 'i.product_id = l.linked_product_id AND cw.website_id = i.website_id AND cis.stock_id = i.stock_id', - array()) + array() + ) ->columns(array('qty' => new Zend_Db_Expr('0'))) ->where('cw.website_id != 0') ->where('e.type_id = ?', $this->getTypeId()) @@ -93,11 +97,17 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f $psCond = $adapter->quoteInto($psExpr . '=?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED); if ($this->_isManageStock()) { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', - 1, 'cisi.is_in_stock'); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 0', + 1, + 'cisi.is_in_stock' + ); } else { - $statusExpr = $adapter->getCheckSql('cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', - 'cisi.is_in_stock', 1); + $statusExpr = $adapter->getCheckSql( + 'cisi.use_config_manage_stock = 0 AND cisi.manage_stock = 1', + 'cisi.is_in_stock', + 1 + ); } $optExpr = $adapter->getCheckSql("{$psCond} AND le.required_options = 0", 'i.stock_status', 0); diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Interface.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Interface.php index 868fb625af3..2e94d61fb49 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Interface.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Indexer/Stock/Interface.php @@ -39,7 +39,7 @@ interface Mage_CatalogInventory_Model_Resource_Indexer_Stock_Interface * */ public function reindexAll() -; + ; /** * Reindex stock status data for defined ids @@ -47,7 +47,7 @@ public function reindexAll() * @param int|array $entityIds */ public function reindexEntity($entityIds) -; + ; /** * Set Product Type Id for indexer @@ -55,7 +55,7 @@ public function reindexEntity($entityIds) * @param string $typeId */ public function setTypeId($typeId) -; + ; /** * Retrieve Product Type Id for indexer @@ -64,5 +64,5 @@ public function setTypeId($typeId) * */ public function getTypeId() -; + ; } diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php index 12552b8cc05..bf4713b58ff 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock.php @@ -242,7 +242,7 @@ protected function _initConfig() $this->_isConfig = true; $this->_stock = Mage::getModel('cataloginventory/stock'); - $this->_configTypeIds = array_keys(Mage::helper('catalogInventory')->getIsQtyTypeIds(true)); + $this->_configTypeIds = array_keys(Mage::helper('cataloginventory')->getIsQtyTypeIds(true)); } } @@ -263,7 +263,8 @@ public function updateSetOutOfStock() ->from($this->getTable('catalog/product'), 'entity_id') ->where('type_id IN(?)', $this->_configTypeIds); - $where = sprintf('stock_id = %1$d' + $where = sprintf( + 'stock_id = %1$d' . ' AND is_in_stock = 1' . ' AND ((use_config_manage_stock = 1 AND 1 = %2$d) OR (use_config_manage_stock = 0 AND manage_stock = 1))' . ' AND ((use_config_backorders = 1 AND %3$d = %4$d) OR (use_config_backorders = 0 AND backorders = %3$d))' @@ -296,7 +297,8 @@ public function updateSetInStock() ->from($this->getTable('catalog/product'), 'entity_id') ->where('type_id IN(?)', $this->_configTypeIds); - $where = sprintf('stock_id = %1$d' + $where = sprintf( + 'stock_id = %1$d' . ' AND is_in_stock = 0' . ' AND stock_status_changed_auto = 1' . ' AND ((use_config_manage_stock = 1 AND 1 = %2$d) OR (use_config_manage_stock = 0 AND manage_stock = 1))' @@ -320,8 +322,10 @@ public function updateLowStockDate() $this->_initConfig(); $adapter = $this->_getWriteAdapter(); - $condition = $adapter->quoteInto('(use_config_notify_stock_qty = 1 AND qty < ?)', - $this->_configNotifyStockQty) . ' OR (use_config_notify_stock_qty = 0 AND qty < notify_stock_qty)'; + $condition = $adapter->quoteInto( + '(use_config_notify_stock_qty = 1 AND qty < ?)', + $this->_configNotifyStockQty + ) . ' OR (use_config_notify_stock_qty = 0 AND qty < notify_stock_qty)'; $currentDbTime = $adapter->quoteInto('?', $this->formatDate(true)); $conditionalDate = $adapter->getCheckSql($condition, $currentDbTime, 'NULL'); @@ -333,7 +337,8 @@ public function updateLowStockDate() ->from($this->getTable('catalog/product'), 'entity_id') ->where('type_id IN(?)', $this->_configTypeIds); - $where = sprintf('stock_id = %1$d' + $where = sprintf( + 'stock_id = %1$d' . ' AND ((use_config_manage_stock = 1 AND 1 = %2$d) OR (use_config_manage_stock = 0 AND manage_stock = 1))' . ' AND product_id IN (%3$s)', $this->_stock->getId(), @@ -382,7 +387,8 @@ public function addLowStockFilter(Mage_Catalog_Model_Resource_Product_Collection . join(') ' . Zend_Db_Select::SQL_OR .' (', $where) . '))'; - $collection->joinTable(array('invtr' => 'cataloginventory/stock_item'), + $collection->joinTable( + array('invtr' => 'cataloginventory/stock_item'), 'product_id = entity_id', $fields, $where diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php index 6a2456ee8fd..6de38eda5d7 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item.php @@ -73,7 +73,8 @@ public function loadByProductId(Mage_CatalogInventory_Model_Stock_Item $item, $p protected function _getLoadSelect($field, $value, $object) { $select = parent::_getLoadSelect($field, $value, $object) - ->join(array('p' => $this->getTable('catalog/product')), + ->join( + array('p' => $this->getTable('catalog/product')), 'product_id=p.entity_id', array('type_id') ); @@ -109,7 +110,7 @@ public function addCatalogInventoryToProductCollection($productCollection) /** * Use qty correction for qty column update * - * @param Mage_Core_Model_Abstract $object + * @param Varien_Object|Mage_CatalogInventory_Model_Stock_Item $object * @param string $table * @return array */ diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item/Collection.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item/Collection.php index ec987e8f629..c2378a29973 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item/Collection.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Item/Collection.php @@ -62,7 +62,7 @@ public function addStockFilter($stock) /** * Add product filter to collection * - * @param array $products + * @param array|Mage_Catalog_Model_Product[] $products * @return $this */ public function addProductsFilter($products) @@ -94,7 +94,7 @@ public function joinStockStatus($storeId = null) $websiteId = Mage::app()->getStore($storeId)->getWebsiteId(); $this->getSelect()->joinLeft( array('status_table' => $this->getTable('cataloginventory/stock_status')), - 'main_table.product_id=status_table.product_id' + 'main_table.product_id=status_table.product_id' . ' AND main_table.stock_id=status_table.stock_id' . $this->getConnection()->quoteInto(' AND status_table.website_id=?', $websiteId), array('stock_status') @@ -149,7 +149,7 @@ public function addQtyFilter($comparsionMethod, $qty) /** * Initialize select object * - * @return $this + * @return Varien_Db_Select */ protected function _initSelect() { diff --git a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Status.php index 9fd6bdb6558..8459a90cbb9 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Status.php +++ b/app/code/core/Mage/CatalogInventory/Model/Resource/Stock/Status.php @@ -49,14 +49,20 @@ protected function _construct() * @param Mage_CatalogInventory_Model_Stock_Status $object * @param int $productId * @param int $status - * @param float $qty + * @param int|float $qty * @param int $stockId * @param int|null $websiteId * @return $this + * @throws Zend_Db_Adapter_Exception */ - public function saveProductStatus(Mage_CatalogInventory_Model_Stock_Status $object, $productId, $status, $qty = 0, - $stockId = 1, $websiteId = null) - { + public function saveProductStatus( + Mage_CatalogInventory_Model_Stock_Status $object, + $productId, + $status, + $qty = 0, + $stockId = 1, + $websiteId = null + ) { $websites = array_keys($object->getWebsites($websiteId)); $adapter = $this->_getWriteAdapter(); foreach ($websites as $websiteId) { @@ -248,8 +254,7 @@ public function addIsInStockFilterToCollection($collection) $websiteId = Mage::app()->getStore($collection->getStoreId())->getWebsiteId(); $joinCondition = $this->_getReadAdapter() ->quoteInto('e.entity_id = stock_status_index.product_id' - . ' AND stock_status_index.website_id = ?', $websiteId - ); + . ' AND stock_status_index.website_id = ?', $websiteId); $joinCondition .= $this->_getReadAdapter()->quoteInto( ' AND stock_status_index.stock_id = ?', diff --git a/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php b/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php index 23e68afef33..6aeacbcd92e 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php +++ b/app/code/core/Mage/CatalogInventory/Model/Source/Backorders.php @@ -26,6 +26,9 @@ class Mage_CatalogInventory_Model_Source_Backorders { + /** + * @return array + */ public function toOptionArray() { return array( diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock.php b/app/code/core/Mage/CatalogInventory/Model/Stock.php index 57ebf52ac0e..5303a1b9fe0 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock.php @@ -69,7 +69,7 @@ public function getId() /** * Add stock item objects to products * - * @param collection $products + * @param Mage_Catalog_Model_Resource_Product_Collection $productCollection * @return Mage_CatalogInventory_Model_Stock */ public function addItemsToProducts($productCollection) @@ -79,9 +79,11 @@ public function addItemsToProducts($productCollection) ->joinStockStatus($productCollection->getStoreId()) ->load(); $stockItems = array(); + /** @var Mage_CatalogInventory_Model_Stock_Item $item */ foreach ($items as $item) { $stockItems[$item->getProductId()] = $item; } + /** @var Mage_Catalog_Model_Product $product */ foreach ($productCollection as $product) { if (isset($stockItems[$product->getId()])) { $stockItems[$product->getId()]->assignProduct($product); @@ -93,7 +95,7 @@ public function addItemsToProducts($productCollection) /** * Retrieve items collection object with stock filter * - * @return unknown + * @return Mage_CatalogInventory_Model_Resource_Stock_Item_Collection */ public function getItemCollection() { @@ -105,6 +107,7 @@ public function getItemCollection() * Prepare array($productId=>$qty) based on array($productId => array('qty'=>$qty, 'item'=>$stockItem)) * * @param array $items + * @return array */ protected function _prepareProductQtys($items) { @@ -116,7 +119,7 @@ protected function _prepareProductQtys($items) $stockItem = $item['item']; } $canSubtractQty = $stockItem->getId() && $stockItem->canSubtractQty(); - if ($canSubtractQty && Mage::helper('catalogInventory')->isQty($stockItem->getTypeId())) { + if ($canSubtractQty && Mage::helper('cataloginventory')->isQty($stockItem->getTypeId())) { $qtys[$productId] = $item['qty']; } } @@ -159,7 +162,8 @@ public function registerProductsSale($items) /** * - * @param unknown_type $items + * @param array $items + * @return Mage_CatalogInventory_Model_Stock */ public function revertProductsSale($items) { @@ -179,7 +183,7 @@ public function registerItemSale(Varien_Object $item) $productId = $item->getProductId(); if ($productId) { $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); - if (Mage::helper('catalogInventory')->isQty($stockItem->getTypeId())) { + if (Mage::helper('cataloginventory')->isQty($stockItem->getTypeId())) { if ($item->getStoreId()) { $stockItem->setStoreId($item->getStoreId()); } @@ -188,8 +192,7 @@ public function registerItemSale(Varien_Object $item) $stockItem->save(); } } - } - else { + } else { Mage::throwException(Mage::helper('cataloginventory')->__('Cannot specify product identifier for the order item.')); } return $this; @@ -199,13 +202,13 @@ public function registerItemSale(Varien_Object $item) * Get back to stock (when order is canceled or whatever else) * * @param int $productId - * @param numeric $qty + * @param float $qty * @return $this */ public function backItemQty($productId, $qty) { $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId); - if ($stockItem->getId() && Mage::helper('catalogInventory')->isQty($stockItem->getTypeId())) { + if ($stockItem->getId() && Mage::helper('cataloginventory')->isQty($stockItem->getTypeId())) { $stockItem->addQty($qty); if ($stockItem->getCanBackInStock() && $stockItem->getQty() > $stockItem->getMinQty()) { $stockItem->setIsInStock(true) @@ -231,7 +234,7 @@ public function lockProductItems($productIds) /** * Adds filtering for collection to return only in stock products * - * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Link_Product_Collection $collection + * @param Mage_Catalog_Model_Resource_Product_Link_Product_Collection $collection * @return $this $this */ public function addInStockFilterToCollection($collection) diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php index 23011f706eb..ecb95780251 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item.php @@ -24,47 +24,72 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Catalog Inventory Stock Model * * @method Mage_CatalogInventory_Model_Resource_Stock_Item _getResource() * @method Mage_CatalogInventory_Model_Resource_Stock_Item getResource() - * @method Mage_CatalogInventory_Model_Stock_Item setProductId(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setStockId(int $value) + * @method Mage_CatalogInventory_Model_Resource_Stock_Item_Collection getCollection() + * + * @method $this setProductId(int $value) + * @method $this setStockId(int $value) * @method float getQty() - * @method Mage_CatalogInventory_Model_Stock_Item setQty(float $value) - * @method Mage_CatalogInventory_Model_Stock_Item setMinQty(float $value) + * @method $this setQty(float $value) + * @method $this setMinQty(float $value) * @method int getUseConfigMinQty() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigMinQty(int $value) + * @method $this setUseConfigMinQty(int $value) * @method int getIsQtyDecimal() - * @method Mage_CatalogInventory_Model_Stock_Item setIsQtyDecimal(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setBackorders(int $value) + * @method $this setIsQtyDecimal(int $value) + * @method $this setBackorders(int $value) * @method int getUseConfigBackorders() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigBackorders(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setMinSaleQty(float $value) + * @method $this setUseConfigBackorders(int $value) + * @method $this setMinSaleQty(float $value) * @method int getUseConfigMinSaleQty() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigMinSaleQty(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setMaxSaleQty(float $value) + * @method $this setUseConfigMinSaleQty(int $value) + * @method $this setMaxSaleQty(float $value) * @method int getUseConfigMaxSaleQty() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigMaxSaleQty(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setIsInStock(int $value) + * @method $this setUseConfigMaxSaleQty(int $value) + * @method $this setIsInStock(int $value) * @method string getLowStockDate() - * @method Mage_CatalogInventory_Model_Stock_Item setLowStockDate(string $value) - * @method Mage_CatalogInventory_Model_Stock_Item setNotifyStockQty(float $value) + * @method $this setLowStockDate(string $value) + * @method $this setNotifyStockQty(float $value) * @method int getUseConfigNotifyStockQty() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigNotifyStockQty(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setManageStock(int $value) + * @method $this setUseConfigNotifyStockQty(int $value) + * @method $this setManageStock(int $value) * @method int getUseConfigManageStock() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigManageStock(int $value) + * @method $this setUseConfigManageStock(int $value) * @method int getStockStatusChangedAutomatically() - * @method Mage_CatalogInventory_Model_Stock_Item setStockStatusChangedAutomatically(int $value) + * @method bool hasStockStatusChangedAutomaticallyFlag() + * @method int getStockStatusChangedAutomaticallyFlag() + * @method $this setStockStatusChangedAutomatically(int $value) * @method int getUseConfigQtyIncrements() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigQtyIncrements(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setQtyIncrements(float $value) + * @method $this setUseConfigQtyIncrements(int $value) + * @method $this setQtyIncrements(float $value) * @method int getUseConfigEnableQtyIncrements() - * @method Mage_CatalogInventory_Model_Stock_Item setUseConfigEnableQtyIncrements(int $value) - * @method Mage_CatalogInventory_Model_Stock_Item setEnableQtyIncrements(int $value) + * @method $this setUseConfigEnableQtyIncrements(int $value) + * @method $this setEnableQtyIncrements(int $value) + * @method bool getStockStatus() + * @method $this setStockStatusChangedAutomaticallyFlag(bool $value) + * @method int getProductTypeId() + * @method $this setStoreId(int $value) + * @method $this setParentItem(Mage_Sales_Model_Quote_Item $value) + * @method $this setProductChangedWebsites(bool $value) + * @method string getProductName() + * @method $this setProductName(string $value) + * @method $this setProductStatusChanged(bool $value) + * @method $this setProductTypeId(string $value) + * @method bool getSuppressCheckQtyIncrements() + * @method $this setSuppressCheckQtyIncrements(bool $value) + * @method int getTypeId() + * @method $this hasIsChildItem() + * @method bool getIsChildItem() + * @method $this setIsChildItem(bool $value) + * @method $this unsIsChildItem() + * @method float getOrderedItems() + * @method $this setOrderedItems(float $value) + * @method $this setStockQty(float $value) + * @method bool hasStockQty() + * @method float getQtyCorrection() * * @category Mage * @package Mage_CatalogInventory @@ -183,7 +208,7 @@ public function getProductId() * Load item data by product * * @param mixed $product - * @return Mage_CatalogInventory_Model_Stock_Item + * @return $this */ public function loadByProduct($product) { @@ -199,7 +224,7 @@ public function loadByProduct($product) * Subtract quote item quantity * * @param float $qty - * @return Mage_CatalogInventory_Model_Stock_Item + * @return $this */ public function subtractQty($qty) { @@ -258,7 +283,7 @@ public function getStoreId() * Adding stock data to product * * @param Mage_Catalog_Model_Product $product - * @return Mage_CatalogInventory_Model_Stock_Item + * @return $this */ public function assignProduct(Mage_Catalog_Model_Product $product) { @@ -300,7 +325,7 @@ public function getCustomerGroupId() /** * Setter for customer group id * - * @param int Value of customer group id + * @param int $value Value of customer group id * @return $this */ public function setCustomerGroupId($value) @@ -528,6 +553,7 @@ public function checkQuoteItemQty($qty, $summaryQty, $origQty = 0) /** * Check if child product assigned to parent */ + /** @var Mage_Sales_Model_Quote_Item $parentItem */ $parentItem = $this->getParentItem(); if ($this->getIsChildItem() && !empty($parentItem)) { $typeInstance = $parentItem->getProduct()->getTypeInstance(true); @@ -684,7 +710,7 @@ public function checkQtyIncrements($qty) ->setQuoteMessageIndex('qty'); if ($this->getIsChildItem()) { $result->setMessage( - Mage::helper('cataloginventory')->__('%s is available for purchase in increments of %s only.',$this->getProductName(), $qtyIncrements * 1) + Mage::helper('cataloginventory')->__('%s is available for purchase in increments of %s only.', $this->getProductName(), $qtyIncrements * 1) ); } else { $result->setMessage( @@ -699,7 +725,7 @@ public function checkQtyIncrements($qty) /** * Add join for catalog in stock field to product collection * - * @param Mage_Catalog_Model_Entity_Product_Collection $productCollection + * @param Mage_Catalog_Model_Resource_Product_Collection $productCollection * @return $this */ public function addCatalogInventoryToProductCollection($productCollection) @@ -717,8 +743,11 @@ public function addCatalogInventoryToProductCollection($productCollection) * @param string $errorIndex * @return $this */ - protected function _addQuoteItemError(Mage_Sales_Model_Quote_Item $item, $itemError, - $quoteError, $errorIndex='error' + protected function _addQuoteItemError( + Mage_Sales_Model_Quote_Item $item, + $itemError, + $quoteError, + $errorIndex = 'error' ) { $item->setHasError(true); $item->setMessage($itemError); @@ -740,7 +769,7 @@ protected function _beforeSave() $typeId = $productTypeId; } - $isQty = Mage::helper('catalogInventory')->isQty($typeId); + $isQty = Mage::helper('cataloginventory')->isQty($typeId); if ($isQty) { if (!$this->verifyStock()) { @@ -752,8 +781,7 @@ protected function _beforeSave() $this->setLowStockDate(null); if ($this->verifyNotification()) { $this->setLowStockDate(Mage::app()->getLocale()->date(null, null, null, false) - ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT) - ); + ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); } $this->setStockStatusChangedAutomatically(0); @@ -863,6 +891,7 @@ public function getStockQty() $productsByGroups = $product->getTypeInstance(true)->getProductsToPurchaseByReqGroups($product); foreach ($productsByGroups as $productsInGroup) { $qty = 0; + /** @var Mage_Catalog_Model_Product $childProduct */ foreach ($productsInGroup as $childProduct) { if ($childProduct->hasStockItem()) { $qty += $childProduct->getStockItem()->getStockQty(); diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php index 55d74171b24..484bfc47330 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api.php @@ -38,6 +38,10 @@ public function __construct() $this->_storeIdSessionField = 'product_store_id'; } + /** + * @param array $productIds + * @return array + */ public function items($productIds) { if (!is_array($productIds)) { @@ -73,6 +77,12 @@ public function items($productIds) return $result; } + /** + * @param int $productId + * @param array $data + * @return bool + * @throws Mage_Api_Exception + */ public function update($productId, $data) { $product = Mage::getModel('catalog/product'); diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php index 7eaefb624b7..1fd3b1dc065 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Item/Api/V2.php @@ -40,7 +40,7 @@ class Mage_CatalogInventory_Model_Stock_Item_Api_V2 extends Mage_CatalogInventor */ public function update($productId, $data) { - /** @var $product Mage_Catalog_Model_Product */ + /** @var Mage_Catalog_Model_Product $product */ $product = Mage::getModel('catalog/product'); $idBySku = $product->getIdBySku($productId); $productId = $idBySku ? $idBySku : $productId; @@ -52,7 +52,7 @@ public function update($productId, $data) $this->_fault('not_exists'); } - /** @var $stockItem Mage_CatalogInventory_Model_Stock_Item */ + /** @var Mage_CatalogInventory_Model_Stock_Item $stockItem */ $stockItem = $product->getStockItem(); $stockData = array_replace($stockItem->getData(), (array)$data); $stockItem->setData($stockData); diff --git a/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php b/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php index 33f42464aac..91033a56bc3 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php +++ b/app/code/core/Mage/CatalogInventory/Model/Stock/Status.php @@ -97,7 +97,7 @@ public function getProductTypeInstances() * Retrieve Product Type Instance By Product Type * * @param string $productType - * @return Mage_Catalog_Model_Product_Type_Abstract + * @return Mage_Catalog_Model_Product_Type_Abstract|false */ public function getProductTypeInstance($productType) { @@ -111,6 +111,7 @@ public function getProductTypeInstance($productType) /** * Retrieve website models * + * @param null $websiteId * @return array */ public function getWebsites($websiteId = null) @@ -273,15 +274,20 @@ public function updateStatus($productId, $productType = null, $websiteId = null) * * @param int $productId * @param string $productType - * @param float $qty + * @param int|float $qty * @param int $status * @param int $stockId * @param int $websiteId * * @return $this */ - protected function _processChildren($productId, $productType, $qty = 0, $status = self::STATUS_IN_STOCK, - $stockId = 1, $websiteId = null + protected function _processChildren( + $productId, + $productType, + $qty = 0, + $status = self::STATUS_IN_STOCK, + $stockId = 1, + $websiteId = null ) { if ($status == self::STATUS_OUT_OF_STOCK) { $this->saveProductStatus($productId, $status, $qty, $stockId, $websiteId); @@ -292,7 +298,7 @@ protected function _processChildren($productId, $productType, $qty = 0, $status $websites = $this->getWebsites($websiteId); foreach (array_keys($websites) as $websiteId) { - /* @var $website Mage_Core_Model_Website */ + /* @var Mage_Core_Model_Website $website */ $statuses[$websiteId] = $status; } @@ -352,7 +358,7 @@ protected function _processParents($productId, $stockId = 1, $websiteId = null) { $parentIds = array(); foreach ($this->getProductTypeInstances() as $typeInstance) { - /* @var $typeInstance Mage_Catalog_Model_Product_Type_Abstract */ + /* @var Mage_Catalog_Model_Product_Type_Abstract $typeInstance */ $parentIds = array_merge($parentIds, $typeInstance->getParentIdsByChild($productId)); } @@ -387,7 +393,7 @@ protected function _processParents($productId, $stockId = 1, $websiteId = null) * * @param int $productId * @param int $status - * @param float $qty + * @param int|float $qty * @param int $stockId * @param int|null $websiteId * @return $this @@ -454,7 +460,7 @@ public function getProductsType($productIds) /** * Add information about stock status to product collection * - * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection + * @param Mage_Catalog_Model_Resource_Product_Collection $productCollection * @param int|null $websiteId * @param int|null $stockId * @return Mage_CatalogInventory_Model_Stock_Status @@ -471,6 +477,7 @@ public function addStockStatusToProducts($productCollection, $websiteId = null, } } $productIds = array(); + /** @var Mage_Catalog_Model_Product $product */ foreach ($productCollection as $product) { $productIds[] = $product->getId(); } @@ -528,7 +535,7 @@ public function prepareCatalogProductIndexSelect(Varien_Db_Select $select, $enti /** * Add only is in stock products filter to product collection * - * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection + * @param Mage_Catalog_Model_Resource_Product_Collection $collection * @return $this */ public function addIsInStockFilterToCollection($collection) diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php index 76168c8345f..afdd4ac5a04 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Eav_Model_Entity_Setup */ +/* @var Mage_Eav_Model_Entity_Setup $installer */ $installer->startSetup(); @@ -160,25 +160,39 @@ 'nullable' => false, 'default' => '0', ), 'Enable Qty Increments') - ->addIndex($installer->getIdxName('cataloginventory/stock_item', array('product_id', 'stock_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), - array('product_id', 'stock_id'), array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) + ->addIndex( + $installer->getIdxName('cataloginventory/stock_item', array('product_id', 'stock_id'), Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE), + array('product_id', 'stock_id'), + array('type' => Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE) ) - ->addIndex($installer->getIdxName('cataloginventory/stock_item', array('product_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_item', array('product_id')), array('product_id') ) - ->addIndex($installer->getIdxName('cataloginventory/stock_item', array('stock_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_item', array('stock_id')), array('stock_id') ) - ->addForeignKey($installer->getFkName('cataloginventory/stock_item', 'product_id', 'catalog/product', 'entity_id'), - 'product_id', $installer->getTable('catalog/product'), 'entity_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + ->addForeignKey( + $installer->getFkName('cataloginventory/stock_item', 'product_id', 'catalog/product', 'entity_id'), + 'product_id', + $installer->getTable('catalog/product'), + 'entity_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) ->addForeignKey( $installer->getFkName( - 'cataloginventory/stock_item', 'stock_id', 'cataloginventory/stock', 'stock_id' + 'cataloginventory/stock_item', + 'stock_id', + 'cataloginventory/stock', + 'stock_id' ), - 'stock_id', $installer->getTable('cataloginventory/stock'), 'stock_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + 'stock_id', + $installer->getTable('cataloginventory/stock'), + 'stock_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) ->setComment('Cataloginventory Stock Item'); $installer->getConnection()->createTable($table); @@ -211,29 +225,47 @@ 'unsigned' => true, 'nullable' => false, ), 'Stock Status') - ->addIndex($installer->getIdxName('cataloginventory/stock_status', array('stock_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status', array('stock_id')), array('stock_id') ) - ->addIndex($installer->getIdxName('cataloginventory/stock_status', array('website_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status', array('website_id')), array('website_id') ) ->addForeignKey( $installer->getFkName( - 'cataloginventory/stock_status', 'stock_id', 'cataloginventory/stock', 'stock_id' + 'cataloginventory/stock_status', + 'stock_id', + 'cataloginventory/stock', + 'stock_id' ), - 'stock_id', $installer->getTable('cataloginventory/stock'), 'stock_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + 'stock_id', + $installer->getTable('cataloginventory/stock'), + 'stock_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) ->addForeignKey( $installer->getFkName( - 'cataloginventory/stock_status', 'product_id', 'catalog/product', 'entity_id' + 'cataloginventory/stock_status', + 'product_id', + 'catalog/product', + 'entity_id' ), - 'product_id', $installer->getTable('catalog/product'), 'entity_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + 'product_id', + $installer->getTable('catalog/product'), + 'entity_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) - ->addForeignKey($installer->getFkName('cataloginventory/stock_status', 'website_id', 'core/website', 'website_id'), - 'website_id', $installer->getTable('core/website'), 'website_id', - Varien_Db_Ddl_Table::ACTION_CASCADE, Varien_Db_Ddl_Table::ACTION_CASCADE + ->addForeignKey( + $installer->getFkName('cataloginventory/stock_status', 'website_id', 'core/website', 'website_id'), + 'website_id', + $installer->getTable('core/website'), + 'website_id', + Varien_Db_Ddl_Table::ACTION_CASCADE, + Varien_Db_Ddl_Table::ACTION_CASCADE ) ->setComment('Cataloginventory Stock Status'); $installer->getConnection()->createTable($table); @@ -266,10 +298,12 @@ 'unsigned' => true, 'nullable' => false, ), 'Stock Status') - ->addIndex($installer->getIdxName('cataloginventory/stock_status_indexer_idx', array('stock_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status_indexer_idx', array('stock_id')), array('stock_id') ) - ->addIndex($installer->getIdxName('cataloginventory/stock_status_indexer_idx', array('website_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status_indexer_idx', array('website_id')), array('website_id') ) ->setComment('Cataloginventory Stock Status Indexer Idx'); @@ -303,10 +337,12 @@ 'unsigned' => true, 'nullable' => false, ), 'Stock Status') - ->addIndex($installer->getIdxName('cataloginventory/stock_status_indexer_tmp', array('stock_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status_indexer_tmp', array('stock_id')), array('stock_id') ) - ->addIndex($installer->getIdxName('cataloginventory/stock_status_indexer_tmp', array('website_id')), + ->addIndex( + $installer->getIdxName('cataloginventory/stock_status_indexer_tmp', array('website_id')), array('website_id') ) ->setComment('Cataloginventory Stock Status Indexer Tmp'); @@ -318,4 +354,3 @@ 'stock_id' => 1, 'stock_name' => 'Default' )); - diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php index a34379fe44d..4b3cc076d11 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-install-0.7.0.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Eav_Model_Entity_Setup */ +/* @var Mage_Eav_Model_Entity_Setup $installer */ $installer->startSetup(); @@ -67,4 +67,3 @@ "); $installer->endSetup(); - diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php index 366a03db0b1..5993b5dd1c3 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php index ca944185e8b..b1c02eb7b56 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.1-0.7.2.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->addColumn($this->getTable('cataloginventory_stock_item'), 'manage_stock', 'tinyint(1) unsigned NOT NULL DEFAULT 0'); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php index ea9b16341ab..6c47afe5c85 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.2-0.7.3.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->getConnection()->addColumn($this->getTable('cataloginventory_stock_item'), 'stock_status_changed_automatically', 'tinyint(1) unsigned NOT NULL DEFAULT 0'); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php index 298df3dd14b..854b256ed4d 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.3-0.7.4.php @@ -26,7 +26,7 @@ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); foreach (array( @@ -37,8 +37,11 @@ 'cataloginventory/options/notify_stock_qty' => 'cataloginventory/item_options/notify_stock_qty', 'cataloginventory/options/manage_stock' => 'cataloginventory/item_options/manage_stock', ) as $was => $become) { - $installer->run(sprintf("UPDATE `%s` SET `path` = '%s' WHERE `path` = '%s'", - $this->getTable('core/config_data'), $become, $was + $installer->run(sprintf( + "UPDATE `%s` SET `path` = '%s' WHERE `path` = '%s'", + $this->getTable('core/config_data'), + $become, + $was )); } diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php index e05b71df1ad..e2601bbb3f9 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -25,11 +25,11 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $connection = $installer->getConnection(); -/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ +/* @var Varien_Db_Adapter_Pdo_Mysql $connection */ $installer->run(" CREATE TABLE `{$installer->getTable('cataloginventory_stock_status')}` ( diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php index b574985b4a3..70b15db50d0 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.5-0.7.6.php @@ -25,12 +25,12 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $tableCataloginventoryStockItem = $installer->getTable('cataloginventory_stock_item'); $connection = $installer->getConnection(); -/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ +/* @var Varien_Db_Adapter_Pdo_Mysql $connection */ $connection->addColumn($tableCataloginventoryStockItem, 'use_config_qty_increments', "tinyint(1) unsigned NOT NULL default '1'"); $connection->addColumn($tableCataloginventoryStockItem, 'qty_increments', "decimal(12,4) NOT NULL DEFAULT '0.0000'"); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php index 633cd48d14b..22964deb264 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.6-0.7.7.php @@ -25,7 +25,7 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer->startSetup(); $installer->run(" DROP TABLE IF EXISTS `{$installer->getTable('cataloginventory/stock_status')}_idx`; diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php index 38f60a8cecc..0841b024b3d 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-0.7.7-0.7.8.php @@ -25,12 +25,12 @@ */ $installer = $this; -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $tableCataloginventoryStockItem = $installer->getTable('cataloginventory/stock_item'); $connection = $installer->getConnection(); -/* @var $connection Varien_Db_Adapter_Pdo_Mysql */ +/* @var Varien_Db_Adapter_Pdo_Mysql $connection */ $connection->addColumn($tableCataloginventoryStockItem, 'use_config_enable_qty_increments', "tinyint(1) unsigned NOT NULL default '1'"); $connection->addColumn($tableCataloginventoryStockItem, 'enable_qty_increments', "tinyint(1) unsigned NOT NULL default '0'"); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php index e48d1608da9..00c39ed06d1 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.5.9.9-1.6.0.0.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/* @var $installer Mage_Core_Model_Resource_Setup */ +/* @var Mage_Core_Model_Resource_Setup $installer */ $installer = $this; $installer->startSetup(); diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php index 54411f9630b..4a52ab1a665 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php @@ -24,9 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer Mage_Eav_Model_Entity_Setup */ +/** @var Mage_Eav_Model_Entity_Setup $installer */ $installer = $this; -/** @var $connection Varien_Db_Adapter_Pdo_Mysql */ +/** @var Varien_Db_Adapter_Pdo_Mysql $connection */ $connection = $installer->getConnection(); $connection->changeTableEngine( $installer->getTable('cataloginventory/stock_status_indexer_tmp'), diff --git a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php index a6d454f5695..2d6ba16d723 100644 --- a/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php +++ b/app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer Mage_Eav_Model_Entity_Setup */ +/** @var Mage_Eav_Model_Entity_Setup $installer */ $installer = $this; /**