From 0f5adbf62a4cd4fcd2787adef08d85d01a195c6a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 25 May 2014 21:38:40 +0300 Subject: [PATCH] Bug fixes --- app/controllers/ActivityController.php | 4 ++-- app/controllers/ClientController.php | 4 ++-- app/controllers/PaymentController.php | 6 +++-- app/lang/de/texts.php | 1 + app/lang/en/texts.php | 1 + app/lang/es/texts.php | 1 + app/lang/fr/texts.php | 1 + app/lang/it/texts.php | 1 + app/lang/nl/texts.php | 1 + app/lang/pt_BR/texts.php | 1 + app/ninja/repositories/InvoiceRepository.php | 23 +++++++++++++++----- app/routes.php | 5 ++--- app/views/accounts/payments.blade.php | 6 +++-- app/views/master.blade.php | 5 ++++- app/views/public/header.blade.php | 2 +- 15 files changed, 43 insertions(+), 19 deletions(-) diff --git a/app/controllers/ActivityController.php b/app/controllers/ActivityController.php index f647dd604926..d66607550d59 100755 --- a/app/controllers/ActivityController.php +++ b/app/controllers/ActivityController.php @@ -8,11 +8,11 @@ class ActivityController extends \BaseController { ->join('clients', 'clients.id', '=', 'activities.client_id') ->where('clients.public_id', '=', $clientPublicId) ->where('activities.account_id', '=', Auth::user()->account_id) - ->select('activities.message', 'activities.created_at', 'clients.currency_id', 'activities.balance', 'activities.adjustment'); + ->select('activities.id', 'activities.message', 'activities.created_at', 'clients.currency_id', 'activities.balance', 'activities.adjustment'); return Datatable::query($query) //->addColumn('blank', function($model) { return ''; }) - ->addColumn('created_at', function($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); }) + ->addColumn('id', function($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); }) ->addColumn('message', function($model) { return Utils::decodeActivity($model->message); }) ->addColumn('balance', function($model) { return Utils::formatMoney($model->balance, $model->currency_id); }) ->addColumn('adjustment', function($model) { return $model->adjustment != 0 ? Utils::formatMoney($model->adjustment, $model->currency_id) : ''; }) diff --git a/app/controllers/ClientController.php b/app/controllers/ClientController.php index ec52bc577456..08b878c8bd22 100755 --- a/app/controllers/ClientController.php +++ b/app/controllers/ClientController.php @@ -99,7 +99,7 @@ class ClientController extends \BaseController { 'showBreadcrumbs' => false, 'client' => $client, 'credit' => $client->getTotalCredit(), - 'title' => '- ' . $client->getDisplayName(), + 'title' => '- ' . trans('texts.view_client'), 'hasRecurringInvoices' => Invoice::scope()->where('is_recurring', '=', true)->whereClientId($client->id)->count() > 0 ); @@ -142,7 +142,7 @@ class ClientController extends \BaseController { 'client' => $client, 'method' => 'PUT', 'url' => 'clients/' . $publicId, - 'title' => '- ' . $client->name + 'title' => '- ' . trans('texts.edit_client') ]; $data = array_merge($data, self::getViewModel()); diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index b520599ac7eb..bdc49f3cd267 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -105,7 +105,7 @@ class PaymentController extends \BaseController $config = json_decode($accountGateway->config); /* - $gateway->setSolutionType ("Sole"); + $gateway->setSolutionType("Sole"); $gateway->setLandingPage("Billing"); */ @@ -120,11 +120,13 @@ class PaymentController extends \BaseController $gateway->$function($val); } + /* if (!Utils::isProd()) { $gateway->setTestMode(true); } - + */ + return $gateway; } diff --git a/app/lang/de/texts.php b/app/lang/de/texts.php index e2a016554695..66c9b6ca61cc 100644 --- a/app/lang/de/texts.php +++ b/app/lang/de/texts.php @@ -360,6 +360,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php index a11045828d87..8fc8ece4e4ef 100644 --- a/app/lang/en/texts.php +++ b/app/lang/en/texts.php @@ -374,6 +374,7 @@ return array( 'clone_quote' => 'Clone Quote', 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', + 'view_client' => 'View Client', 'view_quote' => 'View Quote', 'updated_quote' => 'Successfully updated quote', diff --git a/app/lang/es/texts.php b/app/lang/es/texts.php index 74e268cbae45..dd1812ebb408 100644 --- a/app/lang/es/texts.php +++ b/app/lang/es/texts.php @@ -358,6 +358,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/lang/fr/texts.php b/app/lang/fr/texts.php index 250c666d7a87..4cffdd16d1a0 100644 --- a/app/lang/fr/texts.php +++ b/app/lang/fr/texts.php @@ -360,6 +360,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/lang/it/texts.php b/app/lang/it/texts.php index 9d6de7f2ba45..008a5c20e7d9 100644 --- a/app/lang/it/texts.php +++ b/app/lang/it/texts.php @@ -360,6 +360,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/lang/nl/texts.php b/app/lang/nl/texts.php index 84b9dcaaf2a7..c1ca2cb0e363 100644 --- a/app/lang/nl/texts.php +++ b/app/lang/nl/texts.php @@ -361,6 +361,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/texts.php index c0069f713f37..1e0f21977f1b 100644 --- a/app/lang/pt_BR/texts.php +++ b/app/lang/pt_BR/texts.php @@ -349,6 +349,7 @@ return array( 'convert_to_invoice' => 'Convert to Invoice', 'view_invoice' => 'View Invoice', 'view_quote' => 'View Quote', + 'view_client' => 'View Client', 'updated_quote' => 'Successfully updated quote', 'created_quote' => 'Successfully created quote', diff --git a/app/ninja/repositories/InvoiceRepository.php b/app/ninja/repositories/InvoiceRepository.php index c68c7b45c45f..c9152e3802df 100755 --- a/app/ninja/repositories/InvoiceRepository.php +++ b/app/ninja/repositories/InvoiceRepository.php @@ -198,13 +198,24 @@ class InvoiceRepository $invoice->client_id = $data['client_id']; $invoice->discount = Utils::parseFloat($data['discount']); $invoice->invoice_number = trim($data['invoice_number']); - $invoice->invoice_date = Utils::toSqlDate($data['invoice_date']); - $invoice->due_date = Utils::toSqlDate($data['due_date']); - $invoice->is_recurring = $data['is_recurring'] ? true : false; - $invoice->frequency_id = $data['frequency_id'] ? $data['frequency_id'] : 0; - $invoice->start_date = Utils::toSqlDate($data['start_date']); - $invoice->end_date = Utils::toSqlDate($data['end_date']); + $invoice->invoice_date = Utils::toSqlDate($data['invoice_date']); + + if ($invoice->is_recurring) + { + $invoice->frequency_id = $data['frequency_id'] ? $data['frequency_id'] : 0; + $invoice->start_date = Utils::toSqlDate($data['start_date']); + $invoice->end_date = Utils::toSqlDate($data['end_date']); + $invoice->due_date = null; + } + else + { + $invoice->due_date = Utils::toSqlDate($data['due_date']); + $invoice->frequency_id = 0; + $invoice->start_date = null; + $invoice->end_date = null; + } + $invoice->terms = trim($data['terms']); $invoice->public_notes = trim($data['public_notes']); $invoice->po_number = trim($data['po_number']); diff --git a/app/routes.php b/app/routes.php index 4ab13b1203be..e0ef2efdce65 100755 --- a/app/routes.php +++ b/app/routes.php @@ -126,8 +126,6 @@ Route::group(array('prefix' => 'api/v1', 'before' => 'auth.basic'), function() Route::resource('clients', 'ClientApiController'); }); -// If you're self hosting set this to a value you think is fair -define('PRO_PLAN_PRICE', 50); define('CONTACT_EMAIL', 'contact@invoiceninja.com'); define('CONTACT_NAME', 'Invoice Ninja'); @@ -217,7 +215,8 @@ define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h'); define('NINJA_GATEWAY_ID', GATEWAY_AUTHORIZE_NET); define('NINJA_GATEWAY_CONFIG', '{"apiLoginId":"626vWcD5","transactionKey":"4bn26TgL9r4Br4qJ","testMode":"","developerMode":""}'); define('NINJA_URL', 'https://www.invoiceninja.com'); -define('NINJA_VERSION', '1.1.0'); +define('NINJA_VERSION', '1.2.0'); +define('PRO_PLAN_PRICE', 50); /* diff --git a/app/views/accounts/payments.blade.php b/app/views/accounts/payments.blade.php index 7150a5549388..6fdaf446fd50 100755 --- a/app/views/accounts/payments.blade.php +++ b/app/views/accounts/payments.blade.php @@ -74,8 +74,10 @@ } function gatewayLink(url) { - //if (url.match('authorize')) - openUrl(url, '/affiliate/' + new URL(url).hostname); + var host = new URL(url).hostname; + if (host) { + openUrl(url, '/affiliate/' + host); + } } $(document).ready(function() { diff --git a/app/views/master.blade.php b/app/views/master.blade.php index 1ace6a7867ef..db3a3b1c679d 100755 --- a/app/views/master.blade.php +++ b/app/views/master.blade.php @@ -1,8 +1,11 @@ - Invoice Ninja {{ isset($title) ? $title : ' - Free and Open-Source Online Invoicing' }} + Invoice Ninja {{ isset($title) ? $title : ' - Free and Open-Source Online Invoicing' }} + + + diff --git a/app/views/public/header.blade.php b/app/views/public/header.blade.php index a405eca304b1..020f8c3b1f97 100644 --- a/app/views/public/header.blade.php +++ b/app/views/public/header.blade.php @@ -430,7 +430,7 @@

Safe & Secure


- +