1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Enabled setting the transaction reference field when creating a payment

This commit is contained in:
Hillel Coren 2014-05-08 20:16:00 +03:00
parent cde2da6f6c
commit 7b86aea0a7
11 changed files with 31986 additions and 20 deletions

View File

@ -38,7 +38,7 @@ class PaymentController extends \BaseController
} }
$table->addColumn('transaction_reference', function($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>'; }) $table->addColumn('transaction_reference', function($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>'; })
->addColumn('payment_type', function($model) { return $model->payment_type ? $model->payment_type : ($model->transaction_reference ? '<i>Online payment</i>' : ''); }); ->addColumn('payment_type', function($model) { return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : ''); });
return $table->addColumn('amount', function($model) { return Utils::formatMoney($model->amount, $model->currency_id); }) return $table->addColumn('amount', function($model) { return Utils::formatMoney($model->amount, $model->currency_id); })
->addColumn('payment_date', function($model) { return Utils::dateToString($model->payment_date); }) ->addColumn('payment_date', function($model) { return Utils::dateToString($model->payment_date); })

View File

@ -46,6 +46,7 @@ class ConstantsSeeder extends Seeder
PaymentType::create(array('name' => 'Credit Card Other')); PaymentType::create(array('name' => 'Credit Card Other'));
PaymentType::create(array('name' => 'PayPal')); PaymentType::create(array('name' => 'PayPal'));
PaymentType::create(array('name' => 'Google Wallet')); PaymentType::create(array('name' => 'Google Wallet'));
PaymentType::create(array('name' => 'Check'));
Theme::create(array('name' => 'amelia')); Theme::create(array('name' => 'amelia'));
Theme::create(array('name' => 'cerulean')); Theme::create(array('name' => 'cerulean'));

View File

@ -219,7 +219,7 @@ class Utils
return $date->format($format); return $date->format($format);
} }
public static function toSqlDate($date) public static function toSqlDate($date, $formatResult = true)
{ {
if (!$date) if (!$date)
{ {
@ -229,10 +229,12 @@ class Utils
$timezone = Session::get(SESSION_TIMEZONE); $timezone = Session::get(SESSION_TIMEZONE);
$format = Session::get(SESSION_DATE_FORMAT); $format = Session::get(SESSION_DATE_FORMAT);
return DateTime::createFromFormat($format, $date, new DateTimeZone($timezone))->format('Y-m-d');
$dateTime = DateTime::createFromFormat($format, $date, new DateTimeZone($timezone));
return $formatResult ? $dateTime->format('Y-m-d') : $dateTime;
} }
public static function fromSqlDate($date) public static function fromSqlDate($date, $formatResult = true)
{ {
if (!$date || $date == '0000-00-00') if (!$date || $date == '0000-00-00')
{ {
@ -241,8 +243,9 @@ class Utils
$timezone = Session::get(SESSION_TIMEZONE); $timezone = Session::get(SESSION_TIMEZONE);
$format = Session::get(SESSION_DATE_FORMAT); $format = Session::get(SESSION_DATE_FORMAT);
return DateTime::createFromFormat('Y-m-d', $date, new DateTimeZone($timezone))->format($format); $dateTime = DateTime::createFromFormat('Y-m-d', $date, new DateTimeZone($timezone));
return $formatResult ? $dateTime->format($format) : $dateTime;
} }
public static function today($formatResult = true) public static function today($formatResult = true)

View File

@ -99,6 +99,7 @@ class PaymentRepository
$payment->payment_type_id = $paymentTypeId; $payment->payment_type_id = $paymentTypeId;
$payment->payment_date = Utils::toSqlDate($input['payment_date']); $payment->payment_date = Utils::toSqlDate($input['payment_date']);
$payment->amount = $amount; $payment->amount = $amount;
$payment->transaction_reference = trim($input['transaction_reference']);
$payment->save(); $payment->save();
return $payment; return $payment;

View File

@ -1,23 +1,22 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Invoice Ninja {{ isset($title) ? $title : ' - Free Online Invoicing' }}</title> <title>Invoice Ninja {{ isset($title) ? $title : ' - Free Online Invoicing' }}</title>
<link rel="canonical" href="https://www.invoiceninja.com"></link>
<link href="{{ asset('favicon.ico') }}" rel="icon" type="image/x-icon">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,900,100' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' rel='stylesheet' type='text/css'>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:site_name" content="Invoice Ninja"></meta> <meta property="og:site_name" content="Invoice Ninja"></meta>
<meta property="og:url" content="https://www.invoiceninja.com"></meta> <meta property="og:url" content="https://www.invoiceninja.com"></meta>
<meta property="og:title" content="Invoice Ninja"></meta> <meta property="og:title" content="Invoice Ninja"></meta>
<meta property="og:image" content="https://www.invoiceninja.com/images/social.jpg"></meta> <meta property="og:image" content="https://www.invoiceninja.com/images/social.jpg"></meta>
<meta property="og:description" content="Simple, Intuitive Invoicing."></meta> <meta property="og:description" content="Simple, Intuitive Invoicing."></meta>
<meta name="keywords" content="Invoice Ninja"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,900,100' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700' rel='stylesheet' type='text/css'>
<link href="{{ asset('favicon.ico') }}" rel="icon" type="image/x-icon">
<link href="https://www.invoiceninja.com" rel="canonical"></link>
<script src="{{ asset('built.js') }}" type="text/javascript"></script> <script src="{{ asset('built.js') }}" type="text/javascript"></script>

View File

@ -11,7 +11,7 @@
{{ Former::open($url)->addClass('col-md-10 col-md-offset-1 warn-on-exit')->method($method)->rules(array( {{ Former::open($url)->addClass('col-md-10 col-md-offset-1 warn-on-exit')->method($method)->rules(array(
'client' => 'required', 'client' => 'required',
'invoice' => 'required', 'invoice' => 'required',
'amount' => 'required', 'amount' => 'required',
)); }} )); }}
<div class="row"> <div class="row">
@ -23,6 +23,7 @@
{{ Former::select('payment_type_id')->addOption('','') {{ Former::select('payment_type_id')->addOption('','')
->fromQuery($paymentTypes, 'name', 'id') }} ->fromQuery($paymentTypes, 'name', 'id') }}
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }} {{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar"></i>') }}
{{ Former::text('transaction_reference') }}
{{-- Former::select('currency_id')->addOption('','') {{-- Former::select('currency_id')->addOption('','')
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}} ->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) --}}

View File

@ -11,7 +11,7 @@
<p>&nbsp;</p> <p>&nbsp;</p>
<div class="row"> <div class="row">
<div class="col-lg-3"> <div class="col-lg-4">
{{ Former::open() }} {{ Former::open() }}
{{ Former::populateField('start_date', $startDate) }} {{ Former::populateField('start_date', $startDate) }}
@ -38,7 +38,7 @@
</div> </div>
</div> </div>
<div class="col-lg-9"> <div class="col-lg-8">
<canvas id="monthly-reports" width="850" height="400"></canvas> <canvas id="monthly-reports" width="850" height="400"></canvas>
</div> </div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 216 KiB