mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Bug fixes
This commit is contained in:
parent
310bd2bdbc
commit
c67129a6a9
14
Gruntfile.js
14
Gruntfile.js
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,8 @@ use ninja\repositories\AccountRepository;
|
|||||||
use ninja\mailers\UserMailer;
|
use ninja\mailers\UserMailer;
|
||||||
use ninja\mailers\ContactMailer;
|
use ninja\mailers\ContactMailer;
|
||||||
|
|
||||||
class AccountController extends \BaseController {
|
class AccountController extends \BaseController
|
||||||
|
{
|
||||||
protected $accountRepo;
|
protected $accountRepo;
|
||||||
protected $userMailer;
|
protected $userMailer;
|
||||||
protected $contactMailer;
|
protected $contactMailer;
|
||||||
@ -37,30 +37,24 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
public function getStarted()
|
public function getStarted()
|
||||||
{
|
{
|
||||||
if (Auth::check())
|
if (Auth::check()) {
|
||||||
{
|
|
||||||
return Redirect::to('invoices/create');
|
return Redirect::to('invoices/create');
|
||||||
}
|
} elseif (!Utils::isNinja() && Account::count() > 0) {
|
||||||
else if (!Utils::isNinja() && Account::count() > 0)
|
|
||||||
{
|
|
||||||
return Redirect::to('/login');
|
return Redirect::to('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = false;
|
$user = false;
|
||||||
$guestKey = Input::get('guest_key');
|
$guestKey = Input::get('guest_key');
|
||||||
|
|
||||||
if ($guestKey)
|
if ($guestKey) {
|
||||||
{
|
|
||||||
$user = User::where('password', '=', $guestKey)->first();
|
$user = User::where('password', '=', $guestKey)->first();
|
||||||
|
|
||||||
if ($user && $user->registered)
|
if ($user && $user->registered) {
|
||||||
{
|
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$user)
|
if (!$user) {
|
||||||
{
|
|
||||||
$account = $this->accountRepo->create();
|
$account = $this->accountRepo->create();
|
||||||
$user = $account->users()->first();
|
$user = $account->users()->first();
|
||||||
|
|
||||||
@ -90,6 +84,7 @@ class AccountController extends \BaseController {
|
|||||||
public function setTrashVisible($entityType, $visible)
|
public function setTrashVisible($entityType, $visible)
|
||||||
{
|
{
|
||||||
Session::put("show_trash:{$entityType}", $visible == 'true');
|
Session::put("show_trash:{$entityType}", $visible == 'true');
|
||||||
|
|
||||||
return Redirect::to("{$entityType}s");
|
return Redirect::to("{$entityType}s");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +97,7 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
|
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
|
||||||
{
|
{
|
||||||
if ($section == ACCOUNT_DETAILS)
|
if ($section == ACCOUNT_DETAILS) {
|
||||||
{
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
||||||
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(),
|
||||||
@ -118,25 +112,21 @@ class AccountController extends \BaseController {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return View::make('accounts.details', $data);
|
return View::make('accounts.details', $data);
|
||||||
}
|
} elseif ($section == ACCOUNT_PAYMENTS) {
|
||||||
else if ($section == ACCOUNT_PAYMENTS)
|
|
||||||
{
|
|
||||||
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
|
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
|
||||||
$accountGateway = null;
|
$accountGateway = null;
|
||||||
$config = null;
|
$config = null;
|
||||||
$configFields = null;
|
$configFields = null;
|
||||||
$selectedCards = 0;
|
$selectedCards = 0;
|
||||||
|
|
||||||
if (count($account->account_gateways) > 0)
|
if (count($account->account_gateways) > 0) {
|
||||||
{
|
|
||||||
$accountGateway = $account->account_gateways[0];
|
$accountGateway = $account->account_gateways[0];
|
||||||
$config = $accountGateway->config;
|
$config = $accountGateway->config;
|
||||||
$selectedCards = $accountGateway->accepted_credit_cards;
|
$selectedCards = $accountGateway->accepted_credit_cards;
|
||||||
|
|
||||||
$configFields = json_decode($config);
|
$configFields = json_decode($config);
|
||||||
|
|
||||||
foreach($configFields as $configField => $value)
|
foreach ($configFields as $configField => $value) {
|
||||||
{
|
|
||||||
$configFields->$configField = str_repeat('*', strlen($value));
|
$configFields->$configField = str_repeat('*', strlen($value));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -150,45 +140,42 @@ class AccountController extends \BaseController {
|
|||||||
->get();
|
->get();
|
||||||
$recommendedGatewayArray = array();
|
$recommendedGatewayArray = array();
|
||||||
|
|
||||||
foreach($recommendedGateways as $recommendedGateway)
|
foreach ($recommendedGateways as $recommendedGateway) {
|
||||||
{
|
|
||||||
$arrayItem = array(
|
$arrayItem = array(
|
||||||
'value' => $recommendedGateway->id,
|
'value' => $recommendedGateway->id,
|
||||||
'other' => 'false',
|
'other' => 'false',
|
||||||
'data-imageUrl' => asset($recommendedGateway->getLogoUrl()),
|
'data-imageUrl' => asset($recommendedGateway->getLogoUrl()),
|
||||||
'data-siteUrl' => $recommendedGateway->site_url
|
'data-siteUrl' => $recommendedGateway->site_url,
|
||||||
);
|
);
|
||||||
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
$creditCardsArray = unserialize(CREDIT_CARDS);
|
$creditCardsArray = unserialize(CREDIT_CARDS);
|
||||||
$creditCards = [];
|
$creditCards = [];
|
||||||
foreach($creditCardsArray as $card => $name)
|
foreach ($creditCardsArray as $card => $name) {
|
||||||
{
|
if ($selectedCards > 0 && ($selectedCards & $card) == $card) {
|
||||||
if($selectedCards > 0 && ($selectedCards & $card) == $card)
|
|
||||||
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
|
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card']), 'checked' => 'checked'];
|
||||||
else
|
} else {
|
||||||
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
|
$creditCards[$name['text']] = ['value' => $card, 'data-imageUrl' => asset($name['card'])];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$otherItem = array(
|
$otherItem = array(
|
||||||
'value' => 1000000,
|
'value' => 1000000,
|
||||||
'other' => 'true',
|
'other' => 'true',
|
||||||
'data-imageUrl' => '',
|
'data-imageUrl' => '',
|
||||||
'data-siteUrl' => ''
|
'data-siteUrl' => '',
|
||||||
);
|
);
|
||||||
$recommendedGatewayArray['Other Options'] = $otherItem;
|
$recommendedGatewayArray['Other Options'] = $otherItem;
|
||||||
|
|
||||||
$gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
|
$gateways = Gateway::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get();
|
||||||
|
|
||||||
foreach ($gateways as $gateway)
|
foreach ($gateways as $gateway) {
|
||||||
{
|
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
$paymentLibrary = $gateway->paymentlibrary;
|
||||||
|
|
||||||
$gateway->fields = $gateway->getFields();
|
$gateway->fields = $gateway->getFields();
|
||||||
|
|
||||||
if ($accountGateway && $accountGateway->gateway_id == $gateway->id)
|
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
|
||||||
{
|
|
||||||
$accountGateway->fields = $gateway->fields;
|
$accountGateway->fields = $gateway->fields;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,28 +194,21 @@ class AccountController extends \BaseController {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return View::make('accounts.payments', $data);
|
return View::make('accounts.payments', $data);
|
||||||
}
|
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
|
||||||
else if ($section == ACCOUNT_NOTIFICATIONS)
|
|
||||||
{
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make('accounts.notifications', $data);
|
return View::make('accounts.notifications', $data);
|
||||||
}
|
} elseif ($section == ACCOUNT_IMPORT_EXPORT) {
|
||||||
else if ($section == ACCOUNT_IMPORT_EXPORT)
|
|
||||||
{
|
|
||||||
return View::make('accounts.import_export');
|
return View::make('accounts.import_export');
|
||||||
}
|
} elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
|
||||||
else if ($section == ACCOUNT_ADVANCED_SETTINGS)
|
|
||||||
{
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
'feature' => $subSection
|
'feature' => $subSection,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($subSection == ACCOUNT_INVOICE_DESIGN)
|
if ($subSection == ACCOUNT_INVOICE_DESIGN) {
|
||||||
{
|
|
||||||
$invoice = new stdClass();
|
$invoice = new stdClass();
|
||||||
$client = new stdClass();
|
$client = new stdClass();
|
||||||
$invoiceItem = new stdClass();
|
$invoiceItem = new stdClass();
|
||||||
@ -260,11 +240,9 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return View::make("accounts.{$subSection}", $data);
|
return View::make("accounts.{$subSection}", $data);
|
||||||
}
|
} elseif ($section == ACCOUNT_PRODUCTS) {
|
||||||
else if ($section == ACCOUNT_PRODUCTS)
|
|
||||||
{
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => Auth::user()->account
|
'account' => Auth::user()->account,
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make('accounts.products', $data);
|
return View::make('accounts.products', $data);
|
||||||
@ -273,43 +251,25 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
public function doSection($section = ACCOUNT_DETAILS, $subSection = false)
|
public function doSection($section = ACCOUNT_DETAILS, $subSection = false)
|
||||||
{
|
{
|
||||||
if ($section == ACCOUNT_DETAILS)
|
if ($section == ACCOUNT_DETAILS) {
|
||||||
{
|
|
||||||
return AccountController::saveDetails();
|
return AccountController::saveDetails();
|
||||||
}
|
} elseif ($section == ACCOUNT_PAYMENTS) {
|
||||||
else if ($section == ACCOUNT_PAYMENTS)
|
|
||||||
{
|
|
||||||
return AccountController::savePayments();
|
return AccountController::savePayments();
|
||||||
}
|
} elseif ($section == ACCOUNT_IMPORT_EXPORT) {
|
||||||
else if ($section == ACCOUNT_IMPORT_EXPORT)
|
|
||||||
{
|
|
||||||
return AccountController::importFile();
|
return AccountController::importFile();
|
||||||
}
|
} elseif ($section == ACCOUNT_MAP) {
|
||||||
else if ($section == ACCOUNT_MAP)
|
|
||||||
{
|
|
||||||
return AccountController::mapFile();
|
return AccountController::mapFile();
|
||||||
}
|
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
|
||||||
else if ($section == ACCOUNT_NOTIFICATIONS)
|
|
||||||
{
|
|
||||||
return AccountController::saveNotifications();
|
return AccountController::saveNotifications();
|
||||||
}
|
} elseif ($section == ACCOUNT_EXPORT) {
|
||||||
else if ($section == ACCOUNT_EXPORT)
|
|
||||||
{
|
|
||||||
return AccountController::export();
|
return AccountController::export();
|
||||||
}
|
} elseif ($section == ACCOUNT_ADVANCED_SETTINGS) {
|
||||||
else if ($section == ACCOUNT_ADVANCED_SETTINGS)
|
if ($subSection == ACCOUNT_INVOICE_SETTINGS) {
|
||||||
{
|
|
||||||
if ($subSection == ACCOUNT_INVOICE_SETTINGS)
|
|
||||||
{
|
|
||||||
return AccountController::saveInvoiceSettings();
|
return AccountController::saveInvoiceSettings();
|
||||||
}
|
} elseif ($subSection == ACCOUNT_INVOICE_DESIGN) {
|
||||||
else if ($subSection == ACCOUNT_INVOICE_DESIGN)
|
|
||||||
{
|
|
||||||
return AccountController::saveInvoiceDesign();
|
return AccountController::saveInvoiceDesign();
|
||||||
}
|
}
|
||||||
}
|
} elseif ($section == ACCOUNT_PRODUCTS) {
|
||||||
else if ($section == ACCOUNT_PRODUCTS)
|
|
||||||
{
|
|
||||||
return AccountController::saveProducts();
|
return AccountController::saveProducts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,13 +283,13 @@ class AccountController extends \BaseController {
|
|||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
||||||
return Redirect::to('company/products');
|
return Redirect::to('company/products');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function saveInvoiceSettings()
|
private function saveInvoiceSettings()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->isPro())
|
if (Auth::user()->account->isPro()) {
|
||||||
{
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
$account->custom_label1 = trim(Input::get('custom_label1'));
|
$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) {
|
if (!$account->share_counter && $account->invoice_number_prefix == $account->quote_number_prefix) {
|
||||||
Session::flash('error', trans('texts.invalid_counter'));
|
Session::flash('error', trans('texts.invalid_counter'));
|
||||||
|
|
||||||
return Redirect::to('company/advanced_settings/invoice_settings')->withInput();
|
return Redirect::to('company/advanced_settings/invoice_settings')->withInput();
|
||||||
} else {
|
} else {
|
||||||
$account->save();
|
$account->save();
|
||||||
@ -366,8 +327,7 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
private function saveInvoiceDesign()
|
private function saveInvoiceDesign()
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->isPro())
|
if (Auth::user()->account->isPro()) {
|
||||||
{
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
|
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
|
||||||
$account->hide_paid_to_date = Input::get('hide_paid_to_date') ? 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)
|
private function exportData($output, $data)
|
||||||
{
|
{
|
||||||
if (count($data) > 0)
|
if (count($data) > 0) {
|
||||||
{
|
|
||||||
fputcsv($output, array_keys($data[0]));
|
fputcsv($output, array_keys($data[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($data as $record)
|
foreach ($data as $record) {
|
||||||
{
|
|
||||||
fputcsv($output, $record);
|
fputcsv($output, $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,15 +395,12 @@ class AccountController extends \BaseController {
|
|||||||
$countries = Country::remember(DEFAULT_QUERY_CACHE)->get();
|
$countries = Country::remember(DEFAULT_QUERY_CACHE)->get();
|
||||||
$countryMap = [];
|
$countryMap = [];
|
||||||
|
|
||||||
foreach ($countries as $country)
|
foreach ($countries as $country) {
|
||||||
{
|
|
||||||
$countryMap[strtolower($country->name)] = $country->id;
|
$countryMap[strtolower($country->name)] = $country->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data as $row)
|
foreach ($data as $row) {
|
||||||
{
|
if ($hasHeaders) {
|
||||||
if ($hasHeaders)
|
|
||||||
{
|
|
||||||
$hasHeaders = false;
|
$hasHeaders = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -456,62 +411,36 @@ class AccountController extends \BaseController {
|
|||||||
$contact->send_invoice = true;
|
$contact->send_invoice = true;
|
||||||
$count++;
|
$count++;
|
||||||
|
|
||||||
foreach ($row as $index => $value)
|
foreach ($row as $index => $value) {
|
||||||
{
|
|
||||||
$field = $map[$index];
|
$field = $map[$index];
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
|
|
||||||
if ($field == Client::$fieldName && !$client->name)
|
if ($field == Client::$fieldName && !$client->name) {
|
||||||
{
|
|
||||||
$client->name = $value;
|
$client->name = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldPhone && !$client->work_phone) {
|
||||||
else if ($field == Client::$fieldPhone && !$client->work_phone)
|
|
||||||
{
|
|
||||||
$client->work_phone = $value;
|
$client->work_phone = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldAddress1 && !$client->address1) {
|
||||||
else if ($field == Client::$fieldAddress1 && !$client->address1)
|
|
||||||
{
|
|
||||||
$client->address1 = $value;
|
$client->address1 = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldAddress2 && !$client->address2) {
|
||||||
else if ($field == Client::$fieldAddress2 && !$client->address2)
|
|
||||||
{
|
|
||||||
$client->address2 = $value;
|
$client->address2 = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldCity && !$client->city) {
|
||||||
else if ($field == Client::$fieldCity && !$client->city)
|
|
||||||
{
|
|
||||||
$client->city = $value;
|
$client->city = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldState && !$client->state) {
|
||||||
else if ($field == Client::$fieldState && !$client->state)
|
|
||||||
{
|
|
||||||
$client->state = $value;
|
$client->state = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldPostalCode && !$client->postal_code) {
|
||||||
else if ($field == Client::$fieldPostalCode && !$client->postal_code)
|
|
||||||
{
|
|
||||||
$client->postal_code = $value;
|
$client->postal_code = $value;
|
||||||
}
|
} elseif ($field == Client::$fieldCountry && !$client->country_id) {
|
||||||
else if ($field == Client::$fieldCountry && !$client->country_id)
|
|
||||||
{
|
|
||||||
$value = strtolower($value);
|
$value = strtolower($value);
|
||||||
$client->country_id = isset($countryMap[$value]) ? $countryMap[$value] : null;
|
$client->country_id = isset($countryMap[$value]) ? $countryMap[$value] : null;
|
||||||
}
|
} elseif ($field == Client::$fieldNotes && !$client->private_notes) {
|
||||||
else if ($field == Client::$fieldNotes && !$client->private_notes)
|
|
||||||
{
|
|
||||||
$client->private_notes = $value;
|
$client->private_notes = $value;
|
||||||
}
|
} elseif ($field == Contact::$fieldFirstName && !$contact->first_name) {
|
||||||
else if ($field == Contact::$fieldFirstName && !$contact->first_name)
|
|
||||||
{
|
|
||||||
$contact->first_name = $value;
|
$contact->first_name = $value;
|
||||||
}
|
} elseif ($field == Contact::$fieldLastName && !$contact->last_name) {
|
||||||
else if ($field == Contact::$fieldLastName && !$contact->last_name)
|
|
||||||
{
|
|
||||||
$contact->last_name = $value;
|
$contact->last_name = $value;
|
||||||
}
|
} elseif ($field == Contact::$fieldPhone && !$contact->phone) {
|
||||||
else if ($field == Contact::$fieldPhone && !$contact->phone)
|
|
||||||
{
|
|
||||||
$contact->phone = $value;
|
$contact->phone = $value;
|
||||||
}
|
} elseif ($field == Contact::$fieldEmail && !$contact->email) {
|
||||||
else if ($field == Contact::$fieldEmail && !$contact->email)
|
|
||||||
{
|
|
||||||
$contact->email = strtolower($value);
|
$contact->email = strtolower($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,6 +452,7 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
$message = Utils::pluralize('created_client', $count);
|
$message = Utils::pluralize('created_client', $count);
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
||||||
return Redirect::to('clients');
|
return Redirect::to('clients');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,23 +460,23 @@ class AccountController extends \BaseController {
|
|||||||
{
|
{
|
||||||
$file = Input::file('file');
|
$file = Input::file('file');
|
||||||
|
|
||||||
if ($file == null)
|
if ($file == null) {
|
||||||
{
|
|
||||||
Session::flash('error', trans('texts.select_file'));
|
Session::flash('error', trans('texts.select_file'));
|
||||||
|
|
||||||
return Redirect::to('company/import_export');
|
return Redirect::to('company/import_export');
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $file->getRealPath();
|
$name = $file->getRealPath();
|
||||||
|
|
||||||
require_once(app_path().'/includes/parsecsv.lib.php');
|
require_once app_path().'/includes/parsecsv.lib.php';
|
||||||
$csv = new parseCSV();
|
$csv = new parseCSV();
|
||||||
$csv->heading = false;
|
$csv->heading = false;
|
||||||
$csv->auto($name);
|
$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()]);
|
$message = trans('texts.limit_clients', ['count' => Auth::user()->getMaxNumClients()]);
|
||||||
Session::flash('error', $message);
|
Session::flash('error', $message);
|
||||||
|
|
||||||
return Redirect::to('company/import_export');
|
return Redirect::to('company/import_export');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,28 +498,23 @@ class AccountController extends \BaseController {
|
|||||||
Contact::$fieldFirstName,
|
Contact::$fieldFirstName,
|
||||||
Contact::$fieldLastName,
|
Contact::$fieldLastName,
|
||||||
Contact::$fieldPhone,
|
Contact::$fieldPhone,
|
||||||
Contact::$fieldEmail
|
Contact::$fieldEmail,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($csv->data) > 0)
|
if (count($csv->data) > 0) {
|
||||||
{
|
|
||||||
$headers = $csv->data[0];
|
$headers = $csv->data[0];
|
||||||
foreach ($headers as $title)
|
foreach ($headers as $title) {
|
||||||
{
|
if (strpos(strtolower($title), 'name') > 0) {
|
||||||
if (strpos(strtolower($title),'name') > 0)
|
|
||||||
{
|
|
||||||
$hasHeaders = true;
|
$hasHeaders = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i=0; $i<count($headers); $i++)
|
for ($i = 0; $i<count($headers); $i++) {
|
||||||
{
|
|
||||||
$title = strtolower($headers[$i]);
|
$title = strtolower($headers[$i]);
|
||||||
$mapped[$i] = '';
|
$mapped[$i] = '';
|
||||||
|
|
||||||
if ($hasHeaders)
|
if ($hasHeaders) {
|
||||||
{
|
|
||||||
$map = array(
|
$map = array(
|
||||||
'first' => Contact::$fieldFirstName,
|
'first' => Contact::$fieldFirstName,
|
||||||
'last' => Contact::$fieldLastName,
|
'last' => Contact::$fieldLastName,
|
||||||
@ -606,17 +531,13 @@ class AccountController extends \BaseController {
|
|||||||
'note' => Client::$fieldNotes,
|
'note' => Client::$fieldNotes,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($map as $search => $column)
|
foreach ($map as $search => $column) {
|
||||||
{
|
foreach (explode("|", $search) as $string) {
|
||||||
foreach(explode("|", $search) as $string)
|
if (strpos($title, 'sec') === 0) {
|
||||||
{
|
|
||||||
if (strpos($title, 'sec') === 0)
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($title, $string) !== false)
|
if (strpos($title, $string) !== false) {
|
||||||
{
|
|
||||||
$mapped[$i] = $column;
|
$mapped[$i] = $column;
|
||||||
break(2);
|
break(2);
|
||||||
}
|
}
|
||||||
@ -631,7 +552,7 @@ class AccountController extends \BaseController {
|
|||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'hasHeaders' => $hasHeaders,
|
'hasHeaders' => $hasHeaders,
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
'mapped' => $mapped
|
'mapped' => $mapped,
|
||||||
);
|
);
|
||||||
|
|
||||||
return View::make('accounts.import_map', $data);
|
return View::make('accounts.import_map', $data);
|
||||||
@ -651,6 +572,7 @@ class AccountController extends \BaseController {
|
|||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
||||||
return Redirect::to('company/notifications');
|
return Redirect::to('company/notifications');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,27 +581,20 @@ class AccountController extends \BaseController {
|
|||||||
$rules = array();
|
$rules = array();
|
||||||
$recommendedId = Input::get('recommendedGateway_id');
|
$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);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
|
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
$paymentLibrary = $gateway->paymentlibrary;
|
||||||
|
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
|
|
||||||
foreach ($fields as $field => $details)
|
foreach ($fields as $field => $details) {
|
||||||
{
|
if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor'])) {
|
||||||
if (!in_array($field, ['testMode', 'developerMode', 'headerImageUrl', 'solutionType', 'landingPage', 'brandName', 'logoImageUrl', 'borderColor']))
|
if (strtolower($gateway->name) == 'beanstream') {
|
||||||
{
|
if (in_array($field, ['merchant_id', 'passCode'])) {
|
||||||
if(strtolower($gateway->name) == 'beanstream')
|
|
||||||
{
|
|
||||||
if(in_array($field, ['merchant_id', 'passCode']))
|
|
||||||
{
|
|
||||||
$rules[$gateway->id.'_'.$field] = 'required';
|
$rules[$gateway->id.'_'.$field] = 'required';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$rules[$gateway->id.'_'.$field] = 'required';
|
$rules[$gateway->id.'_'.$field] = 'required';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -689,29 +604,23 @@ class AccountController extends \BaseController {
|
|||||||
$creditcards = Input::get('creditCardTypes');
|
$creditcards = Input::get('creditCardTypes');
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails()) {
|
||||||
{
|
|
||||||
return Redirect::to('company/payments')
|
return Redirect::to('company/payments')
|
||||||
->withErrors($validator)
|
->withErrors($validator)
|
||||||
->withInput();
|
->withInput();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
|
$account = Account::with('account_gateways')->findOrFail(Auth::user()->account_id);
|
||||||
|
|
||||||
if ($gatewayId)
|
if ($gatewayId) {
|
||||||
{
|
|
||||||
$accountGateway = AccountGateway::createNew();
|
$accountGateway = AccountGateway::createNew();
|
||||||
$accountGateway->gateway_id = $gatewayId;
|
$accountGateway->gateway_id = $gatewayId;
|
||||||
$isMasked = false;
|
$isMasked = false;
|
||||||
|
|
||||||
$config = new stdClass;
|
$config = new stdClass();
|
||||||
foreach ($fields as $field => $details)
|
foreach ($fields as $field => $details) {
|
||||||
{
|
|
||||||
$value = trim(Input::get($gateway->id.'_'.$field));
|
$value = trim(Input::get($gateway->id.'_'.$field));
|
||||||
|
|
||||||
if ($value && $value === str_repeat('*', strlen($value)))
|
if ($value && $value === str_repeat('*', strlen($value))) {
|
||||||
{
|
|
||||||
$isMasked = true;
|
$isMasked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,22 +628,17 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$cardCount = 0;
|
$cardCount = 0;
|
||||||
if ($creditcards)
|
if ($creditcards) {
|
||||||
{
|
foreach ($creditcards as $card => $value) {
|
||||||
foreach($creditcards as $card => $value)
|
|
||||||
{
|
|
||||||
$cardCount += intval($value);
|
$cardCount += intval($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isMasked && count($account->account_gateways))
|
if ($isMasked && count($account->account_gateways)) {
|
||||||
{
|
|
||||||
$currentGateway = $account->account_gateways[0];
|
$currentGateway = $account->account_gateways[0];
|
||||||
$currentGateway->accepted_credit_cards = $cardCount;
|
$currentGateway->accepted_credit_cards = $cardCount;
|
||||||
$currentGateway->save();
|
$currentGateway->save();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$accountGateway->config = json_encode($config);
|
$accountGateway->config = json_encode($config);
|
||||||
$accountGateway->accepted_credit_cards = $cardCount;
|
$accountGateway->accepted_credit_cards = $cardCount;
|
||||||
|
|
||||||
@ -743,9 +647,7 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
|
Session::flash('error', trans('validation.required', ['attribute' => 'gateway']));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,21 +663,17 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
$user = Auth::user()->account->users()->first();
|
$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';
|
$rules['email'] = 'email|required|unique:users,email,'.$user->id.',id';
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails()) {
|
||||||
{
|
|
||||||
return Redirect::to('company/details')
|
return Redirect::to('company/details')
|
||||||
->withErrors($validator)
|
->withErrors($validator)
|
||||||
->withInput();
|
->withInput();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->name = trim(Input::get('name'));
|
$account->name = trim(Input::get('name'));
|
||||||
$account->id_number = trim(Input::get('id_number'));
|
$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->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
if (Auth::user()->id === $user->id)
|
if (Auth::user()->id === $user->id) {
|
||||||
{
|
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
$user->first_name = trim(Input::get('first_name'));
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->last_name = trim(Input::get('last_name'));
|
||||||
$user->username = trim(Input::get('email'));
|
$user->username = trim(Input::get('email'));
|
||||||
@ -808,8 +705,7 @@ class AccountController extends \BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Logo image file */
|
/* Logo image file */
|
||||||
if ($file = Input::file('logo'))
|
if ($file = Input::file('logo')) {
|
||||||
{
|
|
||||||
$path = Input::file('logo')->getRealPath();
|
$path = Input::file('logo')->getRealPath();
|
||||||
File::delete('logo/'.$account->account_key.'.jpg');
|
File::delete('logo/'.$account->account_key.'.jpg');
|
||||||
|
|
||||||
@ -820,15 +716,17 @@ class AccountController extends \BaseController {
|
|||||||
Event::fire('user.refresh');
|
Event::fire('user.refresh');
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
||||||
return Redirect::to('company/details');
|
return Redirect::to('company/details');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeLogo() {
|
public function removeLogo()
|
||||||
|
{
|
||||||
File::delete('logo/'.Auth::user()->account->account_key.'.jpg');
|
File::delete('logo/'.Auth::user()->account->account_key.'.jpg');
|
||||||
|
|
||||||
Session::flash('message', trans('texts.removed_logo'));
|
Session::flash('message', trans('texts.removed_logo'));
|
||||||
|
|
||||||
return Redirect::to('company/details');
|
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();
|
$email = User::withTrashed()->where('email', '=', Input::get('email'))->where('id', '<>', Auth::user()->id)->first();
|
||||||
|
|
||||||
if ($email)
|
if ($email) {
|
||||||
{
|
|
||||||
return "taken";
|
return "taken";
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return "available";
|
return "available";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -852,13 +747,12 @@ class AccountController extends \BaseController {
|
|||||||
'new_first_name' => 'required',
|
'new_first_name' => 'required',
|
||||||
'new_last_name' => 'required',
|
'new_last_name' => 'required',
|
||||||
'new_password' => 'required|min:6',
|
'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);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails())
|
if ($validator->fails()) {
|
||||||
{
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -872,24 +766,19 @@ class AccountController extends \BaseController {
|
|||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
$user->amend();
|
$user->amend();
|
||||||
|
|
||||||
if (Utils::isNinja())
|
if (Utils::isNinja()) {
|
||||||
{
|
|
||||||
$this->userMailer->sendConfirmation($user);
|
$this->userMailer->sendConfirmation($user);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->accountRepo->registerUser($user);
|
$this->accountRepo->registerUser($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
$activities = Activity::scope()->get();
|
$activities = Activity::scope()->get();
|
||||||
foreach ($activities as $activity)
|
foreach ($activities as $activity) {
|
||||||
{
|
|
||||||
$activity->message = str_replace('Guest', $user->getFullName(), $activity->message);
|
$activity->message = str_replace('Guest', $user->getFullName(), $activity->message);
|
||||||
$activity->save();
|
$activity->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::get('go_pro') == 'true')
|
if (Input::get('go_pro') == 'true') {
|
||||||
{
|
|
||||||
Session::set(REQUESTED_PRO_PLAN, 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();
|
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
||||||
|
|
||||||
$license = new License;
|
$license = new License();
|
||||||
$license->first_name = Input::get('first_name');
|
$license->first_name = Input::get('first_name');
|
||||||
$license->last_name = Input::get('last_name');
|
$license->last_name = Input::get('last_name');
|
||||||
$license->email = Input::get('email');
|
$license->email = Input::get('email');
|
||||||
@ -918,13 +807,12 @@ class AccountController extends \BaseController {
|
|||||||
|
|
||||||
public function cancelAccount()
|
public function cancelAccount()
|
||||||
{
|
{
|
||||||
if ($reason = trim(Input::get('reason')))
|
if ($reason = trim(Input::get('reason'))) {
|
||||||
{
|
|
||||||
$email = Auth::user()->email;
|
$email = Auth::user()->email;
|
||||||
$name = Auth::user()->getDisplayName();
|
$name = Auth::user()->getDisplayName();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'text' => $reason
|
'text' => $reason,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, 'Invoice Ninja Feedback [Canceled Account]', 'contact', $data);
|
$this->userMailer->sendTo(CONTACT_EMAIL, $email, $name, 'Invoice Ninja Feedback [Canceled Account]', 'contact', $data);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
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 $accountRepo;
|
||||||
protected $mailer;
|
protected $mailer;
|
||||||
|
|
||||||
@ -18,8 +18,7 @@ class AppController extends BaseController {
|
|||||||
|
|
||||||
public function showSetup()
|
public function showSetup()
|
||||||
{
|
{
|
||||||
if (Utils::isNinja() || Utils::isDatabaseSetup())
|
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
|
||||||
{
|
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,8 +27,7 @@ class AppController extends BaseController {
|
|||||||
|
|
||||||
public function doSetup()
|
public function doSetup()
|
||||||
{
|
{
|
||||||
if (Utils::isNinja() || Utils::isDatabaseSetup())
|
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
|
||||||
{
|
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,19 +47,15 @@ class AppController extends BaseController {
|
|||||||
$email = $mail['username'];
|
$email = $mail['username'];
|
||||||
$mail['from']['address'] = $email;
|
$mail['from']['address'] = $email;
|
||||||
|
|
||||||
if ($test == 'mail')
|
if ($test == 'mail') {
|
||||||
{
|
|
||||||
return self::testMail($mail);
|
return self::testMail($mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
$valid = self::testDatabase($database);
|
$valid = self::testDatabase($database);
|
||||||
|
|
||||||
if ($test == 'db')
|
if ($test == 'db') {
|
||||||
{
|
|
||||||
return $valid === true ? 'Success' : $valid;
|
return $valid === true ? 'Success' : $valid;
|
||||||
}
|
} elseif (!$valid) {
|
||||||
else if (!$valid)
|
|
||||||
{
|
|
||||||
return Redirect::to('/setup')->withInput();
|
return Redirect::to('/setup')->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,13 +65,11 @@ class AppController extends BaseController {
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$configDir = app_path().'/config/production';
|
$configDir = app_path().'/config/production';
|
||||||
if (!file_exists($configDir))
|
if (!file_exists($configDir)) {
|
||||||
{
|
|
||||||
mkdir($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).';';
|
$content = '<?php return '.var_export($config, true).';';
|
||||||
$fp = fopen(app_path()."/config/production/{$key}.php", 'w');
|
$fp = fopen(app_path()."/config/production/{$key}.php", 'w');
|
||||||
fwrite($fp, $content);
|
fwrite($fp, $content);
|
||||||
@ -111,17 +103,13 @@ class AppController extends BaseController {
|
|||||||
|
|
||||||
Config::set('database.default', $dbType);
|
Config::set('database.default', $dbType);
|
||||||
|
|
||||||
foreach ($database[$dbType] as $key => $val)
|
foreach ($database[$dbType] as $key => $val) {
|
||||||
{
|
|
||||||
Config::set("database.connections.{$dbType}.{$key}", $val);
|
Config::set("database.connections.{$dbType}.{$key}", $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$valid = DB::connection()->getDatabaseName() ? true : false;
|
$valid = DB::connection()->getDatabaseName() ? true : false;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,8 +121,7 @@ class AppController extends BaseController {
|
|||||||
$email = $mail['username'];
|
$email = $mail['username'];
|
||||||
$fromName = $mail['from']['name'];
|
$fromName = $mail['from']['name'];
|
||||||
|
|
||||||
foreach ($mail as $key => $val)
|
foreach ($mail as $key => $val) {
|
||||||
{
|
|
||||||
Config::set("mail.{$key}", $val);
|
Config::set("mail.{$key}", $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,16 +129,14 @@ class AppController extends BaseController {
|
|||||||
Config::set('mail.from.name', $fromName);
|
Config::set('mail.from.name', $fromName);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'text' => 'Test email'
|
'text' => 'Test email',
|
||||||
];
|
];
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
$this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
|
$this->mailer->sendTo($email, $email, $fromName, 'Test email', 'contact', $data);
|
||||||
|
|
||||||
return 'Sent';
|
return 'Sent';
|
||||||
}
|
} catch (Exception $e) {
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,5 +168,4 @@ class AppController extends BaseController {
|
|||||||
|
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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' => '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' => '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' => '.'));
|
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'));
|
||||||
|
@ -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>
|
||||||
|
1020
public/built.css
1020
public/built.css
File diff suppressed because one or more lines are too long
2716
public/built.js
2716
public/built.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user