Move isInEEC from common to thirdparty class.
This commit is contained in:
parent
aa01afc0d5
commit
24f4d5040a
@ -3576,19 +3576,6 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if a country is inside the EEC (European Economic Community)
|
||||
* @deprecated Use function isInEEC function instead
|
||||
*
|
||||
* @return boolean true = country inside EEC, false = country outside EEC
|
||||
*/
|
||||
function isInEEC()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
return isInEEC($this);
|
||||
}
|
||||
|
||||
|
||||
// --------------------
|
||||
// TODO: All functions here must be redesigned and moved as they are not business functions but output functions
|
||||
// --------------------
|
||||
@ -6005,11 +5992,11 @@ abstract class CommonObject
|
||||
$domData = ' data-element="extrafield"';
|
||||
$domData .= ' data-targetelement="'.$this->element.'"';
|
||||
$domData .= ' data-targetid="'.$this->id.'"';
|
||||
|
||||
|
||||
$html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : '';
|
||||
|
||||
|
||||
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
|
||||
|
||||
|
||||
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||
|
||||
@ -635,9 +635,58 @@ function getFormeJuridiqueLabel($code)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of countries that are inside the EEC (European Economic Community)
|
||||
* TODO Add a field into country dictionary.
|
||||
*
|
||||
* @return array Array of countries code in EEC
|
||||
*/
|
||||
function getCountriesInEEC()
|
||||
{
|
||||
// List of all country codes that are in europe for european vat rules
|
||||
// List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
|
||||
$country_code_in_EEC=array(
|
||||
'AT', // Austria
|
||||
'BE', // Belgium
|
||||
'BG', // Bulgaria
|
||||
'CY', // Cyprus
|
||||
'CZ', // Czech republic
|
||||
'DE', // Germany
|
||||
'DK', // Danemark
|
||||
'EE', // Estonia
|
||||
'ES', // Spain
|
||||
'FI', // Finland
|
||||
'FR', // France
|
||||
'GB', // United Kingdom
|
||||
'GR', // Greece
|
||||
'HR', // Croatia
|
||||
'NL', // Holland
|
||||
'HU', // Hungary
|
||||
'IE', // Ireland
|
||||
'IM', // Isle of Man - Included in UK
|
||||
'IT', // Italy
|
||||
'LT', // Lithuania
|
||||
'LU', // Luxembourg
|
||||
'LV', // Latvia
|
||||
'MC', // Monaco - Included in France
|
||||
'MT', // Malta
|
||||
//'NO', // Norway
|
||||
'PL', // Poland
|
||||
'PT', // Portugal
|
||||
'RO', // Romania
|
||||
'SE', // Sweden
|
||||
'SK', // Slovakia
|
||||
'SI', // Slovenia
|
||||
'UK', // United Kingdom
|
||||
//'CH', // Switzerland - No. Swizerland in not in EEC
|
||||
);
|
||||
|
||||
return $country_code_in_EEC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a country of an object is inside the EEC (European Economic Community)
|
||||
* TODO Add a field into country dictionary.
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @return boolean true = country inside EEC, false = country outside EEC
|
||||
@ -646,43 +695,8 @@ function isInEEC($object)
|
||||
{
|
||||
if (empty($object->country_code)) return false;
|
||||
|
||||
// List of all country codes that are in europe for european vat rules
|
||||
// List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
|
||||
$country_code_in_EEC=array(
|
||||
'AT', // Austria
|
||||
'BE', // Belgium
|
||||
'BG', // Bulgaria
|
||||
'CY', // Cyprus
|
||||
'CZ', // Czech republic
|
||||
'DE', // Germany
|
||||
'DK', // Danemark
|
||||
'EE', // Estonia
|
||||
'ES', // Spain
|
||||
'FI', // Finland
|
||||
'FR', // France
|
||||
'GB', // United Kingdom
|
||||
'GR', // Greece
|
||||
'HR', // Croatia
|
||||
'NL', // Holland
|
||||
'HU', // Hungary
|
||||
'IE', // Ireland
|
||||
'IM', // Isle of Man - Included in UK
|
||||
'IT', // Italy
|
||||
'LT', // Lithuania
|
||||
'LU', // Luxembourg
|
||||
'LV', // Latvia
|
||||
'MC', // Monaco - Included in France
|
||||
'MT', // Malta
|
||||
//'NO', // Norway
|
||||
'PL', // Poland
|
||||
'PT', // Portugal
|
||||
'RO', // Romania
|
||||
'SE', // Sweden
|
||||
'SK', // Slovakia
|
||||
'SI', // Slovenia
|
||||
'UK', // United Kingdom
|
||||
//'CH', // Switzerland - No. Swizerland in not in EEC
|
||||
);
|
||||
$country_code_in_EEC = getCountriesInEEC();
|
||||
|
||||
//print "dd".$this->country_code;
|
||||
return in_array($object->country_code, $country_code_in_EEC);
|
||||
}
|
||||
|
||||
@ -3145,6 +3145,17 @@ class Societe extends CommonObject
|
||||
return $isacompany;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a company is inside the EEC (European Economic Community)
|
||||
*
|
||||
* @return boolean true = country inside EEC, false = country outside EEC
|
||||
*/
|
||||
function isInEEC()
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
return isInEEC($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge la liste des categories fournisseurs
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user