diff --git a/frappe/__init__.py b/frappe/__init__.py index 26c77fcc25..535d3af7c4 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -14,7 +14,7 @@ import os, sys, importlib, inspect, json from .exceptions import * from .utils.jinja import get_jenv, get_template, render_template, get_email_from_template -__version__ = '9.2.1' +__version__ = '9.2.2' __title__ = "Frappe Framework" local = Local() diff --git a/frappe/core/page/usage_info/usage_info.html b/frappe/core/page/usage_info/usage_info.html index 5fd564335c..0b85862622 100644 --- a/frappe/core/page/usage_info/usage_info.html +++ b/frappe/core/page/usage_info/usage_info.html @@ -1,7 +1,7 @@
{% if limits.expiry %}
-

{{ __("You have {0} days left in your trial", [days_to_expiry]) }}

+

{{ __("You have {0} days left in your subscription", [days_to_expiry]) }}

{% if limits.upgrade_url %}

Upgrade to a premium plan with more users, storage and priority support.

diff --git a/frappe/public/js/frappe/list/list_sidebar.js b/frappe/public/js/frappe/list/list_sidebar.js index 744a19f770..ed9d767dd1 100644 --- a/frappe/public/js/frappe/list/list_sidebar.js +++ b/frappe/public/js/frappe/list/list_sidebar.js @@ -309,24 +309,32 @@ frappe.views.ListSidebar = Class.extend({ }, setup_upgrade_box: function() { let upgrade_list = $(``).appendTo(this.sidebar); - let upgrade_box = $(`
- -
Go Premium
-

Upgrade to a premium plan with more users, storage and priority support.

- -
`).appendTo(upgrade_list); - - upgrade_box.find('.btn-primary').on('click', () => { - window.open(frappe.boot.limits.upgrade_url); - }); - upgrade_box.find('.close').on('click', () => { - upgrade_list.remove(); - frappe.flags.upgrade_dismissed = 1; - }); + // Show Renew/Upgrade button, + // if account is holding one user free plan or + // if account's expiry date within range of 30 days from today's date + + let upgrade_date = frappe.datetime.add_days(get_today(), 30); + if (frappe.boot.limits.users === 1 || upgrade_date >= frappe.boot.limits.expiry) { + let upgrade_box = $(`
+ +
Go Premium
+

Upgrade to a premium plan with more users, storage and priority support.

+ +
`).appendTo(upgrade_list); + + upgrade_box.find('.btn-primary').on('click', () => { + frappe.set_route('usage-info'); + }); + + upgrade_box.find('.close').on('click', () => { + upgrade_list.remove(); + frappe.flags.upgrade_dismissed = 1; + }); + } }, get_cat_tags:function(){ return this.cat_tags; diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 84780ce79e..c1e498fc27 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -218,7 +218,11 @@ def formatdate(string_date=None, format_string=None): * mm-dd-yyyy * dd/mm/yyyy """ - date = getdate(string_date) if string_date else now_datetime().date() + + if not string_date: + return '' + + date = getdate(string_date) if not format_string: format_string = get_user_format().replace("mm", "MM")