Browse Source

Added console.warn messages for deprecated API

version-14
Faris Ansari 8 years ago
parent
commit
448e100076
5 changed files with 11 additions and 13 deletions
  1. +7
    -2
      frappe/public/js/frappe/desk.js
  2. +1
    -3
      frappe/public/js/frappe/misc/datetime.js
  3. +1
    -2
      frappe/public/js/frappe/ui/messages.js
  4. +1
    -6
      frappe/public/js/legacy/datatype.js
  5. +1
    -0
      frappe/public/js/legacy/form.js

+ 7
- 2
frappe/public/js/frappe/desk.js View File

@@ -269,13 +269,18 @@ frappe.Application = Class.extend({
},

set_globals: function() {
console.warn('The global `user` has been deprecated. Please use `frappe.session.user` instead.');
frappe.session.user = frappe.boot.user.name;
frappe.session.user_email = frappe.boot.user.email;
frappe.session.user_fullname = frappe.user_info().fullname;

console.warn('The global `user_defaults` has been deprecated. Please use `frappe.user_roles` instead.');
frappe.user_defaults = frappe.boot.user.defaults;
console.warn('The global `roles` has been deprecated. Please use `frappe.user_roles` instead.');
frappe.user_roles = frappe.boot.user.roles;
console.warn('The global `sys_defaults` has been deprecated. Please use `frappe.sys_defaults` instead.');
frappe.sys_defaults = frappe.boot.sysdefaults;

frappe.ui.py_date_format = frappe.boot.sysdefaults.date_format.replace('dd', '%d').replace('mm', '%m').replace('yyyy', '%Y');
frappe.boot.user.last_selected_values = {};
},
@@ -296,12 +301,12 @@ frappe.Application = Class.extend({
localStorage["page_info"] = JSON.stringify(frappe.boot.page_info);
},
set_as_guest: function() {
// for backward compatibility
frappe.session.user = 'Guest';
frappe.session.user_email = '';
frappe.session.user_fullname = 'Guest';

frappe.user_defaults = {};
frappe.user_roles = ['Guest'];
frappe.session.user_email = '';
frappe.sys_defaults = {};
},
make_page_container: function() {


+ 1
- 3
frappe/public/js/frappe/misc/datetime.js View File

@@ -155,6 +155,4 @@ $.extend(frappe.datetime, {

});

// globals (deprecate)
// var date = dateutil = frappe.datetime;
// var get_today = frappe.datetime.get_today;
console.warn('The globals `dateutil` and `get_today` are deprecated. Please use `frappe.datetime` instead.')

+ 1
- 2
frappe/public/js/frappe/ui/messages.js View File

@@ -77,6 +77,7 @@ frappe.prompt = function(fields, callback, title, primary_label) {
return d;
}

console.warn('The globals `msgprint` and `show_alert` has been deprecated. Please use `frappe.msgprint` and `frappe.show_alert` instead.');
var msg_dialog=null;
frappe.msgprint = function(msg, title) {
if(!msg) return;
@@ -221,8 +222,6 @@ frappe.verify_password = function(callback) {
}, __("Verify Password"), __("Verify"))
}

var msgprint = frappe.msgprint;

frappe.show_progress = function(title, count, total) {
if(frappe.cur_progress && frappe.cur_progress.title === title
&& frappe.cur_progress.$wrapper.is(":visible")) {


+ 1
- 6
frappe/public/js/legacy/datatype.js View File

@@ -75,12 +75,7 @@ var crop = function(s, len) {
return s;
}


function keys(obj) {
var mykeys=[];
for (var key in obj) mykeys[mykeys.length]=key;
return mykeys;
}
console.warn('The global `keys` has been deprecated. Please use `Object.keys` instead');

function has_words(list, item) {
if(!item) return true;


+ 1
- 0
frappe/public/js/legacy/form.js View File

@@ -690,6 +690,7 @@ _f.Frm.prototype.reload_doc = function() {
}
}

console.warn('The global `validated` has been deprecated. Please use `frappe.validated` instead.');
frappe.validated = 0;
_f.Frm.prototype.save = function(save_action, callback, btn, on_error) {
btn && $(btn).prop("disabled", true);


Loading…
Cancel
Save