// Merge -> revision 8342

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8344 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-05 14:56:02 +00:00
parent 371f9a5397
commit 79fd72e461
46 changed files with 1299 additions and 249 deletions
+10 -2
View File
@@ -36,6 +36,9 @@ class BackupCore
/** @var string custom backup directory. */
public $customBackupDir = NULL;
public $psBackupAll = true;
public $psBackupDropTable = true;
/**
* Creates a new backup object
*
@@ -45,6 +48,11 @@ class BackupCore
{
if ($filename)
$this->id = $this->getRealBackupPath($filename);
$psBackupAll = Configuration::get('PS_BACKUP_ALL');
$psBackupDropTable = Configuration::get('PS_BACKUP_DROP_TABLE');
$this->psBackupAll = $psBackupAll !== false ? $psBackupAll : true;
$this->psBackupDropTable = $psBackupDropTable !== false ? $psBackupDropTable : true;
}
/**
@@ -169,7 +177,7 @@ class BackupCore
return false;
}
if (!Configuration::get('PS_BACKUP_ALL'))
if (!$this->psBackupAll)
$ignore_insert_table = array(_DB_PREFIX_.'connections', _DB_PREFIX_.'connections_page', _DB_PREFIX_.'connections_source', _DB_PREFIX_.'guest', _DB_PREFIX_.'statssearch');
else
$ignore_insert_table = array();
@@ -228,7 +236,7 @@ class BackupCore
fwrite($fp, '/* Scheme for table ' . $schema[0]['Table'] . " */\n");
if (Configuration::get('PS_BACKUP_DROP_TABLE'))
if ($this->psBackupDropTable)
fwrite($fp, 'DROP TABLE IF EXISTS `'.$schema[0]['Table'].'`;'."\n");
fwrite($fp, $schema[0]['Create Table'] . ";\n\n");
+7 -4
View File
@@ -897,6 +897,8 @@ class PDFCore extends PDF_PageGroupCore
$priceBreakDown['totalsWithTax'][$product['tax_rate']] = 0;
if (!isset($priceBreakDown['totalsEcotax'][$product['tax_rate']]))
$priceBreakDown['totalsEcotax'][$product['tax_rate']] = 0;
if (!isset($priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']]))
$priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']] = 0;
if (!isset($priceBreakDown['totalsWithoutTax'][$product['tax_rate']]))
$priceBreakDown['totalsWithoutTax'][$product['tax_rate']] = 0;
if (!isset($taxes[$product['tax_rate']]))
@@ -950,6 +952,7 @@ class PDFCore extends PDF_PageGroupCore
}
$priceBreakDown['totalsEcotax'][$product['tax_rate']] += ($product['priceEcotax'] * $product['product_quantity']);
$priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']] += ($product['priceEcotax'] * (1 + ($product['ecotax_tax_rate'] / 100)) * $product['product_quantity']);
if ($priceBreakDown['totalsEcotax'][$product['tax_rate']])
$priceBreakDown['hasEcotax'] = 1;
$taxes[$product['tax_rate']] += $vat;
@@ -965,9 +968,9 @@ class PDFCore extends PDF_PageGroupCore
{
$priceBreakDown['totalsWithoutTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate], 2);
$priceBreakDown['totalsProductsWithoutTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate], 2);
$priceBreakDown['totalsWithTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate] * (1 + $tax_rate / 100), 2);
$priceBreakDown['totalsProductsWithTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsProductsWithoutTax'][$tax_rate] * (1 + $tax_rate / 100), 2);
$priceBreakDown['totalsProductsWithTaxAndReduction'][$product['tax_rate']] += Tools::ps_round($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$product['tax_rate']] * (1 + $tax_rate / 100), 2);
$priceBreakDown['totalsWithTax'][$tax_rate] = Tools::ps_round(($priceBreakDown['totalsWithoutTax'][$tax_rate]- $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
$priceBreakDown['totalsProductsWithTax'][$tax_rate] = Tools::ps_round(($priceBreakDown['totalsProductsWithoutTax'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
$priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate] += Tools::ps_round(($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
}
else
{
@@ -1043,7 +1046,7 @@ class PDFCore extends PDF_PageGroupCore
$this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
$this->Cell($w[0], $lineSize, self::l('Products'), 0, 0, 'R');
$this->Cell($w[1], $lineSize, number_format($tax_rate, 3, ',', ' ').' %', 0, 0, 'R');
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate], self::$currency, true)), 0, 0, 'R');
$this->Cell($w[3], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
if ($priceBreakDown['hasEcotax'])
$this->Cell($w[4], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsEcotax'][$tax_rate], self::$currency, true)), 0, 0, 'R');
+1 -1
View File
@@ -222,7 +222,7 @@ abstract class PaymentModuleCore extends Module
if (!empty($product['ecotax']))
$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, true, false);
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false, false);
$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $this->context->shop->getID(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);
$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;
+16 -2
View File
@@ -1934,14 +1934,28 @@ FileETag INode MTime Size
* @param string $type by|way
* @param string $value If no index given, use default order from admin -> pref -> products
*/
public static function getProductsOrder($type, $value = null)
public static function getProductsOrder($type, $value = null, $prefix = false)
{
switch ($type)
{
case 'by' :
$orderByPrefix = '';
if($prefix) {
if ($value == 'id_product' OR $value == 'date_add')
$orderByPrefix = 'p.';
elseif ($value == 'name')
$orderByPrefix = 'pl.';
elseif ($value == 'manufacturer')
{
$orderByPrefix = 'm.';
}
elseif ($value == 'position')
$orderByPrefix = 'cp.';
}
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
return ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
return $orderByPrefix.((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
break;
case 'way' :
+2 -1
View File
@@ -27,6 +27,7 @@
class UpgraderCore{
const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
private static $rss_version_link = 'http://www.prestashop.com/xml/version.xml';
/**
* link contains hte url where to download the file
*
@@ -98,7 +99,7 @@ class UpgraderCore{
if (!($this->autoUpgrade AND $lastCheck) AND ($force OR ($lastCheck < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))) )
{
libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
if ($feed = @simplexml_load_file('http://www.prestashop.com/xml/version.xml'))
if ($feed = @simplexml_load_file(self::$rss_version_link))
{
$this->version_name = (string)$feed->version->name;
$this->version_num = (string)$feed->version->num;