@@ -23,142 +23,142 @@ |
||
23 | 23 | ############################################################################### |
24 | 24 | |
25 | 25 | if (!defined('BASEPATH')) |
26 | - exit('No direct script access allowed'); |
|
26 | + exit('No direct script access allowed'); |
|
27 | 27 | |
28 | 28 | class Package_form { |
29 | 29 | |
30 | - function get_package_form_fields($id='') { |
|
31 | - $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form')); |
|
32 | - $form['Package Information'] = array( |
|
33 | - array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | - array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
|
35 | - array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
37 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
30 | + function get_package_form_fields($id='') { |
|
31 | + $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form')); |
|
32 | + $form['Package Information'] = array( |
|
33 | + array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
|
34 | + array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
|
35 | + array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
37 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
38 | 38 | /** |
39 | 39 | ASTPP 3.0 |
40 | 40 | Add For Package Inbound or Outbound or both? |
41 | 41 | **/ |
42 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', ''), |
|
42 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', ''), |
|
43 | 43 | /*********************************************/ |
44 | - array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status') |
|
45 | - ); |
|
46 | - $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/package/package_list/\')'); |
|
47 | - $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
48 | - |
|
49 | - return $form; |
|
50 | - } |
|
51 | - |
|
52 | - function get_package_search_form() { |
|
53 | - $form['forms'] = array("", array('id' => "package_search")); |
|
54 | - $form['Search'] = array( |
|
55 | - array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''), |
|
56 | - 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")), |
|
57 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''), |
|
44 | + array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Select Status', '', '', '', 'set_status') |
|
45 | + ); |
|
46 | + $form['button_cancel'] = array('name' => 'action', 'content' => 'Cancel', 'value' => 'cancel', 'type' => 'button', 'class' => 'btn btn-line-sky margin-x-10', 'onclick' => 'return redirect_page(\'/package/package_list/\')'); |
|
47 | + $form['button_save'] = array('name' => 'action', 'content' => 'Save', 'value' => 'save', 'type' => 'submit', 'class' => 'btn btn-line-parrot'); |
|
48 | + |
|
49 | + return $form; |
|
50 | + } |
|
51 | + |
|
52 | + function get_package_search_form() { |
|
53 | + $form['forms'] = array("", array('id' => "package_search")); |
|
54 | + $form['Search'] = array( |
|
55 | + array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''), |
|
56 | + 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")), |
|
57 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''), |
|
58 | 58 | /** |
59 | 59 | ASTPP 3.0 |
60 | 60 | Add For Package Inbound or Outbound or both? |
61 | 61 | **/ |
62 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''), |
|
62 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''), |
|
63 | 63 | /*********************************************/ |
64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
65 | 65 | |
66 | - array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | - array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
66 | + array('', 'HIDDEN', 'ajax_search', '1', '', '', ''), |
|
67 | + array('', 'HIDDEN', 'advance_search', '1', '', '', ''), |
|
68 | 68 | |
69 | - ); |
|
70 | - $form['button_search'] = array('name' => 'action', 'id' => "package_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
71 | - $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'); |
|
69 | + ); |
|
70 | + $form['button_search'] = array('name' => 'action', 'id' => "package_search_btn", 'content' => 'Search', 'value' => 'save', 'type' => 'button', 'class' => 'btn btn-line-parrot pull-right'); |
|
71 | + $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'); |
|
72 | 72 | |
73 | - return $form; |
|
74 | - } |
|
73 | + return $form; |
|
74 | + } |
|
75 | 75 | |
76 | - function build_package_list_for_admin() { |
|
77 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
78 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
76 | + function build_package_list_for_admin() { |
|
77 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
78 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
79 | 79 | /** |
80 | 80 | ASTPP 3.0 |
81 | 81 | For Package edit on Name |
82 | 82 | **/ |
83 | - array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"), |
|
83 | + array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"), |
|
84 | 84 | /***********************************/ |
85 | - array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
86 | - array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"), |
|
85 | + array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
86 | + array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"), |
|
87 | 87 | /** |
88 | 88 | ASTPP 3.0 |
89 | 89 | Add For Package Inbound or Outbound or both? |
90 | 90 | **/ |
91 | - array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"), |
|
91 | + array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"), |
|
92 | 92 | /****************************************************/ |
93 | - /* |
|
93 | + /* |
|
94 | 94 | ASTPP 3.0 |
95 | 95 | Creation date,last modified date show in grid |
96 | 96 | */ |
97 | - array("Status", "140", "status", "status", "packages", "get_status","","true","center"), |
|
98 | - array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
99 | - array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
100 | - /***************************************************************/ |
|
101 | - /* |
|
97 | + array("Status", "140", "status", "status", "packages", "get_status","","true","center"), |
|
98 | + array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
99 | + array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
100 | + /***************************************************************/ |
|
101 | + /* |
|
102 | 102 | ASTPP 3.0 |
103 | 103 | status show active or inactive |
104 | 104 | */ |
105 | 105 | |
106 | - /********************************************/ |
|
107 | - array("Action", "160", "", "", "", array("EDIT" => array("url" => "package/package_edit/", "mode" => "single"), |
|
108 | - "DELETE" => array("url" => "package/package_delete/", "mode" => "single"))) |
|
109 | - )); |
|
110 | - return $grid_field_arr; |
|
111 | - } |
|
112 | - |
|
113 | - function build_grid_buttons() { |
|
114 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
115 | - array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/") |
|
116 | - )); |
|
117 | - return $buttons_json; |
|
118 | - } |
|
119 | - |
|
120 | - |
|
121 | - |
|
122 | - function build_package_counter_list_for_admin() { |
|
123 | - // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
124 | - $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"), |
|
125 | - array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
126 | - array("Used Seconds", "420", "seconds", "", "", "","","true","center"), |
|
127 | - )); |
|
128 | - return $grid_field_arr; |
|
129 | - } |
|
130 | - function build_pattern_list_for_customer($packageid) { |
|
131 | - $grid_field_arr = json_encode(array( |
|
132 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
133 | - array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"), |
|
134 | - array("Destination", "450", "destination", "", "", ""), |
|
135 | - array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single"))) |
|
136 | - )); |
|
137 | - return $grid_field_arr; |
|
138 | - } |
|
139 | - function set_pattern_grid_buttons($packageid) { |
|
140 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
141 | - return $buttons_json; |
|
142 | - } |
|
106 | + /********************************************/ |
|
107 | + array("Action", "160", "", "", "", array("EDIT" => array("url" => "package/package_edit/", "mode" => "single"), |
|
108 | + "DELETE" => array("url" => "package/package_delete/", "mode" => "single"))) |
|
109 | + )); |
|
110 | + return $grid_field_arr; |
|
111 | + } |
|
112 | + |
|
113 | + function build_grid_buttons() { |
|
114 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
115 | + array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/") |
|
116 | + )); |
|
117 | + return $buttons_json; |
|
118 | + } |
|
119 | + |
|
120 | + |
|
121 | + |
|
122 | + function build_package_counter_list_for_admin() { |
|
123 | + // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
|
124 | + $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"), |
|
125 | + array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
126 | + array("Used Seconds", "420", "seconds", "", "", "","","true","center"), |
|
127 | + )); |
|
128 | + return $grid_field_arr; |
|
129 | + } |
|
130 | + function build_pattern_list_for_customer($packageid) { |
|
131 | + $grid_field_arr = json_encode(array( |
|
132 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
133 | + array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"), |
|
134 | + array("Destination", "450", "destination", "", "", ""), |
|
135 | + array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single"))) |
|
136 | + )); |
|
137 | + return $grid_field_arr; |
|
138 | + } |
|
139 | + function set_pattern_grid_buttons($packageid) { |
|
140 | + $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
141 | + return $buttons_json; |
|
142 | + } |
|
143 | 143 | |
144 | 144 | |
145 | 145 | |
146 | 146 | function build_package_counter_report() { |
147 | - $buttons_json = json_encode(array( |
|
148 | - array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
147 | + $buttons_json = json_encode(array( |
|
148 | + array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
149 | 149 | |
150 | - )); |
|
151 | - return $buttons_json; |
|
152 | - } |
|
153 | - function build_package_list_for_reseller(){ |
|
154 | - $grid_field_arr = json_encode(array( |
|
155 | - array("Name", "310", "package_name", "", "", "","","true","center"), |
|
156 | - array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
157 | - array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"), |
|
158 | - array("Status", "160", "status", "status", "status", "get_status","","true","center"), |
|
159 | - )); |
|
160 | - return $grid_field_arr; |
|
161 | - } |
|
150 | + )); |
|
151 | + return $buttons_json; |
|
152 | + } |
|
153 | + function build_package_list_for_reseller(){ |
|
154 | + $grid_field_arr = json_encode(array( |
|
155 | + array("Name", "310", "package_name", "", "", "","","true","center"), |
|
156 | + array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
157 | + array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"), |
|
158 | + array("Status", "160", "status", "status", "status", "get_status","","true","center"), |
|
159 | + )); |
|
160 | + return $grid_field_arr; |
|
161 | + } |
|
162 | 162 | |
163 | 163 | |
164 | 164 | } |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
25 | +if ( ! defined('BASEPATH')) |
|
26 | 26 | exit('No direct script access allowed'); |
27 | 27 | |
28 | 28 | class Package_form { |
29 | 29 | |
30 | - function get_package_form_fields($id='') { |
|
31 | - $form['forms'] = array(base_url() . 'package/package_save/'.$id."/",array('id'=>'packeage_form','method'=>'POST','name'=>'packeage_form')); |
|
30 | + function get_package_form_fields($id = '') { |
|
31 | + $form['forms'] = array(base_url().'package/package_save/'.$id."/", array('id'=>'packeage_form', 'method'=>'POST', 'name'=>'packeage_form')); |
|
32 | 32 | $form['Package Information'] = array( |
33 | 33 | array('', 'HIDDEN', array('name' => 'id'), '', '', '', ''), |
34 | 34 | array('', 'HIDDEN', array('name' => 'status', 'value' => '1'), '', '', ''), |
35 | - array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | - array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0","reseller_id" => "0")), |
|
37 | - array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
35 | + array('Name', 'INPUT', array('name' => 'package_name', 'size' => '20', 'class' => "text field medium"), 'trim|required|xss_clean', 'tOOL TIP', ''), |
|
36 | + array('Rate Group', 'pricelist_id', 'SELECT', '', 'dropdown', 'tOOL TIP', 'Please Enter account number', 'id', 'name', 'pricelists', 'build_dropdown', 'where_arr', array("status" => "0", "reseller_id" => "0")), |
|
37 | + array('Included Seconds', 'INPUT', array('name' => 'includedseconds', 'size' => '20', 'class' => "text field medium"), 'trim|is_numeric|required|xss_clean', 'tOOL TIP', ''), |
|
38 | 38 | /** |
39 | 39 | ASTPP 3.0 |
40 | 40 | Add For Package Inbound or Outbound or both? |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $form['forms'] = array("", array('id' => "package_search")); |
54 | 54 | $form['Search'] = array( |
55 | 55 | array('Name', 'INPUT', array('name' => 'package_name[package_name]', '', 'size' => '20', 'class' => "text field"), '', 'tOOL TIP', '1', 'package_name[package_name-string]', '', '', '', 'search_string_type', ''), |
56 | - 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")), |
|
56 | + 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")), |
|
57 | 57 | array('Included Seconds', 'INPUT', array('name' => 'includedseconds[includedseconds]', 'value' => '', 'size' => '20', 'class' => "text field"), '', 'Tool tips info', '1', 'includedseconds[includedseconds-integer]', '', '', '', 'search_int_type', ''), |
58 | 58 | /** |
59 | 59 | ASTPP 3.0 |
60 | 60 | Add For Package Inbound or Outbound or both? |
61 | 61 | **/ |
62 | - array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '',''), |
|
62 | + array('Applicable For?', 'applicable_for', 'SELECT', '', '', 'tOOL TIP', '', '', '', '', 'set_package_type', '', ''), |
|
63 | 63 | /*********************************************/ |
64 | 64 | array('Status', 'status', 'SELECT', '', '', 'tOOL TIP', 'Please Enter account number', '', '', '', 'set_search_status', '', ''), |
65 | 65 | |
@@ -75,28 +75,28 @@ discard block |
||
75 | 75 | |
76 | 76 | function build_package_list_for_admin() { |
77 | 77 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
78 | - $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
78 | + $grid_field_arr = json_encode(array(array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
79 | 79 | /** |
80 | 80 | ASTPP 3.0 |
81 | 81 | For Package edit on Name |
82 | 82 | **/ |
83 | - array("Name", "170", "package_name", "", "", "","EDITABLE","true","center"), |
|
83 | + array("Name", "170", "package_name", "", "", "", "EDITABLE", "true", "center"), |
|
84 | 84 | /***********************************/ |
85 | - array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
86 | - array("Included Seconds", "160", "includedseconds", "", "", "","","true","center"), |
|
85 | + array("Rate Group", "150", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"), |
|
86 | + array("Included Seconds", "160", "includedseconds", "", "", "", "", "true", "center"), |
|
87 | 87 | /** |
88 | 88 | ASTPP 3.0 |
89 | 89 | Add For Package Inbound or Outbound or both? |
90 | 90 | **/ |
91 | - array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type","","true","center"), |
|
91 | + array("Applicable For?", "200", "applicable_for", "applicable_for", "applicable_for", "get_package_type", "", "true", "center"), |
|
92 | 92 | /****************************************************/ |
93 | 93 | /* |
94 | 94 | ASTPP 3.0 |
95 | 95 | Creation date,last modified date show in grid |
96 | 96 | */ |
97 | - array("Status", "140", "status", "status", "packages", "get_status","","true","center"), |
|
98 | - array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to","","true","center"), |
|
99 | - array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to","","true","center"), |
|
97 | + array("Status", "140", "status", "status", "packages", "get_status", "", "true", "center"), |
|
98 | + array("Created Date", "120", "creation_date", "creation_date", "creation_date", "convert_GMT_to", "", "true", "center"), |
|
99 | + array("Modified Date", "140", "last_modified_date", "last_modified_date", "last_modified_date", "convert_GMT_to", "", "true", "center"), |
|
100 | 100 | /***************************************************************/ |
101 | 101 | /* |
102 | 102 | ASTPP 3.0 |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | function build_grid_buttons() { |
114 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
114 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/package/package_add/"), |
|
115 | 115 | array("Delete", "btn btn-line-danger", "fa fa-times-circle fa-lg", "button_action", "/package/package_delete_multiple/") |
116 | 116 | )); |
117 | 117 | return $buttons_json; |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | |
122 | 122 | function build_package_counter_list_for_admin() { |
123 | 123 | // array(display name, width, db_field_parent_table,feidname, db_field_child_table,function name); |
124 | - $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name","","true","center"), |
|
125 | - array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new","","true","center"), |
|
126 | - array("Used Seconds", "420", "seconds", "", "", "","","true","center"), |
|
124 | + $grid_field_arr = json_encode(array(array("Package Name", "430", "package_id", "package_name", "packages", "get_field_name", "", "true", "center"), |
|
125 | + array("Account", "420", "accountid", "first_name,last_name,number", "accounts", "get_field_name_coma_new", "", "true", "center"), |
|
126 | + array("Used Seconds", "420", "seconds", "", "", "", "", "true", "center"), |
|
127 | 127 | )); |
128 | 128 | return $grid_field_arr; |
129 | 129 | } |
130 | 130 | function build_pattern_list_for_customer($packageid) { |
131 | 131 | $grid_field_arr = json_encode(array( |
132 | - array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "","","false","center"), |
|
132 | + array("<input type='checkbox' name='chkAll' class='ace checkall'/><label class='lbl'></label>", "30", "", "", "", "", "", "false", "center"), |
|
133 | 133 | array("Code", "450", "patterns", "patterns", "", "get_only_numeric_val"), |
134 | 134 | array("Destination", "450", "destination", "", "", ""), |
135 | 135 | array("Action", "100", "", "", "", array("DELETE" => array("url" => "package/package_patterns_delete/$packageid/", "mode" => "single"))) |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | return $grid_field_arr; |
138 | 138 | } |
139 | 139 | function set_pattern_grid_buttons($packageid) { |
140 | - $buttons_json = json_encode(array(array("Create","btn btn-line-warning btn","fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
140 | + $buttons_json = json_encode(array(array("Create", "btn btn-line-warning btn", "fa fa-plus-circle fa-lg", "button_action", "/package/customer_add_patterns/$packageid", "popup"))); |
|
141 | 141 | return $buttons_json; |
142 | 142 | } |
143 | 143 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | |
146 | 146 | function build_package_counter_report() { |
147 | 147 | $buttons_json = json_encode(array( |
148 | - array("Export","btn btn-xing" ," fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
148 | + array("Export", "btn btn-xing", " fa fa-download fa-lg", "button_action", "/package/package_counter_report_export/", 'single') |
|
149 | 149 | |
150 | 150 | )); |
151 | 151 | return $buttons_json; |
152 | 152 | } |
153 | - function build_package_list_for_reseller(){ |
|
153 | + function build_package_list_for_reseller() { |
|
154 | 154 | $grid_field_arr = json_encode(array( |
155 | - array("Name", "310", "package_name", "", "", "","","true","center"), |
|
156 | - array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name","","true","center"), |
|
157 | - array("Included Seconds", "260", "includedseconds", "", "", "","","true","center"), |
|
158 | - array("Status", "160", "status", "status", "status", "get_status","","true","center"), |
|
155 | + array("Name", "310", "package_name", "", "", "", "", "true", "center"), |
|
156 | + array("Rate Group", "250", "pricelist_id", "name", "pricelists", "get_field_name", "", "true", "center"), |
|
157 | + array("Included Seconds", "260", "includedseconds", "", "", "", "", "true", "center"), |
|
158 | + array("Status", "160", "status", "status", "status", "get_status", "", "true", "center"), |
|
159 | 159 | )); |
160 | 160 | return $grid_field_arr; |
161 | 161 | } |
@@ -22,8 +22,9 @@ |
||
22 | 22 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ############################################################################### |
24 | 24 | |
25 | -if (!defined('BASEPATH')) |
|
26 | - exit('No direct script access allowed'); |
|
25 | +if (!defined('BASEPATH')) { |
|
26 | + exit('No direct script access allowed'); |
|
27 | +} |
|
27 | 28 | |
28 | 29 | class Package_form { |
29 | 30 |
@@ -24,32 +24,32 @@ |
||
24 | 24 | <div class="col-md-12 no-padding color-three border_box"> |
25 | 25 | <div class="pull-left"> |
26 | 26 | <ul class="breadcrumb"> |
27 | - <li><a href="<?= base_url() . "package/package_list/";?>">Package List </a></li> |
|
27 | + <li><a href="<?= base_url()."package/package_list/"; ?>">Package List </a></li> |
|
28 | 28 | <li class="active"> |
29 | - <a href="<?= base_url() . "package/package_edit/". $edit_id . "/";?>">Details </a> |
|
29 | + <a href="<?= base_url()."package/package_edit/".$edit_id."/"; ?>">Details </a> |
|
30 | 30 | </li> |
31 | 31 | <li class="active"> |
32 | - <a href="<?= base_url() . "package/package_pattern_list/". $edit_id . "/";?>">Codes </a> |
|
32 | + <a href="<?= base_url()."package/package_pattern_list/".$edit_id."/"; ?>">Codes </a> |
|
33 | 33 | </li> |
34 | 34 | </ul> |
35 | 35 | </div> |
36 | 36 | <ul class="breadcrumb"> |
37 | 37 | <li class="active pull-right"> |
38 | - <a href="<?= base_url() . "package/package_edit/" . strtolower($accounttype) . $edit_id . "/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
38 | + <a href="<?= base_url()."package/package_edit/".strtolower($accounttype).$edit_id."/"; ?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
39 | 39 | </ul> |
40 | 40 | </div> |
41 | 41 | <div class="padding-15 col-md-12"> |
42 | 42 | <div class="col-md-12 no-padding"> |
43 | 43 | <div class="pull-left margin-t-10"> |
44 | 44 | <span class="btn btn-line-warning"> |
45 | - <a href='<?php echo base_url() . "/package/package_patterns_add/" . $edit_id . "/"; ?>' rel="facebox_medium" title="Add"> |
|
45 | + <a href='<?php echo base_url()."/package/package_patterns_add/".$edit_id."/"; ?>' rel="facebox_medium" title="Add"> |
|
46 | 46 | <i class="fa fa-plus-circle fa-lg"></i> Add |
47 | 47 | </a> |
48 | 48 | </span> |
49 | 49 | </div> |
50 | 50 | |
51 | 51 | <div class="pull-left margin-t-10" style="padding-left:5px"> |
52 | - <a href='<?php echo base_url() . "/package/package_patterns_import/" . $edit_id . "/"; ?>' title="Import"> |
|
52 | + <a href='<?php echo base_url()."/package/package_patterns_import/".$edit_id."/"; ?>' title="Import"> |
|
53 | 53 | <span class="btn btn-line-blue"> |
54 | 54 | |
55 | 55 | <i class="fa fa-upload fa-lg"></i> Import |
@@ -10,15 +10,15 @@ |
||
10 | 10 | <div class="col-md-12 no-padding color-three border_box"> |
11 | 11 | <div class="pull-left"> |
12 | 12 | <ul class="breadcrumb"> |
13 | - <li><a href="<?= base_url() . "package/package_list/";?>">Package List </a></li> |
|
13 | + <li><a href="<?= base_url()."package/package_list/"; ?>">Package List </a></li> |
|
14 | 14 | <li class="active"> |
15 | - <a href="<?= base_url() . "package/package_edit/". $edit_id . "/";?>">Details </a> |
|
15 | + <a href="<?= base_url()."package/package_edit/".$edit_id."/"; ?>">Details </a> |
|
16 | 16 | </li> |
17 | 17 | </ul> |
18 | 18 | </div> |
19 | 19 | <ul class="breadcrumb"> |
20 | 20 | <li class="active pull-right"> |
21 | - <a href="<?= base_url() . "package/package_list/"?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
21 | + <a href="<?= base_url()."package/package_list/"?>"> <i class="fa fa-fast-backward" aria-hidden="true"></i> Back</a></li> |
|
22 | 22 | </ul> |
23 | 23 | </div> |
24 | 24 | <div class="padding-15 col-md-12"> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | <div class="w-section inverse no-padding"> |
13 | 13 | <?php echo $form; ?> |
14 | 14 | <?php |
15 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
15 | + if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
16 | 16 | <script> |
17 | 17 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
18 | 18 | print_error(ERR_STR); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | <div class="w-section inverse no-padding"> |
13 | 13 | <?php echo $form; ?> |
14 | 14 | <?php |
15 | - if(isset($validation_errors) && $validation_errors != ''){ ?> |
|
15 | + if (isset($validation_errors) && $validation_errors != '') { ?> |
|
16 | 16 | <script> |
17 | 17 | var ERR_STR = '<?php echo $validation_errors; ?>'; |
18 | 18 | print_error(ERR_STR); |
@@ -16,8 +16,8 @@ discard block |
||
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.</p> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | </div> |
37 | 37 | <? |
38 | 38 | $logintype=$this->session->userdata('userlevel_logintype'); |
39 | - // $trunk=null; |
|
39 | + // $trunk=null; |
|
40 | 40 | if($logintype !=1) { ?> |
41 | 41 | <div class="col-md-12 no-padding"> |
42 | 42 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | <?}?> |
99 | 99 | |
100 | 100 | <?php |
101 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
101 | + if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
102 | 102 | |
103 | 103 | <section class="slice color-three"> |
104 | 104 | <div class="w-section inverse no-padding"> |
@@ -108,24 +108,24 @@ discard block |
||
108 | 108 | <form id="import_form" name="import_form" action="<?=base_url()?>package/package_patterns_import_file/<?=$edit_id?>/<?=$check_header?>/" method="POST"> |
109 | 109 | <table width="100%" border="1" class="details_table table"> |
110 | 110 | <? $cnt =7; |
111 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
112 | - if($csv_key < 15){ |
|
113 | - echo "<tr>"; |
|
114 | - foreach($csv_value as $field_name => $field_val){ |
|
115 | - if($csv_key == 0){ |
|
116 | - echo "<th>".ucfirst($field_name)."</th>"; |
|
117 | - }else{ |
|
118 | - echo "<td class='portlet-content'>".$field_val."</td>"; |
|
119 | - } |
|
120 | - } |
|
121 | - echo "</tr>"; |
|
122 | - } |
|
123 | - } |
|
111 | + foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
112 | + if($csv_key < 15){ |
|
113 | + echo "<tr>"; |
|
114 | + foreach($csv_value as $field_name => $field_val){ |
|
115 | + if($csv_key == 0){ |
|
116 | + echo "<th>".ucfirst($field_name)."</th>"; |
|
117 | + }else{ |
|
118 | + echo "<td class='portlet-content'>".$field_val."</td>"; |
|
119 | + } |
|
120 | + } |
|
121 | + echo "</tr>"; |
|
122 | + } |
|
123 | + } |
|
124 | 124 | |
125 | - echo "<tr><td colspan='".$cnt."'> |
|
125 | + echo "<tr><td colspan='".$cnt."'> |
|
126 | 126 | <a href='".base_url()."package/package_patterns_import/$edit_id'><input type='button' class='btn btn-line-sky pull-right margin-x-10' value='Back'/></a> |
127 | 127 | <input type='submit' class='btn btn-line-parrot pull-right' id='Process' value='Process'/></td></tr>"; |
128 | - ?> </table></form> |
|
128 | + ?> </table></form> |
|
129 | 129 | </div> |
130 | 130 | </div></div></div> |
131 | 131 | </section> |
@@ -2,20 +2,20 @@ discard block |
||
2 | 2 | <? startblock('extra_head') ?> |
3 | 3 | <? endblock() ?> |
4 | 4 | <? startblock('page-title') ?> |
5 | -<?= $page_title;?> |
|
5 | +<?= $page_title; ?> |
|
6 | 6 | <? endblock() ?> |
7 | 7 | <? startblock('content') ?> |
8 | - <?php if(!isset($csv_tmp_data)){ ?> |
|
8 | + <?php if ( ! isset($csv_tmp_data)) { ?> |
|
9 | 9 | |
10 | 10 | <section class="slice color-three padding-t-20"> |
11 | 11 | <div class="w-section inverse no-padding"> |
12 | 12 | <div class="container"> |
13 | - <form method="post" action="<?= base_url().'package/package_patterns_preview_file/'.$edit_id . "/"?>" enctype="multipart/form-data" id="package_code"> |
|
13 | + <form method="post" action="<?= base_url().'package/package_patterns_preview_file/'.$edit_id."/"?>" enctype="multipart/form-data" id="package_code"> |
|
14 | 14 | <div class="row"> |
15 | 15 | <div class="col-md-12"> |
16 | 16 | <div class="w-box"> |
17 | 17 | <span style="margin-left:10px; text-align: center;background-color: none;color:#DD191D;"> |
18 | - <? if(isset($error) && !empty($error)) { |
|
18 | + <? if (isset($error) && ! empty($error)) { |
|
19 | 19 | echo $error; |
20 | 20 | }?> |
21 | 21 | </span> |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | </div> |
36 | 36 | </div> |
37 | 37 | <? |
38 | - $logintype=$this->session->userdata('userlevel_logintype'); |
|
38 | + $logintype = $this->session->userdata('userlevel_logintype'); |
|
39 | 39 | // $trunk=null; |
40 | - if($logintype !=1) { ?> |
|
40 | + if ($logintype != 1) { ?> |
|
41 | 41 | <div class="col-md-12 no-padding"> |
42 | 42 | |
43 | 43 | <div> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | <div class="col-md-12 padding-b-10"> |
86 | 86 | <div class="pull-right"> |
87 | 87 | <input class="btn btn-line-parrot" id="import_package_code" type="submit" name="action" value="Import" /> |
88 | - <a href="<?= base_url().'package/package_pattern_list/'. $edit_id . "/"?>"><input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Cancel"/> </a> |
|
88 | + <a href="<?= base_url().'package/package_pattern_list/'.$edit_id."/"?>"><input class="btn btn-line-sky margin-x-10" id="ok" type="button" name="action" value="Cancel"/> </a> |
|
89 | 89 | |
90 | 90 | </div> |
91 | 91 | </div> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | <?}?> |
99 | 99 | |
100 | 100 | <?php |
101 | - if(isset($csv_tmp_data) && !empty($csv_tmp_data)){ ?> |
|
101 | + if (isset($csv_tmp_data) && ! empty($csv_tmp_data)) { ?> |
|
102 | 102 | |
103 | 103 | <section class="slice color-three"> |
104 | 104 | <div class="w-section inverse no-padding"> |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | <div class="col-md-12 margin-t-10"> |
108 | 108 | <form id="import_form" name="import_form" action="<?=base_url()?>package/package_patterns_import_file/<?=$edit_id?>/<?=$check_header?>/" method="POST"> |
109 | 109 | <table width="100%" border="1" class="details_table table"> |
110 | - <? $cnt =7; |
|
111 | - foreach($csv_tmp_data as $csv_key => $csv_value){ |
|
112 | - if($csv_key < 15){ |
|
110 | + <? $cnt = 7; |
|
111 | + foreach ($csv_tmp_data as $csv_key => $csv_value) { |
|
112 | + if ($csv_key < 15) { |
|
113 | 113 | echo "<tr>"; |
114 | - foreach($csv_value as $field_name => $field_val){ |
|
115 | - if($csv_key == 0){ |
|
114 | + foreach ($csv_value as $field_name => $field_val) { |
|
115 | + if ($csv_key == 0) { |
|
116 | 116 | echo "<th>".ucfirst($field_name)."</th>"; |
117 | - }else{ |
|
117 | + } else { |
|
118 | 118 | echo "<td class='portlet-content'>".$field_val."</td>"; |
119 | 119 | } |
120 | 120 | } |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | <div> |
44 | 44 | |
45 | 45 | </div> |
46 | - </div><? } |
|
47 | - else {?> |
|
46 | + </div><? } else {?> |
|
48 | 47 | <input type="hidden" name="trunk_id" value="0" /> |
49 | 48 | <?} ?> |
50 | 49 | <div class="col-md-12 no-padding"> |
@@ -114,7 +113,7 @@ discard block |
||
114 | 113 | foreach($csv_value as $field_name => $field_val){ |
115 | 114 | if($csv_key == 0){ |
116 | 115 | echo "<th>".ucfirst($field_name)."</th>"; |
117 | - }else{ |
|
116 | + } else{ |
|
118 | 117 | echo "<td class='portlet-content'>".$field_val."</td>"; |
119 | 118 | } |
120 | 119 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | </div> |
44 | 44 | <br/> |
45 | 45 | |
46 | - <?php if(isset($packageid) && $packageid!= ""){ ?> |
|
46 | + <?php if (isset($packageid) && $packageid != "") { ?> |
|
47 | 47 | <div class="col-md-12 padding-b-10"> |
48 | 48 | <div class="pull-right"> |
49 | 49 | <a href="<?= base_url().'package/package_pattern_list/'.$packageid?>"><input class="btn btn-line-sky margin-x-10" id="back_to_list" type="button" name="action" value="Back to Package Patterns List" /> </a> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <? startblock('extra_head') ?> |
3 | 3 | <script type="text/javascript" language="javascript"> |
4 | 4 | $(document).ready(function() { |
5 | - build_grid("package_counter_grid","",<? echo $grid_fields; ?>,<? echo $grid_buttons;?>); |
|
5 | + build_grid("package_counter_grid","",<? echo $grid_fields; ?>,<? echo $grid_buttons; ?>); |
|
6 | 6 | //build_grid("package_counter_grid","",<? echo $grid_fields; ?>); |
7 | 7 | }); |
8 | 8 | </script> |
@@ -22,88 +22,88 @@ discard block |
||
22 | 22 | ############################################################################### |
23 | 23 | class Package_model extends CI_Model { |
24 | 24 | |
25 | - function Package_model() { |
|
26 | - parent::__construct(); |
|
27 | - } |
|
25 | + function Package_model() { |
|
26 | + parent::__construct(); |
|
27 | + } |
|
28 | 28 | |
29 | - function getpackage_list($flag, $start = 0, $limit = 0) { |
|
30 | - $this->db_model->build_search('package_list_search'); |
|
31 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
32 | - $account_data = $this->session->userdata("accountinfo"); |
|
33 | - $where = array("reseller_id" => $account_data['id']); |
|
34 | - } else { |
|
35 | - $where = array("reseller_id"=>"0"); |
|
36 | - } |
|
37 | - if ($flag) { |
|
38 | - $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
39 | - } else { |
|
40 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
41 | - } |
|
42 | - return $query; |
|
43 | - } |
|
44 | - function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
45 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
46 | - $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
|
47 | - $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
29 | + function getpackage_list($flag, $start = 0, $limit = 0) { |
|
30 | + $this->db_model->build_search('package_list_search'); |
|
31 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
32 | + $account_data = $this->session->userdata("accountinfo"); |
|
33 | + $where = array("reseller_id" => $account_data['id']); |
|
34 | + } else { |
|
35 | + $where = array("reseller_id"=>"0"); |
|
36 | + } |
|
37 | + if ($flag) { |
|
38 | + $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
39 | + } else { |
|
40 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
41 | + } |
|
42 | + return $query; |
|
43 | + } |
|
44 | + function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
45 | + $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
46 | + $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
|
47 | + $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
48 | 48 | OR includedseconds like '%$instant_search%')":null; |
49 | - $this->db->where('id',$accountid); |
|
50 | - $this->db->select('pricelist_id'); |
|
51 | - $account_info=(array)$this->db->get('accounts')->first_row(); |
|
52 | - $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | - if(!empty($like_str)) |
|
54 | - $this->db->where($like_str); |
|
55 | - if ($flag) { |
|
56 | - $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
57 | - }else { |
|
58 | - $query = $this->db_model->countQuery("*", "packages", $where); |
|
59 | - } |
|
60 | - return $query; |
|
61 | - } |
|
62 | - function add_package($add_array) { |
|
63 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
64 | - $account_data = $this->session->userdata("accountinfo"); |
|
65 | - $add_array["reseller_id"] = $account_data['id']; |
|
66 | - } |
|
67 | - unset($add_array["action"]); |
|
68 | - /* |
|
49 | + $this->db->where('id',$accountid); |
|
50 | + $this->db->select('pricelist_id'); |
|
51 | + $account_info=(array)$this->db->get('accounts')->first_row(); |
|
52 | + $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | + if(!empty($like_str)) |
|
54 | + $this->db->where($like_str); |
|
55 | + if ($flag) { |
|
56 | + $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
|
57 | + }else { |
|
58 | + $query = $this->db_model->countQuery("*", "packages", $where); |
|
59 | + } |
|
60 | + return $query; |
|
61 | + } |
|
62 | + function add_package($add_array) { |
|
63 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
64 | + $account_data = $this->session->userdata("accountinfo"); |
|
65 | + $add_array["reseller_id"] = $account_data['id']; |
|
66 | + } |
|
67 | + unset($add_array["action"]); |
|
68 | + /* |
|
69 | 69 | ASTPP 3.0 Add creation date |
70 | 70 | */ |
71 | - $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
72 | - /*******************************************/ |
|
73 | - $this->db->insert("packages", $add_array); |
|
74 | - return true; |
|
75 | - } |
|
71 | + $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
72 | + /*******************************************/ |
|
73 | + $this->db->insert("packages", $add_array); |
|
74 | + return true; |
|
75 | + } |
|
76 | 76 | |
77 | - function edit_package($data, $id) { |
|
78 | - unset($data["action"]); |
|
79 | - /* |
|
77 | + function edit_package($data, $id) { |
|
78 | + unset($data["action"]); |
|
79 | + /* |
|
80 | 80 | ASTPP 3.0 add last modified field. |
81 | 81 | */ |
82 | - $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
83 | - /********************************************/ |
|
84 | - if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
85 | - $account_data = $this->session->userdata("accountinfo"); |
|
86 | - $add_array["reseller_id"] = $account_data['id']; |
|
87 | - } |
|
88 | - $this->db->where("id", $id); |
|
89 | - $this->db->update("packages", $data); |
|
90 | - return true; |
|
91 | - } |
|
82 | + $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
83 | + /********************************************/ |
|
84 | + if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
|
85 | + $account_data = $this->session->userdata("accountinfo"); |
|
86 | + $add_array["reseller_id"] = $account_data['id']; |
|
87 | + } |
|
88 | + $this->db->where("id", $id); |
|
89 | + $this->db->update("packages", $data); |
|
90 | + return true; |
|
91 | + } |
|
92 | 92 | |
93 | - function remove_package($id) { |
|
94 | - /* ASTPP 3.0 |
|
93 | + function remove_package($id) { |
|
94 | + /* ASTPP 3.0 |
|
95 | 95 | * Remove Package information from table package_patterns as well. |
96 | 96 | */ |
97 | - $this->db->where('package_id',$id); |
|
98 | - $this->db->delete('package_patterns'); |
|
99 | - /***************************************/ |
|
100 | - $this->db->where("id", $id); |
|
101 | - $this->db->delete("packages"); |
|
102 | - return true; |
|
103 | - } |
|
97 | + $this->db->where('package_id',$id); |
|
98 | + $this->db->delete('package_patterns'); |
|
99 | + /***************************************/ |
|
100 | + $this->db->where("id", $id); |
|
101 | + $this->db->delete("packages"); |
|
102 | + return true; |
|
103 | + } |
|
104 | 104 | |
105 | - function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
|
106 | - $where = array(); |
|
105 | + function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
|
106 | + $where = array(); |
|
107 | 107 | $accountinfo = $this->session->userdata('accountinfo'); |
108 | 108 | $reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id']; |
109 | 109 | $this->db->where('reseller_id',$reseller_id); |
@@ -114,109 +114,109 @@ discard block |
||
114 | 114 | if($result->num_rows() >0){ |
115 | 115 | $acc_arr=array(); |
116 | 116 | $result=$result->result_array(); |
117 | - foreach($result as $data){ |
|
118 | - $acc_arr[]=$data['id']; |
|
119 | - } |
|
120 | - $this->db->where_in('accountid',$acc_arr); |
|
121 | - if($flag){ |
|
122 | - $this->db->select('*'); |
|
123 | - } |
|
124 | - else{ |
|
125 | - $this->db->select('count(id) as count'); |
|
126 | - } |
|
127 | - if($flag){ |
|
128 | - $this->db->limit($limit, $start); |
|
129 | - } |
|
130 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
131 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
132 | - }else{ |
|
133 | - $this->db->order_by('seconds','desc'); |
|
134 | - } |
|
135 | - $result=$this->db->get('counters'); |
|
117 | + foreach($result as $data){ |
|
118 | + $acc_arr[]=$data['id']; |
|
119 | + } |
|
120 | + $this->db->where_in('accountid',$acc_arr); |
|
121 | + if($flag){ |
|
122 | + $this->db->select('*'); |
|
123 | + } |
|
124 | + else{ |
|
125 | + $this->db->select('count(id) as count'); |
|
126 | + } |
|
127 | + if($flag){ |
|
128 | + $this->db->limit($limit, $start); |
|
129 | + } |
|
130 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
131 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
132 | + }else{ |
|
133 | + $this->db->order_by('seconds','desc'); |
|
134 | + } |
|
135 | + $result=$this->db->get('counters'); |
|
136 | 136 | // echo $this->db->last_query();exit; |
137 | - if($flag){ |
|
138 | - return $result; |
|
139 | - }else{ |
|
140 | - $result=$result->result_array(); |
|
141 | - return $result[0]['count']; |
|
142 | - } |
|
137 | + if($flag){ |
|
138 | + return $result; |
|
139 | + }else{ |
|
140 | + $result=$result->result_array(); |
|
141 | + return $result[0]['count']; |
|
142 | + } |
|
143 | 143 | }else{ |
144 | - if($flag){ |
|
145 | - $query=(object)array('num_rows'=>0); |
|
146 | - } |
|
147 | - else{ |
|
148 | - $query=0; |
|
149 | - } |
|
144 | + if($flag){ |
|
145 | + $query=(object)array('num_rows'=>0); |
|
146 | + } |
|
147 | + else{ |
|
148 | + $query=0; |
|
149 | + } |
|
150 | 150 | return $query; |
151 | - } |
|
152 | - }else{ |
|
151 | + } |
|
152 | + }else{ |
|
153 | 153 | |
154 | - if($result->num_rows() >0){ |
|
155 | - $acc_arr=array(); |
|
156 | - $result=$result->result_array(); |
|
157 | - foreach($result as $data){ |
|
158 | - $acc_arr[]=$data['id']; |
|
159 | - } |
|
160 | - $this->db->where_in('accountid',$acc_arr); |
|
154 | + if($result->num_rows() >0){ |
|
155 | + $acc_arr=array(); |
|
156 | + $result=$result->result_array(); |
|
157 | + foreach($result as $data){ |
|
158 | + $acc_arr[]=$data['id']; |
|
159 | + } |
|
160 | + $this->db->where_in('accountid',$acc_arr); |
|
161 | 161 | } |
162 | 162 | |
163 | - if($flag){ |
|
163 | + if($flag){ |
|
164 | 164 | $this->db->select('*'); |
165 | - } |
|
166 | - else{ |
|
167 | - $this->db->select('count(id) as count'); |
|
168 | - } |
|
169 | - if($flag){ |
|
165 | + } |
|
166 | + else{ |
|
167 | + $this->db->select('count(id) as count'); |
|
168 | + } |
|
169 | + if($flag){ |
|
170 | 170 | $this->db->order_by('seconds','desc'); |
171 | 171 | $this->db->limit($limit, $start); |
172 | - } |
|
173 | - $result=$this->db->get('counters'); |
|
172 | + } |
|
173 | + $result=$this->db->get('counters'); |
|
174 | 174 | // echo $this->db->last_query();exit; |
175 | - if($result->num_rows() > 0){ |
|
176 | - if($flag){ |
|
175 | + if($result->num_rows() > 0){ |
|
176 | + if($flag){ |
|
177 | 177 | |
178 | 178 | return $result; |
179 | - }else{ |
|
179 | + }else{ |
|
180 | 180 | $result=$result->result_array(); |
181 | 181 | |
182 | 182 | return $result[0]['count']; |
183 | - } |
|
184 | - }else{ |
|
185 | - if($flag){ |
|
183 | + } |
|
184 | + }else{ |
|
185 | + if($flag){ |
|
186 | 186 | |
187 | 187 | $query=(object)array('num_rows'=>0); |
188 | - } |
|
189 | - else{ |
|
188 | + } |
|
189 | + else{ |
|
190 | 190 | $query=0; |
191 | - } |
|
191 | + } |
|
192 | 192 | // echo $this->db->last_query();exit; |
193 | 193 | return $query; |
194 | 194 | } |
195 | - } |
|
196 | - } |
|
197 | - function insert_package_pattern($data, $packageid) { |
|
195 | + } |
|
196 | + } |
|
197 | + function insert_package_pattern($data, $packageid) { |
|
198 | 198 | |
199 | 199 | //echo "<pre>"; prit_r($data); exit; |
200 | - $this->db->select("pattern,comment"); |
|
201 | - $this->db->where("id IN (".$data.")"); |
|
202 | - $result=$this->db->get("routes")->result_array(); |
|
200 | + $this->db->select("pattern,comment"); |
|
201 | + $this->db->where("id IN (".$data.")"); |
|
202 | + $result=$this->db->get("routes")->result_array(); |
|
203 | 203 | |
204 | - $tmp = array(); |
|
205 | - foreach ($result as $key => $data_value) { |
|
206 | - $tmp[$key]["package_id"] = $packageid; |
|
207 | - $tmp[$key]["patterns"] = $data_value['pattern']; |
|
208 | - $tmp[$key]["destination"] = $data_value['comment']; |
|
209 | - } |
|
210 | - return $this->db->insert_batch("package_patterns", $tmp); |
|
211 | - } |
|
204 | + $tmp = array(); |
|
205 | + foreach ($result as $key => $data_value) { |
|
206 | + $tmp[$key]["package_id"] = $packageid; |
|
207 | + $tmp[$key]["patterns"] = $data_value['pattern']; |
|
208 | + $tmp[$key]["destination"] = $data_value['comment']; |
|
209 | + } |
|
210 | + return $this->db->insert_batch("package_patterns", $tmp); |
|
211 | + } |
|
212 | 212 | |
213 | 213 | |
214 | - function bulk_insert_package_pattern($inserted_array) { |
|
214 | + function bulk_insert_package_pattern($inserted_array) { |
|
215 | 215 | //echo "<pre>";print_r($inserted_array);exit; |
216 | - $this->db->insert_batch('package_patterns', $inserted_array); |
|
217 | - $affected_row = $this->db->affected_rows(); |
|
218 | - return $affected_row; |
|
219 | - } |
|
216 | + $this->db->insert_batch('package_patterns', $inserted_array); |
|
217 | + $affected_row = $this->db->affected_rows(); |
|
218 | + return $affected_row; |
|
219 | + } |
|
220 | 220 | |
221 | 221 | |
222 | 222 |
@@ -41,20 +41,20 @@ discard block |
||
41 | 41 | } |
42 | 42 | return $query; |
43 | 43 | } |
44 | - function get_reseller_package_list($flag,$accountid,$accounttype,$start = 0, $limit = 0){ |
|
45 | - $instant_search=$this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
44 | + function get_reseller_package_list($flag, $accountid, $accounttype, $start = 0, $limit = 0) { |
|
45 | + $instant_search = $this->session->userdata('left_panel_search_'.$accounttype.'_packages'); |
|
46 | 46 | $instant_search_currency = $this->common_model->add_calculate_currency($instant_search, "", '', true, false); |
47 | - $like_str=!empty($instant_search) ? "(package_name like '%$instant_search%' |
|
48 | - OR includedseconds like '%$instant_search%')":null; |
|
49 | - $this->db->where('id',$accountid); |
|
47 | + $like_str = ! empty($instant_search) ? "(package_name like '%$instant_search%' |
|
48 | + OR includedseconds like '%$instant_search%')" : null; |
|
49 | + $this->db->where('id', $accountid); |
|
50 | 50 | $this->db->select('pricelist_id'); |
51 | - $account_info=(array)$this->db->get('accounts')->first_row(); |
|
52 | - $where=array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | - if(!empty($like_str)) |
|
51 | + $account_info = (array)$this->db->get('accounts')->first_row(); |
|
52 | + $where = array('pricelist_id'=>$account_info['pricelist_id']); |
|
53 | + if ( ! empty($like_str)) |
|
54 | 54 | $this->db->where($like_str); |
55 | 55 | if ($flag) { |
56 | 56 | $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
57 | - }else { |
|
57 | + } else { |
|
58 | 58 | $query = $this->db_model->countQuery("*", "packages", $where); |
59 | 59 | } |
60 | 60 | return $query; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /* |
69 | 69 | ASTPP 3.0 Add creation date |
70 | 70 | */ |
71 | - $add_array['creation_date']=gmdate('Y-m-d H:i:s'); |
|
71 | + $add_array['creation_date'] = gmdate('Y-m-d H:i:s'); |
|
72 | 72 | /*******************************************/ |
73 | 73 | $this->db->insert("packages", $add_array); |
74 | 74 | return true; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /* |
80 | 80 | ASTPP 3.0 add last modified field. |
81 | 81 | */ |
82 | - $data['last_modified_date']=gmdate('Y-m-d H:i:s'); |
|
82 | + $data['last_modified_date'] = gmdate('Y-m-d H:i:s'); |
|
83 | 83 | /********************************************/ |
84 | 84 | if ($this->session->userdata('logintype') == 1 || $this->session->userdata('logintype') == 5) { |
85 | 85 | $account_data = $this->session->userdata("accountinfo"); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | /* ASTPP 3.0 |
95 | 95 | * Remove Package information from table package_patterns as well. |
96 | 96 | */ |
97 | - $this->db->where('package_id',$id); |
|
97 | + $this->db->where('package_id', $id); |
|
98 | 98 | $this->db->delete('package_patterns'); |
99 | 99 | /***************************************/ |
100 | 100 | $this->db->where("id", $id); |
@@ -105,89 +105,89 @@ discard block |
||
105 | 105 | function getpackage_counter_list($flag, $start = 0, $limit = 0) { |
106 | 106 | $where = array(); |
107 | 107 | $accountinfo = $this->session->userdata('accountinfo'); |
108 | - $reseller_id=$accountinfo['type']== -1 ? 0 : $accountinfo['id']; |
|
109 | - $this->db->where('reseller_id',$reseller_id); |
|
108 | + $reseller_id = $accountinfo['type'] == -1 ? 0 : $accountinfo['id']; |
|
109 | + $this->db->where('reseller_id', $reseller_id); |
|
110 | 110 | $this->db->select('id'); |
111 | - $result=$this->db->get('accounts'); |
|
111 | + $result = $this->db->get('accounts'); |
|
112 | 112 | $this->db_model->build_search('package_list_search'); |
113 | - if($this->session->userdata('advance_search')!= 1){ |
|
114 | - if($result->num_rows() >0){ |
|
115 | - $acc_arr=array(); |
|
116 | - $result=$result->result_array(); |
|
117 | - foreach($result as $data){ |
|
118 | - $acc_arr[]=$data['id']; |
|
113 | + if ($this->session->userdata('advance_search') != 1) { |
|
114 | + if ($result->num_rows() > 0) { |
|
115 | + $acc_arr = array(); |
|
116 | + $result = $result->result_array(); |
|
117 | + foreach ($result as $data) { |
|
118 | + $acc_arr[] = $data['id']; |
|
119 | 119 | } |
120 | - $this->db->where_in('accountid',$acc_arr); |
|
121 | - if($flag){ |
|
120 | + $this->db->where_in('accountid', $acc_arr); |
|
121 | + if ($flag) { |
|
122 | 122 | $this->db->select('*'); |
123 | 123 | } |
124 | - else{ |
|
124 | + else { |
|
125 | 125 | $this->db->select('count(id) as count'); |
126 | 126 | } |
127 | - if($flag){ |
|
127 | + if ($flag) { |
|
128 | 128 | $this->db->limit($limit, $start); |
129 | 129 | } |
130 | - if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
|
131 | - $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
|
132 | - }else{ |
|
133 | - $this->db->order_by('seconds','desc'); |
|
130 | + if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined') { |
|
131 | + $this->db->order_by($_GET['sortname'], ($_GET['sortorder'] == 'undefined') ? 'desc' : $_GET['sortorder']); |
|
132 | + } else { |
|
133 | + $this->db->order_by('seconds', 'desc'); |
|
134 | 134 | } |
135 | - $result=$this->db->get('counters'); |
|
135 | + $result = $this->db->get('counters'); |
|
136 | 136 | // echo $this->db->last_query();exit; |
137 | - if($flag){ |
|
137 | + if ($flag) { |
|
138 | 138 | return $result; |
139 | - }else{ |
|
140 | - $result=$result->result_array(); |
|
139 | + } else { |
|
140 | + $result = $result->result_array(); |
|
141 | 141 | return $result[0]['count']; |
142 | 142 | } |
143 | - }else{ |
|
144 | - if($flag){ |
|
145 | - $query=(object)array('num_rows'=>0); |
|
143 | + } else { |
|
144 | + if ($flag) { |
|
145 | + $query = (object)array('num_rows'=>0); |
|
146 | 146 | } |
147 | - else{ |
|
148 | - $query=0; |
|
147 | + else { |
|
148 | + $query = 0; |
|
149 | 149 | } |
150 | 150 | return $query; |
151 | 151 | } |
152 | - }else{ |
|
152 | + } else { |
|
153 | 153 | |
154 | - if($result->num_rows() >0){ |
|
155 | - $acc_arr=array(); |
|
156 | - $result=$result->result_array(); |
|
157 | - foreach($result as $data){ |
|
158 | - $acc_arr[]=$data['id']; |
|
154 | + if ($result->num_rows() > 0) { |
|
155 | + $acc_arr = array(); |
|
156 | + $result = $result->result_array(); |
|
157 | + foreach ($result as $data) { |
|
158 | + $acc_arr[] = $data['id']; |
|
159 | 159 | } |
160 | - $this->db->where_in('accountid',$acc_arr); |
|
160 | + $this->db->where_in('accountid', $acc_arr); |
|
161 | 161 | } |
162 | 162 | |
163 | - if($flag){ |
|
163 | + if ($flag) { |
|
164 | 164 | $this->db->select('*'); |
165 | 165 | } |
166 | - else{ |
|
166 | + else { |
|
167 | 167 | $this->db->select('count(id) as count'); |
168 | 168 | } |
169 | - if($flag){ |
|
170 | - $this->db->order_by('seconds','desc'); |
|
169 | + if ($flag) { |
|
170 | + $this->db->order_by('seconds', 'desc'); |
|
171 | 171 | $this->db->limit($limit, $start); |
172 | 172 | } |
173 | - $result=$this->db->get('counters'); |
|
173 | + $result = $this->db->get('counters'); |
|
174 | 174 | // echo $this->db->last_query();exit; |
175 | - if($result->num_rows() > 0){ |
|
176 | - if($flag){ |
|
175 | + if ($result->num_rows() > 0) { |
|
176 | + if ($flag) { |
|
177 | 177 | |
178 | 178 | return $result; |
179 | - }else{ |
|
180 | - $result=$result->result_array(); |
|
179 | + } else { |
|
180 | + $result = $result->result_array(); |
|
181 | 181 | |
182 | 182 | return $result[0]['count']; |
183 | 183 | } |
184 | - }else{ |
|
185 | - if($flag){ |
|
184 | + } else { |
|
185 | + if ($flag) { |
|
186 | 186 | |
187 | - $query=(object)array('num_rows'=>0); |
|
187 | + $query = (object)array('num_rows'=>0); |
|
188 | 188 | } |
189 | - else{ |
|
190 | - $query=0; |
|
189 | + else { |
|
190 | + $query = 0; |
|
191 | 191 | } |
192 | 192 | // echo $this->db->last_query();exit; |
193 | 193 | return $query; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | //echo "<pre>"; prit_r($data); exit; |
200 | 200 | $this->db->select("pattern,comment"); |
201 | 201 | $this->db->where("id IN (".$data.")"); |
202 | - $result=$this->db->get("routes")->result_array(); |
|
202 | + $result = $this->db->get("routes")->result_array(); |
|
203 | 203 | |
204 | 204 | $tmp = array(); |
205 | 205 | foreach ($result as $key => $data_value) { |
@@ -50,11 +50,12 @@ discard block |
||
50 | 50 | $this->db->select('pricelist_id'); |
51 | 51 | $account_info=(array)$this->db->get('accounts')->first_row(); |
52 | 52 | $where=array('pricelist_id'=>$account_info['pricelist_id']); |
53 | - if(!empty($like_str)) |
|
54 | - $this->db->where($like_str); |
|
53 | + if(!empty($like_str)) { |
|
54 | + $this->db->where($like_str); |
|
55 | + } |
|
55 | 56 | if ($flag) { |
56 | 57 | $query = $this->db_model->select("*", "packages", $where, "id", "ASC", $limit, $start); |
57 | - }else { |
|
58 | + } else { |
|
58 | 59 | $query = $this->db_model->countQuery("*", "packages", $where); |
59 | 60 | } |
60 | 61 | return $query; |
@@ -120,8 +121,7 @@ discard block |
||
120 | 121 | $this->db->where_in('accountid',$acc_arr); |
121 | 122 | if($flag){ |
122 | 123 | $this->db->select('*'); |
123 | - } |
|
124 | - else{ |
|
124 | + } else{ |
|
125 | 125 | $this->db->select('count(id) as count'); |
126 | 126 | } |
127 | 127 | if($flag){ |
@@ -129,27 +129,26 @@ discard block |
||
129 | 129 | } |
130 | 130 | if (isset($_GET['sortname']) && $_GET['sortname'] != 'undefined'){ |
131 | 131 | $this->db->order_by($_GET['sortname'], ($_GET['sortorder']=='undefined')?'desc':$_GET['sortorder']); |
132 | - }else{ |
|
132 | + } else{ |
|
133 | 133 | $this->db->order_by('seconds','desc'); |
134 | 134 | } |
135 | 135 | $result=$this->db->get('counters'); |
136 | 136 | // echo $this->db->last_query();exit; |
137 | 137 | if($flag){ |
138 | 138 | return $result; |
139 | - }else{ |
|
139 | + } else{ |
|
140 | 140 | $result=$result->result_array(); |
141 | 141 | return $result[0]['count']; |
142 | 142 | } |
143 | - }else{ |
|
143 | + } else{ |
|
144 | 144 | if($flag){ |
145 | 145 | $query=(object)array('num_rows'=>0); |
146 | - } |
|
147 | - else{ |
|
146 | + } else{ |
|
148 | 147 | $query=0; |
149 | 148 | } |
150 | 149 | return $query; |
151 | 150 | } |
152 | - }else{ |
|
151 | + } else{ |
|
153 | 152 | |
154 | 153 | if($result->num_rows() >0){ |
155 | 154 | $acc_arr=array(); |
@@ -162,8 +161,7 @@ discard block |
||
162 | 161 | |
163 | 162 | if($flag){ |
164 | 163 | $this->db->select('*'); |
165 | - } |
|
166 | - else{ |
|
164 | + } else{ |
|
167 | 165 | $this->db->select('count(id) as count'); |
168 | 166 | } |
169 | 167 | if($flag){ |
@@ -176,17 +174,16 @@ discard block |
||
176 | 174 | if($flag){ |
177 | 175 | |
178 | 176 | return $result; |
179 | - }else{ |
|
177 | + } else{ |
|
180 | 178 | $result=$result->result_array(); |
181 | 179 | |
182 | 180 | return $result[0]['count']; |
183 | 181 | } |
184 | - }else{ |
|
182 | + } else{ |
|
185 | 183 | if($flag){ |
186 | 184 | |
187 | 185 | $query=(object)array('num_rows'=>0); |
188 | - } |
|
189 | - else{ |
|
186 | + } else{ |
|
190 | 187 | $query=0; |
191 | 188 | } |
192 | 189 | // echo $this->db->last_query();exit; |
@@ -24,163 +24,163 @@ |
||
24 | 24 | |
25 | 25 | class Refill_coupon extends MX_Controller { |
26 | 26 | |
27 | - function Refill_coupon(){ |
|
28 | - parent::__construct(); |
|
29 | - $this->load->helper('template_inheritance'); |
|
30 | - $this->load->helper('form'); |
|
31 | - $this->load->model('refill_coupon_model'); |
|
32 | - $this->load->library("refill_coupon_form"); |
|
33 | - $this->load->library("astpp/form"); |
|
34 | - $this->load->library("session"); |
|
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . 'login/login'); |
|
37 | - } |
|
38 | - function refill_coupon_list(){ |
|
27 | + function Refill_coupon(){ |
|
28 | + parent::__construct(); |
|
29 | + $this->load->helper('template_inheritance'); |
|
30 | + $this->load->helper('form'); |
|
31 | + $this->load->model('refill_coupon_model'); |
|
32 | + $this->load->library("refill_coupon_form"); |
|
33 | + $this->load->library("astpp/form"); |
|
34 | + $this->load->library("session"); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) |
|
36 | + redirect(base_url() . 'login/login'); |
|
37 | + } |
|
38 | + function refill_coupon_list(){ |
|
39 | 39 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
40 | - redirect(base_url() . 'user/user/'); |
|
40 | + redirect(base_url() . 'user/user/'); |
|
41 | 41 | } |
42 | 42 | $data['username'] = $this->session->userdata('user_name'); |
43 | - $data['page_title'] = gettext('Refill Coupon'); |
|
44 | - $data['search_flag'] = true; |
|
45 | - $this->session->set_userdata('advance_search', 0); |
|
46 | - $this->session->set_userdata('refill_coupon_list_search', 0); |
|
47 | - $data['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid(); |
|
48 | - $data["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon(); |
|
49 | - $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
|
50 | - $this->load->view('view_refill_coupon_list', $data); |
|
51 | - } |
|
52 | - function refill_coupon_list_json(){ |
|
43 | + $data['page_title'] = gettext('Refill Coupon'); |
|
44 | + $data['search_flag'] = true; |
|
45 | + $this->session->set_userdata('advance_search', 0); |
|
46 | + $this->session->set_userdata('refill_coupon_list_search', 0); |
|
47 | + $data['grid_fields'] = $this->refill_coupon_form->build_refill_coupon_grid(); |
|
48 | + $data["grid_buttons"] = $this->refill_coupon_form->build_grid_buttons_refill_coupon(); |
|
49 | + $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
|
50 | + $this->load->view('view_refill_coupon_list', $data); |
|
51 | + } |
|
52 | + function refill_coupon_list_json(){ |
|
53 | 53 | $json_data = array(); |
54 | - $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
|
55 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
56 | - $json_data = $paging_data["json_paging"]; |
|
57 | - $query = $this->refill_coupon_model->get_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
58 | - $grid_fields = json_decode($this->refill_coupon_form->build_refill_coupon_grid()); |
|
59 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
60 | - echo json_encode($json_data); |
|
61 | - } |
|
62 | - function refill_coupon_list_search(){ |
|
63 | - $ajax_search = $this->input->post('ajax_search', 0); |
|
64 | - if ($this->input->post('advance_search', TRUE) == 1) { |
|
65 | - $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
66 | - $action = $this->input->post(); |
|
67 | - unset($action['action']); |
|
68 | - unset($action['advance_search']); |
|
69 | - if (isset($action['amount']['amount']) && $action['amount']['amount'] != '') { |
|
70 | - $action['amount']['amount'] = $this->common_model->add_calculate_currency($action['amount']['amount'], "", '', true, false); |
|
71 | - } |
|
72 | - $this->session->set_userdata('refill_coupon_list_search', $action); |
|
73 | - } |
|
74 | - if (@$ajax_search != 1) { |
|
75 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
76 | - } |
|
77 | - } |
|
78 | - function refill_coupon_clearsearchfilter(){ |
|
54 | + $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
|
55 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
56 | + $json_data = $paging_data["json_paging"]; |
|
57 | + $query = $this->refill_coupon_model->get_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"]); |
|
58 | + $grid_fields = json_decode($this->refill_coupon_form->build_refill_coupon_grid()); |
|
59 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
60 | + echo json_encode($json_data); |
|
61 | + } |
|
62 | + function refill_coupon_list_search(){ |
|
63 | + $ajax_search = $this->input->post('ajax_search', 0); |
|
64 | + if ($this->input->post('advance_search', TRUE) == 1) { |
|
65 | + $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
|
66 | + $action = $this->input->post(); |
|
67 | + unset($action['action']); |
|
68 | + unset($action['advance_search']); |
|
69 | + if (isset($action['amount']['amount']) && $action['amount']['amount'] != '') { |
|
70 | + $action['amount']['amount'] = $this->common_model->add_calculate_currency($action['amount']['amount'], "", '', true, false); |
|
71 | + } |
|
72 | + $this->session->set_userdata('refill_coupon_list_search', $action); |
|
73 | + } |
|
74 | + if (@$ajax_search != 1) { |
|
75 | + redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
76 | + } |
|
77 | + } |
|
78 | + function refill_coupon_clearsearchfilter(){ |
|
79 | 79 | $this->session->set_userdata('advance_search', 0); |
80 | - $this->session->set_userdata('refill_coupon_list_search', ""); |
|
81 | - } |
|
82 | - function refill_coupon_list_view($id){ |
|
83 | - $data['username'] = $this->session->userdata('user_name'); |
|
84 | - $data['page_title'] = 'View Refill Coupon'; |
|
85 | - if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
|
86 | - $refill_coupon_details=$cc->result_array(); |
|
87 | - $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | - $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | - $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | - } else { |
|
91 | - echo "This card is not available."; |
|
92 | - return; |
|
93 | - } |
|
94 | - $this->load->view('view_refill_coupon_details', $data); |
|
80 | + $this->session->set_userdata('refill_coupon_list_search', ""); |
|
81 | + } |
|
82 | + function refill_coupon_list_view($id){ |
|
83 | + $data['username'] = $this->session->userdata('user_name'); |
|
84 | + $data['page_title'] = 'View Refill Coupon'; |
|
85 | + if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
|
86 | + $refill_coupon_details=$cc->result_array(); |
|
87 | + $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | + $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | + $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | + } else { |
|
91 | + echo "This card is not available."; |
|
92 | + return; |
|
93 | + } |
|
94 | + $this->load->view('view_refill_coupon_details', $data); |
|
95 | 95 | |
96 | - } |
|
97 | - function refill_coupon_add() { |
|
96 | + } |
|
97 | + function refill_coupon_add() { |
|
98 | 98 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
99 | - redirect(base_url() . 'user/user/'); |
|
99 | + redirect(base_url() . 'user/user/'); |
|
100 | 100 | } |
101 | - $data['username'] = $this->session->userdata('user_name'); |
|
102 | - $data['flag'] = 'create'; |
|
103 | - $data['page_title'] = 'Create Refill Coupon'; |
|
104 | - $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), ''); |
|
105 | - $this->load->view('view_refill_coupon_add', $data); |
|
106 | - } |
|
107 | - function refill_coupon_save() { |
|
108 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | - $add_array = $this->input->post(); |
|
110 | - $add_array['status']=0; |
|
111 | - $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
|
101 | + $data['username'] = $this->session->userdata('user_name'); |
|
102 | + $data['flag'] = 'create'; |
|
103 | + $data['page_title'] = 'Create Refill Coupon'; |
|
104 | + $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), ''); |
|
105 | + $this->load->view('view_refill_coupon_add', $data); |
|
106 | + } |
|
107 | + function refill_coupon_save() { |
|
108 | + $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | + $add_array = $this->input->post(); |
|
110 | + $add_array['status']=0; |
|
111 | + $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
|
112 | 112 | $result=$this->refill_coupon_model->refill_coupon_count($add_array); |
113 | - $count=$result[0]['count']; |
|
114 | - $remaining_length =0; |
|
115 | - $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | - $currentlength =pow(5,$remaining_length); |
|
117 | - $currentlength=$currentlength-$count; |
|
118 | - $data['page_title'] = 'Add Refill Coupon'; |
|
119 | - if ($this->form_validation->run() == FALSE) { |
|
120 | - $data['validation_errors'] = validation_errors(); |
|
121 | - echo $data['validation_errors']; |
|
122 | - exit; |
|
123 | - } |
|
124 | - else { |
|
125 | - if($account_length<=strlen($add_array['prefix'])){ |
|
126 | - echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
|
127 | - exit; |
|
128 | - } |
|
129 | - if($currentlength <= 0){ |
|
130 | - echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
|
131 | - exit; |
|
132 | - } |
|
133 | - if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
134 | - echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
|
135 | - exit; |
|
136 | - }else{ |
|
137 | - $this->refill_coupon_model->add_refill_coupon($add_array); |
|
138 | - echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
|
139 | - exit; |
|
140 | - } |
|
141 | - } |
|
142 | - } |
|
143 | - function refill_coupon_list_delete($id) { |
|
144 | - $this->refill_coupon_model->remove_refill_coupon($id); |
|
145 | - $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
|
146 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
147 | - } |
|
148 | - function refill_coupon_export(){ |
|
113 | + $count=$result[0]['count']; |
|
114 | + $remaining_length =0; |
|
115 | + $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | + $currentlength =pow(5,$remaining_length); |
|
117 | + $currentlength=$currentlength-$count; |
|
118 | + $data['page_title'] = 'Add Refill Coupon'; |
|
119 | + if ($this->form_validation->run() == FALSE) { |
|
120 | + $data['validation_errors'] = validation_errors(); |
|
121 | + echo $data['validation_errors']; |
|
122 | + exit; |
|
123 | + } |
|
124 | + else { |
|
125 | + if($account_length<=strlen($add_array['prefix'])){ |
|
126 | + echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
|
127 | + exit; |
|
128 | + } |
|
129 | + if($currentlength <= 0){ |
|
130 | + echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
|
131 | + exit; |
|
132 | + } |
|
133 | + if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
134 | + echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
|
135 | + exit; |
|
136 | + }else{ |
|
137 | + $this->refill_coupon_model->add_refill_coupon($add_array); |
|
138 | + echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
|
139 | + exit; |
|
140 | + } |
|
141 | + } |
|
142 | + } |
|
143 | + function refill_coupon_list_delete($id) { |
|
144 | + $this->refill_coupon_model->remove_refill_coupon($id); |
|
145 | + $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
|
146 | + redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
147 | + } |
|
148 | + function refill_coupon_export(){ |
|
149 | 149 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
150 | 150 | $currency_id=$account_info['currency_id']; |
151 | 151 | $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
152 | 152 | $query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true); |
153 | - $cc_array = array(); |
|
154 | - ob_clean(); |
|
155 | - $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
156 | - if ($query->num_rows() > 0) { |
|
157 | - foreach ($query->result_array() as $row) { |
|
158 | - $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
|
159 | - $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
|
160 | - $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
161 | - $cc_array[] = array( |
|
162 | - $row['number'], |
|
163 | - $row['description'], |
|
164 | - $row['acc_name'], |
|
165 | - $this->common->convert_to_currency('','',$row['amount']), |
|
166 | - $row['creation_date'], |
|
167 | - $row['status'], |
|
168 | - $row['firstused'] |
|
169 | - ); |
|
170 | - } |
|
171 | - } |
|
172 | - $this->load->helper('csv'); |
|
173 | - array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
174 | - } |
|
175 | - function refill_coupon_customer_json($accountid){ |
|
153 | + $cc_array = array(); |
|
154 | + ob_clean(); |
|
155 | + $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
156 | + if ($query->num_rows() > 0) { |
|
157 | + foreach ($query->result_array() as $row) { |
|
158 | + $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
|
159 | + $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
|
160 | + $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
161 | + $cc_array[] = array( |
|
162 | + $row['number'], |
|
163 | + $row['description'], |
|
164 | + $row['acc_name'], |
|
165 | + $this->common->convert_to_currency('','',$row['amount']), |
|
166 | + $row['creation_date'], |
|
167 | + $row['status'], |
|
168 | + $row['firstused'] |
|
169 | + ); |
|
170 | + } |
|
171 | + } |
|
172 | + $this->load->helper('csv'); |
|
173 | + array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
174 | + } |
|
175 | + function refill_coupon_customer_json($accountid){ |
|
176 | 176 | $json_data = array(); |
177 | - $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
178 | - $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
179 | - $json_data = $paging_data["json_paging"]; |
|
180 | - $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
181 | - $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
|
182 | - $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
183 | - echo json_encode($json_data); |
|
184 | - } |
|
177 | + $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
178 | + $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
|
179 | + $json_data = $paging_data["json_paging"]; |
|
180 | + $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
181 | + $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
|
182 | + $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
|
183 | + echo json_encode($json_data); |
|
184 | + } |
|
185 | 185 | } |
186 | 186 | ?> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | class Refill_coupon extends MX_Controller { |
26 | 26 | |
27 | - function Refill_coupon(){ |
|
27 | + function Refill_coupon() { |
|
28 | 28 | parent::__construct(); |
29 | 29 | $this->load->helper('template_inheritance'); |
30 | 30 | $this->load->helper('form'); |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | 35 | if ($this->session->userdata('user_login') == FALSE) |
36 | - redirect(base_url() . 'login/login'); |
|
36 | + redirect(base_url().'login/login'); |
|
37 | 37 | } |
38 | - function refill_coupon_list(){ |
|
39 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
40 | - redirect(base_url() . 'user/user/'); |
|
38 | + function refill_coupon_list() { |
|
39 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
40 | + redirect(base_url().'user/user/'); |
|
41 | 41 | } |
42 | 42 | $data['username'] = $this->session->userdata('user_name'); |
43 | 43 | $data['page_title'] = gettext('Refill Coupon'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $data['form_search'] = $this->form->build_serach_form($this->refill_coupon_form->get_refill_coupon_search_form()); |
50 | 50 | $this->load->view('view_refill_coupon_list', $data); |
51 | 51 | } |
52 | - function refill_coupon_list_json(){ |
|
52 | + function refill_coupon_list_json() { |
|
53 | 53 | $json_data = array(); |
54 | 54 | $count_all = $this->refill_coupon_model->get_refill_coupon_list(false, "", ""); |
55 | 55 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
60 | 60 | echo json_encode($json_data); |
61 | 61 | } |
62 | - function refill_coupon_list_search(){ |
|
62 | + function refill_coupon_list_search() { |
|
63 | 63 | $ajax_search = $this->input->post('ajax_search', 0); |
64 | 64 | if ($this->input->post('advance_search', TRUE) == 1) { |
65 | 65 | $this->session->set_userdata('advance_search', $this->input->post('advance_search')); |
@@ -72,21 +72,21 @@ discard block |
||
72 | 72 | $this->session->set_userdata('refill_coupon_list_search', $action); |
73 | 73 | } |
74 | 74 | if (@$ajax_search != 1) { |
75 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
75 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
76 | 76 | } |
77 | 77 | } |
78 | - function refill_coupon_clearsearchfilter(){ |
|
78 | + function refill_coupon_clearsearchfilter() { |
|
79 | 79 | $this->session->set_userdata('advance_search', 0); |
80 | 80 | $this->session->set_userdata('refill_coupon_list_search', ""); |
81 | 81 | } |
82 | - function refill_coupon_list_view($id){ |
|
82 | + function refill_coupon_list_view($id) { |
|
83 | 83 | $data['username'] = $this->session->userdata('user_name'); |
84 | 84 | $data['page_title'] = 'View Refill Coupon'; |
85 | 85 | if ($cc = $this->refill_coupon_model->get_refill_coupon_details($id)) { |
86 | - $refill_coupon_details=$cc->result_array(); |
|
87 | - $data['refill_coupon_details']=$refill_coupon_details[0]; |
|
88 | - $data['refill_coupon_details']['callingcard']= $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | - $data['refill_coupon_details']['currency']= $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
86 | + $refill_coupon_details = $cc->result_array(); |
|
87 | + $data['refill_coupon_details'] = $refill_coupon_details[0]; |
|
88 | + $data['refill_coupon_details']['callingcard'] = $this->common->get_field_name('cardnumber', 'callingcards', $refill_coupon_details[0]['callingcard_id']); |
|
89 | + $data['refill_coupon_details']['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $refill_coupon_details[0]['currency_id']); |
|
90 | 90 | } else { |
91 | 91 | echo "This card is not available."; |
92 | 92 | return; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | function refill_coupon_add() { |
98 | - if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
|
99 | - redirect(base_url() . 'user/user/'); |
|
98 | + if ($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3) { |
|
99 | + redirect(base_url().'user/user/'); |
|
100 | 100 | } |
101 | 101 | $data['username'] = $this->session->userdata('user_name'); |
102 | 102 | $data['flag'] = 'create'; |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | $this->load->view('view_refill_coupon_add', $data); |
106 | 106 | } |
107 | 107 | function refill_coupon_save() { |
108 | - $account_length=Common_model::$global_config['system_config']['refill_coupon_length']; |
|
108 | + $account_length = Common_model::$global_config['system_config']['refill_coupon_length']; |
|
109 | 109 | $add_array = $this->input->post(); |
110 | - $add_array['status']=0; |
|
110 | + $add_array['status'] = 0; |
|
111 | 111 | $data['form'] = $this->form->build_form($this->refill_coupon_form->get_refill_coupon_form_fields(), $add_array); |
112 | - $result=$this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | - $count=$result[0]['count']; |
|
114 | - $remaining_length =0; |
|
115 | - $remaining_length=$account_length - strlen($add_array['prefix']); |
|
116 | - $currentlength =pow(5,$remaining_length); |
|
117 | - $currentlength=$currentlength-$count; |
|
112 | + $result = $this->refill_coupon_model->refill_coupon_count($add_array); |
|
113 | + $count = $result[0]['count']; |
|
114 | + $remaining_length = 0; |
|
115 | + $remaining_length = $account_length - strlen($add_array['prefix']); |
|
116 | + $currentlength = pow(5, $remaining_length); |
|
117 | + $currentlength = $currentlength - $count; |
|
118 | 118 | $data['page_title'] = 'Add Refill Coupon'; |
119 | 119 | if ($this->form_validation->run() == FALSE) { |
120 | 120 | $data['validation_errors'] = validation_errors(); |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | exit; |
123 | 123 | } |
124 | 124 | else { |
125 | - if($account_length<=strlen($add_array['prefix'])){ |
|
125 | + if ($account_length <= strlen($add_array['prefix'])) { |
|
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
128 | 128 | } |
129 | - if($currentlength <= 0){ |
|
129 | + if ($currentlength <= 0) { |
|
130 | 130 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix")); |
131 | 131 | exit; |
132 | 132 | } |
133 | - if($currentlength > 0 && $add_array['count'] > $currentlength){ |
|
133 | + if ($currentlength > 0 && $add_array['count'] > $currentlength) { |
|
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else { |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |
@@ -143,26 +143,26 @@ discard block |
||
143 | 143 | function refill_coupon_list_delete($id) { |
144 | 144 | $this->refill_coupon_model->remove_refill_coupon($id); |
145 | 145 | $this->session->set_flashdata('astpp_notification', 'Refill coupon removed successfully!'); |
146 | - redirect(base_url() . 'refill_coupon/refill_coupon_list/'); |
|
146 | + redirect(base_url().'refill_coupon/refill_coupon_list/'); |
|
147 | 147 | } |
148 | - function refill_coupon_export(){ |
|
148 | + function refill_coupon_export() { |
|
149 | 149 | $account_info = $accountinfo = $this->session->userdata('accountinfo'); |
150 | - $currency_id=$account_info['currency_id']; |
|
151 | - $currency=$this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | - $query = $this->refill_coupon_model->get_refill_coupon_list(true,'','',true); |
|
150 | + $currency_id = $account_info['currency_id']; |
|
151 | + $currency = $this->common->get_field_name('currency', 'currency', $currency_id); |
|
152 | + $query = $this->refill_coupon_model->get_refill_coupon_list(true, '', '', true); |
|
153 | 153 | $cc_array = array(); |
154 | 154 | ob_clean(); |
155 | - $cc_array[] = array('Coupon No.','Description', 'Account','Amount('.$currency.')','Created Date',"Used?",'Used Date'); |
|
155 | + $cc_array[] = array('Coupon No.', 'Description', 'Account', 'Amount('.$currency.')', 'Created Date', "Used?", 'Used Date'); |
|
156 | 156 | if ($query->num_rows() > 0) { |
157 | 157 | foreach ($query->result_array() as $row) { |
158 | 158 | $row['currency'] = $this->common->build_concat_string('currencyname,currency', 'currency', $row['currency_id']); |
159 | 159 | $row['acc_name'] = $row['account_id'] > 0 ? $this->common->get_field_name('number', 'accounts', $row['account_id']) : ""; |
160 | - $row['status']=$this->common->get_refill_coupon_status('','',$row['status']); |
|
160 | + $row['status'] = $this->common->get_refill_coupon_status('', '', $row['status']); |
|
161 | 161 | $cc_array[] = array( |
162 | 162 | $row['number'], |
163 | 163 | $row['description'], |
164 | 164 | $row['acc_name'], |
165 | - $this->common->convert_to_currency('','',$row['amount']), |
|
165 | + $this->common->convert_to_currency('', '', $row['amount']), |
|
166 | 166 | $row['creation_date'], |
167 | 167 | $row['status'], |
168 | 168 | $row['firstused'] |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | $this->load->helper('csv'); |
173 | - array_to_csv($cc_array, 'refill_coupon_' . date("Y-m-d") . '.csv'); |
|
173 | + array_to_csv($cc_array, 'refill_coupon_'.date("Y-m-d").'.csv'); |
|
174 | 174 | } |
175 | - function refill_coupon_customer_json($accountid){ |
|
175 | + function refill_coupon_customer_json($accountid) { |
|
176 | 176 | $json_data = array(); |
177 | - $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "",$accountid); |
|
177 | + $count_all = $this->refill_coupon_model->get_customer_refill_coupon_list(false, "", "", $accountid); |
|
178 | 178 | $paging_data = $this->form->load_grid_config($count_all, $_GET['rp'], $_GET['page']); |
179 | 179 | $json_data = $paging_data["json_paging"]; |
180 | - $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"],$accountid); |
|
180 | + $query = $this->refill_coupon_model->get_customer_refill_coupon_list(true, $paging_data["paging"]["start"], $paging_data["paging"]["page_no"], $accountid); |
|
181 | 181 | $grid_fields = json_decode($this->refill_coupon_form->build_user_refill_coupon_grid()); |
182 | 182 | $json_data['rows'] = $this->form->build_grid($query, $grid_fields); |
183 | 183 | echo json_encode($json_data); |
@@ -32,8 +32,9 @@ discard block |
||
32 | 32 | $this->load->library("refill_coupon_form"); |
33 | 33 | $this->load->library("astpp/form"); |
34 | 34 | $this->load->library("session"); |
35 | - if ($this->session->userdata('user_login') == FALSE) |
|
36 | - redirect(base_url() . 'login/login'); |
|
35 | + if ($this->session->userdata('user_login') == FALSE) { |
|
36 | + redirect(base_url() . 'login/login'); |
|
37 | + } |
|
37 | 38 | } |
38 | 39 | function refill_coupon_list(){ |
39 | 40 | if($this->session->userdata('logintype') == 0 || $this->session->userdata('logintype') == 3){ |
@@ -120,8 +121,7 @@ discard block |
||
120 | 121 | $data['validation_errors'] = validation_errors(); |
121 | 122 | echo $data['validation_errors']; |
122 | 123 | exit; |
123 | - } |
|
124 | - else { |
|
124 | + } else { |
|
125 | 125 | if($account_length<=strlen($add_array['prefix'])){ |
126 | 126 | echo json_encode(array("count_error"=>"You Can Not Create ".$add_array['count']." Accounts with ".$add_array['prefix']." prefix.")); |
127 | 127 | exit; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if($currentlength > 0 && $add_array['count'] > $currentlength){ |
134 | 134 | echo json_encode(array("count_error"=>"You Can Create Maximum ".$currentlength." accounts with ".$add_array['prefix']." prefix")); |
135 | 135 | exit; |
136 | - }else{ |
|
136 | + } else{ |
|
137 | 137 | $this->refill_coupon_model->add_refill_coupon($add_array); |
138 | 138 | echo json_encode(array("SUCCESS"=> "Refill coupon created successfully!")); |
139 | 139 | exit; |