Merge branch 'hotfix'
This commit is contained in:
commit
3265916640
12 changed files with 120 additions and 14 deletions
|
|
@ -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__ = '10.1.45'
|
||||
__version__ = '10.1.46'
|
||||
__title__ = "Frappe Framework"
|
||||
|
||||
local = Local()
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ def notify_mentions(doc):
|
|||
|
||||
subject = _("{0} mentioned you in a comment").format(sender_fullname)
|
||||
|
||||
recipients = [frappe.db.get_value("User", {"enabled": 1, "name": name, "user_type": "System User"})
|
||||
recipients = [frappe.db.get_value("User", {"enabled": 1, "name": name, "user_type": "System User"}, "email")
|
||||
for name in mentions]
|
||||
frappe.sendmail(
|
||||
recipients=recipients,
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ class DocType(Document):
|
|||
self.permissions = []
|
||||
|
||||
self.scrub_field_names()
|
||||
self.scrub_options_in_select()
|
||||
self.set_default_in_list_view()
|
||||
self.validate_series()
|
||||
self.validate_document_type()
|
||||
|
|
@ -177,6 +178,17 @@ class DocType(Document):
|
|||
# fieldnames should be lowercase
|
||||
d.fieldname = d.fieldname.lower()
|
||||
|
||||
def scrub_options_in_select(self):
|
||||
"""Strip options for whitespaces"""
|
||||
for field in self.fields:
|
||||
if field.fieldtype == "Select" and field.options is not None:
|
||||
new_options = ""
|
||||
for option in field.options.split("\n"):
|
||||
new_options += option.strip()
|
||||
new_options += "\n"
|
||||
new_options.rstrip("\n")
|
||||
field.options = new_options
|
||||
|
||||
def validate_series(self, autoname=None, name=None):
|
||||
"""Validate if `autoname` property is correctly set."""
|
||||
if not autoname: autoname = self.autoname
|
||||
|
|
@ -396,9 +408,9 @@ class DocType(Document):
|
|||
# a DocType's name should not start with a number or underscore
|
||||
# and should only contain letters, numbers and underscore
|
||||
if six.PY2:
|
||||
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name)
|
||||
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w ]+$", name)
|
||||
else:
|
||||
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w -]+$", name, flags = re.ASCII)
|
||||
is_a_valid_name = re.match("^(?![\W])[^\d_\s][\w ]+$", name, flags = re.ASCII)
|
||||
if not is_a_valid_name:
|
||||
frappe.throw(_("DocType's name should start with a letter and it can only consist of letters, numbers, spaces and underscores"), frappe.NameError)
|
||||
|
||||
|
|
|
|||
|
|
@ -901,10 +901,10 @@ def notify_admin_access_to_system_manager(login_manager=None):
|
|||
def extract_mentions(txt):
|
||||
"""Find all instances of @name in the string.
|
||||
The mentions will be separated by non-word characters or may appear at the start of the string"""
|
||||
txt = txt.replace("<br>", "<br> ")
|
||||
txt = re.sub(r'(<[a-zA-Z\/][^>]*>)', '', txt)
|
||||
return re.findall(r'(?:[^\w\.\-\@]|^)@([\w\.\-\@]*)', txt)
|
||||
|
||||
|
||||
def handle_password_test_fail(result):
|
||||
suggestions = result['feedback']['suggestions'][0] if result['feedback']['suggestions'] else ''
|
||||
warning = result['feedback']['warning'] if 'warning' in result['feedback'] else ''
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ class AutoEmailReport(Document):
|
|||
new_row = []
|
||||
out.append(new_row)
|
||||
for df in columns:
|
||||
if not row.get(df.fieldname): continue
|
||||
new_row.append(frappe.format(row[df.fieldname], df, row))
|
||||
|
||||
return out
|
||||
|
|
|
|||
|
|
@ -1,3 +1,13 @@
|
|||
this.frm.add_fetch('sender', 'email_id', 'sender_email');
|
||||
|
||||
this.frm.fields_dict.sender.get_query = function(){
|
||||
return {
|
||||
filters: {
|
||||
'enable_outgoing': 1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
frappe.email_alert = {
|
||||
setup_fieldname_select: function(frm) {
|
||||
// get the doctype to update fields
|
||||
|
|
|
|||
|
|
@ -379,6 +379,68 @@
|
|||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sender",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sender",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Email Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "sender_email",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sender Email",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Email",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
|
|
@ -871,7 +933,7 @@
|
|||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-09-26 20:10:00.061780",
|
||||
"modified": "2018-07-30 14:32:02.179599",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Email",
|
||||
"name": "Email Alert",
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ def get_context(context):
|
|||
|
||||
def send(self, doc):
|
||||
'''Build recipients and send email alert'''
|
||||
from email.utils import formataddr
|
||||
|
||||
def get_attachment(doc):
|
||||
""" check print settings are attach the pdf """
|
||||
|
|
@ -126,6 +127,7 @@ def get_context(context):
|
|||
|
||||
context = get_context(doc)
|
||||
recipients = []
|
||||
sender = ""
|
||||
|
||||
for recipient in self.recipients:
|
||||
if recipient.condition:
|
||||
|
|
@ -157,6 +159,9 @@ def get_context(context):
|
|||
|
||||
context = {"doc": doc, "alert": self, "comments": None}
|
||||
|
||||
if self.sender:
|
||||
sender = formataddr((self.sender, self.sender_email))
|
||||
|
||||
if self.is_standard:
|
||||
self.load_standard_properties(context)
|
||||
|
||||
|
|
@ -170,6 +175,7 @@ def get_context(context):
|
|||
|
||||
frappe.sendmail(recipients=recipients, subject=subject,
|
||||
message= frappe.render_template(self.message, context),
|
||||
sender = sender,
|
||||
reference_doctype = doc.doctype,
|
||||
reference_name = doc.name,
|
||||
attachments = attachments,
|
||||
|
|
|
|||
|
|
@ -2554,7 +2554,7 @@
|
|||
"currency": "USD",
|
||||
"currency_fraction": "Cent",
|
||||
"currency_fraction_units": 100,
|
||||
"smallest_currency_fraction_value": 0.05,
|
||||
"smallest_currency_fraction_value": 0.01,
|
||||
"currency_name": "US Dollar",
|
||||
"currency_symbol": "$",
|
||||
"date_format": "mm-dd-yyyy",
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ frappe.patches.v7_2.remove_in_filter
|
|||
execute:frappe.reload_doc('core', 'doctype', 'doctype', force=True) #2017-09-22
|
||||
execute:frappe.reload_doc('core', 'doctype', 'docfield', force=True) #2017-03-03
|
||||
execute:frappe.reload_doc('core', 'doctype', 'docperm') #2017-03-03
|
||||
frappe.patches.v8_0.drop_is_custom_from_docperm
|
||||
execute:frappe.reload_doc('core', 'doctype', 'module_def') #2017-09-22
|
||||
execute:frappe.reload_doc('core', 'doctype', 'version') #2017-04-01
|
||||
execute:frappe.reload_doc('core', 'doctype', 'activity_log')
|
||||
frappe.patches.v7_1.rename_scheduler_log_to_error_log
|
||||
frappe.patches.v6_1.rename_file_data
|
||||
frappe.patches.v7_0.re_route #2016-06-27
|
||||
frappe.patches.v8_0.drop_is_custom_from_docperm
|
||||
frappe.patches.v8_0.update_records_in_global_search #11-05-2017
|
||||
frappe.patches.v8_0.update_published_in_global_search
|
||||
execute:frappe.reload_doc('core', 'doctype', 'custom_docperm')
|
||||
|
|
@ -203,4 +203,5 @@ execute:frappe.delete_doc('Page', 'data-import-tool', ignore_missing=True)
|
|||
frappe.patches.v10_0.reload_countries_and_currencies
|
||||
frappe.patches.v10_0.set_no_copy_to_workflow_state
|
||||
frappe.patches.v10_0.increase_single_table_column_length
|
||||
frappe.patches.v10_0.set_default_locking_time
|
||||
frappe.patches.v10_0.set_default_locking_time
|
||||
frappe.patches.v10_0.modify_smallest_currency_fraction
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.set_value('Currency', 'USD', 'smallest_currency_fraction_value', '0.01')
|
||||
|
|
@ -118,7 +118,6 @@ frappe.ui.form.Timeline = Class.extend({
|
|||
this.wrapper.toggle(true);
|
||||
this.list.empty();
|
||||
this.comment_area.val('');
|
||||
|
||||
var communications = this.get_communications(true);
|
||||
|
||||
communications
|
||||
|
|
@ -178,7 +177,6 @@ frappe.ui.form.Timeline = Class.extend({
|
|||
} else {
|
||||
var $edit_btn = $(this);
|
||||
var content = $timeline_item.find('.timeline-item-content').html();
|
||||
|
||||
$edit_btn
|
||||
.text("Save")
|
||||
.find('i')
|
||||
|
|
@ -298,7 +296,6 @@ frappe.ui.form.Timeline = Class.extend({
|
|||
c.original_content = c.content;
|
||||
c.content = frappe.utils.toggle_blockquote(c.content);
|
||||
}
|
||||
|
||||
if(!frappe.utils.is_html(c.content)) {
|
||||
c.content_html = frappe.markdown(__(c.content));
|
||||
} else {
|
||||
|
|
@ -312,7 +309,17 @@ frappe.ui.form.Timeline = Class.extend({
|
|||
// avoid adding <b> tag a 2nd time
|
||||
!c.content_html.match(/(^|\W)<b>(@[^\s]+)<\/b>/)
|
||||
) {
|
||||
c.content_html = c.content_html.replace(/(^|\W)(@[^\s]+)/g, "$1<b>$2</b>");
|
||||
/*
|
||||
Replace the email ids by only displaying the string which
|
||||
occurs before the second `@` to enhance the mentions.
|
||||
Eg.
|
||||
@abc@a-example.com will be converted to
|
||||
@abc with the below line of code.
|
||||
*/
|
||||
|
||||
c.content_html = c.content_html.replace(/(<[a][^>]*>)/g, "");
|
||||
// bold the @mentions
|
||||
c.content_html = c.content_html.replace(/(@[^\s@]*)@[^\s@|<]*/g, "<b>$1</b>");
|
||||
}
|
||||
|
||||
if (this.is_communication_or_comment(c)) {
|
||||
|
|
@ -657,7 +664,7 @@ frappe.ui.form.Timeline = Class.extend({
|
|||
var valid_users = Object.keys(frappe.boot.user_info)
|
||||
.filter(user => !["Administrator", "Guest"].includes(user));
|
||||
|
||||
return valid_users.map(user => frappe.boot.user_info[user].name);
|
||||
return valid_users.map(user => frappe.boot.user_info[user].email);
|
||||
},
|
||||
|
||||
setup_comment_like: function() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue