Fixed export of InvoicePosition of type Timeaccount
authorPaul Mehrer <p.mehrer@metaways.de>
Thu, 26 Mar 2015 16:07:25 +0000 (17:07 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 27 Mar 2015 08:39:56 +0000 (09:39 +0100)
the export contained also timesheets of timeaccounts that have a budget and therefor shouldnt be exported. Fixed that by adjusting filter.

Change-Id: I079419d0c6838de8e04a466e965932a31801fcc5
Reviewed-on: http://gerrit.tine20.com/customers/1773
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Sales/Frontend/Http.php

index fdaf976..acbb4d7 100644 (file)
@@ -128,6 +128,13 @@ class Sales_Frontend_Http extends Tinebase_Frontend_Http_Abstract
         
         if ($accountable == 'Sales_Model_ProductAggregate') {
             $filter->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'model', 'operator' => 'equals', 'value' => 'Sales_Model_ProductAggregate')));
+        } elseif ($accountable == 'Timetracker_Model_Timeaccount') {
+            $filter = new Timetracker_Model_TimesheetFilter(array(
+                array('field' => 'timeaccount_id', 'operator' => 'AND', 'value' => array(
+                    array('field' => 'budget', 'operator' => 'equals', 'value' => 0),
+                )),
+            ));
+            $filter->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'invoice_id', 'operator' => 'equals', 'value' => $invoiceId)));
         }
         
         parent::_export($filter, array('format' => 'ods'), $billableControllerName::getInstance());