Page MenuHomeIn-Portal Phabricator

D54.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 4:38 AM

D54.diff

Index: branches/5.2.x/units/orders/orders_item.php
===================================================================
--- branches/5.2.x/units/orders/orders_item.php
+++ branches/5.2.x/units/orders/orders_item.php
@@ -93,15 +93,22 @@
/**
* Checks if tangible items are present in order
*
- * @return bool
+ * @return boolean
*/
- function HasTangibleItems()
+ public function HasTangibleItems()
{
+ $oi_table = TABLE_PREFIX . 'OrderItems';
+
+ if ( $this->IsTempTable() ) {
+ $oi_table = $this->Application->GetTempName($oi_table, 'prefix:' . $this->Prefix);
+ }
+
$sql = 'SELECT COUNT(*)
- FROM '.TABLE_PREFIX.'OrderItems orditems
- LEFT JOIN '.TABLE_PREFIX.'Products p ON p.ProductId = orditems.ProductId
- WHERE (orditems.OrderId = '.$this->GetID().') AND (p.Type = '.PRODUCT_TYPE_TANGIBLE.')';
- return $this->Conn->GetOne($sql) ? true : false;
+ FROM ' . $oi_table . ' orditems
+ LEFT JOIN ' . TABLE_PREFIX . 'Products p ON p.ProductId = orditems.ProductId
+ WHERE (orditems.OrderId = ' . $this->GetID() . ') AND (p.Type = ' . PRODUCT_TYPE_TANGIBLE . ')';
+
+ return $this->Conn->GetOne($sql) > 0;
}
/**

Event Timeline