Skip to content

Commit

Permalink
remove VATCHECKER_REQUIRED
Browse files Browse the repository at this point in the history
  • Loading branch information
NKoonen committed Dec 21, 2023
1 parent 3a07d2e commit f8dfca4
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions vatchecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function __construct()
{
$this->name = 'vatchecker';
$this->tab = 'billing_invoicing';
$this->version = '2.0.4';
$this->version = '2.1.0';
$this->author = 'Inform-All & Keraweb';
$this->need_instance = 1;

Expand All @@ -118,11 +118,10 @@ public function __construct()
public function install()
{
Configuration::updateValue( 'VATCHECKER_LIVE_MODE', true );
Configuration::updateValue( 'VATCHECKER_REQUIRED', true );
Configuration::updateValue( 'VATCHECKER_ALLOW_OFFLINE', true );
Configuration::updateValue( 'VATCHECKER_CUSTOMER_GROUP', false );
//Configuration::updateValue('VATCHECKER_EU_COUNTRIES', null );
//Configuration::updateValue('VATCHECKER_ORIGIN_COUNTRY', null);
Configuration::updateValue('VATCHECKER_EU_COUNTRIES', null );
Configuration::updateValue('VATCHECKER_ORIGIN_COUNTRY', null );

return parent::install()
&& $this->installDB()
Expand Down Expand Up @@ -156,7 +155,6 @@ public function installDB()
public function uninstall()
{
Configuration::deleteByName( 'VATCHECKER_LIVE_MODE' );
Configuration::deleteByName( 'VATCHECKER_REQUIRED' );
Configuration::deleteByName( 'VATCHECKER_ALLOW_OFFLINE' );
Configuration::deleteByName( 'VATCHECKER_ORIGIN_COUNTRY' );
Configuration::deleteByName( 'VATCHECKER_EU_COUNTRIES' );
Expand Down Expand Up @@ -243,7 +241,6 @@ protected function getConfigFormValues()
{
$values = [
'VATCHECKER_LIVE_MODE' => Configuration::get( 'VATCHECKER_LIVE_MODE', null, null, null, true ),
'VATCHECKER_REQUIRED' => Configuration::get( 'VATCHECKER_REQUIRED', null, null, null, true ),
'VATCHECKER_ALLOW_OFFLINE' => Configuration::get( 'VATCHECKER_ALLOW_OFFLINE', null, null, null, true ),
'VATCHECKER_ORIGIN_COUNTRY' => Configuration::get( 'VATCHECKER_ORIGIN_COUNTRY', null, null, null, '0' ),
'VATCHECKER_CUSTOMER_GROUP' => Configuration::get( 'VATCHECKER_CUSTOMER_GROUP', null, null, null, false ),
Expand Down Expand Up @@ -339,25 +336,6 @@ protected function getConfigForm()
],
],
],
[
'type' => 'switch',
'label' => $this->l( 'Validation required' ),
'name' => 'VATCHECKER_REQUIRED',
'is_bool' => true,
'desc' => $this->l( 'If a VAT number is provided, it needs to be validated by the VIES database.' ),
'values' => [
[
'id' => 'required_enabled',
'value' => true,
'label' => $this->l( 'Enabled' ),
],
[
'id' => 'required_disabled',
'value' => false,
'label' => $this->l( 'Disabled' ),
],
],
],
[
'type' => 'switch',
'label' => $this->l( 'Offline validation' ),
Expand Down Expand Up @@ -434,7 +412,7 @@ protected function getConfigForm()
*/
public function hookActionValidateCustomerAddressForm( &$params )
{
if ( empty( $params['form'] ) || ! Configuration::get( 'VATCHECKER_REQUIRED' ) ) {
if ( empty( $params['form'] ) || ! Configuration::get( 'VATCHECKER_LIVE_MODE' ) ) {
return true;
}

Expand Down

0 comments on commit f8dfca4

Please sign in to comment.