MTva : Petit ajout

This commit is contained in:
Michael RICOIS 2017-01-19 12:39:10 +01:00
parent e9a011cecf
commit fbf5602231

View File

@ -85,10 +85,10 @@ class Metier_Partenaires_MTva
$dateRef->sub(new DateInterval('P6M'));
$dateMaj = DateTime::createFromFormat('Ymd', $tab['DateMAJ']);
$this->vatNumber = "FR".$this->cle.$this->siren;
if ($cle !== null) {
if ($cle !== null | $cle != 0) {
$this->vatDefined = true;
return true;
} elseif ($cle === null && $dateMaj >= $dateRef) {
} elseif (($cle === null || $cle == 0) && $dateMaj >= $dateRef) {
$this->vatDefined = false;
return true;
}
@ -146,8 +146,8 @@ class Metier_Partenaires_MTva
'traderStreet' => "",
'traderPostalCode' => "",
'traderCity' => "",
'requesterMemberStateCode' => "",
'requesterNumber' => "",
'requesterMemberStateCode' => "FR",
'requesterNumber' => $this->cle.$this->siren,
'action' => "check",
'check' => "Vérifier",
],
@ -160,11 +160,11 @@ class Metier_Partenaires_MTva
if (preg_match('/Yes, valid VAT number/i', $body)
|| preg_match('/Oui, numéro de TVA valide/i', $body)) {
if ($exist) {
$this->conn->update('sdv1.siren_tva', array('cle' => $this->cle,
$this->conn->update('sdv1.siren_tva', array('cle' => intval($this->cle),
'duree' => $time), array('siren' => $this->siren));
} else {
$this->conn->insert('sdv1.siren_tva', array('siren' => $this->siren,
'cle' => $this->cle, 'duree' => $time));
'cle' => intval($this->cle), 'duree' => $time));
}
$this->vatNumber = "FR".$this->cle.$this->siren;
$this->vatDefined = true;