Skip to content

Commit

Permalink
Import Magento Release 1.2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Magento Mirror committed Jan 17, 2009
1 parent 1588b75 commit c55a10a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class Mage {

public static function getVersion()
{
return '1.2.0';
return '1.2.0.1';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ public function linkAction()
{
$id = $this->getRequest()->getParam('id', 0);
$linkPurchasedItem = Mage::getModel('downloadable/link_purchased_item')->load($id);
if ( $linkPurchasedItem->getId() != $id ) {
$this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist."));
return $this->_redirect('*/customer/products');
}
if (!Mage::helper('downloadable')->getIsShareable($linkPurchasedItem)) {
if (!$this->_getCustomerSession()->getCustomerId()) {
$customerId = $this->_getCustomerSession()->getCustomerId();
if (!$customerId) {
$product = Mage::getModel('catalog/product')->load($linkPurchasedItem->getProductId());
if ($product->getId()) {
$notice = Mage::helper('downloadable')->__(
Expand All @@ -166,6 +171,11 @@ public function linkAction()
$this->_getCustomerSession()->setBeforeAuthUrl(Mage::getUrl('downloadable/customer/products/'), array('_secure' => true));
return ;
}
$linkPurchased = Mage::getModel('downloadable/link_purchased')->load($linkPurchasedItem->getPurchasedId());
if ($linkPurchased->getCustomerId() != $customerId) {
$this->_getCustomerSession()->addNotice(Mage::helper('downloadable')->__("Requested link doesn't exist."));
return $this->_redirect('*/customer/products');
}
}
$downloadsLeft = $linkPurchasedItem->getNumberOfDownloadsBought() - $linkPurchasedItem->getNumberOfDownloadsUsed();
if ($linkPurchasedItem->getStatus() == Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE
Expand Down
25 changes: 10 additions & 15 deletions app/code/core/Mage/Eav/Model/Entity/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,30 +483,25 @@ public function getAttributeTable($entityTypeId, $id)
$entityKeyName = is_numeric($entityTypeId) ? 'entity_type_id' : 'entity_type_code';
$attributeKeyName = is_numeric($id) ? 'attribute_id' : 'attribute_code';

$select = $this->_conn->select()
$select = $this->getConnection()->select()
->from(
array('e' => $this->getTable('eav/entity_type')),
array('e.entity_table')
)
->from(
array('entity_table'))
->join(
array('a' => $this->getTable('eav/attribute')),
array('a.backend_type')
)
->where('a.entity_type_id=e.entity_type_id')
'a.entity_type_id=e.entity_type_id',
array('backend_type'))
->where("e.{$entityKeyName}=?", $entityTypeId)
->where("a.{$attributeKeyName}=?", $id)
->limit(1);

$stmt = $this->_conn->query($select);

if ($stmt->rowCount() == 1) {
$row = $stmt->fetchObject();
$table = $this->getTable($row->entity_table);
if ($row->backend_type && $row->backend_type != 'static') {
$table .= '_' . $row->backend_type;
if ($result = $this->getConnection()->fetchRow($select)) {
$table = $this->getTable($result['entity_table']);
if ($result['backend_type'] != 'static') {
$table .= '_' . $result['backend_type'];
}
return $table;
}

return false;
}

Expand Down

0 comments on commit c55a10a

Please sign in to comment.