Ver Fonte

fix remove legacy

Alexandr Kozlov há 8 anos atrás
pai
commit
49d6041d06
1 ficheiros alterados com 9 adições e 19 exclusões
  1. 9 19
      src/lib/Shipment.php

+ 9 - 19
src/lib/Shipment.php

@@ -428,25 +428,15 @@ class Shipment
 
 		$isPaymentOnDelivery = is_null($isPaymentOnDelivery) ? $this->isPaymentOnDelivery() : $isPaymentOnDelivery;
 
-		$row = \Ipol\DPD\DB\Terminal\Table::getList([
-			'select' => array('CNT'),
-
-			'filter' => array_filter(array_merge(
-				[
-					'LOCATION_ID'   => $this->locationTo['ID'],
-				],
-
-				$isPaymentOnDelivery
-					? ['NPP_AVAILABLE' => 'Y', '>=NPP_AMOUNT'  => $this->getPrice()]
-					: []
-			)),
-
-			'runtime' => array(
-				new \Bitrix\Main\Entity\ExpressionField('CNT', 'COUNT(*)')
-			),
-		])->fetch();
-
-		return $row['CNT'] > 0;
+		$row = $this->getDB()->getTable('terminal')->findFirst([
+			'select' => 'count(*) as cnt',
+			'where'  => 'NPP_AVAILABLE = "Y" AND NPP_AMOUNT >= :amount',
+			'bind'   => [
+				':amount' => $this->getPrice(),
+			]
+		]);
+
+		return $row['cnt'] > 0;
 	}
 
 	/**