diff --git a/VERSION.txt b/VERSION.txt index 030bca2b2fe6..4ea01d15c8f5 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.0.32 \ No newline at end of file +5.0.33 \ No newline at end of file diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index b5afe3bb2b71..648fdde221c8 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -617,7 +617,6 @@ class CompanySettings extends BaseSettings '$quote.po_number', '$quote.date', '$quote.valid_until', - '$quote.balance_due', '$quote.total', ], 'credit_details' => [ diff --git a/app/Http/Controllers/ClientPortal/PaymentHookController.php b/app/Http/Controllers/ClientPortal/PaymentHookController.php deleted file mode 100644 index 59a70bc18d6b..000000000000 --- a/app/Http/Controllers/ClientPortal/PaymentHookController.php +++ /dev/null @@ -1,26 +0,0 @@ -input()); - } -} diff --git a/app/Http/Controllers/CreditController.php b/app/Http/Controllers/CreditController.php index d27e18d6a32c..3cec7da3fb94 100644 --- a/app/Http/Controllers/CreditController.php +++ b/app/Http/Controllers/CreditController.php @@ -314,7 +314,7 @@ class CreditController extends BaseController * * @throws \ReflectionException * @OA\Put( - * path="/api/v1/Credits/{id}", + * path="/api/v1/credits/{id}", * operationId="updateCredit", * tags={"Credits"}, * summary="Updates an Credit", diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 6742dc7068e9..21b78f3a3cc1 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -844,7 +844,8 @@ class InvoiceController extends BaseController $file_path = $invoice->service()->getInvoiceDeliveryNote($invoice, $invoice->invitations->first()->contact); try { - $file = base_path("public/storage/{$file_path}"); + $file = public_path("storage/{$file_path}"); + return response()->download($file, basename($file)); } catch (\Exception $e) { diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 6818fa65b7a4..b29620844220 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -372,7 +372,7 @@ class UserController extends BaseController $user = $this->user_repo->save($request->all(), $user); - if ($user) { + if ($old_email != $new_email) { UserEmailChanged::dispatch($new_email, $old_email, auth()->user()->company()); } diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 4843070dc947..d3c6e9479a44 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -34,9 +34,10 @@ class QueryLogging $timeStart = microtime(true); // Enable query logging for development - if (config('ninja.app_env') != 'production') { - DB::enableQueryLog(); - } + if (config('ninja.app_env') == 'production') + return $next($request); + + DB::enableQueryLog(); $response = $next($request); diff --git a/app/Jobs/Ninja/SendReminders.php b/app/Jobs/Ninja/SendReminders.php index 299dd1e0f607..934c42c10d7f 100644 --- a/app/Jobs/Ninja/SendReminders.php +++ b/app/Jobs/Ninja/SendReminders.php @@ -16,6 +16,7 @@ use App\Events\Invoice\InvoiceWasEmailed; use App\Jobs\Entity\EmailEntity; use App\Libraries\MultiDB; use App\Models\Invoice; +use App\Models\Webhook; use App\Utils\Ninja; use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesReminders; @@ -25,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Carbon; +use App\Jobs\Util\WebHookHandler; class SendReminders implements ShouldQueue { @@ -81,6 +83,7 @@ class SendReminders implements ShouldQueue if (in_array($reminder_template, ['reminder1', 'reminder2', 'reminder3', 'endless_reminder'])) { $this->sendReminder($invoice, $reminder_template); + WebHookHandler::dispatch(Webhook::EVENT_REMIND_INVOICE, $invoice, $invoice->company); } }); } diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index bfa50b598555..5f1ccb4098ef 100644 --- a/app/Models/ClientContact.php +++ b/app/Models/ClientContact.php @@ -207,6 +207,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference { $domain = isset($this->company->portal_domain) ?: $this->company->domain(); - return $domain . 'client/key_login/' . $this->contact_key; + return $domain . '/client/key_login/' . $this->contact_key; } } diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 9cc71214d1be..61c535345f86 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -81,4 +81,9 @@ class Expense extends BaseModel { return $this->belongsTo(Company::class); } + + public function vendor() + { + return $this->belongsTo(Vendor::class); + } } diff --git a/app/Notifications/Admin/InvoiceSentNotification.php b/app/Notifications/Admin/InvoiceSentNotification.php index 23520c79fa2d..5f8133d0789a 100644 --- a/app/Notifications/Admin/InvoiceSentNotification.php +++ b/app/Notifications/Admin/InvoiceSentNotification.php @@ -92,7 +92,7 @@ class InvoiceSentNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url').'invoices/'.$this->invoice->hashed_id, + 'url' => config('ninja.app_url').'/invoices/'.$this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/InvoiceViewedNotification.php b/app/Notifications/Admin/InvoiceViewedNotification.php index e8e0ed3a8e67..793f484d8faf 100644 --- a/app/Notifications/Admin/InvoiceViewedNotification.php +++ b/app/Notifications/Admin/InvoiceViewedNotification.php @@ -92,7 +92,7 @@ class InvoiceViewedNotification extends Notification implements ShouldQueue 'invoice' => $this->invoice->number, ] ), - 'url' => config('ninja.app_url').'invoices/'.$this->invoice->hashed_id, + 'url' => config('ninja.app_url').'/invoices/'.$this->invoice->hashed_id, 'button' => ctrans('texts.view_invoice'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/NewPartialPaymentNotification.php b/app/Notifications/Admin/NewPartialPaymentNotification.php index 83eba45e660f..e7023f414a4c 100644 --- a/app/Notifications/Admin/NewPartialPaymentNotification.php +++ b/app/Notifications/Admin/NewPartialPaymentNotification.php @@ -89,7 +89,7 @@ class NewPartialPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url').'payments/'.$this->payment->hashed_id, + 'url' => config('ninja.app_url').'/payments/'.$this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Notifications/Admin/NewPaymentNotification.php b/app/Notifications/Admin/NewPaymentNotification.php index 867e9b818da0..ef7070dfd575 100644 --- a/app/Notifications/Admin/NewPaymentNotification.php +++ b/app/Notifications/Admin/NewPaymentNotification.php @@ -92,7 +92,7 @@ class NewPaymentNotification extends Notification implements ShouldQueue 'invoice' => $invoice_texts, ] ), - 'url' => config('ninja.app_url').'payments/'.$this->payment->hashed_id, + 'url' => config('ninja.app_url').'/payments/'.$this->payment->hashed_id, 'button' => ctrans('texts.view_payment'), 'signature' => $this->settings->email_signature, 'logo' => $this->company->present()->logo(), diff --git a/app/Transformers/CompanyUserTransformer.php b/app/Transformers/CompanyUserTransformer.php index 85dfda97f1c4..111cf0e4095b 100644 --- a/app/Transformers/CompanyUserTransformer.php +++ b/app/Transformers/CompanyUserTransformer.php @@ -23,7 +23,7 @@ class CompanyUserTransformer extends EntityTransformer * @var array */ protected $defaultIncludes = [ - 'user', + // 'user', ]; /** diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 27e08b6d7e88..99f4519253d0 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -26,8 +26,7 @@ class UserTransformer extends EntityTransformer * @var array */ protected $defaultIncludes = [ - //'company_users', - // 'token', + //'company_user' ]; /** diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index 209ff8342730..2d02b8931ef6 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -68,7 +68,7 @@ class Phantom $file_path = $path.$entity_obj->number.'.pdf'; - $url = config('ninja.app_url').'phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret'); + $url = config('ninja.app_url').'/phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret'); info($url); $key = config('ninja.phantomjs_key'); diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 66d37d7257d5..7ea3ff929556 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -601,22 +601,37 @@ trait GeneratesCounter $replace[] = str_replace($format, $date, $matches[1]); } - if ($entity instanceof Client || $entity instanceof Vendor) { - $search[] = '{$client_custom1}'; - $replace[] = $entity->custom_value1; + if ($entity instanceof Vendor) { - $search[] = '{$client_custom2}'; - $replace[] = $entity->custom_value2; - - $search[] = '{$client_custom3}'; - $replace[] = $entity->custom_value3; - - $search[] = '{$client_custom4}'; - $replace[] = $entity->custom_value4; - - $search[] = '{$id_number}'; + $search[] = '{$vendor_id_number}'; $replace[] = $entity->id_number; - } else { + + } + + if ($entity instanceof Expense) { + + if($entity->vendor){ + $search[] = '{$vendor_id_number}'; + $replace[] = $entity->vendor->id_number; + + $search[] = '{$vendor_custom1}'; + $replace[] = $entity->vendor->custom_value1; + + $search[] = '{$vendor_custom2}'; + $replace[] = $entity->vendor->custom_value2; + + $search[] = '{$vendor_custom3}'; + $replace[] = $entity->vendor->custom_value3; + + $search[] = '{$vendor_custom4}'; + $replace[] = $entity->vendor->custom_value4; + } + + $search[] = '{$expense_id_number}'; + $replace[] = $entity->id_number; + } + + if ($entity->client) { $search[] = '{$client_custom1}'; $replace[] = $entity->client->custom_value1; @@ -629,7 +644,7 @@ trait GeneratesCounter $search[] = '{$client_custom4}'; $replace[] = $entity->client->custom_value4; - $search[] = '{$id_number}'; + $search[] = '{$client_id_number}'; $replace[] = $entity->client->id_number; } diff --git a/app/Utils/Traits/Inviteable.php b/app/Utils/Traits/Inviteable.php index 6765c3f65eb6..12188dc55626 100644 --- a/app/Utils/Traits/Inviteable.php +++ b/app/Utils/Traits/Inviteable.php @@ -50,14 +50,14 @@ trait Inviteable switch ($this->company->portal_mode) { case 'subdomain': - return $domain.'client/'.$entity_type.'/'.$this->key; + return $domain.'/client/'.$entity_type.'/'.$this->key; break; case 'iframe': - return $domain.'client/'.$entity_type.'/'.$this->key; + return $domain.'/client/'.$entity_type.'/'.$this->key; //return $domain . $entity_type .'/'. $this->contact->client->client_hash .'/'. $this->key; break; case 'domain': - return $domain.'client/'.$entity_type.'/'.$this->key; + return $domain.'/client/'.$entity_type.'/'.$this->key; break; default: diff --git a/composer.json b/composer.json index 0112f74a8710..0061e00593ef 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "league/omnipay": "^3.0", "livewire/livewire": "^2.0", "maennchen/zipstream-php": "^1.2", - "nwidart/laravel-modules": "^6.0", + "nwidart/laravel-modules": "^8.0", "omnipay/paypal": "^3.0", "predis/predis": "^1.1", "sentry/sentry-laravel": "^2", diff --git a/config/ninja.php b/config/ninja.php index 7321356e7c51..8e2402b989e2 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -10,9 +10,9 @@ return [ 'app_name' => env('APP_NAME'), 'app_env' => env('APP_ENV', 'selfhosted'), 'require_https' => env('REQUIRE_HTTPS', true), - 'app_url' => rtrim(env('APP_URL', ''), '/').'/', + 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.0.32', + 'app_version' => '5.0.33', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index e7da1afbcebc..5e0de48d68a9 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -68,8 +68,8 @@ $LANG = [ 'tax_rates' => 'Steuersätze', 'rate' => 'Satz', 'settings' => 'Einstellungen', - 'enable_invoice_tax' => 'Ermögliche das Bestimmen einer Rechnungssteuer', - 'enable_line_item_tax' => 'Ermögliche das Bestimmen von Steuern für Belegpositionen', + 'enable_invoice_tax' => 'Ermögliche das Bestimmen einer Rechnungssteuer', + 'enable_line_item_tax' => 'Ermögliche das Bestimmen von Steuern für Belegpositionen', 'dashboard' => 'Dashboard', 'clients' => 'Kunden', 'invoices' => 'Rechnungen', @@ -95,9 +95,9 @@ $LANG = [ 'powered_by' => 'Unterstützt durch', 'no_items' => 'Keine Objekte', 'recurring_invoices' => 'Wiederkehrende Rechnungen', - 'recurring_help' => '

Automatically send clients the same invoices weekly, bi-monthly, monthly, quarterly or annually.

-

Use :MONTH, :QUARTER or :YEAR for dynamic dates. Basic math works as well, for example :MONTH-1.

-

Examples of dynamic invoice variables:

+ 'recurring_help' => 'Automatically send clients the same invoices weekly, bi-monthly, monthly, quarterly or annually. + Use :MONTH, :QUARTER or :YEAR for dynamic dates. Basic math works as well, for example :MONTH-1. + Examples of dynamic invoice variables: