Merge pull request #7073 from turbo124/v5-develop

Slovak Language
This commit is contained in:
David Bomba 2022-01-02 13:29:10 +11:00 committed by GitHub
commit d1142f2ccb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 4688 additions and 25 deletions

View File

@ -22,7 +22,7 @@ class RecurringInvoiceFactory
$invoice->discount = 0;
$invoice->is_amount_discount = true;
$invoice->po_number = '';
$invoice->number = '';
// $invoice->number = '';
$invoice->footer = '';
$invoice->terms = '';
$invoice->public_notes = '';

View File

@ -46,7 +46,7 @@ class InvoiceTransformer extends BaseTransformer {
'amount' => 0,
'status_id' => $invoiceStatusMap[ $status =
strtolower( $this->getString( $invoice_data, 'Invoice Status' ) ) ] ?? Invoice::STATUS_SENT,
'viewed' => $status === 'viewed',
// 'viewed' => $status === 'viewed',
];
$line_items = [];

View File

@ -44,7 +44,7 @@ class InvoiceTransformer extends BaseTransformer {
'amount' => 0,
'status_id' => $invoiceStatusMap[ $status =
strtolower( $this->getString( $invoice_data, 'DocumentStatus' ) ) ] ?? Invoice::STATUS_SENT,
'viewed' => $status === 'viewed',
// 'viewed' => $status === 'viewed',
'line_items' => [
[
'amount' => $amount = $this->getFloat( $invoice_data, 'TotalAmount' ),

View File

@ -49,7 +49,7 @@ class InvoiceTransformer extends BaseTransformer {
'balance' => $this->getFloat( $invoice_data, 'Balance' ),
'status_id' => $invoiceStatusMap[ $status =
strtolower( $this->getString( $invoice_data, 'Invoice Status' ) ) ] ?? Invoice::STATUS_SENT,
'viewed' => $status === 'viewed',
// 'viewed' => $status === 'viewed',
];
$line_items = [];
@ -57,7 +57,7 @@ class InvoiceTransformer extends BaseTransformer {
$line_items[] = [
'product_key' => $this->getString( $record, 'Item Name' ),
'notes' => $this->getString( $record, 'Item Description' ),
'cost' => $this->getFloat( $record, 'Item Price' ),
'cost' => round($this->getFloat( $record, 'Item Price' ),2),
'quantity' => $this->getFloat( $record, 'Quantity' ),
'discount' => $this->getString( $record, 'Discount Amount' ),
'is_amount_discount' => true,

View File

@ -381,6 +381,21 @@ class CompanyImport implements ShouldQueue
private function importSettings()
{
$co = (object)$this->getObject("company", true);
$settings = $co->settings;
$settings->invoice_number_counter = 1;
$settings->recurring_invoice_number_counter = 1;
$settings->quote_number_counter = 1;
$settings->credit_number_counter = 1;
$settings->task_number_counter = 1;
$settings->expense_number_counter = 1;
$settings->recurring_expense_number_counter = 1;
$settings->recurring_quote_number_counter = 1;
$settings->vendor_number_counter = 1;
$settings->ticket_number_counter = 1;
$settings->payment_number_counter = 1;
$settings->project_number_counter = 1;
$this->company->settings = $co->settings;
// $this->company->settings = $this->backup_file->company->settings;
$this->company->save();
@ -794,7 +809,6 @@ class CompanyImport implements ShouldQueue
private function import_expenses()
{
$this->genericImport(Expense::class,
['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id','vendor_id','recurring_expense_id'],
[
@ -882,7 +896,7 @@ class CompanyImport implements ShouldQueue
['quotes' => 'quote_id'],
['subscriptions' => 'subscription_id'],
['recurring_invoices' => 'recurring_invoice_id'],
['recurring_expenses' => 'recurring_expense_id'],
// ['recurring_expenses' => 'recurring_expense_id'],
// ['invitations' => 'invitation_id'],
],
'activities');
@ -1285,15 +1299,16 @@ class CompanyImport implements ShouldQueue
}
/* Ensure if no number is set, we don't overwrite a record with an existing number */
private function genericImport($class, $unset, $transforms, $object_property, $match_key)
{
$class::unguard();
$x = 0;
foreach((object)$this->getObject($object_property) as $obj)
// foreach($this->backup_file->{$object_property} as $obj)
{
/* Remove unwanted keys*/
$obj_array = (array)$obj;
foreach($unset as $un){
@ -1322,7 +1337,6 @@ class CompanyImport implements ShouldQueue
$obj_array['webhook_configuration'] = (array)$obj_array['webhook_configuration'];
$obj_array['recurring_product_ids'] = '';
$obj_array['product_ids'] = '';
nlog($obj_array);
}
/* Expenses that don't have a number will not be inserted - so need to override here*/
@ -1332,6 +1346,7 @@ class CompanyImport implements ShouldQueue
$new_obj->fill($obj_array);
$new_obj->save(['timestamps' => false]);
$new_obj->number = $this->getNextExpenseNumber($new_obj);
}
elseif($class == 'App\Models\Invoice' && is_null($obj->{$match_key})){
$new_obj = new Invoice();
@ -1368,7 +1383,7 @@ class CompanyImport implements ShouldQueue
$new_obj->number = $this->getNextRecurringExpenseNumber($client = Client::find($obj_array['client_id']), $new_obj);
}
else{
$new_obj = $class::firstOrNew(
$new_obj = $class::withTrashed()->firstOrNew(
[$match_key => $obj->{$match_key}, 'company_id' => $this->company->id],
$obj_array,
);

View File

@ -15,6 +15,7 @@ namespace App\Mail\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
class UserAdded extends Mailable
{
@ -45,6 +46,8 @@ class UserAdded extends Mailable
*/
public function build()
{
App::setLocale($this->company->getLocale());
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject(ctrans('texts.created_user'))
->view('email.admin.user_added')

View File

@ -15,6 +15,7 @@ namespace App\Mail\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
class UserLoggedIn extends Mailable
{
@ -45,6 +46,8 @@ class UserLoggedIn extends Mailable
*/
public function build()
{
App::setLocale($this->company->getLocale());
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject(ctrans('texts.new_login_detected'))
->view('email.admin.notification')

View File

@ -14,6 +14,7 @@ namespace App\Models;
use App\Models\GatewayType;
use App\Utils\Number;
use Illuminate\Database\Eloquent\SoftDeletes;
use PDO;
use stdClass;
class CompanyGateway extends BaseModel
@ -125,7 +126,11 @@ class CompanyGateway extends BaseModel
{
$class = static::driver_class();
if(!$class)
return false;
return new $class($this, $client);
}
private function driver_class()
@ -136,7 +141,9 @@ class CompanyGateway extends BaseModel
if (class_exists($class))
return $class;
throw new \Exception("Payment Driver does not exist");
return false;
// throw new \Exception("Payment Driver does not exist");
}
/**

View File

@ -256,13 +256,13 @@ class BaseDriver extends AbstractPaymentDriver
$this->payment_hash->payment_id = $payment->id;
$this->payment_hash->save();
$this->attachInvoices($payment, $this->payment_hash);
if($this->payment_hash->credits_total() > 0)
$payment = $payment->service()->applyCredits($this->payment_hash)->save();
$payment->service()->updateInvoicePayment($this->payment_hash);
$this->attachInvoices($payment, $this->payment_hash);
event('eloquent.created: App\Models\Payment', $payment);
if ($this->client->getSetting('client_online_payment_notification') && in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]))

View File

@ -116,7 +116,7 @@ class WePayPaymentDriver extends BaseDriver
$data['gateway'] = $this->wepay;
$client = $data['client'];
$contact = $client->primary_contact()->first() ? $client->primary_contact()->first() : $lient->contacts->first();
$contact = $client->primary_contact()->first() ? $client->primary_contact()->first() : $client->contacts->first();
$data['contact'] = $contact;
return $this->payment_method->authorizeView($data);

View File

@ -140,6 +140,10 @@ class PaymentMethod
foreach ($this->gateways as $gateway) {
//if gateway doesn't exist or is not implemented - continue here //todo
if(!$gateway->driver($this->client))
continue;
foreach ($gateway->driver($this->client)->gatewayTypes() as $type) {
if (isset($gateway->fees_and_limits) && is_object($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {

View File

@ -24,7 +24,7 @@ class AddGatewayFee extends AbstractService
{
private $company_gateway;
private $invoice;
public $invoice;
private $amount;
@ -61,7 +61,7 @@ class AddGatewayFee extends AbstractService
private function cleanPendingGatewayFees()
{
$invoice_items = $this->invoice->line_items;
$invoice_items = (array)$this->invoice->line_items;
$invoice_items = collect($invoice_items)->filter(function ($item) {
return $item->type_id != '3';
@ -92,7 +92,7 @@ class AddGatewayFee extends AbstractService
$invoice_item->tax_rate3 = $fees_and_limits->fee_tax_rate3;
}
$invoice_items = $this->invoice->line_items;
$invoice_items = (array)$this->invoice->line_items;
$invoice_items[] = $invoice_item;
$this->invoice->line_items = $invoice_items;
@ -122,7 +122,7 @@ class AddGatewayFee extends AbstractService
$invoice_item->tax_rate3 = $fees_and_limits->fee_tax_rate3;
}
$invoice_items = $this->invoice->line_items;
$invoice_items = (array)$this->invoice->line_items;
$invoice_items[] = $invoice_item;
$this->invoice->line_items = $invoice_items;

View File

@ -300,10 +300,10 @@ class InvoiceService
return $this;
if($this->invoice->balance == 0){
$this->setStatus(Invoice::STATUS_PAID);
$this->invoice->status_id = Invoice::STATUS_PAID;
}
elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
$this->setStatus(Invoice::STATUS_PARTIAL);
$this->invoice->status_id = Invoice::STATUS_PARTIAL;
}
return $this;
@ -320,8 +320,6 @@ class InvoiceService
return $item;
})->toArray();
//$this->invoice = $this->invoice->calc()->getInvoice();
$this->deletePdf();
return $this;
@ -333,12 +331,19 @@ class InvoiceService
$this->invoice->invitations->each(function ($invitation){
try{
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation) . $this->invoice->numberFormatter().'.pdf');
if(Ninja::isHosted()) {
Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation) . $this->invoice->numberFormatter().'.pdf');
}
}catch(\Exception $e){
nlog($e->getMessage());
}
});
return $this;

View File

@ -222,6 +222,14 @@ class HtmlEngine
$data['$quote.balance_due'] = &$data['$balance_due'];
$data['$invoice.balance_due'] = &$data['$balance_due'];
if ($this->entity_string == 'credit') {
$data['$balance_due'] = ['value' => Number::formatMoney($this->entity->balance, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.credit_balance')];
$data['$balance_due_raw'] = ['value' => $this->entity->balance, 'label' => ctrans('texts.credit_balance')];
$data['$amount_raw'] = ['value' => $this->entity->amount, 'label' => ctrans('texts.amount')];
}
// $data['$balance_due'] = $data['$balance_due'];
$data['$outstanding'] = &$data['$balance_due'];
$data['$partial_due'] = ['value' => Number::formatMoney($this->entity->partial, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.partial_due')];
@ -403,7 +411,7 @@ class HtmlEngine
$data['$product.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$product.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$product.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
$data['$product.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
$data['$product.description'] = ['value' => '', 'label' => ctrans('texts.description')];
$data['$product.unit_cost'] = ['value' => '', 'label' => ctrans('texts.unit_cost')];
$data['$product.product1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'product1')];
@ -423,7 +431,7 @@ class HtmlEngine
$data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
$data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
$data['$task.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
$data['$task.gross_line_total'] = ['value' => '', 'label' => ctrans('texts.gross_line_total')];
$data['$task.service'] = ['value' => '', 'label' => ctrans('texts.service')];
$data['$task.task1'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'task1')];
$data['$task.task2'] = ['value' => '', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'task2')];

View File

@ -0,0 +1,32 @@
<?php
use App\Models\Language;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddSlovakLanguage extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$slovak = ['id' => 34, 'name' => 'Slovak', 'locale' => 'sk'];
Language::unguard();
Language::create($slovak);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -4352,6 +4352,9 @@ $LANG = array(
'payment_type_Bancontact' => 'Bancontact',
'payment_type_BECS' => 'BECS',
'payment_type_ACSS' => 'ACSS',
'gross_line_total' => 'Gross line total',
'lang_Slovak' => 'Slovak',
);
return $LANG;

View File

@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];

View File

@ -0,0 +1,13 @@
<?php
$lang = [
'client_dashboard' => 'Message to be displayed on clients dashboard',
'client_currency' => 'The client currency.',
'client_language' => 'The client language.',
'client_payment_terms' => 'The client payment terms.',
'client_paid_invoice' => 'Message to be displayed on a clients paid invoice screen',
'client_unpaid_invoice' => 'Message to be displayed on a clients unpaid invoice screen',
'client_unapproved_quote' => 'Message to be displayed on a clients unapproved quote screen',
];
return $lang;

View File

@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '« Previous',
'next' => 'Next »',
];

View File

@ -0,0 +1,23 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
'throttled' => "You have requested password reset recently, please check your email.",
];

7
resources/lang/sk/t.php Normal file
View File

@ -0,0 +1,7 @@
<?php
$lang = [
'client_settings' => 'Client Settings',
];
return $lang;

4356
resources/lang/sk/texts.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,146 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'numeric' => 'The :attribute must be greater than :value.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute must have more than :value items.',
],
'gte' => [
'numeric' => 'The :attribute must be greater than or equal :value.',
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
'string' => 'The :attribute must be greater than or equal :value characters.',
'array' => 'The :attribute must have :value items or more.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'numeric' => 'The :attribute must be less than :value.',
'file' => 'The :attribute must be less than :value kilobytes.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute must have less than :value items.',
],
'lte' => [
'numeric' => 'The :attribute must be less than or equal :value.',
'file' => 'The :attribute must be less than or equal :value kilobytes.',
'string' => 'The :attribute must be less than or equal :value characters.',
'array' => 'The :attribute must not have more than :value items.',
],
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];