Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
de0c5ae0bc
@ -26,7 +26,8 @@ report.customize_filters = function() {
|
||||
ignore : 1,
|
||||
options: 'Fiscal Year',
|
||||
parent:'Leave Allocation',
|
||||
in_first_page:1
|
||||
in_first_page:1,
|
||||
report_default: sys_defaults.fiscal_year
|
||||
});
|
||||
this.add_filter({
|
||||
fieldname:'employee_name',
|
||||
|
@ -32,11 +32,13 @@ class DocType(DocTypeNestedSet):
|
||||
# webpage updates
|
||||
from website.utils import update_page_name
|
||||
page_name = self.doc.name
|
||||
if webnotes.conn.get_value("Website Settings", None,
|
||||
if webnotes.conn.get_value("Product Settings", None,
|
||||
"default_product_category")==self.doc.name:
|
||||
page_name = "products"
|
||||
from website.utils import clear_cache
|
||||
clear_cache()
|
||||
|
||||
update_page_name(self.doc, self.doc.name)
|
||||
update_page_name(self.doc, page_name)
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
@ -4,7 +4,7 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-07 15:15:28",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 10:38:02"
|
||||
"modified": "2012-12-27 18:50:20"
|
||||
},
|
||||
{
|
||||
"in_create": 1,
|
||||
@ -52,6 +52,7 @@
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"read_only": 1,
|
||||
"doctype": "DocField",
|
||||
"label": "Page Name",
|
||||
"fieldname": "page_name",
|
||||
|
@ -25,23 +25,19 @@ class DocType:
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
if self.doc.customer:
|
||||
self.doc.name = self.doc.customer + '-' + self.doc.address_type
|
||||
elif self.doc.supplier:
|
||||
self.doc.name = self.doc.supplier + '-' + self.doc.address_type
|
||||
elif self.doc.sales_partner:
|
||||
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
|
||||
elif self.doc.address_title:
|
||||
self.doc.address_title = self.doc.address_title + "-" + self.doc.address_type
|
||||
if not self.doc.address_title:
|
||||
self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner
|
||||
|
||||
if self.doc.address_title:
|
||||
self.doc.name = self.doc.address_title + "-" + self.doc.address_type
|
||||
|
||||
else:
|
||||
webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True)
|
||||
|
||||
|
||||
def validate(self):
|
||||
self.validate_for_whom()
|
||||
self.validate_primary_address()
|
||||
self.validate_shipping_address()
|
||||
|
||||
def validate_for_whom(self):
|
||||
if not (self.doc.customer or self.doc.supplier or self.doc.sales_partner):
|
||||
msgprint("Please enter value in atleast one of customer, supplier and sales partner field", raise_exception=1)
|
||||
|
||||
def validate_primary_address(self):
|
||||
"""Validate that there can only be one primary address for particular customer, supplier"""
|
||||
|
@ -4,7 +4,7 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:41",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 11:31:37"
|
||||
"modified": "2012-12-27 18:08:55"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
@ -55,6 +55,7 @@
|
||||
"label": "Address Title",
|
||||
"fieldname": "address_title",
|
||||
"fieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
@ -214,60 +215,6 @@
|
||||
"fieldtype": "Link",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "System Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Sales Master Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Purchase Master Manager",
|
||||
"cancel": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Maintenance Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Accounts Manager",
|
||||
"cancel": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Sales Manager",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"role": "Purchase Manager",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
|
@ -15,4 +15,8 @@ class DocType:
|
||||
emp = webnotes.doc("Employee", d.employee)
|
||||
emp.image = url_for_website(emp.image)
|
||||
emp_list.append(emp)
|
||||
self.doclist += emp_list
|
||||
self.doclist += emp_list
|
||||
|
||||
def on_update(self):
|
||||
from website.utils import clear_cache
|
||||
clear_cache("about")
|
@ -4,7 +4,7 @@
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 14:24:35",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 15:51:11"
|
||||
"modified": "2012-12-27 17:44:55"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
@ -38,6 +38,13 @@
|
||||
"name": "About Us Settings",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Help",
|
||||
"fieldname": "help",
|
||||
"fieldtype": "HTML",
|
||||
"options": "<div class=\"alert\">Link for About Us Page is \"about.html\"</div>"
|
||||
},
|
||||
{
|
||||
"description": "Introduce your company to the website visitor.",
|
||||
"doctype": "DocField",
|
||||
|
0
website/doctype/contact_us_settings/__init__.py
Normal file
0
website/doctype/contact_us_settings/__init__.py
Normal file
21
website/doctype/contact_us_settings/contact_us_settings.py
Normal file
21
website/doctype/contact_us_settings/contact_us_settings.py
Normal file
@ -0,0 +1,21 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def onload(self):
|
||||
"""load address"""
|
||||
if self.doc.query_options:
|
||||
self.doc.query_options = filter(None, self.doc.query_options.replace(",", "\n").split())
|
||||
else:
|
||||
self.doc.query_options = ["Sales", "Support", "General"]
|
||||
if self.doc.address:
|
||||
self.address = webnotes.model_wrapper("Address", self.doc.address).doc
|
||||
|
||||
def on_update(self):
|
||||
from website.utils import clear_cache
|
||||
clear_cache("about")
|
72
website/doctype/contact_us_settings/contact_us_settings.txt
Normal file
72
website/doctype/contact_us_settings/contact_us_settings.txt
Normal file
@ -0,0 +1,72 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-27 17:43:10",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-27 17:57:55"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
"description": "Settings for Contact Us Page",
|
||||
"doctype": "DocType",
|
||||
"module": "Website",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Contact Us Settings",
|
||||
"doctype": "DocField",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"parentfield": "fields"
|
||||
},
|
||||
{
|
||||
"parent": "Contact Us Settings",
|
||||
"read": 1,
|
||||
"name": "__common__",
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"write": 1,
|
||||
"parenttype": "DocType",
|
||||
"role": "Website Manager",
|
||||
"permlevel": 0,
|
||||
"parentfield": "permissions"
|
||||
},
|
||||
{
|
||||
"name": "Contact Us Settings",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Help",
|
||||
"fieldname": "help",
|
||||
"fieldtype": "HTML",
|
||||
"options": "<div class=\"alert\">Link for Contact Page is \"contact.html\"</div>"
|
||||
},
|
||||
{
|
||||
"description": "Address to be displayed on the Contact Page",
|
||||
"doctype": "DocField",
|
||||
"label": "Address",
|
||||
"fieldname": "address",
|
||||
"fieldtype": "Link",
|
||||
"options": "Address"
|
||||
},
|
||||
{
|
||||
"description": "Contact options, like \"Sales Query, Support Query\" etc each on a new line or separated by commas.",
|
||||
"doctype": "DocField",
|
||||
"label": "Query Options",
|
||||
"fieldname": "query_options",
|
||||
"fieldtype": "Small Text"
|
||||
},
|
||||
{
|
||||
"description": "Introductory information for the Contact Us Page",
|
||||
"doctype": "DocField",
|
||||
"label": "Introduction",
|
||||
"fieldname": "introduction",
|
||||
"fieldtype": "Text Editor"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
]
|
@ -5,4 +5,9 @@ import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def on_update(self):
|
||||
"""clear web cache"""
|
||||
from website.utils import clear_cache
|
||||
clear_cache()
|
@ -2,9 +2,9 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-12-20 14:05:00",
|
||||
"creation": "2012-12-27 11:46:18",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-20 15:46:15"
|
||||
"modified": "2012-12-27 18:51:38"
|
||||
},
|
||||
{
|
||||
"issingle": 1,
|
||||
@ -38,6 +38,21 @@
|
||||
"name": "Product Settings",
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"label": "Help",
|
||||
"fieldname": "help",
|
||||
"fieldtype": "HTML",
|
||||
"options": "<div class=\"alert\">To start adding products on the website, check \"Show in Website\" in <b>Item</b> and <b>Item Group</b></div>"
|
||||
},
|
||||
{
|
||||
"description": "This Item Group represents \"products.html\"",
|
||||
"doctype": "DocField",
|
||||
"label": "Default Product Category",
|
||||
"fieldname": "default_product_category",
|
||||
"fieldtype": "Link",
|
||||
"options": "Item Group"
|
||||
},
|
||||
{
|
||||
"description": "Default: \"Product Search\"",
|
||||
"doctype": "DocField",
|
||||
|
@ -46,4 +46,4 @@ class DocType:
|
||||
def on_update(self):
|
||||
"""rebuild pages"""
|
||||
from website.helpers.make_web_include_files import make
|
||||
make()
|
||||
make()
|
@ -6,7 +6,7 @@
|
||||
<p class="help">Static (content) web page.</p>
|
||||
<br>
|
||||
<h5><a href="#List/Blog">Blog</a></h5>
|
||||
<p class="help">Weblog (blog) entr.y</p>
|
||||
<p class="help">Weblog (blog) entry.</p>
|
||||
<br>
|
||||
<h5><a href="#List/Website Slideshow">Website Slideshow</a></h5>
|
||||
<p class="help">Slideshows for adding in website pages.</p>
|
||||
@ -23,6 +23,9 @@
|
||||
<br>
|
||||
<h5><a href="#Form/About Us Settings">About Us Settings</a></h5>
|
||||
<p class="help">Settings for About Us Page.</p>
|
||||
<br>
|
||||
<h5><a href="#Form/Contact Us Settings">Contact Us Settings</a></h5>
|
||||
<p class="help">Settings for the Contact Us Page.</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
</div>
|
||||
|
37
website/templates/js/contact.js
Normal file
37
website/templates/js/contact.js
Normal file
@ -0,0 +1,37 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.btn-send').click(function() {
|
||||
var email = $('[name="email"]').val();
|
||||
var message = $('[name="message"]').val();
|
||||
|
||||
if(!(email && message)) {
|
||||
msgprint("Please enter both your email and message so that we \
|
||||
can get back to you. Thanks!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!valid_email(email)) {
|
||||
msgprint("You seem to have written your name instead of your email. \
|
||||
Please enter a valid email address so that we can get back.");
|
||||
$('[name="email"]').focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#contact-alert").toggle(false);
|
||||
erpnext.send_message({
|
||||
subject: $('[name="subject"]').val(),
|
||||
sender: email,
|
||||
message: message,
|
||||
callback: function(r) {
|
||||
msgprint(r.message);
|
||||
$(':input').val('');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var msgprint = function(txt) {
|
||||
if(txt) $("#contact-alert").html(txt).toggle(true);
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
{% extends "html/page.html" %}
|
||||
|
||||
{% block title %}
|
||||
About Us
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="layout-wrapper">
|
||||
<div class="layout-main">
|
||||
{% if obj.doc.company_introduction %}
|
||||
{{ obj.doc.company_introduction }}
|
||||
{% endif %}
|
||||
{{ obj.doc.company_introduction or "Some Introduction about your company that you would like your website visitor to know. More people than you think will read your About page. People always like to know who the are doing business with. Be authentic and avoid using jargon like 'value added services' etc. Be sure to update your company history and list of key team members in Website > About Us Settings" }}
|
||||
{% if obj.doclist.get({"doctype":"Company History"}) %}
|
||||
<h3>{{ obj.doc.company_history_heading or "Company History" }}</h3>
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
@ -24,11 +26,11 @@
|
||||
<table class="table table-bordered" style="width: 100%; table-layout: fixed">
|
||||
<tbody>
|
||||
{% for d in obj.doclist.get({"doctype":"Employee"}) %}
|
||||
<tr>
|
||||
<tr itemscope itemtype="http://schema.org/Person">
|
||||
<td style="text-align:right; width: 30%;">
|
||||
<img src="{{ d.image }}" style=""></td>
|
||||
<td><h4>{{ d.employee_name }}</h4>
|
||||
{{ d.bio }}</td>
|
||||
<img src="{{ d.image }}" style="" itemprop="image"></td>
|
||||
<td><h4 itemprop="name">{{ d.employee_name }}</h4>
|
||||
<div itemprop="description">{{ d.bio }}</div></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
56
website/templates/pages/contact.html
Normal file
56
website/templates/pages/contact.html
Normal file
@ -0,0 +1,56 @@
|
||||
{% extends "html/page.html" %}
|
||||
|
||||
{% block javascript %}
|
||||
{% include "js/contact.js" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
Contact Us
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="layout-wrapper">
|
||||
<div class="layout-main">
|
||||
<div class="web-form span5 pull-left">
|
||||
{{ obj.doc.introduction or "<h3>Contact Us</h3>"}}
|
||||
<div class="span4" style="margin-left:0px;">
|
||||
<p id="contact-alert" class="alert"
|
||||
style="display: none;"> </p>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<p><select class="span4" name="subject">
|
||||
{% for option in obj.doc.query_options %}
|
||||
<option value="{{ option }}">{{ option }}</option>
|
||||
{% endfor %}
|
||||
</select></p>
|
||||
<p><input class="span4" name="email" type="text" placeholder="Your Email Address" /></p>
|
||||
<p><textarea class="span4" rows="10" name="message"></textarea></p>
|
||||
<p><button class="btn btn-primary btn-send">Send</button></p>
|
||||
</div>
|
||||
{% if obj.doc.address %}
|
||||
<div class="pull-right span3" itemscope itemtype="http://schema.org/PostalAddress">
|
||||
<h4>{{ obj.address.address_title }}</h4>
|
||||
{% if obj.address.address_line1 %}
|
||||
<p itemprop="streetAddress">{{ obj.address.address_line1 }}</p>
|
||||
{% endif %}
|
||||
{% if obj.address.address_line2 %}
|
||||
<p itemprop="streetAddress">{{ obj.address.address_line2 }}</p>
|
||||
{% endif %}
|
||||
{% if obj.address.city %}
|
||||
<p itemprop="addressLocality">{{ obj.address.city }}</p>
|
||||
{% endif %}
|
||||
{% if obj.address.state %}
|
||||
<p itemprop="addressRegion">{{ obj.address.state }}</p>
|
||||
{% endif %}
|
||||
{% if obj.address.pincode %}
|
||||
<p itemprop="postalCode">{{ obj.address.pincode }}</p>
|
||||
{% endif %}
|
||||
{% if obj.address.country %}
|
||||
<p itemprop="addressCountry">{{ obj.address.country }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -41,7 +41,8 @@ page_map = {
|
||||
}
|
||||
|
||||
page_settings_map = {
|
||||
"about": "About Us Settings"
|
||||
"about": "About Us Settings",
|
||||
"contact": "Contact Us Settings"
|
||||
}
|
||||
|
||||
def render(page_name):
|
||||
|
Loading…
x
Reference in New Issue
Block a user