mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 20:18:33 -05:00 
			
		
		
		
	V5.9.9
This commit is contained in:
		
							parent
							
								
									26d376d070
								
							
						
					
					
						commit
						64e724f215
					
				@ -1 +1 @@
 | 
			
		||||
5.9.8
 | 
			
		||||
5.9.9
 | 
			
		||||
@ -51,9 +51,9 @@ class StoreBankTransactionRuleRequest extends Request
 | 
			
		||||
            'applies_to' => 'bail|sometimes|string',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $rules['category_id'] = 'bail|sometimes|exists:expense_categories,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['vendor_id'] = 'bail|sometimes|exists:vendors,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['client_id'] = 'bail|sometimes|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['category_id'] = 'bail|sometimes|nullable|exists:expense_categories,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['vendor_id'] = 'bail|sometimes|nullable|exists:vendors,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['client_id'] = 'bail|sometimes|nullable|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0';
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -312,8 +312,11 @@ class MatchBankTransactions implements ShouldQueue
 | 
			
		||||
                if ($_amount) {
 | 
			
		||||
                    $this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount];
 | 
			
		||||
 | 
			
		||||
                    $this->invoice->next_send_date = null;
 | 
			
		||||
 | 
			
		||||
                    $this->invoice
 | 
			
		||||
                        ->service()
 | 
			
		||||
                        ->applyNumber()
 | 
			
		||||
                        ->setExchangeRate()
 | 
			
		||||
                        ->updateBalance($_amount * -1)
 | 
			
		||||
                        ->updatePaidToDate($_amount)
 | 
			
		||||
@ -364,14 +367,6 @@ class MatchBankTransactions implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        event('eloquent.created: App\Models\Payment', $payment);
 | 
			
		||||
 | 
			
		||||
        $this->invoice->next_send_date = null;
 | 
			
		||||
 | 
			
		||||
        $this->invoice
 | 
			
		||||
            ->service()
 | 
			
		||||
            ->applyNumber()
 | 
			
		||||
            ->deletePdf()
 | 
			
		||||
            ->save();
 | 
			
		||||
 | 
			
		||||
        $payment->ledger()
 | 
			
		||||
            ->updatePaymentBalance($amount * -1);
 | 
			
		||||
 | 
			
		||||
@ -390,7 +385,13 @@ class MatchBankTransactions implements ShouldQueue
 | 
			
		||||
        event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
			
		||||
        event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
			
		||||
 | 
			
		||||
        $this->bt->invoice_ids = $invoices->get()->pluck('hashed_id')->implode(',');
 | 
			
		||||
        $hashed_keys = [];
 | 
			
		||||
 | 
			
		||||
        foreach($this->attachable_invoices as $attachable_invoice){
 | 
			
		||||
            $hashed_keys[] = $this->encodePrimaryKey($attachable_invoice['id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $this->bt->invoice_ids = implode(",", $hashed_keys);
 | 
			
		||||
        $this->bt->status_id = BankTransaction::STATUS_CONVERTED;
 | 
			
		||||
        $this->bt->payment_id = $payment->id;
 | 
			
		||||
        $this->bt->save();
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ use App\Models\Language;
 | 
			
		||||
use App\Models\Timezone;
 | 
			
		||||
use App\Models\DateFormat;
 | 
			
		||||
use App\Models\PaymentTerm;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use App\Models\DatetimeFormat;
 | 
			
		||||
use Illuminate\Support\ServiceProvider;
 | 
			
		||||
use App\DataMapper\EmailTemplateDefaults;
 | 
			
		||||
@ -49,9 +50,9 @@ class StaticServiceProvider extends ServiceProvider
 | 
			
		||||
            return Country::query()->orderBy('name')->get();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        /** @return \Illuminate\Support\Collection<PaymentTerm> */
 | 
			
		||||
        /** @return \Illuminate\Support\Collection<PaymentType> */
 | 
			
		||||
        app()->singleton('payment_types', function ($app) {
 | 
			
		||||
            return PaymentTerm::query()->orderBy('num_days')->get();
 | 
			
		||||
            return PaymentType::query()->orderBy('id')->get();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        /** @return \Illuminate\Support\Collection<Industry> */
 | 
			
		||||
 | 
			
		||||
@ -11,8 +11,6 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Utils;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Cache;
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -65,91 +63,64 @@ class Statics
 | 
			
		||||
     * @param  string|bool $locale The user locale
 | 
			
		||||
     * @return array          Array of statics
 | 
			
		||||
     */
 | 
			
		||||
    public static function company($locale = false): array
 | 
			
		||||
    public static function company($locale = 'en'): array
 | 
			
		||||
    {
 | 
			
		||||
        $data = [];
 | 
			
		||||
        
 | 
			
		||||
        // foreach (config('ninja.cached_tables') as $name => $class) {
 | 
			
		||||
        //     if (! Cache::has($name)) {
 | 
			
		||||
        //         // check that the table exists in case the migration is pending
 | 
			
		||||
        //         if (! Schema::hasTable((new $class())->getTable())) {
 | 
			
		||||
        //             continue;
 | 
			
		||||
        //         }
 | 
			
		||||
        //         if ($name == 'payment_terms') {
 | 
			
		||||
        //             $orderBy = 'num_days';
 | 
			
		||||
        //         } elseif ($name == 'fonts') {
 | 
			
		||||
        //             $orderBy = 'sort_order';
 | 
			
		||||
        //         } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
 | 
			
		||||
        //             $orderBy = 'name';
 | 
			
		||||
        //         } else {
 | 
			
		||||
        //             $orderBy = 'id';
 | 
			
		||||
        //         }
 | 
			
		||||
        //         $tableData = $class::orderBy($orderBy)->get();
 | 
			
		||||
        //         if ($tableData->count()) {
 | 
			
		||||
        //             Cache::forever($name, $tableData);
 | 
			
		||||
        //         }
 | 
			
		||||
        //     }
 | 
			
		||||
        /** @var \Illuminate\Support\Collection<\App\Models\Industry> */
 | 
			
		||||
        $industries = app('industries');
 | 
			
		||||
    
 | 
			
		||||
        //     $data[$name] = app($name);
 | 
			
		||||
        // }
 | 
			
		||||
        $data['industries'] = $industries->each(function ($industry) {
 | 
			
		||||
            $industry->name = ctrans('texts.industry_'.$industry->name);
 | 
			
		||||
        })->sortBy(function ($industry) {
 | 
			
		||||
            return $industry->name;
 | 
			
		||||
        })->values();
 | 
			
		||||
 | 
			
		||||
        if ($locale) {
 | 
			
		||||
        /** @var \Illuminate\Support\Collection<\App\Models\Country> */
 | 
			
		||||
        $countries = app('countries');
 | 
			
		||||
 | 
			
		||||
            /** @var \Illuminate\Support\Collection<\App\Models\Industry> */
 | 
			
		||||
            $industries = app('industries');
 | 
			
		||||
 | 
			
		||||
            $data['industries'] = $industries->each(function ($industry) {
 | 
			
		||||
                $industry->name = ctrans('texts.industry_'.$industry->name);
 | 
			
		||||
            })->sortBy(function ($industry) {
 | 
			
		||||
                return $industry->name;
 | 
			
		||||
            })->values();
 | 
			
		||||
 | 
			
		||||
            /** @var \Illuminate\Support\Collection<\App\Models\Country> */
 | 
			
		||||
            $countries = app('countries');
 | 
			
		||||
 | 
			
		||||
            $data['countries'] = $countries->each(function ($country) {
 | 
			
		||||
                $country->name = ctrans('texts.country_'.$country->name);
 | 
			
		||||
            })->sortBy(function ($country) {
 | 
			
		||||
                return $country->name;
 | 
			
		||||
            })->values();
 | 
			
		||||
        $data['countries'] = $countries->each(function ($country) {
 | 
			
		||||
            $country->name = ctrans('texts.country_'.$country->name);
 | 
			
		||||
        })->sortBy(function ($country) {
 | 
			
		||||
            return $country->name;
 | 
			
		||||
        })->values();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            /** @var \Illuminate\Support\Collection<\App\Models\PaymentType> */
 | 
			
		||||
            $payment_types = app('payment_types');
 | 
			
		||||
        /** @var \Illuminate\Support\Collection<\App\Models\PaymentType> */
 | 
			
		||||
        $payment_types = app('payment_types');
 | 
			
		||||
    
 | 
			
		||||
            $data['payment_types'] = $payment_types->each(function ($pType) {
 | 
			
		||||
                $pType->name = ctrans('texts.payment_type_'.$pType->name);
 | 
			
		||||
            })->sortBy(function ($pType) {
 | 
			
		||||
                return $pType->name;
 | 
			
		||||
            })->values();
 | 
			
		||||
        $data['payment_types'] = $payment_types->each(function ($pType) {
 | 
			
		||||
            $pType->name = ctrans('texts.payment_type_'.$pType->name);
 | 
			
		||||
            $pType->id = (string) $pType->id;
 | 
			
		||||
        })->sortBy(function ($pType) {
 | 
			
		||||
            return $pType->name;
 | 
			
		||||
        })->values();
 | 
			
		||||
    
 | 
			
		||||
        /** @var \Illuminate\Support\Collection<\App\Models\Language> */
 | 
			
		||||
        $languages = app('languages');
 | 
			
		||||
 | 
			
		||||
        $data['languages'] = $languages->each(function ($lang) {
 | 
			
		||||
            $lang->name = ctrans('texts.lang_'.$lang->name);
 | 
			
		||||
        })->sortBy(function ($lang) {
 | 
			
		||||
            return $lang->name;
 | 
			
		||||
        })->values();
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
            /** @var \Illuminate\Support\Collection<\App\Models\Language> */
 | 
			
		||||
            $payment_types = app('languages');
 | 
			
		||||
        /** @var \Illuminate\Support\Collection<\App\Models\Currency> */
 | 
			
		||||
        $currencies = app('currencies');
 | 
			
		||||
 | 
			
		||||
            $data['languages'] = $payment_types->each(function ($lang) {
 | 
			
		||||
                $lang->name = ctrans('texts.lang_'.$lang->name);
 | 
			
		||||
            })->sortBy(function ($lang) {
 | 
			
		||||
                return $lang->name;
 | 
			
		||||
            })->values();
 | 
			
		||||
        $data['currencies'] = $currencies->each(function ($currency) {
 | 
			
		||||
            $currency->name = ctrans('texts.currency_'.Str::slug($currency->name, '_'));
 | 
			
		||||
        })->sortBy(function ($currency) {
 | 
			
		||||
            return $currency->name;
 | 
			
		||||
        })->values();
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            /** @var \Illuminate\Support\Collection<\App\Models\Currency> */
 | 
			
		||||
            $currencies = app('currencies');
 | 
			
		||||
 | 
			
		||||
            $data['currencies'] = $currencies->each(function ($currency) {
 | 
			
		||||
                $currency->name = ctrans('texts.currency_'.Str::slug($currency->name, '_'));
 | 
			
		||||
            })->sortBy(function ($currency) {
 | 
			
		||||
                return $currency->name;
 | 
			
		||||
            })->values();
 | 
			
		||||
 | 
			
		||||
            $data['sizes'] = app('sizes');
 | 
			
		||||
            $data['datetime_formats'] = app('datetime_formats');
 | 
			
		||||
            $data['gateways'] = app('gateways');
 | 
			
		||||
            $dat['timezones'] = app('timezones');
 | 
			
		||||
            
 | 
			
		||||
            $data['templates'] = app('templates');
 | 
			
		||||
        }
 | 
			
		||||
        $data['sizes'] = app('sizes');
 | 
			
		||||
        $data['datetime_formats'] = app('datetime_formats');
 | 
			
		||||
        $data['gateways'] = app('gateways');
 | 
			
		||||
        $data['timezones'] = app('timezones');
 | 
			
		||||
        $data['date_formats'] = app('date_formats');
 | 
			
		||||
        $data['templates'] = app('templates');
 | 
			
		||||
    
 | 
			
		||||
        $data['bulk_updates'] = [
 | 
			
		||||
            'client' => \App\Models\Client::$bulk_update_columns,
 | 
			
		||||
 | 
			
		||||
@ -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.9.8'),
 | 
			
		||||
    'app_tag' => env('APP_TAG', '5.9.8'),
 | 
			
		||||
    'app_version' => env('APP_VERSION', '5.9.9'),
 | 
			
		||||
    'app_tag' => env('APP_TAG', '5.9.9'),
 | 
			
		||||
    'minimum_client_version' => '5.0.16',
 | 
			
		||||
    'terms_version' => '1.0.1',
 | 
			
		||||
    'api_secret' => env('API_SECRET', false),
 | 
			
		||||
 | 
			
		||||
@ -45,11 +45,11 @@ Route::group(['middleware' => ['auth:vendor', 'vendor_locale', 'domain_db'], 'pr
 | 
			
		||||
    Route::post('documents/download_multiple', [App\Http\Controllers\VendorPortal\DocumentController::class, 'downloadMultiple'])->name('documents.download_multiple');
 | 
			
		||||
    Route::get('documents/{document}/download', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download');
 | 
			
		||||
    Route::get('documents/{document}/download_pdf', [App\Http\Controllers\VendorPortal\DocumentController::class, 'download'])->name('documents.download_pdf');
 | 
			
		||||
    Route::get('purchase_order/{invitation_key}/download_e_purchase_order', [App\Http\Controllers\PurchaseOrderController::class, 'downloadEPurchaseOrder'])->name('purchase_order.download_e_purchase_order')->middleware('token_auth');
 | 
			
		||||
    
 | 
			
		||||
    Route::resource('documents', App\Http\Controllers\VendorPortal\DocumentController::class)->only(['index', 'show']);
 | 
			
		||||
    
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
Route::get('purchase_order/{invitation_key}/download_e_purchase_order', [App\Http\Controllers\PurchaseOrderController::class, 'downloadEPurchaseOrder'])->name('purchase_order.download_e_purchase_order')->middleware('token_auth');
 | 
			
		||||
 | 
			
		||||
Route::fallback([BaseController::class, 'notFoundVendor']);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user