From b6092efb41e2ead0127989b5ba52be32f7f095ac Mon Sep 17 00:00:00 2001
From: Hillel Coren
Date: Mon, 7 Jul 2014 09:43:16 +0300
Subject: [PATCH] Show new client form on click
---
app/filters.php | 9 ++++++---
app/models/User.php | 1 +
app/views/invoices/edit.blade.php | 9 ++++++++-
app/views/public/about_us.blade.php | 2 +-
public/js/script.js | 1 -
5 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/app/filters.php b/app/filters.php
index cd9f00324e..c52d5732e1 100755
--- a/app/filters.php
+++ b/app/filters.php
@@ -13,9 +13,12 @@
App::before(function($request)
{
- $count = Session::get(SESSION_COUNTER, 0);
- Session::put(SESSION_COUNTER, ++$count);
-
+ if (Auth::check())
+ {
+ $count = Session::get(SESSION_COUNTER, 0);
+ Session::put(SESSION_COUNTER, ++$count);
+ }
+
if (App::environment() == ENV_PRODUCTION)
{
if (!Request::secure())
diff --git a/app/models/User.php b/app/models/User.php
index 07bae4f74c..c27c8cd1ee 100755
--- a/app/models/User.php
+++ b/app/models/User.php
@@ -127,6 +127,7 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
}
$count = self::getRequestsCount();
+
if ($count == 1 || $count % 5 == 0)
{
if (!Utils::isRegistered())
diff --git a/app/views/invoices/edit.blade.php b/app/views/invoices/edit.blade.php
index ed71207acf..c38228c395 100755
--- a/app/views/invoices/edit.blade.php
+++ b/app/views/invoices/edit.blade.php
@@ -496,7 +496,14 @@
model.invoice().client().country = false;
}
refreshPDF();
- }); //.trigger('change');
+ });
+
+ // If no clients exists show the client form when clicking on the client select input
+ if (clients.length === 0) {
+ $('.client_select input.form-control').on('click', function() {
+ model.showClientForm();
+ });
+ }
$('#terms, #public_notes, #invoice_number, #invoice_date, #due_date, #po_number, #discount, #currency_id, #invoice_design_id, #recurring').change(function() {
setTimeout(function() {
diff --git a/app/views/public/about_us.blade.php b/app/views/public/about_us.blade.php
index a307c2e46d..9d63c8d13e 100644
--- a/app/views/public/about_us.blade.php
+++ b/app/views/public/about_us.blade.php
@@ -57,7 +57,7 @@
- Hillel has been developing enterprise applications for 15 years. His open-source AutoComplete component has been used by thousands of developers around the world.
+ Hillel has been developing enterprise applications for 15 years. His open-source AutoComplete component has been used by thousands of developers around the world.
diff --git a/public/js/script.js b/public/js/script.js
index 8109ab179d..39e39bb472 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -1537,7 +1537,6 @@ function displayInvoiceHeader(doc, invoice, layout) {
{
doc.text(taxX, layout.tableTop, invoiceLabels.tax);
}
-
}
function displayInvoiceItems(doc, invoice, layout) {