<commit_before>// Copyright (c) 2016, Frappe Technologies and contributors
// For license information, please see license.txt

frappe.ui.form.on('Bulk Update', {
	refresh: function(frm) {
		frm.page.set_primary_action(__('Update'), function() {
			if (!frm.doc.update_value) {
				frappe.throw(__('Field "value" is mandatory. Please specify value to be updated'));
			} else {
				frappe.call({
					method: 'frappe.desk.doctype.bulk_update.bulk_update.update',
					args: {
						doctype: frm.doc.document_type,
						field: frm.doc.field,
						value: frm.doc.update_value,
						condition: frm.doc.condition,
						limit: frm.doc.limit
					},
				}).then(r => {
					let failed = r.message;
					if (!failed) failed = [];

					if (failed.length && !r._server_messages) {
						frappe.throw(__('Cannot update {0}', [failed.map(f => f.bold ? f.bold(): f).join(', ')]));
					}
					frappe.hide_progress();
				});
			}
		});
	},

	document_type: function(frm) {
		// set field options<commit_msg>fix: bulk update tool updating records but not showing result<commit_after>// Copyright (c) 2016, <NAME> and contributors
// For license information, please see license.txt

frappe.ui.form.on('Bulk Update', {
	refresh: function(frm) {
		frm.page.set_primary_action(__('Update'), function() {
			if (!frm.doc.update_value) {
				frappe.throw(__('Field "value" is mandatory. Please specify value to be updated'));
			} else {
				frappe.call({
					method: 'frappe.desk.doctype.bulk_update.bulk_update.update',
					args: {
						doctype: frm.doc.document_type,
						field: frm.doc.field,
						value: frm.doc.update_value,
						condition: frm.doc.condition,
						limit: frm.doc.limit
					},
				}).then(r => {
					let failed = r.message;
					if (!failed) failed = [];

					if (failed.length && !r._server_messages) {
						frappe.throw(__('Cannot update {0}', [failed.map(f => f.bold ? f.bold(): f).join(', ')]));
					} else {
						frappe.msgprint({
							title: __('Success'),
							message: __('Updated Successfully'),
							indicator: 'green'
						});
					}

					frappe.hide_progress();
					frm.save();
				});
			}
		});
	},

	document_type: function(frm) {
		// set field options
{'fraction_non_alphanumeric': 0.16287534121929026, 'fraction_numerical': 0.004549590536851683, 'mean_word_length': 2.8714788732394365, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, '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': '6638273', 'n_tokens_mistral': 955, 'n_tokens_neox': 747, 'n_words': 157}