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
}
}
}
});

View File

@ -4,8 +4,8 @@ use ninja\repositories\AccountRepository;
use ninja\mailers\UserMailer;
use ninja\mailers\ContactMailer;
class AccountController extends \BaseController {
class AccountController extends \BaseController
{
protected $accountRepo;
protected $userMailer;
protected $contactMailer;
@ -37,30 +37,24 @@ class AccountController extends \BaseController {
public function getStarted()
{
if (Auth::check())
{
if (Auth::check()) {
return Redirect::to('invoices/create');
}
else if (!Utils::isNinja() && Account::count() > 0)
{
} elseif (!Utils::isNinja() && Account::count() > 0) {
return Redirect::to('/login');
}
$user = false;
$guestKey = Input::get('guest_key');
if ($guestKey)
{
if ($guestKey) {
$user = User::where('password', '=', $guestKey)->first();
if ($user && $user->registered)
{
if ($user && $user->registered) {
return Redirect::to('/');
}
}
if (!$user)
{
if (!$user) {
$account = $this->accountRepo->create();
$user = $account->users()->first();
@ -90,6 +84,7 @@ class AccountController extends \BaseController {
public function setTrashVisible($entityType, $visible)
{
Session::put("show_trash:{$entityType}", $visible == 'true');
return Redirect::to("{$entityType}s");
}
@ -102,8 +97,7 @@ class AccountController extends \BaseController {
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if ($section == ACCOUNT_DETAILS)
{
if ($section == ACCOUNT_DETAILS) {
$data = [
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
@ -118,25 +112,21 @@ class AccountController extends \BaseController {
];
return View::make('accounts.details', $data);
}
else if ($section == ACCOUNT_PAYMENTS)
{
} elseif ($section == ACCOUNT_PAYMENTS) {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
$accountGateway = null;
$config = null;
$configFields = null;
$selectedCards = 0;
if (count($account->account_gateways) > 0)
{
if (count($account->account_gateways) > 0) {
$accountGateway = $account->account_gateways[0];
$config = $accountGateway->config;
$selectedCards = $accountGateway->accepted_credit_cards;
$configFields = json_decode($config);
foreach($configFields as $configField => $value)
{
foreach ($configFields as $configField => $value) {
$configFields->$configField = str_repeat('*', strlen($value));
}
} else {
@ -150,45 +140,42 @@ class AccountController extends \BaseController {
->get();
$recommendedGatewayArray = array();
foreach($recommendedGateways as $recommendedGateway)
{
foreach ($recommendedGateways as $recommendedGateway) {
$arrayItem = array(
'value' => $recommendedGateway->id,
'other' => 'false',
'data-imageUrl' => asset($recommendedGateway->getLogoUrl()),
'data-siteUrl' => $recommendedGateway->site_url
'data-siteUrl' => $recommendedGateway->site_url,
);
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
}
$creditCardsArray = unserialize(CREDIT_CARDS);
$creditCards = [];
foreach($creditCardsArray as $card => $name)
{
if($selectedCards > 0 && ($selectedCards & $card) == $card)
foreach ($creditCardsArray as $card => $name) {
if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
else
} else {
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
}
}
$otherItem = array(
'value' => 1000000,
'other' => 'true',
'data-imageUrl' => '',
'data-siteUrl' => ''
'data-siteUrl' => '',
);
$recommendedGatewayArray['Other Options'] = $otherItem;
$gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
foreach ($gateways as $gateway)
{
foreach ($gateways as $gateway) {
$paymentLibrary = $gateway->paymentlibrary;
$gateway->fields = $gateway->getFields();
if ($accountGateway && $accountGateway->gateway_id == $gateway->id)
{
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
$accountGateway->fields = $gateway->fields;
}
}
@ -207,28 +194,21 @@ class AccountController extends \BaseController {
];
return View::make('accounts.payments', $data);
}
else if ($section == ACCOUNT_NOTIFICATIONS)
{
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
$data = [
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
];
return View::make('accounts.notifications', $data);
}
else if ($section == ACCOUNT_IMPORT_EXPORT)
{
} elseif ($section == ACCOUNT_IMPORT_EXPORT) {
return View::make('accounts.import_export');
}
else if ($section == ACCOUNT_ADVANCED_SETTINGS)
{
} elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
$data = [
'account' => Auth::user()->account,
'feature' => $subSection
'feature' => $subSection,
];
if ($subSection == ACCOUNT_INVOICE_DESIGN)
{
if ($subSection == ACCOUNT_INVOICE_DESIGN) {
$invoice = new stdClass();
$client = new stdClass();
$invoiceItem = new stdClass();
@ -260,11 +240,9 @@ class AccountController extends \BaseController {
}
return View::make("accounts.{$subSection}", $data);
}
else if ($section == ACCOUNT_PRODUCTS)
{
} elseif ($section == ACCOUNT_PRODUCTS) {
$data = [
'account' => Auth::user()->account
'account' => Auth::user()->account,
];
return View::make('accounts.products', $data);
@ -273,43 +251,25 @@ class AccountController extends \BaseController {
public function doSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if ($section == ACCOUNT_DETAILS)
{
if ($section == ACCOUNT_DETAILS) {
return AccountController::saveDetails();
}
else if ($section == ACCOUNT_PAYMENTS)
{
} elseif ($section == ACCOUNT_PAYMENTS) {
return AccountController::savePayments();
}
else if ($section == ACCOUNT_IMPORT_EXPORT)
{
} elseif ($section == ACCOUNT_IMPORT_EXPORT) {
return AccountController::importFile();
}
else if ($section == ACCOUNT_MAP)
{
} elseif ($section == ACCOUNT_MAP) {
return AccountController::mapFile();
}
else if ($section == ACCOUNT_NOTIFICATIONS)
{
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
return AccountController::saveNotifications();
}
else if ($section == ACCOUNT_EXPORT)
{
} elseif ($section == ACCOUNT_EXPORT) {
return AccountController::export();
}
else if ($section == ACCOUNT_ADVANCED_SETTINGS)
{
if ($subSection == ACCOUNT_INVOICE_SETTINGS)
{
} elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
if ($subSection == ACCOUNT_INVOICE_SETTINGS) {
return AccountController::saveInvoiceSettings();
}
else if ($subSection == ACCOUNT_INVOICE_DESIGN)
{
} elseif ($subSection == ACCOUNT_INVOICE_DESIGN) {
return AccountController::saveInvoiceDesign();
}
}
else if ($section == ACCOUNT_PRODUCTS)
{
} elseif ($section == ACCOUNT_PRODUCTS) {
return AccountController::saveProducts();
}
}
@ -323,13 +283,13 @@ class AccountController extends \BaseController {
$account->save();
Session::flash('message', trans('texts.updated_settings'));
return Redirect::to('company/products');
}
private function saveInvoiceSettings()
{
if (Auth::user()->account->isPro())
{
if (Auth::user()->account->isPro()) {
$account = Auth::user()->account;
$account->custom_label1 = trim(Input::get('custom_label1'));
@ -354,6 +314,7 @@ class AccountController extends \BaseController {
if (!$account->share_counter && $account->invoice_number_prefix == $account->quote_number_prefix) {
Session::flash('error', trans('texts.invalid_counter'));
return Redirect::to('company/advanced_settings/invoice_settings')->withInput();
} else {
$account->save();
@ -366,8 +327,7 @@ class AccountController extends \BaseController {
private function saveInvoiceDesign()
{
if (Auth::user()->account->isPro())
{
if (Auth::user()->account->isPro()) {
$account = Auth::user()->account;
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
$account->hide_paid_to_date = Input::get('hide_paid_to_date') ? true : false;
@ -412,13 +372,11 @@ class AccountController extends \BaseController {
private function exportData($output, $data)
{
if (count($data) > 0)
{
if (count($data) > 0) {
fputcsv($output, array_keys($data[0]));
}
foreach($data as $record)
{
foreach ($data as $record) {
fputcsv($output, $record);
}
@ -437,15 +395,12 @@ class AccountController extends \BaseController {
$countries = Country::remember(DEFAULT_QUERY_CACHE)->get();
$countryMap = [];
foreach ($countries as $country)
{
foreach ($countries as $country) {
$countryMap[strtolower($country->name)] = $country->id;
}
foreach ($data as $row)
{
if ($hasHeaders)
{
foreach ($data as $row) {
if ($hasHeaders) {
$hasHeaders = false;
continue;
}
@ -456,62 +411,36 @@ class AccountController extends \BaseController {
$contact->send_invoice = true;
$count++;
foreach ($row as $index => $value)
{
foreach ($row as $index => $value) {
$field = $map[$index];
$value = trim($value);
if ($field == Client::$fieldName && !$client->name)
{
if ($field == Client::$fieldName && !$client->name) {
$client->name = $value;
}
else if ($field == Client::$fieldPhone && !$client->work_phone)
{
} elseif ($field == Client::$fieldPhone && !$client->work_phone) {
$client->work_phone = $value;
}
else if ($field == Client::$fieldAddress1 && !$client->address1)
{
} elseif ($field == Client::$fieldAddress1 && !$client->address1) {
$client->address1 = $value;
}
else if ($field == Client::$fieldAddress2 && !$client->address2)
{
} elseif ($field == Client::$fieldAddress2 && !$client->address2) {
$client->address2 = $value;
}
else if ($field == Client::$fieldCity && !$client->city)
{
} elseif ($field == Client::$fieldCity && !$client->city) {
$client->city = $value;
}
else if ($field == Client::$fieldState && !$client->state)
{
} elseif ($field == Client::$fieldState && !$client->state) {
$client->state = $value;
}
else if ($field == Client::$fieldPostalCode && !$client->postal_code)
{
} elseif ($field == Client::$fieldPostalCode && !$client->postal_code) {
$client->postal_code = $value;
}
else if ($field == Client::$fieldCountry && !$client->country_id)
{
} elseif ($field == Client::$fieldCountry && !$client->country_id) {
$value = strtolower($value);
$client->country_id = isset($countryMap[$value]) ? $countryMap[$value] : null;
}
else if ($field == Client::$fieldNotes && !$client->private_notes)
{
} elseif ($field == Client::$fieldNotes && !$client->private_notes) {
$client->private_notes = $value;
}
else if ($field == Contact::$fieldFirstName && !$contact->first_name)
{
} elseif ($field == Contact::$fieldFirstName && !$contact->first_name) {
$contact->first_name = $value;
}
else if ($field == Contact::$fieldLastName && !$contact->last_name)
{
} elseif ($field == Contact::$fieldLastName && !$contact->last_name) {
$contact->last_name = $value;
}
else if ($field == Contact::$fieldPhone && !$contact->phone)
{
} elseif ($field == Contact::$fieldPhone && !$contact->phone) {
$contact->phone = $value;
}
else if ($field == Contact::$fieldEmail && !$contact->email)
{
} elseif ($field == Contact::$fieldEmail && !$contact->email) {
$contact->email = strtolower($value);
}
}
@ -523,6 +452,7 @@ class AccountController extends \BaseController {
$message = Utils::pluralize('created_client', $count);
Session::flash('message', $message);
return Redirect::to('clients');
}
@ -530,23 +460,23 @@ class AccountController extends \BaseController {
{
$file = Input::file('file');
if ($file == null)
{
if ($file == null) {
Session::flash('error', trans('texts.select_file'));
return Redirect::to('company/import_export');
}
$name = $file->getRealPath();
require_once(app_path().'/includes/parsecsv.lib.php');
require_once app_path().'/includes/parsecsv.lib.php';
$csv = new parseCSV();
$csv->heading = false;
$csv->auto($name);
if (count($csv->data) + Client::scope()->count() > Auth::user()->getMaxNumClients())
{
if (count($csv->data) + Client::scope()->count() > Auth::user()->getMaxNumClients()) {
$message = trans('texts.limit_clients', ['count' => Auth::user()->getMaxNumClients()]);
Session::flash('error', $message);
return Redirect::to('company/import_export');
}
@ -568,28 +498,23 @@ class AccountController extends \BaseController {
Contact::$fieldFirstName,
Contact::$fieldLastName,
Contact::$fieldPhone,
Contact::$fieldEmail
Contact::$fieldEmail,
);
if (count($csv->data) > 0)
{
if (count($csv->data) > 0) {
$headers = $csv->data[0];
foreach ($headers as $title)
{
if (strpos(strtolower($title),'name') > 0)
{
foreach ($headers as $title) {
if (strpos(strtolower($title), 'name') > 0) {
$hasHeaders = true;
break;
}
}
for ($i=0; $i<count($headers); $i++)
{
for ($i = 0; $i<count($headers); $i++) {
$title = strtolower($headers[$i]);
$mapped[$i] = '';
if ($hasHeaders)
{
if ($hasHeaders) {
$map = array(
'first' => Contact::$fieldFirstName,
'last' => Contact::$fieldLastName,
@ -606,17 +531,13 @@ class AccountController extends \BaseController {
'note' => Client::$fieldNotes,
);
foreach ($map as $search => $column)
{
foreach(explode("|", $search) as $string)
{
if (strpos($title, 'sec') === 0)
{
foreach ($map as $search => $column) {
foreach (explode("|", $search) as $string) {
if (strpos($title, 'sec') === 0) {
continue;
}
if (strpos($title, $string) !== false)
{
if (strpos($title, $string) !== false) {
$mapped[$i] = $column;
break(2);
}
@ -631,7 +552,7 @@ class AccountController extends \BaseController {
'headers' => $headers,
'hasHeaders' => $hasHeaders,
'columns' => $columns,
'mapped' => $mapped
'mapped' => $mapped,
);
return View::make('accounts.import_map', $data);
@ -651,6 +572,7 @@ class AccountController extends \BaseController {
$user->save();
Session::flash('message', trans('texts.updated_settings'));
return Redirect::to('company/notifications');
}
@ -659,27 +581,20 @@ class AccountController extends \BaseController {
$rules = array();
$recommendedId = Input::get('recommendedGateway_id');
if ($gatewayId = $recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId)
{
if ($gatewayId = $recommendedId == 1000000 ? Input::get('gateway_id') : $recommendedId) {
$gateway = Gateway::findOrFail($gatewayId);
$paymentLibrary = $gateway->paymentlibrary;
$fields = $gateway->getFields();
foreach ($fields as $field => $details)
{
if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor']))
{
if(strtolower($gateway->name) == 'beanstream')
{
if(in_array($field, ['merchant_id', 'passCode']))
{
foreach ($fields as $field => $details) {
if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor'])) {
if (strtolower($gateway->name) == 'beanstream') {
if (in_array($field, ['merchant_id', 'passCode'])) {
$rules[$gateway->id.'_'.$field] = 'required';
}
}
else
{
} else {
$rules[$gateway->id.'_'.$field] = 'required';
}
}
@ -689,29 +604,23 @@ class AccountController extends \BaseController {
$creditcards = Input::get('creditCardTypes');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
if ($validator->fails()) {
return Redirect::to('company/payments')
->withErrors($validator)
->withInput();
}
else
{
} else {
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
if ($gatewayId)
{
if ($gatewayId) {
$accountGateway = AccountGateway::createNew();
$accountGateway->gateway_id = $gatewayId;
$isMasked = false;
$config = new stdClass;
foreach ($fields as $field => $details)
{
$config = new stdClass();
foreach ($fields as $field => $details) {
$value = trim(Input::get($gateway->id.'_'.$field));
if ($value && $value === str_repeat('*', strlen($value)))
{
if ($value && $value === str_repeat('*', strlen($value))) {
$isMasked = true;
}
@ -719,22 +628,17 @@ class AccountController extends \BaseController {
}
$cardCount = 0;
if ($creditcards)
{
foreach($creditcards as $card => $value)
{
if ($creditcards) {
foreach ($creditcards as $card => $value) {
$cardCount += intval($value);
}
}
if ($isMasked && count($account->account_gateways))
{
if ($isMasked && count($account->account_gateways)) {
$currentGateway = $account->account_gateways[0];
$currentGateway->accepted_credit_cards = $cardCount;
$currentGateway->save();
}
else
{
} else {
$accountGateway->config = json_encode($config);
$accountGateway->accepted_credit_cards = $cardCount;
@ -743,9 +647,7 @@ class AccountController extends \BaseController {
}
Session::flash('message', trans('texts.updated_settings'));
}
else
{
} else {
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
}
@ -761,21 +663,17 @@ class AccountController extends \BaseController {
$user = Auth::user()->account->users()->first();
if (Auth::user()->id === $user->id)
{
if (Auth::user()->id === $user->id) {
$rules['email'] = 'email|required|unique:users,email,'.$user->id.',id';
}
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
if ($validator->fails()) {
return Redirect::to('company/details')
->withErrors($validator)
->withInput();
}
else
{
} else {
$account = Auth::user()->account;
$account->name = trim(Input::get('name'));
$account->id_number = trim(Input::get('id_number'));
@ -797,8 +695,7 @@ class AccountController extends \BaseController {
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
$account->save();
if (Auth::user()->id === $user->id)
{
if (Auth::user()->id === $user->id) {
$user->first_name = trim(Input::get('first_name'));
$user->last_name = trim(Input::get('last_name'));
$user->username = trim(Input::get('email'));
@ -808,8 +705,7 @@ class AccountController extends \BaseController {
}
/* Logo image file */
if ($file = Input::file('logo'))
{
if ($file = Input::file('logo')) {
$path = Input::file('logo')->getRealPath();
File::delete('logo/'.$account->account_key.'.jpg');
@ -820,15 +716,17 @@ class AccountController extends \BaseController {
Event::fire('user.refresh');
Session::flash('message', trans('texts.updated_settings'));
return Redirect::to('company/details');
}
}
public function removeLogo() {
public function removeLogo()
{
File::delete('logo/'.Auth::user()->account->account_key.'.jpg');
Session::flash('message', trans('texts.removed_logo'));
return Redirect::to('company/details');
}
@ -836,12 +734,9 @@ class AccountController extends \BaseController {
{
$email = User::withTrashed()->where('email', '=', Input::get('email'))->where('id', '<>', Auth::user()->id)->first();
if ($email)
{
if ($email) {
return "taken";
}
else
{
} else {
return "available";
}
}
@ -852,13 +747,12 @@ class AccountController extends \BaseController {
'new_first_name' => 'required',
'new_last_name' => 'required',
'new_password' => 'required|min:6',
'new_email' => 'email|required|unique:users,email,' . Auth::user()->id . ',id'
'new_email' => 'email|required|unique:users,email,'.Auth::user()->id.',id',
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails())
{
if ($validator->fails()) {
return '';
}
@ -872,24 +766,19 @@ class AccountController extends \BaseController {
$user->registered = true;
$user->amend();
if (Utils::isNinja())
{
if (Utils::isNinja()) {
$this->userMailer->sendConfirmation($user);
}
else
{
} else {
$this->accountRepo->registerUser($user);
}
$activities = Activity::scope()->get();
foreach ($activities as $activity)
{
foreach ($activities as $activity) {
$activity->message = str_replace('Guest', $user->getFullName(), $activity->message);
$activity->save();
}
if (Input::get('go_pro') == 'true')
{
if (Input::get('go_pro') == 'true') {
Session::set(REQUESTED_PRO_PLAN, true);
}
@ -902,7 +791,7 @@ class AccountController extends \BaseController {
{
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
$license = new License;
$license = new License();
$license->first_name = Input::get('first_name');
$license->last_name = Input::get('last_name');
$license->email = Input::get('email');
@ -918,13 +807,12 @@ class AccountController extends \BaseController {
public function cancelAccount()
{
if ($reason = trim(Input::get('reason')))
{
if ($reason = trim(Input::get('reason'))) {
$email = Auth::user()->email;
$name = Auth::user()->getDisplayName();
$data = [
'text' => $reason
'text' => $reason,
];
$this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, 'Invoice Ninja Feedback [Canceled Account]', 'contact', $data);

View File

@ -3,8 +3,8 @@
use ninja\mailers\Mailer;
use ninja\repositories\AccountRepository;
class AppController extends BaseController {
class AppController extends BaseController
{
protected $accountRepo;
protected $mailer;
@ -18,8 +18,7 @@ class AppController extends BaseController {
public function showSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup())
{
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
return Redirect::to('/');
}
@ -28,8 +27,7 @@ class AppController extends BaseController {
public function doSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup())
{
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
return Redirect::to('/');
}
@ -49,19 +47,15 @@ class AppController extends BaseController {
$email = $mail['username'];
$mail['from']['address'] = $email;
if ($test == 'mail')
{
if ($test == 'mail') {
return self::testMail($mail);
}
$valid = self::testDatabase($database);
if ($test == 'db')
{
if ($test == 'db') {
return $valid === true ? 'Success' : $valid;
}
else if (!$valid)
{
} elseif (!$valid) {
return Redirect::to('/setup')->withInput();
}
@ -71,13 +65,11 @@ class AppController extends BaseController {
fclose($fp);
$configDir = app_path().'/config/production';
if (!file_exists($configDir))
{
if (!file_exists($configDir)) {
mkdir($configDir);
}
foreach(['app' => $app, 'database' => $database, 'mail' => $mail] as $key => $config)
{
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);
@ -111,17 +103,13 @@ class AppController extends BaseController {
Config::set('database.default', $dbType);
foreach ($database[$dbType] as $key => $val)
{
foreach ($database[$dbType] as $key => $val) {
Config::set("database.connections.{$dbType}.{$key}", $val);
}
try
{
try {
$valid = DB::connection()->getDatabaseName() ? true : false;
}
catch (Exception $e)
{
} catch (Exception $e) {
return $e->getMessage();
}
@ -133,8 +121,7 @@ class AppController extends BaseController {
$email = $mail['username'];
$fromName = $mail['from']['name'];
foreach ($mail as $key => $val)
{
foreach ($mail as $key => $val) {
Config::set("mail.{$key}", $val);
}
@ -142,16 +129,14 @@ class AppController extends BaseController {
Config::set('mail.from.name', $fromName);
$data = [
'text' => 'Test email'
'text' => 'Test email',
];
try
{
try {
$this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
return 'Sent';
}
catch (Exception $e)
{
} catch (Exception $e) {
return $e->getMessage();
}
}
@ -183,5 +168,4 @@ class AppController extends BaseController {
return Redirect::to('/');
}
}

View File

@ -128,14 +128,14 @@ 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' => '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'));

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