mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Product sync for the win!
This commit is contained in:
parent
d87f8d8be0
commit
8279bc2ed2
@ -80,16 +80,16 @@ class QbProduct implements SyncInterface
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sync(string $id): void
|
public function sync(string $id, string $last_updated): void
|
||||||
{
|
{
|
||||||
$qb_record = $this->find($id);
|
$qb_record = $this->find($id);
|
||||||
|
|
||||||
if($ninja_record = $this->findProduct($id))
|
if($ninja_record = $this->findProduct($id))
|
||||||
{
|
{
|
||||||
|
|
||||||
if(Carbon::parse($qb_record->lastUpdated) > Carbon::parse($ninja_record->updated_at))
|
if(Carbon::parse($last_updated) > Carbon::parse($ninja_record->updated_at))
|
||||||
{
|
{
|
||||||
$transformed_qb_product = $this->product_transformer($qb_record);
|
$ninja_data = $this->product_transformer->qbToNinja($qb_record);
|
||||||
|
|
||||||
$ninja_record->fill($ninja_data);
|
$ninja_record->fill($ninja_data);
|
||||||
$ninja_record->save();
|
$ninja_record->save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user