1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Merge pull request #8085 from turbo124/v5-develop

Flip sort order for payments in client portal
This commit is contained in:
David Bomba 2022-12-18 14:35:35 +11:00 committed by GitHub
commit 23138553c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 8 deletions

View File

@ -16,6 +16,8 @@ use App\Models\User;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use InvalidArgumentException;
use RuntimeException;
/**
* InvoiceFilters.
@ -136,6 +138,10 @@ class InvoiceFilters extends QueryFilters
});
}
/**
* @return Builder
* @throws RuntimeException
*/
public function without_deleted_clients()
{
@ -144,6 +150,10 @@ class InvoiceFilters extends QueryFilters
});
}
/**
* @return Builder
* @throws InvalidArgumentException
*/
public function upcoming()
{
return $this->builder
@ -154,6 +164,10 @@ class InvoiceFilters extends QueryFilters
->orderBy('due_date', 'ASC');
}
/**
* @return void
* @throws InvalidArgumentException
*/
public function overdue()
{
$this->builder->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
@ -165,6 +179,11 @@ class InvoiceFilters extends QueryFilters
->orderBy('due_date', 'ASC');
}
/**
* @param string $client_id
* @return Builder
* @throws InvalidArgumentException
*/
public function payable(string $client_id = '')
{
if (strlen($client_id) == 0) {
@ -222,8 +241,20 @@ class InvoiceFilters extends QueryFilters
} else {
return $this->builder->company()->with(['invitations.company'], ['documents.company']);
}
}
// return $this->builder->whereCompanyId(auth()->user()->company()->id);
/**
* @param string $filter
* @return Builder
* @throws InvalidArgumentException
*/
public function private_notes($filter = '') :Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
return $this->builder->where('private_notes', 'LIKE', '%'.$filter.'%');
}
/**

View File

@ -781,7 +781,8 @@ class InvoiceController extends BaseController
case 'email':
//check query parameter for email_type and set the template else use calculateTemplate
if (request()->has('email_type') && in_array(request()->input('email_type'), ['reminder1', 'reminder2', 'reminder3', 'reminder_endless', 'custom1', 'custom2', 'custom3'])) {
// if (request()->has('email_type') && in_array(request()->input('email_type'), ['reminder1', 'reminder2', 'reminder3', 'reminder_endless', 'custom1', 'custom2', 'custom3'])) {
if (request()->has('email_type') && property_exists($invoice->company->settings, request()->input('email_type'))) {
$this->reminder_template = $invoice->client->getSetting(request()->input('email_type'));
} else {
$this->reminder_template = $invoice->calculateTemplate('invoice');

View File

@ -43,7 +43,7 @@ class PaymentsTable extends Component
->where('company_id', $this->company->id)
->where('client_id', auth()->guard('contact')->user()->client_id)
->whereIn('status_id', [Payment::STATUS_FAILED, Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_REFUNDED, Payment::STATUS_PARTIALLY_REFUNDED])
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->orderBy($this->sort_field, $this->sort_asc ? 'desc' : 'asc')
->withTrashed()
->paginate($this->per_page);

View File

@ -77,10 +77,6 @@ trait MakesReminders
private function checkEndlessReminder($last_sent_date, $endless_reminder_frequency_id) :bool
{
// nlog("endless date match = ".$this->addTimeInterval($last_sent_date, $endless_reminder_frequency_id));
// nlog("Endless reminder bool = ");
// nlog(Carbon::now()->startOfDay()->eq($this->addTimeInterval($last_sent_date, $endless_reminder_frequency_id)));
if (Carbon::now()->startOfDay()->eq($this->addTimeInterval($last_sent_date, $endless_reminder_frequency_id))) {
return true;
}

View File

@ -130,7 +130,7 @@ class CurrenciesSeeder extends Seeder
['id' => 105, 'name' => 'Gambia Dalasi', 'code' => 'GMD', 'symbol' => 'D', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 106, 'name' => 'Paraguayan Guarani', 'code' => 'PYG', 'symbol' => '₲', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 107, 'name' => 'Malawi Kwacha', 'code' => 'MWK', 'symbol' => 'MK', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 108, 'name' => 'Zimbabwean Dollar', 'code' => 'ZWL', 'symbol' => 'Z$', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 108, 'name' => 'Zimbabwean Dollar', 'code' => 'ZWL', 'symbol' => 'Z$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 109, 'name' => 'Cambodian Riel', 'code' => 'KHR', 'symbol' => '៛', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 110, 'name' => 'Vanuatu Vatu', 'code' => 'VUV', 'symbol' => 'VT', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['id' => 111, 'name' => 'Cuban Peso', 'code' => 'CUP', 'symbol' => '₱', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],