Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2011-12-06 19:05:14 +05:30
commit cde8bec0a6
7 changed files with 7 additions and 232 deletions

View File

@ -140,7 +140,9 @@ def update_security(args=''):
if 'new_password' in args:
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
import server_tools.gateway_utils
webnotes.msgprint(server_tools.gateway_utils.change_password('', args['new_password'], args['user'], args['sys_admin_pwd'])['message'])
res = server_tools.gateway_utils.change_password('', args['new_password'], args['user'], args['sys_admin_pwd'])
if 'Traceback' not in res['message']:
webnotes.msgprint(res['message'])
else:
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s", (args['new_password'], args['user']))
else: webnotes.msgprint('Settings Updated')
else: webnotes.msgprint('Settings Updated')

View File

@ -34,9 +34,9 @@ class DocType:
'customer_name' : details and details[0]['customer_name'] or ''
}
#get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details)
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact='Yes' and docstatus!=2" %(self.doc.customer), as_dict = 1)
contact_det = sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1)
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
ret['contact_no'] = contact_det and contact_det[0]['contact_no'] or ''
ret['contact_no'] = contact_det and contact_det[0]['phone'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
return ret
else:

View File

@ -1,101 +0,0 @@
content_items = ['Sales','Expenses','Bank Balance','Activity']
# make a grid with items and columns of checkboxes
# Parameters:
# parent
# label (main heading)
# items = [] (rows)
# columns = [] (columns of checks)
# widths
# description
class CheckGrid
constructor: (@args) ->
$.extend @, args
@wrapper = $a @parent, 'div', 'check-grid round'
@render()
render: ->
$a @wrapper, 'h3', 'check-grid-title', null, @label
if @description
$a @wrapper, 'div', 'help-box', null, @description
@tab = make_table @wrapper, @items.length + 1, @columns.length, '100%', @widths
@checks = {}
# render heads
for i in [0..@columns.length-1]
$($td(@tab, 0, i))
.addClass('check-grid-head gradient')
.html @columns[i]
@render_rows()
render_rows: ->
# render rows
for i in [0..@items.length-1]
$td(@tab, i+1, 0).innerHTML = @items[i]
# render checkboxes for this row
@checks[@items[i]] = {}
for c in [1..@columns.length-1]
check = $a_input $td(@tab, i+1, c), 'checkbox'
# tag keys to checkbox
check.item = @items[i]
check.column = @columns[c]
# add in my checks
@checks[@items[i]][@columns[c]] = check
# get the values of the checkbox in a double dict
get: =>
val = {}
for item in keys @checks
for column in keys @checks[item]
check = @checks[item][column]
val[check.item] or= {}
val[check.item][check.column] = if check.checked then 1 else 0
val
# set the values of the grid
set: (val) =>
for item in keys @checks
for column in keys @checks[item]
if val[item][column]
@checks[item][column] .checked = val[item][column]
return
# attach it to onload
cx = cur_frm.cscript
cx.onload = (doc, dt, dn) ->
# make the content grid
cx.content_grid = new CheckGrid
parent: cur_frm.fields_dict.Body.wrapper
label: 'Email Settings'
items: content_items
columns: ['Item','Daily','Weekly']
widths: ['60%', '20%', '20%']
description: 'Select items to be compiled for Email Digest'
# make the email grid
cx.email_grid = new CheckGrid
parent: cur_frm.fields_dict.Body.wrapper
label: 'Send To'
items: ['test1@erpnext', 'test2@erpnext']
columns: ['Email','Daily','Weekly']
widths: ['60%', '20%', '20%']
description: 'Select who gets daily and weekly mails'
cx.content_grid.set JSON.parse doc.content_config if doc.content_config
cx.email_grid.set JSON.parse doc.email_config if doc.email_config
return
# update the data before sending
cx.validate = (doc, dt, dn) ->
doc.content_config = JSON.stringify cx.content_grid.get()
doc.email_config = JSON.stringify cx.email_grid.get()

View File

@ -1,18 +0,0 @@
div.check-grid {
margin: 17px;
}
div.check-grid table {
border-collapse: collapse;
}
div.check-grid table td {
padding: 3px;
border: 1px solid #aaa;
}
td.check-grid-head {
font-weight: bold;
text-align: center;
}

View File

@ -1,108 +0,0 @@
(function() {
var CheckGrid, content_items, cx;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
content_items = ['Sales', 'Expenses', 'Bank Balance', 'Activity'];
CheckGrid = (function() {
function CheckGrid(args) {
this.args = args;
this.set = __bind(this.set, this);
this.get = __bind(this.get, this);
$.extend(this, args);
this.wrapper = $a(this.parent, 'div', 'check-grid round');
this.render();
}
CheckGrid.prototype.render = function() {
var i, _ref;
$a(this.wrapper, 'h3', 'check-grid-title', null, this.label);
if (this.description) {
$a(this.wrapper, 'div', 'help-box', null, this.description);
}
this.tab = make_table(this.wrapper, this.items.length + 1, this.columns.length, '100%', this.widths);
this.checks = {};
for (i = 0, _ref = this.columns.length - 1; 0 <= _ref ? i <= _ref : i >= _ref; 0 <= _ref ? i++ : i--) {
$($td(this.tab, 0, i)).addClass('check-grid-head gradient').html(this.columns[i]);
}
return this.render_rows();
};
CheckGrid.prototype.render_rows = function() {
var c, check, i, _ref, _results;
_results = [];
for (i = 0, _ref = this.items.length - 1; 0 <= _ref ? i <= _ref : i >= _ref; 0 <= _ref ? i++ : i--) {
$td(this.tab, i + 1, 0).innerHTML = this.items[i];
this.checks[this.items[i]] = {};
_results.push((function() {
var _ref2, _results2;
_results2 = [];
for (c = 1, _ref2 = this.columns.length - 1; 1 <= _ref2 ? c <= _ref2 : c >= _ref2; 1 <= _ref2 ? c++ : c--) {
check = $a_input($td(this.tab, i + 1, c), 'checkbox');
check.item = this.items[i];
check.column = this.columns[c];
_results2.push(this.checks[this.items[i]][this.columns[c]] = check);
}
return _results2;
}).call(this));
}
return _results;
};
CheckGrid.prototype.get = function() {
var check, column, item, val, _i, _j, _len, _len2, _name, _ref, _ref2;
val = {};
_ref = keys(this.checks);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
_ref2 = keys(this.checks[item]);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
column = _ref2[_j];
check = this.checks[item][column];
val[_name = check.item] || (val[_name] = {});
val[check.item][check.column] = check.checked ? 1 : 0;
}
}
return val;
};
CheckGrid.prototype.set = function(val) {
var column, item, _i, _j, _len, _len2, _ref, _ref2;
_ref = keys(this.checks);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
item = _ref[_i];
_ref2 = keys(this.checks[item]);
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
column = _ref2[_j];
if (val[item][column]) {
this.checks[item][column].checked = val[item][column];
}
}
}
};
return CheckGrid;
})();
cx = cur_frm.cscript;
cx.onload = function(doc, dt, dn) {
cx.content_grid = new CheckGrid({
parent: cur_frm.fields_dict.Body.wrapper,
label: 'Email Settings',
items: content_items,
columns: ['Item', 'Daily', 'Weekly'],
widths: ['60%', '20%', '20%'],
description: 'Select items to be compiled for Email Digest'
});
cx.email_grid = new CheckGrid({
parent: cur_frm.fields_dict.Body.wrapper,
label: 'Send To',
items: ['test1@erpnext', 'test2@erpnext'],
columns: ['Email', 'Daily', 'Weekly'],
widths: ['60%', '20%', '20%'],
description: 'Select who gets daily and weekly mails'
});
if (doc.content_config) {
cx.content_grid.set(JSON.parse(doc.content_config));
}
if (doc.email_config) {
cx.email_grid.set(JSON.parse(doc.email_config));
}
};
cx.validate = function(doc, dt, dn) {
doc.content_config = JSON.stringify(cx.content_grid.get());
return doc.email_config = JSON.stringify(cx.email_grid.get());
};
}).call(this);

View File

@ -3,7 +3,7 @@
<meta charset="utf-8">
<title>ERPNext</title>
<meta name="author" content="">
<script type="text/javascript">window._version_number="336"
<script type="text/javascript">window._version_number="337"
wn={}
wn.provide=function(namespace){var nsl=namespace.split('.');var l=nsl.length;var parent=window;for(var i=0;i<l;i++){var n=nsl[i];if(!parent[n]){parent[n]={}}

Binary file not shown.