This commit is contained in:
rGaillard
2011-07-06 10:10:43 +00:00
parent 31d94236ac
commit d1a13007b9
4695 changed files with 0 additions and 339293 deletions
-31
View File
@@ -1,31 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
include(dirname(__FILE__). '/../../config/config.inc.php');
include(dirname(__FILE__). '/../../init.php');
include(dirname(__FILE__). '/vatnumber.php');
echo VatNumber::isApplicable($_GET['id_country']);
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>vatnumber</name>
<displayName>European VAT number</displayName>
<version>1</version>
<description>Enable the management of VAT number.</description>
<author>PrestaShop</author>
<tab>billing_invoicing</tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
</module>
-14
View File
@@ -1,14 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{vatnumber}prestashop>vatnumber_cee549912e318726d2c4989bb507665f'] = 'Europäische MwSt.-Identifikationsnummer ';
$_MODULE['<{vatnumber}prestashop>vatnumber_d881fd0a28cbb0d0e351207e6e4d91da'] = 'Verwaltung der MwSt.-Identifikationsnummer aktivieren';
$_MODULE['<{vatnumber}prestashop>vatnumber_162b29cf61678af2aaac37f440265c28'] = 'Ihr Land wurde aktualisiert.';
$_MODULE['<{vatnumber}prestashop>vatnumber_0ca51bcd22e4d7b56b6f1d8a01cefc1f'] = 'Die Überprüfung der MwSt.-Identifikationsnummer mit dem WebService ist nun aktiviert.';
$_MODULE['<{vatnumber}prestashop>vatnumber_467c214bb76759108ece49873eda44e4'] = 'Die Überprüfung der MwSt.-Identifikationsnummer mit dem WebService ist nun deaktiviert.';
$_MODULE['<{vatnumber}prestashop>vatnumber_56564e0a106b0e0e2dc57b5a105ed639'] = 'Ihr Land';
$_MODULE['<{vatnumber}prestashop>vatnumber_038b34b36ec9eaf5f96d11e17f208f1b'] = '- Wählen Sie ein Land -';
$_MODULE['<{vatnumber}prestashop>vatnumber_ab73ac60f122e6493f53ba7699ae2139'] = 'Aktivieren Sie die Überprüfung der MwSt.-Identifikationsnummer mit dem WebService';
$_MODULE['<{vatnumber}prestashop>vatnumber_0a57ec92318a15681fb878bc2931480c'] = 'Die Überprüfung durch den Webservice ist langsam. Das Aktivieren dieser Option kann Ihren Shop verlangsamen.';
$_MODULE['<{vatnumber}prestashop>vatnumber_38fb7d24e0d60a048f540ecb18e13376'] = 'Speichern';
-4
View File
@@ -1,4 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
-14
View File
@@ -1,14 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{vatnumber}prestashop>vatnumber_cee549912e318726d2c4989bb507665f'] = 'Número de IVA europeo';
$_MODULE['<{vatnumber}prestashop>vatnumber_d881fd0a28cbb0d0e351207e6e4d91da'] = 'Activar la gestión del número de IVA';
$_MODULE['<{vatnumber}prestashop>vatnumber_162b29cf61678af2aaac37f440265c28'] = 'Actualización de su país.';
$_MODULE['<{vatnumber}prestashop>vatnumber_0ca51bcd22e4d7b56b6f1d8a01cefc1f'] = 'La comprobación del número de IVA con el WebService se encuentra activada.';
$_MODULE['<{vatnumber}prestashop>vatnumber_467c214bb76759108ece49873eda44e4'] = 'La comprobación del número de IVA con el WebService se encuentra desactivada.';
$_MODULE['<{vatnumber}prestashop>vatnumber_56564e0a106b0e0e2dc57b5a105ed639'] = 'Su país';
$_MODULE['<{vatnumber}prestashop>vatnumber_038b34b36ec9eaf5f96d11e17f208f1b'] = '--Elija un país--';
$_MODULE['<{vatnumber}prestashop>vatnumber_ab73ac60f122e6493f53ba7699ae2139'] = 'Activar la comprobación del número de IVA con el WebService';
$_MODULE['<{vatnumber}prestashop>vatnumber_0a57ec92318a15681fb878bc2931480c'] = 'La comprobación del número de IVA con el WebService es lenta. Activar esta opción puede ralentizar su tienda.';
$_MODULE['<{vatnumber}prestashop>vatnumber_38fb7d24e0d60a048f540ecb18e13376'] = 'Guardar';
-14
View File
@@ -1,14 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{vatnumber}prestashop>vatnumber_cee549912e318726d2c4989bb507665f'] = 'Numéro de TVA Europeen';
$_MODULE['<{vatnumber}prestashop>vatnumber_d881fd0a28cbb0d0e351207e6e4d91da'] = 'Activer la gestion du numéro de TVA';
$_MODULE['<{vatnumber}prestashop>vatnumber_162b29cf61678af2aaac37f440265c28'] = 'Votre pays a été mis à jour.';
$_MODULE['<{vatnumber}prestashop>vatnumber_0ca51bcd22e4d7b56b6f1d8a01cefc1f'] = 'La vérification du numéro de TVA avec le WebService est maintenant activé.';
$_MODULE['<{vatnumber}prestashop>vatnumber_467c214bb76759108ece49873eda44e4'] = 'La vérification du numéro de TVA avec le WebService est maintenant desactivé.';
$_MODULE['<{vatnumber}prestashop>vatnumber_56564e0a106b0e0e2dc57b5a105ed639'] = 'Votre pays';
$_MODULE['<{vatnumber}prestashop>vatnumber_038b34b36ec9eaf5f96d11e17f208f1b'] = '-- Choisissez un pays --';
$_MODULE['<{vatnumber}prestashop>vatnumber_ab73ac60f122e6493f53ba7699ae2139'] = 'Activer la vérification du numéro de TVA avec le WebService';
$_MODULE['<{vatnumber}prestashop>vatnumber_0a57ec92318a15681fb878bc2931480c'] = 'La vérification du numéro de TVA avec le WebService est lente. Activer cette option peut ralentir votre boutique.';
$_MODULE['<{vatnumber}prestashop>vatnumber_38fb7d24e0d60a048f540ecb18e13376'] = 'Sauvegarder';
-14
View File
@@ -1,14 +0,0 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{vatnumber}prestashop>vatnumber_cee549912e318726d2c4989bb507665f'] = 'Partita IVA Europea';
$_MODULE['<{vatnumber}prestashop>vatnumber_d881fd0a28cbb0d0e351207e6e4d91da'] = 'Consenti la gestione di numero di partita IVA';
$_MODULE['<{vatnumber}prestashop>vatnumber_162b29cf61678af2aaac37f440265c28'] = 'Il suo paese è stato aggiornato.';
$_MODULE['<{vatnumber}prestashop>vatnumber_0ca51bcd22e4d7b56b6f1d8a01cefc1f'] = 'Il controllo della partita IVA con il WebService è ora abilitato.';
$_MODULE['<{vatnumber}prestashop>vatnumber_467c214bb76759108ece49873eda44e4'] = 'Il controllo della partita IVA con il WebService è ora disattivato.';
$_MODULE['<{vatnumber}prestashop>vatnumber_56564e0a106b0e0e2dc57b5a105ed639'] = 'Il tuo paese';
$_MODULE['<{vatnumber}prestashop>vatnumber_038b34b36ec9eaf5f96d11e17f208f1b'] = '- Scegli un paese -';
$_MODULE['<{vatnumber}prestashop>vatnumber_ab73ac60f122e6493f53ba7699ae2139'] = 'Abilita il controllo della partita IVA con il WebService';
$_MODULE['<{vatnumber}prestashop>vatnumber_0a57ec92318a15681fb878bc2931480c'] = 'La verifica da parte del webservice è lenta. L\'attivazione di questa opzione può rallentare il tuo negozio.';
$_MODULE['<{vatnumber}prestashop>vatnumber_38fb7d24e0d60a048f540ecb18e13376'] = 'Salva';
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

-183
View File
@@ -1,183 +0,0 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class VatNumber extends Module
{
public function __construct()
{
$this->name = 'vatnumber';
$this->tab = 'billing_invoicing';
$this->version = 1.0;
$this->author = 'PrestaShop';
parent::__construct();
$this->displayName = $this->l('European VAT number');
$this->description = $this->l('Enable the management of 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()
{
parent::enable();
Configuration::updateValue('VATNUMBER_MANAGEMENT', 1);
}
public function disable()
{
parent::disable();
Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
}
public static function getPrefixIntracomVAT()
{
$intracom_array = array('AT'=>'AT', //Austria
'BE'=>'BE', //Belgium
'DK'=>'DK', //Denmark
'FI'=>'FI', //Finland
'FR'=>'FR', //France
'FX'=>'FR', //France m�tropolitaine
'DE'=>'DE', //Germany
'GR'=>'EL', //Greece
'IE'=>'IE', //Irland
'IT'=>'IT', //Italy
'LU'=>'LU', //Luxembourg
'NL'=>'NL', //Netherlands
'PT'=>'PT', //Portugal
'ES'=>'ES', //Spain
'SE'=>'SE', //Sweden
'GB'=>'GB', //United Kingdom
'CY'=>'CY', //Cyprus
'EE'=>'EE', //Estonia
'HU'=>'HU', //Hungary
'LV'=>'LV', //Latvia
'LT'=>'LT', //Lithuania
'MT'=>'MT', //Malta
'PL'=>'PL', //Poland
'SK'=>'SK', //Slovakia
'CZ'=>'CZ', //Czech Republic
'SI'=>'SI', //Slovenia
'RO'=>'RO', //Romania
'BG'=>'BG' //Bulgaria
);
return $intracom_array;
}
public static function isApplicable($id_country)
{
$isApplicable = in_array(Country::getIsoById((int)$id_country), VatNumber::getPrefixIntracomVAT());
if ($isApplicable == "")
{
return 0;
}
return 1;
}
public static function WebServiceCheck($vatNumber)
{
if (empty($vatNumber))
return array();
$vatNumber = str_replace(' ', '', $vatNumber);
$prefix = substr($vatNumber, 0, 2);
if (array_search($prefix, self::getPrefixIntracomVAT()) === false)
return array(Tools::displayError('Invalid VAT number'));
$vat = substr($vatNumber, 2);
$url = 'http://ec.europa.eu/taxation_customs/vies/viesquer.do?ms='.urlencode($prefix).'&iso='.urlencode($prefix).'&vat='.urlencode($vat);
@ini_set('default_socket_timeout', 2);
for ($i = 0; $i < 3; $i++)
{
if ($pageRes = file_get_contents($url))
{
if (preg_match('/invalid VAT number/i', $pageRes))
{
@ini_restore('default_socket_timeout');
return array(Tools::displayError('VAT number not found'));
}
else if (preg_match('/valid VAT number/i', $pageRes))
{
@ini_restore('default_socket_timeout');
return array();
}
else
++$i;
}
else
sleep(1);
}
ini_restore('default_socket_timeout');
return array(Tools::displayError('VAT number validation service unavailable'));
}
public function getContent()
{
global $cookie;
if (Tools::isSubmit('submitVatNumber'))
{
if (Tools::getValue('vatnumber_country'))
if (Configuration::updateValue('VATNUMBER_COUNTRY', (int)(Tools::getValue('vatnumber_country'))))
echo $this->displayConfirmation($this->l('Your country has been updated.'));
$check = (int)Tools::getValue('vatnumber_checking');
if(Configuration::get('VATNUMBER_CHECKING') != $check AND Configuration::updateValue('VATNUMBER_CHECKING', $check))
echo ($check ? $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now enabled.')) : $this->displayConfirmation($this->l('The check of the VAT number with the WebService is now disabled.')));
}
echo '
<fieldset><legend><img src="../modules/'.$this->name.'/logo.gif" /> '.$this->displayName.'</legend>
<form action="'.htmlentities($_SERVER['REQUEST_URI']).'" method="post">
<label>'.$this->l('Your country').'</label>
<div class="margin-form">
<select name="vatnumber_country">
<option value="0">'.$this->l('-- Choose a country --').'</option>';
foreach (Country::getCountries((int)($cookie->id_lang)) as $country)
echo ' <option value="'.$country['id_country'].'" '.(Tools::getValue('VATNUMBER_COUNTRY', Configuration::get('VATNUMBER_COUNTRY')) == $country['id_country'] ? 'selected="selected"' : '').'>'.$country['name'].'</option>';
echo ' </select>
</div>
<div class="clear">&nbsp;</div>
<label>'.$this->l('Enable checking of the VAT number with the WebService').'</label>
<div class="margin-form">
<input type="checkbox" name="vatnumber_checking" '.(Configuration::get('VATNUMBER_CHECKING') ? 'checked="checked"' : '').' value="1"/>
<p>'.$this->l('The verification by the webservice is slow. Enabling this option can slow down your shop.').'</p>
</div>
<div class="clear">&nbsp;</div>
<div class="margin-form">
<input type="submit" class="button" name="submitVatNumber" value="'.$this->l(' Save ').'" />
</div>
</form>
</fieldset>';
}
}