Bug fixes

This commit is contained in:
Hillel Coren 2015-08-13 08:45:48 +03:00
parent dc8bd36e76
commit d1166d415b
2 changed files with 7 additions and 8 deletions

View File

@ -39,7 +39,7 @@ class Mailer
return true; return true;
} catch (Exception $exception) { } catch (Exception $exception) {
if (method_exists($exception, 'getResponse')) { if (isset($_ENV['POSTMARK_API_TOKEN'])) {
$response = $exception->getResponse()->getBody()->getContents(); $response = $exception->getResponse()->getBody()->getContents();
$response = json_decode($response); $response = json_decode($response);
return nl2br($response->Message); return nl2br($response->Message);

View File

@ -410,18 +410,17 @@ class InvoiceRepository
} else if ($item['product_key'] && !$invoice->has_tasks) { } else if ($item['product_key'] && !$invoice->has_tasks) {
$product = Product::findProductByKey(trim($item['product_key'])); $product = Product::findProductByKey(trim($item['product_key']));
if (\Auth::user()->account->update_products) {
if (!$product) { if (!$product) {
$product = Product::createNew(); $product = Product::createNew();
$product->product_key = trim($item['product_key']); $product->product_key = trim($item['product_key']);
} }
if (\Auth::user()->account->update_products) {
$product->notes = $item['notes']; $product->notes = $item['notes'];
$product->cost = $item['cost']; $product->cost = $item['cost'];
}
$product->save(); $product->save();
} }
}
$invoiceItem = InvoiceItem::createNew(); $invoiceItem = InvoiceItem::createNew();
$invoiceItem->product_id = isset($product) ? $product->id : null; $invoiceItem->product_id = isset($product) ? $product->id : null;