00001 <?php 00002 /** 00003 * Magento 00004 * 00005 * NOTICE OF LICENSE 00006 * 00007 * This source file is subject to the Open Software License (OSL 3.0) 00008 * that is bundled with this package in the file LICENSE.txt. 00009 * It is also available through the world-wide-web at this URL: 00010 * http://opensource.org/licenses/osl-3.0.php 00011 * If you did not receive a copy of the license and are unable to 00012 * obtain it through the world-wide-web, please send an email 00013 * to license@magentocommerce.com so we can send you a copy immediately. 00014 * 00015 * DISCLAIMER 00016 * 00017 * Do not edit or add to this file if you wish to upgrade Magento to newer 00018 * versions in the future. If you wish to customize Magento for your 00019 * needs please refer to http://www.magentocommerce.com for more information. 00020 * 00021 * @category Mage 00022 * @package Mage_Sales 00023 * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) 00024 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 00025 */ 00026 00027 /** 00028 * Sales module base helper 00029 * 00030 * @author Magento Core Team <core@magentocommerce.com> 00031 */ 00032 class Mage_Sales_Helper_Data extends Mage_Core_Helper_Data 00033 { 00034 const MAXIMUM_AVAILABLE_NUMBER = 99999999; 00035 00036 public function checkQuoteAmount(Mage_Sales_Model_Quote $quote, $amount) 00037 { 00038 if (!$quote->getHasError() && ($amount>=self::MAXIMUM_AVAILABLE_NUMBER)) { 00039 $quote->setHasError(true); 00040 $quote->addMessage( 00041 $this->__('Some items have quantities exceeding allowed quantities. Please select a lower quantity to checkout.') 00042 ); 00043 } 00044 return $this; 00045 } 00046 00047 public function canSendNewOrderConfirmationEmail($store = null) 00048 { 00049 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order::XML_PATH_EMAIL_ENABLED, $store); 00050 } 00051 00052 public function canSendNewOrderEmail($store = null) 00053 { 00054 return $this->canSendNewOrderConfirmationEmail($store); 00055 } 00056 00057 public function canSendOrderCommentEmail($store = null) 00058 { 00059 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order::XML_PATH_UPDATE_EMAIL_ENABLED, $store); 00060 } 00061 00062 public function canSendNewShipmentEmail($store = null) 00063 { 00064 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Shipment::XML_PATH_EMAIL_ENABLED, $store); 00065 } 00066 00067 public function canSendShipmentCommentEmail($store = null) 00068 { 00069 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Shipment::XML_PATH_UPDATE_EMAIL_ENABLED, $store); 00070 } 00071 00072 public function canSendNewInvoiceEmail($store = null) 00073 { 00074 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Invoice::XML_PATH_EMAIL_ENABLED, $store); 00075 } 00076 00077 public function canSendInvoiceCommentEmail($store = null) 00078 { 00079 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Invoice::XML_PATH_UPDATE_EMAIL_ENABLED, $store); 00080 } 00081 00082 public function canSendNewCreditmemoEmail($store = null) 00083 { 00084 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Creditmemo::XML_PATH_EMAIL_ENABLED, $store); 00085 } 00086 00087 public function canSendCreditmemoCommentEmail($store = null) 00088 { 00089 return Mage::getStoreConfigFlag(Mage_Sales_Model_Order_Creditmemo::XML_PATH_UPDATE_EMAIL_ENABLED, $store); 00090 } 00091 00092 }