Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F803972
D54.id288.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:02 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:02 AM (8 h, 6 m)
Engine
blob
Format
Raw Data
Handle
576692
Attached To
D54: MINC-120 - Make tangible item detection in order temp-table aware
D54.id288.diff
View Options
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
Log In to Comment