1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #8512 from turbo124/v5-develop

v5.5.118
This commit is contained in:
David Bomba 2023-05-17 21:05:31 +10:00 committed by GitHub
commit 533bcb951e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 20 deletions

View File

@ -1 +1 @@
5.5.117
5.5.118

View File

@ -194,7 +194,7 @@ class BaseRule implements RuleInterface
}
/** If we are in a Origin based state, force the company tax here */
if($company->origin_tax_data->originDestination == 'O' && ($company->tax_data->seller_subregion == $this->client_subregion)) {
if($company->origin_tax_data?->originDestination == 'O' && ($company->tax_data?->seller_subregion == $this->client_subregion)) {
$tax_data = $company->origin_tax_data;

View File

@ -145,8 +145,6 @@ class Rule extends BaseRule implements RuleInterface
*/
public function taxPhysical($item): self
{
nlog("tax physical");
nlog($item);
$this->default($item);
return $this;

View File

@ -192,7 +192,7 @@ class FacturaEInvoice extends AbstractService
if($this->invoice->client->custom_value1 == 'yes')
{
foreach($this->invoice->client->contacts() as $contact)
foreach($this->invoice->client->contacts()->whereNotNull('custom_value1')->whereNull('deleted_at')->cursor() as $contact)
{
if(in_array($contact->custom_value1, array_keys($this->centre_codes)))
@ -345,12 +345,11 @@ class FacturaEInvoice extends AbstractService
"fax" => "",
"website" => substr($company->settings->website, 0, 50),
"contactPeople" => substr($company->owner()->present()->name(), 0, 40),
'centres' => $this->setFace(),
// 'centres' => $this->setFace(),
// "cnoCnae" => "04647", // Clasif. Nacional de Act. Económicas
// "ineTownCode" => "280796" // Cód. de municipio del INE
]);
$this->fac->setSeller($seller);
return $this;
@ -375,6 +374,7 @@ class FacturaEInvoice extends AbstractService
"fax" => "",
"website" => substr($this->invoice->client->present()->website(), 0 ,60),
"contactPeople" => substr($this->invoice->client->present()->first_name()." ".$this->invoice->client->present()->last_name(), 0, 40),
'centres' => $this->setFace(),
// "cnoCnae" => "04791", // Clasif. Nacional de Act. Económicas
// "ineTownCode" => "280796" // Cód. de municipio del INE
]);

View File

@ -39,7 +39,11 @@ class TriggeredActions extends AbstractService
public function run()
{
if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') {
$this->invoice->service()->autoBill(); //update notification sends automatically for this.
try {
$this->invoice->service()->autoBill();
} catch(\Exception $e) {
} //update notification sends automatically for this.
}
if ($this->request->has('paid') && $this->request->input('paid') == 'true') {

View File

@ -743,8 +743,6 @@ class Design extends BaseDesign
*/
public function buildTableHeader(string $type): array
{
$this->processTaxColumns($type);
// $this->processCustomColumns($type);
$elements = [];
@ -757,10 +755,16 @@ class Design extends BaseDesign
$table_type = "{$type}_columns";
$column_type = $type;
if ($type == 'product' && $this->entity instanceof Quote && !$this->settings_object->getSetting('sync_invoice_quote_columns')) {
$table_type = "product_quote_columns";
$column_type = 'product_quote';
}
$this->processTaxColumns($column_type);
foreach ($this->context['pdf_variables'][$table_type] as $column) {
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->settings_object->getSetting('hide_empty_columns_on_pdf')]];
@ -837,7 +841,6 @@ class Design extends BaseDesign
$table_type = "product_quote_columns";
}
foreach ($items as $row) {
$element = ['element' => 'tr', 'elements' => []];

View File

@ -150,6 +150,8 @@ trait DesignHelpers
*/
public function processTaxColumns(string $type): void
{
$column_type = $type;
if ($type == 'product') {
$type_id = 1;
}
@ -157,13 +159,21 @@ trait DesignHelpers
if ($type == 'task') {
$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.
// 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
// evaluating the variable.
if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$type}_columns"])) {
if (in_array(sprintf('%s%s.tax', '$', $type), (array) $this->context['pdf_variables']["{$column_type}_columns"])) {
$line_items = collect($this->entity->line_items)->filter(function ($item) use ($type_id) {
return $item->type_id = $type_id;
});
@ -186,10 +196,10 @@ trait DesignHelpers
array_push($taxes, sprintf('%s%s.tax_rate3', '$', $type));
}
$key = array_search(sprintf('%s%s.tax', '$', $type), $this->context['pdf_variables']["{$type}_columns"], true);
$key = array_search(sprintf('%s%s.tax', '$', $type), $this->context['pdf_variables']["{$column_type}_columns"], true);
if ($key !== false) {
array_splice($this->context['pdf_variables']["{$type}_columns"], $key, 1, $taxes);
array_splice($this->context['pdf_variables']["{$column_type}_columns"], $key, 1, $taxes);
}
}
}

View File

@ -45,7 +45,7 @@ class ZipTax implements TaxProviderInterface
}
$response->throw();
// $response->throw();
}
@ -75,7 +75,7 @@ class ZipTax implements TaxProviderInterface
if(isset($response['results']['0']))
return $response['results']['0'];
throw new \Exception("Error resolving tax (code) = " . $response['rCode']);
return null;
// throw new \Exception("Error resolving tax (code) = " . $response['rCode']);
}
}

View File

@ -15,8 +15,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.117',
'app_tag' => '5.5.117',
'app_version' => '5.5.118',
'app_tag' => '5.5.118',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),