Ver código fonte

Fix view FV if BUG in hist_contacts

Piotr Labudda 5 anos atrás
pai
commit
20c6e54628
1 arquivos alterados com 18 adições e 0 exclusões
  1. 18 0
      tools/ViewFV.php

+ 18 - 0
tools/ViewFV.php

@@ -26,6 +26,24 @@ class RouteTool_ViewFV extends RouteToolBase {
 				':id_user' => $idUser,
 				':nr' => $nr,
 			]);
+			// `- 7769215` dla dużych numerów - błędnie wprowadzonych np. 9880 klient(13374) BUG nr 8635412
+			// 8635412 - BUG ID_BILLING_NUMBERS in HIST_CONTACTS
+			//  866197 - correct ID_BILLING_NUMBERS
+			// MAX BILLING_NUMBERS.ID =  874100
+			if (empty($body)) {
+				$body = DB::getPDO(931)->fetchValue("
+					select BODY_HTML
+					from HIST_CONTACTS
+					where ID_BILLING_USERS = :id_user
+						and ID_BILLING_NUMBERS = :nr
+					order by ID DESC
+					limit 1
+				", [
+					':id_user' => $idUser,
+					':nr' => $nr + 7769215,
+				]);
+			}
+
 			if (empty($body)) throw new Exception("Brak faktury");
 
 			die($body);