PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.3.13
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.3.13
1.17.10 1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 All 144 releases
erp / modules / hrm / includes / emails / class-email-rejected-leave-request.php

class-email-rejected-leave-request.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.3.13, at modules/hrm/includes/emails/class-email-rejected-leave-request.php

72 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WeDevs\ERP\HRM\Emails;
3
4 use WeDevs\ERP\Email;
5 use WeDevs\ERP\Framework\Traits\Hooker;
6
7 /**
8 * Rejected Leave Request
9 */
10 class Rejected_Leave_Request extends Email {
11
12 use Hooker;
13
14 function __construct() {
15 $this->id = 'rejected-leave-request';
16 $this->title = __( 'Rejected Leave Request', 'erp' );
17 $this->description = __( 'Rejected leave request notification to employee.', 'erp' );
18
19 $this->subject = __( 'Your leave request has been rejected', 'erp');
20 $this->heading = __( 'Leave Request Rejected', 'erp');
21
22 $this->find = [
23 'full-name' => '{employee_name}',
24 'leave_type' => '{leave_type}',
25 'date_from' => '{date_from}',
26 'date_to' => '{date_to}',
27 'no_days' => '{no_days}',
28 'reason' => '{reject_reason}',
29 ];
30
31 $this->action( 'erp_admin_field_' . $this->id . '_help_texts', 'replace_keys' );
32
33 parent::__construct();
34 }
35
36 function get_args() {
37 return [
38 'email_heading' => $this->heading,
39 'email_body' => wpautop( $this->get_option( 'body' ) ),
40 ];
41 }
42
43 public function trigger( $request_id = null ) {
44 $request = erp_hr_get_leave_request( $request_id );
45
46 if ( ! $request ) {
47 return;
48 }
49
50 $employee = new \WeDevs\ERP\HRM\Employee( intval( $request->user_id ) );
51
52 $this->recipient = $employee->user_email;
53 $this->heading = $this->get_option( 'heading', $this->heading );
54 $this->subject = $this->get_option( 'subject', $this->subject );
55
56 $this->replace = [
57 'full-name' => $request->display_name,
58 'leave_type' => $request->policy_name,
59 'date_from' => erp_format_date( $request->start_date ),
60 'date_to' => erp_format_date( $request->end_date ),
61 'no_days' => $request->days,
62 'reason' => $request->comments,
63 ];
64
65 if ( ! $this->get_recipient() ) {
66 return;
67 }
68
69 $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
70 }
71 }
72