Bug fixes

This commit is contained in:
Hillel Coren 2015-01-15 12:50:16 +02:00
parent 310bd2bdbc
commit c67129a6a9
8 changed files with 3029 additions and 3147 deletions

View File

@ -56,7 +56,7 @@ module.exports = function(grunt) {
'public/vendor/accounting/accounting.min.js', 'public/vendor/accounting/accounting.min.js',
'public/vendor/spectrum/spectrum.js', 'public/vendor/spectrum/spectrum.js',
'public/vendor/jspdf/dist/jspdf.min.js', 'public/vendor/jspdf/dist/jspdf.min.js',
'public/vendor/handsontable/dist/jquery.handsontable.full.min.js', //'public/vendor/handsontable/dist/jquery.handsontable.full.min.js',
'public/js/lightbox.min.js', 'public/js/lightbox.min.js',
'public/js/bootstrap-combobox.js', 'public/js/bootstrap-combobox.js',
'public/js/script.js', 'public/js/script.js',
@ -85,11 +85,14 @@ module.exports = function(grunt) {
'public/css/bootstrap-combobox.css', 'public/css/bootstrap-combobox.css',
'public/css/typeahead.js-bootstrap.css', 'public/css/typeahead.js-bootstrap.css',
'public/css/lightbox.css', 'public/css/lightbox.css',
'public/vendor/handsontable/dist/jquery.handsontable.full.css', //'public/vendor/handsontable/dist/jquery.handsontable.full.css',
'public/css/style.css', 'public/css/style.css',
], ],
dest: 'public/built.css', dest: 'public/built.css',
nonull: true nonull: true,
options: {
process: false
}
}, },
css_public: { css_public: {
src: [ src: [
@ -100,7 +103,10 @@ module.exports = function(grunt) {
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css', 'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
], ],
dest: 'public/built.public.css', dest: 'public/built.public.css',
nonull: true nonull: true,
options: {
process: false
}
} }
} }
}); });

File diff suppressed because it is too large Load Diff

View File

@ -3,185 +3,169 @@
use ninja\mailers\Mailer; use ninja\mailers\Mailer;
use ninja\repositories\AccountRepository; use ninja\repositories\AccountRepository;
class AppController extends BaseController { class AppController extends BaseController
{
protected $accountRepo;
protected $mailer;
protected $accountRepo; public function __construct(AccountRepository $accountRepo, Mailer $mailer)
protected $mailer;
public function __construct(AccountRepository $accountRepo, Mailer $mailer)
{
parent::__construct();
$this->accountRepo = $accountRepo;
$this->mailer = $mailer;
}
public function showSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup())
{ {
return Redirect::to('/'); parent::__construct();
$this->accountRepo = $accountRepo;
$this->mailer = $mailer;
} }
return View::make('setup'); public function showSetup()
}
public function doSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup())
{ {
return Redirect::to('/'); if (Utils::isNinja() || Utils::isDatabaseSetup()) {
return Redirect::to('/');
}
return View::make('setup');
} }
$valid = false; public function doSetup()
$test = Input::get('test');
$app = Input::get('app');
$app['key'] = str_random(RANDOM_KEY_LENGTH);
$app['debug'] = false;
$database = Input::get('database');
$dbType = $database['default'];
$database[$dbType] = $database['type'];
unset($database['type']);
$mail = Input::get('mail');
$email = $mail['username'];
$mail['from']['address'] = $email;
if ($test == 'mail')
{ {
return self::testMail($mail); if (Utils::isNinja() || Utils::isDatabaseSetup()) {
} return Redirect::to('/');
}
$valid = self::testDatabase($database); $valid = false;
$test = Input::get('test');
if ($test == 'db') $app = Input::get('app');
{ $app['key'] = str_random(RANDOM_KEY_LENGTH);
return $valid === true ? 'Success' : $valid; $app['debug'] = false;
}
else if (!$valid)
{
return Redirect::to('/setup')->withInput();
}
$content = "<?php return 'production';"; $database = Input::get('database');
$fp = fopen(base_path() . "/bootstrap/environment.php" , 'w'); $dbType = $database['default'];
fwrite($fp, $content); $database[$dbType] = $database['type'];
fclose($fp); unset($database['type']);
$configDir = app_path() . '/config/production'; $mail = Input::get('mail');
if (!file_exists($configDir)) $email = $mail['username'];
{ $mail['from']['address'] = $email;
mkdir($configDir);
}
foreach(['app' => $app, 'database' => $database, 'mail' => $mail] as $key => $config) if ($test == 'mail') {
{ return self::testMail($mail);
$content = '<?php return ' . var_export($config, true) . ';'; }
$fp = fopen(app_path() . "/config/production/{$key}.php" , 'w');
fwrite($fp, $content);
fclose($fp);
}
Artisan::call('migrate'); $valid = self::testDatabase($database);
Artisan::call('db:seed');
$account = $this->accountRepo->create(); if ($test == 'db') {
$user = $account->users()->first(); return $valid === true ? 'Success' : $valid;
} elseif (!$valid) {
return Redirect::to('/setup')->withInput();
}
$user->first_name = trim(Input::get('first_name')); $content = "<?php return 'production';";
$user->last_name = trim(Input::get('last_name')); $fp = fopen(base_path()."/bootstrap/environment.php", 'w');
$user->email = trim(strtolower(Input::get('email'))); fwrite($fp, $content);
$user->username = $user->email; fclose($fp);
$user->password = trim(Input::get('password'));
$user->password_confirmation = trim(Input::get('password'));
$user->registered = true;
$user->amend();
//Auth::login($user, true); $configDir = app_path().'/config/production';
$this->accountRepo->registerUser($user); if (!file_exists($configDir)) {
mkdir($configDir);
}
return Redirect::to('/invoices/create'); foreach (['app' => $app, 'database' => $database, 'mail' => $mail] as $key => $config) {
} $content = '<?php return '.var_export($config, true).';';
$fp = fopen(app_path()."/config/production/{$key}.php", 'w');
fwrite($fp, $content);
fclose($fp);
}
private function testDatabase($database)
{
$dbType = $database['default'];
Config::set('database.default', $dbType);
foreach ($database[$dbType] as $key => $val)
{
Config::set("database.connections.{$dbType}.{$key}", $val);
}
try
{
$valid = DB::connection()->getDatabaseName() ? true : false;
}
catch (Exception $e)
{
return $e->getMessage();
}
return $valid;
}
private function testMail($mail)
{
$email = $mail['username'];
$fromName = $mail['from']['name'];
foreach ($mail as $key => $val)
{
Config::set("mail.{$key}", $val);
}
Config::set('mail.from.address', $email);
Config::set('mail.from.name', $fromName);
$data = [
'text' => 'Test email'
];
try
{
$this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
return 'Sent';
}
catch (Exception $e)
{
return $e->getMessage();
}
}
public function install()
{
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
try {
Artisan::call('migrate'); Artisan::call('migrate');
Artisan::call('db:seed'); Artisan::call('db:seed');
} catch (Exception $e) {
Response::make($e->getMessage(), 500); $account = $this->accountRepo->create();
} $user = $account->users()->first();
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->email = trim(strtolower(Input::get('email')));
$user->username = $user->email;
$user->password = trim(Input::get('password'));
$user->password_confirmation = trim(Input::get('password'));
$user->registered = true;
$user->amend();
//Auth::login($user, true);
$this->accountRepo->registerUser($user);
return Redirect::to('/invoices/create');
} }
return Redirect::to('/'); private function testDatabase($database)
} {
$dbType = $database['default'];
public function update() Config::set('database.default', $dbType);
{
if (!Utils::isNinja()) { foreach ($database[$dbType] as $key => $val) {
try { Config::set("database.connections.{$dbType}.{$key}", $val);
Artisan::call('migrate'); }
Cache::flush();
} catch (Exception $e) { try {
Response::make($e->getMessage(), 500); $valid = DB::connection()->getDatabaseName() ? true : false;
} } catch (Exception $e) {
return $e->getMessage();
}
return $valid;
} }
return Redirect::to('/'); private function testMail($mail)
} {
$email = $mail['username'];
$fromName = $mail['from']['name'];
foreach ($mail as $key => $val) {
Config::set("mail.{$key}", $val);
}
Config::set('mail.from.address', $email);
Config::set('mail.from.name', $fromName);
$data = [
'text' => 'Test email',
];
try {
$this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
return 'Sent';
} catch (Exception $e) {
return $e->getMessage();
}
}
public function install()
{
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
try {
Artisan::call('migrate');
Artisan::call('db:seed');
} catch (Exception $e) {
Response::make($e->getMessage(), 500);
}
}
return Redirect::to('/');
}
public function update()
{
if (!Utils::isNinja()) {
try {
Artisan::call('migrate');
Cache::flush();
} catch (Exception $e) {
Response::make($e->getMessage(), 500);
}
}
return Redirect::to('/');
}
} }

View File

@ -128,15 +128,15 @@ class ConstantsSeeder extends Seeder
Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
Currency::create(array('name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013')); DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'));
DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013')); DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));

View File

@ -17,6 +17,12 @@
<div class="jumbotron"> <div class="jumbotron">
<h2>Invoice Ninja Setup</h2> <h2>Invoice Ninja Setup</h2>
@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>
@endif
If you need help you can either post to our <a href="https://groups.google.com/forum/#!forum/invoiceninja" target="_blank">Google Group</a> If you need help you can either post to our <a href="https://groups.google.com/forum/#!forum/invoiceninja" target="_blank">Google Group</a>
or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>. or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>.
<p> <p>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long