From 303de7a0b6c5bc8e2492456dfd0219a9bd840fc0 Mon Sep 17 00:00:00 2001 From: Adam Engebretson Date: Thu, 5 Nov 2015 12:39:33 -0600 Subject: [PATCH 1/4] Allow zero-costs Currently, the `parepareItem` method checks to see if the cost and notes evaluate to false. If so, it checks from the product list. However, we need the ability to set cost to zero explicitly through the API. This allows a user to pass null, which will use the default. Otherwise, passing 0 will persist. --- app/Http/Controllers/InvoiceApiController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index 2a9bae80eab8..b0d7aede0710 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -214,13 +214,13 @@ class InvoiceApiController extends Controller } // if only the product key is set we'll load the cost and notes - if ($item['product_key'] && (!$item['cost'] || !$item['notes'])) { + if ($item['product_key'] && (is_null($item['cost']) || is_null($item['notes']))) { $product = Product::findProductByKey($item['product_key']); if ($product) { - if (!$item['cost']) { + if (is_null($item['cost'])) { $item['cost'] = $product->cost; } - if (!$item['notes']) { + if (is_null($item['notes'])) { $item['notes'] = $product->notes; } } From a30b9039decdc21597d03fa39b497924b920a517 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 6 Nov 2015 09:54:29 +0200 Subject: [PATCH 2/4] Bug fixes --- app/Models/Contact.php | 14 -------------- resources/views/invoices/edit.blade.php | 5 +++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/Models/Contact.php b/app/Models/Contact.php index 731900e35840..782a7e47424a 100644 --- a/app/Models/Contact.php +++ b/app/Models/Contact.php @@ -32,20 +32,6 @@ class Contact extends EntityModel return PERSON_CONTACT; } - /* - public function getLastLogin() - { - if ($this->last_login == '0000-00-00 00:00:00') - { - return '---'; - } - else - { - return $this->last_login->format('m/d/y h:i a'); - } - } - */ - public function getName() { return $this->getDisplayName(); diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index d4e1ad2055fb..a2c90a1d9d81 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -77,7 +77,8 @@