mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Bug fixes
This commit is contained in:
parent
4f67ec12a9
commit
9e6b25bcc4
@ -40,7 +40,6 @@ use App\Ninja\Repositories\AccountRepository;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Events\UserLoggedIn;
|
||||
use App\Events\UserSettingsChanged;
|
||||
|
||||
class AccountController extends BaseController
|
||||
{
|
||||
@ -686,7 +685,7 @@ 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 (Utils::isNinjaDev()) {
|
||||
$user->dark_mode = Input::get('dark_mode') ? true : false;
|
||||
}
|
||||
$user->save();
|
||||
@ -698,7 +697,6 @@ class AccountController extends BaseController
|
||||
File::delete('logo/'.$account->account_key.'.jpg');
|
||||
File::delete('logo/'.$account->account_key.'.png');
|
||||
|
||||
$image = Image::make($path);
|
||||
$mimeType = $file->getMimeType();
|
||||
|
||||
if ($mimeType == 'image/jpeg') {
|
||||
@ -706,15 +704,19 @@ class AccountController extends BaseController
|
||||
} else if ($mimeType == 'image/png') {
|
||||
$file->move('logo/', $account->account_key . '.png');
|
||||
} else {
|
||||
$image->resize(200, 120, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
Image::canvas($image->width(), $image->height(), '#FFFFFF')
|
||||
->insert($image)->save('logo/'.$account->account_key.'.jpg');
|
||||
if (extension_loaded('fileinfo')) {
|
||||
$image = Image::make($path);
|
||||
$image->resize(200, 120, function ($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
});
|
||||
Image::canvas($image->width(), $image->height(), '#FFFFFF')
|
||||
->insert($image)->save('logo/'.$account->account_key.'.jpg');
|
||||
} else {
|
||||
Session::flash('warning', 'Warning: To support gifs the fileinfo PHP extension needs to be enabled.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Event::fire(new UserSettingsChanged());
|
||||
Session::flash('message', trans('texts.updated_settings'));
|
||||
|
||||
return Redirect::to('company/details');
|
||||
@ -764,9 +766,9 @@ class AccountController extends BaseController
|
||||
$user->username = $user->email;
|
||||
$user->password = bcrypt(trim(Input::get('new_password')));
|
||||
$user->registered = true;
|
||||
$user->save();
|
||||
$user->save();
|
||||
|
||||
if (Utils::isNinja()) {
|
||||
if (Utils::isNinjaProd()) {
|
||||
$this->userMailer->sendConfirmation($user);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class AppController extends BaseController
|
||||
|
||||
public function showSetup()
|
||||
{
|
||||
if (Utils::isNinja() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
|
||||
if (Utils::isNinjaProd() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ class AppController extends BaseController
|
||||
|
||||
public function doSetup()
|
||||
{
|
||||
if (Utils::isNinja() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
|
||||
if (Utils::isNinjaProd() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
|
||||
return Redirect::to('/');
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ class AppController extends BaseController
|
||||
|
||||
public function install()
|
||||
{
|
||||
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
|
||||
if (!Utils::isNinjaProd() && !Utils::isDatabaseSetup()) {
|
||||
try {
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
if (Industry::count() == 0) {
|
||||
@ -176,7 +176,7 @@ class AppController extends BaseController
|
||||
|
||||
public function update()
|
||||
{
|
||||
if (!Utils::isNinja()) {
|
||||
if (!Utils::isNinjaProd()) {
|
||||
try {
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
Artisan::call('db:seed', array('--force' => true, '--class' => 'PaymentLibrariesSeeder'));
|
||||
|
@ -268,7 +268,7 @@ class ClientController extends BaseController
|
||||
$record = Contact::createNew();
|
||||
}
|
||||
|
||||
$record->email = trim(strtolower($contact->email));
|
||||
$record->email = trim($contact->email);
|
||||
$record->first_name = trim($contact->first_name);
|
||||
$record->last_name = trim($contact->last_name);
|
||||
$record->phone = trim($contact->phone);
|
||||
|
@ -289,7 +289,7 @@ class TaskController extends BaseController
|
||||
private function checkTimezone()
|
||||
{
|
||||
if (!Auth::user()->account->timezone) {
|
||||
$link = link_to('/company/details', trans('texts.click_here'), ['target' => '_blank']);
|
||||
$link = link_to('/company/details?focus=timezone_id', trans('texts.click_here'), ['target' => '_blank']);
|
||||
Session::flash('warning', trans('texts.timezone_unset', ['link' => $link]));
|
||||
}
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ class StartupCheck
|
||||
$licenseKey = Input::get('license_key');
|
||||
$productId = Input::get('product_id');
|
||||
|
||||
$data = trim(file_get_contents((Utils::isNinjaDev() ? 'http://www.ninja.dev' : NINJA_APP_URL)."/claim_license?license_key={$licenseKey}&product_id={$productId}"));
|
||||
|
||||
$data = trim(file_get_contents((Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL)."/claim_license?license_key={$licenseKey}&product_id={$productId}"));
|
||||
|
||||
if ($productId == PRODUCT_INVOICE_DESIGNS) {
|
||||
if ($data = json_decode($data)) {
|
||||
foreach ($data as $item) {
|
||||
|
@ -4,7 +4,9 @@ use Eloquent;
|
||||
use Utils;
|
||||
use Session;
|
||||
use DateTime;
|
||||
use Event;
|
||||
use App;
|
||||
use App\Events\UserSettingsChanged;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Account extends Eloquent
|
||||
@ -324,7 +326,7 @@ class Account extends Eloquent
|
||||
|
||||
public function isWhiteLabel()
|
||||
{
|
||||
if (Utils::isNinja()) {
|
||||
if (Utils::isNinjaProd()) {
|
||||
return self::isPro() && $this->pro_plan_paid != NINJA_DATE;
|
||||
} else {
|
||||
return $this->pro_plan_paid == NINJA_DATE;
|
||||
@ -429,4 +431,8 @@ class Account extends Eloquent
|
||||
{
|
||||
return $this->token_billing_type_id == TOKEN_BILLING_OPT_OUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Account::updated(function ($account) {
|
||||
Event::fire(new UserSettingsChanged());
|
||||
});
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
use Session;
|
||||
use Auth;
|
||||
use Event;
|
||||
use App\Libraries\Utils;
|
||||
use App\Events\UserSettingsChanged;
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Auth\Passwords\CanResetPassword;
|
||||
@ -213,3 +215,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
User::updating(function ($user) {
|
||||
User::updateUser($user);
|
||||
});
|
||||
|
||||
User::updated(function ($user) {
|
||||
Event::fire(new UserSettingsChanged());
|
||||
});
|
||||
|
||||
|
@ -17,10 +17,11 @@ class Mailer
|
||||
try {
|
||||
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
|
||||
|
||||
$toEmail = strtolower($toEmail);
|
||||
$replyEmail = $fromEmail;
|
||||
$fromEmail = CONTACT_EMAIL;
|
||||
|
||||
if(isset($data['invoice_id'])) {
|
||||
if (isset($data['invoice_id'])) {
|
||||
$invoice = Invoice::with('account')->where('id', '=', $data['invoice_id'])->get()->first();
|
||||
if($invoice->account->pdf_email_attachment && file_exists($invoice->getPDFPath())) {
|
||||
$message->attach(
|
||||
|
@ -272,7 +272,6 @@ class AccountRepository
|
||||
}
|
||||
|
||||
public function prepareUsersData($record) {
|
||||
|
||||
if (!$record) {
|
||||
return false;
|
||||
}
|
||||
@ -381,7 +380,6 @@ class AccountRepository
|
||||
}
|
||||
|
||||
public function unlinkUser($userAccountId, $userId) {
|
||||
|
||||
$userAccount = UserAccount::whereId($userAccountId)->first();
|
||||
if ($userAccount->hasUserId($userId)) {
|
||||
$userAccount->removeUserId($userId);
|
||||
|
@ -120,7 +120,7 @@ class ClientRepository
|
||||
if (isset($data['contact'])) {
|
||||
$info = $data['contact'];
|
||||
if (isset($info['email'])) {
|
||||
$contact->email = trim(strtolower($info['email']));
|
||||
$contact->email = trim($info['email']);
|
||||
}
|
||||
if (isset($info['first_name'])) {
|
||||
$contact->first_name = trim($info['first_name']);
|
||||
@ -145,7 +145,7 @@ class ClientRepository
|
||||
}
|
||||
|
||||
if (isset($record['email'])) {
|
||||
$contact->email = trim(strtolower($record['email']));
|
||||
$contact->email = trim($record['email']);
|
||||
}
|
||||
if (isset($record['first_name'])) {
|
||||
$contact->first_name = trim($record['first_name']);
|
||||
|
@ -37,9 +37,12 @@ class AppServiceProvider extends ServiceProvider {
|
||||
|
||||
$str = '<li class="dropdown '.$class.'">
|
||||
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
|
||||
<ul class="dropdown-menu" id="menu1">
|
||||
<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
|
||||
<ul class="dropdown-menu" id="menu1">';
|
||||
|
||||
if ($type != ENTITY_TASK || Auth::user()->account->timezone_id) {
|
||||
$str .= '<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
|
||||
}
|
||||
|
||||
if ($type == ENTITY_INVOICE) {
|
||||
$str .= '<li><a href="'.URL::to('recurring_invoices/create').'">'.trans("texts.new_recurring_invoice").'</a></li>';
|
||||
if (Auth::user()->isPro()) {
|
||||
|
@ -29947,12 +29947,14 @@ function GetPdf(invoice, javascript){
|
||||
lineTotalRight: 550
|
||||
};
|
||||
|
||||
/*
|
||||
if (invoice.has_taxes)
|
||||
{
|
||||
layout.descriptionLeft -= 20;
|
||||
layout.unitCostRight -= 40;
|
||||
layout.qtyRight -= 40;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@param orientation One of "portrait" or "landscape" (or shortcuts "p" (Default), "l")
|
||||
@ -30899,8 +30901,7 @@ function calculateAmounts(invoice) {
|
||||
invoice.discount_amount = discount;
|
||||
invoice.tax_amount = tax;
|
||||
invoice.item_taxes = taxes;
|
||||
invoice.has_taxes = hasTaxes;
|
||||
|
||||
|
||||
if (NINJA.parseFloat(invoice.partial)) {
|
||||
invoice.balance_amount = roundToTwo(invoice.partial);
|
||||
} else {
|
||||
@ -30944,11 +30945,12 @@ function displayInvoiceHeader(doc, invoice, layout) {
|
||||
}
|
||||
doc.text(totalX, layout.tableTop, invoiceLabels.line_total);
|
||||
|
||||
/*
|
||||
if (invoice.has_taxes)
|
||||
{
|
||||
doc.text(taxX, layout.tableTop, invoiceLabels.tax);
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
function displayInvoiceItems(doc, invoice, layout) {
|
||||
@ -31131,10 +31133,11 @@ function displayInvoiceItems(doc, invoice, layout) {
|
||||
|
||||
doc.line(qtyX-45, y-16,qtyX-45, y+55);
|
||||
|
||||
/*
|
||||
if (invoice.has_taxes) {
|
||||
doc.line(taxX-15, y-16,taxX-15, y+55);
|
||||
}
|
||||
|
||||
*/
|
||||
doc.line(totalX-27, y-16,totalX-27, y+55);
|
||||
|
||||
}
|
||||
@ -31197,9 +31200,11 @@ function displayInvoiceItems(doc, invoice, layout) {
|
||||
doc.line(layout.descriptionLeft-8, topX,layout.descriptionLeft-8, y);
|
||||
doc.line(layout.unitCostRight-55, topX,layout.unitCostRight-55, y);
|
||||
doc.line(layout.qtyRight-50, topX,layout.qtyRight-50, y);
|
||||
/*
|
||||
if (invoice.has_taxes) {
|
||||
doc.line(layout.taxRight-28, topX,layout.taxRight-28, y);
|
||||
}
|
||||
*/
|
||||
doc.line(totalX-25, topX,totalX-25, y+90);
|
||||
doc.line(totalX+45, topX,totalX+45, y+90);
|
||||
}
|
||||
@ -31605,7 +31610,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
||||
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
||||
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
||||
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
||||
'invoiceFooter': account.invoice_footer || ' ',
|
||||
'invoiceFooter': invoice.invoice_footer || ' ',
|
||||
'invoiceNumber': invoice.invoice_number || ' ',
|
||||
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
||||
'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
||||
|
@ -97,7 +97,7 @@ NINJA.decodeJavascript = function(invoice, javascript)
|
||||
'subtotalsHeight': NINJA.subtotals(invoice).length * 22,
|
||||
'subtotalsWithoutBalance': NINJA.subtotals(invoice, true),
|
||||
'balanceDue': formatMoney(invoice.balance_amount, invoice.client.currency_id),
|
||||
'invoiceFooter': account.invoice_footer || ' ',
|
||||
'invoiceFooter': invoice.invoice_footer || ' ',
|
||||
'invoiceNumber': invoice.invoice_number || ' ',
|
||||
'entityType': invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice,
|
||||
'entityTypeUC': (invoice.is_quote ? invoiceLabels.quote : invoiceLabels.invoice).toUpperCase(),
|
||||
|
@ -746,7 +746,8 @@ return array(
|
||||
'recurring_invoice' => 'Recurring Invoice',
|
||||
'recurring_too_soon' => 'It\'s too soon to create the next recurring invoice',
|
||||
'created_by_invoice' => 'Created by :invoice',
|
||||
|
||||
'primary_user' => 'Primary User',
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
{{ Former::populateField('last_name', $primaryUser->last_name) }}
|
||||
{{ Former::populateField('email', $primaryUser->email) }}
|
||||
{{ Former::populateField('phone', $primaryUser->phone) }}
|
||||
@if (Utils::isNinja())
|
||||
@if (Utils::isNinjaDev())
|
||||
{{ Former::populateField('dark_mode', intval($primaryUser->dark_mode)) }}
|
||||
@endif
|
||||
@endif
|
||||
@ -84,14 +84,14 @@
|
||||
@if ($showUser)
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">{!! trans('texts.users') !!}</h3>
|
||||
<h3 class="panel-title">{!! trans('texts.primary_user') !!}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{!! Former::text('first_name') !!}
|
||||
{!! Former::text('last_name') !!}
|
||||
{!! Former::text('email') !!}
|
||||
{!! Former::text('phone') !!}
|
||||
@if (Utils::isNinja())
|
||||
@if (Utils::isNinjaDev())
|
||||
{!! Former::checkbox('dark_mode')->text(trans('texts.dark_mode_help')) !!}
|
||||
@endif
|
||||
|
||||
|
@ -324,6 +324,10 @@
|
||||
|
||||
@yield('onReady')
|
||||
|
||||
@if (Input::has('focus'))
|
||||
$('#{{ Input::get('focus') }}').focus();
|
||||
@endif
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -630,7 +634,7 @@
|
||||
@endif
|
||||
|
||||
{{-- Per our license, please do not remove or modify this section. --}}
|
||||
@if (!Utils::isNinja())
|
||||
@if (!Utils::isNinjaProd())
|
||||
<div class="container">
|
||||
{{ trans('texts.powered_by') }} <a href="https://www.invoiceninja.com/?utm_source=powered_by" target="_blank">InvoiceNinja.com</a> |
|
||||
@if (Auth::user()->account->isWhiteLabel())
|
||||
|
@ -112,9 +112,9 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-4" id="col_2">
|
||||
@if (!$isRecurring)
|
||||
<span data-bind="visible: !is_recurring()">
|
||||
{!! Former::text('invoice_number')->label(trans("texts.{$entityType}_number_short"))->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") !!}
|
||||
@endif
|
||||
</span>
|
||||
{!! Former::text('po_number')->label(trans('texts.po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") !!}
|
||||
{!! Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'")
|
||||
->addGroupClass('discount-group')->type('number')->min('0')->step('any')->append(
|
||||
@ -151,9 +151,11 @@
|
||||
<tbody data-bind="sortable: { data: invoice_items, afterMove: onDragged }">
|
||||
<tr data-bind="event: { mouseover: showActions, mouseout: hideActions }" class="sortable-row">
|
||||
<td class="hide-border td-icon">
|
||||
<i style="display:none" data-bind="visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-sort"></i>
|
||||
<i style="display:none" data-bind="visible: actionsVisible() &&
|
||||
$index() < ($parent.invoice_items().length - 1) &&
|
||||
$parent.invoice_items().length > 1" class="fa fa-sort"></i>
|
||||
</td>
|
||||
<td>
|
||||
<td>
|
||||
{!! Former::text('product_key')->useDatalist($products->toArray(), 'product_key')->onkeyup('onItemChange()')
|
||||
->raw()->data_bind("value: product_key, valueUpdate: 'afterkeydown'")->addClass('datalist') !!}
|
||||
</td>
|
||||
@ -172,8 +174,10 @@
|
||||
<td style="text-align:right;padding-top:9px !important">
|
||||
<div class="line-total" data-bind="text: totals.total"></div>
|
||||
</td>
|
||||
<td style="cursor:pointer" class="hide-border td-icon">
|
||||
<i style="display:none" data-bind="click: $parent.removeItem, visible: actionsVisible() && $parent.invoice_items().length > 1" class="fa fa-minus-circle redlink" title="Remove item"/>
|
||||
<td style="cursor:pointer" class="hide-border td-icon">
|
||||
<i style="display:none" data-bind="click: $parent.removeItem, visible: actionsVisible() &&
|
||||
$index() < ($parent.invoice_items().length - 1) &&
|
||||
$parent.invoice_items().length > 1" class="fa fa-minus-circle redlink" title="Remove item"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -7,6 +7,7 @@
|
||||
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
|
||||
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('css/built.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('favicon.png?test') }}" rel="shortcut icon">
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
@ -28,8 +29,8 @@
|
||||
@if (version_compare(phpversion(), '5.4.0', '<'))
|
||||
<div class="alert alert-warning">Warning: The application requires PHP >= 5.4.0</div>
|
||||
@endif
|
||||
@if (!extension_loaded('fileinfo'))
|
||||
<div class="alert alert-warning">Warning: The <a href="http://php.net/manual/en/book.fileinfo.php" target="_blank">fileinfo</a> extension needs to be installed and enabled.</div>
|
||||
@if (!function_exists('proc_open'))
|
||||
<div class="alert alert-warning">Warning: <a href="http://php.net/manual/en/function.proc-open.php" target="_blank">proc_open</a> must be enabled.</div>
|
||||
@endif
|
||||
@if (!@fopen(base_path()."/.env", 'a'))
|
||||
<div class="alert alert-warning">Warning: Permission denied to write config file
|
||||
|
Loading…
x
Reference in New Issue
Block a user