@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | unset($argv[1]); |
23 | 23 | // $argv = array_merge($argv, $config["argv"][$path]); |
24 | 24 | $argv[0] = $argv[0]; |
25 | - $argv[1] =$config["argv"][$path]; |
|
25 | + $argv[1] = $config["argv"][$path]; |
|
26 | 26 | $_SERVER['argv'] = $argv; |
27 | 27 | } else |
28 | 28 | die('Use: php cron.php controller/method'); |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | ob_start(); |
42 | 42 | |
43 | 43 | // chdir( dirname( CRON_CI_INDEX ) ); |
44 | -require( CRON_CI_INDEX ); // main CI index.php file |
|
44 | +require(CRON_CI_INDEX); // main CI index.php file |
|
45 | 45 | $output = ob_get_contents(); |
46 | 46 | |
47 | 47 | if (CRON_FLUSH_BUFFERS === TRUE) |
48 | - while (@ob_end_flush()); // display buffer contents |
|
48 | + while (@ob_end_flush()); // display buffer contents |
|
49 | 49 | else |
50 | 50 | ob_end_clean(); |
51 | 51 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | function __construct() |
42 | 42 | { |
43 | 43 | parent::__construct(); |
44 | - if(!defined( 'CRON' ) ) |
|
44 | + if ( ! defined('CRON')) |
|
45 | 45 | exit(); |
46 | 46 | } |
47 | 47 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | function generate_sitemap() |
77 | 77 | { |
78 | 78 | // Live Mode: |
79 | - if( ! CRON_BETA_MODE ) |
|
79 | + if ( ! CRON_BETA_MODE) |
|
80 | 80 | $cron_id = $this->cron->create('Sitemap (Google|Bing|Ask|Yahoo!)'); |
81 | 81 | |
82 | 82 | // Example Code |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // ... |
90 | 90 | |
91 | 91 | // Sandbox Mode: |
92 | - if( CRON_BETA_MODE ) |
|
92 | + if (CRON_BETA_MODE) |
|
93 | 93 | $this->sitemap->generate_xml(null, false); |
94 | 94 | |
95 | 95 | // Live Mode: |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | echo 'live'; |
98 | 98 | |
99 | 99 | $this->sitemap->generate_xml(); |
100 | - $this->cron->update( $cron_id ); |
|
100 | + $this->cron->update($cron_id); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | } |
@@ -25,21 +25,21 @@ |
||
25 | 25 | function __construct() |
26 | 26 | { |
27 | 27 | parent::__construct(); |
28 | - if(!defined( 'CRON' ) ) |
|
28 | + if ( ! defined('CRON')) |
|
29 | 29 | exit(); |
30 | 30 | $this->load->model("db_model"); |
31 | 31 | $this->load->library("astpp/email_lib"); |
32 | 32 | } |
33 | - function broadcast_email(){ |
|
33 | + function broadcast_email() { |
|
34 | 34 | |
35 | 35 | $where = array("status"=>"1"); |
36 | 36 | $query = $this->db_model->getSelect("*", "mail_details", $where); |
37 | - if($query->num_rows >0){ |
|
37 | + if ($query->num_rows > 0) { |
|
38 | 38 | $account_data = $query->result_array(); |
39 | - foreach($account_data as $data_key =>$account_value){ |
|
40 | - $account_value['history_id']=$account_value['id']; |
|
39 | + foreach ($account_data as $data_key =>$account_value) { |
|
40 | + $account_value['history_id'] = $account_value['id']; |
|
41 | 41 | unset($account_value['id']); |
42 | - $this->email_lib->send_email('',$account_value,'',$account_value['attachment'],1,0,1); |
|
42 | + $this->email_lib->send_email('', $account_value, '', $account_value['attachment'], 1, 0, 1); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -31,11 +31,11 @@ |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | - function customer_list_status($id){ |
|
34 | + function customer_list_status($id) { |
|
35 | 35 | $post_data = $this->input->post(); |
36 | - $post_data['table']=$this->common->decode($post_data['table']); |
|
37 | - $data['status']=$post_data['status'] =='true'? 0:1; |
|
38 | - $result=$post_data['table'] =='accounts' && $post_data['id'] == 1 ? null:$this->db->update($post_data['table'],$data,array("id"=>$post_data['id'])); |
|
36 | + $post_data['table'] = $this->common->decode($post_data['table']); |
|
37 | + $data['status'] = $post_data['status'] == 'true' ? 0 : 1; |
|
38 | + $result = $post_data['table'] == 'accounts' && $post_data['id'] == 1 ? null : $this->db->update($post_data['table'], $data, array("id"=>$post_data['id'])); |
|
39 | 39 | echo TRUE; |
40 | 40 | } |
41 | 41 |
@@ -28,59 +28,59 @@ discard block |
||
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
31 | - function index(){ |
|
31 | + function index() { |
|
32 | 32 | $data['account_info'] = $this->session->userdata['accountinfo']; |
33 | 33 | $data['username'] = $this->session->userdata('user_name'); |
34 | 34 | $data['page_title'] = "Feedback"; |
35 | - $this->load->view('view_feedback',$data); |
|
35 | + $this->load->view('view_feedback', $data); |
|
36 | 36 | } |
37 | - function customer_feedback_result($flag=FALSE){ |
|
38 | - if($flag){ |
|
37 | + function customer_feedback_result($flag = FALSE) { |
|
38 | + if ($flag) { |
|
39 | 39 | $account_info = array(); |
40 | - $this->db->where("accountid","1"); |
|
40 | + $this->db->where("accountid", "1"); |
|
41 | 41 | $res = $this->db->get('invoice_conf'); |
42 | - if($res->num_rows > 0){ |
|
42 | + if ($res->num_rows > 0) { |
|
43 | 43 | $masterdata = $res->result_array(); |
44 | 44 | $account_info = $masterdata['0']; |
45 | 45 | |
46 | - $company_name=$account_info['company_name']; |
|
47 | - $address=$account_info['address']; |
|
48 | - $city=$account_info['city']; |
|
49 | - $province=$account_info['province']; |
|
50 | - $country=$account_info['country']; |
|
51 | - $zipcode=$account_info['zipcode']; |
|
52 | - $telephone=$account_info['telephone']; |
|
53 | - $fax=$account_info['fax']; |
|
54 | - $emailaddress=$account_info['emailaddress']; |
|
55 | - $website=$account_info['website']; |
|
46 | + $company_name = $account_info['company_name']; |
|
47 | + $address = $account_info['address']; |
|
48 | + $city = $account_info['city']; |
|
49 | + $province = $account_info['province']; |
|
50 | + $country = $account_info['country']; |
|
51 | + $zipcode = $account_info['zipcode']; |
|
52 | + $telephone = $account_info['telephone']; |
|
53 | + $fax = $account_info['fax']; |
|
54 | + $emailaddress = $account_info['emailaddress']; |
|
55 | + $website = $account_info['website']; |
|
56 | 56 | |
57 | - $data=array("name"=>"Admin","company_name"=>$company_name,"address"=>$address,"city"=>$city,"province"=>$province,"country"=>$country,"zipcode"=>$zipcode,"telephone"=>$telephone,"fax"=>$fax,"emailaddress"=>$emailaddress,"website"=>$website,"serverip"=>$_SERVER['SERVER_NAME'],"FLAG"=>"TRUE"); |
|
57 | + $data = array("name"=>"Admin", "company_name"=>$company_name, "address"=>$address, "city"=>$city, "province"=>$province, "country"=>$country, "zipcode"=>$zipcode, "telephone"=>$telephone, "fax"=>$fax, "emailaddress"=>$emailaddress, "website"=>$website, "serverip"=>$_SERVER['SERVER_NAME'], "FLAG"=>"TRUE"); |
|
58 | 58 | } |
59 | - }else{ |
|
59 | + } else { |
|
60 | 60 | $account_info = array(); |
61 | - $this->db->where("type","-1"); |
|
61 | + $this->db->where("type", "-1"); |
|
62 | 62 | $res = $this->db->get('accounts'); |
63 | - if($res->num_rows > 0){ |
|
63 | + if ($res->num_rows > 0) { |
|
64 | 64 | $masterdata = $res->result_array(); |
65 | 65 | $account_info = $masterdata['0']; |
66 | 66 | |
67 | - $name=$_REQUEST['name']="Admin"; |
|
68 | - $email=$_REQUEST['email']=$account_info['email']; |
|
69 | - $feedback=$_REQUEST['feedback']; |
|
70 | - $first_name=$account_info['first_name']; |
|
71 | - $last_name=$account_info['last_name']; |
|
72 | - $city=$account_info['city']; |
|
73 | - $telephone_1=$account_info['telephone_1']; |
|
74 | - $account_email=$account_info['email']; |
|
75 | - $company_name=$account_info['company_name']; |
|
76 | - $address_1=$account_info['address_1']; |
|
77 | - $address_2=$account_info['address_2']; |
|
78 | - $telephone_2=$account_info['telephone_2']; |
|
79 | - $province=$account_info['province']; |
|
67 | + $name = $_REQUEST['name'] = "Admin"; |
|
68 | + $email = $_REQUEST['email'] = $account_info['email']; |
|
69 | + $feedback = $_REQUEST['feedback']; |
|
70 | + $first_name = $account_info['first_name']; |
|
71 | + $last_name = $account_info['last_name']; |
|
72 | + $city = $account_info['city']; |
|
73 | + $telephone_1 = $account_info['telephone_1']; |
|
74 | + $account_email = $account_info['email']; |
|
75 | + $company_name = $account_info['company_name']; |
|
76 | + $address_1 = $account_info['address_1']; |
|
77 | + $address_2 = $account_info['address_2']; |
|
78 | + $telephone_2 = $account_info['telephone_2']; |
|
79 | + $province = $account_info['province']; |
|
80 | 80 | |
81 | - $data=array("name"=>$name,"email"=>$email,"feedback"=>$feedback,"first_name"=>$first_name,"last_name"=>$last_name,"city"=>$city,"telephone_1"=>$telephone_1,"account_email"=>$account_email,"company_name"=>$company_name,"address_1"=>$address_1,"address_2"=>$address_2,"telephone_2"=>$telephone_2,"province"=>$province,"serverip"=>$_SERVER['SERVER_ADDR'],"FLAG"=>"FALSE"); |
|
81 | + $data = array("name"=>$name, "email"=>$email, "feedback"=>$feedback, "first_name"=>$first_name, "last_name"=>$last_name, "city"=>$city, "telephone_1"=>$telephone_1, "account_email"=>$account_email, "company_name"=>$company_name, "address_1"=>$address_1, "address_2"=>$address_2, "telephone_2"=>$telephone_2, "province"=>$province, "serverip"=>$_SERVER['SERVER_ADDR'], "FLAG"=>"FALSE"); |
|
82 | 82 | |
83 | - $data_new= json_encode($data); |
|
83 | + $data_new = json_encode($data); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | $ch = curl_init(); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
97 | 97 | |
98 | 98 | $response = curl_exec($ch); |
99 | - if(!$flag) |
|
100 | - redirect(base_url() . 'feedback/thanks'); |
|
99 | + if ( ! $flag) |
|
100 | + redirect(base_url().'feedback/thanks'); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | } |
104 | - function thanks(){ |
|
104 | + function thanks() { |
|
105 | 105 | $this->load->view('view_feedback_response'); |
106 | 106 | } |
107 | 107 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | // Check Charge is applied that is for first time or already calculated before |
52 | 52 | |
53 | - $where = "(charge_upto ='0000-00-00 00:00:00' OR charge_upto <='" . gmdate("Y-m-d H:i:s") . "')"; |
|
53 | + $where = "(charge_upto ='0000-00-00 00:00:00' OR charge_upto <='".gmdate("Y-m-d H:i:s")."')"; |
|
54 | 54 | $this->db->where('accountid', $accountinfo['id']); |
55 | 55 | $this->db->where($where); |
56 | 56 | $this->db->select('*'); |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | foreach ($accountchargs as $accharges) { |
62 | 62 | //Get information from database of active charges. |
63 | 63 | $charge_data = $this->get_table_data("*", "charges", array("id" => $accharges['charge_id'], "status" => "0")); |
64 | - if ($charge_data && !empty($charge_data)) { |
|
64 | + if ($charge_data && ! empty($charge_data)) { |
|
65 | 65 | $charge_data = $charge_data[0]; |
66 | 66 | //Get Start Date of Charge |
67 | 67 | $charge_upto = ($accharges["charge_upto"] != "0000-00-00 00:00:00" && $accharges["charge_upto"] != "") ? |
68 | - date("Y-m-d H:i:s", strtotime("+1 Second", strtotime($accharges["charge_upto"]))) :$accharges["assign_date"]; |
|
69 | - if($accountinfo['original_sweep_id'] == 2 && $charge_data['pro_rate'] == 0 && $charge_data['sweep_id'] == 2 && ($accountinfo['invoice_day']< gmdate("d",strtotime($accharges['assign_date'])))) { |
|
70 | - $charge_upto= date("Y-m-" . $accountinfo['invoice_day'] . " H:i:s", strtotime($accharges["assign_date"])); |
|
68 | + date("Y-m-d H:i:s", strtotime("+1 Second", strtotime($accharges["charge_upto"]))) : $accharges["assign_date"]; |
|
69 | + if ($accountinfo['original_sweep_id'] == 2 && $charge_data['pro_rate'] == 0 && $charge_data['sweep_id'] == 2 && ($accountinfo['invoice_day'] < gmdate("d", strtotime($accharges['assign_date'])))) { |
|
70 | + $charge_upto = date("Y-m-".$accountinfo['invoice_day']." H:i:s", strtotime($accharges["assign_date"])); |
|
71 | 71 | } |
72 | 72 | //Overwrite Billing scehdule of customer assign proper charge |
73 | 73 | if ($accountinfo['sweep_id'] != $charge_data['sweep_id']) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
135 | 135 | if ($lastdate) |
136 | 136 | $this->db->update("reseller_pricing", array("charge_upto" => $lastdate), array("note" => $did_value["number"], "reseller_id" => $reseller_acc_data["id"])); |
137 | - }else { |
|
137 | + } else { |
|
138 | 138 | //Apply charges to Resellers. |
139 | 139 | $lastdate = $this->calculate_charges($reseller_acc_data, $itemArr, $reseller_dids["monthlycost"], $fromdate, $todate, "1"); |
140 | 140 | if ($lastdate) |
@@ -156,39 +156,39 @@ discard block |
||
156 | 156 | function calculate_charges($AccountDATA, $itemArr, $charge, $fromdate, $todate, $pro_rate = "1") { |
157 | 157 | $lastdate = false; |
158 | 158 | $billing_cycle = ($AccountDATA['sweep_id'] == "0") ? "1 day" : "1 month"; |
159 | - $last_invoice_date = $this->common->get_invoice_date("invoice_date",$AccountDATA['id'],$AccountDATA['reseller_id']); |
|
159 | + $last_invoice_date = $this->common->get_invoice_date("invoice_date", $AccountDATA['id'], $AccountDATA['reseller_id']); |
|
160 | 160 | //Below variable gives date based on assign or creation or monthly user billing day |
161 | - $last_invoice_date = ($last_invoice_date) ? $last_invoice_date : (($pro_rate == 0 && $AccountDATA['original_sweep_id'] == 2 && ($AccountDATA['invoice_day']< gmdate("d",strtotime($itemArr['assign_date'])))) ? date("Y-m-" . $AccountDATA['invoice_day'] . " 00:00:00") : (($pro_rate == 1 && $AccountDATA['original_sweep_id'] == 0) ? date("Y-m-d 00:00:00", strtotime($itemArr['assign_date'])) : date("Y-m-d 00:00:00", strtotime($AccountDATA['creation'])))); |
|
161 | + $last_invoice_date = ($last_invoice_date) ? $last_invoice_date : (($pro_rate == 0 && $AccountDATA['original_sweep_id'] == 2 && ($AccountDATA['invoice_day'] < gmdate("d", strtotime($itemArr['assign_date'])))) ? date("Y-m-".$AccountDATA['invoice_day']." 00:00:00") : (($pro_rate == 1 && $AccountDATA['original_sweep_id'] == 0) ? date("Y-m-d 00:00:00", strtotime($itemArr['assign_date'])) : date("Y-m-d 00:00:00", strtotime($AccountDATA['creation'])))); |
|
162 | 162 | $last_invoice_date = ($last_invoice_date <= $fromdate) ? $last_invoice_date : $fromdate; |
163 | 163 | $Charges_date_range = array(); |
164 | - $prorate_array =array(); |
|
164 | + $prorate_array = array(); |
|
165 | 165 | $daylen = 60 * 60 * 24; |
166 | 166 | /*Get assign day and billing day for postpaid monthly user. |
167 | 167 | */ |
168 | - $assign_day=($AccountDATA['original_sweep_id']==2 && $AccountDATA['posttoexternal']==1) ? gmdate("d",strtotime($itemArr['assign_date'])):0; |
|
169 | - $billing_day=($AccountDATA['original_sweep_id']==2 && $AccountDATA['posttoexternal']==1) ? $AccountDATA['invoice_day']:0; |
|
168 | + $assign_day = ($AccountDATA['original_sweep_id'] == 2 && $AccountDATA['posttoexternal'] == 1) ? gmdate("d", strtotime($itemArr['assign_date'])) : 0; |
|
169 | + $billing_day = ($AccountDATA['original_sweep_id'] == 2 && $AccountDATA['posttoexternal'] == 1) ? $AccountDATA['invoice_day'] : 0; |
|
170 | 170 | //Create an array if charge not applied yet and invoice day is greater than assign_day |
171 | - if($itemArr['charge_upto'] == "0000-00-00 00:00:00" && ($billing_day > $assign_day) && $pro_rate==0 && $itemArr['cycle']==2 && $AccountDATA['original_sweep_id']==2){ |
|
172 | - $last_invoice_date = gmdate("Y-m-d H:i:s",strtotime("-1 second",strtotime(date("Y-m-" . $AccountDATA['invoice_day'] . " 00:00:00", strtotime($itemArr["assign_date"]))))); |
|
173 | - $prorate_array[] = array("start_date" => date("Y-m-d H:i:s",strtotime($itemArr['assign_date'])), "end_date" => $last_invoice_date); |
|
171 | + if ($itemArr['charge_upto'] == "0000-00-00 00:00:00" && ($billing_day > $assign_day) && $pro_rate == 0 && $itemArr['cycle'] == 2 && $AccountDATA['original_sweep_id'] == 2) { |
|
172 | + $last_invoice_date = gmdate("Y-m-d H:i:s", strtotime("-1 second", strtotime(date("Y-m-".$AccountDATA['invoice_day']." 00:00:00", strtotime($itemArr["assign_date"]))))); |
|
173 | + $prorate_array[] = array("start_date" => date("Y-m-d H:i:s", strtotime($itemArr['assign_date'])), "end_date" => $last_invoice_date); |
|
174 | 174 | |
175 | 175 | } |
176 | 176 | while (strtotime($last_invoice_date) <= strtotime($todate)) { |
177 | - $startdate=$last_invoice_date; |
|
178 | - $last_invoice_date = gmdate("Y-m-d H:i:s", strtotime("+" . $billing_cycle, strtotime($last_invoice_date))); |
|
179 | - $Charges_date_range[] = array("start_date" =>gmdate("Y-m-d H:i:s",strtotime("+1 Second",strtotime($startdate))), "end_date" => $last_invoice_date); |
|
177 | + $startdate = $last_invoice_date; |
|
178 | + $last_invoice_date = gmdate("Y-m-d H:i:s", strtotime("+".$billing_cycle, strtotime($last_invoice_date))); |
|
179 | + $Charges_date_range[] = array("start_date" =>gmdate("Y-m-d H:i:s", strtotime("+1 Second", strtotime($startdate))), "end_date" => $last_invoice_date); |
|
180 | 180 | } |
181 | - if(!empty($prorate_array)){ |
|
181 | + if ( ! empty($prorate_array)) { |
|
182 | 182 | array_pop($Charges_date_range); |
183 | - $Charges_date_range=array_merge($prorate_array,$Charges_date_range); |
|
183 | + $Charges_date_range = array_merge($prorate_array, $Charges_date_range); |
|
184 | 184 | } |
185 | - if (!empty($Charges_date_range)) { |
|
185 | + if ( ! empty($Charges_date_range)) { |
|
186 | 186 | foreach ($Charges_date_range as $ChargeVal) { |
187 | - if (($pro_rate == 0 && $itemArr['cycle'] != 2) || (($billing_day <= $assign_day) && $pro_rate==0 && $itemArr['cycle']==2 && $AccountDATA['original_sweep_id']==2)) { |
|
187 | + if (($pro_rate == 0 && $itemArr['cycle'] != 2) || (($billing_day <= $assign_day) && $pro_rate == 0 && $itemArr['cycle'] == 2 && $AccountDATA['original_sweep_id'] == 2)) { |
|
188 | 188 | $ChargeVal['end_date'] = gmdate("Y-m-d 23:59:59", strtotime("-1 Day", strtotime($ChargeVal['end_date']))); |
189 | 189 | } |
190 | - if (!empty($itemArr['charge_upto']) && empty($lastdate)) { |
|
191 | - $start_date = ($itemArr['charge_upto'] == '0000-00-00 00:00:00' && $AccountDATA['sweep_id'] == 2 ) ? $itemArr['assign_date'] : $ChargeVal['start_date']; |
|
190 | + if ( ! empty($itemArr['charge_upto']) && empty($lastdate)) { |
|
191 | + $start_date = ($itemArr['charge_upto'] == '0000-00-00 00:00:00' && $AccountDATA['sweep_id'] == 2) ? $itemArr['assign_date'] : $ChargeVal['start_date']; |
|
192 | 192 | } else { |
193 | 193 | $start_date = (empty($lastdate)) ? $ChargeVal['start_date'] : gmdate("Y-m-d H:i:s", strtotime("+1 second", strtotime($lastdate))); |
194 | 194 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | $Bal = "0.00"; |
223 | 223 | if ($AccountData["posttoexternal"] == 0) { |
224 | 224 | $reseller_id = $AccountData['type'] == 1 ? $AccountData['id'] : 0; |
225 | - $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
225 | + $where = "accountid IN ('".$reseller_id."','1')"; |
|
226 | 226 | $this->db->where($where); |
227 | 227 | $this->db->select('*'); |
228 | 228 | $this->db->order_by('accountid', 'desc'); |
229 | 229 | $this->db->limit(1); |
230 | 230 | $invoiceconf = $this->db->get('invoice_conf'); |
231 | - $invoice_conf = (array) $invoiceconf->first_row(); |
|
231 | + $invoice_conf = (array)$invoiceconf->first_row(); |
|
232 | 232 | $last_invoiceid = $this->common->get_invoice_date('invoiceid', '', $AccountData['reseller_id']); |
233 | 233 | if ($last_invoiceid && $last_invoiceid > 0) { |
234 | 234 | $last_invoiceid = ($last_invoiceid + 1); |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | $last_invoiceid = str_pad($last_invoiceid, (strlen($last_invoiceid) + 4), '0', STR_PAD_LEFT); |
239 | 239 | $invoice_prefix = $invoice_conf['invoice_prefix']; |
240 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoice_conf['interval'] . " days")); |
|
240 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoice_conf['interval']." days")); |
|
241 | 241 | |
242 | 242 | $invoiceid = $this->common_model->generate_receipt($AccountData["id"], $charge, $AccountData, $last_invoiceid, $invoice_prefix, $due_date); |
243 | - $this->db->set('balance', 'balance-' . $charge, FALSE); |
|
243 | + $this->db->set('balance', 'balance-'.$charge, FALSE); |
|
244 | 244 | $this->db->where('id', $AccountData["id"]); |
245 | 245 | $this->db->update("accounts"); |
246 | 246 | $AccountData['balance'] = ($AccountData['balance'] - $charge); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | $invoice_item_arr = array("accountid" => $AccountData["id"], |
257 | 257 | "reseller_id" => $AccountData["reseller_id"], |
258 | - "description" => trim($description . "-" . $fromdate . " to " . $todate), |
|
258 | + "description" => trim($description."-".$fromdate." to ".$todate), |
|
259 | 259 | "item_id" => $item_id, "debit" => $charge, "invoiceid" => $invoiceid, |
260 | 260 | "created_date" => trim($invoicedate), |
261 | 261 | "item_type" => $type |
@@ -31,88 +31,88 @@ |
||
31 | 31 | $this->load->model('db_model'); |
32 | 32 | $this->load->model('Astpp_common'); |
33 | 33 | } |
34 | - function index($sipnumber=''){ |
|
35 | - $opensips_flag=common_model::$global_config['system_config']['opensips']; |
|
36 | - $accountid_arr=0; |
|
37 | - if($opensips_flag == '1'){ |
|
38 | - $where=array('username'=>$sipnumber); |
|
39 | - $accountid_arr=$this->db_model->getSelect('accountid','sip_devices',$where); |
|
34 | + function index($sipnumber = '') { |
|
35 | + $opensips_flag = common_model::$global_config['system_config']['opensips']; |
|
36 | + $accountid_arr = 0; |
|
37 | + if ($opensips_flag == '1') { |
|
38 | + $where = array('username'=>$sipnumber); |
|
39 | + $accountid_arr = $this->db_model->getSelect('accountid', 'sip_devices', $where); |
|
40 | 40 | } |
41 | - else{ |
|
41 | + else { |
|
42 | 42 | $db_config = Common_model::$global_config['system_config']; |
43 | - $opensipdsn = "mysql://" . $db_config['opensips_dbuser'] . ":" . $db_config['opensips_dbpass'] . "@" . $db_config['opensips_dbhost'] . "/" . $db_config['opensips_dbname'] . "?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
43 | + $opensipdsn = "mysql://".$db_config['opensips_dbuser'].":".$db_config['opensips_dbpass']."@".$db_config['opensips_dbhost']."/".$db_config['opensips_dbname']."?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir="; |
|
44 | 44 | $this->opensips_db = $this->load->database($opensipdsn, true); |
45 | 45 | $this->opensips_db->where(array("username"=>$sipnumber)); |
46 | - $accountnum_arr=$this->opensips_db->get("subscriber"); |
|
47 | - $accountnum_arr=$accountnum_arr->result_array(); |
|
48 | - foreach($accountnum_arr as $value_num){ |
|
49 | - $accountid_arr = $this->db_model->getSelect('id','accounts',array('number'=>$value_num['accountcode'])); |
|
46 | + $accountnum_arr = $this->opensips_db->get("subscriber"); |
|
47 | + $accountnum_arr = $accountnum_arr->result_array(); |
|
48 | + foreach ($accountnum_arr as $value_num) { |
|
49 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', array('number'=>$value_num['accountcode'])); |
|
50 | 50 | } |
51 | 51 | } |
52 | - if($accountid_arr == ''){ |
|
52 | + if ($accountid_arr == '') { |
|
53 | 53 | echo "Please enter proper username of SIP Account"; |
54 | 54 | } |
55 | - if($accountid_arr->num_rows()==0 ){ |
|
56 | - $where=array('number'=>$sipnumber); |
|
57 | - $accountid_arr=$this->db_model->getSelect('id','accounts',$where); |
|
55 | + if ($accountid_arr->num_rows() == 0) { |
|
56 | + $where = array('number'=>$sipnumber); |
|
57 | + $accountid_arr = $this->db_model->getSelect('id', 'accounts', $where); |
|
58 | 58 | } |
59 | - if($accountid_arr->num_rows()>0){ |
|
60 | - $accountid_arr=$accountid_arr->result_array(); |
|
61 | - if($opensips_flag == '1'){ |
|
62 | - foreach($accountid_arr[0] as $key=>$value){ |
|
59 | + if ($accountid_arr->num_rows() > 0) { |
|
60 | + $accountid_arr = $accountid_arr->result_array(); |
|
61 | + if ($opensips_flag == '1') { |
|
62 | + foreach ($accountid_arr[0] as $key=>$value) { |
|
63 | 63 | } |
64 | - if($key== 'id'){ |
|
65 | - $accountid=$accountid_arr[0]['id']; |
|
64 | + if ($key == 'id') { |
|
65 | + $accountid = $accountid_arr[0]['id']; |
|
66 | 66 | } |
67 | - else{ |
|
68 | - $accountid=$accountid_arr[0]['accountid']; |
|
67 | + else { |
|
68 | + $accountid = $accountid_arr[0]['accountid']; |
|
69 | 69 | } |
70 | 70 | } |
71 | - else{ |
|
72 | - $accountid=$accountid_arr[0]['id']; |
|
71 | + else { |
|
72 | + $accountid = $accountid_arr[0]['id']; |
|
73 | 73 | } |
74 | 74 | $to_currency = common_model::$global_config['system_config']['base_currency']; |
75 | - if($accountid > 0){ |
|
76 | - $where=array('id'=>$accountid); |
|
77 | - $balance=$this->db_model->getSelect('balance,currency_id','accounts',$where); |
|
78 | - if($balance->num_rows() > 0){ |
|
75 | + if ($accountid > 0) { |
|
76 | + $where = array('id'=>$accountid); |
|
77 | + $balance = $this->db_model->getSelect('balance,currency_id', 'accounts', $where); |
|
78 | + if ($balance->num_rows() > 0) { |
|
79 | 79 | //get balance,currency using by user from account number. |
80 | 80 | $balance_arr = $balance->result_array(); |
81 | - $balance=$balance_arr['0']['balance']; |
|
82 | - $currency=$balance_arr['0']['currency_id']; |
|
81 | + $balance = $balance_arr['0']['balance']; |
|
82 | + $currency = $balance_arr['0']['currency_id']; |
|
83 | 83 | //Get Base Currency From System which is main currency of system. |
84 | - $base_currency_arr=$this->db_model->getSelect('value','system',array('name'=>'base_currency')); |
|
85 | - $base_currency_arr=$base_currency_arr->result_array(); |
|
86 | - $base_currency=$base_currency_arr['0']['value']; |
|
84 | + $base_currency_arr = $this->db_model->getSelect('value', 'system', array('name'=>'base_currency')); |
|
85 | + $base_currency_arr = $base_currency_arr->result_array(); |
|
86 | + $base_currency = $base_currency_arr['0']['value']; |
|
87 | 87 | //Get basse Currency rate from Currency Name. |
88 | - $base_currency_info=$this->db_model->getSelect('*','currency',array('currency'=>$base_currency)); |
|
89 | - $base_currency_info=$base_currency_info->result_array(); |
|
90 | - $base_currency_rate=$base_currency_info['0']['currencyrate']; |
|
91 | - $base_currency_name=$base_currency_info['0']['currency']; |
|
88 | + $base_currency_info = $this->db_model->getSelect('*', 'currency', array('currency'=>$base_currency)); |
|
89 | + $base_currency_info = $base_currency_info->result_array(); |
|
90 | + $base_currency_rate = $base_currency_info['0']['currencyrate']; |
|
91 | + $base_currency_name = $base_currency_info['0']['currency']; |
|
92 | 92 | //Find Currency Rate of user Currency from its currency_id |
93 | - $where= array('id'=>$currency); |
|
94 | - $user_currency_info=$this->db_model->getSelect("*",'currency',$where); |
|
93 | + $where = array('id'=>$currency); |
|
94 | + $user_currency_info = $this->db_model->getSelect("*", 'currency', $where); |
|
95 | 95 | //user Currency Is deleted or Not |
96 | - if($user_currency_info->num_rows() > 0){ |
|
97 | - $user_currency_info=$user_currency_info->result_array(); |
|
98 | - $user_currency=$user_currency_info['0']['currencyrate']; |
|
99 | - $user_currency_name=$user_currency_info['0']['currency']; |
|
96 | + if ($user_currency_info->num_rows() > 0) { |
|
97 | + $user_currency_info = $user_currency_info->result_array(); |
|
98 | + $user_currency = $user_currency_info['0']['currencyrate']; |
|
99 | + $user_currency_name = $user_currency_info['0']['currency']; |
|
100 | 100 | } |
101 | - else{ |
|
102 | - $user_currency=$base_currency_rate; |
|
103 | - $user_currency_name=$base_currency_name; |
|
101 | + else { |
|
102 | + $user_currency = $base_currency_rate; |
|
103 | + $user_currency_name = $base_currency_name; |
|
104 | 104 | } |
105 | 105 | // Convert Balance of user in user currency |
106 | - $convert_balance=round(($balance * $user_currency)/$base_currency_rate,2); |
|
107 | - $convert_balance=sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
106 | + $convert_balance = round(($balance * $user_currency) / $base_currency_rate, 2); |
|
107 | + $convert_balance = sprintf("%.2f", $convert_balance).' '.$user_currency_name; |
|
108 | 108 | echo "Balance : ".$convert_balance; |
109 | 109 | } |
110 | 110 | } |
111 | - else{ |
|
111 | + else { |
|
112 | 112 | echo "0.00 ".$to_currency; |
113 | 113 | } |
114 | 114 | } |
115 | - else{ |
|
115 | + else { |
|
116 | 116 | echo "Please enter proper username of SIP Account"; |
117 | 117 | } |
118 | 118 | } |
@@ -29,23 +29,23 @@ |
||
29 | 29 | parent::__construct(); |
30 | 30 | } |
31 | 31 | |
32 | - function index(){ |
|
32 | + function index() { |
|
33 | 33 | $data['account_info'] = $this->session->userdata['accountinfo']; |
34 | 34 | $data['username'] = $this->session->userdata('user_name'); |
35 | 35 | $data['page_title'] = "Test Mail"; |
36 | - $this->load->view('view_newmail',$data); |
|
36 | + $this->load->view('view_newmail', $data); |
|
37 | 37 | } |
38 | - function customer_mail_result($flag=FALSE){ |
|
38 | + function customer_mail_result($flag = FALSE) { |
|
39 | 39 | $account_info = $this->session->userdata['accountinfo']; |
40 | 40 | $post_array = $this->input->post(); |
41 | - $post_array['accountid']=$account_info['id']; |
|
42 | - $post_array['history_id']=0; |
|
43 | - $post_array['email']=$post_array['to']; |
|
41 | + $post_array['accountid'] = $account_info['id']; |
|
42 | + $post_array['history_id'] = 0; |
|
43 | + $post_array['email'] = $post_array['to']; |
|
44 | 44 | unset($post_array['to']); |
45 | - $this->email_lib->send_email($post_array,$post_array,'','',0,0); |
|
45 | + $this->email_lib->send_email($post_array, $post_array, '', '', 0, 0); |
|
46 | 46 | $this->thanks(); |
47 | 47 | } |
48 | - function thanks(){ |
|
48 | + function thanks() { |
|
49 | 49 | $this->load->view('view_mail_response'); |
50 | 50 | } |
51 | 51 |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | if ($query->num_rows > 0) { |
53 | 53 | $account_data = $query->result_array(); |
54 | 54 | foreach ($account_data as $data_key => $account_value) { |
55 | - $end_date = gmdate("Y-m-d") . " 23:59:59"; |
|
56 | - $account_value['sweep_id'] = (int) $account_value['sweep_id']; |
|
55 | + $end_date = gmdate("Y-m-d")." 23:59:59"; |
|
56 | + $account_value['sweep_id'] = (int)$account_value['sweep_id']; |
|
57 | 57 | switch ($account_value['sweep_id']) { |
58 | 58 | case 0: |
59 | 59 | $start_date = $this->validate_invoice_date($account_value); |
60 | 60 | if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
61 | 61 | $start_date = gmdate("Y-m-d H:i:s"); |
62 | 62 | } |
63 | - $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 days")); |
|
63 | + $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date." + 1 days")); |
|
64 | 64 | $this->Generate_Daily_invoice($account_value, $start_date, $end_date); |
65 | 65 | break; |
66 | 66 | case 2: |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | if (strtotime($start_date) >= strtotime(gmdate("Y-m-d H:i:s"))) { |
70 | 70 | $start_date = gmdate("Y-m-d H:i:s"); |
71 | 71 | } |
72 | - $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date . " + 1 month")); |
|
72 | + $end_date = gmdate("Y-m-d 23:59:59", strtotime($start_date." + 1 month")); |
|
73 | 73 | $this->Generate_Monthly_invoice($account_value, $start_date, $end_date); |
74 | 74 | } |
75 | 75 | break; |
76 | 76 | } |
77 | 77 | } |
78 | - $screen_path = getcwd() . "/cron"; |
|
79 | - $screen_filename = "Email_Broadcast_" . strtotime('now'); |
|
80 | - $command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
78 | + $screen_path = getcwd()."/cron"; |
|
79 | + $screen_filename = "Email_Broadcast_".strtotime('now'); |
|
80 | + $command = "cd ".$screen_path." && /usr/bin/screen -d -m -S $screen_filename php cron.php BroadcastEmail"; |
|
81 | 81 | exec($command); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | 85 | function validate_invoice_date($account_value) { |
86 | - $last_invoice_date = $this->common->get_invoice_date("to_date", $account_value["id"],$account_value['reseller_id'],"to_date"); |
|
86 | + $last_invoice_date = $this->common->get_invoice_date("to_date", $account_value["id"], $account_value['reseller_id'], "to_date"); |
|
87 | 87 | $last_invoice_date = ($last_invoice_date) ? $last_invoice_date : $account_value['creation']; |
88 | - $last_invoice_date = gmdate("Y-m-d H:i:s",strtotime("+1 Second",strtotime($last_invoice_date))); |
|
88 | + $last_invoice_date = gmdate("Y-m-d H:i:s", strtotime("+1 Second", strtotime($last_invoice_date))); |
|
89 | 89 | return $last_invoice_date; |
90 | 90 | } |
91 | 91 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | //Get Invoice configuration using single query instead of multiple queries. |
112 | 112 | $invoice_conf = array(); |
113 | 113 | $reseller_id = ($accountdata['reseller_id'] == 0) ? 1 : $accountdata['reseller_id']; |
114 | - $where = "accountid IN ('" . $reseller_id . "','1')"; |
|
114 | + $where = "accountid IN ('".$reseller_id."','1')"; |
|
115 | 115 | $this->db->select('*'); |
116 | 116 | $this->db->where($where); |
117 | 117 | $this->db->order_by('accountid', 'desc'); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $invoice_conf = $this->db->get('invoice_conf'); |
120 | 120 | $invoice_conf = (array)$invoice_conf->first_row(); |
121 | 121 | /*******************************************************/ |
122 | - $last_invoice_ID = $this->common->get_invoice_date("invoiceid","", $accountdata['reseller_id']); |
|
122 | + $last_invoice_ID = $this->common->get_invoice_date("invoiceid", "", $accountdata['reseller_id']); |
|
123 | 123 | if ($last_invoice_ID && $last_invoice_ID > 0) { |
124 | 124 | $last_invoice_ID = ($last_invoice_ID + 1); |
125 | 125 | } else { |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | function count_invoice_data($account, $start_date = "", $end_date = "") { |
144 | 144 | $cdr_query = ""; |
145 | 145 | $inv_data_query = ""; |
146 | - $cdr_query = "select calltype,sum(debit) as debit from cdrs where accountid = " . $account['id']; |
|
147 | - $cdr_query .= " AND callstart >='" . $start_date . "' AND callstart <= '" . $end_date . "' AND invoiceid=0 group by calltype"; |
|
146 | + $cdr_query = "select calltype,sum(debit) as debit from cdrs where accountid = ".$account['id']; |
|
147 | + $cdr_query .= " AND callstart >='".$start_date."' AND callstart <= '".$end_date."' AND invoiceid=0 group by calltype"; |
|
148 | 148 | //echo $cdr_query; |
149 | 149 | $cdr_data = $this->db->query($cdr_query); |
150 | 150 | if ($cdr_data->num_rows > 0) { |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | foreach ($cdr_data as $cdrvalue) { |
154 | 154 | $cdrvalue['debit'] = round($cdrvalue['debit'], self::$global_config['system_config']['decimalpoints']); |
155 | 155 | $tempArr = array("accountid" => $account['id'], "reseller_id" => $account['reseller_id'], "item_id" => "0", |
156 | - "description" => $cdrvalue['calltype'] . " CALLS for the period (" . $start_date . " to " . $end_date, "debit" => $cdrvalue['debit'], "item_type" => $cdrvalue['calltype'], "created_date" => $end_date); |
|
156 | + "description" => $cdrvalue['calltype']." CALLS for the period (".$start_date." to ".$end_date, "debit" => $cdrvalue['debit'], "item_type" => $cdrvalue['calltype'], "created_date" => $end_date); |
|
157 | 157 | $this->db->insert("invoice_details", $tempArr); |
158 | 158 | } |
159 | 159 | } |
160 | - $inv_data_query = "select count(id) as count,sum(debit) as debit,sum(credit) as credit from invoice_details where accountid=" . $account['id'] . " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type != 'FREECALL'"; |
|
160 | + $inv_data_query = "select count(id) as count,sum(debit) as debit,sum(credit) as credit from invoice_details where accountid=".$account['id']." AND created_date >='".$start_date."' AND created_date <= '".$end_date."' AND invoiceid=0 AND item_type != 'FREECALL'"; |
|
161 | 161 | //echo $inv_data_query; |
162 | 162 | $invoice_data = $this->db->query($inv_data_query); |
163 | 163 | if ($invoice_data->num_rows > 0) { |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | |
176 | 176 | //Change Order of arguements |
177 | 177 | function update_cdrs_data($accountid, $invoiceid, $start_date = "", $end_date = "") { |
178 | - $inv_data_query = "update invoice_details SET invoiceid = '" . $invoiceid . "' where accountid=" . $accountid; |
|
179 | - $inv_data_query .= " AND created_date >='" . $start_date . "' AND created_date <= '" . $end_date . "' AND invoiceid=0 AND item_type !='PAYMENT'"; |
|
178 | + $inv_data_query = "update invoice_details SET invoiceid = '".$invoiceid."' where accountid=".$accountid; |
|
179 | + $inv_data_query .= " AND created_date >='".$start_date."' AND created_date <= '".$end_date."' AND invoiceid=0 AND item_type !='PAYMENT'"; |
|
180 | 180 | $this->db->query($inv_data_query); |
181 | 181 | return true; |
182 | 182 | } |
@@ -184,24 +184,24 @@ discard block |
||
184 | 184 | function create_invoice($account, $from_date, $to_date, $last_invoice_ID, $INVprefix, $invoiceconf) { |
185 | 185 | //$due_date = gmdate("Y-m-d H:i:s",strtotime($to_date." +".$invoiceconf['interval']." days")); |
186 | 186 | if ($invoiceconf['interval'] > 0) { |
187 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +" . $invoiceconf['interval'] . " days")); |
|
187 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days")); |
|
188 | 188 | } else { |
189 | - $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s") . " +7 days")); |
|
189 | + $due_date = gmdate("Y-m-d H:i:s", strtotime(gmdate("Y-m-d H:i:s")." +7 days")); |
|
190 | 190 | } |
191 | 191 | // echo "due daye-------".$due_date.'----------'.$to_date.'------------> Invoice interval'.$invoiceconf['interval']; |
192 | 192 | $balance = ($account['credit_limit'] - $account['balance']); |
193 | 193 | $automatic_flag = self::$global_config['system_config']['automatic_invoice']; |
194 | - if($automatic_flag == 1){ |
|
194 | + if ($automatic_flag == 1) { |
|
195 | 195 | $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
196 | 196 | $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance); |
197 | - }else{ |
|
197 | + } else { |
|
198 | 198 | $invoice_data = array("accountid" => $account['id'], "invoice_prefix" => $INVprefix, "invoiceid" => $last_invoice_ID, "reseller_id" => |
199 | 199 | $account['reseller_id'], "invoice_date" => gmdate("Y-m-d H:i:s"), "from_date" => $from_date, "to_date" => $to_date, "due_date" => $due_date, "status" => 1, "amount" => "0.00", "balance" => $balance, "confirm" => 1); |
200 | 200 | } |
201 | 201 | // echo "<pre>"; print_r($invoice_data); exit; |
202 | 202 | $this->db->insert("invoices", $invoice_data); |
203 | 203 | $invoiceid = $this->db->insert_id(); |
204 | - if($automatic_flag == 0){ |
|
204 | + if ($automatic_flag == 0) { |
|
205 | 205 | $this->download_invoice($invoiceid, $account, $invoiceconf); |
206 | 206 | } |
207 | 207 | return $invoiceid; |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | $invoicedata = $this->db_model->getSelect("*", "invoices", array("id" => $invoiceid)); |
227 | 227 | $invoicedata = $invoicedata->result_array(); |
228 | 228 | $invoicedata = $invoicedata[0]; |
229 | - $FilePath = FCPATH . "invoices/" . $accountdata["id"] . '/' . $invoicedata['invoice_prefix']."".$invoicedata['invoiceid'] . "_invoice.pdf"; |
|
230 | - $Filenm = $invoicedata['invoice_prefix'] ."_". $invoicedata['invoiceid'] . "_invoice.pdf"; |
|
229 | + $FilePath = FCPATH."invoices/".$accountdata["id"].'/'.$invoicedata['invoice_prefix']."".$invoicedata['invoiceid']."_invoice.pdf"; |
|
230 | + $Filenm = $invoicedata['invoice_prefix']."_".$invoicedata['invoiceid']."_invoice.pdf"; |
|
231 | 231 | $this->common->get_invoice_template($invoicedata, $accountdata, false); |
232 | 232 | if ($invoice_conf['invoice_notification']) { |
233 | 233 | $this->send_email_notification($FilePath, $Filenm, $accountdata, $invoice_conf, $invoicedata); |
@@ -240,21 +240,21 @@ discard block |
||
240 | 240 | $EmailTemplate = $this->db_model->getSelect("*", "default_templates", $where); |
241 | 241 | foreach ($EmailTemplate->result_array() as $TemplateVal) { |
242 | 242 | $TemplateData = $TemplateVal; |
243 | - $TemplateData['subject'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['subject']); |
|
244 | - $TemplateData['subject'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['subject']); |
|
245 | - $TemplateData['template'] = str_replace('#NAME#', $AccountData['first_name'] . " " . $AccountData['last_name'], $TemplateData['template']); |
|
246 | - $TemplateData['template'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'] . $invData['invoiceid'], $TemplateData['template']); |
|
243 | + $TemplateData['subject'] = str_replace('#NAME#', $AccountData['first_name']." ".$AccountData['last_name'], $TemplateData['subject']); |
|
244 | + $TemplateData['subject'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'].$invData['invoiceid'], $TemplateData['subject']); |
|
245 | + $TemplateData['template'] = str_replace('#NAME#', $AccountData['first_name']." ".$AccountData['last_name'], $TemplateData['template']); |
|
246 | + $TemplateData['template'] = str_replace('#INVOICE_NUMBER#', $invData['invoice_prefix'].$invData['invoiceid'], $TemplateData['template']); |
|
247 | 247 | $TemplateData['template'] = str_replace('#AMOUNT#', $invData['amount'], $TemplateData['template']); |
248 | 248 | |
249 | 249 | $TemplateData['template'] = str_replace("#COMPANY_EMAIL#", $invoice_conf['emailaddress'], $TemplateData['template']); |
250 | 250 | $TemplateData['template'] = str_replace("#COMPANY_NAME#", $invoice_conf['company_name'], $TemplateData['template']); |
251 | 251 | $TemplateData['template'] = str_replace("#COMPANY_WEBSITE#", $invoice_conf['website'], $TemplateData['template']); |
252 | - $TemplateData['template'] = str_replace("#INVOICE_DATE#",$invData['invoice_date'], $TemplateData['template']); |
|
252 | + $TemplateData['template'] = str_replace("#INVOICE_DATE#", $invData['invoice_date'], $TemplateData['template']); |
|
253 | 253 | $TemplateData['template'] = str_replace("#DUE_DATE#", $invData['due_date'], $TemplateData['template']); |
254 | 254 | } |
255 | - $dir_path = getcwd() . "/attachments/"; |
|
256 | - $path = $dir_path . $Filenm; |
|
257 | - $command = "cp " . $FilePath . " " . $path; |
|
255 | + $dir_path = getcwd()."/attachments/"; |
|
256 | + $path = $dir_path.$Filenm; |
|
257 | + $command = "cp ".$FilePath." ".$path; |
|
258 | 258 | exec($command); |
259 | 259 | $email_array = array('accountid' => $AccountData['id'], |
260 | 260 | 'subject' => $TemplateData['subject'], |