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;
} catch (Exception $exception) {
if (method_exists($exception, 'getResponse')) {
if (isset($_ENV['POSTMARK_API_TOKEN'])) {
$response = $exception->getResponse()->getBody()->getContents();
$response = json_decode($response);
return nl2br($response->Message);

View File

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