Mariusz Muszyński 7 лет назад
Родитель
Сommit
f14c1b48e5
1 измененных файлов с 12 добавлено и 2 удалено
  1. 12 2
      SE/se-lib/VAT.php

+ 12 - 2
SE/se-lib/VAT.php

@@ -83,6 +83,10 @@ Class VAT {
 			"active" => true,
 			"active" => true,
 			"shortMessage" => "Zwolniony"
 			"shortMessage" => "Zwolniony"
 		],
 		],
+		"Niepoprawny Numer Identyfikacji Podatkowej" => [
+			"active" => false,
+			"shortMessage" => "Niepoprawny NIP"
+		],
 	];
 	];
 
 
 	private function getHeaders($ch, $header) {
 	private function getHeaders($ch, $header) {
@@ -169,7 +173,9 @@ Class VAT {
 		$this->message = array_map("trim", array_values(array_diff(explode("|", $this->dom->getElementById("caption2_b-3")->textContent), [''])));
 		$this->message = array_map("trim", array_values(array_diff(explode("|", $this->dom->getElementById("caption2_b-3")->textContent), [''])));
 		if (!$this->message) {
 		if (!$this->message) {
 			$this->message = array_map("trim", array_values(array_diff(explode("\n", $this->dom->getElementById("indicator_b-7")->getAttribute("title")), [''])));
 			$this->message = array_map("trim", array_values(array_diff(explode("\n", $this->dom->getElementById("indicator_b-7")->getAttribute("title")), [''])));
-			if ($this->message) throw new Exception($this->message[0]);
+			if ($this->message) {
+//				throw new Exception($this->message[0]);
+			}
 			else throw new Exception("Błąd danych ze strony Ministerstwa Finansów");
 			else throw new Exception("Błąd danych ze strony Ministerstwa Finansów");
 		}
 		}
 		if (isset($this->messages[$this->message[0]])) return $this->messages[$this->message[0]]['active'];
 		if (isset($this->messages[$this->message[0]])) return $this->messages[$this->message[0]]['active'];
@@ -191,7 +197,11 @@ Class VAT {
 	public function isActiveVatPayer($nip) {
 	public function isActiveVatPayer($nip) {
 		$this->message = [];
 		$this->message = [];
 		$nip = str_replace("-", "", trim($nip));
 		$nip = str_replace("-", "", trim($nip));
-		if (!$this->validateNIP($nip)) throw new Exception("Błędny NIP");
+		if (!$this->validateNIP($nip)) {
+			$this->message = ["Niepoprawny Numer Identyfikacji Podatkowej"];
+			return false;
+//			throw new Exception("Błędny NIP");
+		}
 
 
 		if (!$this->initialized) $this->initialize();
 		if (!$this->initialized) $this->initialize();
 		else $this->reinitialize();
 		else $this->reinitialize();