Page MenuHomeIn-Portal Phabricator

D214.id1110.diff
No OneTemporary

File Metadata

Created
Tue, Feb 11, 8:07 PM

D214.id1110.diff

Index: branches/5.2.x/units/orders/orders_tag_processor.php
===================================================================
--- branches/5.2.x/units/orders/orders_tag_processor.php
+++ branches/5.2.x/units/orders/orders_tag_processor.php
@@ -108,11 +108,18 @@
function PrintCart($params)
{
$o = '';
+ $o_items = '';
- $params['render_as'] = $params['item_render_as'];
- $tag_params = array_merge($params, Array ('per_page' => -1));
-
- $o_items = $this->Application->ProcessParsedTag(rtrim('orditems.' . $this->Special, '.'), 'PrintList', $tag_params);
+ if ( $this->orderExists($params) ) {
+ $params['render_as'] = $params['item_render_as'];
+ $tag_params = array_merge($params, array('per_page' => -1));
+
+ $o_items = $this->Application->ProcessParsedTag(
+ rtrim('orditems.' . $this->Special, '.'),
+ 'PrintList',
+ $tag_params
+ );
+ }
if ( $o_items ) {
if ( isset($params['header_render_as']) ) {
@@ -202,9 +209,7 @@
function CartNotEmpty($params)
{
- $object = $this->getObject($params);
-
- if ($object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID) {
+ if ( !$this->orderExists($params) ) {
return 0;
}
@@ -219,6 +224,24 @@
return 0;
}
+ /**
+ * Checks order is exists.
+ *
+ * @param array $params Tag params.
+ *
+ * @return boolean
+ */
+ protected function orderExists(array $params)
+ {
+ $object = $this->getObject($params);
+
+ if ( $object->GetDBField('Status') != ORDER_STATUS_INCOMPLETE || $object->GetID() == FAKE_ORDER_ID ) {
+ return false;
+ }
+
+ return true;
+ }
+
function CartIsEmpty($params)
{
return $this->CartNotEmpty($params) ? false : true;

Event Timeline