Merge branch 'master' of github.com:akaunting/akaunting into 2.1-dev
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Portal;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use App\Http\Requests\Portal\InvoiceShow as Request;
|
||||
use App\Models\Sale\Invoice;
|
||||
use App\Models\Setting\Category;
|
||||
use App\Traits\Currencies;
|
||||
@ -41,7 +42,7 @@ class Invoices extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show(Invoice $invoice)
|
||||
public function show(Invoice $invoice, Request $request)
|
||||
{
|
||||
$payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
@ -57,7 +58,7 @@ class Invoices extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function printInvoice(Invoice $invoice)
|
||||
public function printInvoice(Invoice $invoice, Request $request)
|
||||
{
|
||||
$invoice = $this->prepareInvoice($invoice);
|
||||
|
||||
@ -71,7 +72,7 @@ class Invoices extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function pdfInvoice(Invoice $invoice)
|
||||
public function pdfInvoice(Invoice $invoice, Request $request)
|
||||
{
|
||||
$invoice = $this->prepareInvoice($invoice);
|
||||
|
||||
@ -92,22 +93,6 @@ class Invoices extends Controller
|
||||
|
||||
protected function prepareInvoice(Invoice $invoice)
|
||||
{
|
||||
$paid = 0;
|
||||
|
||||
foreach ($invoice->transactions as $item) {
|
||||
$amount = $item->amount;
|
||||
|
||||
if ($invoice->currency_code != $item->currency_code) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
$amount = $item->getAmountConvertedFromDefault();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
||||
$invoice->paid = $paid;
|
||||
|
||||
$invoice->template_path = 'sales.invoices.print_' . setting('invoice.template' ,'default');
|
||||
|
||||
event(new \App\Events\Sale\InvoicePrinting($invoice));
|
||||
@ -121,22 +106,6 @@ class Invoices extends Controller
|
||||
redirect()->route('login');
|
||||
}
|
||||
|
||||
$paid = 0;
|
||||
|
||||
foreach ($invoice->transactions as $item) {
|
||||
$amount = $item->amount;
|
||||
|
||||
if ($invoice->currency_code != $item->currency_code) {
|
||||
$item->default_currency_code = $invoice->currency_code;
|
||||
|
||||
$amount = $item->getAmountConvertedFromDefault();
|
||||
}
|
||||
|
||||
$paid += $amount;
|
||||
}
|
||||
|
||||
$invoice->paid = $paid;
|
||||
|
||||
$payment_methods = Modules::getPaymentMethods();
|
||||
|
||||
$payment_actions = [];
|
||||
|
@ -4,11 +4,11 @@ namespace App\Http\Controllers\Portal;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use App\Models\Banking\Transaction;
|
||||
use App\Http\Requests\Portal\PaymentShow as Request;
|
||||
use App\Utilities\Modules;
|
||||
|
||||
class Payments extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
@ -30,7 +30,7 @@ class Payments extends Controller
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show(Transaction $payment)
|
||||
public function show(Transaction $payment, Request $request)
|
||||
{
|
||||
$payment_methods = Modules::getPaymentMethods('all');
|
||||
|
||||
|
@ -54,7 +54,9 @@ class Settings extends Controller
|
||||
$settings = [];
|
||||
|
||||
foreach ($modules->settings as $alias => $setting) {
|
||||
if (!user()->can('read-' . $alias . '-settings')) {
|
||||
$permission = !empty($setting['permission']) ? $setting['permission'] : 'read-' . $alias . '-settings';
|
||||
|
||||
if (!user()->can($permission)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user