Remove vatnumber

This commit is contained in:
Abhishek Kumar
2022-04-27 19:37:33 +05:30
parent c5aa251371
commit 5c532000dc
18 changed files with 17 additions and 146 deletions

View File

@@ -237,13 +237,6 @@ class AddressCore extends ObjectModel
public function validateController($htmlentities = true)
{
$errors = parent::validateController($htmlentities);
if (!Configuration::get('VATNUMBER_MANAGEMENT') || !Configuration::get('VATNUMBER_CHECKING')) {
return $errors;
}
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
if (class_exists('VatNumber', false)) {
return array_merge($errors, VatNumber::WebServiceCheck($this->vat_number));
}
return $errors;
}
/**

View File

@@ -591,13 +591,6 @@ class ProductCore extends ObjectModel
$id_address = (int)$cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
}
$address_infos = Address::getCountryAndState($id_address);
if (self::$_taxCalculationMethod != PS_TAX_EXC
&& !empty($address_infos['vat_number'])
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')) {
self::$_taxCalculationMethod = PS_TAX_EXC;
}
} else {
self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
}
@@ -2865,13 +2858,6 @@ class ProductCore extends ObjectModel
$usetax = false;
}
if ($usetax != false
&& !empty($address_infos['vat_number'])
&& $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')) {
$usetax = false;
}
if (is_null($id_customer) && Validate::isLoadedObject($context->customer)) {
$id_customer = $context->customer->id;
}

View File

@@ -465,7 +465,6 @@ class FrontControllerCore extends Controller
'use_taxes' => (int)Configuration::get('PS_TAX'),
'show_taxes' => (int)(Configuration::get('PS_TAX_DISPLAY') == 1 && (int)Configuration::get('PS_TAX')),
'display_tax_label' => (bool)$display_tax_label,
'vat_management' => (int)Configuration::get('VATNUMBER_MANAGEMENT'),
'opc' => (bool)Configuration::get('PS_ORDER_PROCESS_TYPE'),
'PS_CATALOG_MODE' => (bool)Configuration::get('PS_CATALOG_MODE') || (Group::isFeatureActive() && !(bool)Group::getCurrent()->show_prices),
'b2b_enable' => (bool)Configuration::get('PS_B2B_ENABLE'),

View File

@@ -533,9 +533,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$debug = Tools::getValue('debug');
$address = new Address((int)$this->order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT')
&& !empty($address->vat_number)
&& $address->id_country != Configuration::get('VATNUMBER_COUNTRY');
$carrier = new Carrier($this->order->id_carrier);
// code to send name of the taxes applied on the order to show names od taxes in the invoice for GST
@@ -560,7 +557,6 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$data = array(
'showTaxName' => $showTaxName,
'tax_exempt' => $tax_exempt,
'use_one_after_another_method' => $this->order_invoice->useOneAfterAnotherTaxComputationMethod(),
'display_tax_bases_in_breakdowns' => $this->order_invoice->displayTaxBasesInProductTaxesBreakdown(),
'product_tax_breakdown' => $this->order_invoice->getProductTaxesBreakdown($this->order),

View File

@@ -199,12 +199,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
public function getTaxTabContent()
{
$address = new Address((int)$this->order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
$tax_exempt = Configuration::get('VATNUMBER_MANAGEMENT')
&& !empty($address->vat_number)
&& $address->id_country != Configuration::get('VATNUMBER_COUNTRY');
$this->smarty->assign(array(
'tax_exempt' => $tax_exempt,
'product_tax_breakdown' => $this->getProductTaxesBreakdown(),
'shipping_tax_breakdown' => $this->getShippingTaxesBreakdown(),
'order' => $this->order,

View File

@@ -62,7 +62,6 @@
<module action="enable" name="blockcart"/>
<module action="enable" name="blockuserinfo"/>
<module action="disable" name="pscleaner"/>
<module action="disable" name="vatnumber"/>
<hooks>
<hook module="hotelreservationsystem" hook="actionValidateOrder" position="1"/>
<hook module="hotelreservationsystem" hook="Header" position="1"/>

View File

@@ -2135,7 +2135,6 @@ class AdminThemesControllerCore extends AdminController
'statssales',
'statsvisits',
'themeconfigurator',
'vatnumber',
'watermark'
);
}

View File

@@ -257,7 +257,6 @@ class AddressControllerCore extends FrontController
parent::initContent();
$this->assignCountries();
$this->assignVatNumber();
$this->assignAddressFormat();
// Assign common vars
@@ -331,32 +330,6 @@ class AddressControllerCore extends FrontController
));
}
/**
* Assign template vars related to vat number
* @todo move this in vatnumber module !
*/
protected function assignVatNumber()
{
$vat_number_exists = file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
$vat_number_management = Configuration::get('VATNUMBER_MANAGEMENT');
if ($vat_number_management && $vat_number_exists) {
include_once(_PS_MODULE_DIR_.'vatnumber/vatnumber.php');
}
if ($vat_number_management && $vat_number_exists && VatNumber::isApplicable((int)Tools::getCountry())) {
$vat_display = 2;
} elseif ($vat_number_management) {
$vat_display = 1;
} else {
$vat_display = 0;
}
$this->context->smarty->assign(array(
'vatnumber_ajax_call' => file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'),
'vat_display' => $vat_display,
));
}
public function displayAjax()
{
if (count($this->errors)) {

View File

@@ -209,7 +209,6 @@ class AuthControllerCore extends FrontController
'countries' => $countries,
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'sl_country' => (int)$this->id_country,
'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')
));
}

View File

@@ -167,13 +167,6 @@ class HotelRoomTypeDemand extends ObjectModel
$useTax = false;
}
if ($useTax != false
&& !empty($addressInfos['vat_number'])
&& $addressInfos['id_country'] != Configuration::get('VATNUMBER_COUNTRY')
&& Configuration::get('VATNUMBER_MANAGEMENT')) {
$useTax = false;
}
if (is_null($idCustomer) && Validate::isLoadedObject($context->customer)) {
$idCustomer = $context->customer->id;
}

View File

@@ -25,9 +25,7 @@
<!-- TAX DETAILS -->
{if $tax_exempt}
{l s='Exempt of VAT according to section 259B of the General Tax Code.' pdf='true'}
{elseif (isset($tax_breakdowns) && $tax_breakdowns)}
{if (isset($tax_breakdowns) && $tax_breakdowns)}
{assign var=th_rows value=3}
{if isset($showTaxName) && $showTaxName}
{assign var=th_rows value=$th_rows+1}

View File

@@ -232,7 +232,4 @@
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{if isset($vatnumber_ajax_call) && $vatnumber_ajax_call}
{addJsDef vatnumber_ajax_call=$vatnumber_ajax_call}
{/if}
{/strip}

View File

@@ -695,9 +695,6 @@
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{if isset($vatnumber_ajax_call) && $vatnumber_ajax_call}
{addJsDef vatnumber_ajax_call=$vatnumber_ajax_call}
{/if}
{if isset($email_create) && $email_create}
{addJsDef email_create=$email_create|boolval}
{else}

View File

@@ -22,69 +22,24 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function(){
vat_number();
vat_number_ajax();
$(document).on('input', '#company, #company_invoice', function(){
vat_number();
});
$(document).ready(function() {
vat_number();
$(document).on('input', '#company, #company_invoice', function(){
vat_number();
});
});
function vat_number()
{
if ($('#company').length && ($('#company').val() != ''))
$('#vat_number, #vat_number_block').show();
else
$('#vat_number, #vat_number_block').hide();
function vat_number() {
if ($('#company').length && ($('#company').val() != '')) {
$('#vat_number, #vat_number_block').show();
} else {
$('#vat_number, #vat_number_block').hide();
}
if ($('#company_invoice').length && ($('#company_invoice').val() != ''))
$('#vat_number_block_invoice').show();
else
$('#vat_number_block_invoice').hide();
}
function vat_number_ajax()
{
$(document).on('change', '#id_country', function()
{
if ($('#company').length && !$('#company').val())
return;
if (typeof vatnumber_ajax_call !== 'undefined' && vatnumber_ajax_call)
$.ajax({
type: 'POST',
headers: {"cache-control": "no-cache"},
url: baseDir + 'modules/vatnumber/ajax.php?id_country=' + parseInt($(this).val()) + '&rand=' + new Date().getTime(),
success: function(isApplicable){
if(isApplicable == "1")
{
$('#vat_area').show();
$('#vat_number').show();
}
else
$('#vat_area').hide();
}
});
});
$(document).on('change', '#id_country_invoice', function()
{
if ($('#company_invoice').length && !$('#company_invoice').val())
return;
if (typeof vatnumber_ajax_call !== 'undefined' && vatnumber_ajax_call)
$.ajax({
type: 'POST',
headers: {"cache-control": "no-cache"},
url: baseDir + 'modules/vatnumber/ajax.php?id_country=' + parseInt($(this).val()) + '&rand=' + new Date().getTime(),
success: function(isApplicable){
if(isApplicable == "1")
{
$('#vat_area_invoice').show();
$('#vat_number_invoice').show();
}
else
$('#vat_area_invoice').hide();
}
});
});
if ($('#company_invoice').length && ($('#company_invoice').val() != '')) {
$('#vat_number_block_invoice').show();
} else {
$('#vat_number_block_invoice').hide();
}
}

View File

@@ -56,7 +56,6 @@
{addJsDef displayPrice=$priceDisplay}
{addJsDef taxEnabled=$use_taxes}
{addJsDef conditionEnabled=$conditions|intval}
{addJsDef vat_management=$vat_management|intval}
{addJsDef errorCarrier=$errorCarrier|@addcslashes:'\''}
{addJsDef errorTOS=$errorTOS|@addcslashes:'\''}
{addJsDef checkedCarrier=$checked|intval}

View File

@@ -420,7 +420,4 @@
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{if isset($vatnumber_ajax_call) && $vatnumber_ajax_call}
{addJsDef vatnumber_ajax_call=$vatnumber_ajax_call}
{/if}
{/strip}

View File

@@ -425,7 +425,4 @@
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{if isset($vatnumber_ajax_call) && $vatnumber_ajax_call}
{addJsDef vatnumber_ajax_call=$vatnumber_ajax_call}
{/if}
{/strip}

View File

@@ -343,7 +343,6 @@
{addJsDef displayPrice=$priceDisplay}
{addJsDef taxEnabled=$use_taxes}
{addJsDef conditionEnabled=$conditions|intval}
{addJsDef vat_management=$vat_management|intval}
{addJsDef errorCarrier=$errorCarrier|@addcslashes:'\''}
{addJsDef errorTOS=$errorTOS|@addcslashes:'\''}
{addJsDef checkedCarrier=$checked|intval}