extranet/library/Giant/Functions.php

84 lines
2.0 KiB
PHP

<?php
Class GiantFunction
{
public function getFlag($flag)
{
return ('<img src="/themes/default/images/drapeaux/'.$flag.'.png" />');
}
public function getTypeReport($reportType)
{
switch($reportType) {
case 'Full':
return ('FU');
case 'Compact':
return ('CO');
case 'CreditRecommendation':
return (CR);
case 'Flex':
return ('FL');
default:
return (false);
}
}
public function getMethode($methode, $parametres)
{
foreach($this->methodes as $fonction) {
if ($methode == $fonction)
return (call_user_func_array(array($this, $fonction), $parametres));
}
}
public function checkValide($valeur)
{
if (!empty($valeur))
return ($valeur);
return (null);
}
public function checkVat($vatNumber, $countryCode)
{
try {
$client = new Zend_Soap_Client('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl',
array('compression' => SOAP_COMPRESSION_ACCEPT));
} catch (SoapFault $e) {
echo $e->getMessage();
}
$parametres = new stdClass();
$parametres->countryCode = $countryCode;
$parametres->vatNumber = $vatNumber;
return ($client->checkVat($parametres)->valid);
}
public function setQuery($query)
{
$this->query = $query;
}
public function getQuery()
{
return ($this->query);
}
public function getLabelDesc()
{
return ($this->label);
}
public function getLabelResults()
{
return ($this->labelResults);
}
public function getCountryCode()
{
return ($this->Provider->Countrycode);
}
public function getCurrentPage()
{
return ($_SESSION['recherches']['giant']['page']);
}
}