mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 11:34:29 -04:00
commit
f994c1d5a0
@ -1 +1 @@
|
|||||||
5.3.39
|
5.3.40
|
@ -13,7 +13,7 @@ class PaymentFailed extends Exception
|
|||||||
|
|
||||||
public function render($request)
|
public function render($request)
|
||||||
{
|
{
|
||||||
if (auth()->user()) {
|
if (auth()->user() || ($request->has('cko-session-id') && $request->query('cko-session-id') )) {
|
||||||
return render('gateways.unsuccessful', [
|
return render('gateways.unsuccessful', [
|
||||||
'message' => $this->getMessage(),
|
'message' => $this->getMessage(),
|
||||||
'code' => $this->getCode(),
|
'code' => $this->getCode(),
|
||||||
|
@ -20,11 +20,6 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
class DocumentFilters extends QueryFilters
|
class DocumentFilters extends QueryFilters
|
||||||
{
|
{
|
||||||
|
|
||||||
// public function client_id(int $client_id) :Builder
|
|
||||||
// {
|
|
||||||
// return $this->builder->where('client_id', $client_id);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter based on search text.
|
* Filter based on search text.
|
||||||
*
|
*
|
||||||
@ -41,6 +36,14 @@ class DocumentFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If client ID passed to this entity, simply return */
|
||||||
|
public function client_id(string $client_id = '') :Builder
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->builder;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts the list based on $sort.
|
* Sorts the list based on $sort.
|
||||||
*
|
*
|
||||||
@ -64,6 +67,7 @@ class DocumentFilters extends QueryFilters
|
|||||||
*/
|
*/
|
||||||
public function baseQuery(int $company_id, User $user) : Builder
|
public function baseQuery(int $company_id, User $user) : Builder
|
||||||
{
|
{
|
||||||
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
118
app/Filters/PaymentTermFilters.php
Normal file
118
app/Filters/PaymentTermFilters.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use App\Models\Design;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PaymentTermFilters.
|
||||||
|
*/
|
||||||
|
class PaymentTermFilters extends QueryFilters
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Filter based on search text.
|
||||||
|
*
|
||||||
|
* @param string query filter
|
||||||
|
* @return Builder
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public function filter(string $filter = '') : Builder
|
||||||
|
{
|
||||||
|
if (strlen($filter) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->builder->where(function ($query) use ($filter) {
|
||||||
|
$query->where('payment_terms.name', 'like', '%'.$filter.'%');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the list based on the status
|
||||||
|
* archived, active, deleted.
|
||||||
|
*
|
||||||
|
* @param string filter
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
|
public function status(string $filter = '') : Builder
|
||||||
|
{
|
||||||
|
if (strlen($filter) == 0) {
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = 'payment_terms';
|
||||||
|
$filters = explode(',', $filter);
|
||||||
|
|
||||||
|
return $this->builder->where(function ($query) use ($filters, $table) {
|
||||||
|
$query->whereNull($table.'.id');
|
||||||
|
|
||||||
|
if (in_array(parent::STATUS_ACTIVE, $filters)) {
|
||||||
|
$query->orWhereNull($table.'.deleted_at');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
|
||||||
|
$query->orWhere(function ($query) use ($table) {
|
||||||
|
$query->whereNotNull($table.'.deleted_at');
|
||||||
|
|
||||||
|
if (! in_array($table, ['users'])) {
|
||||||
|
$query->where($table.'.is_deleted', '=', 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array(parent::STATUS_DELETED, $filters)) {
|
||||||
|
$query->orWhere($table.'.is_deleted', '=', 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts the list based on $sort.
|
||||||
|
*
|
||||||
|
* @param string sort formatted as column|asc
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
|
public function sort(string $sort) : Builder
|
||||||
|
{
|
||||||
|
$sort_col = explode('|', $sort);
|
||||||
|
|
||||||
|
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the base query.
|
||||||
|
*
|
||||||
|
* @param int company_id
|
||||||
|
* @param User $user
|
||||||
|
* @return Builder
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public function baseQuery(int $company_id, User $user) : Builder
|
||||||
|
{
|
||||||
|
return $this->builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters the query by the users company ID.
|
||||||
|
*
|
||||||
|
* @return Illuminate\Database\Query\Builder
|
||||||
|
*/
|
||||||
|
public function entityFilter()
|
||||||
|
{
|
||||||
|
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
|
||||||
|
return $this->builder->whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null);
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ use App\Transformers\PaymentTermTransformer;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
use App\Filters\PaymentTermFilters;
|
||||||
|
|
||||||
class PaymentTermController extends BaseController
|
class PaymentTermController extends BaseController
|
||||||
{
|
{
|
||||||
@ -73,9 +74,9 @@ class PaymentTermController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index(PaymentTermFilters $filters)
|
||||||
{
|
{
|
||||||
$payment_terms = PaymentTerm::whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null);
|
$payment_terms = PaymentTerm::filter($filters);
|
||||||
|
|
||||||
return $this->listResponse($payment_terms);
|
return $this->listResponse($payment_terms);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class CheckClientExistence
|
|||||||
return redirect()->route('client.login');
|
return redirect()->route('client.login');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($multiple_contacts) == 1) {
|
if (count($multiple_contacts) == 1 && !Auth::guard('contact')->check()) {
|
||||||
Auth::guard('contact')->loginUsingId($multiple_contacts[0]->id, true);
|
Auth::guard('contact')->loginUsingId($multiple_contacts[0]->id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
{
|
{
|
||||||
//unset / transforms / object_property / match_key
|
//unset / transforms / object_property / match_key
|
||||||
$this->genericImport(RecurringExpense::class,
|
$this->genericImport(RecurringExpense::class,
|
||||||
['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id', 'vendor_id'],
|
['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id', 'vendor_id','recurring_expense_id'],
|
||||||
[
|
[
|
||||||
['users' => 'user_id'],
|
['users' => 'user_id'],
|
||||||
['users' => 'assigned_user_id'],
|
['users' => 'assigned_user_id'],
|
||||||
@ -455,7 +455,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
['invoices' => 'invoice_id'],
|
['invoices' => 'invoice_id'],
|
||||||
['expense_categories' => 'category_id'],
|
['expense_categories' => 'category_id'],
|
||||||
],
|
],
|
||||||
'expenses',
|
'recurring_expenses',
|
||||||
'number');
|
'number');
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -796,7 +796,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
|
|
||||||
$this->genericImport(Expense::class,
|
$this->genericImport(Expense::class,
|
||||||
['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id','vendor_id'],
|
['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id','vendor_id','recurring_expense_id'],
|
||||||
[
|
[
|
||||||
['users' => 'user_id'],
|
['users' => 'user_id'],
|
||||||
['users' => 'assigned_user_id'],
|
['users' => 'assigned_user_id'],
|
||||||
@ -804,7 +804,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
['projects' => 'project_id'],
|
['projects' => 'project_id'],
|
||||||
['vendors' => 'vendor_id'],
|
['vendors' => 'vendor_id'],
|
||||||
['invoices' => 'invoice_id'],
|
['invoices' => 'invoice_id'],
|
||||||
['recurring_expenses' => 'recurring_expense_id'],
|
// ['recurring_expenses' => 'recurring_expense_id'],
|
||||||
['expense_categories' => 'category_id'],
|
['expense_categories' => 'category_id'],
|
||||||
],
|
],
|
||||||
'expenses',
|
'expenses',
|
||||||
@ -866,6 +866,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
'company_id',
|
'company_id',
|
||||||
'backup',
|
'backup',
|
||||||
'invitation_id',
|
'invitation_id',
|
||||||
|
'payment_id',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['users' => 'user_id'],
|
['users' => 'user_id'],
|
||||||
@ -873,7 +874,7 @@ class CompanyImport implements ShouldQueue
|
|||||||
['client_contacts' => 'client_contact_id'],
|
['client_contacts' => 'client_contact_id'],
|
||||||
['projects' => 'project_id'],
|
['projects' => 'project_id'],
|
||||||
['vendors' => 'vendor_id'],
|
['vendors' => 'vendor_id'],
|
||||||
['payments' => 'payment_id'],
|
// ['payments' => 'payment_id'],
|
||||||
['invoices' => 'invoice_id'],
|
['invoices' => 'invoice_id'],
|
||||||
['credits' => 'credit_id'],
|
['credits' => 'credit_id'],
|
||||||
['tasks' => 'task_id'],
|
['tasks' => 'task_id'],
|
||||||
@ -1359,6 +1360,13 @@ class CompanyImport implements ShouldQueue
|
|||||||
$new_obj->fill($obj_array);
|
$new_obj->fill($obj_array);
|
||||||
$new_obj->save(['timestamps' => false]);
|
$new_obj->save(['timestamps' => false]);
|
||||||
}
|
}
|
||||||
|
elseif($class == 'App\Models\RecurringExpense' && is_null($obj->{$match_key})){
|
||||||
|
$new_obj = new RecurringExpense();
|
||||||
|
$new_obj->company_id = $this->company->id;
|
||||||
|
$new_obj->fill($obj_array);
|
||||||
|
$new_obj->save(['timestamps' => false]);
|
||||||
|
$new_obj->number = $this->getNextRecurringExpenseNumber($client = Client::find($obj_array['client_id']), $new_obj);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
$new_obj = $class::firstOrNew(
|
$new_obj = $class::firstOrNew(
|
||||||
[$match_key => $obj->{$match_key}, 'company_id' => $this->company->id],
|
[$match_key => $obj->{$match_key}, 'company_id' => $this->company->id],
|
||||||
@ -1419,9 +1427,8 @@ class CompanyImport implements ShouldQueue
|
|||||||
if (! array_key_exists($resource, $this->ids)) {
|
if (! array_key_exists($resource, $this->ids)) {
|
||||||
nlog($resource);
|
nlog($resource);
|
||||||
|
|
||||||
nlog($this->ids);
|
|
||||||
|
|
||||||
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
||||||
|
nlog($this->ids);
|
||||||
throw new \Exception("Resource {$resource} not available.");
|
throw new \Exception("Resource {$resource} not available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1436,6 +1443,8 @@ class CompanyImport implements ShouldQueue
|
|||||||
|
|
||||||
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
$this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
|
||||||
|
|
||||||
|
nlog($this->ids[$resource]);
|
||||||
|
|
||||||
throw new \Exception("Missing {$resource} key: {$old}");
|
throw new \Exception("Missing {$resource} key: {$old}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,14 +82,22 @@ class CreateUbl implements ShouldQueue
|
|||||||
$ubl_invoice->setInvoiceLines($invoice_lines);
|
$ubl_invoice->setInvoiceLines($invoice_lines);
|
||||||
|
|
||||||
$taxtotal = new TaxTotal();
|
$taxtotal = new TaxTotal();
|
||||||
$taxAmount1 = $taxAmount2 = 0;
|
$taxAmount1 = $taxAmount2 = $taxAmount3 = 0;
|
||||||
|
|
||||||
$taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1);
|
|
||||||
if ($invoice->tax_name2 || floatval($invoice->tax_rate2)) {
|
if (strlen($invoice->tax_name1) > 1){
|
||||||
|
$taxAmount1 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate1, $invoice->tax_name1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($invoice->tax_name2) > 1) {
|
||||||
$taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
|
$taxAmount2 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate2, $invoice->tax_name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2);
|
if (strlen($invoice->tax_name3) > 1) {
|
||||||
|
$taxAmount3 = $this->createTaxRate($taxtotal, $taxable, $invoice->tax_rate3, $invoice->tax_name3);
|
||||||
|
}
|
||||||
|
|
||||||
|
$taxtotal->setTaxAmount($taxAmount1 + $taxAmount2 + $taxAmount3);
|
||||||
$ubl_invoice->setTaxTotal($taxtotal);
|
$ubl_invoice->setTaxTotal($taxtotal);
|
||||||
|
|
||||||
$ubl_invoice->setLegalMonetaryTotal((new LegalMonetaryTotal())
|
$ubl_invoice->setLegalMonetaryTotal((new LegalMonetaryTotal())
|
||||||
@ -144,13 +152,15 @@ class CreateUbl implements ShouldQueue
|
|||||||
$taxtotal = new TaxTotal();
|
$taxtotal = new TaxTotal();
|
||||||
$itemTaxAmount1 = $itemTaxAmount2 = $itemTaxAmount3 = 0;
|
$itemTaxAmount1 = $itemTaxAmount2 = $itemTaxAmount3 = 0;
|
||||||
|
|
||||||
$itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1);
|
if(strlen($item->tax_name1) > 1){
|
||||||
|
$itemTaxAmount1 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate1, $item->tax_name1);
|
||||||
|
}
|
||||||
|
|
||||||
if ($item->tax_name2 || floatval($item->tax_rate2)) {
|
if(strlen($item->tax_name2) > 1){
|
||||||
$itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
|
$itemTaxAmount2 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate2, $item->tax_name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item->tax_name3 || floatval($item->tax_rate3)) {
|
if(strlen($item->tax_name3) > 1){
|
||||||
$itemTaxAmount3 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate3, $item->tax_name3);
|
$itemTaxAmount3 = $this->createTaxRate($taxtotal, $taxable, $item->tax_rate3, $item->tax_name3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class TemplateEmail extends Mailable
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_DOCUMENTS)){
|
if($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)){
|
||||||
|
|
||||||
$ubl_string = CreateUbl::dispatchNow($this->invitation->invoice);
|
$ubl_string = CreateUbl::dispatchNow($this->invitation->invoice);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Filterable;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
class PaymentTerm extends BaseModel
|
class PaymentTerm extends BaseModel
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
use Filterable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
@ -84,8 +84,15 @@ trait Utilities
|
|||||||
|
|
||||||
public function processUnsuccessfulPayment(Payment $_payment, $throw_exception = true)
|
public function processUnsuccessfulPayment(Payment $_payment, $throw_exception = true)
|
||||||
{
|
{
|
||||||
$this->getParent()->sendFailureMail($_payment->response_summary);
|
|
||||||
// $this->getParent()->clientPaymentFailureMailer($_payment->status);
|
$error_message = '';
|
||||||
|
|
||||||
|
if(property_exists($_payment, 'server_response'))
|
||||||
|
$error_message = $_payment->response_summary;
|
||||||
|
elseif(property_exists($_payment, 'status'))
|
||||||
|
$error_message = $_payment->status;
|
||||||
|
|
||||||
|
$this->getParent()->sendFailureMail($error_message);
|
||||||
|
|
||||||
$message = [
|
$message = [
|
||||||
'server_response' => $_payment,
|
'server_response' => $_payment,
|
||||||
@ -102,7 +109,8 @@ trait Utilities
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($throw_exception) {
|
if ($throw_exception) {
|
||||||
throw new PaymentFailed($_payment->status . " " . optional($_payment)->response_summary, $_payment->http_code);
|
|
||||||
|
throw new PaymentFailed($_payment->status . " " . $error_message, $_payment->http_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ trait Utilities
|
|||||||
public function convertFromStripeAmount($amount, $precision, $currency)
|
public function convertFromStripeAmount($amount, $precision, $currency)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($currency->code == "JPY")
|
if(in_array($amount, ["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"]))
|
||||||
return $amount;
|
return $amount;
|
||||||
|
|
||||||
return $amount / pow(10, $precision);
|
return $amount / pow(10, $precision);
|
||||||
@ -28,7 +28,7 @@ trait Utilities
|
|||||||
public function convertToStripeAmount($amount, $precision, $currency)
|
public function convertToStripeAmount($amount, $precision, $currency)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($currency->code == "JPY")
|
if(in_array($amount, ["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"]))
|
||||||
return $amount;
|
return $amount;
|
||||||
|
|
||||||
return round(($amount * pow(10, $precision)),0);
|
return round(($amount * pow(10, $precision)),0);
|
||||||
|
@ -33,19 +33,6 @@ class NinjaTranslationServiceProvider extends TranslationServiceProvider
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $this->app->bind('translator', function($app) {
|
|
||||||
|
|
||||||
// $loader = $app['translation.loader'];
|
|
||||||
// $locale = $app['config']['app.locale'];
|
|
||||||
|
|
||||||
// $trans = new NinjaTranslator($loader, $locale);
|
|
||||||
|
|
||||||
// $trans->setFallback($app['config']['app.fallback_locale']);
|
|
||||||
|
|
||||||
// return $trans;
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
$this->app->singleton('translator', function ($app) {
|
$this->app->singleton('translator', function ($app) {
|
||||||
|
|
||||||
$loader = $app['translation.loader'];
|
$loader = $app['translation.loader'];
|
||||||
|
@ -299,7 +299,10 @@ class InvoiceService
|
|||||||
if($this->invoice->status_id == Invoice::STATUS_DRAFT)
|
if($this->invoice->status_id == Invoice::STATUS_DRAFT)
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
if ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
|
if($this->invoice->balance == 0){
|
||||||
|
$this->setStatus(Invoice::STATUS_PAID);
|
||||||
|
}
|
||||||
|
elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) {
|
||||||
$this->setStatus(Invoice::STATUS_PARTIAL);
|
$this->setStatus(Invoice::STATUS_PARTIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ use Illuminate\Support\Facades\App;
|
|||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Illuminate\View\Factory;
|
use Illuminate\View\Factory;
|
||||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +64,7 @@ trait MakesInvoiceHtml
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new FatalThrowableError($e);
|
throw new \Exception($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
@ -14,8 +14,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' => '5.3.39',
|
'app_version' => '5.3.40',
|
||||||
'app_tag' => '5.3.39',
|
'app_tag' => '5.3.40',
|
||||||
'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', ''),
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Language;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddSerbianLanguageTranslations extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$serbian = ['id' => 33, 'name' => 'Serbian', 'locale' => 'sr'];
|
||||||
|
|
||||||
|
Language::unguard();
|
||||||
|
Language::create($serbian);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@
|
|||||||
<env name="SESSION_DRIVER" value="array"/>
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
<env name="MAIL_MAILER" value="array"/>
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
<env name="DB_CONNECTION" value="mysql"/>
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
<env name="DB_DATABASE" value=":memory:"/>
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
</php>
|
</php>
|
||||||
<logging/>
|
<logging/>
|
||||||
|
19
resources/lang/sr/auth.php
Normal file
19
resources/lang/sr/auth.php
Normal 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.',
|
||||||
|
|
||||||
|
];
|
19
resources/lang/sr/pagination.php
Normal file
19
resources/lang/sr/pagination.php
Normal 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 »',
|
||||||
|
|
||||||
|
];
|
23
resources/lang/sr/passwords.php
Normal file
23
resources/lang/sr/passwords.php
Normal 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.",
|
||||||
|
|
||||||
|
];
|
4359
resources/lang/sr/texts.php
Normal file
4359
resources/lang/sr/texts.php
Normal file
File diff suppressed because it is too large
Load Diff
146
resources/lang/sr/validation.php
Normal file
146
resources/lang/sr/validation.php
Normal 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' => [],
|
||||||
|
|
||||||
|
];
|
@ -60,7 +60,6 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
document.querySelector('div[data-ref="required-fields-container"]').classList.add('hidden');
|
document.querySelector('div[data-ref="required-fields-container"]').classList.add('hidden');
|
||||||
|
|
||||||
document.querySelector('div[data-ref="gateway-container"]').classList.remove('opacity-25');
|
document.querySelector('div[data-ref="gateway-container"]').classList.remove('opacity-25');
|
||||||
document.querySelector('div[data-ref="gateway-container"]').classList.remove('pointer-events-none');
|
document.querySelector('div[data-ref="gateway-container"]').classList.remove('pointer-events-none');
|
||||||
});
|
});
|
||||||
|
@ -182,6 +182,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
Route::put('vendors/{vendor}/upload', 'VendorController@upload');
|
Route::put('vendors/{vendor}/upload', 'VendorController@upload');
|
||||||
|
|
||||||
Route::get('users', 'UserController@index');
|
Route::get('users', 'UserController@index');
|
||||||
|
Route::get('users/{user}', 'UserController@show')->middleware('password_protected');
|
||||||
Route::put('users/{user}', 'UserController@update')->middleware('password_protected');
|
Route::put('users/{user}', 'UserController@update')->middleware('password_protected');
|
||||||
Route::post('users', 'UserController@store')->middleware('password_protected');
|
Route::post('users', 'UserController@store')->middleware('password_protected');
|
||||||
//Route::post('users/{user}/attach_to_company', 'UserController@attach')->middleware('password_protected');
|
//Route::post('users/{user}/attach_to_company', 'UserController@attach')->middleware('password_protected');
|
||||||
|
@ -57,6 +57,37 @@ class PaymentTermsApiTest extends TestCase
|
|||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testPaymentTermsGetStatusActive()
|
||||||
|
{
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->get('/api/v1/payment_terms?status=active');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPaymentTermsGetStatusArchived()
|
||||||
|
{
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->get('/api/v1/payment_terms?status=archived');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPaymentTermsGetStatusDeleted()
|
||||||
|
{
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->get('/api/v1/payment_terms?status=deleted');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
public function testPostPaymentTerm()
|
public function testPostPaymentTerm()
|
||||||
{
|
{
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
|
58
tests/Unit/ZeroDecimalTest.php
Normal file
58
tests/Unit/ZeroDecimalTest.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use App\Jobs\Util\UploadFile;
|
||||||
|
use App\Models\Document;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Illuminate\Http\UploadedFile;
|
||||||
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Tests\MockAccountData;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ZeroDecimalTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public array $currencies = ["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"];
|
||||||
|
|
||||||
|
public function setUp() :void
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCurrencyHit()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->assertTrue(in_array("KRW", $this->currencies));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testCurrencyMiss()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->assertFalse(in_array("USD", $this->currencies));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCurrencyNotexist()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->assertFalse(in_array("USDddd", $this->currencies));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user