[*] Project : US + CA TaxSystem

This commit is contained in:
fBrignoli
2011-08-18 10:10:50 +00:00
parent 50e9f03719
commit 8f8ac0670d
33 changed files with 1665 additions and 1168 deletions
+16 -16
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -28,7 +28,7 @@
if (!defined('_PS_VERSION_'))
exit;
class VatNumber extends Module
class VatNumber extends TaxManagerModule
{
public function __construct()
{
@@ -37,35 +37,37 @@ class VatNumber extends Module
$this->version = 1.0;
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->tax_manager_class = 'VATNumberTaxManager';
parent::__construct();
$this->displayName = $this->l('European VAT number');
$this->description = $this->l('Enable entering of the VAT intra-community number when creating the address (You must fill in the company field to allow keyboarding VAT number)');
}
public function install()
{
return (parent::install() AND Configuration::updateValue('VATNUMBER_MANAGEMENT', 1));
}
public function uninstall()
{
return (parent::uninstall() AND Configuration::updateValue('VATNUMBER_MANAGEMENT', 0));
}
public function enable($forceAll = false)
{
parent::enable();
Configuration::updateValue('VATNUMBER_MANAGEMENT', 1);
}
public function disable($forceAll = false)
{
parent::disable();
Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
}
public static function getPrefixIntracomVAT()
{
$intracom_array = array(
@@ -95,13 +97,13 @@ class VatNumber extends Module
'SK'=>'SK', //Slovakia
'CZ'=>'CZ', //Czech Republic
'SI'=>'SI', //Slovenia
'RO'=>'RO', //Romania
'BG'=>'BG' //Bulgaria
'RO'=>'RO', //Romania
'BG'=>'BG' //Bulgaria
);
return $intracom_array;
}
public static function isApplicable($id_country)
public static function isApplicable($id_country)
{
return (((int)$id_country AND in_array(Country::getIsoById($id_country), self::getPrefixIntracomVAT())) ? 1 : 0);
}
@@ -144,7 +146,7 @@ class VatNumber extends Module
public function getContent()
{
$echo = '';
if (Tools::isSubmit('submitVatNumber'))
{
if (Configuration::updateValue('VATNUMBER_COUNTRY', (int)(Tools::getValue('vatnumber_country'))))
@@ -178,6 +180,4 @@ class VatNumber extends Module
</fieldset>';
return $echo;
}
}
}