<commit_before>cur_frm.cscript.select_transaction = function(doc, dt, dn) {
  if(doc.select_transaction) {
    var callback = function(r,rt) {
      var doc = locals[dt][dn];
      doc.custom_message = r.message;
      refresh_field('custom_message');
    }
    $c_obj('Notification Control','get_message',doc.select_transaction, callback)
  }
}

cur_frm.cscript.notify = function(doc, args) {
	if(validate_email(args['send_to'] || doc.contact_email || '')) {
		$c_obj('Notification Control', 'get_formatted_message', {
			type: args['type'],
			doctype: args['doctype'],
			contact_name: args['contact_name'] || doc.contact_display
		}, function(r, rt) {
			if(!r.exc) {
				var res = JSON.parse(r.message);
				var send_from = (function() {
					if(user!='Administrator') {
						return user;
					} else {
						var cp = locals['Control Panel']['Control Panel'];
						return (cp.auto_email_id || '<EMAIL>');
					}
				})();
				if(res.send) {
					var print_heading = (doc.select_print_heading || args['type'])
					sendmail(
						args['send_to'] || doc.contact_email,
						send_from,
						send_from,
						doc.company + " - " + print_heading,
						res.message,
						res.print_format
					);
					msgprint('This ' + print_heading + ' is being sent to <b>'
						+ (args['send_to'] || doc.contact_email) + '</b><br />...');
				}
			}
			//console.log(JSON.parse(r.message));
		});
	}
}<commit_msg>Doc's name in subject of auto notifications<commit_after>cur_frm.cscript.select_transaction = function(doc, dt, dn) {
  if(doc.select_transaction) {
    var callback = function(r,rt) {
      var doc = locals[dt][dn];
      doc.custom_message = r.message;
      refresh_field('custom_message');
    }
    $c_obj('Notification Control','get_message',doc.select_transaction, callback)
  }
}

cur_frm.cscript.notify = function(doc, args) {
	if(validate_email(args['send_to'] || doc.contact_email || '')) {
		$c_obj('Notification Control', 'get_formatted_message', {
			type: args['type'],
			doctype: args['doctype'],
			contact_name: args['contact_name'] || doc.contact_display
		}, function(r, rt) {
			if(!r.exc) {
				var res = JSON.parse(r.message);
				var send_from = (function() {
					if(user!='Administrator') {
						return user;
					} else {
						var cp = locals['Control Panel']['Control Panel'];
						return (cp.auto_email_id || '<EMAIL>');
					}
				})();
				if(res.send) {
					var print_heading = (doc.select_print_heading || args['type'])
					sendmail(
						args['send_to'] || doc.contact_email,
						send_from,
						send_from,
						doc.company + " - " + print_heading + " - " + doc.name,
						res.message,
						res.print_format
					);
					msgprint('This ' + print_heading + ' is being sent to <b>'
						+ (args['send_to'] || doc.contact_email) + '</b><br />...');
				}
			}
			//console.log(JSON.parse(r.message));
		});
	}
}
{'fraction_non_alphanumeric': 0.1742926999650716, 'fraction_numerical': 0.0, 'mean_word_length': 3.132756132756133, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5451724', 'n_tokens_mistral': 1200, 'n_tokens_neox': 974, 'n_words': 163}