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

Bug fixes

This commit is contained in:
Hillel Coren 2015-12-30 20:45:52 +02:00
parent dbf2ec5e13
commit 565b26ba27
5 changed files with 37 additions and 13 deletions

View File

@ -3,7 +3,6 @@ APP_DEBUG=false
APP_URL=http://ninja.dev
APP_CIPHER=rijndael-128
APP_KEY=SomeRandomString
APP_TIMEZONE
DB_TYPE=mysql
DB_STRICT=false

View File

@ -495,7 +495,6 @@ class PaymentController extends BaseController
if (!$token) {
$token = Session::pull('transaction_reference');
}
if (!$token) {
return redirect(NINJA_WEB_URL);
}
@ -505,7 +504,17 @@ class PaymentController extends BaseController
$client = $invoice->client;
$account = $client->account;
$accountGateway = $account->getGatewayByType(Session::get($invitation->id . 'payment_type'));
if ($payerId) {
$paymentType = PAYMENT_TYPE_PAYPAL;
} else {
$paymentType = Session::get($invitation->id . 'payment_type');
}
if (!$paymentType) {
$this->error('No-Payment-Type', false, false);
return Redirect::to($invitation->getLink());
}
$accountGateway = $account->getGatewayByType($paymentType);
$gateway = $this->paymentService->createGateway($accountGateway);
// Check for Dwolla payment error
@ -588,7 +597,7 @@ class PaymentController extends BaseController
return Redirect::to('payments');
}
private function error($type, $error, $accountGateway, $exception = false)
private function error($type, $error, $accountGateway = false, $exception = false)
{
$message = '';
if ($accountGateway && $accountGateway->gateway) {

View File

@ -207,12 +207,26 @@ class Account extends Eloquent
public function getDateTime($date = 'now')
{
return new \DateTime($date, new \DateTimeZone($this->getTimezone()));
if ( ! $date) {
return null;
} elseif ( ! $date instanceof \DateTime) {
$date = new \DateTime($date);
}
$date->setTimeZone(new \DateTimeZone($this->getTimezone()));
return $date;
}
public function getCustomDateFormat()
{
return $this->date_format ? $this->date_format->format : DEFAULT_DATE_FORMAT;
$format = $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT;
if ($this->military_time) {
$format = str_replace('g:i a', 'H:i', $format);
}
return $format;
}
public function formatMoney($amount, $client = null, $hideSymbol = false)
@ -238,10 +252,10 @@ class Account extends Eloquent
public function formatDate($date)
{
$date = $this->getDateTime($date);
if ( ! $date) {
return null;
} elseif ( ! $date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $date->format($this->getCustomDateFormat());
@ -249,10 +263,10 @@ class Account extends Eloquent
public function formatDateTime($date)
{
$date = $this->getDateTime($date);
if ( ! $date) {
return null;
} elseif ( ! $date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $date->format($this->getCustomDateTimeFormat());
@ -260,10 +274,10 @@ class Account extends Eloquent
public function formatTime($date)
{
$date = $this->getDateTime($date);
if ( ! $date) {
return null;
} elseif ( ! $date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $date->format($this->getCustomTimeFormat());
@ -276,7 +290,7 @@ class Account extends Eloquent
public function getCustomDateTimeFormat()
{
return $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT;
return $this->getCustomDateFormat() . ' ' . $this->getCustomTimeFormat();
}
public function getGatewayByType($type = PAYMENT_TYPE_ANY)

View File

@ -120,6 +120,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Rwandan Franc', 'code' => 'RWF', 'symbol' => 'RF ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['name' => 'Tanzanian Shilling', 'code' => 'TZS', 'symbol' => 'TSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
['name' => 'Netherlands Antillean Guilder', 'code' => 'ANG', 'symbol' => 'ANG ', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],
['name' => 'Trinidad and Tobago Dollar', 'code' => 'TTD', 'symbol' => 'TT$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
];
foreach ($currencies as $currency) {

View File

@ -3,6 +3,7 @@
@section('head')
@parent
@include('money_script')
<script src="{{ asset('js/pdf.built.js') }}" type="text/javascript"></script>
<script>