Merge pull request #8664 from turbo124/v5-stable

v5.6.21
This commit is contained in:
David Bomba 2023-07-23 17:51:05 +10:00 committed by GitHub
commit f2b7b21abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 185756 additions and 185616 deletions

View File

@ -1 +1 @@
5.6.20 5.6.21

View File

@ -81,6 +81,19 @@ class AccountTransformer implements AccountTransformerInterface
public function transformAccount($account) public function transformAccount($account)
{ {
$current_balance = 0;
$account_currency = '';
if(property_exists($account, 'currentBalance')) {
$current_balance = $account->currentBalance->amount ?? 0;
$account_currency = $account->currentBalance->currency ?? '';
}
elseif(property_exists($account, 'balance')){
$current_balance = $account->balance->amount ?? 0;
$account_currency = $account->balance->currency ?? '';
}
return [ return [
'id' => $account->id, 'id' => $account->id,
'account_type' => $account->CONTAINER, 'account_type' => $account->CONTAINER,
@ -92,8 +105,8 @@ class AccountTransformer implements AccountTransformerInterface
'provider_id' => $account->providerId, 'provider_id' => $account->providerId,
'provider_name' => $account->providerName, 'provider_name' => $account->providerName,
'nickname' => property_exists($account, 'nickname') ? $account->nickname : '', 'nickname' => property_exists($account, 'nickname') ? $account->nickname : '',
'current_balance' => property_exists($account, 'currentBalance') ? $account->currentBalance->amount : 0, 'current_balance' => $current_balance,
'account_currency' => property_exists($account, 'currency') ? $account->currentBalance->currency : '', 'account_currency' => $account_currency,
]; ];
} }
} }

View File

@ -185,6 +185,21 @@ class Yodlee
} }
} }
public function getAccountSummary($account_id)
{
$token = $this->getAccessToken();
$response = Http::withHeaders($this->getHeaders(["Authorization" => "Bearer {$token}"]))->get($this->getEndpoint(). "/accounts/{$account_id}", []);
if ($response->successful()) {
return $response->object();
}
if ($response->failed()) {
return false;
}
}
public function deleteAccount($account_id) public function deleteAccount($account_id)
{ {
$token = $this->getAccessToken(); $token = $this->getAccessToken();

View File

@ -209,7 +209,12 @@ class BankIntegrationController extends BaseController
$accounts = $yodlee->getAccounts(); $accounts = $yodlee->getAccounts();
foreach ($accounts as $account) { foreach ($accounts as $account) {
if (!BankIntegration::withTrashed()->where('bank_account_id', $account['id'])->where('company_id', $user->company()->id)->exists()) { if ($bi = BankIntegration::withTrashed()->where('bank_account_id', $account['id'])->where('company_id', $user->company()->id)->first()){
$bi->balance = $account['current_balance'];
$bi->currency = $account['account_currency'];
$bi->save();
}
else {
$bank_integration = new BankIntegration(); $bank_integration = new BankIntegration();
$bank_integration->company_id = $user->company()->id; $bank_integration->company_id = $user->company()->id;
$bank_integration->account_id = $user->account_id; $bank_integration->account_id = $user->account_id;

View File

@ -81,7 +81,8 @@ class ImportController extends Controller
/** @var UploadedFile $file */ /** @var UploadedFile $file */
foreach ($request->files->get('files') as $entityType => $file) { foreach ($request->files->get('files') as $entityType => $file) {
$contents = file_get_contents($file->getPathname()); $contents = file_get_contents($file->getPathname());
// $contents = mb_convert_encoding($contents, 'UTF-16LE', 'UTF-8');
$contents = $this->convertEncoding($contents);
// Store the csv in cache with an expiry of 10 minutes // Store the csv in cache with an expiry of 10 minutes
Cache::put($hash.'-'.$entityType, base64_encode($contents), 600); Cache::put($hash.'-'.$entityType, base64_encode($contents), 600);
@ -97,11 +98,21 @@ class ImportController extends Controller
]; ];
} }
$data = mb_convert_encoding($data, 'UTF-8', 'UTF-8');
return response()->json($data); return response()->json($data);
} }
private function convertEncoding($data)
{
$enc = mb_detect_encoding($data, mb_list_encodings(), true);
if($enc !== false) {
$data = mb_convert_encoding($data, "UTF-8", $enc);
}
return $data;
}
public function import(ImportRequest $request) public function import(ImportRequest $request)
{ {
$data = $request->all(); $data = $request->all();

View File

@ -102,6 +102,8 @@ class BaseImport
} }
$csv = base64_decode($base64_encoded_csv); $csv = base64_decode($base64_encoded_csv);
$csv = mb_convert_encoding($csv, 'UTF-8', 'UTF-8');
nlog($csv);
$csv = Reader::createFromString($csv); $csv = Reader::createFromString($csv);
$csvdelimiter = self::detectDelimiter($csv); $csvdelimiter = self::detectDelimiter($csv);
@ -765,8 +767,7 @@ class BaseImport
{ {
$keys = array_shift($data); $keys = array_shift($data);
ksort($keys); ksort($keys);
// nlog($data);
// nlog($keys);
return array_map(function ($values) use ($keys) { return array_map(function ($values) use ($keys) {
return array_combine($keys, $values); return array_combine($keys, $values);
}, $data); }, $data);

View File

@ -24,6 +24,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\Middleware\WithoutOverlapping;
use App\Notifications\Ninja\GenericNinjaAdminNotification; use App\Notifications\Ninja\GenericNinjaAdminNotification;
use App\Helpers\Bank\Yodlee\Transformer\AccountTransformer;
class ProcessBankTransactions implements ShouldQueue class ProcessBankTransactions implements ShouldQueue
{ {
@ -99,6 +100,24 @@ class ProcessBankTransactions implements ShouldQueue
return; return;
} }
try {
$account_summary = $yodlee->getAccountSummary($this->bank_integration->bank_account_id);
if($account_summary) {
$at = new AccountTransformer();
$account = $at->transform($account_summary);
$this->bank_integration->balance = $account['current_balance'];
$this->bank_integration->currency = $account['account_currency'];
$this->bank_integration->save();
}
}
catch(\Exception $e) {
nlog("YODLEE: unable to update account summary for {$this->bank_integration->bank_account_id} => ". $e->getMessage());
}
$data = [ $data = [
'top' => 500, 'top' => 500,
'fromDate' => $this->from_date, 'fromDate' => $this->from_date,

View File

@ -43,6 +43,10 @@ class UnlinkFile implements ShouldQueue
return; return;
} }
Storage::disk($this->disk)->delete($this->file_path); try {
Storage::disk($this->disk)->delete($this->file_path);
} catch (\Exception $e) {
}
} }
} }

View File

@ -212,9 +212,9 @@ class FacturaEInvoice extends AbstractService
private function setPoNumber(): self private function setPoNumber(): self
{ {
if(strlen($this->invoice->po_number) > 1) { $po = $this->invoice->po_number ?? '';
$this->fac->setReferences($this->invoice->po_number);
} $this->fac->setReferences($po, $this->invoice->custom_value1, $this->invoice->custom_value2);
return $this; return $this;
} }
@ -233,10 +233,10 @@ class FacturaEInvoice extends AbstractService
foreach($this->invoice->line_items as $item) { foreach($this->invoice->line_items as $item) {
$this->fac->addItem(new FacturaeItem([ $this->fac->addItem(new FacturaeItem([
'name' => $item->product_key, 'name' => $item->notes,
'description' => $item->notes, 'description' => $item->product_key,
'quantity' => $item->quantity, 'quantity' => $item->quantity,
'unitPrice' => $item->cost, 'unitPriceWithoutTax' => $item->cost,
'discountsAndRebates' => $item->discount, 'discountsAndRebates' => $item->discount,
'charges' => [], 'charges' => [],
'discounts' => [], 'discounts' => [],

View File

@ -150,7 +150,7 @@ class ClientTransformer extends EntityTransformer
'has_valid_vat_number' => (bool) $client->has_valid_vat_number, 'has_valid_vat_number' => (bool) $client->has_valid_vat_number,
'is_tax_exempt' => (bool) $client->is_tax_exempt, 'is_tax_exempt' => (bool) $client->is_tax_exempt,
'routing_id' => (string) $client->routing_id, 'routing_id' => (string) $client->routing_id,
'tax_data' => $client->tax_data ?: '', 'tax_info' => $client->tax_data ?: new \stdClass,
]; ];
} }
} }

View File

@ -133,7 +133,7 @@ class CompanyTransformer extends EntityTransformer
'show_product_details' => (bool) $company->show_product_details, 'show_product_details' => (bool) $company->show_product_details,
'enable_product_quantity' => (bool) $company->enable_product_quantity, 'enable_product_quantity' => (bool) $company->enable_product_quantity,
'default_quantity' => (bool) $company->default_quantity, 'default_quantity' => (bool) $company->default_quantity,
'custom_fields' => $company->custom_fields ?? $std, 'custom_fields' => (object) $company->custom_fields ?? $std,
'size_id' => (string) $company->size_id ?: '', 'size_id' => (string) $company->size_id ?: '',
'industry_id' => (string) $company->industry_id ?: '', 'industry_id' => (string) $company->industry_id ?: '',
'first_month_of_year' => (string) $company->first_month_of_year ?: '', 'first_month_of_year' => (string) $company->first_month_of_year ?: '',

View File

@ -149,7 +149,7 @@ class InvoiceTransformer extends EntityTransformer
'paid_to_date' => (float) $invoice->paid_to_date, 'paid_to_date' => (float) $invoice->paid_to_date,
'subscription_id' => $this->encodePrimaryKey($invoice->subscription_id), 'subscription_id' => $this->encodePrimaryKey($invoice->subscription_id),
'auto_bill_enabled' => (bool) $invoice->auto_bill_enabled, 'auto_bill_enabled' => (bool) $invoice->auto_bill_enabled,
'tax_data' => $invoice->tax_data ?: '', 'tax_info' => $invoice->tax_data ?: new \stdClass,
]; ];
} }
} }

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.6.20'), 'app_version' => env('APP_VERSION','5.6.21'),
'app_tag' => env('APP_TAG','5.6.20'), 'app_tag' => env('APP_TAG','5.6.21'),
'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

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$ir = \App\Models\Currency::where('code', 'IDR')->first();
if($ir){
$ir->thousand_separator = '.';
$ir->decimal_separator = ',';
$ir->save();
}
$ld = \App\Models\Currency::find(115);
if(!$ld) {
$ld = new \App\Models\Currency();
$ld->id = 115;
$ld->code = 'LYD';
$ld->name = 'Libyan Dinar';
$ld->symbol = 'LD';
$ld->thousand_separator = ',';
$ld->decimal_separator = '.';
$ld->precision = 3;
$ld->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};

View File

@ -49,7 +49,7 @@ class CurrenciesSeeder extends Seeder
['id' => 24, 'name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 24, 'name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 25, 'name' => 'United Arab Emirates Dirham', 'code' => 'AED', 'symbol' => 'DH ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 25, 'name' => 'United Arab Emirates Dirham', 'code' => 'AED', 'symbol' => 'DH ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 26, 'name' => 'Hong Kong Dollar', 'code' => 'HKD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 26, 'name' => 'Hong Kong Dollar', 'code' => 'HKD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 27, 'name' => 'Indonesian Rupiah', 'code' => 'IDR', 'symbol' => 'Rp', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 27, 'name' => 'Indonesian Rupiah', 'code' => 'IDR', 'symbol' => 'Rp', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],
['id' => 28, 'name' => 'Mexican Peso', 'code' => 'MXN', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 28, 'name' => 'Mexican Peso', 'code' => 'MXN', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 29, 'name' => 'Egyptian Pound', 'code' => 'EGP', 'symbol' => 'E£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 29, 'name' => 'Egyptian Pound', 'code' => 'EGP', 'symbol' => 'E£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 30, 'name' => 'Colombian Peso', 'code' => 'COP', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], ['id' => 30, 'name' => 'Colombian Peso', 'code' => 'COP', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],
@ -136,6 +136,8 @@ class CurrenciesSeeder extends Seeder
['id' => 111, 'name' => 'Cuban Peso', 'code' => 'CUP', 'symbol' => '₱', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 111, 'name' => 'Cuban Peso', 'code' => 'CUP', 'symbol' => '₱', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 112, 'name' => 'Cayman Island Dollar', 'code' => 'KYD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 112, 'name' => 'Cayman Island Dollar', 'code' => 'KYD', 'symbol' => '', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 113, 'name' => 'Swazi lilangeni', 'code' => 'SZL', 'symbol' => 'E', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 113, 'name' => 'Swazi lilangeni', 'code' => 'SZL', 'symbol' => 'E', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 114, 'name' => 'BZ Dollar', 'code' => 'BZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 115, 'name' => 'Libyan Dinar', 'code' => 'LYD', 'symbol' => 'LD', 'precision' => '3', 'thousand_separator' => ',', 'decimal_separator' => '.'],
]; ];
foreach ($currencies as $currency) { foreach ($currencies as $currency) {

View File

@ -3,10 +3,10 @@ const MANIFEST = 'flutter-app-manifest';
const TEMP = 'flutter-temp-cache'; const TEMP = 'flutter-temp-cache';
const CACHE_NAME = 'flutter-app-cache'; const CACHE_NAME = 'flutter-app-cache';
const RESOURCES = { const RESOURCES = {
"/": "4c0d0481ceb2647c96c83df4e544c41c", "/": "dad42af82faab711765c59e9a7596b11",
"flutter.js": "a85fcf6324d3c4d3ae3be1ae4931e9c5", "flutter.js": "a85fcf6324d3c4d3ae3be1ae4931e9c5",
"favicon.png": "dca91c54388f52eded692718d5a98b8b", "favicon.png": "dca91c54388f52eded692718d5a98b8b",
"main.dart.js": "8f2a7bec4184b6bdfb96c53eb69b9376", "main.dart.js": "b11ed73562dd3c3db2c346bc14702036",
"version.json": "bf49df736fed3f74ade0dbaebf08de11", "version.json": "bf49df736fed3f74ade0dbaebf08de11",
"canvaskit/profiling/canvaskit.js": "c21852696bc1cc82e8894d851c01921a", "canvaskit/profiling/canvaskit.js": "c21852696bc1cc82e8894d851c01921a",
"canvaskit/profiling/canvaskit.wasm": "371bc4e204443b0d5e774d64a046eb99", "canvaskit/profiling/canvaskit.wasm": "371bc4e204443b0d5e774d64a046eb99",

185856
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

182086
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long