mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Handle currency symbol when setting product cost
This commit is contained in:
parent
ab91f76bfe
commit
a50ca5a328
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Product;
|
||||
use App\Models\TaxRate;
|
||||
use App\Ninja\Datatables\ProductDatatable;
|
||||
use App\Ninja\Repositories\ProductRepository;
|
||||
use App\Services\ProductService;
|
||||
use Auth;
|
||||
use Input;
|
||||
@ -24,16 +25,22 @@ class ProductController extends BaseController
|
||||
*/
|
||||
protected $productService;
|
||||
|
||||
/**
|
||||
* @var ProductRepository
|
||||
*/
|
||||
protected $productRepo;
|
||||
|
||||
/**
|
||||
* ProductController constructor.
|
||||
*
|
||||
* @param ProductService $productService
|
||||
*/
|
||||
public function __construct(ProductService $productService)
|
||||
public function __construct(ProductService $productService, ProductRepository $productRepo)
|
||||
{
|
||||
//parent::__construct();
|
||||
|
||||
$this->productService = $productService;
|
||||
$this->productRepo = $productRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,11 +144,7 @@ class ProductController extends BaseController
|
||||
$product = Product::createNew();
|
||||
}
|
||||
|
||||
$product->product_key = trim(Input::get('product_key'));
|
||||
$product->notes = trim(Input::get('notes'));
|
||||
$product->cost = trim(Input::get('cost'));
|
||||
$product->fill(Input::all());
|
||||
$product->save();
|
||||
$this->productRepo->save(Input::all(), $product);
|
||||
|
||||
$message = $productPublicId ? trans('texts.updated_product') : trans('texts.created_product');
|
||||
Session::flash('message', $message);
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\Product;
|
||||
use Utils;
|
||||
use DB;
|
||||
|
||||
class ProductRepository extends BaseRepository
|
||||
@ -64,6 +65,9 @@ class ProductRepository extends BaseRepository
|
||||
}
|
||||
|
||||
$product->fill($data);
|
||||
$product->product_key = trim($data['product_key']);
|
||||
$product->notes = trim($data['notes']);
|
||||
$product->cost = Utils::parseFloat($data['cost']);
|
||||
$product->save();
|
||||
|
||||
return $product;
|
||||
|
Loading…
Reference in New Issue
Block a user