1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00

Merge pull request #8933 from turbo124/v5-develop

v5.7.41
This commit is contained in:
David Bomba 2023-11-01 17:07:58 +11:00 committed by GitHub
commit aca5fba6d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 9 deletions

View File

@ -1 +1 @@
5.7.40 5.7.41

View File

@ -399,7 +399,12 @@ class InvoiceItemSum
$item_tax = 0; $item_tax = 0;
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total)); try {
$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total));
} catch(\DivisionByZeroError $e) {
$amount = $this->item->line_total;
}
//$amount = ($this->sub_total > 0) ? $this->item->line_total - ($this->invoice->discount * ($this->item->line_total / $this->sub_total)) : 0; //$amount = ($this->sub_total > 0) ? $this->item->line_total - ($this->invoice->discount * ($this->item->line_total / $this->sub_total)) : 0;
$item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount); $item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount);

View File

@ -614,7 +614,7 @@ class PdfBuilder
} else { } else {
$_type = Str::startsWith($type, '$') ? ltrim($type, '$') : $type; $_type = Str::startsWith($type, '$') ? ltrim($type, '$') : $type;
foreach ($this->service->config->pdf_variables["{$_type}_columns"] as $key => $cell) { foreach ($this->service->config->pdf_variables[$table_type] as $key => $cell) {
// We want to keep aliases like these: // We want to keep aliases like these:
// $task.cost => $task.rate // $task.cost => $task.rate
// $task.quantity => $task.hours // $task.quantity => $task.hours
@ -773,7 +773,6 @@ class PdfBuilder
*/ */
public function buildTableHeader(string $type): array public function buildTableHeader(string $type): array
{ {
$this->processTaxColumns($type);
$elements = []; $elements = [];
@ -785,11 +784,16 @@ class PdfBuilder
]; ];
$table_type = "{$type}_columns"; $table_type = "{$type}_columns";
$column_type = $type;
if ($type == 'product' && $this->service->config->entity instanceof Quote && !$this->service->config->settings_object?->sync_invoice_quote_columns) { if ($type == 'product' && $this->service->config->entity instanceof Quote && !$this->service->config->settings?->sync_invoice_quote_columns) {
$table_type = "product_quote_columns"; $table_type = "product_quote_columns";
$column_type = 'product_quote';
} }
$this->processTaxColumns($column_type);
foreach ($this->service->config->pdf_variables[$table_type] as $column) { foreach ($this->service->config->pdf_variables[$table_type] as $column) {
if (array_key_exists($column, $aliases)) { if (array_key_exists($column, $aliases)) {
$elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label', 'properties' => ['data-ref' => "{$type}_table-" . substr($aliases[$column], 1) . '-th', 'hidden' => $this->service->config->settings->hide_empty_columns_on_pdf]]; $elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label', 'properties' => ['data-ref' => "{$type}_table-" . substr($aliases[$column], 1) . '-th', 'hidden' => $this->service->config->settings->hide_empty_columns_on_pdf]];
@ -831,6 +835,13 @@ class PdfBuilder
$type_id = 2; $type_id = 2;
} }
/** 17-05-2023 need to explicity define product_quote here */
if ($type == 'product_quote') {
$type_id = 1;
$column_type = 'product_quote';
$type = 'product';
}
// At the moment we pass "task" or "product" as type. // At the moment we pass "task" or "product" as type.
// However, "pdf_variables" contains "$task.tax" or "$product.tax" <-- Notice the dollar sign. // However, "pdf_variables" contains "$task.tax" or "$product.tax" <-- Notice the dollar sign.
// This sprintf() will help us convert "task" or "product" into "$task" or "$product" without // This sprintf() will help us convert "task" or "product" into "$task" or "$product" without

View File

@ -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' => env('APP_VERSION','5.7.40'), 'app_version' => env('APP_VERSION','5.7.41'),
'app_tag' => env('APP_TAG','5.7.40'), 'app_tag' => env('APP_TAG','5.7.41'),
'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', ''),

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="true" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false"
bootstrap="vendor/autoload.php" colors="true" processIsolation="true" stopOnError="true" stopOnFailure="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites> <testsuites>
<testsuite name="Unit"> <testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory> <directory suffix="Test.php">./tests/Unit</directory>

0
storage/app/public/.gitignore vendored Normal file → Executable file
View File

View File

@ -284,7 +284,7 @@ class ReportCsvGenerationTest extends TestCase
private function poll($hash) private function poll($hash)
{ {
$response = Http::retry(50, 1000, throw: false) $response = Http::retry(100, 400, throw: false)
->withHeaders([ ->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'), 'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token, 'X-API-TOKEN' => $this->token,