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

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/spectrum/spectrum.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/bootstrap-combobox.js',
'public/js/script.js',
@ -85,11 +85,14 @@ module.exports = function(grunt) {
'public/css/bootstrap-combobox.css',
'public/css/typeahead.js-bootstrap.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',
],
dest: 'public/built.css',
nonull: true
nonull: true,
options: {
process: false
}
},
css_public: {
src: [
@ -100,7 +103,10 @@ module.exports = function(grunt) {
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.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\repositories\AccountRepository;
class AppController extends BaseController {
class AppController extends BaseController
{
protected $accountRepo;
protected $mailer;
protected $accountRepo;
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())
public function __construct(AccountRepository $accountRepo, Mailer $mailer)
{
return Redirect::to('/');
parent::__construct();
$this->accountRepo = $accountRepo;
$this->mailer = $mailer;
}
return View::make('setup');
}
public function doSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup())
public function showSetup()
{
return Redirect::to('/');
}
$valid = false;
$test = Input::get('test');
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
return Redirect::to('/');
}
$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);
return View::make('setup');
}
$valid = self::testDatabase($database);
if ($test == 'db')
public function doSetup()
{
return $valid === true ? 'Success' : $valid;
}
else if (!$valid)
{
return Redirect::to('/setup')->withInput();
}
$content = "<?php return 'production';";
$fp = fopen(base_path() . "/bootstrap/environment.php" , 'w');
fwrite($fp, $content);
fclose($fp);
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
return Redirect::to('/');
}
$configDir = app_path() . '/config/production';
if (!file_exists($configDir))
{
mkdir($configDir);
}
$valid = false;
$test = Input::get('test');
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);
}
$app = Input::get('app');
$app['key'] = str_random(RANDOM_KEY_LENGTH);
$app['debug'] = false;
Artisan::call('migrate');
Artisan::call('db:seed');
$database = Input::get('database');
$dbType = $database['default'];
$database[$dbType] = $database['type'];
unset($database['type']);
$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();
$mail = Input::get('mail');
$email = $mail['username'];
$mail['from']['address'] = $email;
//Auth::login($user, true);
$this->accountRepo->registerUser($user);
if ($test == 'mail') {
return self::testMail($mail);
}
return Redirect::to('/invoices/create');
}
$valid = self::testDatabase($database);
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();
}
if ($test == 'db') {
return $valid === true ? 'Success' : $valid;
} elseif (!$valid) {
return Redirect::to('/setup')->withInput();
}
return $valid;
}
$content = "<?php return 'production';";
$fp = fopen(base_path()."/bootstrap/environment.php", 'w');
fwrite($fp, $content);
fclose($fp);
private function testMail($mail)
{
$email = $mail['username'];
$fromName = $mail['from']['name'];
$configDir = app_path().'/config/production';
if (!file_exists($configDir)) {
mkdir($configDir);
}
foreach ($mail as $key => $val)
{
Config::set("mail.{$key}", $val);
}
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);
}
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);
}
Artisan::call('db:seed');
$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()
{
if (!Utils::isNinja()) {
try {
Artisan::call('migrate');
Cache::flush();
} catch (Exception $e) {
Response::make($e->getMessage(), 500);
}
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;
}
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' => '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' => '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' => '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' => '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' => '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' => '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-Yk g:i a', 'label' => '10-Mar-2013'));

View File

@ -17,6 +17,12 @@
<div class="jumbotron">
<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>
or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>.
<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