fix: rename Twilio Settings to CRM Twilio Settings in code
This commit is contained in:
parent
97b67cfed5
commit
e7c89fdc2a
@ -40,14 +40,16 @@ class CRMTwilioSettings(Document):
|
||||
self.api_key = new_key.sid
|
||||
self.api_secret = new_key.secret
|
||||
frappe.db.set_value(
|
||||
"Twilio Settings", "Twilio Settings", {"api_key": self.api_key, "api_secret": self.api_secret}
|
||||
"CRM Twilio Settings",
|
||||
"CRM Twilio Settings",
|
||||
{"api_key": self.api_key, "api_secret": self.api_secret},
|
||||
)
|
||||
|
||||
def set_application_credentials(self, twilio):
|
||||
"""Generate TwiML app credentials if not exist and update them."""
|
||||
credentials = self.get_application(twilio) or self.create_application(twilio)
|
||||
self.twiml_sid = credentials.sid
|
||||
frappe.db.set_value("Twilio Settings", "Twilio Settings", "twiml_sid", self.twiml_sid)
|
||||
frappe.db.set_value("CRM Twilio Settings", "CRM Twilio Settings", "twiml_sid", self.twiml_sid)
|
||||
|
||||
def create_api_key(self, twilio):
|
||||
"""Create API keys in twilio account."""
|
||||
|
||||
@ -7,7 +7,7 @@ from crm.utils import are_same_phone_number, parse_phone_number
|
||||
|
||||
@frappe.whitelist()
|
||||
def is_call_integration_enabled():
|
||||
twilio_enabled = frappe.db.get_single_value("Twilio Settings", "enabled")
|
||||
twilio_enabled = frappe.db.get_single_value("CRM Twilio Settings", "enabled")
|
||||
exotel_enabled = frappe.db.get_single_value("CRM Exotel Settings", "enabled")
|
||||
|
||||
return {
|
||||
|
||||
@ -11,7 +11,7 @@ from .twilio_handler import IncomingCall, Twilio, TwilioCallDetails
|
||||
|
||||
@frappe.whitelist()
|
||||
def is_enabled():
|
||||
return frappe.db.get_single_value("Twilio Settings", "enabled")
|
||||
return frappe.db.get_single_value("CRM Twilio Settings", "enabled")
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
@ -14,7 +14,7 @@ class Twilio:
|
||||
|
||||
def __init__(self, settings):
|
||||
"""
|
||||
:param settings: `Twilio Settings` doctype
|
||||
:param settings: `CRM Twilio Settings` doctype
|
||||
"""
|
||||
self.settings = settings
|
||||
self.account_sid = settings.account_sid
|
||||
@ -26,7 +26,7 @@ class Twilio:
|
||||
@classmethod
|
||||
def connect(self):
|
||||
"""Make a twilio connection."""
|
||||
settings = frappe.get_doc("Twilio Settings")
|
||||
settings = frappe.get_doc("CRM Twilio Settings")
|
||||
if not (settings and settings.enabled):
|
||||
return
|
||||
return Twilio(settings=settings)
|
||||
@ -114,11 +114,11 @@ class Twilio:
|
||||
|
||||
@classmethod
|
||||
def get_twilio_client(self):
|
||||
twilio_settings = frappe.get_doc("Twilio Settings")
|
||||
twilio_settings = frappe.get_doc("CRM Twilio Settings")
|
||||
if not twilio_settings.enabled:
|
||||
frappe.throw(_("Please enable twilio settings before making a call."))
|
||||
|
||||
auth_token = get_decrypted_password("Twilio Settings", "Twilio Settings", "auth_token")
|
||||
auth_token = get_decrypted_password("CRM Twilio Settings", "CRM Twilio Settings", "auth_token")
|
||||
client = TwilioClient(twilio_settings.account_sid, auth_token)
|
||||
|
||||
return client
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
v-if="twilio?.doc && twilioTabs"
|
||||
:tabs="twilioTabs"
|
||||
:data="twilio.doc"
|
||||
doctype="Twilio Settings"
|
||||
doctype="CRM Twilio Settings"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -94,9 +94,9 @@ const { isManager, isAgent } = usersStore()
|
||||
|
||||
const twilioFields = createResource({
|
||||
url: 'crm.api.doc.get_fields',
|
||||
cache: ['fields', 'Twilio Settings'],
|
||||
cache: ['fields', 'CRM Twilio Settings'],
|
||||
params: {
|
||||
doctype: 'Twilio Settings',
|
||||
doctype: 'CRM Twilio Settings',
|
||||
allow_all_fieldtypes: true,
|
||||
},
|
||||
auto: true,
|
||||
@ -113,8 +113,8 @@ const exotelFields = createResource({
|
||||
})
|
||||
|
||||
const twilio = createDocumentResource({
|
||||
doctype: 'Twilio Settings',
|
||||
name: 'Twilio Settings',
|
||||
doctype: 'CRM Twilio Settings',
|
||||
name: 'CRM Twilio Settings',
|
||||
fields: ['*'],
|
||||
auto: true,
|
||||
setValue: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user