@@ -75,7 +75,7 @@ def after_insert(self):
75
75
capture_event ("ticket_created" )
76
76
publish_event ("helpdesk:new-ticket" , {"name" : self .name })
77
77
if self .get ("description" ):
78
- self .create_communication_via_contact (self .description )
78
+ self .create_communication_via_contact (self .description , new_ticket = True )
79
79
80
80
def on_update (self ):
81
81
# flake8: noqa
@@ -519,7 +519,13 @@ def reply_via_agent(
519
519
520
520
@frappe .whitelist ()
521
521
# flake8: noqa
522
- def create_communication_via_contact (self , message , attachments = []):
522
+ def create_communication_via_contact (
523
+ self , message , attachments = [], new_ticket = False
524
+ ):
525
+
526
+ if not new_ticket :
527
+ # send email to assigned agents
528
+ self .send_reopen_email_to_agent (message )
523
529
524
530
if self .status == "Replied" :
525
531
self .status = "Open"
@@ -541,9 +547,6 @@ def create_communication_via_contact(self, message, attachments=[]):
541
547
c .ignore_mandatory = True
542
548
c .save (ignore_permissions = True )
543
549
544
- # send email to assigned agents
545
- self .send_email_to_agent (message )
546
-
547
550
_attachments = self .get ("attachments" ) or attachments or []
548
551
if not len (_attachments ):
549
552
return
@@ -560,7 +563,7 @@ def create_communication_via_contact(self, message, attachments=[]):
560
563
for url in file_urls :
561
564
self .attach_file_with_doc ("HD Ticket" , self .name , url )
562
565
563
- def send_email_to_agent (self , message ):
566
+ def send_reopen_email_to_agent (self , message ):
564
567
assigned_agents = self .get_assigned_agents ()
565
568
if not assigned_agents :
566
569
return
0 commit comments