refactor: reduce usage of `cur_frm`
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
index 741039a..7d467cb 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.js
@@ -57,13 +57,13 @@
get_entries: function (frm, account) {
frappe.call({
method: "get_accounts_data",
- doc: cur_frm.doc,
+ doc: frm.doc,
account: account,
callback: function (r) {
frappe.model.clear_table(frm.doc, "accounts");
if (r.message) {
r.message.forEach((d) => {
- cur_frm.add_child("accounts", d);
+ frm.add_child("accounts", d);
});
frm.events.get_total_gain_loss(frm);
refresh_field("accounts");
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js
index 6d90c26..f65f0c2 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.js
@@ -189,7 +189,7 @@
show_general_ledger: (frm) => {
if (frm.doc.docstatus > 0) {
- cur_frm.add_custom_button(
+ frm.add_custom_button(
__("Accounting Ledger"),
function () {
frappe.route_options = {
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.js b/erpnext/accounts/doctype/journal_entry/journal_entry.js
index 3186d07..ed134ba 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.js
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.js
@@ -255,7 +255,7 @@
}
onload_post_render() {
- cur_frm.get_field("accounts").grid.set_multiple_add("account");
+ this.frm.get_field("accounts").grid.set_multiple_add("account");
}
load_defaults() {
@@ -402,7 +402,7 @@
row.debit = -doc.difference;
}
}
- cur_frm.cscript.update_totals(doc);
+ this.frm.cscript.update_totals(doc);
erpnext.accounts.dimensions.copy_dimension_from_first_row(this.frm, cdt, cdn, "accounts");
}
@@ -469,11 +469,11 @@
},
debit: function (frm, dt, dn) {
- cur_frm.cscript.update_totals(frm.doc);
+ frm.cscript.update_totals(frm.doc);
},
credit: function (frm, dt, dn) {
- cur_frm.cscript.update_totals(frm.doc);
+ frm.cscript.update_totals(frm.doc);
},
exchange_rate: function (frm, cdt, cdn) {
@@ -489,7 +489,7 @@
});
frappe.ui.form.on("Journal Entry Account", "accounts_remove", function (frm) {
- cur_frm.cscript.update_totals(frm.doc);
+ frm.cscript.update_totals(frm.doc);
});
$.extend(erpnext.journal_entry, {
@@ -531,7 +531,7 @@
flt(flt(row.credit_in_account_currency) * row.exchange_rate, precision("credit", row))
);
- cur_frm.cscript.update_totals(frm.doc);
+ frm.cscript.update_totals(frm.doc);
},
set_exchange_rate: function (frm, cdt, cdn) {
@@ -673,10 +673,10 @@
return { filters: filters };
},
- reverse_journal_entry: function () {
+ reverse_journal_entry: function (frm) {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.journal_entry.journal_entry.make_reverse_journal_entry",
- frm: cur_frm,
+ frm: frm,
});
},
});
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index 0cb1a3d..781d9f5 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -322,13 +322,13 @@
"references"
);
- cur_frm.set_df_property(
+ frm.set_df_property(
"source_exchange_rate",
"description",
"1 " + frm.doc.paid_from_account_currency + " = [?] " + company_currency
);
- cur_frm.set_df_property(
+ frm.set_df_property(
"target_exchange_rate",
"description",
"1 " + frm.doc.paid_to_account_currency + " = [?] " + company_currency
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
index a6e8bfa..52c7706 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.js
@@ -193,7 +193,7 @@
make_sales_return() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.pos_invoice.pos_invoice.make_sales_return",
- frm: cur_frm,
+ frm: this.frm,
});
}
};
@@ -293,7 +293,7 @@
});
} else if (frappe.dom.freeze_count != 0) {
frappe.dom.unfreeze();
- cur_frm.reload_doc();
+ frm.reload_doc();
cur_pos.payment.events.submit_invoice();
frappe.show_alert({
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index 957611f..2bd39a5 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -131,17 +131,17 @@
if (doc.docstatus == 1 && doc.outstanding_amount != 0 && !doc.on_hold) {
this.frm.add_custom_button(__("Payment"), () => this.make_payment_entry(), __("Create"));
- cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
+ this.frm.page.set_inner_btn_group_as_primary(__("Create"));
}
if (!doc.is_return && doc.docstatus == 1) {
if (doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
- cur_frm.add_custom_button(__("Return / Debit Note"), this.make_debit_note, __("Create"));
+ this.frm.add_custom_button(__("Return / Debit Note"), this.make_debit_note, __("Create"));
}
}
if (doc.outstanding_amount > 0 && !cint(doc.is_return) && !doc.on_hold) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Payment Request"),
function () {
me.make_payment_request();
@@ -462,7 +462,7 @@
make_debit_note() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.purchase_invoice.purchase_invoice.make_debit_note",
- frm: cur_frm,
+ frm: this.frm,
});
}
};
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index c7505ce..cf01bdd 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -61,9 +61,9 @@
refresh(doc, dt, dn) {
const me = this;
super.refresh();
- if (cur_frm.msgbox && cur_frm.msgbox.$wrapper.is(":visible")) {
+ if (this.frm.msgbox && this.frm.msgbox.$wrapper.is(":visible")) {
// hide new msgbox
- cur_frm.msgbox.hide();
+ this.frm.msgbox.hide();
}
this.frm.toggle_reqd("due_date", !this.frm.doc.is_return);
@@ -113,33 +113,33 @@
if (doc.docstatus == 1 && !doc.is_return) {
var is_delivered_by_supplier = false;
- is_delivered_by_supplier = cur_frm.doc.items.some(function (item) {
+ is_delivered_by_supplier = this.frm.doc.items.some(function (item) {
return item.is_delivered_by_supplier ? true : false;
});
if (doc.outstanding_amount >= 0 || Math.abs(flt(doc.outstanding_amount)) < flt(doc.grand_total)) {
- cur_frm.add_custom_button(__("Return / Credit Note"), this.make_sales_return, __("Create"));
- cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
+ this.frm.add_custom_button(__("Return / Credit Note"), this.make_sales_return, __("Create"));
+ this.frm.page.set_inner_btn_group_as_primary(__("Create"));
}
if (cint(doc.update_stock) != 1) {
// show Make Delivery Note button only if Sales Invoice is not created from Delivery Note
var from_delivery_note = false;
- from_delivery_note = cur_frm.doc.items.some(function (item) {
+ from_delivery_note = this.frm.doc.items.some(function (item) {
return item.delivery_note ? true : false;
});
if (!from_delivery_note && !is_delivered_by_supplier) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Delivery"),
- cur_frm.cscript["Make Delivery Note"],
+ this.frm.cscript["Make Delivery Note"],
__("Create")
);
}
}
if (doc.outstanding_amount > 0) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Payment Request"),
function () {
me.make_payment_request();
@@ -147,10 +147,10 @@
__("Create")
);
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Invoice Discounting"),
function () {
- cur_frm.events.create_invoice_discounting(cur_frm);
+ this.frm.events.create_invoice_discounting(this.frm);
},
__("Create")
);
@@ -171,10 +171,10 @@
}
if (doc.docstatus === 1) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Maintenance Schedule"),
function () {
- cur_frm.cscript.make_maintenance_schedule();
+ this.frm.cscript.make_maintenance_schedule();
},
__("Create")
);
@@ -182,7 +182,7 @@
}
// Show buttons only when pos view is active
- if (cint(doc.docstatus == 0) && cur_frm.page.current_view_name !== "pos" && !doc.is_return) {
+ if (cint(doc.docstatus == 0) && this.frm.page.current_view_name !== "pos" && !doc.is_return) {
this.frm.cscript.sales_order_btn();
this.frm.cscript.delivery_note_btn();
this.frm.cscript.quotation_btn();
@@ -213,7 +213,7 @@
make_maintenance_schedule() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_maintenance_schedule",
- frm: cur_frm,
+ frm: this.frm,
});
}
@@ -232,28 +232,27 @@
set_default_print_format() {
// set default print format to POS type or Credit Note
- if (cur_frm.doc.is_pos) {
- if (cur_frm.pos_print_format) {
- cur_frm.meta._default_print_format = cur_frm.meta.default_print_format;
- cur_frm.meta.default_print_format = cur_frm.pos_print_format;
+ if (this.frm.doc.is_pos) {
+ if (this.frm.pos_print_format) {
+ this.frm.meta._default_print_format = this.frm.meta.default_print_format;
+ this.frm.meta.default_print_format = this.frm.pos_print_format;
}
- } else if (cur_frm.doc.is_return && !cur_frm.meta.default_print_format) {
- if (cur_frm.return_print_format) {
- cur_frm.meta._default_print_format = cur_frm.meta.default_print_format;
- cur_frm.meta.default_print_format = cur_frm.return_print_format;
+ } else if (this.frm.doc.is_return && !this.frm.meta.default_print_format) {
+ if (this.frm.return_print_format) {
+ this.frm.meta._default_print_format = this.frm.meta.default_print_format;
+ this.frm.meta.default_print_format = this.frm.return_print_format;
}
} else {
- if (cur_frm.meta._default_print_format) {
- cur_frm.meta.default_print_format = cur_frm.meta._default_print_format;
- cur_frm.meta._default_print_format = null;
+ if (this.frm.meta._default_print_format) {
+ this.frm.meta.default_print_format = this.frm.meta._default_print_format;
+ this.frm.meta._default_print_format = null;
} else if (
- in_list(
- [cur_frm.pos_print_format, cur_frm.return_print_format],
- cur_frm.meta.default_print_format
+ [this.frm.pos_print_format, this.frm.return_print_format].includes(
+ this.frm.meta.default_print_format
)
) {
- cur_frm.meta.default_print_format = null;
- cur_frm.meta._default_print_format = null;
+ this.frm.meta.default_print_format = null;
+ this.frm.meta._default_print_format = null;
}
}
}
@@ -465,7 +464,7 @@
make_sales_return() {
frappe.model.open_mapped_doc({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.make_sales_return",
- frm: cur_frm,
+ frm: this.frm,
});
}
diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js
index 0f71e5d..b4fd739 100644
--- a/erpnext/assets/doctype/asset/asset.js
+++ b/erpnext/assets/doctype/asset/asset.js
@@ -48,7 +48,7 @@
method: "erpnext.assets.doctype.asset.asset.make_asset_movement",
freeze: true,
args: {
- assets: [{ name: cur_frm.doc.name }],
+ assets: [{ name: frm.doc.name }],
},
callback: function (r) {
if (r.message) {
@@ -791,9 +791,7 @@
asset_name: frm.doc.name,
},
method: "erpnext.assets.doctype.asset.depreciation.scrap_asset",
- callback: function (r) {
- cur_frm.reload_doc();
- },
+ callback: (r) => frm.reload_doc(),
});
});
};
@@ -805,19 +803,17 @@
asset_name: frm.doc.name,
},
method: "erpnext.assets.doctype.asset.depreciation.restore_asset",
- callback: function (r) {
- cur_frm.reload_doc();
- },
+ callback: (r) => frm.reload_doc(),
});
});
};
-erpnext.asset.transfer_asset = function () {
+erpnext.asset.transfer_asset = function (frm) {
frappe.call({
method: "erpnext.assets.doctype.asset.asset.make_asset_movement",
freeze: true,
args: {
- assets: [{ name: cur_frm.doc.name }],
+ assets: [{ name: frm.doc.name }],
purpose: "Transfer",
},
callback: function (r) {
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js
index cf38302..c3a155a 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.js
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.js
@@ -86,7 +86,7 @@
args: {
subcontract_order: frm.doc.name,
rm_details: po_details,
- order_doctype: cur_frm.doc.doctype,
+ order_doctype: frm.doc.doctype,
},
callback: function (r) {
if (r && r.message) {
@@ -270,8 +270,8 @@
var allow_receipt = false;
var is_drop_ship = false;
- for (var i in cur_frm.doc.items) {
- var item = cur_frm.doc.items[i];
+ for (var i in this.frm.doc.items) {
+ var item = this.frm.doc.items[i];
if (item.delivered_by_supplier !== 1) {
allow_receipt = true;
} else {
@@ -348,7 +348,7 @@
if (doc.status != "Closed") {
if (doc.status != "On Hold") {
if (flt(doc.per_received, 2) < 100 && allow_receipt) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Purchase Receipt"),
this.make_purchase_receipt,
__("Create")
@@ -356,7 +356,7 @@
if (doc.is_subcontracted) {
if (doc.is_old_subcontracting_flow) {
if (me.has_unsupplied_items()) {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Material to Supplier"),
function () {
me.make_stock_entry();
@@ -365,7 +365,7 @@
);
}
} else {
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Subcontracting Order"),
this.make_subcontracting_order,
__("Create")
@@ -374,7 +374,7 @@
}
}
if (flt(doc.per_billed, 2) < 100)
- cur_frm.add_custom_button(
+ this.frm.add_custom_button(
__("Purchase Invoice"),
this.make_purchase_invoice,
__("Create")
@@ -418,10 +418,10 @@
}
}
- cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
+ this.frm.page.set_inner_btn_group_as_primary(__("Create"));
}
} else if (doc.docstatus === 0) {
- cur_frm.cscript.add_from_mappers();
+ this.frm.cscript.add_from_mappers();
}
}
@@ -458,8 +458,8 @@
frappe.call({
method: "erpnext.controllers.subcontracting_controller.make_rm_stock_entry",
args: {
- subcontract_order: cur_frm.doc.name,
- order_doctype: cur_frm.doc.doctype,
+ subcontract_order: this.frm.doc.name,
+ order_doctype: this.frm.doc.doctype,
},
callback: function (r) {
var doclist = frappe.model.sync(r.message);
@@ -478,7 +478,7 @@
make_purchase_receipt() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt",
- frm: cur_frm,
+ frm: this.frm,
freeze_message: __("Creating Purchase Receipt ..."),
});
}
@@ -486,14 +486,14 @@
make_purchase_invoice() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
- frm: cur_frm,
+ frm: this.frm,
});
}
make_subcontracting_order() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.purchase_order.purchase_order.make_subcontracting_order",
- frm: cur_frm,
+ frm: this.frm,
freeze_message: __("Creating Subcontracting Order ..."),
});
}
@@ -652,7 +652,7 @@
}
unhold_purchase_order() {
- cur_frm.cscript.update_status("Resume", "Draft");
+ this.frm.cscript.update_status("Resume", "Draft");
}
hold_purchase_order() {
@@ -692,15 +692,15 @@
}
unclose_purchase_order() {
- cur_frm.cscript.update_status("Re-open", "Submitted");
+ this.frm.cscript.update_status("Re-open", "Submitted");
}
close_purchase_order() {
- cur_frm.cscript.update_status("Close", "Closed");
+ this.frm.cscript.update_status("Close", "Closed");
}
delivered_by_supplier() {
- cur_frm.cscript.update_status("Deliver", "Delivered");
+ this.frm.cscript.update_status("Deliver", "Delivered");
}
items_on_form_rendered() {
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
index c169871..abb5702 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -22,9 +22,9 @@
this.frm.set_value("valid_till", frappe.datetime.add_months(this.frm.doc.transaction_date, 1));
}
if (this.frm.doc.docstatus === 1) {
- cur_frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, __("Create"));
- cur_frm.page.set_inner_btn_group_as_primary(__("Create"));
- cur_frm.add_custom_button(__("Quotation"), this.make_quotation, __("Create"));
+ this.frm.add_custom_button(__("Purchase Order"), this.make_purchase_order, __("Create"));
+ this.frm.page.set_inner_btn_group_as_primary(__("Create"));
+ this.frm.add_custom_button(__("Quotation"), this.make_quotation, __("Create"));
} else if (this.frm.doc.docstatus === 0) {
this.frm.add_custom_button(
__("Material Request"),
@@ -87,13 +87,13 @@
make_purchase_order() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_purchase_order",
- frm: cur_frm,
+ frm: this.frm,
});
}
make_quotation() {
frappe.model.open_mapped_doc({
method: "erpnext.buying.doctype.supplier_quotation.supplier_quotation.make_quotation",
- frm: cur_frm,
+ frm: this.frm,
});
}
};
diff --git a/erpnext/crm/doctype/campaign/campaign.js b/erpnext/crm/doctype/campaign/campaign.js
index 9e4a0a9..219e8cf 100644
--- a/erpnext/crm/doctype/campaign/campaign.js
+++ b/erpnext/crm/doctype/campaign/campaign.js
@@ -11,7 +11,7 @@
frappe.boot.sysdefaults.campaign_naming_by == "Naming Series"
);
} else {
- cur_frm.add_custom_button(
+ frm.add_custom_button(
__("View Leads"),
function () {
frappe.route_options = { source: "Campaign", campaign_name: frm.doc.name };
diff --git a/erpnext/crm/doctype/lead/lead.js b/erpnext/crm/doctype/lead/lead.js
index 609eab7..848d697 100644
--- a/erpnext/crm/doctype/lead/lead.js
+++ b/erpnext/crm/doctype/lead/lead.js
@@ -89,32 +89,33 @@
make_customer() {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.lead.lead.make_customer",
- frm: cur_frm,
+ frm: this.frm,
});
}
make_quotation() {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.lead.lead.make_quotation",
- frm: cur_frm,
+ frm: this.frm,
});
}
make_prospect() {
+ const me = this;
frappe.model.with_doctype("Prospect", function () {
let prospect = frappe.model.get_new_doc("Prospect");
- prospect.company_name = cur_frm.doc.company_name;
- prospect.no_of_employees = cur_frm.doc.no_of_employees;
- prospect.industry = cur_frm.doc.industry;
- prospect.market_segment = cur_frm.doc.market_segment;
- prospect.territory = cur_frm.doc.territory;
- prospect.fax = cur_frm.doc.fax;
- prospect.website = cur_frm.doc.website;
- prospect.prospect_owner = cur_frm.doc.lead_owner;
- prospect.notes = cur_frm.doc.notes;
+ prospect.company_name = me.frm.doc.company_name;
+ prospect.no_of_employees = me.frm.doc.no_of_employees;
+ prospect.industry = me.frm.doc.industry;
+ prospect.market_segment = me.frm.doc.market_segment;
+ prospect.territory = me.frm.doc.territory;
+ prospect.fax = me.frm.doc.fax;
+ prospect.website = me.frm.doc.website;
+ prospect.prospect_owner = me.frm.doc.lead_owner;
+ prospect.notes = me.frm.doc.notes;
let leads_row = frappe.model.add_child(prospect, "leads");
- leads_row.lead = cur_frm.doc.name;
+ leads_row.lead = me.frm.doc.name;
frappe.set_route("Form", "Prospect", prospect.name);
});
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 1c8a80a..c706357 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -318,14 +318,14 @@
create_quotation() {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_quotation",
- frm: cur_frm,
+ frm: this.frm,
});
}
make_customer() {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_customer",
- frm: cur_frm,
+ frm: this.frm,
});
}
diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js
index 8370cc6..10f0627 100644
--- a/erpnext/public/js/projects/timer.js
+++ b/erpnext/public/js/projects/timer.js
@@ -110,7 +110,7 @@
// Stop the timer and update the time logged by the timer on click of 'Complete' button
$btn_complete.click(function () {
- var grid_row = cur_frm.fields_dict["time_logs"].grid.get_row(row.idx - 1);
+ var grid_row = frm.fields_dict["time_logs"].grid.get_row(row.idx - 1);
var args = dialog.get_values();
grid_row.doc.completed = 1;
grid_row.doc.activity_type = args.activity_type;