mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
commit
a8ccb762c2
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -47,8 +47,8 @@ jobs:
|
|||||||
npm i
|
npm i
|
||||||
npm run build
|
npm run build
|
||||||
cp -r dist/react/* ../public/react
|
cp -r dist/react/* ../public/react
|
||||||
mkdir public/tinymce_6.4.2/tinymce/js/
|
mkdir -p public/tinymce_6.4.2/tinymce/js/
|
||||||
cp -r node_modules/tinymce ../public/tinymce_6.4.2/tinymce/js/
|
cp -r node_modules/tinymce public/tinymce_6.4.2/tinymce/js/
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf ui
|
rm -rf ui
|
||||||
php artisan ninja:react
|
php artisan ninja:react
|
||||||
|
@ -1 +1 @@
|
|||||||
5.6.9
|
5.6.10
|
@ -30,6 +30,8 @@ class InvoiceItemExport extends BaseExport
|
|||||||
|
|
||||||
public Writer $csv;
|
public Writer $csv;
|
||||||
|
|
||||||
|
private bool $force_keys = false;
|
||||||
|
|
||||||
public array $entity_keys = [
|
public array $entity_keys = [
|
||||||
'amount' => 'amount',
|
'amount' => 'amount',
|
||||||
'balance' => 'balance',
|
'balance' => 'balance',
|
||||||
@ -67,9 +69,9 @@ class InvoiceItemExport extends BaseExport
|
|||||||
'total_taxes' => 'total_taxes',
|
'total_taxes' => 'total_taxes',
|
||||||
'currency' => 'currency_id',
|
'currency' => 'currency_id',
|
||||||
'quantity' => 'item.quantity',
|
'quantity' => 'item.quantity',
|
||||||
'unit_cost' => 'item.cost',
|
'cost' => 'item.cost',
|
||||||
'product_key' => 'item.product_key',
|
'product_key' => 'item.product_key',
|
||||||
'cost' => 'item.product_cost',
|
'buy_price' => 'item.product_cost',
|
||||||
'notes' => 'item.notes',
|
'notes' => 'item.notes',
|
||||||
'discount' => 'item.discount',
|
'discount' => 'item.discount',
|
||||||
'is_amount_discount' => 'item.is_amount_discount',
|
'is_amount_discount' => 'item.is_amount_discount',
|
||||||
@ -85,6 +87,8 @@ class InvoiceItemExport extends BaseExport
|
|||||||
'invoice2' => 'item.custom_value2',
|
'invoice2' => 'item.custom_value2',
|
||||||
'invoice3' => 'item.custom_value3',
|
'invoice3' => 'item.custom_value3',
|
||||||
'invoice4' => 'item.custom_value4',
|
'invoice4' => 'item.custom_value4',
|
||||||
|
'tax_category' => 'item.tax_id',
|
||||||
|
'type' => 'item.type_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
private array $decorate_keys = [
|
private array $decorate_keys = [
|
||||||
@ -112,6 +116,7 @@ class InvoiceItemExport extends BaseExport
|
|||||||
$this->csv = Writer::createFromString();
|
$this->csv = Writer::createFromString();
|
||||||
|
|
||||||
if (count($this->input['report_keys']) == 0) {
|
if (count($this->input['report_keys']) == 0) {
|
||||||
|
$this->force_keys = true;
|
||||||
$this->input['report_keys'] = array_values($this->entity_keys);
|
$this->input['report_keys'] = array_values($this->entity_keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,25 +145,30 @@ class InvoiceItemExport extends BaseExport
|
|||||||
$transformed_items = [];
|
$transformed_items = [];
|
||||||
|
|
||||||
foreach ($invoice->line_items as $item) {
|
foreach ($invoice->line_items as $item) {
|
||||||
$item_array = [];
|
$item_array = [];
|
||||||
|
|
||||||
foreach (array_values($this->input['report_keys']) as $key) { //items iterator produces item array
|
foreach (array_values($this->input['report_keys']) as $key) { //items iterator produces item array
|
||||||
|
|
||||||
if (str_contains($key, "item.")) {
|
if (str_contains($key, "item.")) {
|
||||||
|
|
||||||
$key = str_replace("item.", "", $key);
|
$key = str_replace("item.", "", $key);
|
||||||
|
|
||||||
|
if($key == 'type_id')
|
||||||
|
$keyval = 'type';
|
||||||
|
|
||||||
|
if($key == 'tax_id')
|
||||||
|
$keyval = 'tax_category';
|
||||||
|
|
||||||
if (property_exists($item, $key)) {
|
if (property_exists($item, $key)) {
|
||||||
$item_array[$key] = $item->{$key};
|
$item_array[$keyval] = $item->{$key};
|
||||||
} else {
|
} else {
|
||||||
$item_array[$key] = '';
|
$item_array[$keyval] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nlog("item array");
|
|
||||||
nlog($item_array);
|
|
||||||
|
|
||||||
$entity = [];
|
$entity = [];
|
||||||
|
|
||||||
foreach (array_values($this->input['report_keys']) as $key) {
|
foreach (array_values($this->input['report_keys']) as $key) { //create an array of report keys only
|
||||||
$keyval = array_search($key, $this->entity_keys);
|
$keyval = array_search($key, $this->entity_keys);
|
||||||
|
|
||||||
if (array_key_exists($key, $transformed_items)) {
|
if (array_key_exists($key, $transformed_items)) {
|
||||||
@ -167,9 +177,8 @@ nlog($item_array);
|
|||||||
$entity[$keyval] = "";
|
$entity[$keyval] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// nlog("entity");
|
||||||
nlog("entity");
|
// nlog($entity);
|
||||||
nlog($entity);
|
|
||||||
|
|
||||||
$transformed_items = array_merge($transformed_invoice, $item_array);
|
$transformed_items = array_merge($transformed_invoice, $item_array);
|
||||||
$entity = $this->decorateAdvancedFields($invoice, $transformed_items);
|
$entity = $this->decorateAdvancedFields($invoice, $transformed_items);
|
||||||
@ -187,10 +196,21 @@ nlog($entity);
|
|||||||
foreach (array_values($this->input['report_keys']) as $key) {
|
foreach (array_values($this->input['report_keys']) as $key) {
|
||||||
$keyval = array_search($key, $this->entity_keys);
|
$keyval = array_search($key, $this->entity_keys);
|
||||||
|
|
||||||
|
if(!$keyval) {
|
||||||
|
$keyval = array_search(str_replace("invoice.", "", $key), $this->entity_keys) ?? $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$keyval) {
|
||||||
|
$keyval = $key;
|
||||||
|
}
|
||||||
|
|
||||||
if (array_key_exists($key, $transformed_invoice)) {
|
if (array_key_exists($key, $transformed_invoice)) {
|
||||||
$entity[$keyval] = $transformed_invoice[$key];
|
$entity[$keyval] = $transformed_invoice[$key];
|
||||||
} else {
|
} elseif (array_key_exists($keyval, $transformed_invoice)) {
|
||||||
$entity[$keyval] = "";
|
$entity[$keyval] = $transformed_invoice[$keyval];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$entity[$keyval] = $this->resolveKey($keyval, $invoice, $this->invoice_transformer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,13 +223,20 @@ nlog($entity);
|
|||||||
$entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
$entity['currency'] = $invoice->client->currency() ? $invoice->client->currency()->code : $invoice->company->currency()->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(in_array('client_id', $this->input['report_keys']))
|
if(array_key_exists('type', $entity)) {
|
||||||
$entity['client'] = $invoice->client->present()->name();
|
$entity['type'] = $invoice->typeIdString($entity['type']);
|
||||||
$entity['client_id_number'] = $invoice->client->id_number;
|
}
|
||||||
$entity['client_number'] = $invoice->client->number;
|
|
||||||
|
|
||||||
// if(in_array('status_id', $this->input['report_keys']))
|
if(array_key_exists('tax_category', $entity)) {
|
||||||
$entity['status'] = $invoice->stringStatus($invoice->status_id);
|
$entity['tax_category'] = $invoice->taxTypeString($entity['tax_category']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->force_keys) {
|
||||||
|
$entity['client'] = $invoice->client->present()->name();
|
||||||
|
$entity['client_id_number'] = $invoice->client->id_number;
|
||||||
|
$entity['client_number'] = $invoice->client->number;
|
||||||
|
$entity['status'] = $invoice->stringStatus($invoice->status_id);
|
||||||
|
}
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
@ -889,4 +889,38 @@ class Invoice extends BaseModel
|
|||||||
{
|
{
|
||||||
return ctrans('texts.invoice');
|
return ctrans('texts.invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function taxTypeString($id)
|
||||||
|
{
|
||||||
|
match(intval($id)){
|
||||||
|
Product::PRODUCT_TYPE_PHYSICAL => $tax_type = ctrans('texts.physical_goods'),
|
||||||
|
Product::PRODUCT_TYPE_SERVICE => $tax_type = ctrans('texts.services'),
|
||||||
|
Product::PRODUCT_TYPE_DIGITAL => $tax_type = ctrans('texts.digital_products'),
|
||||||
|
Product::PRODUCT_TYPE_SHIPPING => $tax_type = ctrans('texts.shipping'),
|
||||||
|
Product::PRODUCT_TYPE_EXEMPT => $tax_type = ctrans('texts.tax_exempt'),
|
||||||
|
Product::PRODUCT_TYPE_REDUCED_TAX => $tax_type = ctrans('texts.reduced_tax'),
|
||||||
|
Product::PRODUCT_TYPE_OVERRIDE_TAX => $tax_type = ctrans('texts.override_tax'),
|
||||||
|
Product::PRODUCT_TYPE_ZERO_RATED => $tax_type = ctrans('texts.zero_rated'),
|
||||||
|
Product::PRODUCT_TYPE_REVERSE_TAX => $tax_type = ctrans('texts.reverse_tax'),
|
||||||
|
default => $tax_type = ctrans('texts.physical_goods'),
|
||||||
|
};
|
||||||
|
|
||||||
|
return $tax_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function typeIdString($id)
|
||||||
|
{
|
||||||
|
match($id) {
|
||||||
|
'1' => $type = ctrans('texts.product'),
|
||||||
|
'2' => $type = ctrans('texts.service'),
|
||||||
|
'3' => $type = ctrans('texts.gateway_fees'),
|
||||||
|
'4' => $type = ctrans('texts.gateway_fees'),
|
||||||
|
'5' => $type = ctrans('texts.late_fees'),
|
||||||
|
'6' => $type = ctrans('texts.expense'),
|
||||||
|
default => $type = ctrans('texts.product'),
|
||||||
|
};
|
||||||
|
|
||||||
|
return $type;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.6.9',
|
'app_version' => '5.6.10',
|
||||||
'app_tag' => '5.6.9',
|
'app_tag' => '5.6.10',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
@ -5113,7 +5113,7 @@ $LANG = array(
|
|||||||
'item_tax_rate1' => 'Item Tax Rate 1',
|
'item_tax_rate1' => 'Item Tax Rate 1',
|
||||||
'item_tax_rate2' => 'Item Tax Rate 2',
|
'item_tax_rate2' => 'Item Tax Rate 2',
|
||||||
'item_tax_rate3' => 'Item Tax Rate 3',
|
'item_tax_rate3' => 'Item Tax Rate 3',
|
||||||
|
'buy_price' => 'Buy Price',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
includes:
|
includes:
|
||||||
- ./vendor/nunomaduro/larastan/extension.neon
|
- ./vendor/nunomaduro/larastan/extension.neon
|
||||||
|
- phpstan-baseline.neon
|
||||||
parameters:
|
parameters:
|
||||||
treatPhpDocTypesAsCertain: false
|
treatPhpDocTypesAsCertain: false
|
||||||
parallel:
|
parallel:
|
||||||
jobSize: 20
|
jobSize: 5
|
||||||
maximumNumberOfProcesses: 2
|
maximumNumberOfProcesses: 16
|
||||||
processTimeout: 300.0
|
processTimeout: 600.0
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#Call to an undefined method .*badMethod\(\)#'
|
- '#Call to an undefined method .*badMethod\(\)#'
|
||||||
- '#Call to an undefined method Illuminate\Database\Eloquent\Builder::exclude#'
|
- '#Call to an undefined method Illuminate\Database\Eloquent\Builder::exclude#'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user