Prevent invoices with expenses from creating products

This commit is contained in:
Hillel Coren 2016-08-21 18:47:56 +03:00
parent de602283c1
commit b405ed84da

View File

@ -541,7 +541,7 @@ class InvoiceRepository extends BaseRepository
} }
if ($productKey = trim($item['product_key'])) { if ($productKey = trim($item['product_key'])) {
if (\Auth::user()->account->update_products && ! strtotime($productKey) && ! $task && ! $expense) { if (\Auth::user()->account->update_products && ! $invoice->has_tasks && ! $invoice->has_expenses) {
$product = Product::findProductByKey($productKey); $product = Product::findProductByKey($productKey);
if (!$product) { if (!$product) {
if (Auth::user()->can('create', ENTITY_PRODUCT)) { if (Auth::user()->can('create', ENTITY_PRODUCT)) {