1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #8855 from turbo124/v5-develop

v5.7.26
This commit is contained in:
David Bomba 2023-10-05 12:01:28 +11:00 committed by GitHub
commit 49d848e9c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 151 additions and 101 deletions

View File

@ -1 +1 @@
5.7.24
5.7.26

View File

@ -132,6 +132,7 @@ class BaseExport
];
protected array $invoice_report_keys = [
'name' => 'client.name',
"invoice_number" => "invoice.number",
"amount" => "invoice.amount",
"balance" => "invoice.balance",

View File

@ -114,7 +114,7 @@ class PaymentFilters extends QueryFilters
}
if(in_array('partially_unapplied', $status_parameters)) {
$query->where('amount', '>', 'applied')->where('refunded', 0);
$query->whereColumn('amount', '>', 'applied')->where('refunded', 0);
}
});

View File

@ -80,6 +80,7 @@ class ContactForgotPasswordController extends Controller
'passwordEmailRoute' => 'client.password.email',
'account' => $account,
'company' => $company,
'is_react' => false,
]);
}

View File

@ -33,11 +33,18 @@ class StorePaymentRequest extends Request
*/
public function authorize() : bool
{
return auth()->user()->can('create', Payment::class);
/** @var \App\Models\User $user */
$user = auth()->user();
return $user->can('create', Payment::class);
}
public function prepareForValidation()
{
/** @var \App\Models\User $user */
$user = auth()->user();
$input = $this->all();
$invoices_total = 0;
@ -86,7 +93,7 @@ class StorePaymentRequest extends Request
}
if (! isset($input['date'])) {
$input['date'] = now()->addSeconds(auth()->user()->company()->timezone()->utc_offset)->format('Y-m-d');
$input['date'] = now()->addSeconds($user->company()->timezone()->utc_offset)->format('Y-m-d');
}
$this->replace($input);
@ -94,10 +101,13 @@ class StorePaymentRequest extends Request
public function rules()
{
/** @var \App\Models\User $user */
$user = auth()->user();
$rules = [
'amount' => ['numeric', 'bail', new PaymentAmountsBalanceRule(), new ValidCreditsPresentRule($this->all())],
// 'client_id' => 'bail|required|exists:clients,id',
'client_id' => 'bail|required|exists:clients,id,company_id,'.auth()->user()->company()->id.',is_deleted,0',
'client_id' => 'bail|required|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0',
'invoices.*.invoice_id' => 'bail|required|distinct|exists:invoices,id',
'invoices.*.amount' => 'bail|required',
'invoices.*.invoice_id' => new ValidInvoicesRules($this->all()),
@ -105,8 +115,8 @@ class StorePaymentRequest extends Request
'credits.*.credit_id' => new ValidCreditsRules($this->all()),
'credits.*.amount' => ['bail','required', new CreditsSumRule($this->all())],
'invoices' => new ValidPayableInvoicesRule(),
'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
'idempotency_key' => ['nullable', 'bail', 'string','max:64', Rule::unique('payments')->where('company_id', auth()->user()->company()->id)],
'number' => ['nullable', 'bail', Rule::unique('payments')->where('company_id', $user->company()->id)],
'idempotency_key' => ['nullable', 'bail', 'string','max:64', Rule::unique('payments')->where('company_id', $user->company()->id)],
];

View File

@ -660,7 +660,7 @@ class User extends Authenticatable implements MustVerifyEmail
public function getLocale()
{
$locale = $this->language->locale ?? false;
$locale = $this->language->locale ?? null;
if($locale)
App::setLocale($locale);

View File

@ -98,10 +98,17 @@ class GoCardlessPaymentDriver extends BaseDriver
public function init(): self
{
$this->gateway = new \GoCardlessPro\Client([
'access_token' => $this->company_gateway->getConfigField('accessToken'),
'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE,
]);
try {
$this->gateway = new \GoCardlessPro\Client([
'access_token' => $this->company_gateway->getConfigField('accessToken'),
'environment' => $this->company_gateway->getConfigField('testMode') ? \GoCardlessPro\Environment::SANDBOX : \GoCardlessPro\Environment::LIVE,
]);
}
catch(\GoCardlessPro\Core\Exception\AuthenticationException $e){
throw new \Exception('GoCardless: Invalid Access Token', 403);
}
return $this;
}

View File

@ -101,6 +101,9 @@ class PaymentRepository extends BaseRepository
$client->saveQuietly();
}
}, 1);
$client = Client::query()->where('id', $data['client_id'])->withTrashed()->first();
}
/*Fill the payment*/
@ -108,7 +111,7 @@ class PaymentRepository extends BaseRepository
$payment->is_manual = true;
$payment->status_id = Payment::STATUS_COMPLETED;
if (! $payment->currency_id && $client) {
if ((!$payment->currency_id || $payment->currency_id == 0) && $client) {
if (property_exists($client->settings, 'currency_id')) {
$payment->currency_id = $client->settings->currency_id;
} else {

View File

@ -90,7 +90,6 @@ class RecurringExpenseTransformer extends EntityTransformer
'currency_id' => (string) $recurring_expense->currency_id ?: '',
'category_id' => $this->encodePrimaryKey($recurring_expense->category_id),
'payment_type_id' => (string) $recurring_expense->payment_type_id ?: '',
'recurring_recurring_expense_id' => (string) $recurring_expense->recurring_recurring_expense_id ?: '',
'is_deleted' => (bool) $recurring_expense->is_deleted,
'should_be_invoiced' => (bool) $recurring_expense->should_be_invoiced,
'invoice_documents' => (bool) $recurring_expense->invoice_documents,

107
composer.lock generated
View File

@ -485,16 +485,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.282.0",
"version": "3.283.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "79a3ed5bb573f592823f8b1cffe0dbac3132e6b4"
"reference": "5084c03431ecda0003e35d7fc7a12eeca4242685"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/79a3ed5bb573f592823f8b1cffe0dbac3132e6b4",
"reference": "79a3ed5bb573f592823f8b1cffe0dbac3132e6b4",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5084c03431ecda0003e35d7fc7a12eeca4242685",
"reference": "5084c03431ecda0003e35d7fc7a12eeca4242685",
"shasum": ""
},
"require": {
@ -574,9 +574,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.282.0"
"source": "https://github.com/aws/aws-sdk-php/tree/3.283.0"
},
"time": "2023-09-28T18:09:20+00:00"
"time": "2023-10-04T18:08:32+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -2169,16 +2169,16 @@
},
{
"name": "firebase/php-jwt",
"version": "v6.8.1",
"version": "v6.9.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26"
"reference": "f03270e63eaccf3019ef0f32849c497385774e11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"reference": "5dbc8959427416b8ee09a100d7a8588c00fb2e26",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11",
"reference": "f03270e63eaccf3019ef0f32849c497385774e11",
"shasum": ""
},
"require": {
@ -2226,9 +2226,9 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.8.1"
"source": "https://github.com/firebase/php-jwt/tree/v6.9.0"
},
"time": "2023-07-14T18:33:00+00:00"
"time": "2023-10-05T00:24:42+00:00"
},
{
"name": "fruitcake/php-cors",
@ -4287,16 +4287,16 @@
},
{
"name": "laravel/framework",
"version": "v10.25.2",
"version": "v10.26.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "6014dd456b414b305fb0b408404efdcec18e64bc"
"reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/6014dd456b414b305fb0b408404efdcec18e64bc",
"reference": "6014dd456b414b305fb0b408404efdcec18e64bc",
"url": "https://api.github.com/repos/laravel/framework/zipball/6e5440f7c518f26b4495e5d7e4796ec239e26df9",
"reference": "6e5440f7c518f26b4495e5d7e4796ec239e26df9",
"shasum": ""
},
"require": {
@ -4483,20 +4483,20 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2023-09-28T14:08:59+00:00"
"time": "2023-10-03T14:24:20+00:00"
},
{
"name": "laravel/prompts",
"version": "v0.1.10",
"version": "v0.1.11",
"source": {
"type": "git",
"url": "https://github.com/laravel/prompts.git",
"reference": "37ed55f6950d921a87d5beeab16d03f8de26b060"
"reference": "cce65a90e64712909ea1adc033e1d88de8455ffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/37ed55f6950d921a87d5beeab16d03f8de26b060",
"reference": "37ed55f6950d921a87d5beeab16d03f8de26b060",
"url": "https://api.github.com/repos/laravel/prompts/zipball/cce65a90e64712909ea1adc033e1d88de8455ffd",
"reference": "cce65a90e64712909ea1adc033e1d88de8455ffd",
"shasum": ""
},
"require": {
@ -4538,9 +4538,9 @@
],
"support": {
"issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.1.10"
"source": "https://github.com/laravel/prompts/tree/v0.1.11"
},
"time": "2023-09-29T07:26:07+00:00"
"time": "2023-10-03T01:07:35+00:00"
},
{
"name": "laravel/serializable-closure",
@ -9560,16 +9560,16 @@
},
{
"name": "sentry/sentry-laravel",
"version": "3.8.0",
"version": "3.8.1",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-laravel.git",
"reference": "c7e7611553f9f90af10ed98dde1a680220f02e4d"
"reference": "b6142a80fa9360a10b786d2da032339602d0e362"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/c7e7611553f9f90af10ed98dde1a680220f02e4d",
"reference": "c7e7611553f9f90af10ed98dde1a680220f02e4d",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/b6142a80fa9360a10b786d2da032339602d0e362",
"reference": "b6142a80fa9360a10b786d2da032339602d0e362",
"shasum": ""
},
"require": {
@ -9636,7 +9636,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-laravel/issues",
"source": "https://github.com/getsentry/sentry-laravel/tree/3.8.0"
"source": "https://github.com/getsentry/sentry-laravel/tree/3.8.1"
},
"funding": [
{
@ -9648,7 +9648,7 @@
"type": "custom"
}
],
"time": "2023-09-05T11:02:34+00:00"
"time": "2023-10-04T10:21:16+00:00"
},
{
"name": "setasign/fpdf",
@ -14528,16 +14528,16 @@
},
{
"name": "brianium/paratest",
"version": "v7.2.7",
"version": "v7.2.8",
"source": {
"type": "git",
"url": "https://github.com/paratestphp/paratest.git",
"reference": "1526eb4fd195f65075456dee394d14742ae0a66c"
"reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/1526eb4fd195f65075456dee394d14742ae0a66c",
"reference": "1526eb4fd195f65075456dee394d14742ae0a66c",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/882b02d197328138686bb06ce7d8cbb98fc0a16c",
"reference": "882b02d197328138686bb06ce7d8cbb98fc0a16c",
"shasum": ""
},
"require": {
@ -14607,7 +14607,7 @@
],
"support": {
"issues": "https://github.com/paratestphp/paratest/issues",
"source": "https://github.com/paratestphp/paratest/tree/v7.2.7"
"source": "https://github.com/paratestphp/paratest/tree/v7.2.8"
},
"funding": [
{
@ -14619,7 +14619,7 @@
"type": "paypal"
}
],
"time": "2023-09-14T14:10:09+00:00"
"time": "2023-10-04T13:38:04+00:00"
},
{
"name": "composer/class-map-generator",
@ -15046,16 +15046,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.34.0",
"version": "v3.34.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23"
"reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7c7a4ad2ed8fe50df3e25528218b13d383608f23",
"reference": "7c7a4ad2ed8fe50df3e25528218b13d383608f23",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
"reference": "98bf1b1068b4ceddbbc2a2b70b67a5e380add9e3",
"shasum": ""
},
"require": {
@ -15076,9 +15076,6 @@
"symfony/process": "^5.4 || ^6.0",
"symfony/stopwatch": "^5.4 || ^6.0"
},
"conflict": {
"stevebauman/unfinalize": "*"
},
"require-dev": {
"facile-it/paraunit": "^1.3 || ^2.0",
"justinrainbow/json-schema": "^5.2",
@ -15132,7 +15129,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.34.1"
},
"funding": [
{
@ -15140,7 +15137,7 @@
"type": "github"
}
],
"time": "2023-09-29T15:34:26+00:00"
"time": "2023-10-03T23:51:05+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -15851,16 +15848,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.10.36",
"version": "1.10.37",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "ffa3089511121a672e62969404e4fddc753f9b15"
"reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15",
"reference": "ffa3089511121a672e62969404e4fddc753f9b15",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e",
"reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e",
"shasum": ""
},
"require": {
@ -15909,20 +15906,20 @@
"type": "tidelift"
}
],
"time": "2023-09-29T14:07:45+00:00"
"time": "2023-10-02T16:18:37+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "10.1.6",
"version": "10.1.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "56f33548fe522c8d82da7ff3824b42829d324364"
"reference": "355324ca4980b8916c18b9db29f3ef484078f26e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364",
"reference": "56f33548fe522c8d82da7ff3824b42829d324364",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/355324ca4980b8916c18b9db29f3ef484078f26e",
"reference": "355324ca4980b8916c18b9db29f3ef484078f26e",
"shasum": ""
},
"require": {
@ -15979,7 +15976,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.7"
},
"funding": [
{
@ -15987,7 +15984,7 @@
"type": "github"
}
],
"time": "2023-09-19T04:59:03+00:00"
"time": "2023-10-04T15:34:17+00:00"
},
{
"name": "phpunit/php-file-iterator",

View File

@ -36,10 +36,6 @@ return [
* the built in metrics.
*/
'system_logging' => [
'Turbo124\Beacon\Jobs\System\CpuMetric',
'Turbo124\Beacon\Jobs\System\HdMetric',
'Turbo124\Beacon\Jobs\System\MemMetric',
App\Jobs\Ninja\CheckDbStatus::class,
],
];

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

File diff suppressed because one or more lines are too long

View File

@ -76,7 +76,7 @@
"src": "resources/js/clients/payments/checkout-credit-card.js"
},
"resources/js/clients/payments/eway-credit-card.js": {
"file": "assets/eway-credit-card-19df3242.js",
"file": "assets/eway-credit-card-62ce5f3b.js",
"isEntry": true,
"src": "resources/js/clients/payments/eway-credit-card.js"
},

View File

@ -469,7 +469,7 @@ class EwayRapid {
?.addEventListener('click', (e) => this.completeAuthorization(e));
Array.from(
document.getElementsByClassName('toggle-payment-with-token')
document.getElementsByClassName('toggle-payment-with-token') ?? []
).forEach((element) =>
element.addEventListener('click', (element) => {
document
@ -483,17 +483,20 @@ class EwayRapid {
})
);
document
.getElementById('toggle-payment-with-credit-card')
.addEventListener('click', (element) => {
document
.getElementById('eway-secure-panel')
.classList.remove('hidden');
document.getElementById('save-card--container').style.display =
'grid';
document.querySelector('input[name=token]').value = '';
document.getElementById('pay-now').disabled = true;
});
if (document.getElementById('toggle-payment-with-credit-card'))
{
document
.getElementById('toggle-payment-with-credit-card')
.addEventListener('click', (element) => {
document
.getElementById('eway-secure-panel')
.classList.remove('hidden');
document.getElementById('save-card--container').style.display =
'grid';
document.querySelector('input[name=token]').value = '';
document.getElementById('pay-now').disabled = true;
});
}
document.getElementById('pay-now')?.addEventListener('click', (e) => {
let tokenInput = document.querySelector('input[name=token]');

View File

@ -25,7 +25,7 @@
@foreach($multiple_contacts as $contact)
<a data-turbolinks="false"
href="{{ route('client.switch_company', $contact->hashed_id) }}"
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ $contact->client->present()->name()}} - {{ $contact->company->present()->name() }}
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ $contact->client->present()->name()}}
</a>
@endforeach
</div>

View File

@ -92,5 +92,7 @@
@section('gateway_footer')
<script src="https://js.braintreegateway.com/web/3.81.0/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.81.0/js/us-bank-account.min.js"></script>
@vite('resources/js/clients/payment_methods/braintree-ach.js')
<script defer src="{{ asset('js/clients/payment_methods/braintree-ach.js') }}"></script>
@endsection

View File

@ -43,7 +43,7 @@
@endsection
@push('footer')
<script>
<script defer>
Array
.from(document.getElementsByClassName('toggle-payment-with-token'))
.forEach((element) => element.addEventListener('click', (element) => {

View File

@ -75,7 +75,9 @@
@endsection
@section('gateway_footer')
@vite('resources/js/clients/payments/braintree-credit-card.js')
<script defer src="{{ asset('js/clients/payments/braintree-credit-card.js') }}"></script>
@endsection
<div id="threeds"></div>

View File

@ -158,6 +158,44 @@ class ReminderTest extends TestCase
}
public function testReminderInThePast()
{
$translations = new \stdClass;
$translations->late_fee_added = "Fee added :date";
$settings = $this->company->settings;
$settings->enable_reminder1 = false;
$settings->schedule_reminder1 = '';
$settings->num_days_reminder1 = 1;
$settings->enable_reminder2 = false;
$settings->schedule_reminder2 = '';
$settings->num_days_reminder2 = 2;
$settings->enable_reminder3 = false;
$settings->schedule_reminder3 = '';
$settings->num_days_reminder3 = 3;
$settings->timezone_id = '29';
$settings->entity_send_time = 0;
$settings->endless_reminder_frequency_id = '5';
$settings->enable_reminder_endless = true;
$settings->translations = $translations;
$settings->late_fee_amount1 = '0';
$settings->late_fee_amount2 = '0';
$settings->late_fee_amount3 = '0';
$this->buildData(($settings));
$this->invoice->date = now()->subMonths(2)->format('Y-m-d');
$this->invoice->due_date = now()->subMonth()->format('Y-m-d');
$this->invoice->last_sent_date = now();
$this->invoice->service()->setReminder($settings)->save();
$this->invoice = $this->invoice->fresh();
$this->assertEquals(now()->startOfDay()->addMonth()->format('Y-m-d'), \Carbon\Carbon::parse($this->invoice->next_send_date)->startOfDay()->format('Y-m-d'));
}
public function testsForTranslationsInReminders()
{