1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Merge pull request #10147 from turbo124/v5-develop

v5.10.39
This commit is contained in:
David Bomba 2024-10-16 11:11:09 +11:00 committed by GitHub
commit dafc013191
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 46 additions and 39 deletions

View File

@ -1 +1 @@
5.10.38
5.10.39

View File

@ -385,9 +385,12 @@ class CreateSingleAccount extends Command
});
$this->countryClients($company, $user);
$cc = ClientContact::where('company_id', $company->id)->latest()->first();
$cc->email = 'user@example.com';
$cc->save();
$this->info("finished");
}
@ -472,13 +475,13 @@ class CreateSingleAccount extends Command
'company_id' => $company->id,
]);
ClientContact::factory()->create([
'user_id' => $user->id,
'client_id' => $client->id,
'company_id' => $company->id,
'is_primary' => 1,
'email' => 'user@example.com',
]);
// ClientContact::factory()->create([
// 'user_id' => $user->id,
// 'client_id' => $client->id,
// 'company_id' => $company->id,
// 'is_primary' => 1,
// 'email' => 'user@example.com',
// ]);
ClientContact::factory()->count(rand(1, 2))->create([
'user_id' => $user->id,
@ -490,7 +493,6 @@ class CreateSingleAccount extends Command
$settings = $client->settings;
$settings->currency_id = "1";
// $settings->use_credits_payment = "always";
$client->settings = $settings;

View File

@ -610,6 +610,7 @@ class BaseController extends Controller
if (! $user->isAdmin()) {
$query->where('activities.user_id', $user->id);
}
$query->whereColumn('companies.account_id', 'activities.account_id');
},
'company.bank_integrations' => function ($query) use ($user) {
if (! $user->hasPermission('view_bank_transaction')) {

View File

@ -91,7 +91,6 @@ class InvoiceController extends Controller
return auth()->guard('contact')->user()->client->getSetting('payment_flow') == 'default' ? $this->render('invoices.show', $data) : $this->render('invoices.show_smooth', $data);
// return $this->render('invoices.show_smooth', $data);
}
public function showBlob($hash)

View File

@ -25,13 +25,20 @@ class SubdomainController extends BaseController
*/
public function index()
{
$user = auth()->user();
$company = $user->company();
if($company->subdomain == trim(request()->input('subdomain'))){
return response()->json(['message' => 'Current subdomain name.'], 200);
}
if (!MultiDB::checkDomainAvailable(request()->input('subdomain'))) {
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
}
if (!preg_match('/^[A-Za-z0-9](?:[A-Za-z0-9\-]{0,61}[A-Za-z0-9])?$/', request()->input('subdomain'))) {
return response()->json(['message' => ctrans('texts.subdomain_is_not_available')], 401);
return response()->json(['message' => "Invalid subdomain format."], 401);
}

View File

@ -66,7 +66,6 @@ class CheckClientExistence
}
session()->put('multiple_contacts', $multiple_contacts);
session()->put('is_silent', request()->has('silent'));
return $next($request);

View File

@ -74,7 +74,7 @@ class UpdateCompanyRequest extends Request
}
if (Ninja::isHosted()) {
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9.-]+[a-zA-Z0-9]$/', new ValidSubdomain()];
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9-]+[a-zA-Z0-9]$/', new ValidSubdomain()];
}
$rules['expense_mailbox'] = ['sometimes','email', 'nullable', new ValidExpenseMailbox(), Rule::unique('companies')->ignore($this->company->id)];

View File

@ -105,15 +105,12 @@ class InvoicePay extends Component
#[On('terms-accepted')]
public function termsAccepted()
{
nlog("Terms accepted");
// $this->invite = \App\Models\InvoiceInvitation::withTrashed()->find($this->invitation_id)->withoutRelations();
$this->terms_accepted = true;
}
#[On('signature-captured')]
public function signatureCaptured($base64)
{
nlog("signature captured");
$this->signature_accepted = true;
$invite = \App\Models\InvoiceInvitation::withTrashed()->find($this->invitation_id);
@ -141,7 +138,6 @@ class InvoicePay extends Component
$this->setContext('amount', $amount);
$this->setContext('pre_payment', false);
$this->setContext('is_recurring', false);
$this->setContext('invitation_id', $this->invitation_id);
$this->payment_method_accepted = true;
@ -178,9 +174,7 @@ class InvoicePay extends Component
empty($contact->client->{$_field})
|| is_null($contact->client->{$_field}) //@phpstan-ignore-line
) {
return $this->required_fields = true;
}
}
@ -231,17 +225,20 @@ class InvoicePay extends Component
public function mount()
{
$this->resetContext();
MultiDB::setDb($this->db);
// @phpstan-ignore-next-line
$invite = \App\Models\InvoiceInvitation::with('contact.client', 'company')->withTrashed()->find($this->invitation_id);
$client = $invite->contact->client;
$settings = $client->getMergedSettings();
$this->setContext('contact', $invite->contact); // $this->context['contact'] = $invite->contact;
$this->setContext('settings', $settings); // $this->context['settings'] = $settings;
$this->setContext('db', $this->db); // $this->context['db'] = $this->db;
$this->setContext('invitation_id', $this->invitation_id);
if(is_array($this->invoices))
$this->invoices = Invoice::find($this->transformKeys($this->invoices));
@ -293,8 +290,8 @@ class InvoicePay extends Component
public function exception($e, $stopPropagation)
{
app('sentry')->captureException($e);
nlog($e->getMessage());
$stopPropagation();
}

View File

@ -78,9 +78,7 @@ class PaymentMethod extends Component
public function exception($e, $stopPropagation)
{
nlog($e->getMessage());
app('sentry')->captureException($e);
$stopPropagation();
}
}

View File

@ -87,6 +87,8 @@ class ProcessPayment extends Component
public function exception($e, $stopPropagation)
{
app('sentry')->captureException($e);
$errors = session()->get('errors', new \Illuminate\Support\ViewErrorBag());
$bag = new \Illuminate\Support\MessageBag();

View File

@ -61,12 +61,12 @@ class RequiredFields extends Component
$this->fields = $this->getContext()['fields'];
$contact = auth()->guard('contact')->user();
$this->company_gateway = CompanyGateway::withTrashed()
->with('company')
->find($this->getContext()['company_gateway_id']);
$contact = auth()->guard('contact')->user();
$this->client_name = $contact->client->name;
$this->contact_first_name = $contact->first_name;
$this->contact_last_name = $contact->last_name;
@ -138,9 +138,8 @@ class RequiredFields extends Component
public function exception($e, $stopPropagation)
{
app('sentry')->captureException($e);
nlog($e->getMessage());
$stopPropagation();
}

View File

@ -578,7 +578,7 @@ class Company extends BaseModel
public function activities(): HasMany
{
return $this->hasMany(Activity::class)->where('account_id', $this->account_id)->orderBy('id', 'DESC')->take(50);
return $this->hasMany(Activity::class)->orderBy('id', 'DESC')->take(50);
}
/**

View File

@ -467,7 +467,7 @@ class Invoice extends BaseModel
public function isPayable(): bool
{
if($this->is_deleted || $this->status_id == self::STATUS_PAID) {
if($this->is_deleted || $this->status_id == self::STATUS_PAID || $this->balance < 0) {
return false;
} elseif ($this->status_id == self::STATUS_DRAFT && $this->is_deleted == false) {
return true;

View File

@ -281,4 +281,4 @@ class Ubl2Pdf extends AbstractService
// return $c->code === $currency_code;
// })?->id ?? (int) $this->company->settings->currency_id;
// }
// }
}

View File

@ -17,8 +17,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.10.38'),
'app_tag' => env('APP_TAG', '5.10.38'),
'app_version' => env('APP_VERSION', '5.10.39'),
'app_tag' => env('APP_TAG', '5.10.39'),
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false),

View File

@ -78,11 +78,14 @@
<div class="bg-white shadow sm:rounded-lg mb-4">
<div class="px-4 py-5 sm:p-6">
<div class="sm:flex sm:items-start sm:justify-between">
<div>
<div class="flex justify-between items-center w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900">
{{ ctrans('texts.invoice_number_placeholder', ['invoice' => $invoice->number])}}
- {{ \App\Models\Invoice::stringStatus($invoice->status_id) }}
</h3>
@if($invoice->status_id == \App\Models\Invoice::STATUS_PAID && $invoice->payments()->exists())
<span class="ml-4"><a class="button-link text-primary" href="{{ route('client.payments.show', $invoice->payments->first()->hashed_id) }}">{{ ctrans('texts.view_payment') }}</a></span>
@endif
</div>
</div>
</div>