mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for migrations
This commit is contained in:
parent
ae52ea5971
commit
7968b2bb5f
@ -52,7 +52,7 @@ class ExportMigrations extends Command
|
|||||||
|
|
||||||
if($this->option('random')){
|
if($this->option('random')){
|
||||||
|
|
||||||
User::all()->random(50)->each(function ($user){
|
User::all()->random(200)->each(function ($user){
|
||||||
$this->export($user);
|
$this->export($user);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -321,6 +321,7 @@ trait GenerateMigrationResources
|
|||||||
$export_credits = Invoice::where('account_id', $this->account->id)
|
$export_credits = Invoice::where('account_id', $this->account->id)
|
||||||
->where('amount', '<', '0')
|
->where('amount', '<', '0')
|
||||||
->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD)
|
->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD)
|
||||||
|
->where('is_public', true)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@ -333,7 +334,7 @@ trait GenerateMigrationResources
|
|||||||
'status_id' => $credit->invoice_status_id,
|
'status_id' => $credit->invoice_status_id,
|
||||||
'design_id' => $this->getDesignId($credit->invoice_design_id),
|
'design_id' => $this->getDesignId($credit->invoice_design_id),
|
||||||
'number' => $credit->invoice_number,
|
'number' => $credit->invoice_number,
|
||||||
'discount' => $credit->discount ?: 0,
|
'discount' => $credit->discount ? $credit->discount*-1: 0,
|
||||||
'is_amount_discount' => $credit->is_amount_discount ?: false,
|
'is_amount_discount' => $credit->is_amount_discount ?: false,
|
||||||
'po_number' => $credit->po_number ?: '',
|
'po_number' => $credit->po_number ?: '',
|
||||||
'date' => $credit->invoice_date,
|
'date' => $credit->invoice_date,
|
||||||
@ -758,12 +759,14 @@ trait GenerateMigrationResources
|
|||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
|
||||||
if($item->cost < 0)
|
// if($item->cost < 0)
|
||||||
$item->cost = $item->cost * -1;
|
// $item->cost = $item->cost * -1;
|
||||||
|
|
||||||
if($item->qty < 0)
|
|
||||||
$item->qty = $item->qty * -1;
|
$item->qty = $item->qty * -1;
|
||||||
|
|
||||||
|
// if($item->discount < 0)
|
||||||
|
// $item->discount = $item->discount * -1;
|
||||||
|
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $item->id,
|
'id' => $item->id,
|
||||||
'quantity' => (float) $item->qty,
|
'quantity' => (float) $item->qty,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user