From 6b063abe9aa8754055f14c917c1ee540f1c19cac Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 21 Sep 2015 00:05:02 +0300 Subject: [PATCH] Bug fixes --- app/Console/Commands/CheckData.php | 2 +- app/Http/Controllers/AccountController.php | 27 +++++-- app/Http/Controllers/HomeController.php | 7 ++ app/Http/Controllers/InvoiceController.php | 12 ++- app/Http/Controllers/PaymentController.php | 32 +++++--- app/Http/Controllers/UserController.php | 24 ------ app/Http/Middleware/StartupCheck.php | 75 +++++++++---------- app/Http/routes.php | 5 +- app/Models/Account.php | 36 +++++---- app/Ninja/Repositories/AccountRepository.php | 12 +++ app/Ninja/Repositories/InvoiceRepository.php | 9 +-- app/Ninja/Repositories/TaskRepository.php | 2 + app/Services/PaymentService.php | 32 +++++++- composer.json | 2 +- database/seeds/PaymentLibrariesSeeder.php | 8 +- public/css/built.css | 3 + public/css/style.css | 3 + public/js/built.js | 48 ++++++++++-- public/js/pdf.pdfmake.js | 40 ++++++++-- public/js/script.js | 10 ++- resources/lang/da/texts.php | 5 +- resources/lang/de/texts.php | 5 +- resources/lang/en/texts.php | 11 ++- resources/lang/es/texts.php | 5 +- resources/lang/es_ES/texts.php | 5 +- resources/lang/fr/texts.php | 5 +- resources/lang/fr_CA/texts.php | 5 +- resources/lang/it/texts.php | 5 +- resources/lang/lt/texts.php | 5 +- resources/lang/nb_NO/texts.php | 5 +- resources/lang/nl/texts.php | 5 +- resources/lang/pt_BR/texts.php | 5 +- resources/lang/sv/texts.php | 5 +- resources/views/accounts/details.blade.php | 23 ++++-- .../views/accounts/invoice_settings.blade.php | 14 ++-- resources/views/accounts/template.blade.php | 15 +++- .../templates_and_reminders.blade.php | 16 +++- resources/views/invoices/edit.blade.php | 27 ++----- resources/views/master.blade.php | 4 +- storage/templates/bold.js | 28 ++++--- storage/templates/clean.js | 4 +- storage/templates/modern.js | 55 +++++++------- 42 files changed, 430 insertions(+), 216 deletions(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index b83e747e35d9..12b63a617e57 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -197,7 +197,7 @@ class CheckData extends Command { $activityFix = 0; } } else if ($activity->activity_type_id == ACTIVITY_TYPE_DELETE_PAYMENT) { - // **Fix for delting payment after deleting invoice** + // **Fix for deleting payment after deleting invoice** if ($activity->adjustment != 0 && $invoice->is_deleted && $activity->created_at > $invoice->deleted_at) { $this->info("Incorrect adjustment for deleted payment adjustment:{$activity->adjustment}"); $foundProblem = true; diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index d3485ef0ba12..0be29ac688e5 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -33,6 +33,7 @@ use App\Models\DateFormat; use App\Models\DatetimeFormat; use App\Models\Language; use App\Models\Size; +use App\Models\Gateway; use App\Models\Timezone; use App\Models\Industry; use App\Models\InvoiceDesign; @@ -150,7 +151,7 @@ class AccountController extends BaseController public function showSection($section = ACCOUNT_DETAILS, $subSection = false) { if ($section == ACCOUNT_DETAILS) { - $primaryUser = Auth::user()->account->users()->orderBy('id')->first(); + $primaryUser = Auth::user()->account->getPrimaryUser(); $data = [ 'account' => Account::with('users')->findOrFail(Auth::user()->account_id), 'countries' => Cache::get('countries'), @@ -177,7 +178,7 @@ class AccountController extends BaseController return Redirect::to('gateways/create'); } else { return View::make('accounts.payments', [ - 'showAdd' => $count < 3, + 'showAdd' => $count < count(Gateway::$paymentTypes), 'title' => trans('texts.online_payments') ]); } @@ -251,11 +252,16 @@ class AccountController extends BaseController } } else if ($subSection == ACCOUNT_TEMPLATES_AND_REMINDERS) { $data['templates'] = []; + $data['defaultTemplates'] = []; foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type) { $data['templates'][$type] = [ 'subject' => $account->getEmailSubject($type), 'template' => $account->getEmailTemplate($type), ]; + $data['defaultTemplates'][$type] = [ + 'subject' => $account->getDefaultEmailSubject($type), + 'template' => $account->getDefaultEmailTemplate($type), + ]; } $data['emailFooter'] = $account->getEmailFooter(); $data['title'] = trans('texts.email_templates'); @@ -321,18 +327,22 @@ class AccountController extends BaseController foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_PAYMENT, REMINDER1, REMINDER2, REMINDER3] as $type) { $subjectField = "email_subject_{$type}"; - $account->$subjectField = Input::get($subjectField, $account->getEmailSubject($type)); + $subject = Input::get($subjectField, $account->getEmailSubject($type)); + $account->$subjectField = ($subject == $account->getDefaultEmailSubject($type) ? null : $subject); $bodyField = "email_template_{$type}"; - $account->$bodyField = Input::get($bodyField, $account->getEmailTemplate($type)); + $body = Input::get($bodyField, $account->getEmailTemplate($type)); + $account->$bodyField = ($body == $account->getDefaultEmailTemplate($type) ? null : $body); } foreach ([REMINDER1, REMINDER2, REMINDER3] as $type) { $enableField = "enable_{$type}"; $account->$enableField = Input::get($enableField) ? true : false; - $numDaysField = "num_days_{$type}"; - $account->$numDaysField = Input::get($numDaysField); + if ($account->$enableField) { + $numDaysField = "num_days_{$type}"; + $account->$numDaysField = Input::get($numDaysField); + } } $account->save(); @@ -716,6 +726,11 @@ class AccountController extends BaseController $user->username = trim(Input::get('email')); $user->email = trim(strtolower(Input::get('email'))); $user->phone = trim(Input::get('phone')); + if (Utils::isNinja()) { + if (Input::get('referral_code')) { + $user->referral_code = $this->accountRepo->getReferralCode(); + } + } if (Utils::isNinjaDev()) { $user->dark_mode = Input::get('dark_mode') ? true : false; } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f702a85dd1f5..14d126ba31f6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -54,6 +54,13 @@ class HomeController extends BaseController Auth::logout(); } + // Track the referral/campaign code + foreach (['rc', 'utm_campaign'] as $code) { + if (Input::has($code)) { + Session::set(SESSION_REFERRAL_CODE, Input::get($code)); + } + } + if (Auth::check()) { $redirectTo = Input::get('redirect_to', 'invoices/create'); return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up')); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 41c6358775dc..094dd1c09a5c 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -356,6 +356,10 @@ class InvoiceController extends BaseController 'lastSent' => $lastSent); $data = array_merge($data, self::getViewModel()); + if ($clone) { + $data['formIsChanged'] = true; + } + // Set the invitation link on the client's contacts if (!$clone) { $clients = $data['clients']; @@ -526,9 +530,11 @@ class InvoiceController extends BaseController Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT, $url); } - $pdfUpload = Input::get('pdfupload'); - if (!empty($pdfUpload) && strpos($pdfUpload, 'data:application/pdf;base64,') === 0) { - $invoice->updateCachedPDF(Input::get('pdfupload')); + if ($invoice->account->pdf_email_attachment) { + $pdfUpload = Input::get('pdfupload'); + if (!empty($pdfUpload) && strpos($pdfUpload, 'data:application/pdf;base64,') === 0) { + $invoice->updateCachedPDF(Input::get('pdfupload')); + } } if ($action == 'clone') { diff --git a/app/Http/Controllers/PaymentController.php b/app/Http/Controllers/PaymentController.php index 7e1fb5418126..530a1b5bc5cc 100644 --- a/app/Http/Controllers/PaymentController.php +++ b/app/Http/Controllers/PaymentController.php @@ -218,8 +218,12 @@ class PaymentController extends BaseController } Session::put('payment_type', $paymentType); + $accountGateway = $invoice->client->account->getGatewayByType($paymentType); + $gateway = $accountGateway->gateway; + $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes(); + // Handle offsite payments - if ($useToken || $paymentType != PAYMENT_TYPE_CREDIT_CARD) { + if ($useToken || $paymentType != PAYMENT_TYPE_CREDIT_CARD || $gateway->id == GATEWAY_EWAY) { if (Session::has('error')) { Session::reflash(); return Redirect::to('view/'.$invitationKey); @@ -228,10 +232,6 @@ class PaymentController extends BaseController } } - $accountGateway = $invoice->client->account->getGatewayByType($paymentType); - $gateway = $accountGateway->gateway; - $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes(); - $data = [ 'showBreadcrumbs' => false, 'url' => 'payment/'.$invitationKey, @@ -327,7 +327,8 @@ class PaymentController extends BaseController if ($validator->fails()) { return Redirect::to('license') - ->withErrors($validator); + ->withErrors($validator) + ->withInput(); } $account = $this->accountRepo->getNinjaAccount(); @@ -438,7 +439,6 @@ class PaymentController extends BaseController $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { - //Utils::logError('Payment Error [invalid]'); return Redirect::to('payment/'.$invitationKey) ->withErrors($validator) ->withInput(); @@ -456,8 +456,16 @@ class PaymentController extends BaseController } try { + // For offsite payments send the client's details on file + // If we're using a token then we don't need to send any other data + if (!$onSite || $useToken) { + $data = false; + } else { + $data = Input::all(); + } + $gateway = $this->paymentService->createGateway($accountGateway); - $details = $this->paymentService->getPaymentDetails($invitation, ($useToken || !$onSite) ? false : Input::all()); + $details = $this->paymentService->getPaymentDetails($invitation, $data); // check if we're creating/using a billing token if ($accountGateway->gateway_id == GATEWAY_STRIPE) { @@ -475,7 +483,13 @@ class PaymentController extends BaseController } $response = $gateway->purchase($details)->send(); - $ref = $response->getTransactionReference(); + + if ($accountGateway->gateway_id == GATEWAY_EWAY) { + $ref = $response->getData()['AccessCode']; + $token = $response->getCardReference(); + } else { + $ref = $response->getTransactionReference(); + } if (!$ref) { $this->error('No-Ref', $response->getMessage(), $accountGateway); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index d1575db850f9..75f9da467d0b 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -385,28 +385,4 @@ class UserController extends BaseController return View::make('users.account_management'); } - public function claimReferralCode($email) - { - $user = User::whereEmail($email) - ->whereReferralCode(null) - ->whereConfirmed(true) - ->first(); - - if ($user) { - do { - $code = strtoupper(str_random(8)); - $match = User::whereReferralCode($code) - ->withTrashed() - ->first(); - } while ($match); - - $user->referral_code = $code; - $user->save(); - - return $code; - } - - return Redirect::to('/'); - } - } diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 1b1a3feffcb9..f7a4d72dbf6a 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -37,39 +37,6 @@ class StartupCheck return $next($request); } - // Check data has been cached - $cachedTables = [ - 'currencies' => 'App\Models\Currency', - 'sizes' => 'App\Models\Size', - 'industries' => 'App\Models\Industry', - 'timezones' => 'App\Models\Timezone', - 'dateFormats' => 'App\Models\DateFormat', - 'datetimeFormats' => 'App\Models\DatetimeFormat', - 'languages' => 'App\Models\Language', - 'paymentTerms' => 'App\Models\PaymentTerm', - 'paymentTypes' => 'App\Models\PaymentType', - 'countries' => 'App\Models\Country', - 'invoiceDesigns' => 'App\Models\InvoiceDesign', - ]; - if (Input::has('clear_cache')) { - Session::flash('message', 'Cache cleared'); - } - foreach ($cachedTables as $name => $class) { - if (Input::has('clear_cache') || !Cache::has($name)) { - if ($name == 'paymentTerms') { - $orderBy = 'num_days'; - } elseif (in_array($name, ['currencies', 'sizes', 'industries', 'languages', 'countries'])) { - $orderBy = 'name'; - } else { - $orderBy = 'id'; - } - $tableData = $class::orderBy($orderBy)->get(); - if (count($tableData)) { - Cache::forever($name, $tableData); - } - } - } - // check the application is up to date and for any news feed messages if (Auth::check()) { $count = Session::get(SESSION_COUNTER, 0); @@ -122,11 +89,6 @@ class StartupCheck App::setLocale($locale); } - // Track the referral code - if (Input::has('rc')) { - Session::set(SESSION_REFERRAL_CODE, Input::get('rc')); - } - // Make sure the account/user localization settings are in the session if (Auth::check() && !Session::has(SESSION_TIMEZONE)) { Event::fire(new UserSettingsChanged()); @@ -147,10 +109,11 @@ class StartupCheck $design = new InvoiceDesign(); $design->id = $item->id; $design->name = $item->name; - $design->javascript = $item->javascript; + $design->pdfmake = $item->pdfmake; $design->save(); } + Cache::forget('invoiceDesigns'); Session::flash('message', trans('texts.bought_designs')); } } elseif ($productId == PRODUCT_WHITE_LABEL) { @@ -164,6 +127,40 @@ class StartupCheck } } } + + // Check data has been cached + $cachedTables = [ + 'currencies' => 'App\Models\Currency', + 'sizes' => 'App\Models\Size', + 'industries' => 'App\Models\Industry', + 'timezones' => 'App\Models\Timezone', + 'dateFormats' => 'App\Models\DateFormat', + 'datetimeFormats' => 'App\Models\DatetimeFormat', + 'languages' => 'App\Models\Language', + 'paymentTerms' => 'App\Models\PaymentTerm', + 'paymentTypes' => 'App\Models\PaymentType', + 'countries' => 'App\Models\Country', + 'invoiceDesigns' => 'App\Models\InvoiceDesign', + ]; + if (Input::has('clear_cache')) { + Session::flash('message', 'Cache cleared'); + } + foreach ($cachedTables as $name => $class) { + if (Input::has('clear_cache') || !Cache::has($name)) { + if ($name == 'paymentTerms') { + $orderBy = 'num_days'; + } elseif (in_array($name, ['currencies', 'sizes', 'industries', 'languages', 'countries'])) { + $orderBy = 'name'; + } else { + $orderBy = 'id'; + } + $tableData = $class::orderBy($orderBy)->get(); + if (count($tableData)) { + Cache::forever($name, $tableData); + } + } + } + if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) { Session::flash('error', trans('texts.old_browser')); diff --git a/app/Http/routes.php b/app/Http/routes.php index 8fb8b78f712a..8ca91495ff18 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -39,7 +39,6 @@ Route::get('terms', 'HomeController@showTerms'); Route::get('log_error', 'HomeController@logError'); Route::get('invoice_now', 'HomeController@invoiceNow'); Route::get('keep_alive', 'HomeController@keepAlive'); -Route::get('referral_code/{email}', 'UserController@claimReferralCode'); Route::post('get_started', 'AccountController@getStarted'); // Client visible pages @@ -358,6 +357,7 @@ if (!defined('CONTACT_EMAIL')) { define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2); define('GATEWAY_AUTHORIZE_NET', 1); + define('GATEWAY_EWAY', 4); define('GATEWAY_AUTHORIZE_NET_SIM', 2); define('GATEWAY_PAYPAL_EXPRESS', 17); define('GATEWAY_PAYPAL_PRO', 18); @@ -382,7 +382,7 @@ if (!defined('CONTACT_EMAIL')) { define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG'); define('NINJA_WEB_URL', 'https://www.invoiceninja.com'); define('NINJA_APP_URL', 'https://app.invoiceninja.com'); - define('NINJA_VERSION', '2.3.4'); + define('NINJA_VERSION', '2.4.0'); define('NINJA_DATE', '2000-01-01'); define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'); @@ -391,6 +391,7 @@ if (!defined('CONTACT_EMAIL')) { define('OUTDATE_BROWSER_URL', 'http://browsehappy.com/'); define('PDFMAKE_DOCS', 'http://pdfmake.org/playground.html'); define('PHANTOMJS_CLOUD', 'http://api.phantomjscloud.com/single/browser/v1/'); + define('REFERRAL_PROGRAM_URL', false); define('COUNT_FREE_DESIGNS', 4); define('COUNT_FREE_DESIGNS_SELF_HOST', 5); // include the custom design diff --git a/app/Models/Account.php b/app/Models/Account.php index b75c23ae312b..7f80f7b80998 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -412,6 +412,15 @@ class Account extends Eloquent return $this; } + public function getDefaultEmailSubject($entityType) + { + if (strpos($entityType, 'reminder') !== false) { + $entityType = 'reminder'; + } + + return trans("texts.{$entityType}_subject", ['invoice' => '$invoice', 'account' => '$account']); + } + public function getEmailSubject($entityType) { $field = "email_subject_{$entityType}"; @@ -421,22 +430,11 @@ class Account extends Eloquent return $value; } - if (strpos($entityType, 'reminder') !== false) { - $entityType = 'reminder'; - } - - return trans("texts.{$entityType}_subject", ['invoice' => '$invoice', 'account' => '$account']); + return $this->getDefaultEmailSubject($entityType); } - public function getEmailTemplate($entityType, $message = false) + public function getDefaultEmailTemplate($entityType, $message = false) { - $field = "email_template_{$entityType}"; - $template = $this->$field; - - if ($template) { - return $template; - } - if (strpos($entityType, 'reminder') >= 0) { $entityType = ENTITY_INVOICE; } @@ -452,6 +450,18 @@ class Account extends Eloquent return $template . "\$footer"; } + public function getEmailTemplate($entityType, $message = false) + { + $field = "email_template_{$entityType}"; + $template = $this->$field; + + if ($template) { + return $template; + } + + return $this->getDefaultEmailTemplate($entityType, $message); + } + public function getEmailFooter() { if ($this->email_footer) { diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index d9ecc073840f..ace26aac3f49 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -397,4 +397,16 @@ class AccountRepository { return Account::whereRaw('enable_reminder1 = 1 OR enable_reminder2 = 1 OR enable_reminder3 = 1')->get(); } + + public function getReferralCode() + { + do { + $code = strtoupper(str_random(8)); + $match = User::whereReferralCode($code) + ->withTrashed() + ->first(); + } while ($match); + + return $code; + } } diff --git a/app/Ninja/Repositories/InvoiceRepository.php b/app/Ninja/Repositories/InvoiceRepository.php index d98200c57300..7e4f1c314441 100644 --- a/app/Ninja/Repositories/InvoiceRepository.php +++ b/app/Ninja/Repositories/InvoiceRepository.php @@ -289,16 +289,15 @@ class InvoiceRepository } if ($invoice->is_recurring) { + if ($invoice->start_date && $invoice->start_date != Utils::toSqlDate($data['start_date'])) { + $invoice->last_sent_date = null; + } + $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; $invoice->auto_bill = isset($data['auto_bill']) && $data['auto_bill'] ? true : false; - - if (isset($data['show_last_sent_date']) && $data['show_last_sent_date'] - && isset($data['last_sent_date']) && $data['last_sent_date']) { - $invoice->last_sent_date = Utils::toSqlDate($data['last_sent_date']); - } } else { $invoice->due_date = isset($data['due_date_sql']) ? $data['due_date_sql'] : Utils::toSqlDate($data['due_date']); $invoice->frequency_id = 0; diff --git a/app/Ninja/Repositories/TaskRepository.php b/app/Ninja/Repositories/TaskRepository.php index d47a1165cd94..693a1a96b7f2 100644 --- a/app/Ninja/Repositories/TaskRepository.php +++ b/app/Ninja/Repositories/TaskRepository.php @@ -68,6 +68,8 @@ class TaskRepository $timeLog = []; } + array_multisort($timeLog); + if (isset($data['action'])) { if ($data['action'] == 'start') { $task->is_running = true; diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index dc29efa0f2fb..572d52ae7e8a 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -62,7 +62,7 @@ class PaymentService { } elseif (Session::get($key)) { $data = Session::get($key); } else { - $data = []; + $data = $this->createDataForClient($invitation); } $card = new CreditCard($data); @@ -74,6 +74,8 @@ class PaymentService { 'returnUrl' => URL::to('complete'), 'cancelUrl' => $invitation->getLink(), 'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}", + 'transactionId' => $invoice->invoice_number, + 'transactionType' => 'Purchase', ]; } @@ -110,6 +112,34 @@ class PaymentService { return $data; } + public function createDataForClient($invitation) + { + $invoice = $invitation->invoice; + $client = $invoice->client; + $contact = $invitation->contact ?: $client->contacts()->first(); + + return [ + 'email' => $contact->email, + 'company' => $client->getDisplayName(), + 'firstName' => $contact->first_name, + 'lastName' => $contact->last_name, + 'billingAddress1' => $client->address1, + 'billingAddress2' => $client->address2, + 'billingCity' => $client->city, + 'billingPostcode' => $client->postal_code, + 'billingState' => $client->state, + 'billingCountry' => $client->country->iso_3166_2, + 'billingPhone' => $contact->phone, + 'shippingAddress1' => $client->address1, + 'shippingAddress2' => $client->address2, + 'shippingCity' => $client->city, + 'shippingPostcode' => $client->postal_code, + 'shippingState' => $client->state, + 'shippingCountry' => $client->country->iso_3166_2, + 'shippingPhone' => $contact->phone, + ]; + } + public function createToken($gateway, $details, $accountGateway, $client, $contactId) { $tokenResponse = $gateway->createCard($details)->send(); diff --git a/composer.json b/composer.json index dd84c95a348f..4fa692e16924 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "guzzlehttp/guzzle": "~5.0", "laravelcollective/html": "~5.0", "wildbit/laravel-postmark-provider": "dev-master", - "Dwolla/omnipay-dwolla": "dev-master" + "Dwolla/omnipay-dwolla": "dev-master" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/database/seeds/PaymentLibrariesSeeder.php b/database/seeds/PaymentLibrariesSeeder.php index a13844fd7d69..d7f5ff50d115 100644 --- a/database/seeds/PaymentLibrariesSeeder.php +++ b/database/seeds/PaymentLibrariesSeeder.php @@ -40,10 +40,15 @@ class PaymentLibrariesSeeder extends Seeder ['name' => 'Skrill', 'provider' => 'Skrill', 'payment_library_id' => 1], ['name' => 'BitPay', 'provider' => 'BitPay', 'payment_library_id' => 1], ['name' => 'Dwolla', 'provider' => 'Dwolla', 'payment_library_id' => 1], + ['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'payment_library_id' => 1], ]; foreach ($gateways as $gateway) { - if (!DB::table('gateways')->where('name', '=', $gateway['name'])->get()) { + $record = Gateway::where('name', '=', $gateway['name'])->first(); + if ($record) { + $record->provider = $gateway['provider']; + $record->save(); + } else { Gateway::create($gateway); } } @@ -86,6 +91,7 @@ class PaymentLibrariesSeeder extends Seeder ['name' => 'Thai baht', 'code' => 'THB', 'symbol' => 'THB ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Nigerian Naira', 'code' => 'NGN', 'symbol' => 'NGN ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['name' => 'Argentine Peso', 'code' => 'ARS', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], + ['name' => 'Bangladeshi Taka', 'code' => 'BDT', 'symbol' => 'Tk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ]; foreach ($currencies as $currency) { diff --git a/public/css/built.css b/public/css/built.css index d14654495b68..d49558d9566e 100644 --- a/public/css/built.css +++ b/public/css/built.css @@ -2404,6 +2404,9 @@ margin-top: 0; margin-bottom: 0; padding-top: 10px; } +.form-control-static { + padding-top: 11px; +} textarea.form-control { /*height: auto !important;*/ min-height: 40px; diff --git a/public/css/style.css b/public/css/style.css index 781530aef429..cdd02ee90740 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -54,6 +54,9 @@ margin-top: 0; margin-bottom: 0; padding-top: 10px; } +.form-control-static { + padding-top: 11px; +} textarea.form-control { /*height: auto !important;*/ min-height: 40px; diff --git a/public/js/built.js b/public/js/built.js index 3bbc29b3c3fa..49efc7c1f491 100644 --- a/public/js/built.js +++ b/public/js/built.js @@ -31546,6 +31546,14 @@ function doubleDollarSign(str) { if (!str) return ''; return str.replace(/\$/g, '\$\$\$'); } + +function truncate(string, length){ + if (string.length > length) { + return string.substring(0, length) + '...'; + } else { + return string; + } +}; var NINJA = NINJA || {}; NINJA.TEMPLATES = { @@ -31575,12 +31583,17 @@ function GetPdfMake(invoice, javascript, callback) { return function (i, node) { return 0; }; + } else if ((val+'').indexOf('$notFirstAndLastColumn') === 0) { + var parts = val.split(':'); + return function (i, node) { + return (i === 0 || i === node.table.widths.length) ? 0 : parseFloat(parts[1]); + }; } else if ((val+'').indexOf('$notFirst') === 0) { var parts = val.split(':'); return function (i, node) { return i === 0 ? 0 : parseFloat(parts[1]); }; - } else if ((val+'').indexOf('$amount') === 0) { + } else if ((val+'').indexOf('$amount') === 0) { var parts = val.split(':'); return function (i, node) { return parseFloat(parts[1]); @@ -31599,12 +31612,18 @@ function GetPdfMake(invoice, javascript, callback) { //console.log(javascript); var dd = JSON.parse(javascript, jsonCallBack); - - if (!invoice.is_pro && dd.hasOwnProperty('footer') && dd.footer.hasOwnProperty('columns')) { - dd.footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130}) + var designId = invoice.invoice_design_id; + if (!invoice.is_pro) { + if (designId == NINJA.TEMPLATES.CLEAN || designId == NINJA.TEMPLATES.NORMAL) { + dd.footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]}) + } else if (designId == NINJA.TEMPLATES.BOLD) { + dd.footer[1].columns.push({image: logoImages.imageLogo2, alignment: 'right', width: 130, margin: [0, -20, 20, 0]}) + } else if (designId == NINJA.TEMPLATES.MODERN) { + dd.footer[1].columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]}); + } } - //console.log(JSON.stringify(dd)); + //console.log(JSON.stringify(dd.footer[1].columns)); /* var fonts = { @@ -31640,6 +31659,7 @@ NINJA.decodeJavascript = function(invoice, javascript) 'invoiceLineItems': NINJA.invoiceLines(invoice), 'invoiceLineItemColumns': NINJA.invoiceColumns(invoice), 'quantityWidth': NINJA.quantityWidth(invoice), + 'taxWidth': NINJA.taxWidth(invoice), 'clientDetails': NINJA.clientDetails(invoice), 'notesAndTerms': NINJA.notesAndTerms(invoice), 'subtotals': NINJA.subtotals(invoice), @@ -31647,7 +31667,7 @@ NINJA.decodeJavascript = function(invoice, javascript) 'subtotalsWithoutBalance': NINJA.subtotals(invoice, true), 'subtotalsBalance': NINJA.subtotalsBalance(invoice), 'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id), - 'invoiceFooter': invoice.invoice_footer || ' ', + 'invoiceFooter': NINJA.invoiceFooter(invoice), 'invoiceNumber': invoice.invoice_number || ' ', 'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice, 'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(), @@ -31658,7 +31678,7 @@ NINJA.decodeJavascript = function(invoice, javascript) for (var key in json) { // remove trailing commas for these fields - if (['quantityWidth'].indexOf(key) >= 0) { + if (['quantityWidth', 'taxWidth'].indexOf(key) >= 0) { var regExp = new RegExp('"\\$'+key+'",', 'g'); val = json[key]; } else { @@ -31754,11 +31774,25 @@ NINJA.invoiceColumns = function(invoice) return columns; } +NINJA.invoiceFooter = function(invoice) +{ + if (!invoice.is_pro && invoice.invoice_design_id == 3) { + return invoice.invoice_footer ? invoice.invoice_footer.substring(0, 200) : ' '; + } else { + return invoice.invoice_footer || ' '; + } +} + NINJA.quantityWidth = function(invoice) { return invoice.account.hide_quantity == '1' ? '' : '"14%", '; } +NINJA.taxWidth = function(invoice) +{ + return invoice.account.show_item_taxes == '1' ? '"14%", ' : ''; +} + NINJA.invoiceLines = function(invoice) { var total = 0; var shownItem = false; diff --git a/public/js/pdf.pdfmake.js b/public/js/pdf.pdfmake.js index a835418c68fe..d4a76e5da70f 100644 --- a/public/js/pdf.pdfmake.js +++ b/public/js/pdf.pdfmake.js @@ -27,12 +27,17 @@ function GetPdfMake(invoice, javascript, callback) { return function (i, node) { return 0; }; + } else if ((val+'').indexOf('$notFirstAndLastColumn') === 0) { + var parts = val.split(':'); + return function (i, node) { + return (i === 0 || i === node.table.widths.length) ? 0 : parseFloat(parts[1]); + }; } else if ((val+'').indexOf('$notFirst') === 0) { var parts = val.split(':'); return function (i, node) { return i === 0 ? 0 : parseFloat(parts[1]); }; - } else if ((val+'').indexOf('$amount') === 0) { + } else if ((val+'').indexOf('$amount') === 0) { var parts = val.split(':'); return function (i, node) { return parseFloat(parts[1]); @@ -51,12 +56,18 @@ function GetPdfMake(invoice, javascript, callback) { //console.log(javascript); var dd = JSON.parse(javascript, jsonCallBack); - - if (!invoice.is_pro && dd.hasOwnProperty('footer') && dd.footer.hasOwnProperty('columns')) { - dd.footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130}) + var designId = invoice.invoice_design_id; + if (!invoice.is_pro) { + if (designId == NINJA.TEMPLATES.CLEAN || designId == NINJA.TEMPLATES.NORMAL) { + dd.footer.columns.push({image: logoImages.imageLogo1, alignment: 'right', width: 130, margin: [0, 0, 0, 0]}) + } else if (designId == NINJA.TEMPLATES.BOLD) { + dd.footer[1].columns.push({image: logoImages.imageLogo2, alignment: 'right', width: 130, margin: [0, -20, 20, 0]}) + } else if (designId == NINJA.TEMPLATES.MODERN) { + dd.footer[1].columns[0].stack.push({image: logoImages.imageLogo3, alignment: 'left', width: 130, margin: [40, 6, 0, 0]}); + } } - //console.log(JSON.stringify(dd)); + //console.log(JSON.stringify(dd.footer[1].columns)); /* var fonts = { @@ -92,6 +103,7 @@ NINJA.decodeJavascript = function(invoice, javascript) 'invoiceLineItems': NINJA.invoiceLines(invoice), 'invoiceLineItemColumns': NINJA.invoiceColumns(invoice), 'quantityWidth': NINJA.quantityWidth(invoice), + 'taxWidth': NINJA.taxWidth(invoice), 'clientDetails': NINJA.clientDetails(invoice), 'notesAndTerms': NINJA.notesAndTerms(invoice), 'subtotals': NINJA.subtotals(invoice), @@ -99,7 +111,7 @@ NINJA.decodeJavascript = function(invoice, javascript) 'subtotalsWithoutBalance': NINJA.subtotals(invoice, true), 'subtotalsBalance': NINJA.subtotalsBalance(invoice), 'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id), - 'invoiceFooter': invoice.invoice_footer || ' ', + 'invoiceFooter': NINJA.invoiceFooter(invoice), 'invoiceNumber': invoice.invoice_number || ' ', 'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice, 'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(), @@ -110,7 +122,7 @@ NINJA.decodeJavascript = function(invoice, javascript) for (var key in json) { // remove trailing commas for these fields - if (['quantityWidth'].indexOf(key) >= 0) { + if (['quantityWidth', 'taxWidth'].indexOf(key) >= 0) { var regExp = new RegExp('"\\$'+key+'",', 'g'); val = json[key]; } else { @@ -206,11 +218,25 @@ NINJA.invoiceColumns = function(invoice) return columns; } +NINJA.invoiceFooter = function(invoice) +{ + if (!invoice.is_pro && invoice.invoice_design_id == 3) { + return invoice.invoice_footer ? invoice.invoice_footer.substring(0, 200) : ' '; + } else { + return invoice.invoice_footer || ' '; + } +} + NINJA.quantityWidth = function(invoice) { return invoice.account.hide_quantity == '1' ? '' : '"14%", '; } +NINJA.taxWidth = function(invoice) +{ + return invoice.account.show_item_taxes == '1' ? '"14%", ' : ''; +} + NINJA.invoiceLines = function(invoice) { var total = 0; var shownItem = false; diff --git a/public/js/script.js b/public/js/script.js index 16e993da91bd..a62f3f6ef830 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1667,4 +1667,12 @@ function getDescendantProp(obj, desc) { function doubleDollarSign(str) { if (!str) return ''; return str.replace(/\$/g, '\$\$\$'); -} \ No newline at end of file +} + +function truncate(string, length){ + if (string.length > length) { + return string.substring(0, length) + '...'; + } else { + return string; + } +}; \ No newline at end of file diff --git a/resources/lang/da/texts.php b/resources/lang/da/texts.php index c34f56a7fc3d..4fc041b27280 100644 --- a/resources/lang/da/texts.php +++ b/resources/lang/da/texts.php @@ -185,7 +185,7 @@ 'users' => 'Brugere', 'localization' => 'Lokalisering', 'remove_logo' => 'Fjern logo', - 'logo_help' => 'Understøttede filtyper: JPEG, GIF og PNG. Anbefalet størrelse: 200px bredde og 120px højde', + 'logo_help' => 'Understøttede filtyper: JPEG, GIF og PNG', 'payment_gateway' => 'Betalingsløsning', 'gateway_id' => 'Kort betalings udbyder', 'email_notifications' => 'Notifikation via e-mail', @@ -788,6 +788,9 @@ 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); \ No newline at end of file diff --git a/resources/lang/de/texts.php b/resources/lang/de/texts.php index 2f4da96b9230..64b6d8ae3272 100644 --- a/resources/lang/de/texts.php +++ b/resources/lang/de/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Benutzer', 'localization' => 'Lokalisierung', 'remove_logo' => 'Logo entfernen', - 'logo_help' => 'Unterstützt: JPEG, GIF und PNG. Empfohlene Höhe: 120px', + 'logo_help' => 'Unterstützt: JPEG, GIF und PNG', 'payment_gateway' => 'Zahlungseingang', 'gateway_id' => 'Provider', 'email_notifications' => 'E-Mail Benachrichtigungen', @@ -787,6 +787,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 7defe239745e..43e63e02d11f 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Users', 'localization' => 'Localization', 'remove_logo' => 'Remove logo', - 'logo_help' => 'Supported: JPEG, GIF and PNG. Recommended size: 200px width by 120px height', + 'logo_help' => 'Supported: JPEG, GIF and PNG', 'payment_gateway' => 'Payment Gateway', 'gateway_id' => 'Gateway', 'email_notifications' => 'Email Notifications', @@ -672,7 +672,7 @@ return array( 'counter' => 'Counter', 'payment_type_dwolla' => 'Dwolla', - 'gateway_help_43' => ':link to sign up for Dwolla.', + 'gateway_help_43' => ':link to sign up for Dwolla.
Note: remove dashes from the Destination/Dwolla Id', 'partial_value' => 'Must be greater than zero and less than the total', 'more_actions' => 'More Actions', @@ -765,7 +765,7 @@ return array( 'status_viewed' => 'Viewed', 'status_partial' => 'Partial', 'status_paid' => 'Paid', - 'show_line_item_tax' => 'Display line item taxes inline', + 'show_line_item_tax' => 'Display line item taxes inline', 'iframe_url' => 'Website', 'iframe_url_help1' => 'Copy the following code to a page on your site.', @@ -787,6 +787,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', - + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', + ); diff --git a/resources/lang/es/texts.php b/resources/lang/es/texts.php index 3e92d9b66122..c2a041af27eb 100644 --- a/resources/lang/es/texts.php +++ b/resources/lang/es/texts.php @@ -184,7 +184,7 @@ return array( 'users' => 'Usuarios', 'localization' => 'Localización', 'remove_logo' => 'Eliminar logo', - 'logo_help' => 'Formatos aceptados: JPEG, GIF y PNG. Altura recomendada: 120px', + 'logo_help' => 'Formatos aceptados: JPEG, GIF y PNG', 'payment_gateway' => 'Pasarela de pago', 'gateway_id' => 'Proveedor', 'email_notifications' => 'Notificaciones de email', @@ -765,6 +765,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); \ No newline at end of file diff --git a/resources/lang/es_ES/texts.php b/resources/lang/es_ES/texts.php index 11537046966f..3ca889781811 100644 --- a/resources/lang/es_ES/texts.php +++ b/resources/lang/es_ES/texts.php @@ -196,7 +196,7 @@ return array( 'users' => 'Usuarios', 'localization' => 'Localización', 'remove_logo' => 'Eliminar logo', - 'logo_help' => 'Formatos aceptados: JPEG, GIF y PNG. Altura recomendada: 120px', + 'logo_help' => 'Formatos aceptados: JPEG, GIF y PNG', 'payment_gateway' => 'Pasarela de pago', 'gateway_id' => 'Proveedor', 'email_notifications' => 'Notificaciones de email', @@ -787,6 +787,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); \ No newline at end of file diff --git a/resources/lang/fr/texts.php b/resources/lang/fr/texts.php index 9bb2ce8dd98c..b4a1d882bd63 100644 --- a/resources/lang/fr/texts.php +++ b/resources/lang/fr/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Utilisateurs', 'localization' => 'Localisation', 'remove_logo' => 'Supprimer le logo', - 'logo_help' => 'Formats supportés: JPEG, GIF et PNG. Hauteur recommandé: 120px', + 'logo_help' => 'Formats supportés: JPEG, GIF et PNG', 'payment_gateway' => 'Passerelle de paiement', 'gateway_id' => 'Fournisseur', 'email_notifications' => 'Notifications par courriel', @@ -779,6 +779,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/fr_CA/texts.php b/resources/lang/fr_CA/texts.php index f3e0e2769ab1..efb6034c45b5 100644 --- a/resources/lang/fr_CA/texts.php +++ b/resources/lang/fr_CA/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Utilisateurs', 'localization' => 'Localisation', 'remove_logo' => 'Supprimer le logo', - 'logo_help' => 'Formats supportés: JPEG, GIF et PNG. Hauteur recommandé: 120px', + 'logo_help' => 'Formats supportés: JPEG, GIF et PNG', 'payment_gateway' => 'Passerelle de paiement', 'gateway_id' => 'Fournisseur', 'email_notifications' => 'Notifications par courriel', @@ -780,6 +780,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/it/texts.php b/resources/lang/it/texts.php index 7df6cf879197..f589c1ce5603 100644 --- a/resources/lang/it/texts.php +++ b/resources/lang/it/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Utenti', 'localization' => 'Localizzazione', 'remove_logo' => 'Rimuovi logo', - 'logo_help' => 'Supportati: JPEG, GIF e PNG. Altezza raccomandata: 120px', + 'logo_help' => 'Supportati: JPEG, GIF e PNG', 'payment_gateway' => 'Servizi di Pagamento', 'gateway_id' => 'Piattaforma', 'email_notifications' => 'Notifiche Email', @@ -782,5 +782,8 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/lt/texts.php b/resources/lang/lt/texts.php index 69931deef003..c6ef289587cc 100644 --- a/resources/lang/lt/texts.php +++ b/resources/lang/lt/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Users', 'localization' => 'Localization', 'remove_logo' => 'Remove logo', - 'logo_help' => 'Supported: JPEG, GIF and PNG. Recommended size: 200px width by 120px height', + 'logo_help' => 'Supported: JPEG, GIF and PNG', 'payment_gateway' => 'Payment Gateway', 'gateway_id' => 'Provider', 'email_notifications' => 'Email Notifications', @@ -790,6 +790,9 @@ return array( 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/nb_NO/texts.php b/resources/lang/nb_NO/texts.php index 1ba2d6a483c6..2efeb76a8d48 100644 --- a/resources/lang/nb_NO/texts.php +++ b/resources/lang/nb_NO/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Brukere', 'localization' => 'Lokaliseing', 'remove_logo' => 'Fjern logo', - 'logo_help' => 'Støttedefiltyper: JPEG, GIF og PNG. Anbefalt størrelse: 200px bredde by 120px høyde', + 'logo_help' => 'Støttedefiltyper: JPEG, GIF og PNG', 'payment_gateway' => 'Betalingsløsning', 'gateway_id' => 'Tilbyder', 'email_notifications' => 'Varsel via email', @@ -787,6 +787,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); \ No newline at end of file diff --git a/resources/lang/nl/texts.php b/resources/lang/nl/texts.php index e9348a1502ad..239497adb5a9 100644 --- a/resources/lang/nl/texts.php +++ b/resources/lang/nl/texts.php @@ -184,7 +184,7 @@ return array( 'users' => 'Gebruikers', 'localization' => 'Localisatie', 'remove_logo' => 'Verwijder logo', - 'logo_help' => 'Ondersteund: JPEG, GIF en PNG. Aangeraden hoogte: 120px', + 'logo_help' => 'Ondersteund: JPEG, GIF en PNG', 'payment_gateway' => 'Betalingsmiddel', 'gateway_id' => 'Leverancier', 'email_notifications' => 'E-mail meldingen', @@ -782,5 +782,8 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/pt_BR/texts.php b/resources/lang/pt_BR/texts.php index aaf06f5ea781..bd1dbc8d6e5b 100644 --- a/resources/lang/pt_BR/texts.php +++ b/resources/lang/pt_BR/texts.php @@ -183,7 +183,7 @@ return array( 'users' => 'Usuários', 'localization' => 'Localização', 'remove_logo' => 'Remover logo', - 'logo_help' => 'Suportados: JPEG, GIF and PNG. Altura recomendada: 120px', + 'logo_help' => 'Suportados: JPEG, GIF and PNG', 'payment_gateway' => 'Provedor de Pagamento', 'gateway_id' => 'Provedor', 'email_notifications' => 'Notificações por Email', @@ -782,5 +782,8 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/lang/sv/texts.php b/resources/lang/sv/texts.php index 4f0ec1c43b78..32810b532e55 100644 --- a/resources/lang/sv/texts.php +++ b/resources/lang/sv/texts.php @@ -185,7 +185,7 @@ return array( 'users' => 'Användare', 'localization' => 'Språkanpassning', 'remove_logo' => 'Ta bort logga', - 'logo_help' => 'Giltiga format: JPEG, GIF och PNG. Rekommenderad storlek: 200 x 120 pixlar (BxH)', + 'logo_help' => 'Giltiga format: JPEG, GIF och PNG', 'payment_gateway' => 'Betalningstjänst', 'gateway_id' => 'Tjänst', 'email_notifications' => 'Notifieringar', @@ -785,6 +785,9 @@ return array( 'reset' => 'Reset', 'invoice_not_found' => 'The requested invoice is not available', + 'referral_program' => 'Referral Program', + 'referral_code' => 'Referral Code', + 'last_sent_on' => 'Last sent on :date', ); diff --git a/resources/views/accounts/details.blade.php b/resources/views/accounts/details.blade.php index a4b1af9d0df2..6b14fd06bf26 100644 --- a/resources/views/accounts/details.blade.php +++ b/resources/views/accounts/details.blade.php @@ -86,14 +86,25 @@ {!! Former::text('last_name') !!} {!! Former::text('email') !!} {!! Former::text('phone') !!} - @if (Utils::isNinjaDev()) - {!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help')) !!} + @if (Utils::isNinja() && $primaryUser->confirmed) + @if ($primaryUser->referral_code) + {!! Former::plaintext('referral_code') + ->value($primaryUser->referral_code . ' ' . Icon::create('question-sign') . '') !!} + @else + {!! Former::checkbox('referral_code') + ->text(trans('texts.enable') . ' ' . Icon::create('question-sign') . '') !!} + @endif @endif + @if (false && Utils::isNinjaDev()) + {!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help')) !!} + @endif - @if (Auth::user()->confirmed) - {!! Former::actions( Button::primary(trans('texts.change_password'))->small()->withAttributes(['onclick'=>'showChangePassword()'])) !!} - @elseif (Auth::user()->registered) - {!! Former::actions( Button::primary(trans('texts.resend_confirmation'))->asLinkTo(URL::to('/resend_confirmation'))->small() ) !!} + @if (Utils::isNinja()) + @if (Auth::user()->confirmed) + {!! Former::actions( Button::primary(trans('texts.change_password'))->small()->withAttributes(['onclick'=>'showChangePassword()'])) !!} + @elseif (Auth::user()->registered) + {!! Former::actions( Button::primary(trans('texts.resend_confirmation'))->asLinkTo(URL::to('/resend_confirmation'))->small() ) !!} + @endif @endif diff --git a/resources/views/accounts/invoice_settings.blade.php b/resources/views/accounts/invoice_settings.blade.php index 729532917d90..1992924c931a 100644 --- a/resources/views/accounts/invoice_settings.blade.php +++ b/resources/views/accounts/invoice_settings.blade.php @@ -72,10 +72,12 @@

{!! trans('texts.email_settings') !!}

- {{ Former::setOption('capitalize_translations', false) }} - {!! Former::text('subdomain')->placeholder(trans('texts.www'))->onchange('onSubdomainChange()') !!} - {!! Former::text('iframe_url')->placeholder('http://invoices.example.com/') - ->onchange('onDomainChange()')->appendIcon('question-sign')->addGroupClass('iframe_url') !!} + @if (Utils::isNinja()) + {{ Former::setOption('capitalize_translations', false) }} + {!! Former::text('subdomain')->placeholder(trans('texts.www'))->onchange('onSubdomainChange()') !!} + {!! Former::text('iframe_url')->placeholder('http://invoices.example.com/') + ->onchange('onDomainChange()')->appendIcon('question-sign')->addGroupClass('iframe_url') !!} + @endif {!! Former::checkbox('pdf_email_attachment')->text(trans('texts.enable')) !!}
@@ -130,9 +132,9 @@