diff --git a/app/Http/Controllers/Common/Import.php b/app/Http/Controllers/Common/Import.php new file mode 100644 index 000000000..3ea718b8d --- /dev/null +++ b/app/Http/Controllers/Common/Import.php @@ -0,0 +1,22 @@ +middleware('permission:create-' . $controller)->only(['create', 'store']); + $this->middleware('permission:create-' . $controller)->only(['create', 'store', 'duplicate', 'import']); $this->middleware('permission:read-' . $controller)->only(['index', 'show', 'edit']); $this->middleware('permission:update-' . $controller)->only(['update']); $this->middleware('permission:delete-' . $controller)->only('destroy'); diff --git a/app/Http/Controllers/Customers/Payments.php b/app/Http/Controllers/Customers/Payments.php index f908a29e4..8ddadde3e 100644 --- a/app/Http/Controllers/Customers/Payments.php +++ b/app/Http/Controllers/Customers/Payments.php @@ -23,7 +23,7 @@ class Payments extends Controller { $payments = Payment::with(['account', 'category'])->where('customer_id', '=', Auth::user()->customer->id)->paginate(); - $payment_methods = Modules::getPaymentMethods(); + $payment_methods = Modules::getPaymentMethods('all'); $categories = collect(Category::enabled()->type('income')->pluck('name', 'id')) ->prepend(trans('general.all_type', ['type' => trans_choice('general.categories', 2)]), ''); diff --git a/app/Http/Controllers/Expenses/Bills.php b/app/Http/Controllers/Expenses/Bills.php index add0bcdc4..fd87dbff2 100644 --- a/app/Http/Controllers/Expenses/Bills.php +++ b/app/Http/Controllers/Expenses/Bills.php @@ -22,6 +22,7 @@ use App\Models\Setting\Tax; use App\Traits\Currencies; use App\Traits\DateTime; use App\Traits\Uploads; +use App\Utilities\ImportFile; use App\Utilities\Modules; use Date; @@ -201,55 +202,51 @@ class Bills extends Controller $bill->update($request->input()); // Added bill total sub total - $bill_sub_total = [ + BillTotal::create([ 'company_id' => $request['company_id'], 'bill_id' => $bill->id, 'code' => 'sub_total', 'name' => 'bills.sub_total', 'amount' => $sub_total, 'sort_order' => 1, - ]; - - BillTotal::create($bill_sub_total); + ]); $sort_order = 2; // Added bill total taxes if ($taxes) { foreach ($taxes as $tax) { - $bill_tax_total = [ + BillTotal::create([ 'company_id' => $request['company_id'], 'bill_id' => $bill->id, 'code' => 'tax', 'name' => $tax['name'], 'amount' => $tax['amount'], 'sort_order' => $sort_order, - ]; - - BillTotal::create($bill_tax_total); + ]); $sort_order++; } } // Added bill total total - $bill_total = [ + BillTotal::create([ 'company_id' => $request['company_id'], 'bill_id' => $bill->id, 'code' => 'total', 'name' => 'bills.total', 'amount' => $sub_total + $tax_total, 'sort_order' => $sort_order, - ]; + ]); - BillTotal::create($bill_total); - - $request['bill_id'] = $bill->id; - $request['status_code'] = 'new'; - $request['notify'] = 0; - $request['description'] = trans('messages.success.added', ['type' => $request['bill_number']]); - - BillHistory::create($request->input()); + // Add bill history + BillHistory::create([ + 'company_id' => session('company_id'), + 'bill_id' => $bill->id, + 'status_code' => 'draft', + 'notify' => 0, + 'description' => trans('messages.success.added', ['type' => $bill->bill_number]), + ]); // Fire the event to make it extendible event(new BillCreated($bill)); @@ -261,6 +258,58 @@ class Bills extends Controller return redirect('expenses/bills/' . $bill->id); } + /** + * Duplicate the specified resource. + * + * @param Bill $bill + * + * @return Response + */ + public function duplicate(Bill $bill) + { + $clone = $bill->duplicate(); + + // Add bill history + BillHistory::create([ + 'company_id' => session('company_id'), + 'bill_id' => $clone->id, + 'status_code' => 'draft', + 'notify' => 0, + 'description' => trans('messages.success.added', ['type' => $clone->bill_number]), + ]); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.bills', 1)]); + + flash($message)->success(); + + return redirect('expenses/bills/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Bill::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.bills', 2)]); + + flash($message)->success(); + + return redirect('expenses/bills'); + } + /** * Show the form for editing the specified resource. * diff --git a/app/Http/Controllers/Expenses/Payments.php b/app/Http/Controllers/Expenses/Payments.php index c2e7b8da3..e8d3f97da 100644 --- a/app/Http/Controllers/Expenses/Payments.php +++ b/app/Http/Controllers/Expenses/Payments.php @@ -10,7 +10,7 @@ use App\Models\Expense\Vendor; use App\Models\Setting\Category; use App\Models\Setting\Currency; use App\Traits\Uploads; - +use App\Utilities\ImportFile; use App\Utilities\Modules; class Payments extends Controller @@ -90,6 +90,49 @@ class Payments extends Controller return redirect('expenses/payments'); } + /** + * Duplicate the specified resource. + * + * @param Payment $payment + * + * @return Response + */ + public function duplicate(Payment $payment) + { + $clone = $payment->duplicate(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.payments', 1)]); + + flash($message)->success(); + + return redirect('expenses/payments/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Payment::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.payments', 2)]); + + flash($message)->success(); + + return redirect('expenses/payments'); + } + /** * Show the form for editing the specified resource. * diff --git a/app/Http/Controllers/Expenses/Vendors.php b/app/Http/Controllers/Expenses/Vendors.php index b407da365..6b06d28be 100644 --- a/app/Http/Controllers/Expenses/Vendors.php +++ b/app/Http/Controllers/Expenses/Vendors.php @@ -6,6 +6,7 @@ use App\Http\Controllers\Controller; use App\Http\Requests\Expense\Vendor as Request; use App\Models\Expense\Vendor; use App\Models\Setting\Currency; +use App\Utilities\ImportFile; class Vendors extends Controller { @@ -52,6 +53,49 @@ class Vendors extends Controller return redirect('expenses/vendors'); } + /** + * Duplicate the specified resource. + * + * @param Vendor $vendor + * + * @return Response + */ + public function duplicate(Vendor $vendor) + { + $clone = $vendor->duplicate(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.vendors', 1)]); + + flash($message)->success(); + + return redirect('expenses/vendors/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Vendor::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.vendors', 2)]); + + flash($message)->success(); + + return redirect('expenses/vendors'); + } + /** * Show the form for editing the specified resource. * @@ -122,4 +166,11 @@ class Vendors extends Controller return response()->json($vendor); } + + public function vendor(Request $request) + { + $vendor = Vendor::create($request->all()); + + return response()->json($vendor); + } } diff --git a/app/Http/Controllers/Incomes/Customers.php b/app/Http/Controllers/Incomes/Customers.php index 66ab45154..8ed42c8aa 100644 --- a/app/Http/Controllers/Incomes/Customers.php +++ b/app/Http/Controllers/Incomes/Customers.php @@ -7,6 +7,7 @@ use App\Http\Requests\Income\Customer as Request; use App\Models\Auth\User; use App\Models\Income\Customer; use App\Models\Setting\Currency; +use App\Utilities\ImportFile; class Customers extends Controller { @@ -47,33 +48,26 @@ class Customers extends Controller if (empty($request->input('create_user'))) { Customer::create($request->all()); } else { + // Check if user exist $user = User::where('email', $request['email'])->first(); - if (!empty($user)) { $message = trans('messages.error.customer', ['name' => $user->name]); flash($message)->error(); return redirect()->back()->withInput($request->except('create_user'))->withErrors( - ['email' => trans('customer.error.email')] + ['email' => trans('customers.error.email')] ); - - //$user = User::create($request->input()); } - $customer = Customer::create($request->all()); + // Create user first + $user = User::create($request->all()); + $user->roles()->attach(['3']); + $user->companies()->attach([session('company_id')]); $request['user_id'] = $user->id; - $request['roles'] = array('3'); - $request['companies'] = array(session('company_id')); - // Attach roles - $user->roles()->attach($request['roles']); - - // Attach companies - $user->companies()->attach($request['companies']); - - $customer->update($request->all()); + Customer::create($request->all()); } $message = trans('messages.success.added', ['type' => trans_choice('general.customers', 1)]); @@ -83,6 +77,49 @@ class Customers extends Controller return redirect('incomes/customers'); } + /** + * Duplicate the specified resource. + * + * @param Customer $customer + * + * @return Response + */ + public function duplicate(Customer $customer) + { + $clone = $customer->duplicate(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.customers', 1)]); + + flash($message)->success(); + + return redirect('incomes/customers/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Customer::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.customers', 2)]); + + flash($message)->success(); + + return redirect('incomes/customers'); + } + /** * Show the form for editing the specified resource. * @@ -110,29 +147,24 @@ class Customers extends Controller if (empty($request->input('create_user'))) { $customer->update($request->all()); } else { + // Check if user exist $user = User::where('email', $request['email'])->first(); - if (!empty($user)) { $message = trans('messages.error.customer', ['name' => $user->name]); flash($message)->error(); return redirect()->back()->withInput($request->except('create_user'))->withErrors( - ['email' => trans('customer.error.email')] + ['email' => trans('customers.error.email')] ); - - //$user = User::create($request->input()); } + // Create user first + $user = User::create($request->all()); + $user->roles()->attach(['3']); + $user->companies()->attach([session('company_id')]); + $request['user_id'] = $user->id; - $request['roles'] = array('3'); - $request['companies'] = array(session('company_id')); - - // Attach roles - $user->roles()->attach($request['roles']); - - // Attach companies - $user->companies()->attach($request['companies']); $customer->update($request->all()); } @@ -181,4 +213,11 @@ class Customers extends Controller return response()->json($customer); } + + public function customer(Request $request) + { + $customer = Customer::create($request->all()); + + return response()->json($customer); + } } diff --git a/app/Http/Controllers/Incomes/Invoices.php b/app/Http/Controllers/Incomes/Invoices.php index 765ddc94d..460913897 100644 --- a/app/Http/Controllers/Incomes/Invoices.php +++ b/app/Http/Controllers/Incomes/Invoices.php @@ -24,14 +24,16 @@ use App\Notifications\Income\Invoice as Notification; use App\Notifications\Item\Item as ItemNotification; use App\Traits\Currencies; use App\Traits\DateTime; +use App\Traits\Incomes; use App\Traits\Uploads; +use App\Utilities\ImportFile; use App\Utilities\Modules; use Date; use File; class Invoices extends Controller { - use DateTime, Currencies, Uploads; + use DateTime, Currencies, Incomes, Uploads; /** * Display a listing of the resource. @@ -100,11 +102,7 @@ class Invoices extends Controller $taxes = Tax::enabled()->pluck('name', 'id'); - // Generate next invoice number - $prefix = setting('general.invoice_number_prefix', 'INV-'); - $next = setting('general.invoice_number_next', '1'); - $digit = setting('general.invoice_number_digit', '5'); - $number = $prefix . str_pad($next, $digit, '0', STR_PAD_LEFT); + $number = $this->getNextInvoiceNumber(); return view('incomes.invoices.create', compact('customers', 'currencies', 'items', 'taxes', 'number')); } @@ -227,17 +225,17 @@ class Invoices extends Controller // Add invoice totals $this->addTotals($invoice, $request, $taxes, $sub_total, $tax_total); - $request['invoice_id'] = $invoice->id; - $request['status_code'] = 'draft'; - $request['notify'] = 0; - $request['description'] = trans('messages.success.added', ['type' => $request['invoice_number']]); - - InvoiceHistory::create($request->all()); + // Add invoice history + InvoiceHistory::create([ + 'company_id' => session('company_id'), + 'invoice_id' => $invoice->id, + 'status_code' => 'draft', + 'notify' => 0, + 'description' => trans('messages.success.added', ['type' => $invoice->invoice_number]), + ]); // Update next invoice number - $next = setting('general.invoice_number_next', 1) + 1; - setting(['general.invoice_number_next' => $next]); - setting()->save(); + $this->increaseNextInvoiceNumber(); // Fire the event to make it extendible event(new InvoiceCreated($invoice)); @@ -249,6 +247,61 @@ class Invoices extends Controller return redirect('incomes/invoices/' . $invoice->id); } + /** + * Duplicate the specified resource. + * + * @param Invoice $invoice + * + * @return Response + */ + public function duplicate(Invoice $invoice) + { + $clone = $invoice->duplicate(); + + // Add invoice history + InvoiceHistory::create([ + 'company_id' => session('company_id'), + 'invoice_id' => $clone->id, + 'status_code' => 'draft', + 'notify' => 0, + 'description' => trans('messages.success.added', ['type' => $clone->invoice_number]), + ]); + + // Update next invoice number + $this->increaseNextInvoiceNumber(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.invoices', 1)]); + + flash($message)->success(); + + return redirect('incomes/invoices/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Invoice::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.invoices', 2)]); + + flash($message)->success(); + + return redirect('incomes/invoices'); + } + /** * Show the form for editing the specified resource. * @@ -653,47 +706,41 @@ class Invoices extends Controller $sort_order = 1; // Added invoice total sub total - $invoice_sub_total = [ + InvoiceTotal::create([ 'company_id' => $request['company_id'], 'invoice_id' => $invoice->id, 'code' => 'sub_total', 'name' => 'invoices.sub_total', 'amount' => $sub_total, 'sort_order' => $sort_order, - ]; - - InvoiceTotal::create($invoice_sub_total); + ]); $sort_order++; // Added invoice total taxes if ($taxes) { foreach ($taxes as $tax) { - $invoice_tax_total = [ + InvoiceTotal::create([ 'company_id' => $request['company_id'], 'invoice_id' => $invoice->id, 'code' => 'tax', 'name' => $tax['name'], 'amount' => $tax['amount'], 'sort_order' => $sort_order, - ]; - - InvoiceTotal::create($invoice_tax_total); + ]); $sort_order++; } } // Added invoice total total - $invoice_total = [ + InvoiceTotal::create([ 'company_id' => $request['company_id'], 'invoice_id' => $invoice->id, 'code' => 'total', 'name' => 'invoices.total', 'amount' => $sub_total + $tax_total, 'sort_order' => $sort_order, - ]; - - InvoiceTotal::create($invoice_total); + ]); } } diff --git a/app/Http/Controllers/Incomes/Revenues.php b/app/Http/Controllers/Incomes/Revenues.php index 63f12770a..9bad9163e 100644 --- a/app/Http/Controllers/Incomes/Revenues.php +++ b/app/Http/Controllers/Incomes/Revenues.php @@ -12,6 +12,7 @@ use App\Models\Setting\Currency; use App\Traits\Currencies; use App\Traits\DateTime; use App\Traits\Uploads; +use App\Utilities\ImportFile; use App\Utilities\Modules; class Revenues extends Controller @@ -91,6 +92,49 @@ class Revenues extends Controller return redirect('incomes/revenues'); } + /** + * Duplicate the specified resource. + * + * @param Revenue $revenue + * + * @return Response + */ + public function duplicate(Revenue $revenue) + { + $clone = $revenue->duplicate(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.revenues', 1)]); + + flash($message)->success(); + + return redirect('incomes/revenues/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Revenue::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.revenues', 2)]); + + flash($message)->success(); + + return redirect('incomes/revenues'); + } + /** * Show the form for editing the specified resource. * diff --git a/app/Http/Controllers/Install/Requirements.php b/app/Http/Controllers/Install/Requirements.php index bd87542d9..3f76d7664 100644 --- a/app/Http/Controllers/Install/Requirements.php +++ b/app/Http/Controllers/Install/Requirements.php @@ -43,10 +43,6 @@ class Requirements extends Controller { $requirements = array(); - if (version_compare(PHP_VERSION, '5.6.4', '<')) { - $requirements[] = trans('install.requirements.php_version'); - } - if (ini_get('safe_mode')) { $requirements[] = trans('install.requirements.disabled', ['feature' => 'Safe Mode']); } diff --git a/app/Http/Controllers/Items/Items.php b/app/Http/Controllers/Items/Items.php index 70026d540..b3477aadf 100644 --- a/app/Http/Controllers/Items/Items.php +++ b/app/Http/Controllers/Items/Items.php @@ -9,6 +9,7 @@ use App\Models\Setting\Category; use App\Models\Setting\Currency; use App\Models\Setting\Tax; use App\Traits\Uploads; +use App\Utilities\ImportFile; class Items extends Controller { @@ -67,6 +68,49 @@ class Items extends Controller return redirect('items/items'); } + /** + * Duplicate the specified resource. + * + * @param Item $item + * + * @return Response + */ + public function duplicate(Item $item) + { + $clone = $item->duplicate(); + + $message = trans('messages.success.duplicated', ['type' => trans_choice('general.items', 1)]); + + flash($message)->success(); + + return redirect('items/items/' . $clone->id . '/edit'); + } + + /** + * Import the specified resource. + * + * @param ImportFile $import + * + * @return Response + */ + public function import(ImportFile $import) + { + $rows = $import->all(); + + foreach ($rows as $row) { + $data = $row->toArray(); + $data['company_id'] = session('company_id'); + + Item::create($data); + } + + $message = trans('messages.success.imported', ['type' => trans_choice('general.items', 2)]); + + flash($message)->success(); + + return redirect('items/items'); + } + /** * Show the form for editing the specified resource. * diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php index 7133a0ffc..ef110aed2 100644 --- a/app/Http/Controllers/Settings/Currencies.php +++ b/app/Http/Controllers/Settings/Currencies.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers\Settings; +use Akaunting\Money\Currency as MoneyCurrency; use App\Http\Controllers\Controller; use App\Http\Requests\Setting\Currency as Request; use App\Models\Banking\Account; use App\Models\Setting\Currency; -use ClickNow\Money\Currency as MoneyCurrency; class Currencies extends Controller { @@ -29,10 +29,18 @@ class Currencies extends Controller */ public function create() { + // Get current currencies + $current = Currency::pluck('code')->toArray(); + // Prepare codes $codes = array(); $currencies = MoneyCurrency::getCurrencies(); foreach ($currencies as $key => $item) { + // Don't show if already available + if (in_array($key, $current)) { + continue; + } + $codes[$key] = $key; } @@ -77,10 +85,18 @@ class Currencies extends Controller */ public function edit(Currency $currency) { + // Get current currencies + $current = Currency::pluck('code')->toArray(); + // Prepare codes $codes = array(); $currencies = MoneyCurrency::getCurrencies(); foreach ($currencies as $key => $item) { + // Don't show if already available + if (($key != $currency->code) && in_array($key, $current)) { + continue; + } + $codes[$key] = $key; } diff --git a/app/Listeners/Updates/Version110.php b/app/Listeners/Updates/Version110.php new file mode 100644 index 000000000..e8ebe934f --- /dev/null +++ b/app/Listeners/Updates/Version110.php @@ -0,0 +1,48 @@ +check($event)) { + return; + } + + // Create permission + $permission = Permission::firstOrCreate([ + 'name' => 'create-common-import', + 'display_name' => 'Create Common Import', + 'description' => 'Create Common Import', + ]); + + // Attach permission to roles + $roles = Role::all(); + + foreach ($roles as $role) { + $allowed = ['admin', 'manager']; + + if (!in_array($role->name, $allowed)) { + continue; + } + + $role->attachPermission($permission); + } + } +} diff --git a/app/Models/Expense/Bill.php b/app/Models/Expense/Bill.php index ea726b525..ca4dd2be7 100644 --- a/app/Models/Expense/Bill.php +++ b/app/Models/Expense/Bill.php @@ -5,11 +5,12 @@ namespace App\Models\Expense; use App\Models\Model; use App\Traits\Currencies; use App\Traits\DateTime; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Bill extends Model { - use Currencies, DateTime, Eloquence; + use Cloneable, Currencies, DateTime, Eloquence; protected $table = 'bills'; @@ -44,6 +45,13 @@ class Bill extends Model 'notes' => 2, ]; + /** + * Clonable relationships. + * + * @var array + */ + protected $cloneable_relations = ['items', 'totals']; + public function vendor() { return $this->belongsTo('App\Models\Expense\Vendor'); @@ -94,6 +102,11 @@ class Bill extends Model return $query->where('bill_status_code', '!=', 'new'); } + public function onCloning($src, $child = null) + { + $this->bill_status_code = 'draft'; + } + /** * Convert amount to double. * diff --git a/app/Models/Expense/Payment.php b/app/Models/Expense/Payment.php index 33d7da38e..ae3e230c8 100644 --- a/app/Models/Expense/Payment.php +++ b/app/Models/Expense/Payment.php @@ -5,11 +5,12 @@ namespace App\Models\Expense; use App\Models\Model; use App\Traits\Currencies; use App\Traits\DateTime; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Payment extends Model { - use Currencies, DateTime, Eloquence; + use Cloneable, Currencies, DateTime, Eloquence; protected $table = 'payments'; diff --git a/app/Models/Expense/Vendor.php b/app/Models/Expense/Vendor.php index 4911a4158..bc2090da0 100644 --- a/app/Models/Expense/Vendor.php +++ b/app/Models/Expense/Vendor.php @@ -3,11 +3,12 @@ namespace App\Models\Expense; use App\Models\Model; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Vendor extends Model { - use Eloquence; + use Cloneable, Eloquence; protected $table = 'vendors'; diff --git a/app/Models/Income/Customer.php b/app/Models/Income/Customer.php index 461bd5f16..9c32ecf88 100644 --- a/app/Models/Income/Customer.php +++ b/app/Models/Income/Customer.php @@ -3,13 +3,13 @@ namespace App\Models\Income; use App\Models\Model; +use Bkwld\Cloner\Cloneable; use Illuminate\Notifications\Notifiable; use Sofa\Eloquence\Eloquence; class Customer extends Model { - use Eloquence; - use Notifiable; + use Cloneable, Eloquence, Notifiable; protected $table = 'customers'; @@ -59,4 +59,9 @@ class Customer extends Model { return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id'); } + + public function onCloning($src, $child = null) + { + $this->user_id = null; + } } diff --git a/app/Models/Income/Invoice.php b/app/Models/Income/Invoice.php index 28765ce0b..b6874c858 100644 --- a/app/Models/Income/Invoice.php +++ b/app/Models/Income/Invoice.php @@ -5,11 +5,13 @@ namespace App\Models\Income; use App\Models\Model; use App\Traits\Currencies; use App\Traits\DateTime; +use App\Traits\Incomes; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Invoice extends Model { - use Currencies, DateTime, Eloquence; + use Cloneable, Currencies, DateTime, Eloquence, Incomes; protected $table = 'invoices'; @@ -44,6 +46,13 @@ class Invoice extends Model 'notes' => 2, ]; + /** + * Clonable relationships. + * + * @var array + */ + protected $cloneable_relations = ['items', 'totals']; + public function user() { return $this->belongsTo('App\Models\Auth\User', 'customer_id', 'id'); @@ -99,6 +108,12 @@ class Invoice extends Model return $query->where('invoice_status_code', '!=', 'draft'); } + public function onCloning($src, $child = null) + { + $this->invoice_status_code = 'draft'; + $this->invoice_number = $this->getNextInvoiceNumber(); + } + /** * Convert amount to double. * diff --git a/app/Models/Income/Revenue.php b/app/Models/Income/Revenue.php index 0299cabff..60c4f8b89 100644 --- a/app/Models/Income/Revenue.php +++ b/app/Models/Income/Revenue.php @@ -5,11 +5,12 @@ namespace App\Models\Income; use App\Models\Model; use App\Traits\Currencies; use App\Traits\DateTime; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Revenue extends Model { - use Currencies, DateTime, Eloquence; + use Cloneable, Currencies, DateTime, Eloquence; protected $table = 'revenues'; diff --git a/app/Models/Item/Item.php b/app/Models/Item/Item.php index a1008b0c3..9095186b9 100644 --- a/app/Models/Item/Item.php +++ b/app/Models/Item/Item.php @@ -3,14 +3,13 @@ namespace App\Models\Item; use App\Models\Model; -use App\Models\Expense\Bill; -use App\Models\Income\Invoice; use App\Traits\Currencies; +use Bkwld\Cloner\Cloneable; use Sofa\Eloquence\Eloquence; class Item extends Model { - use Currencies, Eloquence; + use Cloneable, Currencies, Eloquence; protected $table = 'items'; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index de24146b8..d40ac00eb 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,6 +18,7 @@ class EventServiceProvider extends ServiceProvider 'App\Listeners\Updates\Version107', 'App\Listeners\Updates\Version108', 'App\Listeners\Updates\Version109', + 'App\Listeners\Updates\Version110', ], 'Illuminate\Auth\Events\Login' => [ 'App\Listeners\Auth\Login', diff --git a/app/Traits/Currencies.php b/app/Traits/Currencies.php index bee742369..45a3f05e7 100644 --- a/app/Traits/Currencies.php +++ b/app/Traits/Currencies.php @@ -2,8 +2,8 @@ namespace App\Traits; -use ClickNow\Money\Money; -use ClickNow\Money\Currency; +use Akaunting\Money\Money; +use Akaunting\Money\Currency; trait Currencies { diff --git a/app/Traits/Incomes.php b/app/Traits/Incomes.php new file mode 100644 index 000000000..1e2dc80d6 --- /dev/null +++ b/app/Traits/Incomes.php @@ -0,0 +1,34 @@ + $next]); + setting()->save(); + } +} \ No newline at end of file diff --git a/app/Utilities/ImportFile.php b/app/Utilities/ImportFile.php new file mode 100644 index 000000000..fa43216aa --- /dev/null +++ b/app/Utilities/ImportFile.php @@ -0,0 +1,36 @@ +hasFile('import')) { + flash(trans('messages.error.no_file'))->error(); + + redirect()->back()->send(); + } + + $folder = session('company_id') . '/imports'; + + // Upload file + $path = Storage::path($request->import->store($folder)); + + return $path; + } + + public function getFilters() + { + return [ + 'chunk' + ]; + } + +} \ No newline at end of file diff --git a/app/Utilities/Modules.php b/app/Utilities/Modules.php index 9d773da17..f36adb8ce 100644 --- a/app/Utilities/Modules.php +++ b/app/Utilities/Modules.php @@ -11,14 +11,14 @@ use App\Events\PaymentGatewayListing; class Modules { - public static function getPaymentMethods() + public static function getPaymentMethods($type = null) { $payment_methods = Cache::get('payment_methods.admin'); $customer = auth()->user()->customer; - if ($customer) { + if ($customer && $type != 'all') { $payment_methods = Cache::get('payment_methods.customer'); } @@ -38,7 +38,7 @@ class Modules continue; } - if ($customer && empty($gateway['customer'])) { + if (($customer && empty($gateway['customer'])) && $type != 'all') { continue; } diff --git a/composer.json b/composer.json index 223a33da9..408c87be8 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,14 @@ "require": { "php": ">=5.6.4", "akaunting/language": "1.0.*", + "akaunting/money": "1.0.*", "akaunting/setting": "1.0.*", "akaunting/version": "1.0.*", "almasaeed2010/adminlte": "2.3.*", "barryvdh/laravel-debugbar": "2.3.*", "barryvdh/laravel-dompdf": "0.*", "barryvdh/laravel-ide-helper": "2.3.*", - "cknow/laravel-money": "1.0.*", + "bkwld/cloner": "3.2.*", "dingo/api": "1.0.0-beta8", "fzaninotto/faker": "1.6.*", "guzzlehttp/guzzle": "6.3.*", @@ -26,6 +27,7 @@ "laravel/framework": "5.4.*", "laravel/tinker": "~1.0", "LaravelCollective/html": "5.4.*", + "maatwebsite/excel": "2.1.*", "nwidart/laravel-menus": "0.5.*", "nwidart/laravel-modules": "1.*", "santigarcor/laratrust": "4.0.*", diff --git a/config/app.php b/config/app.php index 62d7f7ad9..803a21955 100644 --- a/config/app.php +++ b/config/app.php @@ -184,10 +184,11 @@ return [ * Vendor Service Providers... */ Akaunting\Language\Provider::class, + Akaunting\Money\Provider::class, Akaunting\Setting\Provider::class, Akaunting\Version\Provider::class, Barryvdh\DomPDF\ServiceProvider::class, - ClickNow\Money\MoneyServiceProvider::class, + Bkwld\Cloner\ServiceProvider::class, Collective\Html\HtmlServiceProvider::class, Dingo\Api\Provider\LaravelServiceProvider::class, EloquentFilter\ServiceProvider::class, @@ -197,6 +198,7 @@ return [ Kyslik\ColumnSortable\ColumnSortableServiceProvider::class, Laracasts\Flash\FlashServiceProvider::class, Laratrust\LaratrustServiceProvider::class, + Maatwebsite\Excel\ExcelServiceProvider::class, Nwidart\Menus\MenusServiceProvider::class, Nwidart\Modules\LaravelModulesServiceProvider::class, Sofa\Eloquence\ServiceProvider::class, @@ -257,6 +259,7 @@ return [ 'Debugbar' => Barryvdh\Debugbar\Facade::class, 'Date' => Jenssegers\Date\Date::class, 'DotenvEditor' => Jackiedo\DotenvEditor\Facades\DotenvEditor::class, + 'Excel' => Maatwebsite\Excel\Facades\Excel::class, 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, 'Image' => Intervention\Image\Facades\Image::class, diff --git a/config/excel.php b/config/excel.php new file mode 100644 index 000000000..3e682141b --- /dev/null +++ b/config/excel.php @@ -0,0 +1,704 @@ + [ + + /* + |-------------------------------------------------------------------------- + | Enable/Disable cell caching + |-------------------------------------------------------------------------- + */ + 'enable' => true, + + /* + |-------------------------------------------------------------------------- + | Caching driver + |-------------------------------------------------------------------------- + | + | Set the caching driver + | + | Available methods: + | memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3 + | + */ + 'driver' => 'memory', + + /* + |-------------------------------------------------------------------------- + | Cache settings + |-------------------------------------------------------------------------- + */ + 'settings' => [ + + 'memoryCacheSize' => '32MB', + 'cacheTime' => 600 + + ], + + /* + |-------------------------------------------------------------------------- + | Memcache settings + |-------------------------------------------------------------------------- + */ + 'memcache' => [ + + 'host' => 'localhost', + 'port' => 11211, + + ], + + /* + |-------------------------------------------------------------------------- + | Cache dir (for discISAM) + |-------------------------------------------------------------------------- + */ + + 'dir' => storage_path('cache') + ], + + 'properties' => [ + 'creator' => 'Akaunting', + 'lastModifiedBy' => 'Akaunting', + 'title' => 'Spreadsheet', + 'description' => 'Default spreadsheet export', + 'subject' => 'Spreadsheet export', + 'keywords' => 'akaunting, excel, export', + 'category' => 'Excel', + 'manager' => 'Akaunting', + 'company' => 'Akaunting', + ], + + /* + |-------------------------------------------------------------------------- + | Sheets settings + |-------------------------------------------------------------------------- + */ + 'sheets' => [ + + /* + |-------------------------------------------------------------------------- + | Default page setup + |-------------------------------------------------------------------------- + */ + 'pageSetup' => [ + 'orientation' => 'portrait', + 'paperSize' => '9', + 'scale' => '100', + 'fitToPage' => false, + 'fitToHeight' => true, + 'fitToWidth' => true, + 'columnsToRepeatAtLeft' => ['', ''], + 'rowsToRepeatAtTop' => [0, 0], + 'horizontalCentered' => false, + 'verticalCentered' => false, + 'printArea' => null, + 'firstPageNumber' => null, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Creator + |-------------------------------------------------------------------------- + | + | The default creator of a new Excel file + | + */ + + 'creator' => 'Akaunting', + + 'csv' => [ + /* + |-------------------------------------------------------------------------- + | Delimiter + |-------------------------------------------------------------------------- + | + | The default delimiter which will be used to read out a CSV file + | + */ + + 'delimiter' => ',', + + /* + |-------------------------------------------------------------------------- + | Enclosure + |-------------------------------------------------------------------------- + */ + + 'enclosure' => '"', + + /* + |-------------------------------------------------------------------------- + | Line endings + |-------------------------------------------------------------------------- + */ + + 'line_ending' => "\r\n", + + /* + |-------------------------------------------------------------------------- + | setUseBom + |-------------------------------------------------------------------------- + */ + + 'use_bom' => false + ], + + 'export' => [ + + /* + |-------------------------------------------------------------------------- + | Autosize columns + |-------------------------------------------------------------------------- + | + | Disable/enable column autosize or set the autosizing for + | an array of columns ( array('A', 'B') ) + | + */ + 'autosize' => true, + + /* + |-------------------------------------------------------------------------- + | Autosize method + |-------------------------------------------------------------------------- + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX + | The default is based on an estimate, which does its calculation based + | on the number of characters in the cell value (applying any calculation + | and format mask, and allowing for wordwrap and rotation) and with an + | "arbitrary" adjustment based on the font (Arial, Calibri or Verdana, + | defaulting to Calibri if any other font is used) and a proportional + | adjustment for the font size. + | + | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT + | The second method is more accurate, based on actual style formatting as + | well (bold, italic, etc), and is calculated by generating a gd2 imagettf + | bounding box and using its dimensions to determine the size; but this + | method is significantly slower, and its accuracy is still dependent on + | having the appropriate fonts installed. + | + */ + 'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX, + + /* + |-------------------------------------------------------------------------- + | Auto generate table heading + |-------------------------------------------------------------------------- + | + | If set to true, the array indices (or model attribute names) + | will automatically be used as first row (table heading) + | + */ + 'generate_heading_by_indices' => true, + + /* + |-------------------------------------------------------------------------- + | Auto set alignment on merged cells + |-------------------------------------------------------------------------- + */ + 'merged_cell_alignment' => 'left', + + /* + |-------------------------------------------------------------------------- + | Pre-calculate formulas during export + |-------------------------------------------------------------------------- + */ + 'calculate' => false, + + /* + |-------------------------------------------------------------------------- + | Include Charts during export + |-------------------------------------------------------------------------- + */ + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Default sheet settings + |-------------------------------------------------------------------------- + */ + 'sheets' => [ + + /* + |-------------------------------------------------------------------------- + | Default page margin + |-------------------------------------------------------------------------- + | + | 1) When set to false, default margins will be used + | 2) It's possible to enter a single margin which will + | be used for all margins. + | 3) Alternatively you can pass an array with 4 margins + | Default order: array(top, right, bottom, left) + | + */ + 'page_margin' => false, + + /* + |-------------------------------------------------------------------------- + | Value in source array that stands for blank cell + |-------------------------------------------------------------------------- + */ + 'nullValue' => null, + + /* + |-------------------------------------------------------------------------- + | Insert array starting from this cell address as the top left coordinate + |-------------------------------------------------------------------------- + */ + 'startCell' => 'A1', + + /* + |-------------------------------------------------------------------------- + | Apply strict comparison when testing for null values in the array + |-------------------------------------------------------------------------- + */ + 'strictNullComparison' => false + ], + + /* + |-------------------------------------------------------------------------- + | Store settings + |-------------------------------------------------------------------------- + */ + + 'store' => [ + + /* + |-------------------------------------------------------------------------- + | Path + |-------------------------------------------------------------------------- + | + | The path we want to save excel file to + | + */ + 'path' => storage_path('app/exports'), + + /* + |-------------------------------------------------------------------------- + | Return info + |-------------------------------------------------------------------------- + | + | Whether we want to return information about the stored file or not + | + */ + 'returnInfo' => false + + ], + + /* + |-------------------------------------------------------------------------- + | PDF Settings + |-------------------------------------------------------------------------- + */ + 'pdf' => [ + + /* + |-------------------------------------------------------------------------- + | PDF Drivers + |-------------------------------------------------------------------------- + | Supported: DomPDF, tcPDF, mPDF + */ + 'driver' => 'DomPDF', + + /* + |-------------------------------------------------------------------------- + | PDF Driver settings + |-------------------------------------------------------------------------- + */ + 'drivers' => [ + + /* + |-------------------------------------------------------------------------- + | DomPDF settings + |-------------------------------------------------------------------------- + */ + 'DomPDF' => [ + 'path' => base_path('vendor/dompdf/dompdf/') + ], + + /* + |-------------------------------------------------------------------------- + | tcPDF settings + |-------------------------------------------------------------------------- + */ + 'tcPDF' => [ + 'path' => base_path('vendor/tecnick.com/tcpdf/') + ], + + /* + |-------------------------------------------------------------------------- + | mPDF settings + |-------------------------------------------------------------------------- + */ + 'mPDF' => [ + 'path' => base_path('vendor/mpdf/mpdf/') + ], + ] + ] + ], + + 'filters' => [ + /* + |-------------------------------------------------------------------------- + | Register read filters + |-------------------------------------------------------------------------- + */ + + 'registered' => [ + 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter' + ], + + /* + |-------------------------------------------------------------------------- + | Enable certain filters for every file read + |-------------------------------------------------------------------------- + */ + + 'enabled' => [] + ], + + 'import' => [ + + /* + |-------------------------------------------------------------------------- + | Has heading + |-------------------------------------------------------------------------- + | + | The sheet has a heading (first) row which we can use as attribute names + | + | Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original + | + */ + + 'heading' => 'slugged', + + /* + |-------------------------------------------------------------------------- + | First Row with data or heading of data + |-------------------------------------------------------------------------- + | + | If the heading row is not the first row, or the data doesn't start + | on the first row, here you can change the start row. + | + */ + + 'startRow' => 1, + + /* + |-------------------------------------------------------------------------- + | Cell name word separator + |-------------------------------------------------------------------------- + | + | The default separator which is used for the cell names + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'separator' => '_', + + /* + |-------------------------------------------------------------------------- + | Slug whitelisting + |-------------------------------------------------------------------------- + | + | Here you can whitelist certain characters in the slug. + | E.g. user.last_name will not remove . and _ + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'slug_whitelist' => '._', + + /* + |-------------------------------------------------------------------------- + | Include Charts during import + |-------------------------------------------------------------------------- + */ + + 'includeCharts' => false, + + /* + |-------------------------------------------------------------------------- + | Sheet heading conversion + |-------------------------------------------------------------------------- + | + | Convert headings to ASCII + | Note: only applies to 'heading' settings 'true' && 'slugged' + | + */ + + 'to_ascii' => true, + + /* + |-------------------------------------------------------------------------- + | Import encoding + |-------------------------------------------------------------------------- + */ + + 'encoding' => [ + + 'input' => 'UTF-8', + 'output' => 'UTF-8' + + ], + + /* + |-------------------------------------------------------------------------- + | Calculate + |-------------------------------------------------------------------------- + | + | By default cells with formulas will be calculated. + | + */ + + 'calculate' => true, + + /* + |-------------------------------------------------------------------------- + | Ignore empty cells + |-------------------------------------------------------------------------- + | + | By default empty cells are not ignored + | + */ + + 'ignoreEmpty' => true, + + /* + |-------------------------------------------------------------------------- + | Force sheet collection + |-------------------------------------------------------------------------- + | + | For a sheet collection even when there is only 1 sheets. + | When set to false and only 1 sheet found, the parsed file will return + | a row collection instead of a sheet collection. + | When set to true, it will return a sheet collection instead. + | + */ + 'force_sheets_collection' => false, + + /* + |-------------------------------------------------------------------------- + | Date format + |-------------------------------------------------------------------------- + | + | The format dates will be parsed to + | + */ + + 'dates' => [ + + /* + |-------------------------------------------------------------------------- + | Enable/disable date formatting + |-------------------------------------------------------------------------- + */ + 'enabled' => true, + + /* + |-------------------------------------------------------------------------- + | Default date format + |-------------------------------------------------------------------------- + | + | If set to false, a carbon object will return + | + */ + 'format' => false, + + /* + |-------------------------------------------------------------------------- + | Date columns + |-------------------------------------------------------------------------- + */ + 'columns' => [] + ], + + /* + |-------------------------------------------------------------------------- + | Import sheets by config + |-------------------------------------------------------------------------- + */ + 'sheets' => [ + + /* + |-------------------------------------------------------------------------- + | Example sheet + |-------------------------------------------------------------------------- + | + | Example sheet "test" will grab the firstname at cell A2 + | + */ + + 'test' => [ + + 'firstname' => 'A2' + + ] + + ] + ], + + 'views' => [ + + /* + |-------------------------------------------------------------------------- + | Styles + |-------------------------------------------------------------------------- + | + | The default styles which will be used when parsing a view + | + */ + + 'styles' => [ + + /* + |-------------------------------------------------------------------------- + | Table headings + |-------------------------------------------------------------------------- + */ + 'th' => [ + 'font' => [ + 'bold' => true, + 'size' => 12, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Strong tags + |-------------------------------------------------------------------------- + */ + 'strong' => [ + 'font' => [ + 'bold' => true, + 'size' => 12, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Bold tags + |-------------------------------------------------------------------------- + */ + 'b' => [ + 'font' => [ + 'bold' => true, + 'size' => 12, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Italic tags + |-------------------------------------------------------------------------- + */ + 'i' => [ + 'font' => [ + 'italic' => true, + 'size' => 12, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 1 + |-------------------------------------------------------------------------- + */ + 'h1' => [ + 'font' => [ + 'bold' => true, + 'size' => 24, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 2 + |-------------------------------------------------------------------------- + */ + 'h2' => [ + 'font' => [ + 'bold' => true, + 'size' => 18, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 3 + |-------------------------------------------------------------------------- + */ + 'h3' => [ + 'font' => [ + 'bold' => true, + 'size' => 13.5, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 4 + |-------------------------------------------------------------------------- + */ + 'h4' => [ + 'font' => [ + 'bold' => true, + 'size' => 12, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 5 + |-------------------------------------------------------------------------- + */ + 'h5' => [ + 'font' => [ + 'bold' => true, + 'size' => 10, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Heading 6 + |-------------------------------------------------------------------------- + */ + 'h6' => [ + 'font' => [ + 'bold' => true, + 'size' => 7.5, + ] + ], + + /* + |-------------------------------------------------------------------------- + | Hyperlinks + |-------------------------------------------------------------------------- + */ + 'a' => [ + 'font' => [ + 'underline' => true, + 'color' => ['argb' => 'FF0000FF'], + ] + ], + + /* + |-------------------------------------------------------------------------- + | Horizontal rules + |-------------------------------------------------------------------------- + */ + 'hr' => [ + 'borders' => [ + 'bottom' => [ + 'style' => 'thin', + 'color' => ['FF000000'] + ], + ] + ] + ] + + ] + +); diff --git a/config/language.php b/config/language.php index d8184b026..21d8d3a37 100644 --- a/config/language.php +++ b/config/language.php @@ -115,7 +115,7 @@ return [ | */ - 'allowed' => ['en-GB', 'de-DE', 'es-ES', 'fa-IR', 'fr-FR', 'pt-BR', 'ru-RU', 'sq-AL', 'tr-TR', 'zh-TW'], + 'allowed' => ['en-GB', 'de-DE', 'es-ES', 'fa-IR', 'fr-FR', 'nl-NL', 'pt-BR', 'ru-RU', 'sq-AL', 'tr-TR', 'vi-VN', 'zh-TW'], /* |-------------------------------------------------------------------------- diff --git a/config/clicknow.money.php b/config/money.php similarity index 100% rename from config/clicknow.money.php rename to config/money.php diff --git a/database/seeds/Roles.php b/database/seeds/Roles.php index fc3005018..db424e010 100644 --- a/database/seeds/Roles.php +++ b/database/seeds/Roles.php @@ -35,6 +35,7 @@ class Roles extends Seeder 'auth-permissions' => 'c,r,u,d', 'auth-profile' => 'r,u', 'companies-companies' => 'c,r,u,d', + 'common-import' => 'c', 'items-items' => 'c,r,u,d', 'incomes-invoices' => 'c,r,u,d', 'incomes-revenues' => 'c,r,u,d', @@ -64,6 +65,7 @@ class Roles extends Seeder 'admin-panel' => 'r', 'auth-profile' => 'r,u', 'companies-companies' => 'c,r,u,d', + 'common-import' => 'c', 'items-items' => 'c,r,u,d', 'incomes-invoices' => 'c,r,u,d', 'incomes-revenues' => 'c,r,u,d', diff --git a/index.php b/index.php index 61339a274..6f29ad120 100644 --- a/index.php +++ b/index.php @@ -6,6 +6,14 @@ * @link https://akaunting.com */ +// Define minimum supported PHP version +define('AKAUNTING_PHP', '5.6.4'); + +// Check PHP version +if (version_compare(PHP_VERSION, AKAUNTING_PHP, '<')) { + die('Your host needs to use PHP ' . AKAUNTING_PHP . ' or higher to run Akaunting'); +} + // Register the auto-loader require(__DIR__.'/bootstrap/autoload.php'); diff --git a/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php b/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php index 9b702ed82..541a5c57c 100644 --- a/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php +++ b/modules/OfflinePayment/Resources/lang/en-GB/offlinepayment.php @@ -10,4 +10,7 @@ return [ 'order' => 'Order', 'payment_gateways' => 'Offline Payment Methods', + 'confirm' => 'Confirm', + 'loading' => 'Loading', + ]; diff --git a/modules/OfflinePayment/Resources/views/edit.blade.php b/modules/OfflinePayment/Resources/views/edit.blade.php index 99305c2f1..97caf406b 100644 --- a/modules/OfflinePayment/Resources/views/edit.blade.php +++ b/modules/OfflinePayment/Resources/views/edit.blade.php @@ -3,82 +3,84 @@ @section('title', trans('offlinepayment::offlinepayment.offlinepayment')) @section('content') -
{{ trans('general.name') }} | -{{ trans('offlinepayment::offlinepayment.code') }} | -{{ trans('offlinepayment::offlinepayment.order') }} | -{{ trans('general.actions') }} | -
---|---|---|---|
{{ $item->name }} | -{{ $item->code }} | -{{ $item->order }} | -- - - | -
{{ trans('general.name') }} | +{{ trans('offlinepayment::offlinepayment.code') }} | +{{ trans('offlinepayment::offlinepayment.order') }} | +{{ trans('general.actions') }} | +
---|---|---|---|
{{ $item->name }} | +{{ $item->code }} | +{{ $item->order }} | ++ + + | +
:message
') !!} +