diff --git a/.gitignore b/.gitignore index d4e3a29cc0..8091b7cec6 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +.project diff --git a/README.md b/README.md index 7bfd991b1d..98dfbef059 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/app/config/packages/anahkiasen/former/config.php b/app/config/packages/anahkiasen/former/config.php index 327019638f..fe5eff7349 100755 --- a/app/config/packages/anahkiasen/former/config.php +++ b/app/config/packages/anahkiasen/former/config.php @@ -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( diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 8470e52f0c..d82c2ebccf 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -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(); diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php index 2c9d381961..dd8cfd1cca 100644 --- a/app/controllers/DashboardController.php +++ b/app/controllers/DashboardController.php @@ -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 diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 629e6df79e..6cd3d2295f 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -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 diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 89d8c75046..e49828d85b 100755 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -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 ) ) diff --git a/app/database/migrations/2014_03_19_201454_add_language_support.php b/app/database/migrations/2014_03_19_201454_add_language_support.php index 5e63292a7d..b48683073e 100644 --- a/app/database/migrations/2014_03_19_201454_add_language_support.php +++ b/app/database/migrations/2014_03_19_201454_add_language_support.php @@ -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) { diff --git a/app/database/migrations/2014_03_23_051736_enable_forcing_jspdf.php b/app/database/migrations/2014_03_23_051736_enable_forcing_jspdf.php new file mode 100644 index 0000000000..30d7c664e4 --- /dev/null +++ b/app/database/migrations/2014_03_23_051736_enable_forcing_jspdf.php @@ -0,0 +1,34 @@ +boolean('force_pdfjs')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function($table) + { + $table->dropColumn('force_pdfjs'); + }); + } + +} diff --git a/app/lang/de/fields.php b/app/lang/de/fields.php new file mode 100644 index 0000000000..10f5d738c3 --- /dev/null +++ b/app/lang/de/fields.php @@ -0,0 +1,54 @@ + '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', + +); \ No newline at end of file diff --git a/app/lang/en/fields.php b/app/lang/en/fields.php new file mode 100644 index 0000000000..10f5d738c3 --- /dev/null +++ b/app/lang/en/fields.php @@ -0,0 +1,54 @@ + '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', + +); \ No newline at end of file diff --git a/app/lang/en/messages.php b/app/lang/en/messages.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/lang/en/texts.php b/app/lang/en/texts.php deleted file mode 100644 index 97fa8600f4..0000000000 --- a/app/lang/en/texts.php +++ /dev/null @@ -1,28 +0,0 @@ - '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', - -); \ No newline at end of file diff --git a/app/lang/fr/fields.php b/app/lang/fr/fields.php new file mode 100644 index 0000000000..10f5d738c3 --- /dev/null +++ b/app/lang/fr/fields.php @@ -0,0 +1,54 @@ + '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', + +); \ No newline at end of file diff --git a/app/lang/it/fields.php b/app/lang/it/fields.php new file mode 100644 index 0000000000..10f5d738c3 --- /dev/null +++ b/app/lang/it/fields.php @@ -0,0 +1,54 @@ + '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', + +); \ No newline at end of file diff --git a/app/lang/pt_BR/texts.php b/app/lang/pt_BR/fields.php similarity index 100% rename from app/lang/pt_BR/texts.php rename to app/lang/pt_BR/fields.php diff --git a/app/models/Account.php b/app/models/Account.php index 0c73e2fd39..bc74165573 100755 --- a/app/models/Account.php +++ b/app/models/Account.php @@ -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; + } + } \ No newline at end of file diff --git a/app/models/Activity.php b/app/models/Activity.php index 227590fb09..5cb9b861b3 100755 --- a/app/models/Activity.php +++ b/app/models/Activity.php @@ -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; diff --git a/app/routes.php b/app/routes.php index 332bd03adf..4db3a8cfc8 100755 --- a/app/routes.php +++ b/app/routes.php @@ -1,5 +1,6 @@ '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); }); -*/ \ No newline at end of file +*/ + +/* +if (Auth::check() && Auth::user()->id === 1) +{ + Auth::loginUsingId(1); +} +*/ diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index bf8df2a957..692d0b33e7 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -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') diff --git a/app/views/accounts/notifications.blade.php b/app/views/accounts/notifications.blade.php index 4a0e8a41be..3dd004f739 100755 --- a/app/views/accounts/notifications.blade.php +++ b/app/views/accounts/notifications.blade.php @@ -14,6 +14,27 @@ {{ Former::checkbox('notify_viewed')->label(' ')->text('Email me when an invoice is viewed') }} {{ Former::checkbox('notify_paid')->label(' ')->text('Email me when an invoice is paid') }} + {{ Former::legend('Site Updates') }} + +