Browse Source

Merge branch 'hotfix'

version-14
Rushabh Mehta 8 years ago
parent
commit
7960bc729a
14 changed files with 97 additions and 58 deletions
  1. +1
    -1
      frappe/__init__.py
  2. +4
    -1
      frappe/client.py
  3. +1
    -1
      frappe/commands/site.py
  4. +0
    -8
      frappe/core/doctype/communication/comment.py
  5. +2
    -3
      frappe/core/doctype/communication/communication.py
  6. +6
    -2
      frappe/desk/doctype/desktop_icon/desktop_icon.py
  7. +1
    -1
      frappe/email/doctype/auto_email_report/auto_email_report.py
  8. +2
    -5
      frappe/model/document.py
  9. +5
    -1
      frappe/patches/v7_1/setup_integration_services.py
  10. +12
    -11
      frappe/print/page/print_format_builder/print_format_builder.js
  11. +6
    -2
      frappe/print/page/print_format_builder/print_format_builder_field.html
  12. +1
    -1
      frappe/public/js/frappe/views/reports/query_report.js
  13. +22
    -15
      frappe/templates/generators/web_form.html
  14. +34
    -6
      frappe/website/doctype/web_form_field/web_form_field.json

+ 1
- 1
frappe/__init__.py View File

@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from .exceptions import *
from .utils.jinja import get_jenv, get_template, render_template

__version__ = '7.1.13'
__version__ = '7.1.14'
__title__ = "Frappe Framework"

local = Local()


+ 4
- 1
frappe/client.py View File

@@ -61,7 +61,10 @@ def set_value(doctype, name, fieldname, value=None):
if not value:
values = fieldname
if isinstance(fieldname, basestring):
values = json.loads(fieldname)
try:
values = json.loads(fieldname)
except ValueError:
values = {fieldname: ''}
else:
values = {fieldname: value}



+ 1
- 1
frappe/commands/site.py View File

@@ -22,7 +22,7 @@ def new_site(site, mariadb_root_username=None, mariadb_root_password=None, admin
"Create a new site"
frappe.init(site=site, new_site=True)

_new_site(None, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password,
_new_site(db_name, site, mariadb_root_username=mariadb_root_username, mariadb_root_password=mariadb_root_password, admin_password=admin_password,
verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)

if len(frappe.utils.get_sites()) == 1:


+ 0
- 8
frappe/core/doctype/communication/comment.py View File

@@ -11,14 +11,6 @@ from frappe.website.render import clear_cache
from frappe.model.db_schema import add_column
from frappe.exceptions import ImplicitCommitError

def validate_comment(doc):
"""Raise exception for more than 50 comments."""
if not (doc.communication_type=='Comment' and doc.reference_doctype and doc.reference_name):
return

if doc.comment_type=="Comment" and "<!-- markdown -->" not in doc.content:
doc.content += '\n<!-- markdown -->'

def on_trash(doc):
if doc.communication_type != "Comment":
return


+ 2
- 3
frappe/core/doctype/communication/communication.py View File

@@ -6,8 +6,8 @@ import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import validate_email_add, get_fullname, strip_html, cstr
from frappe.core.doctype.communication.comment import (validate_comment,
notify_mentions, update_comment_in_doc)
from frappe.core.doctype.communication.comment import (notify_mentions,
update_comment_in_doc)
from frappe.core.doctype.communication.email import (validate_email,
notify, _notify, update_parent_status)
from frappe.utils.bot import BotReply
@@ -43,7 +43,6 @@ class Communication(Document):
self.set_status()
self.set_sender_full_name()
validate_email(self)
validate_comment(self)
self.set_timeline_doc()

def after_insert(self):


+ 6
- 2
frappe/desk/doctype/desktop_icon/desktop_icon.py View File

@@ -170,7 +170,7 @@ def set_order(new_order, user=None):

clear_desktop_icons_cache()

def set_desktop_icons(visible_list):
def set_desktop_icons(visible_list, ignore_duplicate=True):
'''Resets all lists and makes only the given one standard,
if the desktop icon does not exist and the name is a DocType, then will create
an icon for the doctype'''
@@ -188,7 +188,11 @@ def set_desktop_icons(visible_list):
frappe.db.set_value('Desktop Icon', name, 'hidden', 0)
else:
if frappe.db.exists('DocType', module_name):
add_user_icon(module_name, standard=1)
try:
add_user_icon(module_name, standard=1)
except frappe.UniqueValidationError, e:
if not ignore_duplicate:
raise e

# set the order
set_order(visible_list)


+ 1
- 1
frappe/email/doctype/auto_email_report/auto_email_report.py View File

@@ -130,7 +130,7 @@ def send_daily():
# if not correct weekday, skip
if auto_email_report.frequency=='Weekly':
if now.weekday()!={'Monday':0,'Tuesday':1,'Wednesday':2,
'Thursday':3,'Friday':4,'Saturday':5,'Sunday':6}[auto_email_report.weekday]:
'Thursday':3,'Friday':4,'Saturday':5,'Sunday':6}[auto_email_report.day_of_week]:
continue

auto_email_report.send()


+ 2
- 5
frappe/model/document.py View File

@@ -382,6 +382,7 @@ class Document(BaseDocument):
self._validate_selects()
self._validate_constants()
self._validate_length()
self._extract_images_from_text_editor()
self._sanitize_content()
self._save_passwords()

@@ -390,6 +391,7 @@ class Document(BaseDocument):
d._validate_selects()
d._validate_constants()
d._validate_length()
d._extract_images_from_text_editor()
d._sanitize_content()
d._save_passwords()

@@ -398,11 +400,6 @@ class Document(BaseDocument):
for fieldname in optional_fields:
self.set(fieldname, None)

# extract images after validations to save processing if some validation error is raised
self._extract_images_from_text_editor()
for d in children:
d._extract_images_from_text_editor()

def apply_fieldlevel_read_permissions(self):
'''Remove values the user is not allowed to read (called when loading in desk)'''
has_higher_permlevel = False


+ 5
- 1
frappe/patches/v7_1/setup_integration_services.py View File

@@ -2,6 +2,7 @@ from __future__ import unicode_literals
import frappe
from frappe.exceptions import DataError
from frappe.utils.password import get_decrypted_password
from frappe.utils import cstr

app_list = [
{"app_name": "razorpay_integration", "service_name": "Razorpay", "doctype": "Razorpay Settings", "remove": True},
@@ -55,7 +56,7 @@ def get_app_settings(app_details):

for d in controller.fields:
if settings.get(d.fieldname):
if ''.join(set(settings.get(d.fieldname))) == '*':
if ''.join(set(cstr(settings.get(d.fieldname)))) == '*':
setattr(settings, d.fieldname, get_decrypted_password(doctype, docname, d.fieldname, raise_exception=True))

parameters.update({d.fieldname : settings.get(d.fieldname)})
@@ -85,6 +86,9 @@ def get_parameters(app_details):
elif app_details["service_name"] == "Dropbox":
doc = frappe.db.get_value(app_details["doctype"], None,
["dropbox_access_key", "dropbox_access_secret", "upload_backups_to_dropbox"], as_dict=1)
if not doc:
return

if not (frappe.conf.dropbox_access_key and frappe.conf.dropbox_secret_key):
return


+ 12
- 11
frappe/print/page/print_format_builder/print_format_builder.js View File

@@ -89,8 +89,7 @@ frappe.PrintFormatBuilder = Class.extend({
var name = me.print_format_input.get_value();
if(!name) return;
frappe.model.with_doc("Print Format", name, function(doc) {
me.print_format = frappe.get_doc("Print Format", name);
me.refresh();
frappe.set_route('print-format-builder', name);
});
});
},
@@ -446,9 +445,9 @@ frappe.PrintFormatBuilder = Class.extend({
},
],
});
d.set_value('label', field.attr("data-label"));
d.set_primary_action(__("Update"), function() {
field.attr('data-align', d.get_value('align'));
field.attr('data-label', d.get_value('label'));
@@ -627,7 +626,7 @@ frappe.PrintFormatBuilder = Class.extend({
return $.map(f.visible_columns, function(v) { return v.fieldname + "|" + (v.print_width || "") }).join(",");
},
get_no_content: function() {
return '<div class="text-extra-muted" data-no-content>'+__("Edit to add content")+'</div>'
return __("Edit to add content")
},
setup_edit_custom_html: function() {
var me = this;
@@ -637,12 +636,13 @@ frappe.PrintFormatBuilder = Class.extend({
});
},
get_edit_html_dialog: function(title, label, $content) {
var me = this;
var d = new frappe.ui.Dialog({
title: title,
fields: [
{
fieldname: "content",
fieldtype: "Text Editor",
fieldtype: "Code",
label: label
},
{
@@ -657,11 +657,12 @@ frappe.PrintFormatBuilder = Class.extend({
});

// set existing content in input
content = $content.html();
if(content.indexOf("data-no-content")!==-1) content = "";
content = $content.attr('data-html-content');
if(content.indexOf(me.get_no_content())!==-1) content = "";
d.set_input("content", content);

d.set_primary_action(__("Update"), function() {
$content.attr('data-html-content', d.get_value("content"));
$content.html(d.get_value("content"));
d.hide();
});
@@ -696,11 +697,11 @@ frappe.PrintFormatBuilder = Class.extend({
fieldname: $this.attr("data-fieldname"),
print_hide: 0
};
if(align) {
df.align = align;
}
if(label) {
df.label = label;
}
@@ -721,7 +722,7 @@ frappe.PrintFormatBuilder = Class.extend({
if(fieldtype==="Custom HTML") {
// custom html as HTML field
df.fieldtype = "HTML";
df.options = $this.find(".html-content").html();
df.options = $this.find(".html-content").attr('data-html-content');
}
data.push(df);
});


+ 6
- 2
frappe/print/page/print_format_builder/print_format_builder_field.html View File

@@ -3,22 +3,26 @@
title="{{ __("Hidden") }}"{% } %}
data-fieldname="{%= field.fieldname %}"
data-label="{{ field.label }}"
{% if field.align %}data-align="{{ field.align }}"{% endif %}
data-fieldtype="{%= field.fieldtype %}"
{% if(field.fieldtype==="Table") { %}
data-columns="{%= me.get_visible_columns_string(field) %}"
data-doctype="{%= field.options %}"
{% } %}>
{% if !in_list(["Table", "HTML", "Custom HTML"], field.fieldtype) %}
<a class="field-settings pull-right
btn-default btn-xs" style="padding-top: 3px">
<span class="octicon octicon-gear text-muted"></span></a>
{% endif %}
{% if(field.fieldtype==="Custom HTML") { %}
<div class="text-right">
<a class="edit-html btn btn-default btn-xs">
{%= __("Edit HTML") %}</a>
</div>
<div class="html-content">{%= field.options || me.get_no_content() %}</div>
<div class="html-content"
data-html-content="{{ field.options || me.get_no_content() }}">
{{ field.options || me.get_no_content() }}</div>
{% } else { %}
<span class="field-label">{{ field.label }}</span>
{% if(field.fieldtype==="Table") { %}


+ 1
- 1
frappe/public/js/frappe/views/reports/query_report.js View File

@@ -175,7 +175,7 @@ frappe.views.QueryReport = Class.extend({
}
},
pdf_report: function() {
base_url = frappe.urllib.get_base_url();
base_url = frappe.urllib.get_base_url();
print_css = frappe.boot.print_css;

if(!frappe.model.can_print(this.report_doc.ref_doctype)) {


+ 22
- 15
frappe/templates/generators/web_form.html View File

@@ -7,7 +7,7 @@
{% endblock %}

{% block breadcrumbs %}
{% if has_header %}
{% if has_header and login_required %}
{% include "templates/includes/breadcrumbs.html" %}
{% endif %}
{% endblock %}
@@ -15,8 +15,10 @@
{% block header_actions %}
{% if not read_only and has_header %}
<div style="padding-bottom: 15px;">
<a href="{{ cancel_url or pathname }}" class="btn btn-default btn-sm">
{{ _("Cancel") }}</a>
{% if login_required -%}
<a href="{{ cancel_url or pathname }}" class="btn btn-default btn-sm">
{{ _("Cancel") }}</a>
{%- endif %}
<button type="submit" class="btn btn-primary btn-sm btn-form-submit">
{{ _("Save") }}</button>
</div>
@@ -43,7 +45,7 @@
<p class="text-muted">{{ introduction_text }}</p>
{% endif %}
</div>
<div class="form-message alert alert-warning hide"></div>
<div class="form-message hide"></div>
{% if _login_required %}
<div class="login-required">
<div class="text-muted">
@@ -340,8 +342,7 @@
frappe.ready(function() {
frappe.file_reading = false;
frappe.allow_incomplete = {{ allow_incomplete or 0 }};
frappe.success_message = "{{ success_message or "" }}";
frappe.success_link = '{{ success_message }}<p><a href="{{ success_url }}">{{ _("Continue") }}</a></p>'
frappe.success_link = '<p>{{ success_message or _("Your information has been submitted") }}</p><p><a href="{{ success_url or "/" }}" class="btn btn-sm btn-default">{{ _("Continue") }}</a></p>'
frappe.datepicker_format = "{{ frappe.date_format.replace('yyyy', 'yy') }}";
frappe.web_form_doctype = "{{ doc_type }}";
frappe.web_form_name = "{{ name }}";
@@ -349,6 +350,7 @@ frappe.ready(function() {
frappe.is_read_only = {{ 1 if read_only else 0 }};
frappe.doc_name = "{{ frappe.form_dict.name or "" }}";
frappe.form_dirty = false;
frappe.login_required = {{ 1 if login_required else 0 }};
frappe.max_attachment_size = {{ max_attachment_size }};
moment.defaultFormat = "{{ frappe.date_format.upper() }}";
{% if row_template %}frappe.web_form_row_template = "{{ row_template }}";{% endif %}
@@ -627,22 +629,25 @@ frappe.ready(function() {
callback: function(data) {
if(!data.exc) {
frappe.doc_name = data.message;
if(frappe.success_message) {
if(!frappe.login_required) {
$form.addClass("hide");
$(".comments, .introduction").addClass("hide");
$(".comments, .introduction, .page-head").addClass("hide");
scroll(0, 0);
set_message(frappe.success_message);
set_message(frappe.success_link, true);
} else {
set_message(__('Saved'));
}
if(frappe.is_new) {

if(frappe.is_new && frappe.login_required) {
// reload page (with ID)
window.location.href = window.location.pathname + "?name=" + frappe.doc_name;
}
if(for_payment && data.message) {
// redirect to payment
window.location.href = data.message;
}
} else {
set_message(__('Not Saved'));
frappe.msgprint(__('There were errors. Please report this.'));
}
},
always: function() {
@@ -666,14 +671,16 @@ frappe.ready(function() {
+ text.join('<br>'));
}

function set_message(msg) {
function set_message(msg, permanent) {
$(".form-message")
.html(msg)
.removeClass("hide");

setTimeout(function() {
$(".form-message").addClass('hide');
}, 5000);
if(!permanent) {
setTimeout(function() {
$(".form-message").addClass('hide');
}, 5000);
}
}

// submit


+ 34
- 6
frappe/website/doctype/web_form_field/web_form_field.json View File

@@ -15,21 +15,22 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "fieldtype",
"fieldname": "fieldname",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"label": "Fieldtype",
"label": "Fieldname",
"length": 0,
"no_copy": 0,
"options": "Attach\nCheck\nData\nDate\nDatetime\nFloat\nHTML\nInt\nLink\nSelect\nText\nTable\nSection Break\nColumn Break\nPage Break",
"permlevel": 0,
"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,
@@ -41,20 +42,23 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "fieldname",
"fieldname": "fieldtype",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"label": "Fieldname",
"label": "Fieldtype",
"length": 0,
"no_copy": 0,
"options": "Attach\nCheck\nData\nDate\nDatetime\nFloat\nHTML\nInt\nLink\nSelect\nText\nTable\nSection Break\nColumn Break\nPage Break",
"permlevel": 0,
"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,
@@ -72,6 +76,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"label": "Label",
"length": 0,
@@ -80,6 +85,7 @@
"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,
@@ -97,6 +103,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Mandatory",
"length": 0,
@@ -105,6 +112,7 @@
"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,
@@ -122,6 +130,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Read Only",
"length": 0,
@@ -130,6 +139,7 @@
"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,
@@ -147,6 +157,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Hidden",
"length": 0,
@@ -155,6 +166,7 @@
"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,
@@ -172,6 +184,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
@@ -179,6 +192,7 @@
"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,
@@ -196,6 +210,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"label": "Options",
"length": 0,
@@ -204,6 +219,7 @@
"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,
@@ -221,6 +237,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Max Length",
"length": 0,
@@ -230,6 +247,7 @@
"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,
@@ -248,6 +266,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Max Value",
"length": 0,
@@ -257,6 +276,7 @@
"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,
@@ -274,6 +294,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
@@ -281,6 +302,7 @@
"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,
@@ -298,6 +320,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Description",
"length": 0,
@@ -306,6 +329,7 @@
"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,
@@ -323,6 +347,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"length": 0,
"no_copy": 0,
@@ -330,6 +355,7 @@
"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,
@@ -347,6 +373,7 @@
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Default",
"length": 0,
@@ -355,6 +382,7 @@
"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,
@@ -372,7 +400,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-09-26 07:22:54.305948",
"modified": "2016-11-15 12:36:51.897756",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Form Field",


Loading…
Cancel
Save