Merge branch 'master' of github.com:akaunting/akaunting
This commit is contained in:
commit
f2b73d83d8
@ -31,7 +31,7 @@ class Bills extends BulkAction
|
||||
],
|
||||
'cancelled' => [
|
||||
'icon' => 'cancel',
|
||||
'name' => 'general.cancel',
|
||||
'name' => 'documents.actions.cancel',
|
||||
'message' => 'bulk_actions.message.cancelled',
|
||||
'permission' => 'update-purchases-bills',
|
||||
],
|
||||
|
@ -31,7 +31,7 @@ class Invoices extends BulkAction
|
||||
],
|
||||
'cancelled' => [
|
||||
'icon' => 'cancel',
|
||||
'name' => 'general.cancel',
|
||||
'name' => 'documents.actions.cancel',
|
||||
'message' => 'bulk_actions.message.cancelled',
|
||||
'permission' => 'update-sales-invoices',
|
||||
],
|
||||
|
20
app/Events/Document/DocumentSending.php
Normal file
20
app/Events/Document/DocumentSending.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\Document;
|
||||
|
||||
use App\Abstracts\Event;
|
||||
|
||||
class DocumentSending extends Event
|
||||
{
|
||||
public $document;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @param $document
|
||||
*/
|
||||
public function __construct($document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ use App\Imports\Sales\Invoices as Import;
|
||||
use App\Jobs\Document\CreateDocument;
|
||||
use App\Jobs\Document\DeleteDocument;
|
||||
use App\Jobs\Document\DuplicateDocument;
|
||||
use App\Jobs\Document\SendDocument;
|
||||
use App\Jobs\Document\UpdateDocument;
|
||||
use App\Models\Document\Document;
|
||||
use App\Notifications\Sale\Invoice as Notification;
|
||||
@ -260,12 +261,17 @@ class Invoices extends Controller
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
// Notify the customer
|
||||
$invoice->contact->notify(new Notification($invoice, 'invoice_new_customer', true));
|
||||
$response = $this->ajaxDispatch(new SendDocument($invoice));
|
||||
|
||||
event(new \App\Events\Document\DocumentSent($invoice));
|
||||
if ($response['success']) {
|
||||
$message = trans('documents.messages.email_sent', ['type' => trans_choice('general.invoices', 1)]);
|
||||
|
||||
flash(trans('documents.messages.email_sent', ['type' => trans_choice('general.invoices', 1)]))->success();
|
||||
flash($message)->success();
|
||||
} else {
|
||||
$message = $response['message'];
|
||||
|
||||
flash($message)->error()->important();
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
26
app/Jobs/Document/SendDocument.php
Normal file
26
app/Jobs/Document/SendDocument.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Document;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Document\DocumentSending;
|
||||
use App\Events\Document\DocumentSent;
|
||||
use App\Models\Document\Document;
|
||||
|
||||
class SendDocument extends Job
|
||||
{
|
||||
public function __construct(Document $document)
|
||||
{
|
||||
$this->document = $document;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
event(new DocumentSending($document));
|
||||
|
||||
// Notify the customer
|
||||
$invoice->contact->notify(new Notification($invoice, 'invoice_new_customer', true));
|
||||
|
||||
event(new DocumentSent($document));
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace App\Jobs\Document;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Events\Document\DocumentSending;
|
||||
use App\Events\Document\DocumentSent;
|
||||
use App\Models\Document\Document;
|
||||
|
||||
@ -18,6 +19,8 @@ class SendDocumentAsCustomMail extends Job
|
||||
{
|
||||
$document = Document::find($this->request->get('document_id'));
|
||||
|
||||
event(new DocumentSending($document));
|
||||
|
||||
$custom_mail = $this->request->only(['to', 'subject', 'body']);
|
||||
|
||||
if ($this->request->get('user_email', false)) {
|
||||
|
71
app/Listeners/Update/V30/Version3013.php
Normal file
71
app/Listeners/Update/V30/Version3013.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Update\V30;
|
||||
|
||||
use App\Abstracts\Listeners\Update as Listener;
|
||||
use App\Events\Install\UpdateFinished as Event;
|
||||
use App\Traits\Categories;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Version3013 extends Listener
|
||||
{
|
||||
use Categories;
|
||||
|
||||
const ALIAS = 'core';
|
||||
|
||||
const VERSION = '3.0.13';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($this->skipThisUpdate($event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log::channel('stdout')->info('Updating to 3.0.13 version...');
|
||||
|
||||
DB::transaction(function () {
|
||||
$types = $this->getTypesByAllowedTranslations();
|
||||
|
||||
foreach ($types as $type => $translations) {
|
||||
DB::table('categories')->whereIn('type', $translations)->update(['type' => $type]);
|
||||
}
|
||||
});
|
||||
|
||||
Log::channel('stdout')->info('Done!');
|
||||
}
|
||||
|
||||
protected function getTypesByAllowedTranslations(): array
|
||||
{
|
||||
$types = $this->getCategoryTypes(false);
|
||||
$lang_codes = array_keys(language()->allowed());
|
||||
|
||||
foreach ($types as $type => $trans_name) {
|
||||
$translations_for_type = [];
|
||||
|
||||
foreach ($lang_codes as $lang_code) {
|
||||
$translation = trans_choice($trans_name, 1, locale: $lang_code);
|
||||
|
||||
if ($translation === $trans_name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$translations_for_type[] = $translation;
|
||||
}
|
||||
|
||||
$types[$type] = $translations_for_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Example: en-GB es-ES
|
||||
* 'income' => ['Income', 'Ingresos']
|
||||
*/
|
||||
return $types;
|
||||
}
|
||||
}
|
@ -614,7 +614,7 @@ class Document extends Model
|
||||
if (! in_array($this->status, ['cancelled', 'draft'])) {
|
||||
try {
|
||||
$actions[] = [
|
||||
'title' => trans('general.cancel'),
|
||||
'title' => trans('documents.actions.cancel'),
|
||||
'icon' => 'cancel',
|
||||
'url' => route($prefix . '.cancelled', $this->id),
|
||||
'permission' => 'update-' . $group . '-' . $permission_prefix,
|
||||
|
@ -21,6 +21,7 @@ class Event extends Provider
|
||||
'App\Listeners\Update\V30\Version305',
|
||||
'App\Listeners\Update\V30\Version307',
|
||||
'App\Listeners\Update\V30\Version309',
|
||||
'App\Listeners\Update\V30\Version3013',
|
||||
],
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\Auth\Login',
|
||||
|
@ -7,7 +7,7 @@ use Illuminate\Support\Str;
|
||||
|
||||
trait Categories
|
||||
{
|
||||
public function getCategoryTypes(): array
|
||||
public function getCategoryTypes(bool $translate = true): array
|
||||
{
|
||||
$types = [];
|
||||
$configs = config('type.category');
|
||||
@ -21,7 +21,7 @@ trait Categories
|
||||
$name = $attr['alias'] . '::' . $name;
|
||||
}
|
||||
|
||||
$types[$type] = trans_choice($name, 1);
|
||||
$types[$type] = $translate ? trans_choice($name, 1) : $name;
|
||||
}
|
||||
|
||||
return $types;
|
||||
|
@ -156,20 +156,4 @@ return [
|
||||
*/
|
||||
|
||||
'middleware' => explode(',', env('API_MIDDLEWARE', 'api')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Rate Limit (Throttle)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Consumers of your API can be limited to the amount of requests they can
|
||||
| make. You can create your own throttles or simply change the default
|
||||
| throttles.
|
||||
|
|
||||
*/
|
||||
|
||||
'rate_limit' => [
|
||||
Limit::perMinute(env('API_RATE_LIMIT', 60)),
|
||||
],
|
||||
|
||||
];
|
||||
|
@ -10,6 +10,10 @@ return [
|
||||
'billing' => 'Billing',
|
||||
'advanced' => 'Advanced',
|
||||
|
||||
'actions' => [
|
||||
'cancel' => 'Cancel',
|
||||
],
|
||||
|
||||
'invoice_detail' => [
|
||||
'marked' => '<b>You</b> marked this invoice as',
|
||||
'services' => 'Services',
|
||||
|
@ -61,54 +61,56 @@
|
||||
|
||||
</br>
|
||||
|
||||
@if (! empty($transaction->contact) && $transaction->contact->email)
|
||||
<x-button id="show-slider-actions-transaction-send-email-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.email_required') }}" placement="top">
|
||||
<x-button class="text-purple mt-1" override="class" disabled="disabled">
|
||||
<div class="flex flex-row">
|
||||
@if (! empty($transaction->contact) && $transaction->contact->email)
|
||||
<x-button id="show-slider-actions-transaction-send-email-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.email_required') }}" placement="top">
|
||||
<x-button class="text-purple mt-1" override="class" disabled="disabled">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
|
||||
<span> - </span>
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
|
||||
<span> - </span>
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
@php
|
||||
$message = trans('general.delete_confirm', [
|
||||
'name' => '<strong>' . Date::parse($transaction->paid_at)->format(company_date_format()) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
|
||||
'type' => strtolower(trans_choice('general.transactions', 1))
|
||||
]);
|
||||
@endphp
|
||||
@php
|
||||
$message = trans('general.delete_confirm', [
|
||||
'name' => '<strong>' . Date::parse($transaction->paid_at)->format(company_date_format()) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
|
||||
'type' => strtolower(trans_choice('general.transactions', 1))
|
||||
]);
|
||||
@endphp
|
||||
|
||||
<x-delete-link
|
||||
:model="$transaction"
|
||||
:route="'transactions.destroy'"
|
||||
:title="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
:message="$message"
|
||||
:label="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
class="text-purple mt-1"
|
||||
text-class="bg-no-repeat bg-0-2 bg-0-full hover:bg-full-2 bg-gradient-to-b from-transparent to-purple transition-backgroundSize"
|
||||
override="class"
|
||||
/>
|
||||
<x-delete-link
|
||||
:model="$transaction"
|
||||
:route="'transactions.destroy'"
|
||||
:title="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
:message="$message"
|
||||
:label="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
class="text-purple mt-1"
|
||||
text-class="bg-no-repeat bg-0-2 bg-0-full hover:bg-full-2 bg-gradient-to-b from-transparent to-purple transition-backgroundSize"
|
||||
override="class"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
|
@ -44,54 +44,56 @@
|
||||
|
||||
</br>
|
||||
|
||||
@if (! empty($transaction->contact) && $transaction->contact->email)
|
||||
<x-button id="show-slider-actions-transaction-send-email-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.email_required') }}" placement="top">
|
||||
<x-button class="text-purple mt-1" override="class" disabled="disabled">
|
||||
<div class="flex flex-row">
|
||||
@if (! empty($transaction->contact) && $transaction->contact->email)
|
||||
<x-button id="show-slider-actions-transaction-send-email-{{ $document->type }}-{{ $transaction->id }}" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
@else
|
||||
<x-tooltip message="{{ trans('invoices.messages.email_required') }}" placement="top">
|
||||
<x-button class="text-purple mt-1" override="class" disabled="disabled">
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
</x-tooltip>
|
||||
@endif
|
||||
|
||||
<span> - </span>
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
<x-button
|
||||
@click="onEditPayment('{{ route('modals.documents.document.transactions.edit', ['document' => $document->id, 'transaction' => $transaction->id]) }}')"
|
||||
id="show-slider-actions-transaction-edit-{{ $document->type }}-{{ $transaction->id }}"
|
||||
class="text-purple mt-1"
|
||||
override="class"
|
||||
>
|
||||
<x-button.hover color="to-purple">
|
||||
{{ trans('general.title.edit', ['type' => trans_choice('general.payments', 1)]) }}
|
||||
</x-button.hover>
|
||||
</x-button>
|
||||
|
||||
<span> - </span>
|
||||
<span class="mt-1 mr-2 ml-2"> - </span>
|
||||
|
||||
@php
|
||||
$message = trans('general.delete_confirm', [
|
||||
'name' => '<strong>' . Date::parse($transaction->paid_at)->format(company_date_format()) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
|
||||
'type' => strtolower(trans_choice('general.transactions', 1))
|
||||
]);
|
||||
@endphp
|
||||
@php
|
||||
$message = trans('general.delete_confirm', [
|
||||
'name' => '<strong>' . Date::parse($transaction->paid_at)->format(company_date_format()) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
|
||||
'type' => strtolower(trans_choice('general.transactions', 1))
|
||||
]);
|
||||
@endphp
|
||||
|
||||
<x-delete-link
|
||||
:model="$transaction"
|
||||
:route="'transactions.destroy'"
|
||||
:title="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
:message="$message"
|
||||
:label="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
class="text-purple mt-1"
|
||||
text-class="bg-no-repeat bg-0-2 bg-0-full hover:bg-full-2 bg-gradient-to-b from-transparent to-purple transition-backgroundSize"
|
||||
override="class"
|
||||
/>
|
||||
<x-delete-link
|
||||
:model="$transaction"
|
||||
:route="'transactions.destroy'"
|
||||
:title="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
:message="$message"
|
||||
:label="trans('general.title.delete', ['type' => trans_choice('general.payments', 1)])"
|
||||
class="text-purple mt-1"
|
||||
text-class="bg-no-repeat bg-0-2 bg-0-full hover:bg-full-2 bg-gradient-to-b from-transparent to-purple transition-backgroundSize"
|
||||
override="class"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
|
@ -113,7 +113,7 @@
|
||||
<x-dropdown.divider />
|
||||
|
||||
<x-dropdown.link href="{{ route($cancelledRoute, $document->id) }}" id="show-more-actions-cancel-{{ $document->type }}">
|
||||
{{ trans('general.cancel') }}
|
||||
{{ trans('documents.actions.cancel') }}
|
||||
</x-dropdown.link>
|
||||
@endcan
|
||||
@endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
value="{{ $signedUrl }}"
|
||||
ref="clone"
|
||||
@click="onCopyLink()"
|
||||
style="appearance: none; background-color: whitesmoke; border: none; font-size: 16px;"
|
||||
style="appearance: none; background-color: whitesmoke; cursor:pointer; border: none; font-size: 16px;"
|
||||
/>
|
||||
<x-form.input.hidden name="hidden-share" value="{{ $signedUrl }}" />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user