Catch not found Exception for invoices in timesheets
authorsstamer <s.stamer@metaways.de>
Fri, 11 Sep 2015 09:11:51 +0000 (11:11 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 11 Sep 2015 16:31:43 +0000 (18:31 +0200)
Change-Id: I1a62ba14ec0f2c981a8d7b759ec037dd79293867
Reviewed-on: http://gerrit.tine20.com/customers/2192
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Timetracker/Frontend/Json.php

index a69b302..a26d63c 100644 (file)
@@ -66,7 +66,11 @@ class Timetracker_Frontend_Json extends Tinebase_Frontend_Json_Abstract
                 Tinebase_User::getInstance()->resolveUsers($_record, 'account_id');
 
                 if (Tinebase_Core::getUser()->hasRight('Sales', 'manage_invoices') && ! empty($_record['invoice_id'])) {
-                    $_record['invoice_id'] = Sales_Controller_Invoice::getInstance()->get($_record['invoice_id']);
+                    try {
+                        $_record['invoice_id'] = Sales_Controller_Invoice::getInstance()->get($_record['invoice_id']);
+                    } catch (Tinebase_Exception_NotFound $nfe) {
+                        Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' Could not resolve invoice with id ' . $_record['invoice_id']);
+                    }
                 }
                 
                 $recordArray = parent::_recordToJson($_record);