From f739976de224b4b1a038719cec1218b702517b22 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 4 Dec 2016 11:47:58 +0200 Subject: [PATCH] Fix for gateway type in buy now buttons --- app/Http/Controllers/AccountController.php | 11 +++++++++-- app/Libraries/Utils.php | 2 +- ...6_02_01_135956_add_source_currency_to_expenses.php | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 54475fbb6983..276d9388b183 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -641,11 +641,18 @@ class AccountController extends BaseController ); } - $types = [GATEWAY_TYPE_CREDIT_CARD, GATEWAY_TYPE_BANK_TRANSFER, GATEWAY_TYPE_PAYPAL, GATEWAY_TYPE_BITCOIN, GATEWAY_TYPE_DWOLLA]; + $types = [ + GATEWAY_TYPE_CREDIT_CARD, + GATEWAY_TYPE_BANK_TRANSFER, + GATEWAY_TYPE_PAYPAL, + GATEWAY_TYPE_BITCOIN, + GATEWAY_TYPE_DWOLLA + ]; $options = []; foreach ($types as $type) { if ($account->getGatewayByType($type)) { - $options[$type] = trans("texts.{$type}"); + $alias = GatewayType::getAliasFromId($type); + $options[$alias] = trans("texts.{$alias}"); } } diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index 2dede0e95dab..d86ea881e602 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -725,7 +725,7 @@ class Utils } elseif ($model->first_name || $model->last_name) { return $model->first_name.' '.$model->last_name; } else { - return $model->email; + return $model->email ?: ''; } } diff --git a/database/migrations/2016_02_01_135956_add_source_currency_to_expenses.php b/database/migrations/2016_02_01_135956_add_source_currency_to_expenses.php index a4b1fa62436b..c39a722af01f 100644 --- a/database/migrations/2016_02_01_135956_add_source_currency_to_expenses.php +++ b/database/migrations/2016_02_01_135956_add_source_currency_to_expenses.php @@ -21,7 +21,7 @@ class AddSourceCurrencyToExpenses extends Migration $table->renameColumn('currency_id', 'invoice_currency_id'); } - $table->unsignedInteger('expense_currency_id'); + $table->unsignedInteger('expense_currency_id')->nullable(); }); Schema::table('expenses', function (Blueprint $table) {