mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
7f226fe5d2
commit
406cb5a334
@ -20,6 +20,9 @@ class QuickbooksSettingsCast implements CastsAttributes
|
||||
{
|
||||
$data = json_decode($value, true);
|
||||
|
||||
if(!is_array($data))
|
||||
return null;
|
||||
|
||||
$qb = new QuickbooksSettings();
|
||||
$qb->accessTokenKey = $data['accessTokenKey'];
|
||||
$qb->refresh_token = $data['refresh_token'];
|
||||
|
@ -30,6 +30,7 @@ use League\CommonMark\CommonMarkConverter;
|
||||
* @property string|null $custom_value4
|
||||
* @property string|null $product_key
|
||||
* @property string|null $notes
|
||||
* @property string|null $hash
|
||||
* @property float $cost
|
||||
* @property float $price
|
||||
* @property float $quantity
|
||||
|
@ -135,8 +135,8 @@ class QuickbooksService
|
||||
{
|
||||
match($entity){
|
||||
// 'client' => $this->syncQbToNinjaClients($records),
|
||||
// 'product' => $this->syncQbToNinjaProducts($records),
|
||||
'invoice' => $this->syncQbToNinjaInvoices($records),
|
||||
'product' => $this->syncQbToNinjaProducts($records),
|
||||
// 'invoice' => $this->syncQbToNinjaInvoices($records),
|
||||
// 'vendor' => $this->syncQbToNinjaClients($records),
|
||||
// 'quote' => $this->syncInvoices($records),
|
||||
// 'purchase_order' => $this->syncInvoices($records),
|
||||
@ -262,7 +262,7 @@ class QuickbooksService
|
||||
{
|
||||
$ninja_data = $product_transformer->qbToNinja($record);
|
||||
|
||||
if($product = $this->findProduct($ninja_data['product_key']))
|
||||
if($product = $this->findProduct($ninja_data['hash']))
|
||||
{
|
||||
$product->fill($ninja_data);
|
||||
$product->save();
|
||||
@ -309,7 +309,7 @@ class QuickbooksService
|
||||
$search = Product::query()
|
||||
->withTrashed()
|
||||
->where('company_id', $this->company->id)
|
||||
->where('product_key', $key);
|
||||
->where('hash', $key);
|
||||
|
||||
if($search->count() == 0) {
|
||||
//new product
|
||||
|
@ -32,6 +32,7 @@ class ProductTransformer extends BaseTransformer
|
||||
{
|
||||
|
||||
return [
|
||||
'hash' => data_get($data, 'ItemRef.value', null)),
|
||||
'product_key' => data_get($data, 'Name', data_get($data, 'FullyQualifiedName','')),
|
||||
'notes' => data_get($data, 'Description', ''),
|
||||
'cost' => data_get($data, 'PurchaseCost', 0),
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table){
|
||||
$table->string('hash')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user