Browse Source

add empty period test to avoid errors when there is no period defined

SiM 5 years ago
parent
commit
71f1e354d1

+ 1 - 1
apps/admin/modules/kataoCart/actions/actions.class.php

@@ -54,7 +54,7 @@ class kataoCartActions extends wpActions {
         if ('' != $this->filter_node = $this->getUser()->getAttribute('katao_cart_filter_node')) {
             $criteria->add(KataoCartPeer::KATAO_NODE_ID, $this->filter_node);
         }
-        if ('' != $this->filter_period = $this->getUser()->getAttribute('katao_cart_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
+        if (!is_null(KataoPeriodPeer::getActivePeriod()) && '' != $this->filter_period = $this->getUser()->getAttribute('katao_cart_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
             $criteria->add(KataoCartPeer::KATAO_PERIOD_ID, $this->filter_period);
         }
 

+ 1 - 1
apps/admin/modules/kataoInvoice/actions/actions.class.php

@@ -47,7 +47,7 @@ class kataoInvoiceActions extends wpActions {
         if ('' != $this->filter_node = $this->getUser()->getAttribute('katao_invoice_filter_node')) {
             $criteria->add(KataoInvoicePeer::KATAO_NODE_ID, $this->filter_node);
         }
-        if ('' != $this->filter_period = $this->getUser()->getAttribute('katao_invoice_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
+        if (!is_null(KataoPeriodPeer::getActivePeriod()) && '' != $this->filter_period = $this->getUser()->getAttribute('katao_invoice_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
             $criteria->add(KataoInvoicePeer::KATAO_PERIOD_ID, $this->filter_period);
         }
 

+ 1 - 1
apps/admin/modules/kataoOrder/actions/actions.class.php

@@ -52,7 +52,7 @@ class kataoOrderActions extends wpActions {
 		if ('' != $this->filter_node = $this->getUser()->getAttribute('katao_cart_order_node')) {
 			$criteria->add(KataoOrderPeer::KATAO_NODE_ID, $this->filter_node);
 		}
-		if ('' != $this->filter_period = $this->getUser()->getAttribute('katao_cart_order_period', KataoPeriodPeer::getActivePeriod()->getId())) {
+		if (!is_null(KataoPeriodPeer::getActivePeriod()) && '' != $this->filter_period = $this->getUser()->getAttribute('katao_cart_order_period', KataoPeriodPeer::getActivePeriod()->getId())) {
 			$criteria->add(KataoOrderPeer::KATAO_PERIOD_ID, $this->filter_period);
 		}
 

+ 1 - 1
apps/admin/modules/kataoSupplierInvoice/actions/actions.class.php

@@ -40,7 +40,7 @@ class kataoSupplierInvoiceActions extends wpActions {
         if ('' != $this->filter_supplier = $this->getUser()->getAttribute('katao_supplier_invoice_filter_supplier')) {
             $criteria->add(KataoSupplierInvoicePeer::KATAO_SUPPLIER_ID, $this->filter_supplier);
         }
-        if ('' != $this->filter_period = $this->getUser()->getAttribute('katao_supplier_invoice_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
+        if (!is_null(KataoPeriodPeer::getActivePeriod()) && '' != $this->filter_period = $this->getUser()->getAttribute('katao_supplier_invoice_filter_period', KataoPeriodPeer::getActivePeriod()->getId())) {
             $criteria->add(KataoSupplierInvoicePeer::KATAO_PERIOD_ID, $this->filter_period);
         }