Merge pull request #8889 from turbo124/v5-develop

v5.7.33
This commit is contained in:
David Bomba 2023-10-20 07:47:27 +11:00 committed by GitHub
commit 91ddacc3dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 78 deletions

View File

@ -1 +1 @@
5.7.32
5.7.33

View File

@ -15,6 +15,7 @@ use App\Models\Company;
use App\Models\Invoice;
use App\Models\RecurringInvoice;
use App\Utils\Ninja;
use BaconQrCode\Exception\InvalidArgumentException;
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
@ -50,8 +51,7 @@ class EpcQrGenerator
);
$writer = new Writer($renderer);
if($this->validateFields())
return '';
$this->validateFields();
$qr = $writer->writeString($this->encodeMessage(), 'utf-8');
@ -59,10 +59,15 @@ class EpcQrGenerator
<rect x='0' y='0' width='100%'' height='100%' />{$qr}</svg>";
} catch(\Throwable $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
} catch(\Exception $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
}
} catch( InvalidArgumentException $e) {
nlog("EPC QR failure => ".$e->getMessage());
return '';
}
}
@ -88,16 +93,13 @@ class EpcQrGenerator
private function validateFields()
{
if (Ninja::isSelfHost() && isset($this->company?->custom_fields?->company2)) {
return true;
nlog('The BIC field is not present and _may_ be a required fields for EPC QR codes');
}
if (Ninja::isSelfHost() && isset($this->company?->custom_fields?->company1)) {
return true;
nlog('The IBAN field is required');
}
return false;
}
private function formatMoney($value)

View File

@ -308,7 +308,8 @@ class ClientController extends BaseController
*/
public function updateTaxData(PurgeClientRequest $request, Client $client)
{
(new UpdateTaxData($client, $client->company))->handle();
if($client->company->account->isPaid())
(new UpdateTaxData($client, $client->company))->handle();
return $this->itemResponse($client->fresh());
}

View File

@ -111,11 +111,12 @@ class PreviewController extends BaseController
$html->settings = $settings;
$variables = $html->generateLabelsAndValues();
$design = \App\Models\Design::withTrashed()->find($entity_obj->design_id ?? 2);
$design = \App\Models\Design::query()->withTrashed()->find($entity_obj->design_id ?? 2);
/* Catch all in case migration doesn't pass back a valid design */
if (! $design) {
$design = \App\Models\Design::find(2);
$design = \App\Models\Design::query()->find(2);
}
if ($design->is_custom) {
@ -329,8 +330,8 @@ class PreviewController extends BaseController
/**
* @deprecated due to usage of transactions
*
* @param mixed $request
* @return void
* @param PreviewInvoiceRequest $request
* @return mixed
*/
public function livex(PreviewInvoiceRequest $request)
{

View File

@ -52,7 +52,7 @@ class UpdateTaxData implements ShouldQueue
{
MultiDB::setDb($this->company->db);
if($this->company->account->isFreeHostedClient())
if($this->company->account->isFreeHostedClient() || $this->client->country_id != 840)
return;
$tax_provider = new \App\Services\Tax\Providers\TaxProvider($this->company, $this->client);
@ -73,69 +73,6 @@ class UpdateTaxData implements ShouldQueue
nlog("problem getting tax data => ".$e->getMessage());
}
/*
if(!$tax_provider->updatedTaxStatus() && $this->client->country_id == 840){
$calculated_state = false;
if(array_key_exists($this->client->shipping_state, USStates::get())) {
$calculated_state = $this->client->shipping_state;
$calculated_postal_code = $this->client->shipping_postal_code;
$calculated_city = $this->client->shipping_city;
}
elseif(array_key_exists($this->client->state, USStates::get())){
$calculated_state = $this->client->state;
$calculated_postal_code = $this->client->postal_code;
$calculated_city = $this->client->city;
}
else {
try{
$calculated_state = USStates::getState($this->client->shipping_postal_code);
$calculated_postal_code = $this->client->shipping_postal_code;
$calculated_city = $this->client->shipping_city;
}
catch(\Exception $e){
nlog("could not calculate state from postal code => {$this->client->shipping_postal_code} or from state {$this->client->shipping_state}");
}
if(!$calculated_state) {
try {
$calculated_state = USStates::getState($this->client->postal_code);
$calculated_postal_code = $this->client->postal_code;
$calculated_city = $this->client->city;
} catch(\Exception $e) {
nlog("could not calculate state from postal code => {$this->client->postal_code} or from state {$this->client->state}");
}
}
if($this->company->tax_data?->seller_subregion)
$calculated_state = $this->company->tax_data?->seller_subregion;
nlog("i am trying");
if(!$calculated_state) {
nlog("could not determine state");
return;
}
}
$data = [
'seller_subregion' => $this->company->tax_data?->seller_subregion ?: '',
'geoPostalCode' => $this->client->postal_code ?? '',
'geoCity' => $this->client->city ?? '',
'geoState' => $calculated_state,
'taxSales' => $this->company->tax_data->regions->US->subregions?->{$calculated_state}?->taxSales ?? 0,
];
$tax_data = new Response($data);
$this->client->tax_data = $tax_data;
$this->client->saveQuietly();
}
*/
}
public function middleware()

View File

@ -225,6 +225,8 @@ class TaxProvider
*/
private function configureEuTax(): self
{
throw new \Exception("No tax region defined for this country");
$this->provider = EuTax::class;
return $this;

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' => env('APP_VERSION','5.7.32'),
'app_tag' => env('APP_TAG','5.7.32'),
'app_version' => env('APP_VERSION','5.7.33'),
'app_tag' => env('APP_TAG','5.7.33'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),