1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Recurring Invoice import

This commit is contained in:
David Bomba 2023-04-19 15:37:08 +10:00
parent 65c7a2c1d5
commit bf0d39cbb7
5 changed files with 11 additions and 7 deletions

View File

@ -23,7 +23,7 @@ class RecurringInvoiceMap
4 => 'client.name', 4 => 'client.name',
5 => 'invoice.discount', 5 => 'invoice.discount',
6 => 'invoice.po_number', 6 => 'invoice.po_number',
7 => 'invoice.date', 7 => 'invoice.next_send_date',
8 => 'invoice.due_date', 8 => 'invoice.due_date',
9 => 'invoice.terms', 9 => 'invoice.terms',
10 => 'invoice.status', 10 => 'invoice.status',
@ -87,7 +87,7 @@ class RecurringInvoiceMap
4 => 'texts.client', 4 => 'texts.client',
5 => 'texts.discount', 5 => 'texts.discount',
6 => 'texts.po_number', 6 => 'texts.po_number',
7 => 'texts.date', 7 => 'texts.start_date',
8 => 'texts.due_date', 8 => 'texts.due_date',
9 => 'texts.terms', 9 => 'texts.terms',
10 => 'texts.status', 10 => 'texts.status',
@ -114,7 +114,7 @@ class RecurringInvoiceMap
31 => 'texts.surcharge', 31 => 'texts.surcharge',
32 => 'texts.surcharge', 32 => 'texts.surcharge',
33 => 'texts.exchange_rate', 33 => 'texts.exchange_rate',
34 => 'texts.frequency', 34 => 'texts.frequency_id',
35 => 'texts.remaining_cycles', 35 => 'texts.remaining_cycles',
36 => 'texts.auto_bill', 36 => 'texts.auto_bill',
37 => 'texts.payment_date', 37 => 'texts.payment_date',

View File

@ -147,6 +147,11 @@ class BaseTransformer
public function getRemainingCycles($remaining_cycles = -1): int public function getRemainingCycles($remaining_cycles = -1): int
{ {
if ($remaining_cycles == 'endless') {
return -1;
}
return (int)$remaining_cycles; return (int)$remaining_cycles;
} }

View File

@ -130,8 +130,7 @@ class RecurringInvoiceTransformer extends BaseTransformer
), ),
'frequency_id' => $this->getFrequency(isset($invoice_data['invoice.frequency_id']) ? $invoice_data['invoice.frequency_id'] : 'monthly' 'frequency_id' => $this->getFrequency(isset($invoice_data['invoice.frequency_id']) ? $invoice_data['invoice.frequency_id'] : 'monthly'
), ),
'remaining_cycles' => $this->getRemainingCycles( 'remaining_cycles' => $this->getRemainingCycles(isset($invoice_data['invoice.remaining_cycles']) ? $invoice_data['invoice.remaining_cycles'] : -1
$this->getNumber($invoice_data, 'invoice.remaining_cycles')
), ),
// 'archived' => $status === 'archived', // 'archived' => $status === 'archived',
]; ];

View File

@ -103,7 +103,7 @@ class CsvImportTest extends TestCase
12 => 'invoice.public_notes', 12 => 'invoice.public_notes',
13 => 'invoice.private_notes', 13 => 'invoice.private_notes',
5 => 'invoice.number', 5 => 'invoice.number',
7 => 'invoice.date', 7 => 'invoice.next_send_date',
17 => 'item.product_key', 17 => 'item.product_key',
18 => 'item.notes', 18 => 'item.notes',
19 => 'item.cost', 19 => 'item.cost',

View File

@ -1,7 +1,7 @@
"Invoice Ninja v4.5.17 - December 19, 2020 11:28 pm",,,,,,,,,,,,,,,,,,,, "Invoice Ninja v4.5.17 - December 19, 2020 11:28 pm",,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,
INVOICES,,,,,,,,,,,,,,,,,,,, INVOICES,,,,,,,,,,,,,,,,,,,,
Client,Email,Auto Bill,Frequency,Remaining Cycles,Invoice Number,Amount,Paid,PO Number,Status,Invoice Date,Due Date,Discount,Partial/Deposit,Partial Due Date,Public Notes,Private Notes,Item Product,Item Notes,Item Cost,Item Quantity Client,Email,Auto Bill,Frequency,Remaining Cycles,Invoice Number,Amount,Paid,PO Number,Status,Start Date,Due Date,Discount,Partial/Deposit,Partial Due Date,Public Notes,Private Notes,Item Product,Item Notes,Item Cost,Item Quantity
Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,1,$13.50,$5.01,,Partial,2019-11-25,2019-10-20,,$0.00,,,,et,Ad neque sit dolores est praesentium. In laboriosam fugiat et a adipisci id laborum. Quis nam aperiam non qui porro.,1.35,10 Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,1,$13.50,$5.01,,Partial,2019-11-25,2019-10-20,,$0.00,,,,et,Ad neque sit dolores est praesentium. In laboriosam fugiat et a adipisci id laborum. Quis nam aperiam non qui porro.,1.35,10
Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,2,$26.67,$6.94,,Partial,2020-02-19,2020-02-29,,$0.00,,,,omnis,Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam.,8.89,3 Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,2,$26.67,$6.94,,Partial,2020-02-19,2020-02-29,,$0.00,,,,omnis,Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam.,8.89,3
Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,2,$26.67,$6.94,,Partial,2020-02-19,2020-02-29,,$0.00,,,,omnis,Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam.,8.89,3 Ludwig Krajcik DVM,brook59@example.org,always,monthly,endless,2,$26.67,$6.94,,Partial,2020-02-19,2020-02-29,,$0.00,,,,omnis,Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam.,8.89,3

1 Invoice Ninja v4.5.17 - December 19, 2020 11:28 pm
2
3 INVOICES
4 Client Email Auto Bill Frequency Remaining Cycles Invoice Number Amount Paid PO Number Status Invoice Date Start Date Due Date Discount Partial/Deposit Partial Due Date Public Notes Private Notes Item Product Item Notes Item Cost Item Quantity
5 Ludwig Krajcik DVM brook59@example.org always monthly endless 1 $13.50 $5.01 Partial 2019-11-25 2019-10-20 $0.00 et Ad neque sit dolores est praesentium. In laboriosam fugiat et a adipisci id laborum. Quis nam aperiam non qui porro. 1.35 10
6 Ludwig Krajcik DVM brook59@example.org always monthly endless 2 $26.67 $6.94 Partial 2020-02-19 2020-02-29 $0.00 omnis Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam. 8.89 3
7 Ludwig Krajcik DVM brook59@example.org always monthly endless 2 $26.67 $6.94 Partial 2020-02-19 2020-02-29 $0.00 omnis Dicta quam ut nihil animi occaecati omnis nulla. Eum minus quae ut et. Et iste consequatur saepe quam. 8.89 3