From 9d96a9daed13e89190fed4b9082de9ff595b7925 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 3 Sep 2015 10:32:39 +0300 Subject: [PATCH] Bug fixes --- app/Http/Controllers/TaskController.php | 22 ++++------------------ app/Http/routes.php | 1 + app/Libraries/Utils.php | 9 +++++++++ app/Ninja/Mailers/Mailer.php | 1 + app/Providers/AppServiceProvider.php | 7 ++----- resources/views/list.blade.php | 7 +++---- resources/views/tasks/edit.blade.php | 2 +- 7 files changed, 21 insertions(+), 28 deletions(-) diff --git a/app/Http/Controllers/TaskController.php b/app/Http/Controllers/TaskController.php index 4475360b150f..cfa3d5fa8666 100644 --- a/app/Http/Controllers/TaskController.php +++ b/app/Http/Controllers/TaskController.php @@ -36,8 +36,6 @@ class TaskController extends BaseController */ public function index() { - self::checkTimezone(); - return View::make('list', array( 'entityType' => ENTITY_TASK, 'title' => trans('texts.tasks'), @@ -128,16 +126,14 @@ class TaskController extends BaseController */ public function create($clientPublicId = 0) { - self::checkTimezone(); - $data = [ 'task' => null, 'clientPublicId' => Input::old('client') ? Input::old('client') : $clientPublicId, 'method' => 'POST', 'url' => 'tasks', 'title' => trans('texts.new_task'), - 'timezone' => Auth::user()->account->timezone->name, - 'datetimeFormat' => Auth::user()->account->datetime_format ? Auth::user()->account->datetime_format->format_moment : 'DD/MMM/YYYY h:mm:ss a' + 'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE, + 'datetimeFormat' => Auth::user()->account->datetime_format ? Auth::user()->account->datetime_format->format_moment : DEFAULT_DATETIME_MOMENT_FORMAT ]; $data = array_merge($data, self::getViewModel()); @@ -153,8 +149,6 @@ class TaskController extends BaseController */ public function edit($publicId) { - self::checkTimezone(); - $task = Task::scope($publicId)->with('client', 'invoice')->firstOrFail(); $actions = []; @@ -187,8 +181,8 @@ class TaskController extends BaseController 'title' => trans('texts.edit_task'), 'duration' => $task->is_running ? $task->getCurrentDuration() : $task->getDuration(), 'actions' => $actions, - 'timezone' => Auth::user()->account->timezone->name, - 'datetimeFormat' => Auth::user()->account->datetime_format ? Auth::user()->account->datetime_format->format_moment : 'DD/MMM/YYYY h:mm:ss a' + 'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE, + 'datetimeFormat' => Auth::user()->account->datetime_format ? Auth::user()->account->datetime_format->format_moment : DEFAULT_DATETIME_MOMENT_FORMAT ]; $data = array_merge($data, self::getViewModel()); @@ -287,12 +281,4 @@ class TaskController extends BaseController } } } - - private function checkTimezone() - { - if (!Auth::user()->account->timezone) { - $link = link_to('/company/details?focus=timezone_id', trans('texts.click_here'), ['target' => '_blank']); - Session::flash('warning', trans('texts.timezone_unset', ['link' => $link])); - } - } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 63a678f357bc..297c2ea62296 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -338,6 +338,7 @@ if (!defined('CONTACT_EMAIL')) { define('DEFAULT_DATE_FORMAT', 'M j, Y'); define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy'); define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a'); + define('DEFAULT_DATETIME_MOMENT_FORMAT', 'MMM D, YYYY h:mm:ss a'); define('DEFAULT_QUERY_CACHE', 120); // minutes define('DEFAULT_LOCALE', 'en'); diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index a5eb3b9a4a4c..3b47d85e2ef1 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -743,4 +743,13 @@ class Utils return $values; } } + + // nouns in German and French should be uppercase + public static function transFlowText($key) { + $str = trans("texts.$key"); + if (!in_array(App::getLocale(), ['de', 'fr'])) { + $str = strtolower($str); + } + return $str; + } } diff --git a/app/Ninja/Mailers/Mailer.php b/app/Ninja/Mailers/Mailer.php index 9995a27c4df5..fa29f288553d 100644 --- a/app/Ninja/Mailers/Mailer.php +++ b/app/Ninja/Mailers/Mailer.php @@ -41,6 +41,7 @@ class Mailer return true; } catch (Exception $exception) { if (isset($_ENV['POSTMARK_API_TOKEN'])) { + //dd($exception->getResponse()); $response = $exception->getResponse()->getBody()->getContents(); $response = json_decode($response); return nl2br($response->Message); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 56a8e8bca115..4d01f44b50a4 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -37,11 +37,8 @@ class AppServiceProvider extends ServiceProvider { $str = '