Completed
Push — v3.0 ( 23635d...e28df5 )
by Samir
23s
created
web_interface/astpp/application/modules/rates/libraries/rates_form.php 1 patch
Indentation   +258 added lines, -258 removed lines patch added patch discarded remove patch
@@ -21,422 +21,422 @@
 block discarded – undo
21 21
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 22
 ###############################################################################
23 23
 if (!defined('BASEPATH'))
24
-    exit('No direct script access allowed');
24
+	exit('No direct script access allowed');
25 25
 
26 26
 class rates_form {
27
-    function __construct($library_name = '') {
28
-        $this->CI = & get_instance();
29
-    }
30
-    function get_termination_rate_form_fields() {
31
-        $form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32
-        $form['Rate Information'] = array(
33
-        array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34
-            array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
-            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
-            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
-            array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
-            array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
27
+	function __construct($library_name = '') {
28
+		$this->CI = & get_instance();
29
+	}
30
+	function get_termination_rate_form_fields() {
31
+		$form['forms'] = array(base_url() . 'rates/termination_rate_save/', array('id' => 'termination_rate_form', 'method' => 'POST', 'name' => 'termination_rate_form'));
32
+		$form['Rate Information'] = array(
33
+		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
34
+			array('Trunk', 'trunk_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),     
35
+			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20',  'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
36
+			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20',  'class' => "text field medium"), 'tOOL TIP', ''),            
37
+			array('Strip', 'INPUT', array('name' => 'strip', 'size' => '20',  'class' => "text field medium"), '', 'tOOL TIP', ''),
38
+			array('Prepend', 'INPUT', array('name' => 'prepend', 'size' => '20',  'class' => "text field medium"), 'trim|xss_clean', 'tOOL TIP', ''),
39
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
40 40
             
41 41
         
42 42
 );
43
-        $form['Billing Information'] = array(
44
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46
-             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
43
+		$form['Billing Information'] = array(
44
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
45
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
46
+			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
47 47
 /**
48 48
 ASTPP  3.0 
49 49
 For Add Initial Increment field
50 50
 **/
51
-	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
51
+		array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
52 52
 /*******************************************************/
53
-            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54
-            array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
53
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
54
+			array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''));
55 55
 	
56
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
57
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
56
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
57
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
58 58
 
59
-        return $form;
60
-    }
59
+		return $form;
60
+	}
61 61
 
62
-    function get_origination_rate_form_fields() {
62
+	function get_origination_rate_form_fields() {
63 63
 	 $logintype=$this->CI->session->userdata('userlevel_logintype');
64
-        $trunk=null;
65
-        if($logintype !=1)
64
+		$trunk=null;
65
+		if($logintype !=1)
66 66
 	  $trunk = array('Force Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"));
67
-        $form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68
-        $form['Rate Information'] = array(
69
-            array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
-            array('Rate Group', 'pricelist_id', 'SELECT', '','', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0",'reseller_id'=>0)),        
71
-            array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72
-            array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73
-            //array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
74
-            array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
67
+		$form['forms'] = array(base_url() . 'rates/origination_rate_save/', array('id' => 'origination_rate_form', 'method' => 'POST', 'name' => 'origination_rate_form'));
68
+		$form['Rate Information'] = array(
69
+			array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
70
+			array('Rate Group', 'pricelist_id', 'SELECT', '','', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0",'reseller_id'=>0)),        
71
+			array('Code', 'INPUT', array('name' => 'pattern', 'size' => '20', 'class' => "text field medium"), 'trim|required|numeric|xss_clean', 'tOOL TIP', ''),
72
+			array('Destination', 'INPUT', array('name' => 'comment', 'size' => '20', 'class' => "text field medium"), 'tOOL TIP', ''),
73
+			//array('Priority', 'INPUT', array('name' => 'precedence', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
74
+			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_status'),
75 75
         
76 76
 );
77
-        $form['Billing Information'] = array(
78
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
-             array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
77
+		$form['Billing Information'] = array(
78
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
79
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
80
+			 array('Per Minute Cost', 'INPUT', array('name' => 'cost', 'size' => '20',  'class' => "text field medium"), 'trim|numeric|currency_decimal|xss_clean', 'tOOL TIP', ''),
81 81
 /**
82 82
 ASTPP  3.0 
83 83
 For Add Initial Increment field
84 84
 **/
85
-    	    array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
85
+			array('Initial Increment', 'INPUT', array('name' => 'init_inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
86 86
 /********************************************************************/
87
-            array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
88
-            $trunk,
87
+			array('Increment', 'INPUT', array('name' => 'inc', 'size' => '20', 'class' => "text field medium"), 'trim|numeric|xss_clean', 'tOOL TIP', ''),
88
+			$trunk,
89 89
             
90 90
         
91 91
 );
92 92
 
93
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
94
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
93
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
94
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
95 95
 
96
-        return $form;
97
-    }
96
+		return $form;
97
+	}
98 98
 	
99
-    function get_termination_rate_search_form() {
100
-        $form['forms'] = array("", array('id' => "termination_rate_search"));
101
-        $form['Search'] = array(
99
+	function get_termination_rate_search_form() {
100
+		$form['forms'] = array("", array('id' => "termination_rate_search"));
101
+		$form['Search'] = array(
102 102
             
103
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
104
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
105
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
106
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
107
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
103
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
104
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
105
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
106
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
107
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
108 108
 /**
109 109
 ASTPP  3.0 
110 110
 For Add Initial Increment field
111 111
 **/
112 112
 			array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''),
113 113
 /***************************************************************/
114
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115
-                array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
-            array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117
-           array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
114
+		array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
115
+				array('Priority', 'INPUT', array('name' => 'prepend[prepend]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'prepend[prepend-string]', '', '', '', 'search_string_type', ''),
116
+			array('Trunk', 'trunk_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0")),array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
117
+		   array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
118 118
  /******
119 119
 ASTPP  3.0 
120 120
 Batch Delete
121 121
 ******/
122
-	         array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),            
122
+			 array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),            
123 123
 /************************/           
124 124
 		 array('', 'HIDDEN', 'advance_search', '1', '', '', '')
125 125
             
126 126
             
127
-        );
127
+		);
128 128
 /******
129 129
 ASTPP  3.0 
130 130
 Batch Delete
131 131
 ******/
132
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
132
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "termination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'submit', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
133 133
 
134 134
 /***********************/
135 135
 /******
136 136
 ASTPP  3.0 
137 137
 Batch Delete
138 138
 ******/
139
-        $form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
139
+		$form['button_search'] = array('name' => 'action', 'id' => "termination_rate_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right margin-x-10');
140 140
 /***********************/
141
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
141
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
142 142
 
143
-        return $form;
144
-    }
143
+		return $form;
144
+	}
145 145
 
146 146
     
147
-    function termination_rate_batch_update_form() {
148
-        $form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149
-        $form['Batch Update'] = array(
150
-	    array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
-	    array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
-	    array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
147
+	function termination_rate_batch_update_form() {
148
+		$form['forms'] = array("rates/termination_rate_batch_update/", array('id' => "termination_rate_batch_update"));
149
+		$form['Batch Update'] = array(
150
+		array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
151
+		array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
152
+		array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]','id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
153 153
             
154
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
-	    array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
-	    array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
-            array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
158
-        );
154
+		array('Increment', 'INPUT', array('name' => 'inc[inc]','id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
155
+		array('Priority', 'INPUT', array('name' => 'precedence[precedence]','id'=>'precedence', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'precedence[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
156
+		array('Prepand', 'INPUT', array('name' => 'prepend[prepend]','id'=>'prepend', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'prepend[operator]','class'=>'update_drp'), '', '', '', 'update_drp_type', ''),
157
+			array('Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type'),
158
+		);
159 159
 
160
-        $form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
161
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
160
+		$form['button_search'] = array('name' => 'action', 'id' => "batch_update_btn", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' =>'btn btn-line-parrot pull-right');
161
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
162 162
 
163
-        return $form;
164
-    }
165
-    function origination_rate_batch_update_form() {
166
-    $logintype=$this->CI->session->userdata('userlevel_logintype');
167
-            $trunk=null;
168
-        if($logintype !=1)
163
+		return $form;
164
+	}
165
+	function origination_rate_batch_update_form() {
166
+	$logintype=$this->CI->session->userdata('userlevel_logintype');
167
+			$trunk=null;
168
+		if($logintype !=1)
169 169
 	  $trunk = array('Force Trunk', array('name'=> 'trunk_id[trunk_id]','id'=>'trunk_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'trunks', 'build_dropdown', 'where_arr', array("status" => "0"),array('name'=>'trunk_id[operator]','class'=>'update_drp'), 'update_drp_type');
170
-        $form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
171
-        $form['Batch Update'] = array(
172
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
-            array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
-            array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
177
-           $trunk,
178
-        );
170
+		$form['forms'] = array("rates/origination_rate_batch_update/",array('id' => "origination_rate_batch_update"));        
171
+		$form['Batch Update'] = array(
172
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]','id'=>'connectcost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1', array('name'=>'connectcost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
173
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]','id'=>'includedseconds', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'includedseconds[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
174
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'id'=>'cost', 'value' => '', 'size' => '20',  'class' => "text field "), '', 'Tool tips info', '1',array('name'=>'cost[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
175
+			array('Increment', 'INPUT', array('name' => 'inc[inc]', 'id'=>'inc', 'size' => '20',  'class' => "text field "), '', 'tOOL TIP', '1', array('name'=>'inc[operator]','class'=>'update_drp'), '', '', '', 'update_int_type', ''),
176
+			array('Rate Group', array('name'=> 'pricelist_id[pricelist_id]','id'=>'pricelist_id'), 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0"),array('name'=>'pricelist_id[operator]','class'=>'update_drp'), 'update_drp_type'),
177
+		   $trunk,
178
+		);
179 179
 
180
-        $form['button_search'] = array('name' => 'action', 'id' => "batch_update", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
181
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' =>'btn btn-line-sky pull-right margin-x-10');
180
+		$form['button_search'] = array('name' => 'action', 'id' => "batch_update", 'content' => 'Update', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
181
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_batch_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' =>'btn btn-line-sky pull-right margin-x-10');
182 182
 
183
-        return $form;
184
-    }
183
+		return $form;
184
+	}
185 185
     
186
-         function build_rates_list_for_reseller() {
186
+		 function build_rates_list_for_reseller() {
187 187
 			 
188 188
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
189 189
 $currency_id=$account_info['currency_id'];
190 190
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);			 
191 191
 			 
192
-        $grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
193
-		    array('Destination', "240", "comment", "", "", ""),
194
-		    array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
-		    array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
-		    array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
-		    array('Increment', "140", "inc", "", "", "","","true","center"),
198
-		    array('Priority', "155", "precedence", "", "", "","","true","center"),
199
-                ));
200
-        return $grid_field_arr;
201
-    }
202
-    function get_reseller_origination_rate_search_form() {
192
+		$grid_field_arr = json_encode(array(array('Code', "140", "pattern", "pattern", "", "get_only_numeric_val","","true","center"),
193
+			array('Destination', "240", "comment", "", "", ""),
194
+			array('Connection Cost('.$currency.')', "210", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
195
+			array('Included Seconds', "180", "includedseconds", "", "", "","","true","center"),
196
+			array('Per Minute Cost('.$currency.')', "180", "cost", "cost", "cost", "convert_to_currency","","true","right"),
197
+			array('Increment', "140", "inc", "", "", "","","true","center"),
198
+			array('Priority', "155", "precedence", "", "", "","","true","center"),
199
+				));
200
+		return $grid_field_arr;
201
+	}
202
+	function get_reseller_origination_rate_search_form() {
203 203
 	$accountinfo=$this->CI->session->userdata('accountinfo');
204 204
 	
205
-        $form['forms'] = array("", array('id' => "resellerrates_list_search"));
206
-        $form['Search My Rates'] = array(
205
+		$form['forms'] = array("", array('id' => "resellerrates_list_search"));
206
+		$form['Search My Rates'] = array(
207 207
            
208
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
209
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
210
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
211
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
212
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
213
-	    array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
214
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
215
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
216
-        );
208
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
209
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
210
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
211
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
212
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
213
+		array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
214
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
215
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
216
+		);
217 217
 
218
-        $form['button_search'] = array('name' => 'action', 'id' => "resellerrates_list_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
219
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
218
+		$form['button_search'] = array('name' => 'action', 'id' => "resellerrates_list_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right');
219
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
220 220
 
221
-        return $form;
222
-    }
223
-    function get_origination_rate_search_form() {
224
-        $form['forms'] = array("", array('id' => "origination_rate_list_search"));
225
-        $form['Search'] = array(
221
+		return $form;
222
+	}
223
+	function get_origination_rate_search_form() {
224
+		$form['forms'] = array("", array('id' => "origination_rate_list_search"));
225
+		$form['Search'] = array(
226 226
            
227
-            array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
228
-            array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
229
-            array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
230
-            array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
231
-            array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
227
+			array('Code', 'INPUT', array('name' => 'pattern[pattern]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'pattern[pattern-string]', '', '', '', 'search_string_type', ''),
228
+			array('Destination', 'INPUT', array('name' => 'comment[comment]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'comment[comment-string]', '', '', '', 'search_string_type', ''),
229
+			array('Connect Cost', 'INPUT', array('name' => 'connectcost[connectcost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'connectcost[connectcost-integer]', '', '', '', 'search_int_type', ''),
230
+			array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''),
231
+			array('Per Minute Cost', 'INPUT', array('name' => 'cost[cost]', 'value' => '', 'size' => '20', 'class' => "text field "), '', 'Tool tips info', '1', 'cost[cost-integer]', '', '', '', 'search_int_type', ''),
232 232
 /**
233 233
 ASTPP  3.0 
234 234
 For Add Initial Increment field
235 235
 **/
236
-            array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''),
236
+			array('Initial Increment', 'INPUT', array('name' => 'init_inc[init_inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'init_inc[init_inc-integer]', '', '', '', 'search_int_type', ''),
237 237
 /**************************************************************/
238 238
 			array('Increment', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field "), '', 'tOOL TIP', '1', 'inc[inc-integer]', '', '', '', 'search_int_type', ''),
239
-            array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id"=>"0")),
239
+			array('Rate Group', 'pricelist_id', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id"=>"0")),
240 240
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
241
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
243
-        );
241
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
242
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
243
+		);
244 244
 /******
245 245
 ASTPP  3.0 
246 246
 Batch Delete
247 247
 ******/
248
-        $form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
248
+		$form['button_search_delete'] = array('name' => 'action', 'id' => "origination_rate_batch_dlt",'onclick'=>"check_btn();", 'content' => 'Delete Search Record','style'=>'display:none;', 'value' => 'save', 'type' => 'button', 'class' => 'btn pull-right btn btn-line-danger ');
249 249
 
250 250
 /***********************/
251 251
 /******** 
252 252
 ASTPP  3.0 
253 253
 Batch delete
254 254
 *********/
255
-        $form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
255
+		$form['button_search'] = array('name' => 'action', 'id' => "origination_rate_list_search_btn",'onclick'=>'search_btn();', 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right  margin-x-10');
256 256
 /**************************/
257
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
257
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => 'btn btn-line-sky pull-right margin-x-10');
258 258
 
259
-        return $form;
260
-    }
259
+		return $form;
260
+	}
261 261
     
262 262
     
263 263
 
264
-    /*
264
+	/*
265 265
     ASTPP  3.0
266 266
     changes in grid size
267 267
     */
268 268
 
269
-    function build_termination_rate_for_admin() {
269
+	function build_termination_rate_for_admin() {
270 270
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
271 271
 $currency_id=$account_info['currency_id'];
272 272
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
273 273
 		
274
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
274
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
275
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
276 276
 /**
277 277
 ASTPP  3.0
278 278
 For Termination Rate edit on Code
279 279
 **/
280
-            array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
280
+			array("Code", "78", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
281 281
 /*********************************/
282
-            array("Destination", "80", "comment", "", "", "","","true","center"),
283
-            array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
-            array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
-            array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
-  	    array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
-            array("Increment", "75", "inc", "", "", "","","true","center"),
288
-            array("Priority", "70", "precedence", "", "", "","","true","center"),
289
-            array("Strip","60", "strip", "", "", "","","true","center"),
290
-            array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
-            array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
292
-           /*
282
+			array("Destination", "80", "comment", "", "", "","","true","center"),
283
+			array("Connect Cost($currency)", "125", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
284
+			array("Included<br/> Seconds", "70", "includedseconds", "", "", "","","true","center"),
285
+			array("Per Minute <br/>Cost($currency)", "100", "cost", "cost", "cost", "convert_to_currency","","true","right"),
286
+  		array("Initial <br/> Increment", "95", "init_inc", "", "", "","","true","center"),
287
+			array("Increment", "75", "inc", "", "", "","","true","center"),
288
+			array("Priority", "70", "precedence", "", "", "","","true","center"),
289
+			array("Strip","60", "strip", "", "", "","","true","center"),
290
+			array("Prepend", "70", "prepend", "pattern", "", "get_only_numeric_val","","true","center"),
291
+			array("Trunk", "80", "trunk_id", "name", "trunks", "get_field_name","","true","center"),
292
+		   /*
293 293
             ASTPP  3.0 
294 294
             creation field show in grid
295 295
             */
296
-            array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
296
+			array("Status", "100", "status", "status", "outbound_routes", "get_status","","true","center"),
297 297
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
298
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
299
-            /********************************************************************/
300
-             /*
298
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
299
+			/********************************************************************/
300
+			 /*
301 301
             ASTPP  3.0
302 302
              status show active or inactive
303 303
             */
304 304
        
305
-            /***********************************************************************/
305
+			/***********************************************************************/
306 306
 //             array("Reseller", "103", "reseller_id", "number", "accounts", "get_field_name"),
307
-            array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
308
-                    "DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309
-                ));
310
-        return $grid_field_arr;
311
-    }
312
-    /**************************************************/
307
+			array("Action", "80", "", "", "", array("EDIT" => array("url" => "rates/termination_rate_edit/", "mode" => "popup","layout"=>"medium"),
308
+					"DELETE" => array("url" => "rates/termination_rate_delete/", "mode" => "single")))
309
+				));
310
+		return $grid_field_arr;
311
+	}
312
+	/**************************************************/
313 313
 	
314 314
    /*
315 315
    ASTPP  3.0 
316 316
     changes in grid size
317 317
    */
318
-    function build_origination_rate_list_for_admin() {
318
+	function build_origination_rate_list_for_admin() {
319 319
 $account_info = $accountinfo = $this->CI->session->userdata('accountinfo');
320 320
 $currency_id=$account_info['currency_id'];
321 321
 $currency=$this->CI->common->get_field_name('currency', 'currency', $currency_id);
322 322
 		
323
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
-        $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
323
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
324
+		$grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
325 325
 /**
326 326
 ASTPP  3.0 
327 327
 For Origination rate edit on code
328 328
 **/
329
-            array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
329
+			array("Code", "75", "pattern", "pattern", "", "get_only_numeric_val","EDITABLE","true","center"),
330 330
 /************************************/
331
-            array("Destination", "100", "comment", "", "", "","","true","center"),
332
-            array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
-            array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
-            array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
331
+			array("Destination", "100", "comment", "", "", "","","true","center"),
332
+			array("Connect Cost($currency)", "130", "connectcost", "connectcost", "connectcost", "convert_to_currency","","true","right"),
333
+			array("Included Seconds", "120", "includedseconds", "", "", "","","true","center"),
334
+			array("Per Minute Cost($currency)", "150", "cost", "cost", "cost", "convert_to_currency","","true","right"),
335 335
 /**
336 336
 ASTPP  3.0 
337 337
 For Add Initial Increment field
338 338
 **/
339 339
 			array("Initial Increment", "130", "init_inc", "", "", "","","true","center"),
340 340
 /*******************************************************************/
341
-            array("Increment", "90", "inc", "", "", "","","true","center"),
342
-            //array("Priority", "72", "precedence", "", "", "","","true","center"),
343
-            array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
344
-            /*
341
+			array("Increment", "90", "inc", "", "", "","","true","center"),
342
+			//array("Priority", "72", "precedence", "", "", "","","true","center"),
343
+			array("Rate Group", "90", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"),
344
+			/*
345 345
             ASTPP  3.0  creation field show in grid
346 346
             */
347
-            array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
347
+			array("Status", "100", "status", "status", "routes", "get_status","","true","center"),
348 348
 //            array("Created<br/>Date", "80", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"),
349
-            array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
349
+			array("Modified Date", "150", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"),
350 350
 
351
-            /********************************************************************/
352
-            /*
351
+			/********************************************************************/
352
+			/*
353 353
             ASTPP  3.0
354 354
             chnage in status active or inactive
355 355
             */
356 356
             
357
-            array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
358
-                    "DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359
-                ));
360
-        return $grid_field_arr;
361
-    }
362
-    /****************************************************************************************/
357
+			array("Action", "95", "", "", "", array("EDIT" => array("url" => "rates/origination_rate_edit/", "mode" => "popup","layout"=>"medium"),
358
+					"DELETE" => array("url" => "/rates/origination_rate_delete/", "mode" => "single")))
359
+				));
360
+		return $grid_field_arr;
361
+	}
362
+	/****************************************************************************************/
363 363
 
364
-    function build_grid_buttons() {
365
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
-            array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
369
-            ));
370
-        return $buttons_json;
371
-    }
364
+	function build_grid_buttons() {
365
+		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/termination_rate_add/", "popup","medium"),
366
+			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/termination_rate_delete_multiple/"),
367
+			array("import","btn btn-line-blue" ,"fa fa-upload fa-lg", "button_action", "/rates/termination_rate_import/", 'single'),
368
+			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/termination_rate_export_cdr_xls/", 'single')
369
+			));
370
+		return $buttons_json;
371
+	}
372 372
 
373
-    function build_grid_buttons_origination_rate() {
374
-        $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
375
-            array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
-            array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
-            array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
373
+	function build_grid_buttons_origination_rate() {
374
+		$buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/rates/origination_rate_add/", "popup","medium"),
375
+			array("Delete", "btn btn-line-danger","fa fa-times-circle fa-lg", "button_action", "/rates/origination_rate_delete_multiple/"),
376
+			array("import", "btn btn-line-blue","fa fa-upload fa-lg", "button_action", "/rates/origination_rate_import/", 'single'),
377
+			array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/origination_rate_export_cdr_xls/", 'single')
378 378
             
379
-            ));
380
-        return $buttons_json;
381
-    }
379
+			));
380
+		return $buttons_json;
381
+	}
382 382
 
383
-    function build_termination_rate_list_for_customer() {
384
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
385
-        $grid_field_arr = json_encode(array(
386
-            array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
387
-            array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
388
-            array("Increment", "75", "inc", "", "", ""),
389
-            array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
390
-            array("Included <br> Seconds", "100", "includedseconds", "", "", ""),
391
-            array("Destination", "100", "comment", "", "", ""),
392
-            array("Cost per <br> Minutes", "100", "cost", "cost", "cost", "convert_to_currency"),
393
-            array("Priority", "80", "precedence", "", "", ""),
394
-            array("Reseller", "80", "reseller_id", "number", "accounts", "get_field_name")
395
-                ));
396
-        return $grid_field_arr;
397
-    }
398
-    function build_block_pattern_list_for_customer() {
399
-        // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
400
-        $grid_field_arr = json_encode(array(
401
-            array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
402
-            array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
403
-            array("Destination", "350", "comment", "", "", ""),
404
-                ));
405
-        return $grid_field_arr;
406
-    }
407
-    function build_pattern_list_for_customer($accountid,$accounttype) {
383
+	function build_termination_rate_list_for_customer() {
384
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
385
+		$grid_field_arr = json_encode(array(
386
+			array("<input type='checkbox' name='chkAll' class='ace checking checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
387
+			array("Code", "70", "pattern", "pattern", "", "get_only_numeric_val"),
388
+			array("Increment", "75", "inc", "", "", ""),
389
+			array("Connect <br> Charge", "100", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
390
+			array("Included <br> Seconds", "100", "includedseconds", "", "", ""),
391
+			array("Destination", "100", "comment", "", "", ""),
392
+			array("Cost per <br> Minutes", "100", "cost", "cost", "cost", "convert_to_currency"),
393
+			array("Priority", "80", "precedence", "", "", ""),
394
+			array("Reseller", "80", "reseller_id", "number", "accounts", "get_field_name")
395
+				));
396
+		return $grid_field_arr;
397
+	}
398
+	function build_block_pattern_list_for_customer() {
399
+		// array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
400
+		$grid_field_arr = json_encode(array(
401
+			array("<input type='checkbox' name='chkAll1' class='ace checking'/><label class='lbl'></label>", "30", "", "", "", "","","false","center","PatternChkBox"),
402
+			array("Code", "350", "pattern", "pattern", "", "get_only_numeric_val"),
403
+			array("Destination", "350", "comment", "", "", ""),
404
+				));
405
+		return $grid_field_arr;
406
+	}
407
+	function build_pattern_list_for_customer($accountid,$accounttype) {
408 408
 
409
-        $grid_field_arr = json_encode(array(
410
-            array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
411
-            array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
412
-            array("Destination", "450", "destination", "", "", ""),
413
-            array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
414
-                ));
415
-        return $grid_field_arr;
416
-    }
409
+		$grid_field_arr = json_encode(array(
410
+			array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"),
411
+			array("Code", "450", "blocked_patterns", "blocked_patterns", "", "get_only_numeric_val"),
412
+			array("Destination", "450", "destination", "", "", ""),
413
+			array("Action", "100", "", "", "", array("DELETE" => array("url" => "accounts/".$accounttype."_delete_block_pattern/$accountid/", "mode" => "single")))
414
+				));
415
+		return $grid_field_arr;
416
+	}
417 417
 
418
-    function set_pattern_grid_buttons($accountid) {
419
-        $buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
420
-        return $buttons_json;
421
-    }
418
+	function set_pattern_grid_buttons($accountid) {
419
+		$buttons_json = json_encode(array(array("Add Prefixes","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/accounts/customer_add_blockpatterns/$accountid", "popup")));
420
+		return $buttons_json;
421
+	}
422 422
 
423
-    function build_origination_rate_list_for_user() {
424
-              // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
425
-        $grid_field_arr = json_encode(array(array("Code", "155", "pattern", "pattern", "", "get_only_numeric_val"),
426
-	      array("Destination", "225", "comment", "", "", ""),
427
-	      array("Increment", "235", "inc", "", "", ""),
428
-	      array("Cost per Minutes", "240", "cost", "cost", "cost", "convert_to_currency"),
429
-	      array("Connect Charge", "200", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
430
-	      array("Included Seconds", "200", "includedseconds", "", "", "")
423
+	function build_origination_rate_list_for_user() {
424
+			  // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name);
425
+		$grid_field_arr = json_encode(array(array("Code", "155", "pattern", "pattern", "", "get_only_numeric_val"),
426
+		  array("Destination", "225", "comment", "", "", ""),
427
+		  array("Increment", "235", "inc", "", "", ""),
428
+		  array("Cost per Minutes", "240", "cost", "cost", "cost", "convert_to_currency"),
429
+		  array("Connect Charge", "200", "connectcost", "connectcost", "connectcost", "convert_to_currency"),
430
+		  array("Included Seconds", "200", "includedseconds", "", "", "")
431 431
 	));
432
-        return $grid_field_arr;
433
-    }
432
+		return $grid_field_arr;
433
+	}
434 434
 
435 435
 
436 436
 function build_grid_buttons_rates() {
437
-        $buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
438
-        return $buttons_json;
439
-    }
437
+		$buttons_json = json_encode(array(array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/rates/resellersrates_xls/", 'single')));
438
+		return $buttons_json;
439
+	}
440 440
 
441 441
 
442 442
 }
Please login to merge, or discard this patch.
astpp/application/modules/rates/views/view_import_origination_rate.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
             	<div class="w-box">
17 17
                    <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
18 18
                     <? if(isset($error) && !empty($error)) {
19
-                        echo $error;
20
-                    }?>
19
+						echo $error;
20
+					}?>
21 21
                    </span>            	
22 22
                    <h3 class="padding-t-10 padding-l-16">File must be in the following format(.csv):</h3>
23 23
                    <p>Code,Destination,Connect Cost,Included Seconds,Per Minute Cost,Initial Increment,Increment.</p>
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
                                <label class="col-md-3">Rate Group:</label>
33 33
                                <div>
34 34
                                <? $pricelists = form_dropdown('pricelist_id', $this->db_model->build_dropdown("id,name", "pricelists","where_arr", array("reseller_id" => "0", "status" => "0")), '');
35
-                                    echo $pricelists;
36
-                               ?>
35
+									echo $pricelists;
36
+							   ?>
37 37
                                </div>
38 38
                            </div>
39 39
 				<?
40 40
 				 $logintype=$this->session->userdata('userlevel_logintype');
41
-				       // $trunk=null;
41
+					   // $trunk=null;
42 42
 				 if($logintype !=1) { ?>
43 43
                            <div class="col-md-12 no-padding">
44 44
                                <label class="col-md-3">Force Trunk:</label>
45 45
                                <div>
46 46
                                <? $trunklist = form_dropdown_all('trunk_id', $this->db_model->build_dropdown("id,name", "trunks","where_arr", array("status" => "0")), '');
47
-                                    echo $trunklist;
48
-                               ?>
47
+									echo $trunklist;
48
+							   ?>
49 49
                                </div>
50 50
                            </div><? }
51 51
 				else {?>
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 <?}?>    
102 102
         
103 103
 <?php
104
-    if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
104
+	if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
105 105
 
106 106
 <section class="slice color-three">
107 107
 	<div class="w-section inverse no-padding">
@@ -111,24 +111,24 @@  discard block
 block discarded – undo
111 111
             <form id="import_form" name="import_form" action="<?=base_url()?>rates/origination_rate_import_file/<?= $pricelistid?>/<?=$trunkid?><?=$check_header?>/" method="POST">
112 112
             <table width="100%" border="1"  class="details_table table">
113 113
                 <?  $cnt =7;
114
-                    foreach($csv_tmp_data as $csv_key => $csv_value){
115
-                        if($csv_key <  15){
116
-                            echo "<tr>";
117
-                            foreach($csv_value as $field_name => $field_val){
118
-                                if($csv_key == 0){
119
-                                    echo "<th>".ucfirst($field_name)."</th>";
120
-                                }else{
121
-                                    echo "<td class='portlet-content'>".$field_val."</td>";   
122
-                                }
123
-                            }
124
-                            echo "</tr>";
125
-                        }
126
-                    }
114
+					foreach($csv_tmp_data as $csv_key => $csv_value){
115
+						if($csv_key <  15){
116
+							echo "<tr>";
117
+							foreach($csv_value as $field_name => $field_val){
118
+								if($csv_key == 0){
119
+									echo "<th>".ucfirst($field_name)."</th>";
120
+								}else{
121
+									echo "<td class='portlet-content'>".$field_val."</td>";   
122
+								}
123
+							}
124
+							echo "</tr>";
125
+						}
126
+					}
127 127
                     
128
-                    echo "<tr><td colspan='".$cnt."'>
128
+					echo "<tr><td colspan='".$cnt."'>
129 129
                         <a href='".base_url()."rates/origination_rate_import/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
130 130
                         <input type='submit' class='btn btn-line-parrot pull-right' id='Process' value='Process'/></td></tr>";
131
-        ?> </table></form>  
131
+		?> </table></form>  
132 132
         </div>
133 133
 </div></div></div>
134 134
     </section>  
Please login to merge, or discard this patch.
astpp/application/modules/rates/views/view_import_termination_rate.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
             	<div class="w-box">
20 20
             	 <span  style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;">
21 21
                     <? if(isset($error) && !empty($error)) {
22
-                        echo $error;
23
-                    }?>
22
+						echo $error;
23
+					}?>
24 24
                  </span>
25 25
                    <h3 class="padding-t-10 padding-l-16">File must be in the following format(.csv):</h3>
26 26
                    <p>Code,Destination,Connect Cost,Included Seconds,Per Minute Cost,Initial Increment,Increment,Precedence,Strip,Prepend.</p>
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                                <label class="col-md-3">Trunk List:</label>
36 36
                                <div class="">
37 37
                                <? $trunklist = form_dropdown('trunk_id', $this->db_model->build_dropdown("id,name", "trunks", "where_arr",array("status " => "0")), '');
38
-                            echo $trunklist; ?></div>
38
+							echo $trunklist; ?></div>
39 39
                            </div>
40 40
                            <div class="col-md-12 no-padding">
41 41
                             <input type="hidden" name="mode" value="import_termination_rate" />
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 <?}?>    
89 89
         
90 90
 <?php
91
-    if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
91
+	if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?>
92 92
         
93 93
 <section class="slice color-three padding-b-20">
94 94
 	<div class="w-section inverse no-padding">
@@ -98,24 +98,24 @@  discard block
 block discarded – undo
98 98
             <form id="import_form" name="import_form" action="<?=base_url()?>rates/termination_rate_rates_import/<?= $trunkid?>/<?=$check_header?>/" method="POST">
99 99
             <table width="100%" border="1"  class="details_table table">
100 100
                 <?  $cnt =7;
101
-                    foreach($csv_tmp_data as $csv_key => $csv_value){
102
-                        if($csv_key <  15){
103
-                            echo "<tr>";
104
-                            foreach($csv_value as $field_name => $field_val){
105
-                                if($csv_key == 0){
106
-                                    echo "<th>".ucfirst($field_name)."</th>";
107
-                                }else{
108
-                                    echo "<td class='portlet-content'>".$field_val."</td>";   
109
-                                }
110
-                            }
111
-                            echo "</tr>";
112
-                        }
113
-                    }
101
+					foreach($csv_tmp_data as $csv_key => $csv_value){
102
+						if($csv_key <  15){
103
+							echo "<tr>";
104
+							foreach($csv_value as $field_name => $field_val){
105
+								if($csv_key == 0){
106
+									echo "<th>".ucfirst($field_name)."</th>";
107
+								}else{
108
+									echo "<td class='portlet-content'>".$field_val."</td>";   
109
+								}
110
+							}
111
+							echo "</tr>";
112
+						}
113
+					}
114 114
                     
115
-                    echo "<tr><td colspan='".$cnt."'>
115
+					echo "<tr><td colspan='".$cnt."'>
116 116
                         <a href='".base_url()."rates/termination_rates_list/'><input type='button' class='btn btn-line-sky pull-right  margin-x-10' value='Back'/></a>
117 117
                         <input type='submit' class='btn btn-line-parrot pull-right'' id='Process' value='Process'/></td></tr>";
118
-        ?> </table></form>  
118
+		?> </table></form>  
119 119
      </div>  
120 120
             </div>
121 121
         </div>
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/rates/models/rates_model.php 1 patch
Indentation   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -22,97 +22,97 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 class rates_model extends CI_Model {
24 24
 
25
-    function rates_model() {
26
-        parent::__construct();
27
-    }
25
+	function rates_model() {
26
+		parent::__construct();
27
+	}
28 28
 
29
-    function get_termination_rates_list($flag, $start = 0, $limit = 0) {
30
-        $this->db_model->build_search('termination_rates_list_search');
29
+	function get_termination_rates_list($flag, $start = 0, $limit = 0) {
30
+		$this->db_model->build_search('termination_rates_list_search');
31 31
 /********
32 32
 ASTPP  3.0 
33 33
 Batch Delete
34 34
 ********/
35
-        if($this->session->userdata('advance_batch_delete') == 1){
36
-           $this->db->where(array("trunk_id >"=>"0"));
37
-           $this->db->delete("outbound_routes");
38
-           $this->session->set_userdata('advance_batch_delete','0');
39
-	       $this->session->unset_userdata('advance_batch_delete');
35
+		if($this->session->userdata('advance_batch_delete') == 1){
36
+		   $this->db->where(array("trunk_id >"=>"0"));
37
+		   $this->db->delete("outbound_routes");
38
+		   $this->session->set_userdata('advance_batch_delete','0');
39
+		   $this->session->unset_userdata('advance_batch_delete');
40 40
 	   }
41 41
 /**************/
42
-        if ($flag) {
43
-            $query = $this->db_model->select("*", "outbound_routes", "", "id", "ASC", $limit, $start);
44
-        } else {
45
-            $query = $this->db_model->countQuery("*", "outbound_routes", "");
46
-        }
47
-        return $query;
48
-    }
49
-    function get_termination_rate($flag, $start = 0, $limit = 0, $export = true) {
50
-        $this->db_model->build_search('termination_rates_list_search');
51
-        $this->db->from('outbound_routes');
52
-        if ($flag) {
53
-            if ($export)
54
-                $this->db->limit($limit, $start);
55
-            $result = $this->db->get();
56
-        }else {
57
-            $result = $this->db->count_all_results();
58
-        }
59
-        return $result;
60
-    }
42
+		if ($flag) {
43
+			$query = $this->db_model->select("*", "outbound_routes", "", "id", "ASC", $limit, $start);
44
+		} else {
45
+			$query = $this->db_model->countQuery("*", "outbound_routes", "");
46
+		}
47
+		return $query;
48
+	}
49
+	function get_termination_rate($flag, $start = 0, $limit = 0, $export = true) {
50
+		$this->db_model->build_search('termination_rates_list_search');
51
+		$this->db->from('outbound_routes');
52
+		if ($flag) {
53
+			if ($export)
54
+				$this->db->limit($limit, $start);
55
+			$result = $this->db->get();
56
+		}else {
57
+			$result = $this->db->count_all_results();
58
+		}
59
+		return $result;
60
+	}
61 61
 
62
-    function get_origination_rate($flag, $start = 0, $limit = 0, $export = true) {
63
-        $this->db_model->build_search('origination_rate_list_search');
64
-	    if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
65
-            $account_data = $this->session->userdata("accountinfo");
66
-            $reseller = $account_data['id'];
67
-            $where = array("reseller_id" => $reseller);
68
-        } else {
69
-            $where = array('reseller_id'=>'0');
70
-        }
62
+	function get_origination_rate($flag, $start = 0, $limit = 0, $export = true) {
63
+		$this->db_model->build_search('origination_rate_list_search');
64
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
65
+			$account_data = $this->session->userdata("accountinfo");
66
+			$reseller = $account_data['id'];
67
+			$where = array("reseller_id" => $reseller);
68
+		} else {
69
+			$where = array('reseller_id'=>'0');
70
+		}
71 71
        
72
-	    $this->db_model->build_search('origination_rate_list_search');
73
-        if ($flag) {
74
-            if ($export)
75
-                $this->db->limit($limit, $start);
76
-            $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
77
-        }else {
78
-            $result = $this->db_model->countQuery("*", "routes", $where);
79
-        }
72
+		$this->db_model->build_search('origination_rate_list_search');
73
+		if ($flag) {
74
+			if ($export)
75
+				$this->db->limit($limit, $start);
76
+			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
77
+		}else {
78
+			$result = $this->db_model->countQuery("*", "routes", $where);
79
+		}
80 80
 // 	echo "<pre>";print_r($result->result());exit;
81
-        return $result;
82
-    }
81
+		return $result;
82
+	}
83 83
 
84
-    function get_origination_rate_for_user($flag, $start = 0, $limit = 0,$export = true) {
85
-        $this->db_model->build_search('origination_rate_list_search');
84
+	function get_origination_rate_for_user($flag, $start = 0, $limit = 0,$export = true) {
85
+		$this->db_model->build_search('origination_rate_list_search');
86 86
 
87
-        $account_data = $this->session->userdata("accountinfo");
87
+		$account_data = $this->session->userdata("accountinfo");
88 88
 
89
-        $where = array("pricelist_id" => $account_data["pricelist_id"]);
89
+		$where = array("pricelist_id" => $account_data["pricelist_id"]);
90 90
 
91
-        $this->db_model->build_search('origination_rate_list_search');
92
-        if ($flag) {
93
-            if ($export)
94
-                $this->db->limit($limit, $start);
95
-            $result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
96
-        }else {
97
-            $result = $this->db_model->countQuery("*", "routes", $where);
98
-        }
99
-        return $result;
100
-    }
91
+		$this->db_model->build_search('origination_rate_list_search');
92
+		if ($flag) {
93
+			if ($export)
94
+				$this->db->limit($limit, $start);
95
+			$result = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
96
+		}else {
97
+			$result = $this->db_model->countQuery("*", "routes", $where);
98
+		}
99
+		return $result;
100
+	}
101 101
 // ==============================================
102
-    function get_origination_rate_list($flag, $start = 0, $limit = 0) {
103
-        $this->db_model->build_search('origination_rate_list_search');
104
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
105
-            $account_data = $this->session->userdata("accountinfo");
106
-            $where = array("reseller_id" => $account_data['id']);
107
-        } else {
108
-            $where = array('reseller_id'=>'0');
109
-        }        
102
+	function get_origination_rate_list($flag, $start = 0, $limit = 0) {
103
+		$this->db_model->build_search('origination_rate_list_search');
104
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
105
+			$account_data = $this->session->userdata("accountinfo");
106
+			$where = array("reseller_id" => $account_data['id']);
107
+		} else {
108
+			$where = array('reseller_id'=>'0');
109
+		}        
110 110
 /***********
111 111
 ASTPP  3.0 
112 112
 Batch delete
113 113
 ************/
114
-        if($this->session->userdata('advance_batch_delete') == 1){
115
-            $this->db->where($where);
114
+		if($this->session->userdata('advance_batch_delete') == 1){
115
+			$this->db->where($where);
116 116
 			$this->db->delete("routes");
117 117
 			//echo $this->db->last_query(); exit;
118 118
 			$this->session->set_userdata('advance_batch_delete','0');
@@ -122,232 +122,232 @@  discard block
 block discarded – undo
122 122
 		$this->db_model->build_search('origination_rate_list_search');
123 123
 /***********************/
124 124
 
125
-        if ($flag) {
126
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
127
-        } else {
128
-            $query = $this->db_model->countQuery("*", "routes", $where);
125
+		if ($flag) {
126
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
127
+		} else {
128
+			$query = $this->db_model->countQuery("*", "routes", $where);
129 129
             
130
-        }
131
-        //echo $this->db->last_query();
132
-        return $query;
133
-    }
134
-    function getunblocked_pattern_list($accountid,$flag, $start = 0, $limit = 0) {
135
-        $this->db_model->build_search('origination_rate_list_search');
136
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
137
-            $account_data = $this->session->userdata("accountinfo");
138
-            $reseller = $account_data['id'];
139
-            $where = array("reseller_id" => $reseller, "status" => "0");
140
-        } else {
141
-            $where = array("status" => "0",'reseller_id'=>'0');
142
-        }
143
-        $where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
144
-        $this->db->where($where1);        
145
-        if ($flag) {
146
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
130
+		}
131
+		//echo $this->db->last_query();
132
+		return $query;
133
+	}
134
+	function getunblocked_pattern_list($accountid,$flag, $start = 0, $limit = 0) {
135
+		$this->db_model->build_search('origination_rate_list_search');
136
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
137
+			$account_data = $this->session->userdata("accountinfo");
138
+			$reseller = $account_data['id'];
139
+			$where = array("reseller_id" => $reseller, "status" => "0");
140
+		} else {
141
+			$where = array("status" => "0",'reseller_id'=>'0');
142
+		}
143
+		$where1 = '(pattern NOT IN (select blocked_patterns from block_patterns where accountid = "'.$accountid.'"))';
144
+		$this->db->where($where1);        
145
+		if ($flag) {
146
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
147 147
 //             echo "<pre>"; print_r($query); exit;
148
-        } else {
149
-            $query = $this->db_model->countQuery("*", "routes", $where);
150
-        }
151
-        return $query;
152
-    }
153
-    function getunblocked_package_pattern($accountid,$flag, $start = 0, $limit = 0) {
154
-        $this->db_model->build_search('origination_rate_list_search');
155
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
156
-            $account_data = $this->session->userdata("accountinfo");
157
-            $reseller = $account_data['id'];
158
-            $where = array("reseller_id" => $reseller, "status" => "0");
159
-        } else {
160
-            $where = array("status" => "0",'reseller_id'=>'0');
161
-        }
162
-        $where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
163
-        $this->db->where($where1);       
164
-        if ($flag) {
165
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
166
-        } else {
167
-            $query = $this->db_model->countQuery("*", "routes", $where);
168
-        }
169
-        return $query;
170
-    }
148
+		} else {
149
+			$query = $this->db_model->countQuery("*", "routes", $where);
150
+		}
151
+		return $query;
152
+	}
153
+	function getunblocked_package_pattern($accountid,$flag, $start = 0, $limit = 0) {
154
+		$this->db_model->build_search('origination_rate_list_search');
155
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
156
+			$account_data = $this->session->userdata("accountinfo");
157
+			$reseller = $account_data['id'];
158
+			$where = array("reseller_id" => $reseller, "status" => "0");
159
+		} else {
160
+			$where = array("status" => "0",'reseller_id'=>'0');
161
+		}
162
+		$where1 = '(pattern NOT IN (select DISTINCT patterns from package_patterns where package_id = "'.$accountid.'"))';
163
+		$this->db->where($where1);       
164
+		if ($flag) {
165
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
166
+		} else {
167
+			$query = $this->db_model->countQuery("*", "routes", $where);
168
+		}
169
+		return $query;
170
+	}
171 171
 
172
-    function get_origination_rate_list_for_user($flag, $start = 0, $limit = 0) {
173
-        $this->db_model->build_search('user_rates_list_search');
172
+	function get_origination_rate_list_for_user($flag, $start = 0, $limit = 0) {
173
+		$this->db_model->build_search('user_rates_list_search');
174 174
 
175
-        $account_data = $this->session->userdata("accountinfo");
176
-        $where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0');
175
+		$account_data = $this->session->userdata("accountinfo");
176
+		$where = array("pricelist_id" => $account_data["pricelist_id"],"status" => '0');
177 177
 
178
-        $this->db_model->build_search('origination_rate_list_search');
179
-        if ($flag) {
180
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
181
-        } else {
182
-            $query = $this->db_model->countQuery("*", "routes", $where);
183
-        }
184
-        return $query;
185
-    }
178
+		$this->db_model->build_search('origination_rate_list_search');
179
+		if ($flag) {
180
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);
181
+		} else {
182
+			$query = $this->db_model->countQuery("*", "routes", $where);
183
+		}
184
+		return $query;
185
+	}
186 186
 
187 187
 
188
-    function add_termination_rate($add_array) {
189
-        unset($add_array["action"]);
190
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
191
-            $account_data = $this->session->userdata("accountinfo");
192
-            $reseller = $account_data['id'];
193
-            $add_array['reseller_id'] = $reseller;
194
-        }
195
-        $add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
196
-        $add_array['prepend'] = $add_array['prepend'];
197
-        /*
188
+	function add_termination_rate($add_array) {
189
+		unset($add_array["action"]);
190
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
191
+			$account_data = $this->session->userdata("accountinfo");
192
+			$reseller = $account_data['id'];
193
+			$add_array['reseller_id'] = $reseller;
194
+		}
195
+		$add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
196
+		$add_array['prepend'] = $add_array['prepend'];
197
+		/*
198 198
         ASTPP  3.0 
199 199
          add creation date.
200 200
         */
201
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
202
-        /*******************************************************/
203
-        $this->insert_if_not_exitst($add_array,"outbound_routes");
204
-        //$this->db->insert("outbound_routes", $add_array);
205
-        return true;
206
-    }
201
+		$add_array['creation_date']=gmdate('Y-m-d H:i:s');
202
+		/*******************************************************/
203
+		$this->insert_if_not_exitst($add_array,"outbound_routes");
204
+		//$this->db->insert("outbound_routes", $add_array);
205
+		return true;
206
+	}
207 207
 
208
-    function edit_termination_rate($data, $id) {
209
-        unset($data["action"]);
210
-        /*
208
+	function edit_termination_rate($data, $id) {
209
+		unset($data["action"]);
210
+		/*
211 211
         ASTPP  3.0
212 212
          Edit time last modified date
213 213
         */
214
-        $data['last_modified_date']=gmdate('Y-m-d H:i:s');
215
-        /***************************************************/
216
-        $data['pattern'] = "^" . $data['pattern'] . ".*";
217
-        $this->db->where("id", $id);
218
-        $this->db->update("outbound_routes", $data);
219
-    }
214
+		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
215
+		/***************************************************/
216
+		$data['pattern'] = "^" . $data['pattern'] . ".*";
217
+		$this->db->where("id", $id);
218
+		$this->db->update("outbound_routes", $data);
219
+	}
220 220
 
221
-    function remove_termination_rate($id) {
222
-        $this->db->where("id", $id);
223
-        $this->db->delete("outbound_routes");
224
-        return true;
225
-    }
221
+	function remove_termination_rate($id) {
222
+		$this->db->where("id", $id);
223
+		$this->db->delete("outbound_routes");
224
+		return true;
225
+	}
226 226
 
227
-    function add_origination_rate($add_array) {
227
+	function add_origination_rate($add_array) {
228 228
 		
229
-        unset($add_array["action"]);
230
-        /*
229
+		unset($add_array["action"]);
230
+		/*
231 231
         ASTPP  3.0 
232 232
         ADD time put creation date in routes table 
233 233
         */
234
-        $add_array['creation_date']=gmdate('Y-m-d H:i:s');
235
-        /**********************************************/
236
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
237
-            $account_data = $this->session->userdata("accountinfo");
238
-            $reseller = $account_data['id'];
239
-            $add_array['reseller_id'] = $reseller;
240
-        }
234
+		$add_array['creation_date']=gmdate('Y-m-d H:i:s');
235
+		/**********************************************/
236
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
237
+			$account_data = $this->session->userdata("accountinfo");
238
+			$reseller = $account_data['id'];
239
+			$add_array['reseller_id'] = $reseller;
240
+		}
241 241
 	
242
-        $add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
242
+		$add_array['pattern'] = "^" . $add_array['pattern'] . ".*";
243 243
 /*************
244 244
 ASTPP  3.0 
245 245
 Rate insert
246 246
 *************/
247
-        $this->insert_if_not_exitst($add_array,"routes");
247
+		$this->insert_if_not_exitst($add_array,"routes");
248 248
 //        $this->db->insert("routes", $add_array);
249 249
 /*******************************/
250
-        return true;
251
-    }
250
+		return true;
251
+	}
252 252
 
253
-    function edit_origination_rate($data, $id) {
254
-        unset($data["action"]);
255
-        /*
253
+	function edit_origination_rate($data, $id) {
254
+		unset($data["action"]);
255
+		/*
256 256
         ASTPP  3.0
257 257
          Edit tile last modified date update
258 258
         */
259
-        $data['last_modified_date']=gmdate('Y-m-d H:i:s');
260
-        /********************************************************/
261
-        $data['pattern'] = "^" . $data['pattern'] . ".*";
262
-        $this->db->where("id", $id);
263
-        $this->db->update("routes", $data);
264
-    }
259
+		$data['last_modified_date']=gmdate('Y-m-d H:i:s');
260
+		/********************************************************/
261
+		$data['pattern'] = "^" . $data['pattern'] . ".*";
262
+		$this->db->where("id", $id);
263
+		$this->db->update("routes", $data);
264
+	}
265 265
 
266
-    function remove_origination_rate($id) {
267
-        $this->db->where("id", $id);
268
-        $this->db->delete("routes");
269
-        return true;
270
-    }
266
+	function remove_origination_rate($id) {
267
+		$this->db->where("id", $id);
268
+		$this->db->delete("routes");
269
+		return true;
270
+	}
271 271
 
272
-    function get_trunk_name($field_value) {
273
-        $this->db->where("name", $field_value);
274
-        $query = $this->db->get('trunks');
275
-        $data = $query->result();
276
-        if ($query->num_rows > 0)
277
-            return $data[0]->id;
278
-        else
279
-            return '';
280
-    }
272
+	function get_trunk_name($field_value) {
273
+		$this->db->where("name", $field_value);
274
+		$query = $this->db->get('trunks');
275
+		$data = $query->result();
276
+		if ($query->num_rows > 0)
277
+			return $data[0]->id;
278
+		else
279
+			return '';
280
+	}
281 281
 
282
-    function bulk_insert_termination_rate($field_value) {
283
-        //$this->db->insert_batch('outbound_routes', $field_value);
284
-        $this->db->insert_on_duplicate_update_batch('outbound_routes', $field_value);
285
-        $affected_row = $this->db->affected_rows();
286
-        return $affected_row;
287
-    }
282
+	function bulk_insert_termination_rate($field_value) {
283
+		//$this->db->insert_batch('outbound_routes', $field_value);
284
+		$this->db->insert_on_duplicate_update_batch('outbound_routes', $field_value);
285
+		$affected_row = $this->db->affected_rows();
286
+		return $affected_row;
287
+	}
288 288
 
289
-    function bulk_insert_origination_rate($inserted_array) {
290
-        //$this->db->insert_batch('routes', $inserted_array);
291
-        $this->db->insert_on_duplicate_update_batch('routes', $inserted_array);
292
-        $affected_row = $this->db->affected_rows();
293
-        return $affected_row;
294
-    }
295
-    function termination_rate_batch_update($update_array){
296
-        $this->db_model->build_search('termination_rates_list_search');
297
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
298
-            $account_data = $this->session->userdata("accountinfo");
299
-            $this->db->where("reseller_id",$account_data['id']);
300
-        }
289
+	function bulk_insert_origination_rate($inserted_array) {
290
+		//$this->db->insert_batch('routes', $inserted_array);
291
+		$this->db->insert_on_duplicate_update_batch('routes', $inserted_array);
292
+		$affected_row = $this->db->affected_rows();
293
+		return $affected_row;
294
+	}
295
+	function termination_rate_batch_update($update_array){
296
+		$this->db_model->build_search('termination_rates_list_search');
297
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
298
+			$account_data = $this->session->userdata("accountinfo");
299
+			$this->db->where("reseller_id",$account_data['id']);
300
+		}
301 301
         
302
-        $updateflg = $this->db_model->build_batch_update_array($update_array);
303
-        if($updateflg)
304
-            return $this->db->update("outbound_routes");
305
-        else
306
-            return false;
307
-    }
308
-    function origination_rate_batch_update($update_array){
309
-        $this->db_model->build_search('origination_rate_list_search');
310
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
311
-            $account_data = $this->session->userdata("accountinfo");
312
-            $this->db->where("reseller_id",$account_data['id']);
313
-        }
314
-        $updateflg = $this->db_model->build_batch_update_array($update_array);
315
-        if($updateflg)
316
-            return $this->db->update("routes");
317
-        else
318
-            return false;
319
-    }
320
-    function getreseller_rates_list($flag, $start = 0, $limit = 0,$export=false) {
321
-        $this->db_model->build_search('resellerrates_list_search');
322
-        $account_data = $this->session->userdata("accountinfo");
323
-        $where = array("status"=>"0","pricelist_id" => $account_data["pricelist_id"]);
324
-        if ($flag) {
325
-            $query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);            
326
-        } else {
327
-            $query = $this->db_model->countQuery("*", "routes", $where);
328
-        }
329
-        return $query;
330
-    }
302
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
303
+		if($updateflg)
304
+			return $this->db->update("outbound_routes");
305
+		else
306
+			return false;
307
+	}
308
+	function origination_rate_batch_update($update_array){
309
+		$this->db_model->build_search('origination_rate_list_search');
310
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
311
+			$account_data = $this->session->userdata("accountinfo");
312
+			$this->db->where("reseller_id",$account_data['id']);
313
+		}
314
+		$updateflg = $this->db_model->build_batch_update_array($update_array);
315
+		if($updateflg)
316
+			return $this->db->update("routes");
317
+		else
318
+			return false;
319
+	}
320
+	function getreseller_rates_list($flag, $start = 0, $limit = 0,$export=false) {
321
+		$this->db_model->build_search('resellerrates_list_search');
322
+		$account_data = $this->session->userdata("accountinfo");
323
+		$where = array("status"=>"0","pricelist_id" => $account_data["pricelist_id"]);
324
+		if ($flag) {
325
+			$query = $this->db_model->select("*", "routes", $where, "id", "ASC", $limit, $start);            
326
+		} else {
327
+			$query = $this->db_model->countQuery("*", "routes", $where);
328
+		}
329
+		return $query;
330
+	}
331 331
 /*************
332 332
 ASTPP  3.0
333 333
 Rate insert
334 334
 *************/
335
-    function insert_if_not_exitst($add_array,$table_name){
336
-        $insert_str = "Insert into $table_name (";
337
-        $insert_key = "";
338
-        $insert_value = "";
339
-        $update_str = "";
340
-        foreach($add_array as $key => $value){
341
-           if($key != 'id'){
342
-                   $insert_key .= $key.",";
343
-                   $insert_value .= "'$value',";   
344
-                   $update_str .= $key." = '$value',";
345
-           }
346
-        }
347
-        $insert_key = rtrim($insert_key,",");
348
-        $insert_value = rtrim($insert_value,",");
349
-        $update_str = rtrim($update_str,",");
350
-        $insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
351
-        $this->db->query($insert_str);
352
-    }   
335
+	function insert_if_not_exitst($add_array,$table_name){
336
+		$insert_str = "Insert into $table_name (";
337
+		$insert_key = "";
338
+		$insert_value = "";
339
+		$update_str = "";
340
+		foreach($add_array as $key => $value){
341
+		   if($key != 'id'){
342
+				   $insert_key .= $key.",";
343
+				   $insert_value .= "'$value',";   
344
+				   $update_str .= $key." = '$value',";
345
+		   }
346
+		}
347
+		$insert_key = rtrim($insert_key,",");
348
+		$insert_value = rtrim($insert_value,",");
349
+		$update_str = rtrim($update_str,",");
350
+		$insert_str .= $insert_key.") values"."(".$insert_value.")  ON DUPLICATE KEY UPDATE $update_str";
351
+		$this->db->query($insert_str);
352
+	}   
353 353
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/controllers/pricing.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -22,213 +22,213 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class pricing extends CI_Controller {
24 24
 
25
-    function pricing() {
26
-        parent::__construct();
27
-
28
-        $this->load->helper('template_inheritance');
29
-
30
-        $this->load->library('session');
31
-        $this->load->library("pricing_form");
32
-        $this->load->library('astpp/form');
33
-        $this->load->model('pricing_model');
34
-
35
-        if ($this->session->userdata('user_login') == FALSE)
36
-            redirect(base_url() . '/astpp/login');
37
-    }
38
-
39
-    function price_add($type = "") {
40
-        $data['username'] = $this->session->userdata('user_name');
41
-        $data['flag'] = 'Create Rate Group';
42
-        $data['page_title'] = 'Create Rate Group';
43
-        $data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), '');
44
-
45
-        $this->load->view('view_price_add_edit', $data);
46
-    }
47
-
48
-    function price_edit($edit_id = '') {
49
-        $data['page_title'] = 'Edit Rate Group';
50
-        $where = array('id' => $edit_id);
51
-        $account = $this->db_model->getSelect("*", " pricelists", $where);
52
-        foreach ($account->result_array() as $key => $value) {
53
-            $edit_data = $value;
54
-        }
25
+	function pricing() {
26
+		parent::__construct();
27
+
28
+		$this->load->helper('template_inheritance');
29
+
30
+		$this->load->library('session');
31
+		$this->load->library("pricing_form");
32
+		$this->load->library('astpp/form');
33
+		$this->load->model('pricing_model');
34
+
35
+		if ($this->session->userdata('user_login') == FALSE)
36
+			redirect(base_url() . '/astpp/login');
37
+	}
38
+
39
+	function price_add($type = "") {
40
+		$data['username'] = $this->session->userdata('user_name');
41
+		$data['flag'] = 'Create Rate Group';
42
+		$data['page_title'] = 'Create Rate Group';
43
+		$data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), '');
44
+
45
+		$this->load->view('view_price_add_edit', $data);
46
+	}
47
+
48
+	function price_edit($edit_id = '') {
49
+		$data['page_title'] = 'Edit Rate Group';
50
+		$where = array('id' => $edit_id);
51
+		$account = $this->db_model->getSelect("*", " pricelists", $where);
52
+		foreach ($account->result_array() as $key => $value) {
53
+			$edit_data = $value;
54
+		}
55 55
 	$routing_data = $this->db_model->getSelect("trunk_id", "routing",array("pricelist_id"=>$edit_id));
56 56
 	if($routing_data->num_rows > 0){
57 57
 	  foreach($routing_data->result_array() as $trunkid){
58
-	    $edit_data["trunk_id"][] = $trunkid["trunk_id"];
58
+		$edit_data["trunk_id"][] = $trunkid["trunk_id"];
59 59
 	  }
60 60
 	}
61
-        $data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $edit_data);
62
-        $this->load->view('view_price_add_edit', $data);
63
-    }
64
-
65
-    function price_save() {
66
-        $add_array = $this->input->post();
67
-
68
-        $data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $add_array);
69
-        if ($add_array['id'] != '') {
70
-            $data['page_title'] = 'Edit Price Details';
71
-            if ($this->form_validation->run() == FALSE) {
72
-                $data['validation_errors'] = validation_errors();
73
-                echo $data['validation_errors'];
74
-                exit;
75
-            } else {
61
+		$data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $edit_data);
62
+		$this->load->view('view_price_add_edit', $data);
63
+	}
64
+
65
+	function price_save() {
66
+		$add_array = $this->input->post();
67
+
68
+		$data['form'] = $this->form->build_form($this->pricing_form->get_pricing_form_fields(), $add_array);
69
+		if ($add_array['id'] != '') {
70
+			$data['page_title'] = 'Edit Price Details';
71
+			if ($this->form_validation->run() == FALSE) {
72
+				$data['validation_errors'] = validation_errors();
73
+				echo $data['validation_errors'];
74
+				exit;
75
+			} else {
76 76
 	  	  $where = array("pricelist_id"=>$add_array['id']);
77 77
 	  	  $this->db->delete("routing",$where);
78 78
 		if(isset($add_array['trunk_id']) && $add_array['trunk_id'] != ''){
79 79
 		  $this->set_force_routing($add_array['id'],$add_array['trunk_id']);
80 80
 		  unset($add_array['trunk_id']);
81 81
 		}
82
-                $this->pricing_model->edit_price($add_array, $add_array['id']);
83
-                echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group updated successfully!"));
84
-                exit;
85
-            }
86
-            $this->load->view('view_price_add_edit', $data);
87
-       }else {
88
-            $data['page_title'] = 'Create Price Details';
89
-            if ($this->form_validation->run() == FALSE) {
90
-                $data['validation_errors'] = validation_errors();
91
-                echo $data['validation_errors'];
92
-                exit;
93
-            } else {
82
+				$this->pricing_model->edit_price($add_array, $add_array['id']);
83
+				echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group updated successfully!"));
84
+				exit;
85
+			}
86
+			$this->load->view('view_price_add_edit', $data);
87
+	   }else {
88
+			$data['page_title'] = 'Create Price Details';
89
+			if ($this->form_validation->run() == FALSE) {
90
+				$data['validation_errors'] = validation_errors();
91
+				echo $data['validation_errors'];
92
+				exit;
93
+			} else {
94 94
 		if(isset($add_array['trunk_id']) && !empty($add_array['trunk_id']))
95
-                $trunk_id=$add_array['trunk_id'];
96
-                unset($add_array['trunk_id']);
97
-                $priceid=$this->pricing_model->add_price($add_array);
95
+				$trunk_id=$add_array['trunk_id'];
96
+				unset($add_array['trunk_id']);
97
+				$priceid=$this->pricing_model->add_price($add_array);
98 98
 		if(isset($trunk_id) && $trunk_id != ''){
99 99
 		  $this->set_force_routing($priceid,$trunk_id);
100 100
 		}
101
-                echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!"));
102
-                exit;
103
-            }
104
-        }
105
-    }
106
-    function set_force_routing($priceid,$trunkid){
101
+				echo json_encode(array("SUCCESS"=> $add_array["name"]." rate group added successfully!"));
102
+				exit;
103
+			}
104
+		}
105
+	}
106
+	function set_force_routing($priceid,$trunkid){
107 107
 // 	echo "<pre>".$priceid; print_r($trunkid);
108 108
 	foreach($trunkid as $id){
109 109
 	  $routing_arr = array("trunk_id" => $id, "pricelist_id"=>$priceid);
110 110
 	  $this->db->insert("routing",$routing_arr);
111 111
 	}
112
-    }
113
-    function price_list_search() {
114
-        $ajax_search = $this->input->post('ajax_search', 0);
115
-
116
-        if ($this->input->post('advance_search', TRUE) == 1) {
117
-            $this->session->set_userdata('advance_search', $this->input->post('advance_search'));
118
-            $action = $this->input->post();
119
-            unset($action['action']);
120
-            unset($action['advance_search']);
121
-            $this->session->set_userdata('price_list_search', $action);
122
-        }
123
-        if (@$ajax_search != 1) {
124
-            redirect(base_url() . 'accounts/customer_list/');
125
-        }
126
-    }
127
-
128
-    function price_list_clearsearchfilter() {
129
-        $this->session->set_userdata('advance_search', 0);
130
-        $this->session->set_userdata('account_search', "");
131
-    }
132
-
133
-    function price_list() {
134
-        $data['username'] = $this->session->userdata('user_name');
135
-        $data['page_title'] = 'Rate Groups';
112
+	}
113
+	function price_list_search() {
114
+		$ajax_search = $this->input->post('ajax_search', 0);
115
+
116
+		if ($this->input->post('advance_search', TRUE) == 1) {
117
+			$this->session->set_userdata('advance_search', $this->input->post('advance_search'));
118
+			$action = $this->input->post();
119
+			unset($action['action']);
120
+			unset($action['advance_search']);
121
+			$this->session->set_userdata('price_list_search', $action);
122
+		}
123
+		if (@$ajax_search != 1) {
124
+			redirect(base_url() . 'accounts/customer_list/');
125
+		}
126
+	}
127
+
128
+	function price_list_clearsearchfilter() {
129
+		$this->session->set_userdata('advance_search', 0);
130
+		$this->session->set_userdata('account_search', "");
131
+	}
132
+
133
+	function price_list() {
134
+		$data['username'] = $this->session->userdata('user_name');
135
+		$data['page_title'] = 'Rate Groups';
136 136
 		$data['search_flag'] = true;
137
-        $this->session->set_userdata('advance_search', 0);
138
-        $data['grid_fields'] = $this->pricing_form->build_pricing_list_for_admin();
139
-        $data["grid_buttons"] = $this->pricing_form->build_grid_buttons();
140
-        $data['form_search'] = $this->form->build_serach_form($this->pricing_form->get_pricing_search_form());
141
-        $this->load->view('view_price_list', $data);
142
-    }
143
-
144
-    /**
145
-     * -------Here we write code for controller accounts functions account_list------
146
-     * Listing of Accounts table data through php function json_encode
147
-     */
148
-    function price_list_json() {
149
-        $json_data = array();
150
-        $count_all = $this->pricing_model->getpricing_list(false);
151
-        $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
152
-        $json_data = $paging_data["json_paging"];
153
-
154
-        $query = $this->pricing_model->getpricing_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
155
-        $grid_fields = json_decode($this->pricing_form->build_pricing_list_for_admin());
156
-        $json_data['rows'] = $this->form->build_grid($query, $grid_fields);
157
-
158
-        echo json_encode($json_data);
159
-    }
160
-
161
-    function price_delete($pricelist_id) {
162
-        $where = array("id" => $pricelist_id);
163
-        $this->db_model->update("pricelists", array("status" => "2"), $where);
137
+		$this->session->set_userdata('advance_search', 0);
138
+		$data['grid_fields'] = $this->pricing_form->build_pricing_list_for_admin();
139
+		$data["grid_buttons"] = $this->pricing_form->build_grid_buttons();
140
+		$data['form_search'] = $this->form->build_serach_form($this->pricing_form->get_pricing_search_form());
141
+		$this->load->view('view_price_list', $data);
142
+	}
143
+
144
+	/**
145
+	 * -------Here we write code for controller accounts functions account_list------
146
+	 * Listing of Accounts table data through php function json_encode
147
+	 */
148
+	function price_list_json() {
149
+		$json_data = array();
150
+		$count_all = $this->pricing_model->getpricing_list(false);
151
+		$paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']);
152
+		$json_data = $paging_data["json_paging"];
153
+
154
+		$query = $this->pricing_model->getpricing_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]);
155
+		$grid_fields = json_decode($this->pricing_form->build_pricing_list_for_admin());
156
+		$json_data['rows'] = $this->form->build_grid($query, $grid_fields);
157
+
158
+		echo json_encode($json_data);
159
+	}
160
+
161
+	function price_delete($pricelist_id) {
162
+		$where = array("id" => $pricelist_id);
163
+		$this->db_model->update("pricelists", array("status" => "2"), $where);
164 164
 	$this->db->delete("routing",array("pricelist_id"=>$pricelist_id));
165
-        $this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!');
166
-        redirect(base_url() . 'pricing/price_list/');
167
-    }
165
+		$this->session->set_flashdata('astpp_notification', 'Rate group removed successfully!');
166
+		redirect(base_url() . 'pricing/price_list/');
167
+	}
168 168
 
169 169
  function price_delete_multiple() {
170
-        $add_array = $this->input->post();
171
-        $where = 'IN ('.$add_array['selected_ids'].')';
172
-        if (isset($add_array['flag'])) {            
173
-            $update_data = array('status' => '2');
174
-            $this->db->where('pricelist_id '.$where);
175
-            $this->db->delete('routes');            
176
-            $this->db->delete("routing",array("pricelist_id"=>$where));
177
-            $this->db->where('id '.$where);
178
-            echo $this->db->update('pricelists', $update_data);
179
-        } else {
180
-            $pricelist_arr=array();
181
-            //Get selected Rategroup Name from database.
182
-            $this->db->select('id,name');
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'];
188
-            }
189
-            //Get count of accounts which are using selected rategroups.
190
-            $this->db->where('pricelist_id '.$where);
191
-            $this->db->where('deleted',0);
192
-            $this->db->select('count(id) as cnt,pricelist_id');
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'];
199
-             }
200
-            }
201
-            //Get count of routes which are using selected rategroups.
202
-            $this->db->where('pricelist_id '.$where);
203
-            $this->db->select('count(id) as cnt,pricelist_id');
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'];
210
-             }
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 ";
218
-                 }
219
-                 if(isset($value['routes'])){
220
-                     $custom_str.= $value['routes']." origination rates and ";
221
-                 }
222
-                 $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n";
223
-               }
224
-            }
225
-            if(!empty($str)){
226
-                $data['str']=$str;
227
-            }    
228
-            $data['selected_ids']=$add_array['selected_ids'];
229
-            echo json_encode($data);
230
-        }
231
-    }
170
+		$add_array = $this->input->post();
171
+		$where = 'IN ('.$add_array['selected_ids'].')';
172
+		if (isset($add_array['flag'])) {            
173
+			$update_data = array('status' => '2');
174
+			$this->db->where('pricelist_id '.$where);
175
+			$this->db->delete('routes');            
176
+			$this->db->delete("routing",array("pricelist_id"=>$where));
177
+			$this->db->where('id '.$where);
178
+			echo $this->db->update('pricelists', $update_data);
179
+		} else {
180
+			$pricelist_arr=array();
181
+			//Get selected Rategroup Name from database.
182
+			$this->db->select('id,name');
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'];
188
+			}
189
+			//Get count of accounts which are using selected rategroups.
190
+			$this->db->where('pricelist_id '.$where);
191
+			$this->db->where('deleted',0);
192
+			$this->db->select('count(id) as cnt,pricelist_id');
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'];
199
+			 }
200
+			}
201
+			//Get count of routes which are using selected rategroups.
202
+			$this->db->where('pricelist_id '.$where);
203
+			$this->db->select('count(id) as cnt,pricelist_id');
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'];
210
+			 }
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 ";
218
+				 }
219
+				 if(isset($value['routes'])){
220
+					 $custom_str.= $value['routes']." origination rates and ";
221
+				 }
222
+				 $str.=" Rate group Name : ".$value['name']." using by ".rtrim($custom_str," and ")."\n";
223
+			   }
224
+			}
225
+			if(!empty($str)){
226
+				$data['str']=$str;
227
+			}    
228
+			$data['selected_ids']=$add_array['selected_ids'];
229
+			echo json_encode($data);
230
+		}
231
+	}
232 232
 /***********************************************************/
233 233
     
234 234
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/libraries/pricing_form.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 
24 24
 if (!defined('BASEPATH'))
25
-    exit('No direct script access allowed');
25
+	exit('No direct script access allowed');
26 26
 
27 27
 class pricing_form {
28
-    function __construct($library_name = '') {
29
-        $this->CI = & get_instance();
30
-    }
31
-    function get_pricing_form_fields() {
28
+	function __construct($library_name = '') {
29
+		$this->CI = & get_instance();
30
+	}
31
+	function get_pricing_form_fields() {
32 32
 	$form['forms'] = array(base_url() . 'pricing/price_save/', array('id' => 'pricing_form', 'method' => 'POST', 'name' => 'pricing_form'));
33
-        if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
34
-	    $form['Rate Group Information'] = array(
33
+		if ($this->CI->session->userdata('logintype') == 1 || $this->CI->session->userdata('logintype') == 5) {
34
+		$form['Rate Group Information'] = array(
35 35
 		array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''),
36 36
 		array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''),
37 37
 		array('Name', 'INPUT', array('name' => 'name', 'size' => '20',  'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', 'Please Enter account number'),
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 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 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 45
 	else{
46 46
 	  $form['Rate Group Information'] = array(
@@ -57,64 +57,64 @@  discard block
 block discarded – undo
57 57
 	}
58 58
         
59 59
 
60
-        $form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
61
-        $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
60
+		$form['button_cancel'] = array('name' => 'action', 'content' => 'Close', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'NULL\')');
61
+		$form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'id' => 'submit', 'type' => 'button', 'class' => 'btn btn-line-parrot');
62 62
 
63
-        return $form;
64
-    }
63
+		return $form;
64
+	}
65 65
 
66
-    function get_pricing_search_form() {
67
-        $form['forms'] = array("", array('id' => "price_search"));
68
-        $form['Search'] = array(
69
-            array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
70
-            array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_routetype_status', '', ''),
71
-            array('Initial Increment ', 'INPUT', array('name' => 'initially_increment[initially_increment]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'initially_increment[initially_increment-string]', '', '', '', 'search_string_type', ''),
72
-            array('Default Increment ', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'inc[inc-string]', '', '', '', 'search_string_type', ''),
66
+	function get_pricing_search_form() {
67
+		$form['forms'] = array("", array('id' => "price_search"));
68
+		$form['Search'] = array(
69
+			array('Name', 'INPUT', array('name' => 'name[name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'name[name-string]', '', '', '', 'search_string_type', ''),
70
+			array('Routing Type', 'routing_type', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_routetype_status', '', ''),
71
+			array('Initial Increment ', 'INPUT', array('name' => 'initially_increment[initially_increment]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'initially_increment[initially_increment-string]', '', '', '', 'search_string_type', ''),
72
+			array('Default Increment ', 'INPUT', array('name' => 'inc[inc]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'inc[inc-string]', '', '', '', 'search_string_type', ''),
73 73
             
74 74
 			array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''),
75
-            array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
76
-            array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
75
+			array('', 'HIDDEN', 'ajax_search', '1', '', '', ''),
76
+			array('', 'HIDDEN', 'advance_search', '1', '', '', ''),
77 77
 
78
-        );
79
-        $form['button_search'] = array('name' => 'action', 'id' => "price_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => "btn btn-line-parrot pull-right");
80
-        $form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => "btn btn-line-sky pull-right margin-x-10");
78
+		);
79
+		$form['button_search'] = array('name' => 'action', 'id' => "price_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => "btn btn-line-parrot pull-right");
80
+		$form['button_reset'] = array('name' => 'action', 'id' => "id_reset", 'content' => 'Clear', 'value' => 'cancel', 'type' => 'reset', 'class' => "btn btn-line-sky pull-right margin-x-10");
81 81
 
82
-        return $form;
83
-    }
82
+		return $form;
83
+	}
84 84
 
85 85
 	   /*
86 86
             ASTPP  3.0  Changes in grid size
87 87
             */
88
-    function build_pricing_list_for_admin() {
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"),
88
+	function build_pricing_list_for_admin() {
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"),
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
-            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"),
105
-            array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"),
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"),
105
+			array("Action", "150", "", "", "", array("EDIT" => array("url" => "pricing/price_edit/", "mode" => "popup"),
106 106
 
107
-                    "DELETE" => array("url" => "pricing/price_delete/", "mode" => "single")))
108
-                ));
109
-        return $grid_field_arr;
110
-    }
107
+					"DELETE" => array("url" => "pricing/price_delete/", "mode" => "single")))
108
+				));
109
+		return $grid_field_arr;
110
+	}
111 111
 
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/")
115
-            ));
116
-        return $buttons_json;
117
-    }
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/")
115
+			));
116
+		return $buttons_json;
117
+	}
118 118
 
119 119
 }
120 120
 
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/pricing/models/pricing_model.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -22,73 +22,73 @@
 block discarded – undo
22 22
 ###############################################################################
23 23
 class pricing_model extends CI_Model {
24 24
 
25
-    function pricing_model() {
26
-        parent::__construct();
27
-    }
25
+	function pricing_model() {
26
+		parent::__construct();
27
+	}
28 28
 
29
-    function getpricing_list($flag, $start = 0, $limit = 0) {
30
-        $this->db_model->build_search('price_list_search');
31
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
32
-            $account_data = $this->session->userdata("accountinfo");
33
-            $reseller = $account_data['id'];
34
-           //$where = array("reseller_id" => $reseller, "status" => "0");
29
+	function getpricing_list($flag, $start = 0, $limit = 0) {
30
+		$this->db_model->build_search('price_list_search');
31
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
32
+			$account_data = $this->session->userdata("accountinfo");
33
+			$reseller = $account_data['id'];
34
+		   //$where = array("reseller_id" => $reseller, "status" => "0");
35 35
 	$where = array("reseller_id" => $reseller, "status != " => "2");
36
-        } else {
37
-            $where = array("reseller_id" => "0", "status != " => "2");
38
-        }
39
-        if ($flag) {
40
-            $query = $this->db_model->Select("*", "pricelists", $where, "id", "ASC", $limit, $start);
41
-        } else {
42
-            $query = $this->db_model->countQuery("*", "pricelists", $where);
43
-        }
44
-        return $query;
45
-    }
36
+		} else {
37
+			$where = array("reseller_id" => "0", "status != " => "2");
38
+		}
39
+		if ($flag) {
40
+			$query = $this->db_model->Select("*", "pricelists", $where, "id", "ASC", $limit, $start);
41
+		} else {
42
+			$query = $this->db_model->countQuery("*", "pricelists", $where);
43
+		}
44
+		return $query;
45
+	}
46 46
 
47
-    function add_price($add_array) {
48
-        unset($add_array["action"]);
49
-        /*
47
+	function add_price($add_array) {
48
+		unset($add_array["action"]);
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");
53
-        /************************************/
54
-        if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
55
-            $account_data = $this->session->userdata("accountinfo");
56
-            $add_array["reseller_id"] = $account_data['id'];
57
-        } else {
58
-            $add_array["reseller_id"] = "0";
59
-        }
60
-        $this->db->insert("pricelists", $add_array);
52
+		$add_array['creation_date']=gmdate("Y-m-d H:i:s");
53
+		/************************************/
54
+		if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) {
55
+			$account_data = $this->session->userdata("accountinfo");
56
+			$add_array["reseller_id"] = $account_data['id'];
57
+		} else {
58
+			$add_array["reseller_id"] = "0";
59
+		}
60
+		$this->db->insert("pricelists", $add_array);
61 61
         
62
-        return $this->db->insert_id();
63
-    }
62
+		return $this->db->insert_id();
63
+	}
64 64
 
65
-    function edit_price($data, $id) {
66
-        unset($data["action"]);
67
-        /*
65
+	function edit_price($data, $id) {
66
+		unset($data["action"]);
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");
71
-        /*********************************************************/
72
-        $this->db->where("id", $id);
73
-        $this->db->update("pricelists", $data);
74
-        return true;
75
-    }
70
+		$data['last_modified_date']=gmdate("Y-m-d H:i:s");
71
+		/*********************************************************/
72
+		$this->db->where("id", $id);
73
+		$this->db->update("pricelists", $data);
74
+		return true;
75
+	}
76 76
 
77
-    function get_price_list_for_cdrs() {
78
-        if ($this->session->userdata('username') != "" && $this->session->userdata('logintype') != 2) {
79
-            $this->db->where('reseller', $this->session->userdata('username'));
80
-        } else {
81
-            $this->db->where(array('reseller' => "0"));
82
-        }
83
-        $this->db->where('status <', 2);
84
-        $this->db->order_by('name', 'desc');
85
-        $query = $this->db->get("pricelists");
86
-        $price_list = array();
87
-        $result = $query->result_array();
88
-        foreach ($result as $row) {
89
-            $price_list[$row['name']] = $row['name'];
90
-        }
91
-        return $price_list;
92
-    }
77
+	function get_price_list_for_cdrs() {
78
+		if ($this->session->userdata('username') != "" && $this->session->userdata('logintype') != 2) {
79
+			$this->db->where('reseller', $this->session->userdata('username'));
80
+		} else {
81
+			$this->db->where(array('reseller' => "0"));
82
+		}
83
+		$this->db->where('status <', 2);
84
+		$this->db->order_by('name', 'desc');
85
+		$query = $this->db->get("pricelists");
86
+		$price_list = array();
87
+		$result = $query->result_array();
88
+		foreach ($result as $row) {
89
+			$price_list[$row['name']] = $row['name'];
90
+		}
91
+		return $price_list;
92
+	}
93 93
 
94 94
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/login/controllers/login.php 1 patch
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 ###############################################################################
23 23
 class Login extends MX_Controller {
24 24
 
25
-    function Login() {
26
-        parent::__construct();
27
-        $this->load->helper('form');
28
-        $this->load->library('astpp/permission');
29
-        $this->load->library('encrypt');        
30
-        $this->load->model('Auth_model');
31
-        $this->load->model('db_model');
32
-    }
25
+	function Login() {
26
+		parent::__construct();
27
+		$this->load->helper('form');
28
+		$this->load->library('astpp/permission');
29
+		$this->load->library('encrypt');        
30
+		$this->load->model('Auth_model');
31
+		$this->load->model('db_model');
32
+	}
33 33
     
34
-    function set_lang_global($post=false){ 
34
+	function set_lang_global($post=false){ 
35 35
 	if(!is_array($post)){
36 36
 		$str=trim($post);
37 37
 		$new_arr[$str]=$str;
@@ -51,25 +51,25 @@  discard block
 block discarded – undo
51 51
 	} 
52 52
 	$this->locale->set_lang();
53 53
 	return true;
54
-    }
54
+	}
55 55
 
56
-    function index() {
57
-        if ($this->session->userdata('user_login') == FALSE) {
58
-            if (!empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
-	        $_POST['password']=$this->common->encode($_POST['password']);
60
-                $user_valid = $this->Auth_model->verify_login($_POST['username'], $_POST['password']);
56
+	function index() {
57
+		if ($this->session->userdata('user_login') == FALSE) {
58
+			if (!empty($_POST) && trim($_POST['username']) != '' && trim($_POST['password']) != '') {
59
+			$_POST['password']=$this->common->encode($_POST['password']);
60
+				$user_valid = $this->Auth_model->verify_login($_POST['username'], $_POST['password']);
61 61
                 
62
-                if ($user_valid == 1) {
63
-                    $this->session->set_userdata('user_login', TRUE);
64
-		    $where = "number = '".$this->db->escape_str($_POST['username'])."' OR email = '".$this->db->escape_str($_POST['username'])."'";
65
-                    $result = $this->db_model->getSelect("*", "accounts",$where);
66
-                    $result = $result->result_array();
67
-                    $result = $result[0];
68
-                     $logintype=$result['type']== -1 ? 2: $result['type'];
69
-                    $this->session->set_userdata('logintype', $logintype);
70
-                    $this->session->set_userdata('userlevel_logintype', $result['type']);
71
-                    $this->session->set_userdata('username', $_POST['username']);
72
-                    $this->session->set_userdata('accountinfo', $result);
62
+				if ($user_valid == 1) {
63
+					$this->session->set_userdata('user_login', TRUE);
64
+			$where = "number = '".$this->db->escape_str($_POST['username'])."' OR email = '".$this->db->escape_str($_POST['username'])."'";
65
+					$result = $this->db_model->getSelect("*", "accounts",$where);
66
+					$result = $result->result_array();
67
+					$result = $result[0];
68
+					 $logintype=$result['type']== -1 ? 2: $result['type'];
69
+					$this->session->set_userdata('logintype', $logintype);
70
+					$this->session->set_userdata('userlevel_logintype', $result['type']);
71
+					$this->session->set_userdata('username', $_POST['username']);
72
+					$this->session->set_userdata('accountinfo', $result);
73 73
 		/*
74 74
 		*
75 75
 		* Purpose : Display logo based on domain name
@@ -115,24 +115,24 @@  discard block
 block discarded – undo
115 115
 		$this->session->set_userdata('user_footer', $data['user_footer']);
116 116
 		//                      echo $data['user_header'];exit;
117 117
 		/***************************************************************************************/
118
-                    if ($result['type'] == 0 || $result['type'] == 1) {
119
-                        $menu_list = $this->permission->get_module_access($result['type']);
120
-                        $this->session->set_userdata('mode_cur', 'user');
121
-                        if($result['type'] == 1){
122
-                            redirect(base_url() . 'dashboard/');
123
-                        }else{
124
-                            redirect(base_url() . 'user/user/');
125
-                        }
126
-                    } else {
127
-                        $menu_list = $this->permission->get_module_access($result['type']);
128
-                        $this->session->set_userdata('mode_cur', 'admin');
129
-                        redirect(base_url() . 'dashboard/');
130
-                    }
131
-                } else {
118
+					if ($result['type'] == 0 || $result['type'] == 1) {
119
+						$menu_list = $this->permission->get_module_access($result['type']);
120
+						$this->session->set_userdata('mode_cur', 'user');
121
+						if($result['type'] == 1){
122
+							redirect(base_url() . 'dashboard/');
123
+						}else{
124
+							redirect(base_url() . 'user/user/');
125
+						}
126
+					} else {
127
+						$menu_list = $this->permission->get_module_access($result['type']);
128
+						$this->session->set_userdata('mode_cur', 'admin');
129
+						redirect(base_url() . 'dashboard/');
130
+					}
131
+				} else {
132 132
 		   
133
-                        $data['astpp_notification'] = "Login Failed! Try Again..";
134
-                }
135
-            }
133
+						$data['astpp_notification'] = "Login Failed! Try Again..";
134
+				}
135
+			}
136 136
 	/*
137 137
 	* Purpose : Display logo based on domain name
138 138
 	*/
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	$this->session->set_userdata('user_footer', $data['website_footer']);
149 149
 	//              echo $data['user_logo'];exit;
150 150
 	/***************************************************************************************/
151
-            $this->session->set_userdata('user_login', FALSE);
152
-            $data['app_name'] = 'ASTPP - Open Source Billing Solution';
153
-            $this->load->view('view_login', $data);
154
-        }else {
151
+			$this->session->set_userdata('user_login', FALSE);
152
+			$data['app_name'] = 'ASTPP - Open Source Billing Solution';
153
+			$this->load->view('view_login', $data);
154
+		}else {
155 155
 	/*
156 156
 	*
157 157
 	* Purpose : Display logo based on domain name
@@ -172,79 +172,79 @@  discard block
 block discarded – undo
172 172
 		$this->session->set_userdata('user_footer', $data['user_footer']);
173 173
 	//              echo $data['user_logo'];exit;
174 174
 /***************************************************************************************/
175
-	    if ($this->session->userdata('logintype') == '2') {
175
+		if ($this->session->userdata('logintype') == '2') {
176 176
 		redirect(base_url() . 'dashboard/');
177
-	    } else {
177
+		} else {
178 178
 		redirect(base_url().'user/user/');
179
-	    }
180
-        }
181
-    }
179
+		}
180
+		}
181
+	}
182 182
 
183
-    function logout() {
184
-        $this->session->sess_destroy();
185
-        redirect(base_url());
186
-    }
183
+	function logout() {
184
+		$this->session->sess_destroy();
185
+		redirect(base_url());
186
+	}
187 187
   function paypal_response(){
188
-      if(count($_POST)>0)
189
-      {
190
-        $response_arr=$_POST;
191
-	    $fp=fopen("/var/log/astpp/astpp_payment.log","w+");
192
-    	$date = date("Y-m-d H:i:s");
193
-	    fwrite($fp,"====================".$date."===============================\n");
194
-	    foreach($response_arr as $key => $value){	  
195
-		    fwrite($fp,$key.":::>".$value."\n");
196
-	    }
197
-    	$payment_check = $this->db_model->countQuery("txn_id", "payments", array("txn_id" => $response_arr['txn_id']));
198
-        if( ($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed" ) && $payment_check == 0){
188
+	  if(count($_POST)>0)
189
+	  {
190
+		$response_arr=$_POST;
191
+		$fp=fopen("/var/log/astpp/astpp_payment.log","w+");
192
+		$date = date("Y-m-d H:i:s");
193
+		fwrite($fp,"====================".$date."===============================\n");
194
+		foreach($response_arr as $key => $value){	  
195
+			fwrite($fp,$key.":::>".$value."\n");
196
+		}
197
+		$payment_check = $this->db_model->countQuery("txn_id", "payments", array("txn_id" => $response_arr['txn_id']));
198
+		if( ($response_arr["payment_status"] == "Pending" || $response_arr["payment_status"] == "Complete" || $response_arr["payment_status"] == "Completed" ) && $payment_check == 0){
199 199
 
200
-            $paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax","group_title"=>"paypal"))->first_row();
201
-            $paypal_tax =$paypal_tax['value'];
202
-            $balance_amt = $actual_amount = $response_arr["custom"];
203
-            $paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee","group_title"=>"paypal"))->first_row();
204
-            $paypal_fee = $paypal_fee['value'];
205
-            $paypalfee = ($paypal_fee == 0)?'0':$response_arr["mc_gross"];
206
-            $account_data = (array)$this->db->get_where("accounts", array("id" => $response_arr["item_number"]))->first_row();
207
-            $currency = (array)$this->db->get_where('currency', array("id"=>$account_data["currency_id"]))->first_row();
208
-            $date = date('Y-m-d H:i:s');
209
-            $payment_trans_array = array("accountid"=>$response_arr["item_number"],
210
-            				"amount"=>$response_arr["payment_gross"],
211
-	                                "tax"=>"1",
212
-	                                "payment_method"=>"Paypal",
213
-	                                "actual_amount"=>$actual_amount,
214
-	                                "paypal_fee"=>$paypalfee,
215
-                			"user_currency"=>$currency["currency"],
216
-                			"currency_rate"=>$currency["currencyrate"],
217
-                			"transaction_details"=>json_encode($response_arr),
218
-                			"date"=>$date);
219
-             $paymentid=$this->db->insert('payment_transaction',$payment_trans_array);
220
-    	     $parent_id =$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
221
-	     $payment_arr = array("accountid"=> $response_arr["item_number"],
222
-	     		"payment_mode"=>"1","credit"=>$balance_amt,
223
-	    		"type"=>"PAYPAL",
224
-	    		"payment_by"=>$parent_id,
225
-	    		"notes"=>"Payment Made by Paypal on date:-".$date,
226
-	    		"paypalid"=>$paymentid,
227
-		    	"txn_id"=>$response_arr["txn_id"],
228
-		    	'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
229
-	     $this->db->insert('payments', $payment_arr);
230
-	     $this->db->select('invoiceid');
231
-	     $this->db->order_by('id','desc');
232
-	     $this->db->limit(1);
233
- 	     $last_invoice_result=(array)$this->db->get('invoices')->first_row();
234
- 	     $last_invoice_ID=isset($last_invoice_result['invoiceid'] ) && $last_invoice_result['invoiceid'] > 0 ?$last_invoice_result['invoiceid'] : 1;
235
- 	     $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
-	     $where="accountid IN ('".$reseller_id."','1')";
237
-	     $this->db->where($where);
238
-	     $this->db->select('*');
239
-	     $this->db->order_by('accountid', 'desc');
240
-	     $this->db->limit(1);
241
-             $invoiceconf = $this->db->get('invoice_conf');
242
-             $invoiceconf = (array)$invoiceconf->first_row();
243
-	     $invoice_prefix=$invoiceconf['invoice_prefix'];
200
+			$paypal_tax = (array)$this->db->get_where("system", array("name" => "paypal_tax","group_title"=>"paypal"))->first_row();
201
+			$paypal_tax =$paypal_tax['value'];
202
+			$balance_amt = $actual_amount = $response_arr["custom"];
203
+			$paypal_fee = (array)$this->db->get_where("system", array("name" => "paypal_fee","group_title"=>"paypal"))->first_row();
204
+			$paypal_fee = $paypal_fee['value'];
205
+			$paypalfee = ($paypal_fee == 0)?'0':$response_arr["mc_gross"];
206
+			$account_data = (array)$this->db->get_where("accounts", array("id" => $response_arr["item_number"]))->first_row();
207
+			$currency = (array)$this->db->get_where('currency', array("id"=>$account_data["currency_id"]))->first_row();
208
+			$date = date('Y-m-d H:i:s');
209
+			$payment_trans_array = array("accountid"=>$response_arr["item_number"],
210
+							"amount"=>$response_arr["payment_gross"],
211
+									"tax"=>"1",
212
+									"payment_method"=>"Paypal",
213
+									"actual_amount"=>$actual_amount,
214
+									"paypal_fee"=>$paypalfee,
215
+							"user_currency"=>$currency["currency"],
216
+							"currency_rate"=>$currency["currencyrate"],
217
+							"transaction_details"=>json_encode($response_arr),
218
+							"date"=>$date);
219
+			 $paymentid=$this->db->insert('payment_transaction',$payment_trans_array);
220
+			 $parent_id =$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : '-1';
221
+		 $payment_arr = array("accountid"=> $response_arr["item_number"],
222
+		 		"payment_mode"=>"1","credit"=>$balance_amt,
223
+				"type"=>"PAYPAL",
224
+				"payment_by"=>$parent_id,
225
+				"notes"=>"Payment Made by Paypal on date:-".$date,
226
+				"paypalid"=>$paymentid,
227
+				"txn_id"=>$response_arr["txn_id"],
228
+				'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
229
+		 $this->db->insert('payments', $payment_arr);
230
+		 $this->db->select('invoiceid');
231
+		 $this->db->order_by('id','desc');
232
+		 $this->db->limit(1);
233
+ 		 $last_invoice_result=(array)$this->db->get('invoices')->first_row();
234
+ 		 $last_invoice_ID=isset($last_invoice_result['invoiceid'] ) && $last_invoice_result['invoiceid'] > 0 ?$last_invoice_result['invoiceid'] : 1;
235
+ 		 $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
236
+		 $where="accountid IN ('".$reseller_id."','1')";
237
+		 $this->db->where($where);
238
+		 $this->db->select('*');
239
+		 $this->db->order_by('accountid', 'desc');
240
+		 $this->db->limit(1);
241
+			 $invoiceconf = $this->db->get('invoice_conf');
242
+			 $invoiceconf = (array)$invoiceconf->first_row();
243
+		 $invoice_prefix=$invoiceconf['invoice_prefix'];
244 244
 
245
-	     $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
-	     $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
247
-	     $details_insert=array(
245
+		 $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));  
246
+		 $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
247
+		 $details_insert=array(
248 248
 			'created_date'=>$date,
249 249
 			'credit'=>$balance_amt,
250 250
 			'debit'=>'-',
@@ -253,45 +253,45 @@  discard block
 block discarded – undo
253 253
 			'invoiceid'=>$invoice_id,
254 254
 			'description'=>"Payment Made by Paypal on date:-".$date,
255 255
 			'item_type'=>'PAYMENT',
256
-	  	        'before_balance'=>$account_data['balance'],
256
+	  			'before_balance'=>$account_data['balance'],
257 257
 			'after_balance'=>$account_data['balance']+$balance_amt,
258 258
 			);
259 259
 		$this->db->insert("invoice_details", $details_insert); 
260 260
 		$this->db_model->update_balance($balance_amt,$account_data["id"],"credit");            
261 261
 		if($parent_id > 0){
262
-		      $reseller_ids=$this->common->get_parent_info($parent_id,0);
263
-		      $reseller_ids=rtrim($reseller_ids,",");
264
-		      $reseller_arr=explode(",",$reseller_ids);
265
-		      if(!empty($reseller_arr)){
262
+			  $reseller_ids=$this->common->get_parent_info($parent_id,0);
263
+			  $reseller_ids=rtrim($reseller_ids,",");
264
+			  $reseller_arr=explode(",",$reseller_ids);
265
+			  if(!empty($reseller_arr)){
266 266
 			foreach($reseller_arr as $key=>$reseller_id){
267 267
 			  $account_data = (array)$this->db->get_where("accounts", array("id" => $reseller_id))->first_row();
268 268
 			  $this->db->select('invoiceid');
269
-		          $this->db->order_by('id','desc');
270
-		          $this->db->limit(1);
271
- 	                  $last_invoice_result=(array)$this->db->get('invoices')->first_row();
272
- 	                  $last_invoice_ID=$last_invoice_result['invoiceid'];
273
- 	     		  $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
-	                  $where="accountid IN ('".$reseller_id."','1')";
275
-	                  $this->db->where($where);
276
-		          $this->db->select('*');
277
-		          $this->db->order_by('accountid', 'desc');
278
-		          $this->db->limit(1);
279
-		          $invoiceconf = $this->db->get('invoice_conf');
280
-		          $invoiceconf = (array)$invoiceconf->first_row();
281
-	                  $invoice_prefix=$invoiceconf['invoice_prefix'];
282
-	     		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
-	     		  $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
269
+				  $this->db->order_by('id','desc');
270
+				  $this->db->limit(1);
271
+ 					  $last_invoice_result=(array)$this->db->get('invoices')->first_row();
272
+ 					  $last_invoice_ID=$last_invoice_result['invoiceid'];
273
+ 		 		  $reseller_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : 0;
274
+					  $where="accountid IN ('".$reseller_id."','1')";
275
+					  $this->db->where($where);
276
+				  $this->db->select('*');
277
+				  $this->db->order_by('accountid', 'desc');
278
+				  $this->db->limit(1);
279
+				  $invoiceconf = $this->db->get('invoice_conf');
280
+				  $invoiceconf = (array)$invoiceconf->first_row();
281
+					  $invoice_prefix=$invoiceconf['invoice_prefix'];
282
+		 		  $due_date = gmdate("Y-m-d H:i:s",strtotime(gmdate("Y-m-d H:i:s")." +".$invoiceconf['interval']." days"));
283
+		 		  $invoice_id=$this->generate_receipt($account_data['id'],$balance_amt,$account_data,$last_invoice_ID+1,$invoice_prefix,$due_date);
284 284
 			  $parent_id=$account_data['reseller_id'] > 0 ? $account_data['reseller_id'] : -1;
285 285
 			  $payment_arr = array("accountid"=> $account_data["id"],
286
-	     					"payment_mode"=>"1",
287
-	     					"credit"=>$balance_amt,
288
-				    		"type"=>"PAYPAL",
289
-	    					"payment_by"=>$parent_id,
290
-	    					"notes"=>"Your account has been credited due to your customer account recharge done by paypal",
291
-				    		"paypalid"=>$paymentid,
292
-		    				"txn_id"=>$response_arr["txn_id"],
293
-		    				'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
294
-	 	          $this->db->insert('payments', $payment_arr);
286
+		 					"payment_mode"=>"1",
287
+		 					"credit"=>$balance_amt,
288
+							"type"=>"PAYPAL",
289
+							"payment_by"=>$parent_id,
290
+							"notes"=>"Your account has been credited due to your customer account recharge done by paypal",
291
+							"paypalid"=>$paymentid,
292
+							"txn_id"=>$response_arr["txn_id"],
293
+							'payment_date'=>gmdate('Y-m-d H:i:s',strtotime($response_arr['payment_date'])));
294
+	 			  $this->db->insert('payments', $payment_arr);
295 295
 			  $details_insert=array(
296 296
 				'created_date'=>$date,
297 297
 				'credit'=>$balance_amt,
@@ -301,29 +301,29 @@  discard block
 block discarded – undo
301 301
 				'invoiceid'=>$invoice_id,
302 302
 				'description'=>"Your account has been credited due to your customer account recharge done by paypal",
303 303
 				'item_type'=>'PAYMENT',
304
-		  	        'before_balance'=>$account_data['balance'],
304
+		  			'before_balance'=>$account_data['balance'],
305 305
 				'after_balance'=>$account_data['balance']+$balance_amt,
306 306
 			   );
307
-		          $this->db->insert("invoice_details", $details_insert); 
308
-	          	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
307
+				  $this->db->insert("invoice_details", $details_insert); 
308
+			  	  $this->db_model->update_balance($balance_amt,$account_data["id"],"credit");  			         
309 309
 			}
310
-		      }
310
+			  }
311 311
 		}
312 312
 		redirect(base_url() . 'user/user/');
313
-        }
314
-      }         
313
+		}
314
+	  }         
315 315
 	redirect(base_url() . 'user/user/');
316
-    }
317
-    function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
316
+	}
317
+	function generate_receipt($accountid,$amount,$accountinfo,$last_invoice_ID,$invoice_prefix,$due_date){
318 318
 		$invoice_data = array("accountid"=>$accountid,"invoice_prefix" =>$invoice_prefix,"invoiceid"=>'0000'.$last_invoice_ID,"reseller_id"=>$accountinfo['reseller_id'],"invoice_date"=>gmdate("Y-m-d H:i:s"),"from_date"=>  gmdate("Y-m-d H:i:s"),"to_date"=>gmdate("Y-m-d H:i:s"),"due_date"=>$due_date,"status"=>1,"balance"=>$accountinfo['balance'],"amount"=>$amount,"type"=>'R',"confirm"=>'1');            
319
-        $this->db->insert("invoices",$invoice_data);
320
-        $invoiceid = $this->db->insert_id();    
321
-        return  $invoiceid;  
322
-    }
319
+		$this->db->insert("invoices",$invoice_data);
320
+		$invoiceid = $this->db->insert_id();    
321
+		return  $invoiceid;  
322
+	}
323 323
     
324
-    function get_language_text(){
324
+	function get_language_text(){
325 325
    // echo '<pre>'; print_r($_POST); exit;
326
-      echo gettext($_POST['display']); 
326
+	  echo gettext($_POST['display']); 
327 327
  	}  
328 328
     
329 329
 }
Please login to merge, or discard this patch.
web_interface/astpp/application/modules/login/views/view_login.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
                         <?php if (isset($astpp_notification)){ ?>
40 40
                         Login unsuccessful. Please make sure you entered the correct username and password, and that your account is active.
41 41
                     <?php }else{
42
-                         echo "&nbsp;";
43
-                    } ?>
42
+						 echo "&nbsp;";
43
+					} ?>
44 44
                     </span></div> <br/>
45 45
                     <br/>
46 46
                     <br/>
Please login to merge, or discard this patch.