| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/helpdesk/__pycache__/ |
Upload File : |
o
hͦh% � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl
mZ ddlm
Z
dd lmZ dd
lmZ ddlmZ e�e�ZG dd
� d
e�ZG dd� de�ZG dd� de�ZdS )z>
threading.py
This module is used handle mail sent in thread
� N)�Thread)�settings)�messages)�EmailMessage)�render_to_string)�ConfiguredEmailBackend)�
Department)�EmployeeWorkInformation)�Ticketc s4 e Zd ZdZdd� Zddd�Zd� fd d
�Z� ZS )
�TicketSendThread�
MailSend
c C s� t �| � || _|| _|| _|j�� | _|�� | _ |�
� rdnd| _|�� }t
|t�r@|j�� r;|j�� �� j| _d S d | _d S d S �N�https�http)r �__init__�ticket�type�request�assigned_to�all� assignees�get_host�host� is_secure�protocol�get_raised_on_object�
isinstancer �dept_manager�first�manager�department_manager)�selfr r r � raised_on� r# �"/var/www/erp/helpdesk/threading.pyr s
�zTicketSendThread.__init__�#c
C s� t jdtt j�d � }d}d}t� }|j} | jr6z| jjj�� � d| jjjj � d�}
W n t
�t� Y |dkrE|� d|� d|� d �}|D ]4}t
d
||||||d��}t||| |j g|
gd�}
d
|
_z|
�� W qG t�| jd|�� � �� Y qGd S )Nr � r r% � <�>�://�/helpdesk/ticket-detail/�/�(helpdesk/mail_templates/ticket_mail.html��link�instancer r �subject�content�r0 �body�
from_email�to�reply_to�html�Mail not sent to )r �BASE_URL�lenr �$dynamic_from_email_with_display_namer �user�employee_get�
get_full_name�email�logger�error� Exceptionr r �content_subtype�sendr )r! r0 r1 �
recipients� ticket_idr r r. �
email_backend�display_email_name�reply_email_name� recipient�html_messager? r# r# r$ �
send_email+ sL &�����zTicketSendThread.send_email�returnNc sH t � �� | jdkr6| jj}t| j�}d|� d�}d}| �|||| jj� d}d}| �|||g| jj� d S | jdkr�| j}| jj}| j� � }|d d } |d d
d d }
|d d
d d }d
}d| � d|� d|
� d�}
| �||
t
|�|hB | jj� d S | jdkr�| j}| jj}d}d| jj� d�}
| �||
t
|�|hB � d S )N�createa This is to inform you that a ticket has been raised on your department. Take the necessary actions to address the issue or request outlined in the ticket. Should you have any additional information or updates, please feel free to communicate directly with the �.z(Ticket created raised on your departmentaX This is to inform you that the ticket you created has been successfully logged into our system. The assigned team/individual will now take the necessary actions to address the issue or request outlined in the ticket. Should you have any additional information or updates, please feel free to communicate directly with the Support/Helpdesk team.zTicket created successfully�
status_changer �
updated_by�changes�new�oldz)The Status of the Ticket has been updatedzRThis is to inform you that the status of the following ticket has been updated by z from z to zp. If you have any questions or require further information, feel free to reach out to the Support/Helpdesk team.�deletezThe Ticket has been deletedz'This is to inform you that the Ticket "z�" has been deleted. If you have any questions or require further information, feel free to reach out to the Support/Helpdesk team.)�super�runr r �employee_id�listr rL �id�tracking�set�title)r! �ownerr �content_manager�subject_manager�
content_owner�
subject_ownerr r[ rQ �
new_status�
old_statusr0 r1 �� __class__r# r$ rW V s>