Passed
Push — v3.0 ( 2dc815...9faf9f )
by Samir
12:41
created
web_interface/astpp/application/modules/signup/models/signup_model.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,49 +51,49 @@
 block discarded – undo
51 51
 		$data['reseller_id'] = $data['key_unique'];	
52 52
 		unset($data['agreeCheck']);
53 53
 		unset($data['key_unique']);
54
-		$data['creation']=gmdate('Y-m-d H:i:s');
54
+		$data['creation'] = gmdate('Y-m-d H:i:s');
55 55
 		$data['expiry'] = date('Y-m-d H:i:s', strtotime('+10 years'));
56
-		$this->db->insert("accounts",$data);
56
+		$this->db->insert("accounts", $data);
57 57
 		return   $this->db->insert_id();
58 58
 		}
59 59
 
60
-	function check_user($accno,$email,$balance)
60
+	function check_user($accno, $email, $balance)
61 61
 	{
62
-		$info = array("number"=>$accno,"email"=>$email,"status"=>1);
62
+		$info = array("number"=>$accno, "email"=>$email, "status"=>1);
63 63
 						$this->db->where($info);
64 64
 						$this->db->select('*');
65
-		$acc_res=$this->db->get('accounts');
66
-		if($acc_res->num_rows() > 0)	
65
+		$acc_res = $this->db->get('accounts');
66
+		if ($acc_res->num_rows() > 0)	
67 67
 		{         
68
-						$acc_res=$acc_res->result_array();
69
-						$acc_res=$acc_res[0];
70
-						$this->db->where('pricelist_id',$acc_res['pricelist_id']);
68
+						$acc_res = $acc_res->result_array();
69
+						$acc_res = $acc_res[0];
70
+						$this->db->where('pricelist_id', $acc_res['pricelist_id']);
71 71
 						$this->db->select("*");
72
-						$charge_res=$this->db->get('charges');
72
+						$charge_res = $this->db->get('charges');
73 73
                         
74
-			if($charge_res->num_rows() > 0){
75
-			$charge_res=$charge_res->result_array();
76
-						$charge_res=$charge_res[0];
77
-						$charge_acc_arr=array(
74
+			if ($charge_res->num_rows() > 0) {
75
+			$charge_res = $charge_res->result_array();
76
+						$charge_res = $charge_res[0];
77
+						$charge_acc_arr = array(
78 78
 						"charge_id"=>$charge_res['id'],
79 79
 						"accountid"=>$acc_res['id'],
80 80
 						"status"=>0,
81 81
 						"assign_date"=>date('Y-m-d H:i:s')
82 82
 						 );
83
-			}else{
84
-			$charge_res=$charge_res->result_array();
83
+			} else {
84
+			$charge_res = $charge_res->result_array();
85 85
 			//echo "<pre>"; print_r($charge_res); exit;
86 86
 			$charge_acc_arr = array("charge_id"=>'id',
87 87
 						"accountid"=>$acc_res['id'],
88 88
 						"assign_date"=>date('Y-m-d H:i:s'));
89 89
 			}
90
-						$result=$this->db->insert("charge_to_account",$charge_acc_arr);
91
-			$update = array("status" => 0,"balance" => $balance );
90
+						$result = $this->db->insert("charge_to_account", $charge_acc_arr);
91
+			$update = array("status" => 0, "balance" => $balance);
92 92
 			$this->db->where($info);
93 93
 			$result = $this->db->update('accounts', $update);
94
-			$sip_device_update = array('username'=>$accno,"status"=>1);
94
+			$sip_device_update = array('username'=>$accno, "status"=>1);
95 95
 			return 1;
96
-		} else{
96
+		} else {
97 97
 			return 0;
98 98
 		}
99 99
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/systems/models/system_model.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,50 +39,50 @@  discard block
 block discarded – undo
39 39
 		return $query;
40 40
 	}
41 41
 
42
-	function gettemplate_list($flag="", $start, $limit="") {
42
+	function gettemplate_list($flag = "", $start, $limit = "") {
43 43
 
44 44
          
45 45
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
46 46
 			$account_data = $this->session->userdata("accountinfo");
47 47
 			$reseller = $account_data['id'];
48
-			$this->db->where('reseller_id',$reseller);
49
-			$query = $this->db_model->select("*", "default_templates","","","","","");
50
-
51
-			if($query->num_rows() >0){
52
-		$result =$query->result_array();
53
-		$match_array =array();
54
-		$unmatch_array= array();
55
-		$i=0;
56
-		$str=0;
57
-		foreach($result as $value)
48
+			$this->db->where('reseller_id', $reseller);
49
+			$query = $this->db_model->select("*", "default_templates", "", "", "", "", "");
50
+
51
+			if ($query->num_rows() > 0) {
52
+		$result = $query->result_array();
53
+		$match_array = array();
54
+		$unmatch_array = array();
55
+		$i = 0;
56
+		$str = 0;
57
+		foreach ($result as $value)
58 58
 		{
59
-			$this->db->where('name',$value['name']);
60
-			$this->db->where('reseller_id',0);
61
-			$query = $this->db_model->select("id", "default_templates","", "id", "ASC", $limit, $start);		
62
-			$innerresult =$query->result_array();
63
-			foreach($innerresult as $value)
59
+			$this->db->where('name', $value['name']);
60
+			$this->db->where('reseller_id', 0);
61
+			$query = $this->db_model->select("id", "default_templates", "", "id", "ASC", $limit, $start);		
62
+			$innerresult = $query->result_array();
63
+			foreach ($innerresult as $value)
64 64
 			{                   
65
-			  $str.=$value['id'].",";
65
+			  $str .= $value['id'].",";
66 66
 			}		
67 67
 		}            
68
-		$str= rtrim($str,',');
68
+		$str = rtrim($str, ',');
69 69
 		
70 70
 		$where = "id NOT IN ($str)";		
71
-		$this->db->where('reseller_id',$reseller);
72
-		$this->db->or_where('reseller_id',0);
71
+		$this->db->where('reseller_id', $reseller);
72
+		$this->db->or_where('reseller_id', 0);
73 73
 		$this->db->where($where);
74 74
 			}
75 75
 			else
76 76
 			{
77
-			   $this->db->where('reseller_id',0);
77
+			   $this->db->where('reseller_id', 0);
78 78
 			}
79 79
               
80
-			if($flag) {
80
+			if ($flag) {
81 81
 
82
-		$query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start);
83
-		 }else {
82
+		$query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start);
83
+		 } else {
84 84
 
85
-		$query = $this->db_model->countQuery("*", "default_templates","");
85
+		$query = $this->db_model->countQuery("*", "default_templates", "");
86 86
 		
87 87
 		 }
88 88
 	  } 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 			$this->db->where($where);
93 93
 			$this->db_model->build_search('template_search');
94 94
 		if ($flag) {
95
-			$query = $this->db_model->select("*", "default_templates","", "id", "ASC", $limit, $start);
95
+			$query = $this->db_model->select("*", "default_templates", "", "id", "ASC", $limit, $start);
96 96
 		} else {
97
-			$query = $this->db_model->countQuery("*", "default_templates","");
97
+			$query = $this->db_model->countQuery("*", "default_templates", "");
98 98
 		}
99 99
 	  }
100 100
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
                         
107 107
 		$this->db->where("name", $name);
108 108
 		$this->db->update("system", $add_array);
109
-		if($name == 'base_currency'){
109
+		if ($name == 'base_currency') {
110 110
             
111
-			$screen_path = getcwd() . "/cron";
112
-			$screen_filename = "CurrencyUpdate" . strtotime('now');
113
-			$command = "cd " . $screen_path . " && /usr/bin/screen -d -m -S  $screen_filename php cron.php CurrencyUpdate";
111
+			$screen_path = getcwd()."/cron";
112
+			$screen_filename = "CurrencyUpdate".strtotime('now');
113
+			$command = "cd ".$screen_path." && /usr/bin/screen -d -m -S  $screen_filename php cron.php CurrencyUpdate";
114 114
 			exec($command);
115
-			$this->db->update("currency",array("currencyrate"=>'1'),array("currency"=>"INR"));
115
+			$this->db->update("currency", array("currencyrate"=>'1'), array("currency"=>"INR"));
116 116
 		}
117 117
 	}
118 118
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	function getcurrency_list($flag, $start = 0, $limit = 0) {
180 180
 		 $this->db_model->build_search('currency_list_search');
181 181
 	
182
-	$where=array('currency <>' =>Common_model::$global_config['system_config']['base_currency']);
182
+	$where = array('currency <>' =>Common_model::$global_config['system_config']['base_currency']);
183 183
 		if ($flag) {
184 184
 			$query = $this->db_model->select("*", "currency", $where, "id", "ASC", $limit, $start);
185 185
 		} else {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$this->db->delete("currency");
206 206
 		return true;
207 207
 	}
208
-	function backup_insert($add_array='')
208
+	function backup_insert($add_array = '')
209 209
 	{
210 210
 	 unset($add_array["action"]);
211 211
 		$this->db->insert("backup_database", $add_array);
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 	function get_backup_data($id)
224 224
 	{
225
-	  $where=array('id'=>$id);
225
+	  $where = array('id'=>$id);
226 226
 	  $query = $this->db_model->getSelect("*", "backup_database", $where);
227 227
 	  return $query;
228 228
 	}
229
-   function import_database($filename,$target_path)
229
+   function import_database($filename, $target_path)
230 230
 	{
231
-		$this->db->insert("backup_database", array('backup_name'=>$filename , 'path'=>$target_path));
231
+		$this->db->insert("backup_database", array('backup_name'=>$filename, 'path'=>$target_path));
232 232
 			return true;
233 233
 	}
234 234
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/systems/controllers/systems.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$this->load->dbutil();
35 35
 
36 36
 		if ($this->session->userdata('user_login') == FALSE)
37
-			redirect(base_url() . '/astpp/login');
37
+			redirect(base_url().'/astpp/login');
38 38
 	}
39 39
 
40 40
 	function configuration_edit($edit_id = '') {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			$this->session->set_userdata('configuration_search', $action);
59 59
 		}
60 60
 		if (@$ajax_search != 1) {
61
-			redirect(base_url() . 'systems/configuration/');
61
+			redirect(base_url().'systems/configuration/');
62 62
 		}
63 63
 	}
64 64
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 		}
85 85
 	}
86 86
 
87
-	function configuration($group_title='') {
88
-	if($group_title==""){
89
-		redirect(base_url() . '/dashboard');
87
+	function configuration($group_title = '') {
88
+	if ($group_title == "") {
89
+		redirect(base_url().'/dashboard');
90 90
 	}
91
-	if($group_title=="email"){
91
+	if ($group_title == "email") {
92 92
 		  $data['test_email_flag'] = true;
93 93
 	}
94 94
 		$data['username'] = $this->session->userdata('user_name');
95 95
 		$data['page_title'] = ucfirst($group_title);
96
-	$data['group_title']=$group_title;
97
-	$where=array("group_title"=>$group_title);
96
+	$data['group_title'] = $group_title;
97
+	$where = array("group_title"=>$group_title);
98 98
 	$details = $this->db_model->getSelect("*", "system", $where);
99
-	$data['details']=$details->result_array();
99
+	$data['details'] = $details->result_array();
100 100
 	$add_array = $this->input->post();
101
- 	if (!empty($add_array)) {
101
+ 	if ( ! empty($add_array)) {
102 102
 
103
-		foreach($add_array as $key=>$val){
104
-			$update_array=array('value'=>$val);
103
+		foreach ($add_array as $key=>$val) {
104
+			$update_array = array('value'=>$val);
105 105
 			$this->system_model->edit_configuration($update_array, $key);
106 106
 		}
107 107
 				$this->session->set_flashdata('astpp_errormsg', ucfirst($group_title).' Settings updated sucessfully!');
108
-			redirect(base_url() . 'systems/configuration/'.$group_title);
109
-		}else{
108
+			redirect(base_url().'systems/configuration/'.$group_title);
109
+		} else {
110 110
 	 	$this->load->view('view_systemconf', $data);
111 111
 	}
112 112
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
167 167
 			 $account_data = $this->session->userdata("accountinfo");
168 168
 			 $reseller = $account_data['id'];
169
-			 $this->resellertemplate_save($add_array,$reseller);
169
+			 $this->resellertemplate_save($add_array, $reseller);
170 170
 		}
171 171
 		else
172 172
 		{
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 		}
175 175
 	}
176 176
     
177
-	function resellertemplate_save($data,$resellerid)
177
+	function resellertemplate_save($data, $resellerid)
178 178
 	{
179
-		$where = array('name' => $data['name'],'reseller_id'=>$resellerid);
179
+		$where = array('name' => $data['name'], 'reseller_id'=>$resellerid);
180 180
 		$count = $this->db_model->countQuery("*", "default_templates", $where);
181 181
 		$data['form'] = $this->form->build_form($this->system_form->get_template_form_fields(), $data);
182
-		if($count >0)
182
+		if ($count > 0)
183 183
 		{
184 184
 			$data['page_title'] = 'Edit Template';
185 185
 			if ($this->form_validation->run() == FALSE) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 
189 189
 				$this->system_model->edit_resellertemplate($data, $data['id']);
190 190
 				$this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!');
191
-				redirect(base_url() . 'systems/template/');
191
+				redirect(base_url().'systems/template/');
192 192
 				exit;
193 193
 			}
194 194
 		} else {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				 $data['reseller_id'] = $resellerid;
200 200
 				$this->system_model->add_resellertemplate($data);
201 201
 				$this->session->set_flashdata('astpp_errormsg', 'Template added successfully!');
202
-				redirect(base_url() . 'systems/template/');
202
+				redirect(base_url().'systems/template/');
203 203
 				exit;
204 204
 			}
205 205
 		}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				 unset($data['page_title']);
218 218
 				$this->system_model->edit_template($data, $data['id']);
219 219
 				$this->session->set_flashdata('astpp_errormsg', 'Template updated successfully!');
220
-				redirect(base_url() . 'systems/template/');
220
+				redirect(base_url().'systems/template/');
221 221
 				exit;
222 222
 			}
223 223
 		} else {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 				 unset($data['form']);
229 229
 				$this->system_model->add_template($data);
230 230
 				$this->session->set_flashdata('astpp_errormsg', 'Template added successfully!');
231
-				redirect(base_url() . 'systems/template/');
231
+				redirect(base_url().'systems/template/');
232 232
 				exit;
233 233
 			}
234 234
 		}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			$this->session->set_userdata('template_search', $action);
246 246
 		}
247 247
 		if (@$ajax_search != 1) {
248
-			redirect(base_url() . 'systems/template/');
248
+			redirect(base_url().'systems/template/');
249 249
 		}
250 250
 	}
251 251
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			$this->session->set_userdata('country_list_search', $action);
294 294
 		}
295 295
 		if (@$ajax_search != 1) {
296
-			redirect(base_url() . 'systems/country_list/');
296
+			redirect(base_url().'systems/country_list/');
297 297
 		}
298 298
 	}
299 299
 
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
     
353 353
 	function country_remove($id) {
354 354
 		$this->system_model->remove_country($id);
355
-		$country=$this->common->get_field_name('country','countrycode',$id);
355
+		$country = $this->common->get_field_name('country', 'countrycode', $id);
356 356
 		$this->session->set_flashdata('astpp_notification', $country.'Country removed successfully!');
357
-		redirect(base_url() . 'systems/country_list/');
357
+		redirect(base_url().'systems/country_list/');
358 358
 	}
359 359
 
360 360
 	function country_delete_multiple() {
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			$this->session->set_userdata('currency_list_search', $action);
406 406
 		}
407 407
 		if (@$ajax_search != 1) {
408
-			redirect(base_url() . 'systems/currency_list/');
408
+			redirect(base_url().'systems/currency_list/');
409 409
 		}
410 410
 	}
411 411
 
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 	}
465 465
     
466 466
 	 function currency_remove($id) {
467
-		$currencyname=$this->common->get_field_name('currencyname','currency',$id);
467
+		$currencyname = $this->common->get_field_name('currencyname', 'currency', $id);
468 468
 		$this->system_model->remove_currency($id);
469
-		$this->session->set_flashdata('astpp_notification',$currencyname. ' Currency removed successfully!');
470
-		redirect(base_url() . 'systems/currency_list/');
469
+		$this->session->set_flashdata('astpp_notification', $currencyname.' Currency removed successfully!');
470
+		redirect(base_url().'systems/currency_list/');
471 471
 	}
472 472
 
473 473
 	function currency_delete_multiple() {
@@ -478,53 +478,53 @@  discard block
 block discarded – undo
478 478
 	}
479 479
 	function database_backup()
480 480
 	{
481
-		$data=array();
481
+		$data = array();
482 482
 		$data['username'] = $this->session->userdata('user_name');
483 483
 		$data['page_title'] = 'Database Backup';
484
-		$filename=$this->db->database."_".date("YmdHms").".sql.gz";
484
+		$filename = $this->db->database."_".date("YmdHms").".sql.gz";
485 485
 		$data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($filename), '');
486 486
 		$this->load->view('view_database_backup', $data);
487 487
 	}
488 488
 	function database_backup_save()
489 489
 	{ 
490 490
 
491
-	  $add_array=$this->input->post();
491
+	  $add_array = $this->input->post();
492 492
       
493
-	  $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'],$add_array['id']),$add_array);
493
+	  $data['form'] = $this->form->build_form($this->system_form->get_backup_database_form_fields($add_array['path'], $add_array['id']), $add_array);
494 494
 	  $data['page_title'] = 'Database Backup';
495
-	  if($add_array['id'] != ''){
495
+	  if ($add_array['id'] != '') {
496 496
       
497
-	  }else{
498
-		   if($this->form_validation->run() == FALSE) {
497
+	  } else {
498
+		   if ($this->form_validation->run() == FALSE) {
499 499
 				$data['validation_errors'] = validation_errors();
500 500
 				echo $data['validation_errors'];
501 501
 				exit;
502
-		  }else{
502
+		  } else {
503 503
 			 $db_name     = $this->db->database;
504 504
 			 $db_username = $this->db->username;
505 505
 			 $db_password = $this->db->password;
506 506
 			 $db_hostname = $this->db->hostname;
507 507
 			 $filename = $add_array['path'];
508
-			 $backup_file=DATABASE_DIRECTORY.$filename;
509
-			if (substr($backup_file,-3)=='.gz'){
510
-				  $backup_file = substr($backup_file,0,-3);
511
-				  $do_gzip=1;
508
+			 $backup_file = DATABASE_DIRECTORY.$filename;
509
+			if (substr($backup_file, -3) == '.gz') {
510
+				  $backup_file = substr($backup_file, 0, -3);
511
+				  $do_gzip = 1;
512 512
 			}
513 513
 
514
-		   $run_backup="/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'";
515
-		   $error_zip=0;
516
-		   exec($run_backup,$output,$error);
517
-		   if ($do_gzip){
514
+		   $run_backup = "/usr/bin/mysqldump -all --databases ".$db_name." -u'".$db_username."' -p'".$db_password."' > '$backup_file'";
515
+		   $error_zip = 0;
516
+		   exec($run_backup, $output, $error);
517
+		   if ($do_gzip) {
518 518
 			  $gzip = $this->config->item('gzip-path');
519 519
 			  $run_gzip = $gzip." ".$backup_file;
520
-			  exec($run_gzip,$output,$error_zip);
520
+			  exec($run_gzip, $output, $error_zip);
521 521
 		   }
522 522
           
523
-		   if($error == 0 && $error_zip == 0 ){      
523
+		   if ($error == 0 && $error_zip == 0) {      
524 524
 			  $this->system_model->backup_insert($add_array);
525 525
 			  echo json_encode(array("SUCCESS"=> $add_array['backup_name']." backup exported successfully!"));
526 526
 			  exit;
527
-		   }else{
527
+		   } else {
528 528
 				echo 'An error occur when the system tried to backup of the database. Please check yours system settings for the backup section';
529 529
 				exit;
530 530
 		   }
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	{
542 542
 	$json_data = array();
543 543
 		$count_all = $this->system_model->getbackup_list(false, "", "");
544
-		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'],$_GET['page']);
544
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
545 545
 		$json_data = $paging_data["json_paging"];
546 546
 
547 547
 		$query = $this->system_model->getbackup_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
@@ -551,56 +551,56 @@  discard block
 block discarded – undo
551 551
 		echo json_encode($json_data);
552 552
 	exit;
553 553
 	}
554
-	function database_restore_one($id='')
554
+	function database_restore_one($id = '')
555 555
 	{
556 556
 	   $result = $this->system_model->get_backup_data($id);
557
-	   $result_array=$result->result_array();
558
-	   if($result->num_rows() > 0)
557
+	   $result_array = $result->result_array();
558
+	   if ($result->num_rows() > 0)
559 559
 	   {
560 560
 			$db_name     = $this->db->database;
561 561
 			$db_username = $this->db->username;
562 562
 			$db_password = $this->db->password;
563 563
 			$db_hostname = $this->db->hostname;            
564
-			$path=DATABASE_DIRECTORY.$result_array[0]['path'];
565
-			if(file_exists($path)){
566
-			  if (substr($path,-3)=='.gz') {
564
+			$path = DATABASE_DIRECTORY.$result_array[0]['path'];
565
+			if (file_exists($path)) {
566
+			  if (substr($path, -3) == '.gz') {
567 567
 							$GUNZIP_EXE = $this->config->item('gunzip-path');
568 568
 							$run_gzip = $GUNZIP_EXE." < ".$path." | ";
569 569
 			  }
570
-			  $MYSQL="/usr/bin/mysql";
570
+			  $MYSQL = "/usr/bin/mysql";
571 571
 			  $run_restore = $run_gzip.$MYSQL." -h".$db_hostname." -u".$db_username." -p".$db_password." ".$db_name;
572 572
 			  exec($run_restore);
573 573
 			  $this->session->set_flashdata('astpp_errormsg', 'Database Restore successfully.');
574
-			  redirect(base_url() . 'systems/database_restore/');
575
-			}else{
574
+			  redirect(base_url().'systems/database_restore/');
575
+			} else {
576 576
 			  $this->session->set_flashdata('astpp_notification', 'File not exists!');
577
-			  redirect(base_url() . 'systems/database_restore/');
577
+			  redirect(base_url().'systems/database_restore/');
578 578
 			}
579 579
 	  }
580
-	  redirect(base_url() . 'systems/database_restore/');
580
+	  redirect(base_url().'systems/database_restore/');
581 581
 	}
582 582
 
583
- function database_download($id=''){
583
+ function database_download($id = '') {
584 584
     
585 585
 	$result = $this->system_model->get_backup_data($id);
586
-	$result_array=$result->result_array();
587
-	if($result->num_rows() > 0)
586
+	$result_array = $result->result_array();
587
+	if ($result->num_rows() > 0)
588 588
 	{
589
-	  $path=$result_array[0]['path'];
589
+	  $path = $result_array[0]['path'];
590 590
 	  $filename = basename($path);
591 591
 	  $len = filesize($path);
592 592
       
593 593
 	  header("Content-Encoding: binary");
594 594
 	  header("Content-Type: application/octet-stream");
595
-	  header( "content-length: " . $len );
596
-	  header( "content-disposition: attachment; filename=" . $filename );
595
+	  header("content-length: ".$len);
596
+	  header("content-disposition: attachment; filename=".$filename);
597 597
 	  header("Expires: 0");
598 598
 	  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
599 599
 	  header("Cache-Control: private");
600 600
 	  header("Pragma: public");
601 601
 	  ob_clean();
602
-	  $fp=fopen( $path, "r" );
603
-	  fpassthru( $fp );
602
+	  $fp = fopen($path, "r");
603
+	  fpassthru($fp);
604 604
 	  exit;
605 605
 	}
606 606
 	}
@@ -614,17 +614,17 @@  discard block
 block discarded – undo
614 614
    function database_import_file()
615 615
 	{
616 616
 		$filename = $_POST['fname'];
617
-		$upload_greeting_file= $_FILES['userfile']['name'];
618
-		$db_file = explode(".",$upload_greeting_file); 
619
-		if( $db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql'){
620
-			$target_path = basename( $_FILES['userfile']['name']);
621
-			move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path );
617
+		$upload_greeting_file = $_FILES['userfile']['name'];
618
+		$db_file = explode(".", $upload_greeting_file); 
619
+		if ($db_file[1] == 'csv' || $db_file[1] == 'tar' || $db_file[1] == 'sql') {
620
+			$target_path = basename($_FILES['userfile']['name']);
621
+			move_uploaded_file($_FILES["userfile"]["tmp_name"], $target_path);
622 622
           
623
-			$query = $this->system_model->import_database($filename,$_FILES['userfile']['name']);
624
-			$this->session->set_flashdata('astpp_errormsg',"The file ".  basename( $_FILES['userfile']['name'])." has been uploaded");
623
+			$query = $this->system_model->import_database($filename, $_FILES['userfile']['name']);
624
+			$this->session->set_flashdata('astpp_errormsg', "The file ".basename($_FILES['userfile']['name'])." has been uploaded");
625 625
 			redirect(base_url()."systems/database_restore/");            
626
-		}else{
627
-			$this->session->set_flashdata('astpp_notification',"There is a some issue or invalid file format.");
626
+		} else {
627
+			$this->session->set_flashdata('astpp_notification', "There is a some issue or invalid file format.");
628 628
 			redirect(base_url()."systems/database_restore/");            
629 629
 		}
630 630
 	}
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 	  $this->db->where($where);
635 635
 	  $this->db->delete("backup_database");
636 636
 	  $this->session->set_flashdata('astpp_errormsg', 'Database backup deleted successfully.');      
637
-	  redirect(base_url() . 'systems/database_restore/');
637
+	  redirect(base_url().'systems/database_restore/');
638 638
 	  return true;
639 639
 	}
640 640
 	function database_backup_delete_multiple() {
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/models/pricing_model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		/*
50 50
         ASTPP  3.0  Add Rategroup add creation date.
51 51
         */
52
-		$add_array['creation_date']=gmdate("Y-m-d H:i:s");
52
+		$add_array['creation_date'] = gmdate("Y-m-d H:i:s");
53 53
 		/************************************/
54 54
 		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
55 55
 			$account_data = $this->session->userdata("accountinfo");
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		/*
68 68
         ASTPP  3.0  Edit Rategroup time update last mofied date.
69 69
         */
70
-		$data['last_modified_date']=gmdate("Y-m-d H:i:s");
70
+		$data['last_modified_date'] = gmdate("Y-m-d H:i:s");
71 71
 		/*********************************************************/
72 72
 		$this->db->where("id", $id);
73 73
 		$this->db->update("pricelists", $data);
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/controllers/pricing.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$this->load->model('pricing_model');
34 34
 
35 35
 		if ($this->session->userdata('user_login') == FALSE)
36
-			redirect(base_url() . '/astpp/login');
36
+			redirect(base_url().'/astpp/login');
37 37
 	}
38 38
 
39 39
 	function price_add($type = "") {
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 		foreach ($account->result_array() as $key => $value) {
53 53
 			$edit_data = $value;
54 54
 		}
55
-	$routing_data = $this->db_model->getSelect("trunk_id", "routing",array("pricelist_id"=>$edit_id));
56
-	if($routing_data->num_rows > 0){
57
-	  foreach($routing_data->result_array() as $trunkid){
55
+	$routing_data = $this->db_model->getSelect("trunk_id", "routing", array("pricelist_id"=>$edit_id));
56
+	if ($routing_data->num_rows > 0) {
57
+	  foreach ($routing_data->result_array() as $trunkid) {
58 58
 		$edit_data["trunk_id"][] = $trunkid["trunk_id"];
59 59
 	  }
60 60
 	}
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
 				exit;
85 85
 			}
86 86
 			$this->load->view('view_price_add_edit', $data);
87
-	   }else {
87
+	   } else {
88 88
 			$data['page_title'] = 'Create Price Details';
89 89
 			if ($this->form_validation->run() == FALSE) {
90 90
 				$data['validation_errors'] = validation_errors();
91 91
 				echo $data['validation_errors'];
92 92
 				exit;
93 93
 			} else {
94
-		if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id']))
95
-				$trunk_id=$add_array['trunk_id'];
94
+		if (isset($add_array['trunk_id']) && ! empty($add_array['trunk_id']))
95
+				$trunk_id = $add_array['trunk_id'];
96 96
 				unset($add_array['trunk_id']);
97
-				$priceid=$this->pricing_model->add_price($add_array);
98
-		if(isset($trunk_id) && $trunk_id != ''){
99
-		  $this->set_force_routing($priceid,$trunk_id);
97
+				$priceid = $this->pricing_model->add_price($add_array);
98
+		if (isset($trunk_id) && $trunk_id != '') {
99
+		  $this->set_force_routing($priceid, $trunk_id);
100 100
 		}
101 101
 				echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!"));
102 102
 				exit;
103 103
 			}
104 104
 		}
105 105
 	}
106
-	function set_force_routing($priceid,$trunkid){
106
+	function set_force_routing($priceid, $trunkid) {
107 107
 // 	echo "<pre>".$priceid; print_r($trunkid);
108
-	foreach($trunkid as $id){
108
+	foreach ($trunkid as $id) {
109 109
 	  $routing_arr = array("trunk_id" => $id, "pricelist_id"=>$priceid);
110
-	  $this->db->insert("routing",$routing_arr);
110
+	  $this->db->insert("routing", $routing_arr);
111 111
 	}
112 112
 	}
113 113
 	function price_list_search() {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			$this->session->set_userdata('price_list_search', $action);
122 122
 		}
123 123
 		if (@$ajax_search != 1) {
124
-			redirect(base_url() . 'accounts/customer_list/');
124
+			redirect(base_url().'accounts/customer_list/');
125 125
 		}
126 126
 	}
127 127
 
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	function price_delete($pricelist_id) {
162 162
 		$where = array("id" => $pricelist_id);
163 163
 		$this->db_model->update("pricelists", array("status" => "2"), $where);
164
-	$this->db->delete("routing",array("pricelist_id"=>$pricelist_id));
164
+	$this->db->delete("routing", array("pricelist_id"=>$pricelist_id));
165 165
 		$this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!');
166
-		redirect(base_url() . 'pricing/price_list/');
166
+		redirect(base_url().'pricing/price_list/');
167 167
 	}
168 168
 
169 169
  function price_delete_multiple() {
@@ -173,59 +173,59 @@  discard block
 block discarded – undo
173 173
 			$update_data = array('status' => '2');
174 174
 			$this->db->where('pricelist_id '.$where);
175 175
 			$this->db->delete('routes');            
176
-			$this->db->delete("routing",array("pricelist_id"=>$where));
176
+			$this->db->delete("routing", array("pricelist_id"=>$where));
177 177
 			$this->db->where('id '.$where);
178 178
 			echo $this->db->update('pricelists', $update_data);
179 179
 		} else {
180
-			$pricelist_arr=array();
180
+			$pricelist_arr = array();
181 181
 			//Get selected Rategroup Name from database.
182 182
 			$this->db->select('id,name');
183 183
 			$this->db->where('id '.$where);
184
-			$pricelist_res=$this->db->get('pricelists');
185
-			$pricelist_res=$pricelist_res->result_array();
186
-			foreach($pricelist_res as $value){
187
-				$pricelist_arr[$value['id']]['name']=$value['name'];
184
+			$pricelist_res = $this->db->get('pricelists');
185
+			$pricelist_res = $pricelist_res->result_array();
186
+			foreach ($pricelist_res as $value) {
187
+				$pricelist_arr[$value['id']]['name'] = $value['name'];
188 188
 			}
189 189
 			//Get count of accounts which are using selected rategroups.
190 190
 			$this->db->where('pricelist_id '.$where);
191
-			$this->db->where('deleted',0);
191
+			$this->db->where('deleted', 0);
192 192
 			$this->db->select('count(id) as cnt,pricelist_id');
193 193
 			$this->db->group_by('pricelist_id');
194
-			$account_res=$this->db->get('accounts');
195
-			if($account_res->num_rows() > 0){
196
-			 $account_res=$account_res->result_array();
197
-			 foreach($account_res as $key=>$value){
198
-				$pricelist_arr[$value['pricelist_id']]['account']=$value['cnt'];
194
+			$account_res = $this->db->get('accounts');
195
+			if ($account_res->num_rows() > 0) {
196
+			 $account_res = $account_res->result_array();
197
+			 foreach ($account_res as $key=>$value) {
198
+				$pricelist_arr[$value['pricelist_id']]['account'] = $value['cnt'];
199 199
 			 }
200 200
 			}
201 201
 			//Get count of routes which are using selected rategroups.
202 202
 			$this->db->where('pricelist_id '.$where);
203 203
 			$this->db->select('count(id) as cnt,pricelist_id');
204 204
 			$this->db->group_by('pricelist_id');
205
-			$routes_res=$this->db->get('routes');
206
-			if($routes_res->num_rows() > 0){
207
-			 $routes_res=$routes_res->result_array();
208
-			 foreach($routes_res as $key=>$value){
209
-				$pricelist_arr[$value['pricelist_id']]['routes']=$value['cnt'];
205
+			$routes_res = $this->db->get('routes');
206
+			if ($routes_res->num_rows() > 0) {
207
+			 $routes_res = $routes_res->result_array();
208
+			 foreach ($routes_res as $key=>$value) {
209
+				$pricelist_arr[$value['pricelist_id']]['routes'] = $value['cnt'];
210 210
 			 }
211 211
 			}
212
-			$str=null;
213
-			foreach($pricelist_arr as $key=>$value){
214
-			   $custom_str=null;
215
-			   if(isset($value['account']) || isset($value['routes'])){
216
-				 if(isset($value['account'])){
217
-					 $custom_str.= $value['account']." accounts and ";
212
+			$str = null;
213
+			foreach ($pricelist_arr as $key=>$value) {
214
+			   $custom_str = null;
215
+			   if (isset($value['account']) || isset($value['routes'])) {
216
+				 if (isset($value['account'])) {
217
+					 $custom_str .= $value['account']." accounts and ";
218 218
 				 }
219
-				 if(isset($value['routes'])){
220
-					 $custom_str.= $value['routes']." origination rates and ";
219
+				 if (isset($value['routes'])) {
220
+					 $custom_str .= $value['routes']." origination rates and ";
221 221
 				 }
222
-				 $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n";
222
+				 $str .= " Rate group Name : ".$value['name']." using by ".rtrim($custom_str, " and ")."\n";
223 223
 			   }
224 224
 			}
225
-			if(!empty($str)){
226
-				$data['str']=$str;
225
+			if ( ! empty($str)) {
226
+				$data['str'] = $str;
227 227
 			}    
228
-			$data['selected_ids']=$add_array['selected_ids'];
228
+			$data['selected_ids'] = $add_array['selected_ids'];
229 229
 			echo json_encode($data);
230 230
 		}
231 231
 	}
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/libraries/pricing_form.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 
24
-if (!defined('BASEPATH'))
24
+if ( ! defined('BASEPATH'))
25 25
 	exit('No direct script access allowed');
26 26
 
27 27
 class pricing_form {
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 		$this->CI = & get_instance();
30 30
 	}
31 31
 	function get_pricing_form_fields() {
32
-	$form['forms'] = array(base_url() . 'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form'));
32
+	$form['forms'] = array(base_url().'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form'));
33 33
 		if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
34 34
 		$form['Rate Group Information'] = array(
35 35
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
36 36
 		array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
37
-		array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
37
+		array('Name', 'INPUT', array('name' => 'name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
38 38
 		array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_routetype'),
39 39
 		array('Initial Increment', 'INPUT', array('name' => 'initially_increment', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
-		array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
41
-		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0" ,  'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
40
+		array('Default Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
41
+		array('Markup(%)', 'INPUT', array('name' => 'markup', 'value' => "0", 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
42 42
 		array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status'),
43 43
 		);
44 44
 	}
45
-	else{
45
+	else {
46 46
 	  $form['Rate Group Information'] = array(
47 47
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
48 48
 		array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
             */
88 88
 	function build_pricing_list_for_admin() {
89 89
 		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
90
-		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
90
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"),
91 91
 /**
92 92
 ASTPP  3.0 
93 93
 For Rategroup edit on Name
94 94
 **/
95
-			array(gettext("Name"), "110", "name", "", "", "","EDITABLE","true","center"),
95
+			array(gettext("Name"), "110", "name", "", "", "", "EDITABLE", "true", "center"),
96 96
 /***************************************/
97 97
 			array(gettext("Routing Type"), "120", "routing_type", "routing_type", "routing_type", "get_routetype"),
98
-		array(gettext("Initial Increment"), "140", "initially_increment", "", "", "","","true","center"),
99
-			array("Default Increment", "140", "inc", "", "", "","","true","center"),
100
-			array(gettext("Markup(%)"), "100", "markup", "", "", "","","true","center"),
101
-		array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count","","true","center"),
102
-			array(gettext("Status"), "110", "status", "id", "pricelists", "get_status","","true","center"),
103
-			array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
104
-			array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
98
+		array(gettext("Initial Increment"), "140", "initially_increment", "", "", "", "", "true", "center"),
99
+			array("Default Increment", "140", "inc", "", "", "", "", "true", "center"),
100
+			array(gettext("Markup(%)"), "100", "markup", "", "", "", "", "true", "center"),
101
+		array(gettext("Rate Count"), "100", "id", "pricelist_id", "routes", "get_field_count", "", "true", "center"),
102
+			array(gettext("Status"), "110", "status", "id", "pricelists", "get_status", "", "true", "center"),
103
+			array(gettext("Created Date"), "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"),
104
+			array(gettext("Modified Date"), "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"),
105 105
 			array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"),
106 106
 
107 107
 					"DELETE" => array("url" => "pricing/price_delete/", "mode" => "single")))
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 	function build_grid_buttons() {
113
-		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn" ,"fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"),
114
-			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/")
113
+		$buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/pricing/price_add/", "popup"),
114
+			array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/pricing/price_delete_multiple/")
115 115
 			));
116 116
 		return $buttons_json;
117 117
 	}
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/models/refill_coupon_model.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -27,80 +27,80 @@
 block discarded – undo
27 27
 	function refill_coupon_model() {
28 28
 		parent::__construct();
29 29
 	}
30
-	function get_refill_coupon_list($flag,$start = 0, $limit = 0,$export=false){
30
+	function get_refill_coupon_list($flag, $start = 0, $limit = 0, $export = false) {
31 31
 		$this->db_model->build_search('refill_coupon_list_search');
32
-		$accountinfo=$this->session->userdata('accountinfo');
33
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : 0;
34
-		$where=array('reseller_id'=>$reseller_id);
32
+		$accountinfo = $this->session->userdata('accountinfo');
33
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
34
+		$where = array('reseller_id'=>$reseller_id);
35 35
 		if ($flag) {
36
-		if($export)
37
-		  $query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC",'','');
36
+		if ($export)
37
+		  $query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", '', '');
38 38
 		else
39
-		$query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start);
39
+		$query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start);
40 40
 		} else {
41
-			$query = $this->db_model->countQuery("*", "refill_coupon",$where);
41
+			$query = $this->db_model->countQuery("*", "refill_coupon", $where);
42 42
 		}
43 43
 		return $query;
44 44
 	}
45
-	function get_customer_refill_coupon_list($flag,$start = 0, $limit = 0,$accountid){
45
+	function get_customer_refill_coupon_list($flag, $start = 0, $limit = 0, $accountid) {
46 46
 		$this->db_model->build_search('refill_coupon_list_search');
47
-		$accountinfo=$this->session->userdata('accountinfo');
48
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id'] : ($accountinfo['type']== 0 ? $accountinfo['reseller_id']: 0 );
49
-		$where=array('reseller_id'=>$reseller_id,"account_id"=>$accountid);
47
+		$accountinfo = $this->session->userdata('accountinfo');
48
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : ($accountinfo['type'] == 0 ? $accountinfo['reseller_id'] : 0);
49
+		$where = array('reseller_id'=>$reseller_id, "account_id"=>$accountid);
50 50
 		if ($flag) {
51
-		$query = $this->db_model->select("*", "refill_coupon",$where, "id", "ASC", $limit, $start);
51
+		$query = $this->db_model->select("*", "refill_coupon", $where, "id", "ASC", $limit, $start);
52 52
 		} else {
53
-			$query = $this->db_model->countQuery("*", "refill_coupon",$where);
53
+			$query = $this->db_model->countQuery("*", "refill_coupon", $where);
54 54
 		}
55 55
 		return $query;
56 56
 	}
57
-	function add_refill_coupon($add_array){
57
+	function add_refill_coupon($add_array) {
58 58
 	  $count = $add_array['count'];
59 59
 		unset($add_array['action']);
60 60
 		unset($add_array['count']);
61
-		$prefix=$add_array['prefix'];
61
+		$prefix = $add_array['prefix'];
62 62
 		unset($add_array['prefix']);
63
-		$accountinfo=$this->session->userdata('accountinfo');
64
-		$reseller_id=$accountinfo['type']==1 ? $accountinfo['id']:0;
65
-		$insert_arr=array();
66
-		$account_length=Common_model::$global_config['system_config']['refill_coupon_length'];
67
-		$length=strlen($prefix);
68
-		if($length !=0){
69
-	  $number_length=$account_length-$length;
70
-	} else{
71
-	  $number_length=$account_length;
63
+		$accountinfo = $this->session->userdata('accountinfo');
64
+		$reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
65
+		$insert_arr = array();
66
+		$account_length = Common_model::$global_config['system_config']['refill_coupon_length'];
67
+		$length = strlen($prefix);
68
+		if ($length != 0) {
69
+	  $number_length = $account_length - $length;
70
+	} else {
71
+	  $number_length = $account_length;
72 72
 	}
73 73
 	$add_array['amount'] = $this->common_model->add_calculate_currency($add_array['amount'], '', '', false, false);
74
-	$number=$this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon',$prefix,$count);
75
-	$date=gmdate('Y-m-d H:i:s');
74
+	$number = $this->common->find_uniq_rendno_accno($number_length, 'number', 'refill_coupon', $prefix, $count);
75
+	$date = gmdate('Y-m-d H:i:s');
76 76
 		for ($i = 0; $i < $count; $i++) {
77 77
 			$add_array['number'] = trim($number[$i]);
78
-		$add_array['currency_id']=$accountinfo['currency_id'];
79
-		$add_array['reseller_id']=$reseller_id;
80
-		$add_array['creation_date']=$date;
81
-		$insert_arr[$i]=$add_array;
78
+		$add_array['currency_id'] = $accountinfo['currency_id'];
79
+		$add_array['reseller_id'] = $reseller_id;
80
+		$add_array['creation_date'] = $date;
81
+		$insert_arr[$i] = $add_array;
82 82
 		}
83
-		$this->db->insert_batch("refill_coupon",$insert_arr);
83
+		$this->db->insert_batch("refill_coupon", $insert_arr);
84 84
 		return true;
85 85
 	}
86
-	function remove_refill_coupon($id){
86
+	function remove_refill_coupon($id) {
87 87
 		$this->db->where("id", $id);
88 88
 		$this->db->delete("refill_coupon");
89 89
 		return true;
90 90
 	}
91
-	function get_refill_coupon_details($id){
91
+	function get_refill_coupon_details($id) {
92 92
 	   $this->db->where("id", $id);
93
-	   $result=$this->db->get('refill_coupon');
93
+	   $result = $this->db->get('refill_coupon');
94 94
 	   return $result;
95 95
 	}
96
-	function refill_coupon_count($add_array){
97
-		$account_length=Common_model::$global_config['system_config']['refill_coupon_length'];
98
-		$this->db->where("length(number)",$account_length);
99
-		$this->db->like('number',$add_array['prefix'],'after');
96
+	function refill_coupon_count($add_array) {
97
+		$account_length = Common_model::$global_config['system_config']['refill_coupon_length'];
98
+		$this->db->where("length(number)", $account_length);
99
+		$this->db->like('number', $add_array['prefix'], 'after');
100 100
 		$this->db->select("count(id) as count");
101 101
 		$this->db->from('refill_coupon');
102
-		$result=$this->db->get();
103
-		$result=$result->result_array();
102
+		$result = $this->db->get();
103
+		$result = $result->result_array();
104 104
 	return $result;
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/controllers/refill_coupon.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 class Refill_coupon extends MX_Controller {
26 26
     
27
-	function Refill_coupon(){
27
+	function Refill_coupon() {
28 28
 		  parent::__construct();
29 29
 		  $this->load->helper('template_inheritance');
30 30
 		  $this->load->helper('form');
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 		  $this->load->library("astpp/form");
34 34
 		  $this->load->library("session");
35 35
 		  if ($this->session->userdata('user_login') == FALSE)
36
-			redirect(base_url() . 'login/login');
36
+			redirect(base_url().'login/login');
37 37
 	  }
38
-	function refill_coupon_list(){
39
-	if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){
40
-			redirect(base_url() . 'user/user/');
38
+	function refill_coupon_list() {
39
+	if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) {
40
+			redirect(base_url().'user/user/');
41 41
 	}
42 42
 		$data['username'] = $this->session->userdata('user_name');
43 43
 		$data['page_title'] = gettext('Refill Coupon');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form());
50 50
 		$this->load->view('view_refill_coupon_list', $data);
51 51
 	}
52
-	function refill_coupon_list_json(){
52
+	function refill_coupon_list_json() {
53 53
 	$json_data = array();
54 54
 		$count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", "");
55 55
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
60 60
 		echo json_encode($json_data);
61 61
 	}   
62
-	function refill_coupon_list_search(){
62
+	function refill_coupon_list_search() {
63 63
 		$ajax_search = $this->input->post('ajax_search', 0);
64 64
 		if ($this->input->post('advance_search', TRUE) == 1) {
65 65
 			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 			$this->session->set_userdata('refill_coupon_list_search', $action);
73 73
 		}
74 74
 		if (@$ajax_search != 1) {
75
-			redirect(base_url() . 'refill_coupon/refill_coupon_list/');
75
+			redirect(base_url().'refill_coupon/refill_coupon_list/');
76 76
 		}
77 77
 	}
78
-	function refill_coupon_clearsearchfilter(){
78
+	function refill_coupon_clearsearchfilter() {
79 79
 	$this->session->set_userdata('advance_search', 0);
80 80
 		$this->session->set_userdata('refill_coupon_list_search', "");
81 81
 	}
82
-	function refill_coupon_list_view($id){
82
+	function refill_coupon_list_view($id) {
83 83
 	$data['username'] = $this->session->userdata('user_name');
84 84
 		$data['page_title'] = 'View Refill Coupon';
85 85
 		if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) {
86
-		$refill_coupon_details=$cc->result_array();
87
-		$data['refill_coupon_details']=$refill_coupon_details[0];
88
-			$data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']);
89
-			$data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']);
86
+		$refill_coupon_details = $cc->result_array();
87
+		$data['refill_coupon_details'] = $refill_coupon_details[0];
88
+			$data['refill_coupon_details']['callingcard'] = $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']);
89
+			$data['refill_coupon_details']['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']);
90 90
 		} else {
91 91
 			echo "This card is not available.";
92 92
 			return;
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     
96 96
 	}
97 97
 	function refill_coupon_add() {
98
-	if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){
99
-			redirect(base_url() . 'user/user/');
98
+	if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) {
99
+			redirect(base_url().'user/user/');
100 100
 	}
101 101
 		$data['username'] = $this->session->userdata('user_name');
102 102
 		$data['flag'] = 'create';
@@ -105,16 +105,16 @@  discard block
 block discarded – undo
105 105
 		$this->load->view('view_refill_coupon_add', $data);
106 106
 	}
107 107
 	function refill_coupon_save() {
108
-		$account_length=Common_model::$global_config['system_config']['refill_coupon_length'];
108
+		$account_length = Common_model::$global_config['system_config']['refill_coupon_length'];
109 109
 		$add_array = $this->input->post();
110
-		$add_array['status']=0;
110
+		$add_array['status'] = 0;
111 111
 		$data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array);
112
-	$result=$this->refill_coupon_model->refill_coupon_count($add_array);
113
-		$count=$result[0]['count'];
114
-		$remaining_length =0;
115
-		$remaining_length=$account_length - strlen($add_array['prefix']);
116
-		$currentlength =pow(5,$remaining_length);
117
-		$currentlength=$currentlength-$count;
112
+	$result = $this->refill_coupon_model->refill_coupon_count($add_array);
113
+		$count = $result[0]['count'];
114
+		$remaining_length = 0;
115
+		$remaining_length = $account_length - strlen($add_array['prefix']);
116
+		$currentlength = pow(5, $remaining_length);
117
+		$currentlength = $currentlength - $count;
118 118
 		$data['page_title'] = 'Add Refill Coupon';
119 119
 		if ($this->form_validation->run() == FALSE) {
120 120
 				$data['validation_errors'] = validation_errors();
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 				exit;
123 123
 		}
124 124
 		else {    
125
-		  if($account_length<=strlen($add_array['prefix'])){
125
+		  if ($account_length <= strlen($add_array['prefix'])) {
126 126
 			  echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix."));
127 127
 			  exit;      
128 128
 		  }
129
-		  if($currentlength <= 0){
129
+		  if ($currentlength <= 0) {
130 130
 			echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix"));
131 131
 			exit;  
132 132
 		  }
133
-		  if($currentlength > 0 && $add_array['count'] > $currentlength){
133
+		  if ($currentlength > 0 && $add_array['count'] > $currentlength) {
134 134
 			echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix"));
135 135
 			exit;      
136
-		  }else{
136
+		  } else {
137 137
 			$this->refill_coupon_model->add_refill_coupon($add_array);
138 138
 			echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!"));
139 139
 			exit;
@@ -143,26 +143,26 @@  discard block
 block discarded – undo
143 143
 	function refill_coupon_list_delete($id) {
144 144
 		$this->refill_coupon_model->remove_refill_coupon($id);
145 145
 		$this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!');
146
-		redirect(base_url() . 'refill_coupon/refill_coupon_list/');
146
+		redirect(base_url().'refill_coupon/refill_coupon_list/');
147 147
 	}
148
-	function refill_coupon_export(){
148
+	function refill_coupon_export() {
149 149
 	 $account_info = $accountinfo = $this->session->userdata('accountinfo');
150
-		$currency_id=$account_info['currency_id'];
151
-		$currency=$this->common->get_field_name('currency', 'currency', $currency_id);
152
-	$query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true);
150
+		$currency_id = $account_info['currency_id'];
151
+		$currency = $this->common->get_field_name('currency', 'currency', $currency_id);
152
+	$query = $this->refill_coupon_model->get_refill_coupon_list(true, '', '', true);
153 153
 		$cc_array = array();
154 154
 		ob_clean();
155
-		$cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date');
155
+		$cc_array[] = array('Coupon No.', 'Description', 'Account', 'Amount('.$currency.')', 'Created Date', "Used?", 'Used Date');
156 156
 		if ($query->num_rows() > 0) {
157 157
 			foreach ($query->result_array() as $row) {
158 158
 				$row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']);
159 159
 				$row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : "";
160
-				$row['status']=$this->common->get_refill_coupon_status('','',$row['status']);
160
+				$row['status'] = $this->common->get_refill_coupon_status('', '', $row['status']);
161 161
 				$cc_array[] = array(
162 162
 					$row['number'],
163 163
 					$row['description'],
164 164
 					$row['acc_name'],
165
-					$this->common->convert_to_currency('','',$row['amount']),
165
+					$this->common->convert_to_currency('', '', $row['amount']),
166 166
 					$row['creation_date'],
167 167
 					$row['status'],
168 168
 					$row['firstused']
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 			}
171 171
 		}
172 172
 		$this->load->helper('csv');
173
-		array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv');
173
+		array_to_csv($cc_array, 'refill_coupon_'.date("Y-m-d").'.csv');
174 174
 	}
175
-	function refill_coupon_customer_json($accountid){
175
+	function refill_coupon_customer_json($accountid) {
176 176
 	$json_data = array();
177
-		$count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid);
177
+		$count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "", $accountid);
178 178
 		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
179 179
 		$json_data = $paging_data["json_paging"];
180
-		$query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid);
180
+		$query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $accountid);
181 181
 		$grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid());
182 182
 		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
183 183
 		echo json_encode($json_data);
Please login to merge, or discard this patch.
astpp/application/modules/refill_coupon/libraries/refill_coupon_form.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@  discard block
 block discarded – undo
20 20
 # You should have received a copy of the GNU Affero General Public License
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23
-if (!defined('BASEPATH'))
23
+if ( ! defined('BASEPATH'))
24 24
 	exit('No direct script access allowed');
25 25
 
26 26
 class Refill_coupon_form {
27 27
 	function __construct($library_name = '') {
28 28
 		$this->CI = & get_instance();
29 29
 	}
30
-	function get_refill_coupon_form_fields(){
31
-		$form['forms'] = array(base_url() . 'refill_coupon/refill_coupon_save/',array("id" => "refill_coupon_form", "name" => "refill_coupon_form"));
30
+	function get_refill_coupon_form_fields() {
31
+		$form['forms'] = array(base_url().'refill_coupon/refill_coupon_save/', array("id" => "refill_coupon_form", "name" => "refill_coupon_form"));
32 32
 		$form['Coupon Information'] = array(
33
-		array('Description', 'INPUT', array('name' => 'description', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'),
34
-		array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
33
+		array('Description', 'INPUT', array('name' => 'description', 'size' => '20', 'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', 'Please Enter account number'),
34
+		array('Start prefix', 'INPUT', array('name' => 'prefix', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
35 35
 			array('Quantity', 'INPUT', array('name' => 'count', 'size' => '20', 'maxlength' => '5', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'),
36 36
 			array('Amount', 'INPUT', array('name' => 'amount', 'size' => '20', 'class' => "text field medium"), 'trim|required|is_numeric|greater_than[0]|xss_clean', 'tOOL TIP', 'Please Enter account number'),
37 37
 		);
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	} 
43 43
 	function build_grid_buttons_refill_coupon() {
44 44
 		$buttons_json = json_encode(array(
45
-		array(gettext("Create"),"btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/","popup"),
46
-		array(gettext("Export"),"btn btn-xing" ," fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'),
45
+		array(gettext("Create"), "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/refill_coupon/refill_coupon_add/", "popup"),
46
+		array(gettext("Export"), "btn btn-xing", " fa fa-download fa-lg", "button_action", "/refill_coupon/refill_coupon_export/", 'single'),
47 47
 		   ));
48 48
 		return $buttons_json;
49 49
 	}
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 		return $buttons_json;
54 54
 	}
55 55
 	function get_refill_coupon_search_form() {
56
-	   $accountinfo=$this->CI->session->userdata('accountinfo');
57
-	   $reseller_id=$accountinfo['type']== 1 ?$accountinfo['id'] :  0 ;
56
+	   $accountinfo = $this->CI->session->userdata('accountinfo');
57
+	   $reseller_id = $accountinfo['type'] == 1 ? $accountinfo['id'] : 0;
58 58
 		$form['forms'] = array("", array('id' => "refill_coupon_list_search"));
59 59
 		$form['Search'] = array(
60 60
 			array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''),
61
-			array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15','class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
62
-		   array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id,"type"=>"GLOBAL")),
63
-			array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15',  'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
61
+			array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
62
+		   array('Account', 'accountid', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'IF(`deleted`=1,concat( first_name, " ", last_name, " ", "(", number, ")^" ),concat( first_name, " ", last_name, " ", "(", number, ")" )) as number', 'accounts', 'build_dropdown_deleted', 'where_arr', array("reseller_id" => $reseller_id, "type"=>"GLOBAL")),
63
+			array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
64 64
 			array('Used?', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''),
65 65
              
66 66
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		$form['Search Refill Coupon'] = array(
78 78
 			array('Coupon Number', 'INPUT', array('name' => 'number[number]', '', 'id' => 'number', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'number[number-string]', '', '', '', 'search_string_type', ''),
79 79
 			array('Description', 'INPUT', array('name' => 'description[description]', '', 'id' => 'description', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'description[description-string]', '', '', '', 'search_string_type', ''),
80
-			array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15',  'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
80
+			array('Amount', 'INPUT', array('name' => 'amount[amount]', '', 'id' => 'amount', 'size' => '15', 'class' => "text field "), '', 'tOOL TIP', '1', 'amount[amount-integer]', '', '', '', 'search_int_type', ''),
81 81
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_refill_coupon_status', '', ''),
82 82
 			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
83 83
 			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 	function build_refill_coupon_grid() {
90 90
 		
91 91
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
92
-		$currency_id=$account_info['currency_id'];
93
-		$currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
92
+		$currency_id = $account_info['currency_id'];
93
+		$currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
94 94
 		
95 95
 		$grid_field_arr = json_encode(array(
96
-			array(gettext("Coupon Number"), "150", "number", "", "", "","","true","center"),
97
-			array(gettext("Description"), "165", "description", "", "", "","","true","center"),
98
-			array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string","","true","center"),
99
-			array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency","","true","right"),
100
-			array(gettext("Created Date"), "200", "creation_date", "", "", "","","true","center"),
101
-			array(gettext("Used?"),"135","status",'status','status','get_refill_coupon_used',"","true","center"),
102
-			array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check","","true","center"),
96
+			array(gettext("Coupon Number"), "150", "number", "", "", "", "", "true", "center"),
97
+			array(gettext("Description"), "165", "description", "", "", "", "", "true", "center"),
98
+			array(gettext("Account"), "165", "account_id", "first_name,last_name,number", "accounts", "build_concat_string", "", "true", "center"),
99
+			array("Amount($currency)", "150", "amount", "amount", "amount", "convert_to_currency", "", "true", "right"),
100
+			array(gettext("Created Date"), "200", "creation_date", "", "", "", "", "true", "center"),
101
+			array(gettext("Used?"), "135", "status", 'status', 'status', 'get_refill_coupon_used', "", "true", "center"),
102
+			array(gettext("Used Date"), "180", "firstused", "firstused", "firstused", "firstused_check", "", "true", "center"),
103 103
 			array("Action", "120", "", "", "", array(
104 104
 					"DELETE" => array("url" => "refill_coupon/refill_coupon_list_delete/", "mode" => "single")
105 105
 			))
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 	function build_user_refill_coupon_grid() {
110 110
 		$account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
111
-		 $currency_id=$account_info['currency_id'];
112
-		 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
111
+		 $currency_id = $account_info['currency_id'];
112
+		 $currency = $this->CI->common->get_field_name('currency', 'currency', $currency_id);
113 113
 		 $grid_field_arr = json_encode(array(
114
-			array("Coupon Number", "230", "number", "", "", "","","true","center"),
115
-			array("Description", "210", "description", "", "", "","","true","center"),
116
-			array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency","","true","right"),
117
-			array("Created Date", "250", "creation_date", "", "", "","","true","center"),
118
-			array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check","","true","center"),
114
+			array("Coupon Number", "230", "number", "", "", "", "", "true", "center"),
115
+			array("Description", "210", "description", "", "", "", "", "true", "center"),
116
+			array("Amount($currency)", "190", "amount", "amount", "amount", "convert_to_currency", "", "true", "right"),
117
+			array("Created Date", "250", "creation_date", "", "", "", "", "true", "center"),
118
+			array("Used Date", "250", "firstused", "firstused", "firstused", "firstused_check", "", "true", "center"),
119 119
 				));
120 120
 		return $grid_field_arr;
121 121
 	}
Please login to merge, or discard this patch.