mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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)
|
$invoices = Invoice::whereIn('id', $ids)
|
||||||
->whereClientId(auth()->user()->client->id)
|
->whereClientId(auth()->user()->client->id)
|
||||||
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
//filter invoices which are payable
|
//filter invoices which are payable
|
||||||
|
@ -95,7 +95,7 @@ class PaymentController extends Controller
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$payable_invoices = collect($request->payable_invoices);
|
$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){
|
$invoices->each(function($invoice){
|
||||||
$invoice->service()->removeUnpaidGatewayFees()->save();
|
$invoice->service()->removeUnpaidGatewayFees()->save();
|
||||||
|
@ -123,8 +123,8 @@ class CompanyUserController extends BaseController
|
|||||||
if (auth()->user()->isAdmin()) {
|
if (auth()->user()->isAdmin()) {
|
||||||
$company_user->fill($request->input('company_user'));
|
$company_user->fill($request->input('company_user'));
|
||||||
} else {
|
} else {
|
||||||
$company_user->fill($request->input('company_user')['settings']);
|
$company_user->settings = $request->input('company_user')['settings'];
|
||||||
$company_user->fill($request->input('company_user')['notifications']);
|
$company_user->notifications = $request->input('company_user')['notifications'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$company_user->save();
|
$company_user->save();
|
||||||
|
@ -136,21 +136,40 @@ class ClientPresenter extends EntityPresenter
|
|||||||
return $str;
|
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()
|
public function getCityState()
|
||||||
{
|
{
|
||||||
$settings = $this->entity->getMergedSettings();
|
$client = $this->entity;
|
||||||
|
|
||||||
$country = false;
|
$country = $client->country ?: false;
|
||||||
|
|
||||||
if ($settings->country_id) {
|
|
||||||
$country = Country::find($settings->country_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$swap = $country && $country->swap_postal_code;
|
$swap = $country && $country->swap_postal_code;
|
||||||
|
|
||||||
$city = e($settings->city ?: '');
|
$city = e($client->city ?: '');
|
||||||
$state = e($settings->state ?: '');
|
$state = e($client->state ?: '');
|
||||||
$postalCode = e($settings->postal_code ?: '');
|
$postalCode = e($client->postal_code ?: '');
|
||||||
|
|
||||||
if ($city || $state || $postalCode) {
|
if ($city || $state || $postalCode) {
|
||||||
return $this->cityStateZip($city, $state, $postalCode, $swap);
|
return $this->cityStateZip($city, $state, $postalCode, $swap);
|
||||||
|
@ -188,7 +188,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
public function attachInvoices(Payment $payment, PaymentHash $payment_hash): Payment
|
public function attachInvoices(Payment $payment, PaymentHash $payment_hash): Payment
|
||||||
{
|
{
|
||||||
$paid_invoices = $payment_hash->invoices();
|
$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);
|
$payment->invoices()->sync($invoices);
|
||||||
|
|
||||||
$invoices->each(function ($invoice) use ($payment) {
|
$invoices->each(function ($invoice) use ($payment) {
|
||||||
|
@ -37,7 +37,7 @@ class UpdateInvoicePayment
|
|||||||
{
|
{
|
||||||
$paid_invoices = $this->payment_hash->invoices();
|
$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) {
|
collect($paid_invoices)->each(function ($paid_invoice) use ($invoices) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user