Merge branch 'master' of github.com:akaunting/akaunting

This commit is contained in:
Cüneyt Şentürk 2021-06-22 17:48:59 +03:00
commit e24240c6e7
15 changed files with 175 additions and 38 deletions

View File

@ -671,7 +671,7 @@ abstract class DocumentIndex extends Base
return $class;
}
return 'col-xs-4 col-sm-4 col-md-4 col-lg-2 col-xl-2 text-left';
return 'col-xs-4 col-sm-4 col-md-4 col-lg-2 col-xl-2 text-left long-texts';
}
protected function getClassAmount($type, $classAmount)

View File

@ -236,6 +236,12 @@ abstract class DocumentShow extends Base
/** @var bool */
public $hideTimelineCreate;
/** @var string */
public $textDocumentTitle;
/** @var string */
public $textDocumentSubheading;
/** @var string */
public $textTimelineCreateTitle;
@ -377,6 +383,7 @@ abstract class DocumentShow extends Base
string $textHeaderContact = '', string $textHeaderAmount = '', string $textHeaderDueAt = '',
string $classHeaderStatus = '', string $classHeaderContact = '', string $classHeaderAmount = '', string $classHeaderDueAt = '', string $classFooterHistories = '', string $classFooterTransactions = '',
bool $hideHeaderStatus = false, bool $hideHeaderContact = false, bool $hideHeaderAmount = false, bool $hideHeaderDueAt = false,
string $textDocumentTitle = '', string $textDocumentSubheading = '',
string $textTimelineCreateTitle = '', string $textTimelineCreateMessage = '', string $textTimelineSentTitle = '', string $textTimelineSentStatusDraft = '', string $textTimelineSentStatusMarkSent = '', string $textTimelineSentStatusReceived = '', string $textTimelineSendStatusMail = '',
string $textTimelineGetPaidTitle = '', string $textTimelineGetPaidStatusAwait = '', string $textTimelineGetPaidStatusPartiallyPaid = '', string $textTimelineGetPaidMarkPaid = '', string $textTimelineGetPaidAddPayment = '',
bool $hideTimelineCreate = false, bool $hideCompanyLogo = false, bool $hideCompanyDetails = false,
@ -474,6 +481,8 @@ abstract class DocumentShow extends Base
$this->hideButtonShare = $hideButtonShare;
$this->hideButtonPaid = $hideButtonPaid;
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
$this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading);
$this->textTimelineCreateTitle = $this->getTextTimelineCreateTitle($type, $textTimelineCreateTitle);
$this->textTimelineCreateMessage = $this->getTextTimelineCreateMessage($type, $textTimelineCreateMessage);
$this->textTimelineSentTitle = $this->getTextTimelineSentTitle($type, $textTimelineSentTitle);
@ -1136,6 +1145,44 @@ abstract class DocumentShow extends Base
return $hideTimelineStatuses;
}
protected function getTextDocumentTitle($type, $textDocumentTitle)
{
if (!empty($textDocumentTitle)) {
return $textDocumentTitle;
}
$translation = $this->getTextFromConfig($type, 'document_title', 'title');
if (!empty($translation)) {
return $translation;
}
if (!empty(setting($type . '.title'))) {
return setting($type . '.title');
}
return setting('invoice.title');
}
protected function getTextDocumentSubheading($type, $textDocumentSubheading)
{
if (!empty($textDocumentSubheading)) {
return $textDocumentSubheading;
}
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
if (!empty($translation)) {
return $translation;
}
if (!empty(setting($type . '.subheading'))) {
return setting($type . '.subheading');
}
return setting('invoice.subheading');
}
protected function getTextTimelineCreateTitle($type, $textTimelineCreateTitle)
{
if (!empty($textTimelineCreateTitle)) {

View File

@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Log;
use Image;
use Intervention\Image\Exception\NotReadableException;
use Storage;
use Illuminate\Support\Str;
abstract class DocumentTemplate extends Base
{
@ -68,6 +69,12 @@ abstract class DocumentTemplate extends Base
public $hideDueAt;
/** @var string */
public $textDocumentTitle;
/** @var string */
public $textDocumentSubheading;
public $textContactInfo;
/** @var string */
@ -121,6 +128,7 @@ abstract class DocumentTemplate extends Base
bool $hideCompanyName = false, bool $hideCompanyAddress = false, bool $hideCompanyTaxNumber = false, bool $hideCompanyPhone = false, bool $hideCompanyEmail = false, bool $hideContactInfo = false,
bool $hideContactName = false, bool $hideContactAddress = false, bool $hideContactTaxNumber = false, bool $hideContactPhone = false, bool $hideContactEmail = false,
bool $hideOrderNumber = false, bool $hideDocumentNumber = false, bool $hideIssuedAt = false, bool $hideDueAt = false,
string $textDocumentTitle = '', string $textDocumentSubheading = '',
string $textContactInfo = '', string $textDocumentNumber = '', string $textOrderNumber = '', string $textIssuedAt = '', string $textDueAt = '',
bool $hideItems = false, bool $hideName = false, bool $hideDescription = false, bool $hideQuantity = false, bool $hidePrice = false, bool $hideDiscount = false, bool $hideAmount = false, bool $hideNote = false,
string $textItems = '', string $textQuantity = '', string $textPrice = '', string $textAmount = ''
@ -151,6 +159,8 @@ abstract class DocumentTemplate extends Base
$this->hideIssuedAt = $hideIssuedAt;
$this->hideDueAt = $hideDueAt;
$this->textDocumentTitle = $this->getTextDocumentTitle($type, $textDocumentTitle);
$this->textDocumentSubheading = $this->gettextDocumentSubheading($type, $textDocumentSubheading);
$this->textContactInfo = $this->getTextContactInfo($type, $textContactInfo);
$this->textIssuedAt = $this->getTextIssuedAt($type, $textIssuedAt);
$this->textDocumentNumber = $this->getTextDocumentNumber($type, $textDocumentNumber);
@ -259,6 +269,44 @@ abstract class DocumentTemplate extends Base
return $backgroundColor;
}
protected function getTextDocumentTitle($type, $textDocumentTitle)
{
if (!empty($textDocumentTitle)) {
return $textDocumentTitle;
}
if (!empty(setting($type . '.title'))) {
return setting($type . '.title');
}
$translation = $this->getTextFromConfig($type, 'document_title', Str::plural($type));
if (!empty($translation)) {
return trans_choice($translation, 1);
}
return setting('invoice.title');
}
protected function getTextDocumentSubheading($type, $textDocumentSubheading)
{
if (!empty($textDocumentSubheading)) {
return $textDocumentSubheading;
}
if (!empty(setting($type . '.subheading'))) {
return setting($type . '.subheading');
}
$translation = $this->getTextFromConfig($type, 'document_subheading', 'subheading');
if (!empty($translation)) {
return trans($translation);
}
return false;
}
protected function getTextDocumentNumber($type, $textDocumentNumber)
{
if (!empty($textDocumentNumber)) {

View File

@ -59,19 +59,25 @@ class ReportCache extends Command
$reports = Report::orderBy('name')->get();
foreach ($reports as $report) {
$class = Utility::getClassInstance($report, false);
try {
$class = Utility::getClassInstance($report, false);
if (empty($class)) {
continue;
if (empty($class)) {
continue;
}
$ttl = 3600 * 6; // 6 hours
Cache::forget('reports.totals.' . $report->id);
Cache::remember('reports.totals.' . $report->id, $ttl, function () use ($class) {
return $class->getGrandTotal();
});
} catch (\Throwable $e) {
$this->error($e->getMessage());
report($e);
}
$ttl = 3600 * 6; // 6 hours
Cache::forget('reports.totals.' . $report->id);
Cache::remember('reports.totals.' . $report->id, $ttl, function () use ($class) {
return $class->getGrandTotal();
});
}
}
}

View File

@ -37,7 +37,7 @@ class User extends FormRequest
$id = is_numeric($this->user) ? $this->user : $this->user->getAttribute('id');
$password = '';
$companies = $this->user->can('read-common-companies') ? 'required' : '';
$roles = $this->user->can('read-auth-roles') ? 'required' : '';
$roles = $this->user->can('read-auth-roles') ? 'required|array' : '';
if ($this->user->contact) {
$email .= '|unique:contacts,NULL,'
@ -51,7 +51,7 @@ class User extends FormRequest
$id = null;
$password = 'required|';
$companies = 'required';
$roles = 'required';
$roles = 'required|array';
}
$email .= '|unique:users,email,' . $id . ',id,deleted_at,NULL';

View File

@ -51,8 +51,12 @@ class Version2117 extends Listener
protected function cacheReports()
{
Report::all()->each(function ($report) {
Cache::put('reports.totals.' . $report->id, Utility::getClassInstance($report)->getGrandTotal());
});
try {
Report::all()->each(function ($report) {
Cache::put('reports.totals.' . $report->id, Utility::getClassInstance($report)->getGrandTotal());
});
} catch (\Throwable $e) {
report($e);
}
}
}

View File

@ -110,7 +110,17 @@ export default class Form {
}
} else {
if (form_element.checked) {
this[form_element.getAttribute('data-field')][name] = form_element.value;
if (form_element.dataset.type != undefined) {
if (form_element.dataset.type == 'multiple') {
this[name] = [];
this[form_element.getAttribute('data-field')][name].push(form_element.value);
} else {
this[form_element.getAttribute('data-field')][name] = form_element.value;
}
} else {
this[form_element.getAttribute('data-field')][name] = form_element.value;
}
} else {
this[form_element.getAttribute('data-field')][name] = [];
}
@ -141,7 +151,17 @@ export default class Form {
}
} else {
if (form_element.checked) {
this[name] = form_element.value;
if (form_element.dataset.type != undefined) {
if (form_element.dataset.type == 'multiple') {
this[name] = [];
this[name].push(form_element.value);
} else {
this[name] = form_element.value;
}
} else {
this[name] = form_element.value;
}
} else {
this[name] = [];
}

View File

@ -108,6 +108,8 @@
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
text-document-title="{{ $textDocumentTitle }}"
text-document-subheading="{{ $textDocumentSubheading }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"

View File

@ -34,6 +34,8 @@
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
text-document-title="{{ $textDocumentTitle }}"
text-document-subheading="{{ $textDocumentSubheading }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
@ -77,6 +79,8 @@
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
text-document-title="{{ $textDocumentTitle }}"
text-document-subheading="{{ $textDocumentSubheading }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
@ -120,6 +124,8 @@
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
text-document-title="{{ $textDocumentTitle }}"
text-document-subheading="{{ $textDocumentSubheading }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"

View File

@ -2,12 +2,13 @@
<div class="col-100">
<div class="text">
<h3>
{{ setting('invoice.title') }}
{{ $textDocumentTitle }}
</h3>
@if (setting('invoice.subheading'))
<h5>
{{ setting('invoice.subheading') }}
</h5>
@if ($textDocumentSubheading)
<h5>
{{ $textDocumentSubheading }}
</h5>
@endif
</div>
</div>

View File

@ -2,12 +2,13 @@
<div class="col-100">
<div class="text">
<h3>
{{ setting('invoice.title') }}
{{ $textDocumentTitle }}
</h3>
@if (setting('invoice.subheading'))
<h5>
{{ setting('invoice.subheading') }}
</h5>
@if ($textDocumentSubheading)
<h5>
{{ $textDocumentSubheading }}
</h5>
@endif
</div>
</div>

View File

@ -2,12 +2,13 @@
<div class="col-100">
<div class="text">
<h3>
{{ setting('invoice.title') }}
{{ $textDocumentTitle }}
</h3>
@if (setting('invoice.subheading'))
<h5>
{{ setting('invoice.subheading') }}
</h5>
@if ($textDocumentSubheading)
<h5>
{{ $textDocumentSubheading }}
</h5>
@endif
</div>
</div>

View File

@ -25,6 +25,7 @@
{{ Form::checkbox($name, $item->$id, (is_array($selected) && count($selected) ? (in_array($item->$id, $selected) ? true : false) : null), array_merge([
'id' => 'checkbox-' . $name . '-' . $item->$id,
'class' => 'custom-control-input',
'data-type' => (is_array($selected)) ? 'multiple' : 'single',
'v-model' => !empty($attributes['v-model']) ? $attributes['v-model'] : (!empty($attributes['data-field']) ? 'form.' . $attributes['data-field'] . '.'. $name : 'form.' . $name),
], $item_attributes)) }}

View File

@ -47,8 +47,8 @@
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
{{ Form::bulkActionGroup($item->id, $item->name) }}
</td>
<td class="col-xs-4 col-sm-3 col-md-4 col-lg-3 col-xl-3 long-texts">
<a class="col-aka" href="{{ route('vendors.show', $item->id) }}">{{ $item->name }}</a>
<td class="col-xs-4 col-sm-3 col-md-4 col-lg-3 col-xl-3">
<a class="col-aka long-texts d-block" href="{{ route('vendors.show', $item->id) }}">{{ $item->name }}</a>
</td>
<td class="col-md-3 col-lg-3 col-xl-3 d-none d-md-block long-texts">
<el-tooltip content="{{ !empty($item->phone) ? $item->phone : trans('general.na') }}"

View File

@ -47,8 +47,8 @@
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">
{{ Form::bulkActionGroup($item->id, $item->name) }}
</td>
<td class="col-xs-4 col-sm-3 col-md-4 col-lg-3 col-xl-3 long-texts">
<a class="col-aka" href="{{ route('customers.show', $item->id) }}">{{ $item->name }}</a>
<td class="col-xs-4 col-sm-3 col-md-4 col-lg-3 col-xl-3">
<a class="col-aka long-texts d-block" href="{{ route('customers.show', $item->id) }}">{{ $item->name }}</a>
</td>
<td class="col-md-3 col-lg-3 col-xl-3 d-none d-md-block long-texts">
<el-tooltip content="{{ !empty($item->phone) ? $item->phone : trans('general.na') }}"