Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726980
D54.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
Mon, Jan 6, 4:38 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 4:38 AM (2 d, 23 h ago)
Engine
blob
Format
Raw Data
Handle
537052
Attached To
D54: MINC-120 - Make tangible item detection in order temp-table aware
D54.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