1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-17 16:42:48 +01:00

Merge branch 'master' into Dev_PHP-Payments

Merged changes from master.
This commit is contained in:
blkmutt 2014-03-23 10:23:55 -04:00
commit 6c286b9648
29 changed files with 466 additions and 109 deletions

3
.gitignore vendored
View File

@ -10,6 +10,7 @@
/bootstrap/compiled.php
/bootstrap/environment.php
/vendor
/.env.development.php
/composer.phar
/composer.lock
/.DS_Store
@ -18,4 +19,4 @@
/ninja.sublime-workspace
/tests/_log
.idea
.project
.project

View File

@ -6,6 +6,8 @@
Most online invoicing sites are expensive. They shouldn't be. The aim of this project is to provide a free, open-source alternative. Additionally, the hope is the codebase will serve as a sample site for Laravel as well as other JavaScript technologies.
For discussion of the code please use the [Google Group](https://groups.google.com/d/forum/invoiceninja).
For updates follow [@invoiceninja](https://twitter.com/invoiceninja) or join the [Facebook Group](https://www.facebook.com/invoiceninja)
Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)

View File

@ -48,7 +48,7 @@
////////////////////////////////////////////////////////////////////
// Where Former should look for translations
'translate_from' => 'texts',
'translate_from' => 'fields',
// An array of attributes to automatically translate
'translatable' => array(

View File

@ -461,7 +461,7 @@ class AccountController extends \BaseController {
else
{
$account = Account::findOrFail(Auth::user()->account_id);
$account->account_gateways()->forceDelete();
$account->account_gateways()->delete();
if ($gatewayId)
{
@ -516,7 +516,7 @@ class AccountController extends \BaseController {
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
$account->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1; // US Dollar
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
//$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
$account->save();
$user = Auth::user();

View File

@ -43,11 +43,11 @@ class DashboardController extends \BaseController {
->orderBy('due_date', 'asc')->take(6)->get();
$data = [
'totalIncome' => Utils::formatMoney($totalIncome->value, Session::get(SESSION_CURRENCY)),
'billedClients' => $metrics->billed_clients,
'invoicesSent' => $metrics->invoices_sent,
'activeClients' => $metrics->active_clients,
'invoiceAvg' => Utils::formatMoney($metrics->invoice_avg, Session::get(SESSION_CURRENCY)),
'totalIncome' => Utils::formatMoney($totalIncome ? $totalIncome->value : 0, Session::get(SESSION_CURRENCY)),
'billedClients' => $metrics ? $metrics->billed_clients : 0,
'invoicesSent' => $metrics ? $metrics->invoices_sent : 0,
'activeClients' => $metrics ? $metrics->active_clients : 0,
'invoiceAvg' => Utils::formatMoney(($metrics ? $metrics->invoice_avg : 0), Session::get(SESSION_CURRENCY)),
'activities' => $activities,
'pastDue' => $pastDue,
'upcoming' => $upcoming

View File

@ -143,7 +143,8 @@ class InvoiceController extends \BaseController {
$data = array(
'showBreadcrumbs' => false,
'invoice' => $invoice->hidePrivateFields(),
'invitation' => $invitation
'invitation' => $invitation,
'invoiceLabels' => $client->account->getInvoiceLabels(),
);
return View::make('invoices.view', $data);
@ -223,6 +224,7 @@ class InvoiceController extends \BaseController {
'paymentTerms' => PaymentTerm::remember(DEFAULT_QUERY_CACHE)->orderBy('num_days')->get(['name', 'num_days']),
'industries' => Industry::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'invoiceDesigns' => InvoiceDesign::remember(DEFAULT_QUERY_CACHE)->orderBy('id')->get(),
'invoiceLabels' => Auth::user()->account->getInvoiceLabels(),
'frequencies' => array(
1 => 'Weekly',
2 => 'Two weeks',
@ -335,7 +337,15 @@ class InvoiceController extends \BaseController {
else
{
Session::flash('message', 'Successfully saved invoice'.$message);
Session::flash('error', 'Please sign up to email an invoice');
if (Auth::user()->registered)
{
Session::flash('error', 'Please confirm your email address');
}
else
{
Session::flash('error', 'Please sign up to email an invoice');
}
}
}
else

View File

@ -20,6 +20,17 @@ class UserController extends BaseController {
return Redirect::to(Input::get('path'));
}
public function forcePDFJS()
{
$user = Auth::user();
$user->force_pdfjs = true;
$user->save();
Session::flash('message', 'Successfully updated PDF settings');
return Redirect::to('/invoices/create');
}
/**
* Displays the form for account creation
*
@ -110,18 +121,18 @@ class UserController extends BaseController {
// with the second parameter as true.
// logAttempt will check if the 'email' perhaps is the username.
// Get the value from the config file instead of changing the controller
if ( Confide::logAttempt( $input, false ) )
if ( Input::get( 'login_email' ) && Confide::logAttempt( $input, false ) )
{
Event::fire('user.login');
// Redirect the user to the URL they were trying to access before
// caught by the authentication filter IE Redirect::guest('user/login').
// Otherwise fallback to '/'
// Fix pull #145
return Redirect::intended('/clients'); // change it to '/admin', '/dashboard' or something
return Redirect::intended('/dashboard'); // change it to '/admin', '/dashboard' or something
}
else
{
$user = new User;
//$user = new User;
// Check if there was too many login attempts
if( Confide::isThrottled( $input ) )

View File

@ -23,6 +23,7 @@ class AddLanguageSupport extends Migration {
DB::table('languages')->insert(['name' => 'Italian', 'locale' => 'it']);
DB::table('languages')->insert(['name' => 'German', 'locale' => 'de']);
DB::table('languages')->insert(['name' => 'French', 'locale' => 'fr']);
DB::table('languages')->insert(['name' => 'Brazilian Portuguese', 'locale' => 'pt_BR']);
Schema::table('accounts', function($table)
{

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class EnableForcingJspdf extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->boolean('force_pdfjs')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function($table)
{
$table->dropColumn('force_pdfjs');
});
}
}

54
app/lang/de/fields.php Normal file
View File

@ -0,0 +1,54 @@
<?php
return array(
// client
'organization' => 'Organization',
'name' => 'Name',
'website' => 'Website',
'work_phone' => 'Phone',
'address' => 'Address',
'address1' => 'Street',
'address2' => 'Apt/Suite',
'city' => 'City',
'state' => 'State/Province',
'postal_code' => 'Postal Code',
'country_id' => 'Country',
'contacts' => 'Contacts',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'phone' => 'Phone',
'email' => 'Email',
'additional_info' => 'Additional Info',
'payment_terms' => 'Payment Terms',
'currency_id' => 'Currency',
'size_id' => 'Size',
'industry_id' => 'Industry',
'private_notes' => 'Private Notes',
// invoice
'invoice' => 'Invoice',
'client' => 'Client',
'invoice_date' => 'Invoice Date',
'due_date' => 'Due Date',
'invoice_number' => 'Invoice Number',
'invoice_number_short' => 'Invoice #',
'po_number' => 'PO Number',
'po_number_short' => 'PO #',
'frequency_id' => 'How often',
'dicount' => 'Discount',
'taxes' => 'Taxes',
'tax' => 'Tax',
'item' => 'Item',
'description' => 'Description',
'unit_cost' => 'Unit Cost',
'quantity' => 'Quantity',
'line_total' => 'Line Total',
'subtotal' => 'Subtotal',
'paid_to_date' => 'Paid to Date',
'balance_due' => 'Balance Due',
'invoice_design_id' => 'Design',
'terms' => 'Terms',
'your_invoice' => 'Your Invoice',
);

54
app/lang/en/fields.php Normal file
View File

@ -0,0 +1,54 @@
<?php
return array(
// client
'organization' => 'Organization',
'name' => 'Name',
'website' => 'Website',
'work_phone' => 'Phone',
'address' => 'Address',
'address1' => 'Street',
'address2' => 'Apt/Suite',
'city' => 'City',
'state' => 'State/Province',
'postal_code' => 'Postal Code',
'country_id' => 'Country',
'contacts' => 'Contacts',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'phone' => 'Phone',
'email' => 'Email',
'additional_info' => 'Additional Info',
'payment_terms' => 'Payment Terms',
'currency_id' => 'Currency',
'size_id' => 'Size',
'industry_id' => 'Industry',
'private_notes' => 'Private Notes',
// invoice
'invoice' => 'Invoice',
'client' => 'Client',
'invoice_date' => 'Invoice Date',
'due_date' => 'Due Date',
'invoice_number' => 'Invoice Number',
'invoice_number_short' => 'Invoice #',
'po_number' => 'PO Number',
'po_number_short' => 'PO #',
'frequency_id' => 'How often',
'dicount' => 'Discount',
'taxes' => 'Taxes',
'tax' => 'Tax',
'item' => 'Item',
'description' => 'Description',
'unit_cost' => 'Unit Cost',
'quantity' => 'Quantity',
'line_total' => 'Line Total',
'subtotal' => 'Subtotal',
'paid_to_date' => 'Paid to Date',
'balance_due' => 'Balance Due',
'invoice_design_id' => 'Design',
'terms' => 'Terms',
'your_invoice' => 'Your Invoice',
);

0
app/lang/en/messages.php Normal file
View File

View File

@ -1,28 +0,0 @@
<?php
return array(
'organization' => 'Organization',
'name' => 'Name',
'website' => 'Website',
'work_phone' => 'Phone',
'address' => 'Address',
'address1' => 'Street',
'address2' => 'Apt/Suite',
'city' => 'City',
'state' => 'State/Province',
'postal_code' => 'Postal Code',
'country_id' => 'Country',
'contacts' => 'Contacts',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'phone' => 'Phone',
'email' => 'Email',
'additional_info' => 'Additional Info',
'payment_terms' => 'Payment Terms',
'currency_id' => 'Currency',
'size_id' => 'Size',
'industry_id' => 'Industry',
'private_notes' => 'Private Notes',
);

54
app/lang/fr/fields.php Normal file
View File

@ -0,0 +1,54 @@
<?php
return array(
// client
'organization' => 'Organization',
'name' => 'Name',
'website' => 'Website',
'work_phone' => 'Phone',
'address' => 'Address',
'address1' => 'Street',
'address2' => 'Apt/Suite',
'city' => 'City',
'state' => 'State/Province',
'postal_code' => 'Postal Code',
'country_id' => 'Country',
'contacts' => 'Contacts',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'phone' => 'Phone',
'email' => 'Email',
'additional_info' => 'Additional Info',
'payment_terms' => 'Payment Terms',
'currency_id' => 'Currency',
'size_id' => 'Size',
'industry_id' => 'Industry',
'private_notes' => 'Private Notes',
// invoice
'invoice' => 'Invoice',
'client' => 'Client',
'invoice_date' => 'Invoice Date',
'due_date' => 'Due Date',
'invoice_number' => 'Invoice Number',
'invoice_number_short' => 'Invoice #',
'po_number' => 'PO Number',
'po_number_short' => 'PO #',
'frequency_id' => 'How often',
'dicount' => 'Discount',
'taxes' => 'Taxes',
'tax' => 'Tax',
'item' => 'Item',
'description' => 'Description',
'unit_cost' => 'Unit Cost',
'quantity' => 'Quantity',
'line_total' => 'Line Total',
'subtotal' => 'Subtotal',
'paid_to_date' => 'Paid to Date',
'balance_due' => 'Balance Due',
'invoice_design_id' => 'Design',
'terms' => 'Terms',
'your_invoice' => 'Your Invoice',
);

54
app/lang/it/fields.php Normal file
View File

@ -0,0 +1,54 @@
<?php
return array(
// client
'organization' => 'Organization',
'name' => 'Name',
'website' => 'Website',
'work_phone' => 'Phone',
'address' => 'Address',
'address1' => 'Street',
'address2' => 'Apt/Suite',
'city' => 'City',
'state' => 'State/Province',
'postal_code' => 'Postal Code',
'country_id' => 'Country',
'contacts' => 'Contacts',
'first_name' => 'First Name',
'last_name' => 'Last Name',
'phone' => 'Phone',
'email' => 'Email',
'additional_info' => 'Additional Info',
'payment_terms' => 'Payment Terms',
'currency_id' => 'Currency',
'size_id' => 'Size',
'industry_id' => 'Industry',
'private_notes' => 'Private Notes',
// invoice
'invoice' => 'Invoice',
'client' => 'Client',
'invoice_date' => 'Invoice Date',
'due_date' => 'Due Date',
'invoice_number' => 'Invoice Number',
'invoice_number_short' => 'Invoice #',
'po_number' => 'PO Number',
'po_number_short' => 'PO #',
'frequency_id' => 'How often',
'dicount' => 'Discount',
'taxes' => 'Taxes',
'tax' => 'Tax',
'item' => 'Item',
'description' => 'Description',
'unit_cost' => 'Unit Cost',
'quantity' => 'Quantity',
'line_total' => 'Line Total',
'subtotal' => 'Subtotal',
'paid_to_date' => 'Paid to Date',
'balance_due' => 'Balance Due',
'invoice_design_id' => 'Design',
'terms' => 'Terms',
'your_invoice' => 'Your Invoice',
);

View File

@ -168,4 +168,37 @@ class Account extends Eloquent
Session::put(SESSION_DATETIME_FORMAT, $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT);
Session::put(SESSION_CURRENCY, $this->currency_id ? $this->currency_id : DEFAULT_CURRENCY);
}
public function getInvoiceLabels()
{
$data = [];
$fields = [
'invoice',
'invoice_date',
'due_date',
'invoice_number',
'po_number',
'dicount',
'taxes',
'tax',
'item',
'description',
'unit_cost',
'quantity',
'line_total',
'subtotal',
'paid_to_date',
'balance_due',
'terms',
'your_invoice',
];
foreach ($fields as $field)
{
$data[$field] = trans("fields.$field");
}
return $data;
}
}

View File

@ -96,13 +96,13 @@ class Activity extends Eloquent
public static function createInvoice($invoice)
{
if ($invoice->is_recurring)
if (Auth::check())
{
$message = Utils::encodeActivity(null, 'created recurring', $invoice);
$message = Utils::encodeActivity(Auth::user(), 'created', $invoice);
}
else
{
$message = Utils::encodeActivity(Auth::user(), 'created', $invoice);
$message = Utils::encodeActivity(null, 'created', $invoice);
}
$client = $invoice->client;

View File

@ -1,5 +1,6 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
@ -22,7 +23,6 @@
//dd(gethostname());
//Log::error('test');
Route::get('/', 'HomeController@showWelcome');
Route::get('/rocksteady', 'HomeController@showWelcome');
Route::get('/about', 'HomeController@showAboutUs');
@ -56,6 +56,7 @@ Route::group(array('before' => 'auth'), function()
{
Route::get('dashboard', 'DashboardController@index');
Route::get('view_archive/{entity_type}/{visible}', 'AccountController@setTrashVisible');
Route::get('force_inline_pdf', 'UserController@forcePDFJS');
Route::get('account/getSearchData', array('as' => 'getSearchData', 'uses' => 'AccountController@getSearchData'));
Route::get('company/{section?}', 'AccountController@showSection');
@ -173,7 +174,7 @@ HTML::macro('breadcrumbs', function() {
define('CONTACT_EMAIL', 'contact@invoiceninja.com');
define('ANALYTICS_KEY', 'UA-46031341-1');
//define('ANALYTICS_KEY', 'UA-46031341-1');
define('ENV_DEVELOPMENT', 'local');
define('ENV_STAGING', 'staging');
@ -281,4 +282,11 @@ Event::listen('illuminate.query', function($query, $bindings, $time, $name)
Log::info($query, $data);
});
*/
*/
/*
if (Auth::check() && Auth::user()->id === 1)
{
Auth::loginUsingId(1);
}
*/

View File

@ -63,8 +63,8 @@
{{ Former::text('phone') }}
{{ Former::legend('Localization') }}
{{ Former::select('language_id')->addOption('','')->label('Language')
->fromQuery($languages, 'name', 'id') }}
{{-- Former::select('language_id')->addOption('','')->label('Language')
->fromQuery($languages, 'name', 'id') --}}
{{ Former::select('currency_id')->addOption('','')->label('Currency')
->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('timezone_id')->addOption('','')->label('Timezone')

View File

@ -14,6 +14,27 @@
{{ Former::checkbox('notify_viewed')->label('&nbsp;')->text('Email me when an invoice is <b>viewed</b>') }}
{{ Former::checkbox('notify_paid')->label('&nbsp;')->text('Email me when an invoice is <b>paid</b>') }}
{{ Former::legend('Site Updates') }}
<div class="form-group">
<label for="invoice_terms" class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-8 col-sm-8">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=635126583203143";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-follow" data-href="https://www.facebook.com/invoiceninja" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>&nbsp;&nbsp;
<a href="https://twitter.com/invoiceninja" class="twitter-follow-button" data-show-count="false" data-size="medium">Follow @invoiceninja</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div></div>
{{ Former::legend('Custom Messages') }}
{{ Former::textarea('invoice_terms')->label('Set default invoice terms') }}
{{ Former::textarea('email_footer')->label('Set default email signature') }}

View File

@ -388,10 +388,10 @@
$.ajax({
type: 'POST',
url: '{{ URL::to('signup/submit') }}',
data: 'new_email=' + $('form.signUpForm #new_email').val() +
'&new_password=' + $('form.signUpForm #new_password').val() +
'&new_first_name=' + $('form.signUpForm #new_first_name').val() +
'&new_last_name=' + $('form.signUpForm #new_last_name').val(),
data: 'new_email=' + encodeURIComponent($('form.signUpForm #new_email').val()) +
'&new_password=' + encodeURIComponent($('form.signUpForm #new_password').val()) +
'&new_first_name=' + encodeURIComponent($('form.signUpForm #new_first_name').val()) +
'&new_last_name=' + encodeURIComponent($('form.signUpForm #new_last_name').val()),
success: function(result) {
if (result) {
localStorage.setItem('guest_key', '');

View File

@ -70,7 +70,7 @@
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'due_date\')"></i>') }}
</div>
<div data-bind="visible: is_recurring" style="display: none">
{{ Former::select('frequency_id')->label('How often')->options($frequencies)->data_bind("value: frequency_id") }}
{{ Former::select('frequency_id')->options($frequencies)->data_bind("value: frequency_id") }}
{{ Former::text('start_date')->data_bind("datePicker: start_date, valueUpdate: 'afterkeydown'")
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'start_date\')"></i>') }}
{{ Former::text('end_date')->data_bind("datePicker: end_date, valueUpdate: 'afterkeydown'")
@ -90,10 +90,10 @@
</div>
<div class="col-md-4" id="col_2">
{{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('po_number')->label('PO #')->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('invoice_number')->label(trans('fields.invoice_number_short'))->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('po_number')->label(trans('fields.po_number_short'))->data_bind("value: po_number, valueUpdate: 'afterkeydown'") }}
{{ Former::text('discount')->data_bind("value: discount, valueUpdate: 'afterkeydown'")->append('%') }}
{{-- Former::select('currency_id')->label('Currency')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") --}}
{{-- Former::select('currency_id')->addOption('', '')->fromQuery($currencies, 'name', 'id')->data_bind("value: currency_id") --}}
<div class="form-group" style="margin-bottom: 8px">
<label for="recurring" class="control-label col-lg-4 col-sm-4">Taxes</label>
@ -210,7 +210,7 @@
{{ Former::select('invoice_design_id')->label('Design')->style('display:inline;width:120px')->raw()
{{ Former::select('invoice_design_id')->style('display:inline;width:120px')->raw()
->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id") }}
@ -291,16 +291,16 @@
{{ Former::legend('Organization') }}
{{ Former::text('name')->data_bind("value: name, valueUpdate: 'afterkeydown', attr { placeholder: name.placeholder }") }}
{{ Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") }}
{{ Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'")->label('Phone') }}
{{ Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") }}
{{ Former::legend('Address') }}
{{ Former::text('address1')->label('Street')->data_bind("value: address1, valueUpdate: 'afterkeydown'") }}
{{ Former::text('address2')->label('Apt/Suite')->data_bind("value: address2, valueUpdate: 'afterkeydown'") }}
{{ Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") }}
{{ Former::text('address2')->data_bind("value: address2, valueUpdate: 'afterkeydown'") }}
{{ Former::text('city')->data_bind("value: city, valueUpdate: 'afterkeydown'") }}
{{ Former::text('state')->label('State/Province')->data_bind("value: state, valueUpdate: 'afterkeydown'") }}
{{ Former::text('state')->data_bind("value: state, valueUpdate: 'afterkeydown'") }}
{{ Former::text('postal_code')->data_bind("value: postal_code, valueUpdate: 'afterkeydown'") }}
{{ Former::select('country_id')->addOption('','')->label('Country')->addGroupClass('country_select')
{{ Former::select('country_id')->addOption('','')->addGroupClass('country_select')
->fromQuery($countries, 'name', 'id')->data_bind("dropdown: country_id") }}
</div>
@ -332,11 +332,11 @@
{{ Former::legend('Additional Info') }}
{{ Former::select('payment_terms')->addOption('','0')->data_bind('value: payment_terms')
->fromQuery($paymentTerms, 'name', 'num_days') }}
{{ Former::select('currency_id')->addOption('','')->label('Currency')->data_bind('value: currency_id')
{{ Former::select('currency_id')->addOption('','')->data_bind('value: currency_id')
->fromQuery($currencies, 'name', 'id') }}
{{ Former::select('size_id')->addOption('','')->label('Size')->data_bind('value: size_id')
{{ Former::select('size_id')->addOption('','')->data_bind('value: size_id')
->fromQuery($sizes, 'name', 'id') }}
{{ Former::select('industry_id')->addOption('','')->label('Industry')->data_bind('value: industry_id')
{{ Former::select('industry_id')->addOption('','')->data_bind('value: industry_id')
->fromQuery($industries, 'name', 'id') }}
{{ Former::textarea('private_notes')->data_bind('value: private_notes') }}
@ -616,14 +616,15 @@
var isRefreshing = false;
var needsRefresh = false;
function getPDFString() {
var invoice = createInvoiceModel();
var doc = generatePDF(invoice);
var doc = generatePDF(invoice, invoiceLabels);
if (!doc) return;
return doc.output('datauristring');
}
function refreshPDF() {
if (isFirefox || (isChrome && !isChromium)) {
if ({{ Auth::user()->force_pdfjs ? 'false' : 'true' }} && (isFirefox || (isChrome && !isChromium))) {
var string = getPDFString();
$('#theFrame').attr('src', string).show();
} else {
@ -1445,10 +1446,10 @@
var products = {{ $products }};
var clients = {{ $clients }};
var invoiceLabels = {{ json_encode($invoiceLabels) }};
var clientMap = {};
var $clientSelect = $('select#client');
for (var i=0; i<clients.length; i++) {
var client = clients[i];
for (var j=0; j<client.contacts.length; j++) {

View File

@ -29,6 +29,19 @@
$(function() {
window.invoice = {{ $invoice->toJson() }};
invoice.imageLogo1 = "{{ HTML::image_data('images/report_logo1.jpg') }}";
invoice.imageLogoWidth1 =120;
invoice.imageLogoHeight1 = 40
invoice.imageLogo2 = "{{ HTML::image_data('images/report_logo2.jpg') }}";
invoice.imageLogoWidth2 =325/2;
invoice.imageLogoHeight2 = 81/2;
invoice.imageLogo3 = "{{ HTML::image_data('images/report_logo3.jpg') }}";
invoice.imageLogoWidth3 =325/2;
invoice.imageLogoHeight3 = 81/2;
@if (file_exists($invoice->client->account->getLogoPath()))
invoice.image = "{{ HTML::image_data($invoice->client->account->getLogoPath()) }}";
invoice.imageWidth = {{ $invoice->client->account->getLogoWidth() }};
@ -59,6 +72,8 @@
});
}
});
var invoiceLabels = {{ json_encode($invoiceLabels) }};
function onDownloadClick() {
var doc = generatePDF(invoice);

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<title>Invoice Ninja {{ isset($title) ? $title : '' }}</title>
<title>Invoice Ninja {{ isset($title) ? $title : ' - Free Online Invoicing' }}</title>
<link rel="canonical" href="https://www.invoiceninja.com"></link>
<link href="{{ asset('favicon.ico') }}" rel="icon" type="image/x-icon">
@ -45,14 +45,14 @@
<body>
@if (App::environment() == ENV_PRODUCTION)
@if (App::environment() == ENV_PRODUCTION && isset($_ENV['ANALYTICS_KEY']) && $_ENV['ANALYTICS_KEY'])
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', ANALYTICS_KEY);
ga('create', '{{ $_ENV['ANALYTICS_KEY'] }}');
ga('send', 'pageview');
</script>
@endif

View File

@ -70,20 +70,32 @@
<div class="navbar" style="margin-bottom:0px">
<div class="container">
<div class="social">
<div class="fb-like" data-href="https://www.invoiceninja.com" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div>
<div class="fb-follow" data-href="https://www.facebook.com/invoiceninja" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>
<!--<div class="fb-follow" data-href="https://www.facebook.com/invoiceninja" data-colorscheme="light" data-layout="button" data-show-faces="false"></div>-->
<!--<a href="https://twitter.com/invoiceninja" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @invoiceninja</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>-->
<div class="fb-like" data-href="https://www.invoiceninja.com" data-layout="button" data-action="like" data-show-faces="false" data-share="false"></div>
&nbsp;
<!--
<a href="http://twitter.com/eas_id"><span class=
"socicon">c</span></a>
<a href=
"http://facebook.com/invoiceninja" target="_blank"><span class=
"socicon">b</span></a> <a href=
"http://twitter.com/invoiceninja" target="_blank"><span class=
"socicon">a</span></a>
-->
<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://www.invoiceninja.com/" data-via="invoiceninja" data-related="hillelcoren" data-count="none" data-text="Free online invoicing">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
&nbsp;
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-size="medium" data-width="300" data-href="https://www.invoiceninja.com/" data-annotation="none" data-count="false" data-recommendations="false"></div>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
&nbsp;
<!--<iframe src="http://ghbtns.com/github-btn.html?user=hillelcoren&repo=invoice-ninja&type=watch" allowtransparency="true" frameborder="0" scrolling="0" width="62" height="20"></iframe>-->
<p>&nbsp;</p>
<p>Copyright © 2014 InvoiceNinja. All rights reserved.</p>
</div>

View File

@ -528,6 +528,15 @@ footer .social .socicon {
float: left;
}
div.fb_iframe_widget {
display: inline;
}
div.fb_iframe_widget > span {
vertical-align: top !important;
}
@font-face {
font-family: 'socicon';

View File

@ -619,6 +619,13 @@ border-color: #08273c;
#signUpPopOver {
cursor: pointer;
}
div.fb_iframe_widget {
display: inline;
}
div.fb_iframe_widget > span {
vertical-align: top !important;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ecf0f1;

View File

@ -716,7 +716,7 @@ function GetReportTemplate1(doc, invoice, layout, checkMath)
SetPdfColor('LightBlue',doc);
doc.setFontSize('11');
doc.text(50, layout.headerTop, 'INVOICE');
doc.text(50, layout.headerTop, invoiceLabels.invoice.toUpperCase());
//doc.setDrawColor(220,220,220);
//doc.line(30, y, 560, y); // horizontal line
@ -896,7 +896,7 @@ function GetReportTemplate2(doc, invoice, layout, checkMath)
SetPdfColor('SomeGreen',doc);
doc.setFontSize('14');
doc.setFontType("bold");
doc.text(50, GlobalY, 'YOUR INVOICE');
doc.text(50, GlobalY, invoiceLabels.your_invoice.toUpperCase());
var z=GlobalY;
@ -1306,11 +1306,11 @@ function displayInvoice(doc, invoice, x, y, layout, rightAlignX) {
}
var data = [
{'Invoice Number': invoice.invoice_number},
{'PO Number': invoice.po_number},
{'Invoice Date': invoice.invoice_date},
{'Due Date': invoice.due_date},
{'Balance Due': formatMoney(invoice.balance_amount, invoice.client.currency_id)}
{'invoice_number': invoice.invoice_number},
{'po_number': invoice.po_number},
{'invoice_date': invoice.invoice_date},
{'due_date': invoice.due_date},
{'balance_due': formatMoney(invoice.balance_amount, invoice.client.currency_id)}
];
displayGrid(doc, invoice, data, x, y, layout, true, rightAlignX);
@ -1324,10 +1324,10 @@ function displaySubtotals(doc, layout, invoice, y, rightAlignTitleX)
//var taxTitle = 'Tax ' + getInvoiceTaxRate(invoice) + '%';
var data = [
{'Subtotal': formatMoney(invoice.subtotal_amount, invoice.client.currency_id)},
{'Discount': invoice.discount_amount > 0 ? formatMoney(invoice.discount_amount, invoice.client.currency_id) : false},
{'Tax': invoice.tax_amount > 0 ? formatMoney(invoice.tax_amount, invoice.client.currency_id) : false},
{'Paid to Date': formatMoney(invoice.amount - invoice.balance, invoice.client.currency_id)}
{'subtotal': formatMoney(invoice.subtotal_amount, invoice.client.currency_id)},
{'discount': invoice.discount_amount > 0 ? formatMoney(invoice.discount_amount, invoice.client.currency_id) : false},
{'tax': invoice.tax_amount > 0 ? formatMoney(invoice.tax_amount, invoice.client.currency_id) : false},
{'paid_to_date': formatMoney(invoice.amount - invoice.balance, invoice.client.currency_id)}
];
return displayGrid(doc, invoice, data, 300, y, layout, true, 550, rightAlignTitleX) + 10;
@ -1390,12 +1390,17 @@ function displayGrid(doc, invoice, data, x, y, layout, hasheader, rightAlignX, r
}
doc.text(marginLeft, y, value);
/*
if (rightAlignTitleX && i === 0) {
doc.setFontType('bold');
} else {
doc.setFontType('normal');
}
*/
doc.setFontType('normal');
key = invoiceLabels[key];
if (rightAlignTitleX) {
marginLeft = rightAlignTitleX - (doc.getStringUnitWidth(key) * doc.internal.getFontSize());
} else {
@ -1426,7 +1431,7 @@ function displayNotesAndTerms(doc, layout, invoice, y)
if (invoice.terms) {
doc.setFontType("bold");
doc.text(layout.marginLeft, y, "Terms");
doc.text(layout.marginLeft, y, invoiceLabels.terms);
y += 16;
doc.setFontType("normal");
doc.text(layout.marginLeft, y, invoice.terms);
@ -1502,26 +1507,25 @@ function getInvoiceTaxRate(invoice) {
function displayInvoiceHeader(doc, invoice, layout) {
var costX = layout.unitCostRight - (doc.getStringUnitWidth('Unit Cost') * doc.internal.getFontSize());
var qtyX = layout.qtyRight - (doc.getStringUnitWidth('Quantity') * doc.internal.getFontSize());
var taxX = layout.taxRight - (doc.getStringUnitWidth('Tax') * doc.internal.getFontSize());
var totalX = layout.lineTotalRight - (doc.getStringUnitWidth('Line Total') * doc.internal.getFontSize());
var costX = layout.unitCostRight - (doc.getStringUnitWidth(invoiceLabels.unit_cost) * doc.internal.getFontSize());
var qtyX = layout.qtyRight - (doc.getStringUnitWidth(invoiceLabels.quantity) * doc.internal.getFontSize());
var taxX = layout.taxRight - (doc.getStringUnitWidth(invoiceLabels.tax) * doc.internal.getFontSize());
var totalX = layout.lineTotalRight - (doc.getStringUnitWidth(invoiceLabels.line_total) * doc.internal.getFontSize());
doc.text(layout.marginLeft, layout.tableTop, 'Item');
doc.text(layout.descriptionLeft, layout.tableTop, 'Description');
doc.text(costX, layout.tableTop, 'Unit Cost');
doc.text(qtyX, layout.tableTop, 'Quantity');
doc.text(totalX, layout.tableTop, 'Line Total');
doc.text(layout.marginLeft, layout.tableTop, invoiceLabels.item);
doc.text(layout.descriptionLeft, layout.tableTop, invoiceLabels.description);
doc.text(costX, layout.tableTop, invoiceLabels.unit_cost);
doc.text(qtyX, layout.tableTop, invoiceLabels.quantity);
doc.text(totalX, layout.tableTop, invoiceLabels.line_total);
if (invoice.has_taxes)
{
doc.text(taxX, layout.tableTop, 'Tax');
doc.text(taxX, layout.tableTop, invoiceLabels.tax);
}
}
function displayInvoiceItems(doc, invoice, layout) {
doc.setFontType("normal");
var line = 1;