'.$title.'';
}
function _formartDateRapport($date)
{
$dateF = explode($date);
return ($dateF[0]+$dateF[1]+($dateF[2][0].$dateF[2][1]));
}
function checkDateRapport($NameFileRapport, $dateNewRapport)
{
$array = explode('-',$NameFileRapport);
if (($array[1]+$array[2]+$array[3]) < _formartDateRappor($dateNewRapport))
return (false);
return (true);
}
function _ifDirectoryExist($companyId)
{
if (is_dir($companyId))
return ($companyId);
mkdir($companyId);
return ($companyId);
}
function _ifConfigSet($config, $param)
{
if (!empty($config[$param]))
return($config[$param]);
return ($param);
}
function SelectTrueLabel($config, $name)
{
foreach($config as $param => $valeur)
{
if ($param == $name)
return (_ifConfigSet($config, $param));
}
return ($name);
}
function selectDevise($devise)
{
switch($devise)
{
case 'EUR':
return (' €');
case 'DOL':
return (' $');
default:
return (' €');
}
}
function _getFlags($lang, $path_icons)
{
switch($lang)
{
case 'en':
return ($path_icons.'/uk.png');
break;
case 'nl':
return ($path_icons.'/nl.png');
break;
default:
}
}
function _setParamsHasChamps($champ, $valeur, $configNace)
{
if ($champ == 'NaceCode') {
$array_nace = explode(',', $valeur);
foreach($array_nace as $code)
echo $code . ' ' . SelectTrueLabel($configNace['Section_NaceCode'], $code).'
';
} else if($champ == 'CompanyWebSite')
{
$uri = parse_url($valeur);
echo ''.$uri['host'] . '';
}
else if ($champ == 'CompanyEmail')
echo ''.$valeur.'';
else if ($champ == 'VatNumber')
echo $valeur . ' '. _checkTVA($valeur);
else
{
if (!is_object($valeur))
echo $valeur;
else
{
foreach($valeur as $row) {
foreach($row as $val)
echo $val;
}
}
}
}
function _checkTVA($tvaNumber)
{
if (!empty($tvaNumber))
{
$VatNumber = str_replace($_GET['pays'], '', $tvaNumber);
$params = new stdClass();
$params->countryCode = $_GET['pays'];
$params->vatNumber = $VatNumber;
try{
$soap_client =
new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl');
} catch(SoapFault $f) {
echo $f->getMessage();
}
$result = $soap_client->checkVat($params);
if ($result->valid)
return '';
return '';
}
}
// --------------------------------------------------------------------------- //
// getArray
// --------------------------------------------------------------------------- //
function getArray($obj)
{
if (is_array($obj) == false) {
return array($obj);
} else {
return $obj;
}
}
// --------------------------------------------------------------------------- //
// printObj
// --------------------------------------------------------------------------- //
function printObj($obj)
{
$ret = '';
foreach ($obj as $val) {
if (is_object($val) == true) {
$ret .= printObj($val);
} else if ($val == 'OldValue' ||
$val == 'NewValue') {
$ret .= '('.$val.') ';
} else if ($val != 'eq') {
$ret .= $val.' ';
}
}
return $ret;
}
// --------------------------------------------------------------------------- //
// cmp
// --------------------------------------------------------------------------- //
function cmp($a, $b)
{
if ($a->Date->_ == $b->Date->_) {
return 0;
}
return ($a->Date->_ < $b->Date->_) ? 1 : -1;
}
// --------------------------------------------------------------------------- //
// pdate
// --------------------------------------------------------------------------- //
function pdate($d)
{
if (isset($d->format) == false) {
if (isset($d->_) == true) {
return $d->_;
} else {
return $d;
}
}
$f = substr($d->format, 0, 1);
$date = '';
for ($i = 0; $i < strlen($d->format); ++$i) {
if (substr($d->format, $i, 1) != $f) {
$f = substr($d->format, $i, 1);
$date .= ' / ';
}
$date .= substr($d->_, $i, 1);
}
return $date;
}
// --------------------------------------------------------------------------- //
// arrayInsert
// --------------------------------------------------------------------------- //
function arrayInsert($array, $pos, $value)
{
return array_merge(array_slice($array, 0 , $pos),
array($value),
array_slice($array, $pos));
}
// --------------------------------------------------------------------------- //
// printLiensFinanciers
// --------------------------------------------------------------------------- //
function printLiensFinanciers(&$company, $type)
{
foreach (getArray($company->Associated) as $t) {
if ($t->RelationShip == $type) {
$libelle = '';
if (isset($t->Shares) == true) {
$libelle = $t->Shares->Percentage.' %';
}
$id = '';
if (isset($t->Company->CompanyId) == true) {
$id = $t->Company->CompanyId;
} else if (isset($t->Company->CompanyAddress) == true &&
isset($t->Company->CompanyAddress->Country) == true) {
$id = '('.$t->Company->CompanyAddress->Country.')';
}
$name = '';
if (isset($t->Company->CompanyName) == true) {
$name .= ' '.$t->Company->CompanyName->_;
}
dRow2($libelle, $name, $id);
}
}
}