mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Merge pull request #6088 from turbo124/v5-develop
Allow archived Invoice to be paid
This commit is contained in:
commit
01c9e1ebad
@ -89,6 +89,7 @@ class InvoiceController extends Controller
|
||||
{
|
||||
$invoices = Invoice::whereIn('id', $ids)
|
||||
->whereClientId(auth()->user()->client->id)
|
||||
->withTrashed()
|
||||
->get();
|
||||
|
||||
//filter invoices which are payable
|
||||
|
@ -95,7 +95,7 @@ class PaymentController extends Controller
|
||||
*/
|
||||
|
||||
$payable_invoices = collect($request->payable_invoices);
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->withTrashed()->get();
|
||||
|
||||
$invoices->each(function($invoice){
|
||||
$invoice->service()->removeUnpaidGatewayFees()->save();
|
||||
|
@ -123,8 +123,8 @@ class CompanyUserController extends BaseController
|
||||
if (auth()->user()->isAdmin()) {
|
||||
$company_user->fill($request->input('company_user'));
|
||||
} else {
|
||||
$company_user->fill($request->input('company_user')['settings']);
|
||||
$company_user->fill($request->input('company_user')['notifications']);
|
||||
$company_user->settings = $request->input('company_user')['settings'];
|
||||
$company_user->notifications = $request->input('company_user')['notifications'];
|
||||
}
|
||||
|
||||
$company_user->save();
|
||||
|
@ -136,21 +136,40 @@ class ClientPresenter extends EntityPresenter
|
||||
return $str;
|
||||
}
|
||||
|
||||
// public function getCityState()
|
||||
// {
|
||||
// $settings = $this->entity->getMergedSettings();
|
||||
|
||||
// $country = false;
|
||||
|
||||
// if ($settings->country_id) {
|
||||
// $country = Country::find($settings->country_id);
|
||||
// }
|
||||
|
||||
// $swap = $country && $country->swap_postal_code;
|
||||
|
||||
// $city = e($settings->city ?: '');
|
||||
// $state = e($settings->state ?: '');
|
||||
// $postalCode = e($settings->postal_code ?: '');
|
||||
|
||||
// if ($city || $state || $postalCode) {
|
||||
// return $this->cityStateZip($city, $state, $postalCode, $swap);
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
public function getCityState()
|
||||
{
|
||||
$settings = $this->entity->getMergedSettings();
|
||||
|
||||
$country = false;
|
||||
|
||||
if ($settings->country_id) {
|
||||
$country = Country::find($settings->country_id);
|
||||
}
|
||||
$client = $this->entity;
|
||||
|
||||
$country = $client->country ?: false;
|
||||
|
||||
$swap = $country && $country->swap_postal_code;
|
||||
|
||||
$city = e($settings->city ?: '');
|
||||
$state = e($settings->state ?: '');
|
||||
$postalCode = e($settings->postal_code ?: '');
|
||||
$city = e($client->city ?: '');
|
||||
$state = e($client->state ?: '');
|
||||
$postalCode = e($client->postal_code ?: '');
|
||||
|
||||
if ($city || $state || $postalCode) {
|
||||
return $this->cityStateZip($city, $state, $postalCode, $swap);
|
||||
|
@ -188,7 +188,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
public function attachInvoices(Payment $payment, PaymentHash $payment_hash): Payment
|
||||
{
|
||||
$paid_invoices = $payment_hash->invoices();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->withTrashed()->get();
|
||||
$payment->invoices()->sync($invoices);
|
||||
|
||||
$invoices->each(function ($invoice) use ($payment) {
|
||||
|
@ -37,7 +37,7 @@ class UpdateInvoicePayment
|
||||
{
|
||||
$paid_invoices = $this->payment_hash->invoices();
|
||||
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
collect($paid_invoices)->each(function ($paid_invoice) use ($invoices) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user