mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-21 10:30:55 -04:00
bug fixes
This commit is contained in:
parent
309442cab3
commit
fff1aa69d3
@ -506,10 +506,10 @@ class AccountController extends \BaseController {
|
|||||||
public function submitSignup()
|
public function submitSignup()
|
||||||
{
|
{
|
||||||
$rules = array(
|
$rules = array(
|
||||||
'first_name' => 'required',
|
'new_first_name' => 'required',
|
||||||
'last_name' => 'required',
|
'new_last_name' => 'required',
|
||||||
'password' => 'required|min:6',
|
'new_password' => 'required|min:6',
|
||||||
'email' => 'email|required'
|
'new_email' => 'email|required'
|
||||||
);
|
);
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
@ -528,7 +528,8 @@ class AccountController extends \BaseController {
|
|||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$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();
|
||||||
}
|
}
|
||||||
|
@ -114,11 +114,11 @@ class ClientController extends \BaseController {
|
|||||||
public function show($publicId)
|
public function show($publicId)
|
||||||
{
|
{
|
||||||
$client = Client::scope($publicId)->with('contacts', 'client_size', 'client_industry')->firstOrFail();
|
$client = Client::scope($publicId)->with('contacts', 'client_size', 'client_industry')->firstOrFail();
|
||||||
Utils::trackViewed($client->name, ENTITY_CLIENT);
|
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'client' => $client,
|
'client' => $client,
|
||||||
'title' => '- ' . $client->name,
|
'title' => '- ' . $client->getDisplayName(),
|
||||||
'hasRecurringInvoices' => Invoice::scope()->where('is_recurring', '=', true)->whereClientId($client->id)->count() > 0
|
'hasRecurringInvoices' => Invoice::scope()->where('is_recurring', '=', true)->whereClientId($client->id)->count() > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@ class CreditController extends \BaseController {
|
|||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$credit = Credit::scope($publicId)->firstOrFail();
|
$credit = Credit::scope($publicId)->firstOrFail();
|
||||||
|
$credit->credit_date = Utils::fromSqlDate($credit->credit_date);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'client' => null,
|
'client' => null,
|
||||||
'credit' => $credit,
|
'credit' => $credit,
|
||||||
@ -126,7 +128,7 @@ class CreditController extends \BaseController {
|
|||||||
$credit = Credit::createNew();
|
$credit = Credit::createNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
$credit->client_id = Input::get('client');
|
$credit->client_id = Client::getPrivateId(Input::get('client'));
|
||||||
$credit->credit_date = Utils::toSqlDate(Input::get('credit_date'));
|
$credit->credit_date = Utils::toSqlDate(Input::get('credit_date'));
|
||||||
$credit->amount = floatval(Input::get('amount'));
|
$credit->amount = floatval(Input::get('amount'));
|
||||||
$credit->currency_id = Input::get('currency_id') ? Input::get('currency_id') : null;
|
$credit->currency_id = Input::get('currency_id') ? Input::get('currency_id') : null;
|
||||||
@ -134,7 +136,7 @@ class CreditController extends \BaseController {
|
|||||||
|
|
||||||
$message = $publicId ? 'Successfully updated credit' : 'Successfully created credit';
|
$message = $publicId ? 'Successfully updated credit' : 'Successfully created credit';
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
return Redirect::to('clients/' . $credit->client_id);
|
return Redirect::to('clients/' . Input::get('client'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,12 @@ class InvoiceController extends \BaseController {
|
|||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$invoice = Invoice::scope($publicId)->with('account.country', 'client', 'invoice_items')->firstOrFail();
|
$invoice = Invoice::scope($publicId)->with('account.country', 'client', 'invoice_items')->firstOrFail();
|
||||||
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->name, ENTITY_INVOICE);
|
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->getDisplayName(), ENTITY_INVOICE);
|
||||||
|
|
||||||
|
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||||
|
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||||
|
$invoice->start_date = Utils::fromSqlDate($invoice->start_date);
|
||||||
|
$invoice->end_date = Utils::fromSqlDate($invoice->end_date);
|
||||||
|
|
||||||
$contactIds = DB::table('invitations')
|
$contactIds = DB::table('invitations')
|
||||||
->join('contacts', 'contacts.id', '=','invitations.contact_id')
|
->join('contacts', 'contacts.id', '=','invitations.contact_id')
|
||||||
@ -453,7 +458,7 @@ class InvoiceController extends \BaseController {
|
|||||||
{
|
{
|
||||||
$message = ' and created client';
|
$message = ' and created client';
|
||||||
$url = URL::to('clients/' . $client->public_id);
|
$url = URL::to('clients/' . $client->public_id);
|
||||||
Utils::trackViewed($client->name, ENTITY_CLIENT, $url);
|
Utils::trackViewed($client->getDisplayName(), ENTITY_CLIENT, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'clone')
|
if ($action == 'clone')
|
||||||
|
@ -89,6 +89,8 @@ class PaymentController extends \BaseController
|
|||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$payment = Payment::scope($publicId)->firstOrFail();
|
$payment = Payment::scope($publicId)->firstOrFail();
|
||||||
|
$payment->payment_date = Utils::fromSqlDate($payment->payment_date);
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'client' => null,
|
'client' => null,
|
||||||
'invoice' => null,
|
'invoice' => null,
|
||||||
@ -132,9 +134,9 @@ class PaymentController extends \BaseController
|
|||||||
$payment = Payment::createNew();
|
$payment = Payment::createNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoiceId = Input::get('invoice') && Input::get('invoice') != "-1" ? Input::get('invoice') : null;
|
$invoiceId = Input::get('invoice') && Input::get('invoice') != "-1" ? Invoice::getPrivateId(Input::get('invoice')) : null;
|
||||||
|
|
||||||
$payment->client_id = Input::get('client');
|
$payment->client_id = Client::getPrivateId(Input::get('client'));
|
||||||
$payment->invoice_id = $invoiceId;
|
$payment->invoice_id = $invoiceId;
|
||||||
$payment->currency_id = Input::get('currency_id') ? Input::get('currency_id') : null;
|
$payment->currency_id = Input::get('currency_id') ? Input::get('currency_id') : null;
|
||||||
$payment->payment_date = Utils::toSqlDate(Input::get('payment_date'));
|
$payment->payment_date = Utils::toSqlDate(Input::get('payment_date'));
|
||||||
@ -143,7 +145,7 @@ class PaymentController extends \BaseController
|
|||||||
|
|
||||||
$message = $publicId ? 'Successfully updated payment' : 'Successfully created payment';
|
$message = $publicId ? 'Successfully updated payment' : 'Successfully created payment';
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
return Redirect::to('clients/' . $payment->client_id);
|
return Redirect::to('clients/' . Input::get('client'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,15 +8,15 @@ class ReportController extends \BaseController {
|
|||||||
{
|
{
|
||||||
$groupBy = Input::get('group_by');
|
$groupBy = Input::get('group_by');
|
||||||
$chartType = Input::get('chart_type');
|
$chartType = Input::get('chart_type');
|
||||||
$startDate = date_create(Input::get('start_date'));
|
$startDate = Utils::toSqlDate(Input::get('start_date'), false);
|
||||||
$endDate = date_create(Input::get('end_date'));
|
$endDate = Utils::toSqlDate(Input::get('end_date'), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$groupBy = 'MONTH';
|
$groupBy = 'MONTH';
|
||||||
$chartType = 'Bar';
|
$chartType = 'Bar';
|
||||||
$startDate = date_create()->modify('-3 month');
|
$startDate = Utils::today(false)->modify('-3 month');
|
||||||
$endDate = date_create();
|
$endDate = Utils::today(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$padding = $groupBy == 'DAYOFYEAR' ? 'day' : ($groupBy == 'WEEK' ? 'week' : 'month');
|
$padding = $groupBy == 'DAYOFYEAR' ? 'day' : ($groupBy == 'WEEK' ? 'week' : 'month');
|
||||||
@ -90,8 +90,8 @@ class ReportController extends \BaseController {
|
|||||||
'dateTypes' => $dateTypes,
|
'dateTypes' => $dateTypes,
|
||||||
'chartTypes' => $chartTypes,
|
'chartTypes' => $chartTypes,
|
||||||
'chartType' => $chartType,
|
'chartType' => $chartType,
|
||||||
'startDate' => $startDate->format('m/d/Y'),
|
'startDate' => $startDate->format(Session::get(SESSION_DATE_FORMAT)),
|
||||||
'endDate' => $endDate->modify('-1'.$padding)->format('m/d/Y'),
|
'endDate' => $endDate->modify('-1'.$padding)->format(Session::get(SESSION_DATE_FORMAT)),
|
||||||
'groupBy' => $groupBy
|
'groupBy' => $groupBy
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->integer('payment_terms');
|
$t->integer('payment_terms');
|
||||||
|
|
||||||
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
$t->foreign('country_id')->references('id')->on('countries');
|
$t->foreign('country_id')->references('id')->on('countries');
|
||||||
$t->foreign('client_industry_id')->references('id')->on('client_industries');
|
$t->foreign('client_industry_id')->references('id')->on('client_industries');
|
||||||
$t->foreign('client_size_id')->references('id')->on('client_sizes');
|
$t->foreign('client_size_id')->references('id')->on('client_sizes');
|
||||||
@ -262,7 +262,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->timestamp('last_login');
|
$t->timestamp('last_login');
|
||||||
|
|
||||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
|
|
||||||
$t->unsignedInteger('public_id');
|
$t->unsignedInteger('public_id');
|
||||||
$t->unique( array('account_id','public_id') );
|
$t->unique( array('account_id','public_id') );
|
||||||
@ -314,7 +314,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
|
|
||||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
||||||
$t->foreign('account_id')->references('id')->on('accounts');
|
$t->foreign('account_id')->references('id')->on('accounts');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
$t->foreign('invoice_status_id')->references('id')->on('invoice_statuses');
|
$t->foreign('invoice_status_id')->references('id')->on('invoice_statuses');
|
||||||
$t->foreign('currency_id')->references('id')->on('currencies');
|
$t->foreign('currency_id')->references('id')->on('currencies');
|
||||||
$t->foreign('recurring_invoice_id')->references('id')->on('invoices');
|
$t->foreign('recurring_invoice_id')->references('id')->on('invoices');
|
||||||
@ -338,7 +338,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->timestamp('sent_date');
|
$t->timestamp('sent_date');
|
||||||
$t->timestamp('viewed_date');
|
$t->timestamp('viewed_date');
|
||||||
|
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
$t->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
$t->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
||||||
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
||||||
|
|
||||||
@ -358,7 +358,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->decimal('rate', 13, 4);
|
$t->decimal('rate', 13, 4);
|
||||||
|
|
||||||
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
|
|
||||||
$t->unsignedInteger('public_id');
|
$t->unsignedInteger('public_id');
|
||||||
$t->unique( array('account_id','public_id') );
|
$t->unique( array('account_id','public_id') );
|
||||||
@ -378,7 +378,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->decimal('qty', 13, 4);
|
$t->decimal('qty', 13, 4);
|
||||||
|
|
||||||
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
|
|
||||||
$t->unsignedInteger('public_id');
|
$t->unsignedInteger('public_id');
|
||||||
$t->unique( array('account_id','public_id') );
|
$t->unique( array('account_id','public_id') );
|
||||||
@ -405,7 +405,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
|
|
||||||
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
||||||
$t->foreign('product_id')->references('id')->on('products');
|
$t->foreign('product_id')->references('id')->on('products');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
|
|
||||||
$t->unsignedInteger('public_id');
|
$t->unsignedInteger('public_id');
|
||||||
$t->unique( array('account_id','public_id') );
|
$t->unique( array('account_id','public_id') );
|
||||||
@ -434,7 +434,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->foreign('account_id')->references('id')->on('accounts');
|
$t->foreign('account_id')->references('id')->on('accounts');
|
||||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
||||||
$t->foreign('contact_id')->references('id')->on('contacts');
|
$t->foreign('contact_id')->references('id')->on('contacts');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
$t->foreign('currency_id')->references('id')->on('currencies');
|
$t->foreign('currency_id')->references('id')->on('currencies');
|
||||||
|
|
||||||
$t->unsignedInteger('public_id')->index();
|
$t->unsignedInteger('public_id')->index();
|
||||||
@ -460,7 +460,7 @@ class ConfideSetupUsersTable extends Migration {
|
|||||||
$t->foreign('account_id')->references('id')->on('accounts');
|
$t->foreign('account_id')->references('id')->on('accounts');
|
||||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
||||||
$t->foreign('contact_id')->references('id')->on('contacts');
|
$t->foreign('contact_id')->references('id')->on('contacts');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||||
$t->foreign('currency_id')->references('id')->on('currencies');
|
$t->foreign('currency_id')->references('id')->on('currencies');
|
||||||
|
|
||||||
$t->unsignedInteger('public_id')->index();
|
$t->unsignedInteger('public_id')->index();
|
||||||
|
@ -83,7 +83,7 @@ class ConstantsSeeder extends Seeder
|
|||||||
DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013, 6:15 pm'));
|
DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013, 6:15 pm'));
|
||||||
|
|
||||||
DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
|
DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
|
||||||
DateFormat::create(array('format' => 'D M jS, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10th, 2013'));
|
DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
d, dd: Numeric date, no leading zero and leading zero, respectively. Eg, 5, 05.
|
||||||
|
@ -35,7 +35,7 @@ App::after(function($request, $response)
|
|||||||
|
|
||||||
Route::filter('auth', function()
|
Route::filter('auth', function()
|
||||||
{
|
{
|
||||||
if (Auth::guest()) return Redirect::guest('login');
|
if (Auth::guest()) return Redirect::guest('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,13 +107,10 @@ class Utils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
$timezone = Session::get(SESSION_TIMEZONE);
|
||||||
$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
|
$format = Session::get(SESSION_DATE_FORMAT);
|
||||||
$format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT);
|
|
||||||
return DateTime::createFromFormat($format, $date, new DateTimeZone($timezone));
|
|
||||||
*/
|
|
||||||
|
|
||||||
return DateTime::createFromFormat('Y-m-d', $date);
|
return DateTime::createFromFormat($format, $date, new DateTimeZone($timezone));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fromSqlDate($date)
|
public static function fromSqlDate($date)
|
||||||
@ -123,14 +120,26 @@ class Utils
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
$timezone = Session::get(SESSION_TIMEZONE);
|
||||||
$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
|
$format = Session::get(SESSION_DATE_FORMAT);
|
||||||
|
|
||||||
return DateTime::createFromFormat('Y-m-d', $date, new DateTimeZone($timezone))->format($format);
|
return DateTime::createFromFormat('Y-m-d', $date, new DateTimeZone($timezone))->format($format);
|
||||||
*/
|
}
|
||||||
|
|
||||||
$format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT);
|
public static function today($formatResult = true)
|
||||||
|
{
|
||||||
|
$timezone = Session::get(SESSION_TIMEZONE);
|
||||||
|
$format = Session::get(SESSION_DATE_FORMAT);
|
||||||
|
$date = date_create(null, new DateTimeZone($timezone));
|
||||||
|
|
||||||
return DateTime::createFromFormat('Y-m-d', $date)->format($format);
|
if ($formatResult)
|
||||||
|
{
|
||||||
|
return $date->format($format);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $date;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function trackViewed($name, $type, $url = false)
|
public static function trackViewed($name, $type, $url = false)
|
||||||
|
@ -93,13 +93,17 @@ class InvoiceRepository
|
|||||||
$invoice->public_notes = trim($data['public_notes']);
|
$invoice->public_notes = trim($data['public_notes']);
|
||||||
$invoice->po_number = trim($data['po_number']);
|
$invoice->po_number = trim($data['po_number']);
|
||||||
$invoice->currency_id = $data['currency_id'];
|
$invoice->currency_id = $data['currency_id'];
|
||||||
$invoice->tax_rate = 0;
|
|
||||||
|
|
||||||
if (isset($data['tax']) && isset($data['tax']->rate) && floatval($data['tax']->rate) > 0)
|
if (isset($data['tax']) && isset($data['tax']->rate) && floatval($data['tax']->rate) > 0)
|
||||||
{
|
{
|
||||||
$invoice->tax_rate = floatval($data['tax']->rate);
|
$invoice->tax_rate = floatval($data['tax']->rate);
|
||||||
$invoice->tax_name = trim($data['tax']->name);
|
$invoice->tax_name = trim($data['tax']->name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$invoice->tax_rate = 0;
|
||||||
|
$invoice->tax_name = '';
|
||||||
|
}
|
||||||
|
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
$invoice->invoice_items()->forceDelete();
|
$invoice->invoice_items()->forceDelete();
|
||||||
|
@ -47,14 +47,6 @@ Route::post('forgot_password', 'UserController@do_forgot_password');
|
|||||||
Route::get('logout', 'UserController@logout');
|
Route::get('logout', 'UserController@logout');
|
||||||
|
|
||||||
|
|
||||||
Route::filter('auth', function()
|
|
||||||
{
|
|
||||||
if (!Auth::check())
|
|
||||||
{
|
|
||||||
return Redirect::to('/');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::group(array('before' => 'auth'), function()
|
Route::group(array('before' => 'auth'), function()
|
||||||
{
|
{
|
||||||
Route::get('home', function() { return View::make('header'); });
|
Route::get('home', function() { return View::make('header'); });
|
||||||
@ -178,7 +170,6 @@ define('SESSION_DATETIME_FORMAT', 'datetimeFormat');
|
|||||||
define('DEFAULT_TIMEZONE', 'US/Eastern');
|
define('DEFAULT_TIMEZONE', 'US/Eastern');
|
||||||
define('DEFAULT_CURRENCY', 1); // US Dollar
|
define('DEFAULT_CURRENCY', 1); // US Dollar
|
||||||
define('DEFAULT_DATE_FORMAT', 'M j, Y');
|
define('DEFAULT_DATE_FORMAT', 'M j, Y');
|
||||||
define('DEFAULT_DATE_PICKER_FORMAT', 'yyyy-mm-dd');
|
define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy');
|
||||||
define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a');
|
define('DEFAULT_DATETIME_FORMAT', 'F j, Y, g:i a');
|
||||||
|
|
||||||
define('DEFAULT_QUERY_CACHE', 120);
|
define('DEFAULT_QUERY_CACHE', 120);
|
@ -16,7 +16,7 @@
|
|||||||
@if ($credit)
|
@if ($credit)
|
||||||
{{ Former::populate($credit) }}
|
{{ Former::populate($credit) }}
|
||||||
@else
|
@else
|
||||||
{{ Former::populateField('credit_date', date('Y-m-d')) }}
|
{{ Former::populateField('credit_date', Utils::today()) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
||||||
{{ Former::text('amount') }}
|
{{ Former::text('amount') }}
|
||||||
{{ Former::text('credit_date')->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('credit_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
{{ Former::select('currency_id')->addOption('','')->label('Currency')
|
{{ Former::select('currency_id')->addOption('','')->label('Currency')
|
||||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
|
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
|
||||||
|
|
||||||
@ -68,7 +68,8 @@
|
|||||||
|
|
||||||
$('#credit_date').datepicker({
|
$('#credit_date').datepicker({
|
||||||
autoclose: true,
|
autoclose: true,
|
||||||
todayHighlight: true
|
todayHighlight: true,
|
||||||
|
keyboardNavigation: false
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
{{ Former::close() }}
|
{{ Former::close() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Need something changed? We're {{ link_to('https://github.com/hillelcoren/invoice-ninja', 'open source', array('target'=>'_blank')) }}, email us at {{ link_to('mailto:contact@invoiceninja.com', 'contact@invoiceninja.com') }}.
|
Want something changed? We're {{ link_to('https://github.com/hillelcoren/invoice-ninja', 'open source', array('target'=>'_blank')) }}, email us at {{ link_to('mailto:contact@invoiceninja.com', 'contact@invoiceninja.com') }}.
|
||||||
<p class="text-danger">This is a demo site, the data is erased.</p>
|
<p class="text-danger">This is a demo site, the data is erased.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -185,15 +185,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
|
<div style="padding-right:20px" id="signUpDiv" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
|
||||||
|
|
||||||
{{ Former::open('signup/submit')->addClass('signUpForm') }}
|
{{ Former::open('signup/submit')->addClass('signUpForm') }}
|
||||||
|
|
||||||
@if (Auth::check())
|
@if (Auth::check())
|
||||||
{{ Former::populate(Auth::user()) }}
|
{{ Former::populateField('new_first_name', Auth::user()->first_name); }}
|
||||||
|
{{ Former::populateField('new_last_name', Auth::user()->last_name); }}
|
||||||
|
{{ Former::populateField('new_email', Auth::user()->email); }}
|
||||||
@endif
|
@endif
|
||||||
{{ Former::hidden('path')->value(Request::path()) }}
|
{{ Former::hidden('path')->value(Request::path()) }}
|
||||||
{{ Former::text('first_name') }}
|
{{ Former::text('new_first_name')->label('First name') }}
|
||||||
{{ Former::text('last_name') }}
|
{{ Former::text('new_last_name')->label('Last name') }}
|
||||||
{{ Former::text('email') }}
|
{{ Former::text('new_email')->label('Email') }}
|
||||||
{{ Former::password('password') }}
|
{{ Former::password('new_password')->label('Password') }}
|
||||||
{{ Former::close() }}
|
{{ Former::close() }}
|
||||||
<center><div id="errorTaken" style="display:none"> <br/>The email address is already regiestered</div></center>
|
<center><div id="errorTaken" style="display:none"> <br/>The email address is already regiestered</div></center>
|
||||||
</div>
|
</div>
|
||||||
@ -224,7 +228,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h3>Are you sure?</h3>
|
<h3>Are you sure?</h3>
|
||||||
<p>This will erase all of your data.</p>
|
<p>This will permanently erase your data.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer" id="signUpFooter">
|
<div class="modal-footer" id="signUpFooter">
|
||||||
@ -253,7 +257,7 @@
|
|||||||
{
|
{
|
||||||
var isFormValid = true;
|
var isFormValid = true;
|
||||||
$(['first_name','last_name','email','password']).each(function(i, field) {
|
$(['first_name','last_name','email','password']).each(function(i, field) {
|
||||||
var $input = $('form.signUpForm #'+field),
|
var $input = $('form.signUpForm #new_'+field),
|
||||||
val = $.trim($input.val());
|
val = $.trim($input.val());
|
||||||
var isValid = val && val.length >= (field == 'password' ? 6 : 1);
|
var isValid = val && val.length >= (field == 'password' ? 6 : 1);
|
||||||
if (isValid && field == 'email') {
|
if (isValid && field == 'email') {
|
||||||
@ -372,6 +376,12 @@
|
|||||||
*/
|
*/
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if (Session::has('message'))
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.alert-info').fadeOut();
|
||||||
|
}, 5000);
|
||||||
|
@endif
|
||||||
|
|
||||||
@yield('onReady')
|
@yield('onReady')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,13 +60,13 @@
|
|||||||
<div class="col-md-4" id="col_2">
|
<div class="col-md-4" id="col_2">
|
||||||
<div data-bind="visible: !is_recurring()">
|
<div data-bind="visible: !is_recurring()">
|
||||||
{{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
|
{{ Former::text('invoice_number')->label('Invoice #')->data_bind("value: invoice_number, valueUpdate: 'afterkeydown'") }}
|
||||||
{{ Former::text('invoice_date')->data_bind("value: invoice_date, valueUpdate: 'afterkeydown'")->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('invoice_date')->data_bind("value: invoice_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
{{ Former::text('due_date')->data_bind("value: due_date, valueUpdate: 'afterkeydown'")->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('due_date')->data_bind("value: due_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="visible: is_recurring">
|
<div data-bind="visible: is_recurring">
|
||||||
{{ Former::select('frequency_id')->label('How often')->options($frequencies)->data_bind("value: frequency_id") }}
|
{{ Former::select('frequency_id')->label('How often')->options($frequencies)->data_bind("value: frequency_id") }}
|
||||||
{{ Former::text('start_date')->data_bind("value: start_date, valueUpdate: 'afterkeydown'")->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('start_date')->data_bind("value: start_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
{{ Former::text('end_date')->data_bind("value: end_date, valueUpdate: 'afterkeydown'")->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('end_date')->data_bind("value: end_date, valueUpdate: 'afterkeydown'")->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
</div>
|
</div>
|
||||||
@if ($invoice && $invoice->recurring_invoice_id)
|
@if ($invoice && $invoice->recurring_invoice_id)
|
||||||
<div class="pull-right" style="padding-top: 6px">
|
<div class="pull-right" style="padding-top: 6px">
|
||||||
@ -202,12 +202,12 @@
|
|||||||
array('Delete Invoice', "javascript:onDeleteClick()"),
|
array('Delete Invoice', "javascript:onDeleteClick()"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
, array('id'=>'actionDropDown','style'=>'text-align:left'))->split(); }}
|
, array('id'=>'actionDropDown', 'style'=>'text-align:left', 'data-bind'=>'css: saveButtonEnabled'))->split(); }}
|
||||||
@else
|
@else
|
||||||
{{ Button::primary_submit('Save Invoice') }}
|
{{ Button::primary_submit('Save Invoice', array('data-bind'=>'css: saveButtonEnabled')) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{ Button::primary('Send Email', array('id' => 'email_button', 'onclick' => 'onEmailClick()')) }}
|
{{ Button::primary('Send Email', array('id' => 'email_button', 'onclick' => 'onEmailClick()', 'data-bind' => 'css: emailButtonEnabled')) }}
|
||||||
</div>
|
</div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
@ -358,14 +358,10 @@
|
|||||||
$('#country_id').combobox();
|
$('#country_id').combobox();
|
||||||
$('[rel=tooltip]').tooltip();
|
$('[rel=tooltip]').tooltip();
|
||||||
|
|
||||||
$('#invoice_date').datepicker({
|
$('#invoice_date, #due_date, #start_date, #end_date').datepicker({
|
||||||
autoclose: true,
|
autoclose: true,
|
||||||
todayHighlight: true
|
todayHighlight: true,
|
||||||
});
|
keyboardNavigation: false
|
||||||
|
|
||||||
$('#due_date, #start_date, #end_date').datepicker({
|
|
||||||
autoclose: true,
|
|
||||||
todayHighlight: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@if ($client && !$invoice)
|
@if ($client && !$invoice)
|
||||||
@ -378,7 +374,7 @@
|
|||||||
if (clientId > 0) {
|
if (clientId > 0) {
|
||||||
model.loadClient(clientMap[clientId]);
|
model.loadClient(clientMap[clientId]);
|
||||||
} else {
|
} else {
|
||||||
model.loadClient(new ClientModel());
|
model.loadClient($.parseJSON(ko.toJSON(new ClientModel())));
|
||||||
}
|
}
|
||||||
refreshPDF();
|
refreshPDF();
|
||||||
}).trigger('change');
|
}).trigger('change');
|
||||||
@ -476,14 +472,15 @@
|
|||||||
return invoice;
|
return invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function refreshPDF() {
|
function refreshPDF() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
_refreshPDF();
|
_refreshPDF();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function refreshPDF() {
|
||||||
function _refreshPDF() {
|
|
||||||
console.log("refreshPDF");
|
console.log("refreshPDF");
|
||||||
var invoice = createInvoiceModel();
|
var invoice = createInvoiceModel();
|
||||||
var doc = generatePDF(invoice);
|
var doc = generatePDF(invoice);
|
||||||
@ -576,7 +573,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function InvoiceModel() {
|
function InvoiceModel(data) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.client = new ClientModel();
|
this.client = new ClientModel();
|
||||||
self.discount = ko.observable('');
|
self.discount = ko.observable('');
|
||||||
@ -590,7 +587,7 @@
|
|||||||
self.due_date = ko.observable('');
|
self.due_date = ko.observable('');
|
||||||
self.start_date = ko.observable('');
|
self.start_date = ko.observable('');
|
||||||
self.end_date = ko.observable('');
|
self.end_date = ko.observable('');
|
||||||
self.tax = ko.observable('');
|
self.tax = ko.observable();
|
||||||
self.is_recurring = ko.observable(false);
|
self.is_recurring = ko.observable(false);
|
||||||
self.invoice_status_id = ko.observable(0);
|
self.invoice_status_id = ko.observable(0);
|
||||||
|
|
||||||
@ -607,7 +604,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.loadClient = function(client) {
|
self.loadClient = function(client) {
|
||||||
//console.log(client);
|
//console.log(client);
|
||||||
ko.mapping.fromJS(client, model.client.mapping, model.client);
|
ko.mapping.fromJS(client, model.client.mapping, model.client);
|
||||||
@ -667,6 +663,39 @@
|
|||||||
return self.client.public_id() ? 'Edit client details' : 'Create new client';
|
return self.client.public_id() ? 'Edit client details' : 'Create new client';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.saveButtonEnabled = ko.computed(function() {
|
||||||
|
var isValid = false;
|
||||||
|
|
||||||
|
for (var i=0; i<self.client.contacts().length; i++) {
|
||||||
|
var contact = self.client.contacts()[i];
|
||||||
|
if (isValidEmailAddress(contact.email())) {
|
||||||
|
isValid = true;
|
||||||
|
} else {
|
||||||
|
isValid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isValid ? "enabled" : "disabled";
|
||||||
|
});
|
||||||
|
|
||||||
|
self.emailButtonEnabled = ko.computed(function() {
|
||||||
|
var isValid = false;
|
||||||
|
var sendTo = false;
|
||||||
|
for (var i=0; i<self.client.contacts().length; i++) {
|
||||||
|
var contact = self.client.contacts()[i];
|
||||||
|
if (isValidEmailAddress(contact.email())) {
|
||||||
|
isValid = true;
|
||||||
|
if (contact.send_invoice()) {
|
||||||
|
sendTo = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
isValid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isValid && sendTo ? "enabled" : "disabled";
|
||||||
|
});
|
||||||
|
|
||||||
self.showTaxesForm = function() {
|
self.showTaxesForm = function() {
|
||||||
self.taxBackup = ko.mapping.toJS(self.tax_rates);
|
self.taxBackup = ko.mapping.toJS(self.tax_rates);
|
||||||
|
|
||||||
@ -1087,9 +1116,17 @@
|
|||||||
model.addTaxRate({{ $taxRate }});
|
model.addTaxRate({{ $taxRate }});
|
||||||
@endforeach
|
@endforeach
|
||||||
model.addTaxRate();
|
model.addTaxRate();
|
||||||
|
model.tax(model.getBlankTaxRate());
|
||||||
@if ($invoice)
|
@if ($invoice)
|
||||||
var invoice = {{ $invoice }};
|
var invoice = {{ $invoice }};
|
||||||
ko.mapping.fromJS(invoice, model.mapping, model);
|
ko.mapping.fromJS(invoice, model.mapping, model);
|
||||||
|
for (var i=0; i<model.tax_rates().length; i++) {
|
||||||
|
var taxRate = model.tax_rates()[i];
|
||||||
|
if (model.tax_name() == taxRate.name() && model.tax_rate() == taxRate.rate()) {
|
||||||
|
model.tax(taxRate);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!model.discount()) model.discount('');
|
if (!model.discount()) model.discount('');
|
||||||
var invitationContactIds = {{ json_encode($invitationContactIds) }};
|
var invitationContactIds = {{ json_encode($invitationContactIds) }};
|
||||||
var client = clientMap[invoice.client.public_id];
|
var client = clientMap[invoice.client.public_id];
|
||||||
@ -1098,8 +1135,8 @@
|
|||||||
contact.send_invoice = invitationContactIds.indexOf(contact.public_id) >= 0;
|
contact.send_invoice = invitationContactIds.indexOf(contact.public_id) >= 0;
|
||||||
}
|
}
|
||||||
@else
|
@else
|
||||||
model.invoice_date('{{ date('Y-m-d') }}');
|
model.invoice_date('{{ Utils::today() }}');
|
||||||
model.start_date('{{ date('Y-m-d') }}');
|
model.start_date('{{ Utils::today() }}');
|
||||||
model.invoice_number('{{ $invoiceNumber }}');
|
model.invoice_number('{{ $invoiceNumber }}');
|
||||||
model.terms(wordWrapText('{{ $account->invoice_terms }}', 340));
|
model.terms(wordWrapText('{{ $account->invoice_terms }}', 340));
|
||||||
@endif
|
@endif
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
@if ($payment)
|
@if ($payment)
|
||||||
{{-- Former::populate($payment) --}}
|
{{-- Former::populate($payment) --}}
|
||||||
@else
|
@else
|
||||||
{{ Former::populateField('payment_date', date('Y-m-d')) }}
|
{{ Former::populateField('payment_date', Utils::today()) }}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +33,7 @@
|
|||||||
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
{{ Former::select('client')->addOption('', '')->addGroupClass('client-select') }}
|
||||||
{{ Former::select('invoice')->addOption('', '')->addGroupClass('invoice-select') }}
|
{{ Former::select('invoice')->addOption('', '')->addGroupClass('invoice-select') }}
|
||||||
{{ Former::text('amount') }}
|
{{ Former::text('amount') }}
|
||||||
{{ Former::text('payment_date')->data_date_format(DEFAULT_DATE_PICKER_FORMAT) }}
|
{{ Former::text('payment_date')->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT)) }}
|
||||||
{{ Former::select('currency_id')->addOption('','')->label('Currency')
|
{{ Former::select('currency_id')->addOption('','')->label('Currency')
|
||||||
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
|
->fromQuery($currencies, 'name', 'id')->select(Session::get(SESSION_CURRENCY, DEFAULT_CURRENCY)) }}
|
||||||
|
|
||||||
@ -140,7 +140,8 @@
|
|||||||
|
|
||||||
$('#payment_date').datepicker({
|
$('#payment_date').datepicker({
|
||||||
autoclose: true,
|
autoclose: true,
|
||||||
todayHighlight: true
|
todayHighlight: true,
|
||||||
|
keyboardNavigation: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@
|
|||||||
|
|
||||||
$('#start_date, #end_date').datepicker({
|
$('#start_date, #end_date').datepicker({
|
||||||
autoclose: true,
|
autoclose: true,
|
||||||
todayHighlight: true
|
todayHighlight: true,
|
||||||
|
keyboardNavigation: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@stop
|
@stop
|
@ -173,9 +173,9 @@ table.invoice-table tbody tr:hover {
|
|||||||
|
|
||||||
|
|
||||||
/* Animate col width changes */
|
/* Animate col width changes */
|
||||||
.row div {
|
body {
|
||||||
-webkit-transition: width 0.5s ease, margin 0.5s ease;
|
-webkit-transition: all 0.5s ease;
|
||||||
-moz-transition: width 0.5s ease, margin 0.5s ease;
|
-moz-transition: all 0.5s ease;
|
||||||
-o-transition: width 0.5s ease, margin 0.5s ease;
|
-o-transition: all 0.5s ease;
|
||||||
transition: width 0.5s ease, margin 0.5s ease;
|
transition: all 0.5s ease;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user