Passed
Pull Request — v3.0 (#167)
by Samir
11:33
created
web_interface/astpp/application/views/footer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 	
8 8
   <?php
9 9
 	$this->db->select('*');
10
-	$this->db->where('domain',$_SERVER['HTTP_HOST']);
11
-	$result=$this->db->get('invoice_conf');
12
-	if($result->num_rows() > 0){
13
-		$result=$result->result_array();
10
+	$this->db->where('domain', $_SERVER['HTTP_HOST']);
11
+	$result = $this->db->get('invoice_conf');
12
+	if ($result->num_rows() > 0) {
13
+		$result = $result->result_array();
14 14
 		$footer = $result[0]['website_footer'];
15
-	}else{
15
+	} else {
16 16
 		$footer = '';
17 17
 	}
18
-  	if($footer != ''){ ?>
18
+  	if ($footer != '') { ?>
19 19
 		 <div style="margin-left:470px; "><?=$footer ?>
20 20
 		 
21 21
 		 <div style="" class="pull-left">
Please login to merge, or discard this patch.
web_interface/astpp/application/views/left_panel_master.php 1 patch
Spacing   +57 added lines, -58 removed lines patch added patch discarded remove patch
@@ -61,84 +61,83 @@
 block discarded – undo
61 61
 <div class="sidebar collapse">
62 62
 	
63 63
              <?php 
64
-			 $uri_string= uri_string();
65
-			 $uri_arr=explode("/",$uri_string);
66
-			 $entity_name=false;
67
-			 if(isset($uri_arr[1]) && !empty($uri_arr[1])){
68
-					$function_explode=explode("_",$uri_arr[1]);
69
-				   $entity_name = isset($function_explode[1]) && !empty($function_explode[1]) ? $function_explode[0] : false;
64
+			 $uri_string = uri_string();
65
+			 $uri_arr = explode("/", $uri_string);
66
+			 $entity_name = false;
67
+			 if (isset($uri_arr[1]) && ! empty($uri_arr[1])) {
68
+					$function_explode = explode("_", $uri_arr[1]);
69
+				   $entity_name = isset($function_explode[1]) && ! empty($function_explode[1]) ? $function_explode[0] : false;
70 70
 			 }
71 71
              
72
-			 $accountinfo=$this->session->userdata('accountinfo');
73
-			 if($accountinfo['type'] != 0  && $accountinfo['type'] !=3){
74
-			  $menu_info= ($uri_arr[0]=="user"
75
-							? unserialize(RESELLERPROFILE_ARRAY):($uri_arr[0]=="accounts"&& $entity_name =='customer'
76
-							? unserialize(CUSTOMEREDIT_ARRAY)   :($uri_arr[0]=="accounts"&& $entity_name =='provider'
77
-							? unserialize(PROVIDEREDIT_ARRAY)   :($uri_arr[0]=="accounts"&& $entity_name =='reseller' 
78
-							? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] =="package" ? unserialize(PACKAGEEDIT_ARRAY):false) ))));
79
-			 }else{
80
-			   $menu_info=null;
81
-			   $current_menu_url=$uri_arr[0]."/".$uri_arr[1]."/";
82
-			   $new_menu_info=array();
83
-				$menus=  unserialize($this->session->userdata('menuinfo'));
84
-				foreach($menus as $entity_key=>$entity_menu){
85
-					foreach($entity_menu as $entity_subkey=>$entity_submenu){
86
-						 foreach($entity_submenu as $subkey=>$submenus){
87
-							 if($submenus['module_url']==$current_menu_url){
88
-								 $new_menu_info=$entity_menu;
72
+			 $accountinfo = $this->session->userdata('accountinfo');
73
+			 if ($accountinfo['type'] != 0 && $accountinfo['type'] != 3) {
74
+			  $menu_info = ($uri_arr[0] == "user"
75
+							? unserialize(RESELLERPROFILE_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'customer'
76
+							? unserialize(CUSTOMEREDIT_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'provider'
77
+							? unserialize(PROVIDEREDIT_ARRAY) : ($uri_arr[0] == "accounts" && $entity_name == 'reseller' 
78
+							? unserialize(RESELLEREDIT_ARRAY) : ($uri_arr[0] == "package" ? unserialize(PACKAGEEDIT_ARRAY) : false)))));
79
+			 } else {
80
+			   $menu_info = null;
81
+			   $current_menu_url = $uri_arr[0]."/".$uri_arr[1]."/";
82
+			   $new_menu_info = array();
83
+				$menus = unserialize($this->session->userdata('menuinfo'));
84
+				foreach ($menus as $entity_key=>$entity_menu) {
85
+					foreach ($entity_menu as $entity_subkey=>$entity_submenu) {
86
+						 foreach ($entity_submenu as $subkey=>$submenus) {
87
+							 if ($submenus['module_url'] == $current_menu_url) {
88
+								 $new_menu_info = $entity_menu;
89 89
 							 }
90 90
 						 }
91 91
 					}
92 92
 				}
93
-				foreach($new_menu_info as $key=>$value){
94
-					foreach($value as $subvalue){
95
-						$menu_info[$subvalue['menu_label']]=$subvalue['module_url'];
93
+				foreach ($new_menu_info as $key=>$value) {
94
+					foreach ($value as $subvalue) {
95
+						$menu_info[$subvalue['menu_label']] = $subvalue['module_url'];
96 96
 					}
97 97
 				}
98 98
 			 }
99
-			 if($accountinfo['type']==0 || $accountinfo['type']==3){
100
-		  if($uri_arr[0]=='user' && $uri_arr[1] =='user_myprofile' || $uri_arr[0]=='user' && $uri_arr[1]=='user_change_password'){
101
-		$menu_info=unserialize(CUSTOMERPROFILE_ARRAY);
99
+			 if ($accountinfo['type'] == 0 || $accountinfo['type'] == 3) {
100
+		  if ($uri_arr[0] == 'user' && $uri_arr[1] == 'user_myprofile' || $uri_arr[0] == 'user' && $uri_arr[1] == 'user_change_password') {
101
+		$menu_info = unserialize(CUSTOMERPROFILE_ARRAY);
102 102
 		  }
103 103
 			 }
104
-			 if(!empty($menu_info)){
104
+			 if ( ! empty($menu_info)) {
105 105
 				echo "<ul class='sidemenu'>";
106
-				$i=0;
107
-				foreach($menu_info as $key=>$value){ 
108
-				$url=($entity_name=='provider'||$entity_name =='customer' || $entity_name =='reseller' || $uri_arr[0] =="package") && isset($uri_arr[2]) && !empty($uri_arr[2])
106
+				$i = 0;
107
+				foreach ($menu_info as $key=>$value) { 
108
+				$url = ($entity_name == 'provider' || $entity_name == 'customer' || $entity_name == 'reseller' || $uri_arr[0] == "package") && isset($uri_arr[2]) && ! empty($uri_arr[2])
109 109
 					?
110
-				base_url().$value.$uri_arr[2]."/" : 
111
-				base_url().$value;
112
-				$value_flag=false;
113
-		if($acc_info['type'] == '3' || $acc_info['type'] == '0'){
114
-		  if($value == "user/user_ipmap/" && $acc_info['allow_ip_management'] == '1'){
115
-			$value_flag=false;
116
-		  }elseif(in_array('user/user_sipdevices/',$menu_info) && $value == "user/user_sipdevices/" && common_model::$global_config['system_config']['opensips']== 0){
117
-			$value_flag=false;
118
-		  }else{
119
-			$value_flag=true;
110
+				base_url().$value.$uri_arr[2]."/" : base_url().$value;
111
+				$value_flag = false;
112
+		if ($acc_info['type'] == '3' || $acc_info['type'] == '0') {
113
+		  if ($value == "user/user_ipmap/" && $acc_info['allow_ip_management'] == '1') {
114
+			$value_flag = false;
115
+		  }elseif (in_array('user/user_sipdevices/', $menu_info) && $value == "user/user_sipdevices/" && common_model::$global_config['system_config']['opensips'] == 0) {
116
+			$value_flag = false;
117
+		  } else {
118
+			$value_flag = true;
120 119
 		  }
121
-				}else{
122
-		  if(common_model::$global_config['system_config']['opensips'] == 1 ){
123
-			  if($value != "accounts/".$entity_name."_opensips/"){
124
-			  $value_flag=true;
125
-			  }else{
126
-			$value_flag=false;
120
+				} else {
121
+		  if (common_model::$global_config['system_config']['opensips'] == 1) {
122
+			  if ($value != "accounts/".$entity_name."_opensips/") {
123
+			  $value_flag = true;
124
+			  } else {
125
+			$value_flag = false;
127 126
 			  }
128 127
 		  }
129
-		  if(common_model::$global_config['system_config']['opensips']== 0 ){
130
-			  if($value != "accounts/".$entity_name."_sipdevices/"){
131
-			  $value_flag=true;
132
-			  }else{
133
-			$value_flag=false;
128
+		  if (common_model::$global_config['system_config']['opensips'] == 0) {
129
+			  if ($value != "accounts/".$entity_name."_sipdevices/") {
130
+			  $value_flag = true;
131
+			  } else {
132
+			$value_flag = false;
134 133
 			  }
135 134
 		  }
136 135
 				}
137 136
 
138
-				if($value_flag){
139
-					$class = ($value == $uri_arr[0]."/".$uri_arr[1]."/" ) ? 'active' : '';
140
-					if($i==0)
141
-						$class=($uri_arr[1]== $entity_name."_save") ? 'active': $class;
137
+				if ($value_flag) {
138
+					$class = ($value == $uri_arr[0]."/".$uri_arr[1]."/") ? 'active' : '';
139
+					if ($i == 0)
140
+						$class = ($uri_arr[1] == $entity_name."_save") ? 'active' : $class;
142 141
                     
143 142
 					echo "<li class='$class'><a href ='$url'>$key</a></li>";
144 143
 				}
Please login to merge, or discard this patch.
web_interface/astpp/application/helpers/email_csv_helper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 }
4 4
 
5 5
 function create_csv_string($data) {
6
-	if (!$fp = fopen('php://temp', 'w+')) {
6
+	if ( ! $fp = fopen('php://temp', 'w+')) {
7 7
 		return FALSE;
8 8
 	}
9 9
 	foreach ($data as $line) {
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 	return stream_get_contents($fp);
14 14
 }
15 15
 
16
-function send_csv_mail ($csvData, $body, $to, $subject,$file_name) {
16
+function send_csv_mail($csvData, $body, $to, $subject, $file_name) {
17 17
 	//print_r($csvData);
18 18
 	$where = array('group_title' =>'email');
19 19
 		$query = $this->CI->db_model->getSelect("*", "system", $where);
20 20
 		$query = $query->result_array();
21
-	foreach($query as $key=>$val){
22
-		$from=$val['value'];
21
+	foreach ($query as $key=>$val) {
22
+		$from = $val['value'];
23 23
 	}
24 24
 	$multipartSep = '-----'.md5(time()).'-----';
25 25
 	$headers = array(
Please login to merge, or discard this patch.
web_interface/astpp/application/config/constants.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 								"Alert Threshold"=>"user/user_alert_threshold/"
52 52
 							   ))
53 53
 );
54
-define("CUSTOMEREDIT_ARRAY",serialize(array(
54
+define("CUSTOMEREDIT_ARRAY", serialize(array(
55 55
 											  "Customer Profile"=>"accounts/customer_edit/",
56 56
 											  "SIP Devices"=>"accounts/customer_sipdevices/",
57 57
 											  "Opensips Device"=>"accounts/customer_opensips/",
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 											 )
71 71
 							  ));
72 72
 
73
-define("PROVIDEREDIT_ARRAY",serialize(array(
73
+define("PROVIDEREDIT_ARRAY", serialize(array(
74 74
 						  "Provider Profile"=>"accounts/provider_edit/",
75 75
 											  "SIP Devices"=>"accounts/provider_sipdevices/",
76 76
 											  "Opensips Device"=>"accounts/provider_opensips/",
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 											  "Alert Threshold"=>"accounts/provider_alert_threshold/"
89 89
 											 )
90 90
 							  ));
91
-define("RESELLEREDIT_ARRAY",serialize(array("Reseller Profile"=>"accounts/reseller_edit/",
91
+define("RESELLEREDIT_ARRAY", serialize(array("Reseller Profile"=>"accounts/reseller_edit/",
92 92
 						"DID"=>"accounts/reseller_dids/",
93 93
 											"Subscription"=>"accounts/reseller_subscription/",
94 94
 											"Invoice"=>"accounts/reseller_invoices/",
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
 											"Emails"=>"accounts/reseller_emailhistory/",
101 101
 											"Alert Threshold"=>"accounts/reseller_alert_threshold/"
102 102
 )));
103
-define("PACKAGEEDIT_ARRAY",  serialize( array(
103
+define("PACKAGEEDIT_ARRAY", serialize(array(
104 104
 											"Package Details"=>"package/package_edit/",
105 105
 											"Package Codes"=>"package/package_pattern_list/"
106 106
 									   )));
107
-define("CUSTOMERPROFILE_ARRAY",serialize(array(
107
+define("CUSTOMERPROFILE_ARRAY", serialize(array(
108 108
 			"My Profile"=>"user/user_myprofile/",
109 109
 			"Change Password"=>"user/user_change_password"
110 110
 )));
111
-define("DATABASE_DIRECTORY",FCPATH.'database_backup'.DIRECTORY_SEPARATOR);
111
+define("DATABASE_DIRECTORY", FCPATH.'database_backup'.DIRECTORY_SEPARATOR);
112 112
 define('LOCALE_REQUEST_PARAM', 'lang');
113 113
 define('WEBSITE_DOMAIN', 'messages');
114 114
 
Please login to merge, or discard this patch.
web_interface/astpp/application/config/config.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('BASEPATH'))
3
+if ( ! defined('BASEPATH'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /*
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/charges/models/charges_model.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		$this->db->insert("charges", $add_array);
64 64
 		$insert_id = $this->db->insert_id(); 
65 65
 		$data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $add_array['pricelist_id']));
66
-		if($data->num_rows > 0){
67
-		   foreach ($data->result_array() as $key => $value){
66
+		if ($data->num_rows > 0) {
67
+		   foreach ($data->result_array() as $key => $value) {
68 68
 				$this->common->mail_to_users('add_subscription', $value);  
69 69
 		   }
70 70
 		}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		$this->db->where("id", $id);
89 89
 		$this->db->update("charges", $data);
90 90
         
91
-		if($data['pricelist_id'] == 0){
91
+		if ($data['pricelist_id'] == 0) {
92 92
 			$this->db->where("charge_id", $id);
93 93
 			$this->db->delete("charge_to_account");
94 94
 		}
@@ -103,23 +103,23 @@  discard block
 block discarded – undo
103 103
 		$data = $data->result_array();
104 104
 		$data = $data[0];
105 105
 		$data = $this->db_model->getSelect("*", "accounts", array("pricelist_id" => $data['pricelist_id']));
106
-		if($data->num_rows > 0){
107
-		   foreach ($data->result_array() as $key => $value){
106
+		if ($data->num_rows > 0) {
107
+		   foreach ($data->result_array() as $key => $value) {
108 108
 				$this->common->mail_to_users('remove_subscription', $value);  
109 109
 		   }
110 110
 		}
111 111
 		return true;
112 112
 	}
113 113
     
114
-	function add_account_charges($pricelistid,$chargeid,$flag){
115
-		if($flag){
114
+	function add_account_charges($pricelistid, $chargeid, $flag) {
115
+		if ($flag) {
116 116
 		   $this->db->where("charge_id", $chargeid);
117 117
 		   $this->db->delete("charge_to_account");
118 118
 		}
119 119
 		$account = $this->db_model->getSelect("*", "accounts", array("pricelist_id"=>$pricelistid));
120
-		if($account->num_rows > 0){
121
-		   foreach ($account->result_array() as $key => $value){
122
-				$charge_arr = array("charge_id"=>$chargeid,"accountid"=>$value['id'],"assign_date"=>gmdate("Y-m-d H:i:s"));
120
+		if ($account->num_rows > 0) {
121
+		   foreach ($account->result_array() as $key => $value) {
122
+				$charge_arr = array("charge_id"=>$chargeid, "accountid"=>$value['id'], "assign_date"=>gmdate("Y-m-d H:i:s"));
123 123
 				$this->db->insert("charge_to_account", $charge_arr);               
124 124
 		   }
125 125
 		}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/charges/controllers/charges.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		$this->load->model('charges_model');
36 36
 
37 37
 		if ($this->session->userdata('user_login') == FALSE)
38
-			redirect(base_url() . '/astpp/login');
38
+			redirect(base_url().'/astpp/login');
39 39
 	}
40 40
 
41 41
 	function periodiccharges_add() {
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 				$add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
76 76
 				$this->charges_model->edit_charge($add_array, $add_array['id']);
77 77
                 
78
-				if($add_array['pricelist_id'] > 0){
79
-				   $this->charges_model->add_account_charges($add_array['pricelist_id'],$add_array['id'],true);
78
+				if ($add_array['pricelist_id'] > 0) {
79
+				   $this->charges_model->add_account_charges($add_array['pricelist_id'], $add_array['id'], true);
80 80
 				}                
81 81
 				echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription updated successfully!"));
82 82
 				exit;
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 			} else {
91 91
 				$add_array['charge'] = $this->common_model->add_calculate_currency($add_array['charge'], '', '', false, false);
92 92
 				$charge_id = $this->charges_model->add_charge($add_array);
93
-				if($add_array['pricelist_id'] > 0 && $charge_id > 0){
94
-				   $this->charges_model->add_account_charges($add_array['pricelist_id'],$charge_id,false);
93
+				if ($add_array['pricelist_id'] > 0 && $charge_id > 0) {
94
+				   $this->charges_model->add_account_charges($add_array['pricelist_id'], $charge_id, false);
95 95
 				}                  
96 96
 				echo json_encode(array("SUCCESS"=> $add_array["description"]." subscription added successfully!"));
97 97
 				exit;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	function periodiccharges_delete($id) {
105 105
 		$this->charges_model->remove_charge($id);
106 106
 		$this->session->set_flashdata('astpp_notification', 'Subscription removed successfully!');
107
-		redirect(base_url() . 'charges/periodiccharges/');
107
+		redirect(base_url().'charges/periodiccharges/');
108 108
 	}
109 109
 
110 110
 	function periodiccharges_search() {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			$this->session->set_userdata('charges_list_search', $action);
121 121
 		}
122 122
 		if (@$ajax_search != 1) {
123
-			redirect(base_url() . 'charges/periodiccharges/');
123
+			redirect(base_url().'charges/periodiccharges/');
124 124
 		}
125 125
 	}
126 126
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	function periodiccharges_delete_multiple() {
161 161
 		$ids = $this->input->post("selected_ids", true);
162 162
 		$where = "id IN ($ids)";
163
-		$charge_where="charge_id IN(".$ids.")";
164
-		$this->db->delete('charge_to_account',$charge_where);
165
-		echo $this->db->delete("charges",$where);
163
+		$charge_where = "charge_id IN(".$ids.")";
164
+		$this->db->delete('charge_to_account', $charge_where);
165
+		echo $this->db->delete("charges", $where);
166 166
 	}
167 167
 	function customer_charge_list($accountid, $accounttype) {
168 168
 	
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 		$where = array('accounts.id' => $accountid);
177 177
 		$order_type = 'id';
178 178
 		$order_by = "ASC";
179
-		$instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
-		$like_str=!empty($instant_search) ? "(charges.description like '%$instant_search%'  
179
+		$instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_subscription'); 
180
+		$like_str = ! empty($instant_search) ? "(charges.description like '%$instant_search%'  
181 181
                                             OR  charges.charge like '%$instant_search%'
182 182
                                             OR  charges.charge like '%$instant_search%' 
183 183
                                                 )"
184 184
 										   :null;
185
-		if(!empty($like_str))
185
+		if ( ! empty($like_str))
186 186
 		$this->db->where($like_str);
187 187
 		$count_all = $this->db_model->getCountWithJion($table, $select, $where, $jionTable, $jionCondition, $type);
188 188
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
189 189
 		$json_data = $paging_data["json_paging"];
190
-		if(!empty($like_str))
190
+		if ( ! empty($like_str))
191 191
 		$this->db->where($like_str);
192 192
 		$account_charge_list = $this->db_model->getAllJionQuery($table, $select, $where, $jionTable, $jionCondition, $type, $paging_data["paging"]["page_no"], $paging_data["paging"]["start"], $order_by, $order_type, "");
193 193
 		$grid_fields = json_decode($this->charges_form->build_charges_list_for_customer($accountid, $accounttype));
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/charges/libraries/charges_form.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 23
 ###############################################################################
24 24
 
25
-if (!defined('BASEPATH'))
25
+if ( ! defined('BASEPATH'))
26 26
 	exit('No direct script access allowed');
27 27
 
28 28
 class Charges_form {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	}
32 32
    
33 33
 	function get_charge_form_fields() {
34
-		$form['forms'] = array(base_url() . 'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
34
+		$form['forms'] = array(base_url().'charges/periodiccharges_save/', array('id' => 'charges_form', 'method' => 'POST', 'name' => 'charges_form'));
35 35
 		$form['Information'] = array(
36 36
 			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
37 37
 			array('Name', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 			$account_data = $this->CI->session->userdata("accountinfo");
53 53
 			$loginid = $account_data['id'];
54 54
 
55
-		}else{
55
+		} else {
56 56
 			$loginid = "0";
57 57
 		}
58 58
 		$form['forms'] = array("", array('id' => "charges_search"));
59 59
 		$form['Search'] = array(
60 60
 			array('Name', 'INPUT', array('name' => 'description[description]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
61
-			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0,'reseller_id'=>$loginid)),
61
+			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array('status'=>0, 'reseller_id'=>$loginid)),
62 62
 			array('Amount', 'INPUT', array('name' => 'charge[charge]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'charge[charge-integer]', '', '', '', 'search_int_type', ''),
63 63
 			array('Billing Cycle', 'sweep_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'sweep', 'sweeplist', 'build_dropdown', '', ''), 
64 64
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status'),
@@ -77,28 +77,28 @@  discard block
 block discarded – undo
77 77
 	function build_charge_list_for_admin() {
78 78
 		
79 79
 		  $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
80
-	$currency_id=$account_info['currency_id'];
81
-	 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
80
+	$currency_id = $account_info['currency_id'];
81
+	 $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
82 82
 		
83 83
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
84
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
84
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
85 85
 /**
86 86
 ASTPP  3.0 
87 87
 For DID edit on DID number
88 88
 **/
89
-		array(gettext("Name"), "140", "description", "", "", "","EDITABLE","true","center"),
89
+		array(gettext("Name"), "140", "description", "", "", "", "EDITABLE", "true", "center"),
90 90
 /**************************************************/
91
-			array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
92
-			array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency","","true","right"),
93
-			array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
94
-			array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
91
+			array(gettext("Rate Group"), "140", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"),
92
+			array("Amount($currency)", "125", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"),
93
+			array(gettext("Prorate"), "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"),
94
+			array(gettext("Billing Cycle"), "130", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"),
95 95
 			/**
96 96
 	    ASTPP  3.0 
97 97
 	    Show Creation date,last_modified date in reseller grid with admin login
98 98
 			 **/
99
-			array(gettext("Status"), "125", "status", "status", "charges", "get_status","","true","center"),
100
-			array(gettext("Created Date"), "150", "creation_date", "", "", "","","true","center"),
101
-			 array(gettext("Modified Date"), "150", "last_modified_date", "", "", "","","true","center"),
99
+			array(gettext("Status"), "125", "status", "status", "charges", "get_status", "", "true", "center"),
100
+			array(gettext("Created Date"), "150", "creation_date", "", "", "", "", "true", "center"),
101
+			 array(gettext("Modified Date"), "150", "last_modified_date", "", "", "", "", "true", "center"),
102 102
 			/************************************************/
103 103
 		   /*
104 104
             ASTPP  3.0 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	/********************************************/
115 115
 
116 116
 	function build_grid_buttons() {
117
-		$buttons_json = json_encode(array(array("Create" , "btn btn-line-warning btn" , "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
-			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg",  "button_action", "/charges/periodiccharges_delete_multiple/")
117
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/charges/periodiccharges_add/", "popup"),
118
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/charges/periodiccharges_delete_multiple/")
119 119
 			));
120 120
 		return $buttons_json;
121 121
 	}
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	function build_charges_list_for_customer($accountid, $accounttype) {
124 124
 		
125 125
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
126
-		$currency_id=$account_info['currency_id'];
127
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);		
126
+		$currency_id = $account_info['currency_id'];
127
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);		
128 128
 		
129
-		$grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "","","true","center"),
130
-			array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency","","true","right"),
131
-			array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate","","true","center"),
132
-			array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name","","true","center"),
133
-			array("Created Date", "150", "creation_date", "", "", "","","true","center"),
134
-			 array("Modified Date", "150", "last_modified_date", "", "", "","","true","center"),
129
+		$grid_field_arr = json_encode(array(array("Name", "140", "description", "", "", "", "", "true", "center"),
130
+			array("Amount($currency)", "140", "charge", "charge", "charge", "convert_to_currency", "", "true", "right"),
131
+			array("Prorate", "125", "pro_rate", "pro_rate", "charges", "get_prorate", "", "true", "center"),
132
+			array("Billing Cycle", "170", "sweep_id", "sweep", "sweeplist", "get_field_name", "", "true", "center"),
133
+			array("Created Date", "150", "creation_date", "", "", "", "", "true", "center"),
134
+			 array("Modified Date", "150", "last_modified_date", "", "", "", "", "true", "center"),
135 135
 			array("Action", "150", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_subscription_action/delete/$accountid/$accounttype/", "mode" => "single")))
136 136
 				));
137 137
 		return $grid_field_arr;
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/summary/models/summary_model.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
 		parent::__construct();
29 29
 	}
30 30
 
31
-	function get_resellersummary_report_list($flag, $start = 0, $limit = 0,$group_by, $select,$order, $export = false) {
31
+	function get_resellersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) {
32 32
 
33 33
 		$this->db_model->build_search('summary_reseller_search');
34
-		$accountinfo=$this->session->userdata('accountinfo');
34
+		$accountinfo = $this->session->userdata('accountinfo');
35 35
 		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
36
-		$where['reseller_id']=$reseller_id;
36
+		$where['reseller_id'] = $reseller_id;
37 37
 		if ($this->session->userdata('advance_search') != 1) {
38
-			$where['callstart >=']=date('Y-m-d') . " 00:00:00";
39
-			$where['callstart <=']=date('Y-m-d') . " 23:59:59";
38
+			$where['callstart >='] = date('Y-m-d')." 00:00:00";
39
+			$where['callstart <='] = date('Y-m-d')." 23:59:59";
40 40
 		}
41 41
 		$this->db->where($where);
42
-		if(!empty($group_by))
42
+		if ( ! empty($group_by))
43 43
 			$this->db->group_by($group_by);
44 44
 		if ($flag) {
45 45
 			if ($export) {
46
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
46
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', '', '', '');
47 47
 			} else {
48
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
48
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "reseller_cdrs", '', $order, 'asc', $limit, $start, '');
49 49
 			}
50 50
 		} else {
51 51
 			$result = $this->db_model->getSelect("count(*) as total_count", "reseller_cdrs", '');
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
 		return $result;
59 59
 	}
60 60
 
61
-	function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export = false) {
61
+	function get_providersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export = false) {
62 62
 		$this->db_model->build_search('summary_provider_search');
63
-		$where['provider_id >']=0;
63
+		$where['provider_id >'] = 0;
64 64
 		if ($this->session->userdata('advance_search') != 1) {
65
-			$where['callstart >=']=date('Y-m-d') . " 00:00:00";
66
-			$where['callstart <=']=date('Y-m-d') . " 23:59:59";
65
+			$where['callstart >='] = date('Y-m-d')." 00:00:00";
66
+			$where['callstart <='] = date('Y-m-d')." 23:59:59";
67 67
 		}
68 68
 		$this->db->where($where);
69
-		if(!empty($group_by))
69
+		if ( ! empty($group_by))
70 70
 			$this->db->group_by($group_by);
71 71
 		if ($flag) {
72 72
 			if ($export) {
73
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
73
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
74 74
 			} else {
75
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
75
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
76 76
 			}
77 77
 		} else {
78 78
 			$result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
@@ -85,24 +85,24 @@  discard block
 block discarded – undo
85 85
 		return $result;
86 86
 	}
87 87
 
88
-	function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select,$order, $export) {
88
+	function get_customersummary_report_list($flag, $start = 0, $limit = 0, $group_by, $select, $order, $export) {
89 89
 		$this->db_model->build_search('summary_customer_search');
90
-		$accountinfo=$this->session->userdata('accountinfo');
90
+		$accountinfo = $this->session->userdata('accountinfo');
91 91
 		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
92
-		$where['reseller_id']=$reseller_id;
93
-		$where['type']=0;
92
+		$where['reseller_id'] = $reseller_id;
93
+		$where['type'] = 0;
94 94
 		if ($this->session->userdata('advance_search') != 1) {
95
-			$where['callstart >=']=date('Y-m-d') . " 00:00:00";
96
-			$where['callstart <=']=date('Y-m-d') . " 23:59:59";
95
+			$where['callstart >='] = date('Y-m-d')." 00:00:00";
96
+			$where['callstart <='] = date('Y-m-d')." 23:59:59";
97 97
 		}
98 98
 		$this->db->where($where);
99
-		if(!empty($group_by))
99
+		if ( ! empty($group_by))
100 100
 			$this->db->group_by($group_by);
101 101
 		if ($flag) {
102 102
 			if ($export) {
103
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
103
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free' THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', '', '', '');
104 104
 			} else {
105
-				$result = $this->db_model->select($select . ",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
105
+				$result = $this->db_model->select($select.",COUNT(*) AS attempts, AVG(billseconds) AS acd,MAX(billseconds) AS mcd,SUM(billseconds) AS duration,SUM(CASE WHEN calltype !='free'  THEN billseconds ELSE 0 END) as billable,SUM(CASE WHEN billseconds > 0 THEN 1 ELSE 0 END) as completed,SUM(debit) AS debit,SUM(cost) AS cost", "cdrs", '', $order, 'asc', $limit, $start, '');
106 106
 			}
107 107
 		} else {
108 108
 			$result = $this->db_model->getSelect("count(*) as total_count", "cdrs", '');
Please login to merge, or discard this patch.