From 81117fa6ce534ecd6cd10548824d090839c0da6c Mon Sep 17 00:00:00 2001 From: Lee Saferite Date: Sat, 30 May 2009 14:41:09 -0400 Subject: [PATCH] Import Magento Release 1.3.2 --- app/code/core/Mage/Tax/Model/Mysql4/Rate.php | 190 ------------------ .../Mage/Tax/Model/Mysql4/Rate/Collection.php | 101 ---------- .../core/Mage/Tax/Model/Mysql4/Rate/Data.php | 100 --------- .../Tax/Model/Mysql4/Rate/Data/Collection.php | 65 ------ .../core/Mage/Tax/Model/Mysql4/Rate/Type.php | 40 ---- .../Tax/Model/Mysql4/Rate/Type/Collection.php | 46 ----- app/code/core/Mage/Tax/Model/Mysql4/Rule.php | 54 ----- .../Mage/Tax/Model/Mysql4/Rule/Collection.php | 105 ---------- app/code/core/Mage/Tax/Model/Rate.php | 126 ------------ app/code/core/Mage/Tax/Model/Rate/Data.php | 98 --------- app/code/core/Mage/Tax/Model/Rate/Type.php | 33 --- .../core/Mage/Tax/Model/Rate/Type/Source.php | 42 ---- app/code/core/Mage/Tax/Model/Rule.php | 85 -------- 13 files changed, 1085 deletions(-) delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate/Collection.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate/Data.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate/Data/Collection.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate/Type.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rate/Type/Collection.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rule.php delete mode 100644 app/code/core/Mage/Tax/Model/Mysql4/Rule/Collection.php delete mode 100644 app/code/core/Mage/Tax/Model/Rate.php delete mode 100644 app/code/core/Mage/Tax/Model/Rate/Data.php delete mode 100644 app/code/core/Mage/Tax/Model/Rate/Type.php delete mode 100644 app/code/core/Mage/Tax/Model/Rate/Type/Source.php delete mode 100644 app/code/core/Mage/Tax/Model/Rule.php diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rate.php b/app/code/core/Mage/Tax/Model/Mysql4/Rate.php deleted file mode 100644 index 2449b997f4..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rate.php +++ /dev/null @@ -1,190 +0,0 @@ - - */ - -class Mage_Tax_Model_Mysql4_Rate extends Mage_Core_Model_Mysql4_Abstract -{ - protected function _construct() - { - $this->_init('tax/tax_rate', 'tax_rate_id'); - } - - /** - * Initialize unique fields - * - * @return Mage_Core_Model_Mysql4_Abstract - */ - protected function _initUniqueFields() - { - $this->_uniqueFields = array(array( - 'field' => array('tax_country_id', 'tax_region_id', 'tax_postcode'), - 'title' => Mage::helper('tax')->__('Country/Region/Postal code combination'), - )); - return $this; - } - -// public function loadWithAttributes($rateId = 0) -// { -// $select = Mage::getModel('tax/rate')->getCollection() -// ->joinTypeData() -// ->joinRegionTable(); -// if (is_int($rateId) && $rateId > 0) { -// $select->addRateFilter($rateId); -// return $this->_getReadAdapter()->fetchRow($select->getSelect()); -// } else { -// return $this->_getReadAdapter()->fetchAll($select->getSelect()); -// } -// } - -// protected function _beforeSave(Mage_Core_Model_Abstract $object) -// { -// $rateArray = array( -// 'tax_county_id' => $object->getTaxCountyId(), -// 'tax_region_id' => $object->getTaxRegionId(), -// ); -// if ($object->getTaxPostcode()) { -// $rateArray['tax_postcode'] = $object->getTaxPostcode(); -// } else { -// $rateArray['tax_postcode'] = new Zend_Db_Expr('NULL'); -// } -// -// if (intval($object->getTaxRateId()) <= 0) { -// $this->_getWriteAdapter()->insert($this->getMainTable(), $rateArray); -// $rateId = $this->_getWriteAdapter()->lastInsertId(); -// } -// else { -// $rateId = $object->getTaxRateId(); -// $condition = $this->_getWriteAdapter()->quoteInto("{$this->getMainTable()}.tax_rate_id=?", $rateId); -// $this->_getWriteAdapter()->update($this->getMainTable(), $rateArray, $condition); -// -// $condition = $this->_getWriteAdapter()->quoteInto("{$this->getTable('tax/tax_rate_data')}.tax_rate_id=?", $rateId); -// $this->_getWriteAdapter()->delete($this->getTable('tax/tax_rate_data'), $condition); -// } -// -// return $this; -// } - -// protected function _afterSave(Mage_Core_Model_Abstract $object) -// { -// foreach ($object->getRateData() as $rateType => $rateValue) { -// $rateValueArray = array( -// 'tax_rate_id' => $rateId, -// 'rate_value' => $rateValue, -// 'rate_type_id' => $rateType -// ); -// $this->_getWriteAdapter()->insert($this->_rateDataTable, $rateValueArray); -// } -// } - - -// /** -// * resource tables -// */ -// protected $_rateTable; -// -// protected $_rateDataTable; -// -// /** -// * resources -// */ -// protected $_write; -// -// protected $_read; -// -// -// public function __construct() -// { -// $this->_rateTable = Mage::getSingleton('core/resource')->getTableName('tax/tax_rate'); -// $this->_rateDataTable = Mage::getSingleton('core/resource')->getTableName('tax/tax_rate_data'); -// -// $this->_read = Mage::getSingleton('core/resource')->getConnection('tax_read'); -// $this->_write = Mage::getSingleton('core/resource')->getConnection('tax_write'); -// } -// -// public function getIdFieldName() -// { -// return 'tax_rate_id'; -// } -// -// public function load($model, $rateId) -// { -// $model->setData(array()); -// } -// - -// -// public function save($rateObject) -// { -// $rateArray = array( -// 'tax_county_id' => $rateObject->getTaxCountyId(), -// 'tax_region_id' => $rateObject->getTaxRegionId(), -// ); -// if ($rateObject->getTaxPostcode()) { -// $rateArray['tax_postcode'] = $rateObject->getTaxPostcode(); -// } else { -// $rateArray['tax_postcode'] = new Zend_Db_Expr('NULL'); -// } -// if( intval($rateObject->getTaxRateId()) <= 0 ) { -// $this->_write->insert($this->_rateTable, $rateArray); -// $rateId = $this->_write->lastInsertId(); -// -// } else { -// $rateId = $rateObject->getTaxRateId(); -// $condition = $this->_write->quoteInto("{$this->_rateTable}.tax_rate_id=?", $rateId); -// $this->_write->update($this->_rateTable, $rateArray, $condition); -// -// $condition = $this->_write->quoteInto("{$this->_rateDataTable}.tax_rate_id=?", $rateId); -// $this->_write->delete($this->_rateDataTable, $condition); -// } -// -// foreach ($rateObject->getRateData() as $rateType => $rateValue) { -// $rateValueArray = array( -// 'tax_rate_id' => $rateId, -// 'rate_value' => $rateValue, -// 'rate_type_id' => $rateType -// ); -// $this->_write->insert($this->_rateDataTable, $rateValueArray); -// } -// } -// -// public function delete($rateObject) -// { -// $condition = $this->_write->quoteInto("{$this->_rateTable}.tax_rate_id=?", $rateObject->getTaxRateId()); -// $this->_write->delete($this->_rateTable, $condition); -// } -// - public function deleteAllRates() - { - $this->_getWriteAdapter()->delete($this->getMainTable()); - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Collection.php b/app/code/core/Mage/Tax/Model/Mysql4/Rate/Collection.php deleted file mode 100644 index 9b6b01f324..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Collection.php +++ /dev/null @@ -1,101 +0,0 @@ - - */ - -class Mage_Tax_Model_Mysql4_Rate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract -{ - protected function _construct() - { - $this->_init('tax/rate'); - } - - /** - * Join Type Data - * - * @return object - */ - public function joinTypeData() - { - $typeCollection = Mage::getModel('tax/rate_type')->getCollection(); - - foreach($typeCollection as $type) { - $typeId = (int) $type->getId(); - if (!$typeId) { - continue; - } - $alias = 'trd_'.$typeId; - $this->_select->joinLeft( - array($alias => $this->getTable('tax/tax_rate_data')), - "main_table.tax_rate_id={$alias}.tax_rate_id AND {$alias}.rate_type_id={$typeId}", - array('rate_value_'.$type->getId() => 'rate_value') - ); - } - - return $this; - } - - public function joinCountryTable() - { - $this->_select->join( - array('country_table' => $this->getTable('directory/country')), - 'main_table.tax_country_id=country_table.country_id', - array('country_name' => 'iso2_code') - ); - return $this; - } - - /** - * Join Region Table - * - * @return object - */ - public function joinRegionTable() - { - $this->_select->joinLeft( - array('region_table' => $this->getTable('directory/country_region')), - 'main_table.tax_region_id=region_table.region_id', - array('region_name' => 'code') - ); - return $this; - } - - public function addRateFilter($rateId) - { - if (is_int($rateId) && $rateId > 0) { - return $this->_select->where('main_table.tax_rate_id=?', $rateId); - } - else { - return $this; - } - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Data.php b/app/code/core/Mage/Tax/Model/Mysql4/Rate/Data.php deleted file mode 100644 index 9138bbed32..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Data.php +++ /dev/null @@ -1,100 +0,0 @@ -_init('tax/tax_rate_data', 'tax_rate_data_id'); - } - - public function fetchRate(Mage_Tax_Model_Rate_Data $request) - { - $bind = array( - 'country_id' => $request->getCountryId(), - 'region_id' => $request->getRegionId(), - 'tax_postcode' => $request->getPostcode() - ); - - $select = $this->_getReadAdapter()->select() - ->from(array('data'=>$this->getMainTable()), array('data.tax_rate_id')) - ->join(array('rule'=>$this->getTable('tax_rule')), 'rule.tax_rate_type_id=data.rate_type_id', array()) - ->where('rule.tax_customer_class_id = ?', $request->getCustomerClassId()) - ->where('rule.tax_product_class_id = ?', $request->getProductClassId()); - - - $rate = clone $select; - $rate - ->join(array('rate'=>$this->getTable('tax_rate')), 'rate.tax_rate_id=data.tax_rate_id', array()) - ->where('rate.tax_country_id=:country_id') - ->where('rate.tax_region_id is null or rate.tax_region_id=0 or rate.tax_region_id=:region_id') - ->where("rate.tax_postcode is null or rate.tax_postcode in ('','*') or rate.tax_postcode=:tax_postcode") - - ->order('tax_region_id desc')->order('tax_postcode desc'); - - $rateId = $this->_getReadAdapter()->fetchOne($rate, $bind); - if (!$rateId) - return 0; - - - $priority = clone $select; - $priority - ->reset(Zend_Db_Select::COLUMNS) - ->from(null, array('rule.tax_rate_type_id', 'rule.priority')) - ->where('data.tax_rate_id = ?', $rateId) - ->order('rule.priority'); - - $priorities = $this->_getReadAdapter()->fetchAll($priority, $bind); - - $values = $this->_getReadAdapter()->select(); - $values->from(array('data'=>$this->getMainTable()), array('value'=>'data.rate_value', 'data.rate_type_id')); - $values->where('data.tax_rate_id = ?', $rateId); - $rows = $this->_getReadAdapter()->fetchAll($values, $bind); - - $currentRate = $rate = 0; - if ($rows && $priorities) { - for ($i=0; $i - */ - -class Mage_Tax_Model_Mysql4_Rate_Data_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract -{ - protected function _construct() - { - $this->_init('tax/rate_data'); - } - - public function setRateFilter($rate) - { - if ($rate instanceof Mage_Tax_Model_Rate) { - $this->addFieldToFilter('tax_rate_id', $rate->getId()); - } - else { - $this->addFieldToFilter('tax_rate_id', $rate); - } - return $this; - } - - public function getItemByRateAndType($rateId, $rateTypeId) - { - if (!$rateId || !$rateTypeId) { - return false; - } - foreach ($this as $item) { - if ($item->getTaxRateId() == $rateId && $item->getRateTypeId()==$rateTypeId) { - return $item; - } - } - return false; - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type.php b/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type.php deleted file mode 100644 index 0876a1d6ee..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type.php +++ /dev/null @@ -1,40 +0,0 @@ - - */ - -class Mage_Tax_Model_Mysql4_Rate_Type extends Mage_Core_Model_Mysql4_Abstract -{ - protected function _construct() - { - $this->_init('tax/tax_rate_type', 'type_id'); - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type/Collection.php b/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type/Collection.php deleted file mode 100644 index 5237d98b53..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rate/Type/Collection.php +++ /dev/null @@ -1,46 +0,0 @@ - - */ - -class Mage_Tax_Model_Mysql4_Rate_Type_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract -{ - protected function _construct() - { - $this->_init('tax/rate_type'); - } - - public function toOptionArray() - { - return parent::_toOptionArray('type_id', 'type_name'); - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rule.php b/app/code/core/Mage/Tax/Model/Mysql4/Rule.php deleted file mode 100644 index ce8b14dfca..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rule.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class Mage_Tax_Model_Mysql4_Rule extends Mage_Core_Model_Mysql4_Abstract -{ - protected function _construct() - { - $this->_init('tax/tax_rule', 'tax_rule_id'); - } - - /** - * Initialize unique fields - * - * @return Mage_Core_Model_Mysql4_Abstract - */ - protected function _initUniqueFields() - { - $this->_uniqueFields = array(array( - 'field' => array('tax_customer_class_id', 'tax_product_class_id', 'tax_rate_type_id'), - 'title' => Mage::helper('tax')->__('Error while saving this tax rule. This product tax class, customer tax class and tax rate combination'), - )); - return $this; - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Mysql4/Rule/Collection.php b/app/code/core/Mage/Tax/Model/Mysql4/Rule/Collection.php deleted file mode 100644 index ea41b12fe3..0000000000 --- a/app/code/core/Mage/Tax/Model/Mysql4/Rule/Collection.php +++ /dev/null @@ -1,105 +0,0 @@ - - */ - -class Mage_Tax_Model_Mysql4_Rule_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract -{ - protected function _construct() - { - $this->_init('tax/rule'); - } - - public function setClassTypeFilter($classType, $classTypeId) - { - $sqlJoin = $classType == 'CUSTOMER' - ? 'main_table.tax_customer_class_id = class_table.class_id' - : 'main_table.tax_product_class_id = class_table.class_id'; - - $sqlWhere = $classType == 'CUSTOMER' - ? 'main_table.tax_customer_class_id = ?' - : 'main_table.tax_product_class_id = ?'; - - $this->_select->joinLeft( - array('class_table' => $this->getTable('tax/tax_class')), - $sqlJoin - ); - $this->_select->where($sqlWhere, $classTypeId); - - return $this; - } - - public function joinClassTable() - { - $this->_select->joinLeft( - array('class_customer_table' => $this->getTable('tax/tax_class')), - 'main_table.tax_customer_class_id = class_customer_table.class_id', - array('class_customer_name' => 'class_name') - ); - $this->_select->joinLeft( - array('class_product_table' => $this->getTable('tax/tax_class')), - 'main_table.tax_product_class_id = class_product_table.class_id', - array('class_product_name' => 'class_name') - ); - - return $this; - } - - public function joinRateTypeTable() - { - $this->_select->joinLeft( - array('rate_type_table' => $this->getTable('tax/tax_rate_type')), - 'main_table.tax_rate_type_id = rate_type_table.type_id', - array('rate_type_name' => 'type_name') - ); - - return $this; - } - - protected function _getConditionFieldName($fieldName) - { - switch ($fieldName) { - case 'class_customer_name': - $fieldName = 'class_customer_table.class_name'; - break; - case 'class_product_name': - $fieldName = 'class_product_table.class_name'; - break; - case 'rate_type_name': - $fieldName = 'rate_type_table.type_name'; - break; - default: - break; - } - return $fieldName; - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Rate.php b/app/code/core/Mage/Tax/Model/Rate.php deleted file mode 100644 index abc92af143..0000000000 --- a/app/code/core/Mage/Tax/Model/Rate.php +++ /dev/null @@ -1,126 +0,0 @@ -_init('tax/rate'); - } - - public function addRateData($rateData) - { - if (is_array($rateData) && isset($rateData['rate_type_id']) && isset($rateData['rate_value'])) { - $rateDataModel = Mage::getModel('tax/rate_data') - ->setRateTypeId($rateData['rate_type_id']) - ->setRateValue($rateData['rate_value']); - } - elseif ($rateData instanceof Mage_Tax_Model_Rate_Data) { - $rateDataModel = $rateData; - } - - if (!$rateDataModel) { - Mage::throwException(Mage::helper('tax')->__('Incorrect rate Data')); - } - - $dataItem = $this->getRateDataCollection()->getItemByRateAndType( - $this->getId(), - $rateDataModel->getRateTypeId() - ); - if ($dataItem) { - $dataItem->addData($rateDataModel->getData()); - } - else { - $this->getRateDataCollection()->addItem($rateDataModel); - } - - return $this; - } - - public function getRateDataCollection() - { - if (is_null($this->_dataCollection)) { - $this->_dataCollection = Mage::getModel('tax/rate_data')->getCollection(); - $this->_dataCollection->setRateFilter($this); - } - return $this->_dataCollection; - } - - protected function _afterLoad() - { - parent::_afterLoad(); -// if (!$this->getTaxPostcode()) { -// $this->setTaxPostcode('*'); -// } - } - - protected function _beforeSave() - { - if (!$this->hasTaxRegionId()) { - $this->setTaxRegionId(0); - } - if (!$this->getTaxPostcode()) { - $this->setTaxPostcode('*'); - } - parent::_beforeSave(); - } - - protected function _afterSave() - { - foreach ($this->getRateDataCollection() as $dataModel) { - $dataModel->setTaxRateId($this->getId()); - $dataModel->save(); - } - parent::_afterSave(); - } - -// public function loadWithAttributes($rateId) -// { -// return $this->_getResource()->loadWithAttributes($rateId); -// } - -// public function loadCollectionWithAttributes() -// { -// return $this->getCollection() -// ->joinTypeData() -// ->joinRegionTable(); -// } -// -// //public function load -// -// public function loadWithAttributes($rateId = 0) -// { -// return $this->_getResource()->loadWithAttributes($rateId); -// } - - public function deleteAllRates() - { - $this->_getResource()->deleteAllRates(); - return $this; - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Rate/Data.php b/app/code/core/Mage/Tax/Model/Rate/Data.php deleted file mode 100644 index 3389e60593..0000000000 --- a/app/code/core/Mage/Tax/Model/Rate/Data.php +++ /dev/null @@ -1,98 +0,0 @@ -_init('tax/rate_data'); - } - - public function getRate() - { - if (!$this->getCountryId() - //|| !$this->getPostcode() - //|| !$this->getRegionId() - || !$this->getCustomerClassId() - || !$this->getProductClassId() - ) { - return 0; - #throw Mage::exception('Mage_Tax', Mage::helper('tax')->__('Invalid data for tax rate calculation')); - } - - $cacheKey = $this->getCustomerClassId() - .'|'.$this->getProductClassId() - .'|'.$this->getCountryId() - .'|'.$this->getRegionId() - .'|'.$this->getPostcode(); - - if (!isset($this->_cache[$cacheKey])) { - $this->unsRateValue(); - Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$this)); - if (!$this->hasRateValue()) { - $this->setRateValue($this->_getResource()->fetchRate($this)); - } - $this->_cache[$cacheKey] = $this->getRateValue(); - } - - return $this->_cache[$cacheKey]; - } - - /** - * Remove USA post code - */ - /*public function getRegionId() - { - if (!$this->getData('region_id') && $this->getPostcode()) { - $regionId = Mage::getModel('usa/postcode')->load($this->getPostcode())->getRegionId(); - if ($regionId) { - $this->setRegionId($regionId); - } - } - return $this->getData('region_id'); - }*/ - - public function getCustomerClassId() - { - if (!$this->getData('customer_class_id')) { - $this->setCustomerClassId(Mage::getSingleton('customer/session')->getCustomer()->getTaxClassId()); - } - return $this->getData('customer_class_id'); - } -} diff --git a/app/code/core/Mage/Tax/Model/Rate/Type.php b/app/code/core/Mage/Tax/Model/Rate/Type.php deleted file mode 100644 index e43d0a1b32..0000000000 --- a/app/code/core/Mage/Tax/Model/Rate/Type.php +++ /dev/null @@ -1,33 +0,0 @@ -_init('tax/rate_type'); - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Rate/Type/Source.php b/app/code/core/Mage/Tax/Model/Rate/Type/Source.php deleted file mode 100644 index b584603837..0000000000 --- a/app/code/core/Mage/Tax/Model/Rate/Type/Source.php +++ /dev/null @@ -1,42 +0,0 @@ -_options) { - $this->_options = Mage::getModel('tax/rate_type')->getCollection() - ->load() - ->toOptionArray(); - array_unshift($this->_options, array('value'=>'', 'label'=>'')); - } - return $this->_options; - } -} \ No newline at end of file diff --git a/app/code/core/Mage/Tax/Model/Rule.php b/app/code/core/Mage/Tax/Model/Rule.php deleted file mode 100644 index ab5daad32f..0000000000 --- a/app/code/core/Mage/Tax/Model/Rule.php +++ /dev/null @@ -1,85 +0,0 @@ -_init('tax/rule'); - } - - protected function _beforeSave() - { - $this->cleanCache(); - parent::_beforeSave(); - } - - protected function _beforeDelete() - { - $this->cleanCache(); - parent::_beforeDelete(); - } - - public function cleanCache() - { - $ids = Mage::getModel('catalog/product')->getCollection() - ->addAttributeToFilter('tax_class_id', $this->getTaxProductClassId()) - ->getAllIds(); - $tags = array(); - foreach ($ids as $id) { - $tags[] = 'catalog_product_'.$id; - } - Mage::app()->cleanCache($tags); - } -// public function __construct($rule=false) -// { -// parent::__construct(); -// $this->setIdFieldName($this->getResource()->getIdFieldName()); -// } -// -// public function getResource() -// { -// return Mage::getResourceModel('tax/rule'); -// } -// -// public function load($ruleId) -// { -// $this->getResource()->load($this, $ruleId); -// return $this; -// } -// -// public function save() -// { -// $this->getResource()->save($this); -// return $this; -// } -// -// public function delete() -// { -// $this->getResource()->delete($this); -// return $this; -// } -} \ No newline at end of file