@@ -22,180 +22,180 @@ discard block |
||
| 22 | 22 | ############################################################################### |
| 23 | 23 | |
| 24 | 24 | if ( ! defined('BASEPATH')) |
| 25 | - exit('No direct script access allowed'); |
|
| 25 | + exit('No direct script access allowed'); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Dynamically build forms for display |
| 29 | 29 | */ |
| 30 | 30 | class Form { |
| 31 | 31 | |
| 32 | - protected $CI; // codeigniter |
|
| 33 | - protected $fields = array(); // array of fields |
|
| 34 | - protected $form_title = 'Form'; |
|
| 35 | - protected $form_id = 'form'; |
|
| 36 | - protected $form_action = ''; |
|
| 37 | - protected $form_class = ''; |
|
| 38 | - protected $hidden = array(); |
|
| 39 | - protected $multipart = FALSE; // default to standard form |
|
| 40 | - protected $submit_button = 'Submit'; |
|
| 41 | - protected $after_button = ''; |
|
| 42 | - protected $rules = array(); // storage for validation rules |
|
| 43 | - |
|
| 44 | - function __construct() { |
|
| 45 | - $this->CI = & get_instance(); |
|
| 46 | - $this->CI->load->library('form_validation'); |
|
| 47 | - $this->CI->load->library('astpp/common'); |
|
| 48 | - $this->CI->load->model('db_model'); |
|
| 49 | - $this->check_permissions(); |
|
| 50 | - } |
|
| 32 | + protected $CI; // codeigniter |
|
| 33 | + protected $fields = array(); // array of fields |
|
| 34 | + protected $form_title = 'Form'; |
|
| 35 | + protected $form_id = 'form'; |
|
| 36 | + protected $form_action = ''; |
|
| 37 | + protected $form_class = ''; |
|
| 38 | + protected $hidden = array(); |
|
| 39 | + protected $multipart = FALSE; // default to standard form |
|
| 40 | + protected $submit_button = 'Submit'; |
|
| 41 | + protected $after_button = ''; |
|
| 42 | + protected $rules = array(); // storage for validation rules |
|
| 43 | + |
|
| 44 | + function __construct() { |
|
| 45 | + $this->CI = & get_instance(); |
|
| 46 | + $this->CI->load->library('form_validation'); |
|
| 47 | + $this->CI->load->library('astpp/common'); |
|
| 48 | + $this->CI->load->model('db_model'); |
|
| 49 | + $this->check_permissions(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | // __construct |
| 53 | - /** |
|
| 54 | - * adds raw html to the field array |
|
| 55 | - */ |
|
| 56 | - function check_permissions() { |
|
| 57 | - if ($this->CI->session->userdata('user_login') == TRUE) { |
|
| 58 | - $module_info = unserialize($this->CI->session->userdata("permited_modules")); |
|
| 59 | - if ($this->CI->session->userdata('userlevel_logintype') != 0 && $this->CI->session->userdata('userlevel_logintype') != 3) { |
|
| 60 | - $module_info[] = 'dashboard'; |
|
| 61 | - } |
|
| 62 | - $url = $this->CI->uri->uri_string; |
|
| 63 | - $file_name = explode("/", $url); |
|
| 64 | - if (isset($file_name['1'])) { |
|
| 65 | - $module = explode('_', $file_name['1']); |
|
| 66 | - } else { |
|
| 67 | - $module = $file_name; |
|
| 68 | - } |
|
| 69 | - if ($this->CI->session->userdata('userlevel_logintype') == 1) { |
|
| 53 | + /** |
|
| 54 | + * adds raw html to the field array |
|
| 55 | + */ |
|
| 56 | + function check_permissions() { |
|
| 57 | + if ($this->CI->session->userdata('user_login') == TRUE) { |
|
| 58 | + $module_info = unserialize($this->CI->session->userdata("permited_modules")); |
|
| 59 | + if ($this->CI->session->userdata('userlevel_logintype') != 0 && $this->CI->session->userdata('userlevel_logintype') != 3) { |
|
| 60 | + $module_info[] = 'dashboard'; |
|
| 61 | + } |
|
| 62 | + $url = $this->CI->uri->uri_string; |
|
| 63 | + $file_name = explode("/", $url); |
|
| 64 | + if (isset($file_name['1'])) { |
|
| 65 | + $module = explode('_', $file_name['1']); |
|
| 66 | + } else { |
|
| 67 | + $module = $file_name; |
|
| 68 | + } |
|
| 69 | + if ($this->CI->session->userdata('userlevel_logintype') == 1) { |
|
| 70 | 70 | $module_info[] = 'user'; |
| 71 | 71 | } |
| 72 | - if (in_array($module[0], $module_info)) { |
|
| 73 | - if ($this->CI->session->userdata('userlevel_logintype') == 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] != 'customer_transfer') { |
|
| 74 | - redirect(base_url().'user/user/'); |
|
| 75 | - } else { |
|
| 76 | - return true; |
|
| 77 | - } |
|
| 78 | - } else { |
|
| 79 | - $this->CI->session->set_userdata('astpp_errormsg', 'You do not have permission to access this module..!'); |
|
| 80 | - if ($this->CI->session->userdata('userlevel_logintype') == '-1' || $this->CI->session->userdata('logintype') == '1') { |
|
| 81 | - redirect(base_url().'dashboard/'); |
|
| 82 | - } else { |
|
| 83 | - redirect(base_url().'user/user/'); |
|
| 84 | - } |
|
| 85 | - } |
|
| 86 | - } else { |
|
| 87 | - redirect(base_url()); |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - function build_form($fields_array, $values) { |
|
| 92 | - $form_contents = ''; |
|
| 93 | - $form_contents .= '<div class="pop_md col-md-12 margin-t-10 padding-x-8">'; |
|
| 94 | - if (isset($fields_array['breadcrumb'])) { |
|
| 95 | - $form_contents .= form_breadcrumb($fields_array['breadcrumb']); |
|
| 96 | - unset($fields_array['breadcrumb']); |
|
| 97 | - } |
|
| 98 | - $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
| 99 | - unset($fields_array['forms']); |
|
| 100 | - $button_array = array(); |
|
| 101 | - if (isset($fields_array['button_save']) || isset($fields_array['button_cancel']) || isset($fields_array['additional_button'])) { |
|
| 102 | - $save = $fields_array['button_save']; |
|
| 103 | - unset($fields_array['button_save']); |
|
| 104 | - if (isset($fields_array['button_cancel'])) { |
|
| 105 | - $cancel = $fields_array['button_cancel']; |
|
| 106 | - unset($fields_array['button_cancel']); |
|
| 107 | - } |
|
| 108 | - if (isset($fields_array['additional_button'])) { |
|
| 109 | - $additiopnal_button = $fields_array['additional_button']; |
|
| 110 | - unset($fields_array['additional_button']); |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - if (isset($additiopnal_button)) { |
|
| 114 | - $form_contents .= form_button(gettext($additiopnal_button)); |
|
| 115 | - } |
|
| 116 | - $i = 0; |
|
| 117 | - foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
| 118 | - if (count($fields_array) > 1) { |
|
| 119 | - if ($i == 1 || $i == 3) { |
|
| 120 | - $form_contents .= '<div class="col-md-6 no-padding pull-right">'; |
|
| 121 | - $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
| 122 | - } else { |
|
| 123 | - $form_contents .= '<div class="col-md-6 no-padding">'; |
|
| 124 | - $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
| 125 | - } |
|
| 126 | - } else { |
|
| 127 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 128 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 129 | - } |
|
| 130 | - $form_contents .= '<ul class="no-padding">'; |
|
| 131 | - $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 132 | - if ($i == 1 || $i == 3) { |
|
| 133 | - $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
| 134 | - } else { |
|
| 135 | - $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
| 136 | - } |
|
| 137 | - foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
| 138 | - $form_contents .= '<li class="col-md-12">'; |
|
| 139 | - if ($fieldvalue[1] == 'HIDDEN') { |
|
| 140 | - if (isset($this->CI->input->post)) |
|
| 141 | - $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
| 142 | - else |
|
| 143 | - $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
| 144 | - $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
|
| 145 | - } else { |
|
| 146 | - $validation_arr = array(); |
|
| 147 | - if ($fieldvalue[1] == 'INPUT') { |
|
| 148 | - if ( ! empty($fieldvalue[3])) { |
|
| 149 | - $validation_arr = explode("|", $fieldvalue[3]); |
|
| 150 | - } |
|
| 151 | - } |
|
| 152 | - elseif ($fieldvalue[2] == 'SELECT') { |
|
| 153 | - |
|
| 154 | - if (is_array($fieldvalue[4])) { |
|
| 155 | - $validation_arr = explode("|", $fieldvalue[4]['rules']); |
|
| 156 | - } else { |
|
| 157 | - $validation_arr = explode("|", $fieldvalue[4]); |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - if ( ! empty($validation_arr)) { |
|
| 161 | - $fieldvalue[0] = in_array('required', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
| 162 | - $fieldvalue[0] = in_array('dropdown', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
| 163 | - } |
|
| 72 | + if (in_array($module[0], $module_info)) { |
|
| 73 | + if ($this->CI->session->userdata('userlevel_logintype') == 0 && $module[0] == 'customer' && isset($file_name[1]) && $file_name[1] != 'customer_transfer') { |
|
| 74 | + redirect(base_url().'user/user/'); |
|
| 75 | + } else { |
|
| 76 | + return true; |
|
| 77 | + } |
|
| 78 | + } else { |
|
| 79 | + $this->CI->session->set_userdata('astpp_errormsg', 'You do not have permission to access this module..!'); |
|
| 80 | + if ($this->CI->session->userdata('userlevel_logintype') == '-1' || $this->CI->session->userdata('logintype') == '1') { |
|
| 81 | + redirect(base_url().'dashboard/'); |
|
| 82 | + } else { |
|
| 83 | + redirect(base_url().'user/user/'); |
|
| 84 | + } |
|
| 85 | + } |
|
| 86 | + } else { |
|
| 87 | + redirect(base_url()); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + function build_form($fields_array, $values) { |
|
| 92 | + $form_contents = ''; |
|
| 93 | + $form_contents .= '<div class="pop_md col-md-12 margin-t-10 padding-x-8">'; |
|
| 94 | + if (isset($fields_array['breadcrumb'])) { |
|
| 95 | + $form_contents .= form_breadcrumb($fields_array['breadcrumb']); |
|
| 96 | + unset($fields_array['breadcrumb']); |
|
| 97 | + } |
|
| 98 | + $form_contents .= form_open($fields_array['forms'][0], $fields_array['forms'][1]); |
|
| 99 | + unset($fields_array['forms']); |
|
| 100 | + $button_array = array(); |
|
| 101 | + if (isset($fields_array['button_save']) || isset($fields_array['button_cancel']) || isset($fields_array['additional_button'])) { |
|
| 102 | + $save = $fields_array['button_save']; |
|
| 103 | + unset($fields_array['button_save']); |
|
| 104 | + if (isset($fields_array['button_cancel'])) { |
|
| 105 | + $cancel = $fields_array['button_cancel']; |
|
| 106 | + unset($fields_array['button_cancel']); |
|
| 107 | + } |
|
| 108 | + if (isset($fields_array['additional_button'])) { |
|
| 109 | + $additiopnal_button = $fields_array['additional_button']; |
|
| 110 | + unset($fields_array['additional_button']); |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + if (isset($additiopnal_button)) { |
|
| 114 | + $form_contents .= form_button(gettext($additiopnal_button)); |
|
| 115 | + } |
|
| 116 | + $i = 0; |
|
| 117 | + foreach ($fields_array as $fieldset_key => $form_fileds) { |
|
| 118 | + if (count($fields_array) > 1) { |
|
| 119 | + if ($i == 1 || $i == 3) { |
|
| 120 | + $form_contents .= '<div class="col-md-6 no-padding pull-right">'; |
|
| 121 | + $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
| 122 | + } else { |
|
| 123 | + $form_contents .= '<div class="col-md-6 no-padding">'; |
|
| 124 | + $form_contents .= '<div class="col-md-12 padding-x-4">'; |
|
| 125 | + } |
|
| 126 | + } else { |
|
| 127 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 128 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 129 | + } |
|
| 130 | + $form_contents .= '<ul class="no-padding">'; |
|
| 131 | + $form_contents .= '<div class="col-md-12 no-padding">'; |
|
| 132 | + if ($i == 1 || $i == 3) { |
|
| 133 | + $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
| 134 | + } else { |
|
| 135 | + $form_contents .= form_fieldset(gettext($fieldset_key)); |
|
| 136 | + } |
|
| 137 | + foreach ($form_fileds as $fieldkey => $fieldvalue) { |
|
| 138 | + $form_contents .= '<li class="col-md-12">'; |
|
| 139 | + if ($fieldvalue[1] == 'HIDDEN') { |
|
| 140 | + if (isset($this->CI->input->post)) |
|
| 141 | + $fieldvalue[2]['value'] = ( ! $this->CI->input->post($fieldvalue[2]['name'])) ? @$fieldvalue[2]['value'] : $this->CI->input->post($fieldvalue[2]['name']); |
|
| 142 | + else |
|
| 143 | + $fieldvalue[2]['value'] = ($values) ? (isset($values[$fieldvalue[2]['name']]) ? $values[$fieldvalue[2]['name']] : '') : (isset($fieldvalue[2]['value']) ? $fieldvalue[2]['value'] : ''); |
|
| 144 | + $form_contents .= form_hidden($fieldvalue[2]['name'], $fieldvalue[2]['value']); |
|
| 145 | + } else { |
|
| 146 | + $validation_arr = array(); |
|
| 147 | + if ($fieldvalue[1] == 'INPUT') { |
|
| 148 | + if ( ! empty($fieldvalue[3])) { |
|
| 149 | + $validation_arr = explode("|", $fieldvalue[3]); |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | + elseif ($fieldvalue[2] == 'SELECT') { |
|
| 153 | + |
|
| 154 | + if (is_array($fieldvalue[4])) { |
|
| 155 | + $validation_arr = explode("|", $fieldvalue[4]['rules']); |
|
| 156 | + } else { |
|
| 157 | + $validation_arr = explode("|", $fieldvalue[4]); |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + if ( ! empty($validation_arr)) { |
|
| 161 | + $fieldvalue[0] = in_array('required', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
| 162 | + $fieldvalue[0] = in_array('dropdown', $validation_arr) ? $fieldvalue[0]."<span style='color:black;'> *</span>" : $fieldvalue[0]; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - if (is_array($fieldvalue[1]) || (is_array($fieldvalue[2]) && isset($fieldvalue[2]['hidden']))) { |
|
| 166 | - $form_contents .= form_label(gettext($fieldvalue[0]), $fieldvalue[0], array('class' => 'col-md-3 no-padding add_settings')); |
|
| 167 | - } else { |
|
| 168 | - $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "col-md-3 no-padding")); |
|
| 169 | - } |
|
| 170 | - } |
|
| 171 | - if ($fieldvalue[2] == 'SELECT' && ! isset($fieldvalue[13])) { |
|
| 172 | - |
|
| 173 | - /* |
|
| 165 | + if (is_array($fieldvalue[1]) || (is_array($fieldvalue[2]) && isset($fieldvalue[2]['hidden']))) { |
|
| 166 | + $form_contents .= form_label(gettext($fieldvalue[0]), $fieldvalue[0], array('class' => 'col-md-3 no-padding add_settings')); |
|
| 167 | + } else { |
|
| 168 | + $form_contents .= form_label(gettext($fieldvalue[0]), "", array("class" => "col-md-3 no-padding")); |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | + if ($fieldvalue[2] == 'SELECT' && ! isset($fieldvalue[13])) { |
|
| 172 | + |
|
| 173 | + /* |
|
| 174 | 174 | To make Drop down enabled disabled |
| 175 | 175 | */ |
| 176 | - $extra = isset($fieldvalue[1]['extra']) ? $fieldvalue[1]['extra'] : ''; |
|
| 177 | - /***************************/ |
|
| 178 | - if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
| 179 | - $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
| 180 | - |
|
| 181 | - if (isset($this->CI->input->post)) { |
|
| 182 | - $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
| 183 | - } else { |
|
| 184 | - if (is_array($fieldvalue[1])) { |
|
| 185 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
| 186 | - } else { |
|
| 187 | - $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
| 191 | - |
|
| 192 | - if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
| 193 | - $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
| 194 | - } else { |
|
| 195 | - $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
| 196 | - } |
|
| 197 | - if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
| 198 | - if(is_array($fieldvalue[4])){ |
|
| 176 | + $extra = isset($fieldvalue[1]['extra']) ? $fieldvalue[1]['extra'] : ''; |
|
| 177 | + /***************************/ |
|
| 178 | + if ($fieldvalue[7] != '' && $fieldvalue[8] != '') { |
|
| 179 | + $str = $fieldvalue[7].",".$fieldvalue[8]; |
|
| 180 | + |
|
| 181 | + if (isset($this->CI->input->post)) { |
|
| 182 | + $fieldvalue['value'] = ( ! $this->CI->input->post($fieldvalue[1])) ? @$fieldvalue[1] : $this->CI->input->post($fieldvalue[1]); |
|
| 183 | + } else { |
|
| 184 | + if (is_array($fieldvalue[1])) { |
|
| 185 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]['name']] : @$fieldvalue[1]; |
|
| 186 | + } else { |
|
| 187 | + $fieldvalue['value'] = ($values) ? @$values[$fieldvalue[1]] : @$fieldvalue[1]; |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + $drp_array = call_user_func_array(array($this->CI->db_model, $fieldvalue[10]), array($str, $fieldvalue[9], $fieldvalue[11], $fieldvalue[12])); |
|
| 191 | + |
|
| 192 | + if ($fieldset_key == gettext('System Configuration Information') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Force Trunk') || ($fieldset_key == 'Card Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key == 'Billing Information' && $fieldvalue[0] == 'Account') || $fieldset_key == 'Freeswitch Devices' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Origination Rate Add/Edit' && $fieldvalue[0] == 'Trunks' )||$fieldset_key== 'Billing Information' && $fieldvalue[0] == 'Rate Group' || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #1') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Failover GW Name #2') || ($fieldset_key== 'Information' && $fieldvalue[0] == 'Rate Group') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Sip Profile') || ($fieldset_key== 'Sip Devices' && $fieldvalue[0] == 'Account')) { |
|
| 193 | + $form_contents.=form_dropdown_all($fieldvalue[1], $drp_array, $fieldvalue['value'],$extra); |
|
| 194 | + } else { |
|
| 195 | + $form_contents.=form_dropdown($fieldvalue[1], $drp_array, $fieldvalue['value'], $extra); |
|
| 196 | + } |
|
| 197 | + if(isset($fieldvalue[4]) && $fieldvalue[4] != ''){ |
|
| 198 | + if(is_array($fieldvalue[4])){ |
|
| 199 | 199 | |
| 200 | 200 | if(isset($fieldvalue[1]['name'])){ |
| 201 | 201 | $fieldvalue_pass=$fieldvalue[1]['name']; |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | $fieldvalue_pass=$fieldvalue[1]; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
|
| 207 | - }else{ |
|
| 206 | + $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]['rules']); |
|
| 207 | + }else{ |
|
| 208 | 208 | |
| 209 | 209 | if(isset($fieldvalue[1]['name'])){ |
| 210 | 210 | $fieldvalue_pass=$fieldvalue[1]['name']; |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | $fieldvalue_pass=$fieldvalue[1]; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]); |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
| 219 | - $form_contents.= '<span class="popup_error error no-padding" id="'.(gettext(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1])).'_error"> |
|
| 215 | + $this->CI->form_validation->set_rules($fieldvalue_pass, $fieldvalue[0], $fieldvalue[4]); |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + $form_contents.= '<div class="tooltips error_div pull-left no-padding" id="'.(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1]).'_error_div" ><i style="color:#D95C5C; padding-left: 3px; padding-top: 10px;" class="fa fa-exclamation-triangle"></i>'; |
|
| 219 | + $form_contents.= '<span class="popup_error error no-padding" id="'.(gettext(is_array($fieldvalue[1])?$fieldvalue[1]['name']:$fieldvalue[1])).'_error"> |
|
| 220 | 220 | |
| 221 | 221 | </span></div>'; |
| 222 | 222 | } else { |
@@ -209,24 +209,24 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - function customer_save($add_array = false) { |
|
| 213 | - $add_array = $this->input->post(); |
|
| 214 | - $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
| 215 | - $data['country_id'] = isset($add_array['country_id'])? $add_array['country_id']:''; |
|
| 216 | - $data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id']:''; |
|
| 217 | - $data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id']:''; |
|
| 218 | - $data['entity_name'] = $entity_name; |
|
| 219 | - $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
| 220 | - $data['edit_id']=$add_array['id']; |
|
| 221 | - $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array); |
|
| 222 | - if ($add_array['id'] != '') { |
|
| 223 | - $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']); |
|
| 224 | - if ($this->form_validation->run() == FALSE) { |
|
| 225 | - $data['validation_errors'] = validation_errors(); |
|
| 226 | - } else { |
|
| 227 | - ASTPP 3.0 |
|
| 228 | - Password encode |
|
| 229 | - * **** */ |
|
| 212 | + function customer_save($add_array = false) { |
|
| 213 | + $add_array = $this->input->post(); |
|
| 214 | + $entity_name = strtolower($this->common->get_entity_type('', '', $add_array['type'])); |
|
| 215 | + $data['country_id'] = isset($add_array['country_id'])? $add_array['country_id']:''; |
|
| 216 | + $data['timezone_id'] = isset($add_array['timezone_id']) ? $add_array['timezone_id']:''; |
|
| 217 | + $data['currency_id'] = isset($add_array['currency_id']) ? $add_array['currency_id']:''; |
|
| 218 | + $data['entity_name'] = $entity_name; |
|
| 219 | + $data['callingcard'] = Common_model::$global_config['system_config']['pinlength']; |
|
| 220 | + $data['edit_id']=$add_array['id']; |
|
| 221 | + $data['form'] = $this->form->build_form($this->accounts_form->get_customer_form_fields($entity_name, $add_array['id']), $add_array); |
|
| 222 | + if ($add_array['id'] != '') { |
|
| 223 | + $data['page_title'] = 'Edit ' . $this->common->get_entity_type('', '', $add_array['type']); |
|
| 224 | + if ($this->form_validation->run() == FALSE) { |
|
| 225 | + $data['validation_errors'] = validation_errors(); |
|
| 226 | + } else { |
|
| 227 | + ASTPP 3.0 |
|
| 228 | + Password encode |
|
| 229 | + * **** */ |
|
| 230 | 230 | $add_array['password'] = $this->common->encode($add_array['password']); |
| 231 | 231 | /* * ****************** */ |
| 232 | 232 | $add_array['credit_limit'] = $this->common_model->add_calculate_currency($add_array['credit_limit'], '', '', false, false); |
@@ -1385,35 +1385,35 @@ discard block |
||
| 1385 | 1385 | $invoice_id=$this->invoices->invoices->generate_receipt($reseller_info['id'],$custom_array['credit'],$reseller_info,$last_invoice_ID+1,$invoice_prefix,$due_date); |
| 1386 | 1386 | $account_balance = $this->common->get_field_name('balance', 'accounts', $reseller_info['id']); |
| 1387 | 1387 | $insert_arr = array("accountid" => $reseller_info['id'], |
| 1388 | - "description" => trim($custom_array['notes']), |
|
| 1389 | - "debit" => 0, |
|
| 1390 | - "credit" => $custom_array['credit'], |
|
| 1391 | - "created_date" => gmdate("Y-m-d H:i:s"), |
|
| 1392 | - "invoiceid"=>$invoice_id, |
|
| 1393 | - "reseller_id"=>$reseller_info['reseller_id'], |
|
| 1394 | - "item_type"=>'Refill', |
|
| 1395 | - "item_id"=>'0', |
|
| 1396 | - 'before_balance'=>$account_balance - $custom_array['credit'], |
|
| 1397 | - 'after_balance'=>$account_balance, |
|
| 1398 | - ); |
|
| 1399 | - $this->db->insert("invoice_details", $insert_arr); |
|
| 1388 | + "description" => trim($custom_array['notes']), |
|
| 1389 | + "debit" => 0, |
|
| 1390 | + "credit" => $custom_array['credit'], |
|
| 1391 | + "created_date" => gmdate("Y-m-d H:i:s"), |
|
| 1392 | + "invoiceid"=>$invoice_id, |
|
| 1393 | + "reseller_id"=>$reseller_info['reseller_id'], |
|
| 1394 | + "item_type"=>'Refill', |
|
| 1395 | + "item_id"=>'0', |
|
| 1396 | + 'before_balance'=>$account_balance - $custom_array['credit'], |
|
| 1397 | + 'after_balance'=>$account_balance, |
|
| 1398 | + ); |
|
| 1399 | + $this->db->insert("invoice_details", $insert_arr); |
|
| 1400 | + } |
|
| 1401 | + } |
|
| 1400 | 1402 | } |
| 1401 | - } |
|
| 1402 | - } |
|
| 1403 | 1403 | } |
| 1404 | - $message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully."; |
|
| 1404 | + $message = $post_array['payment_type'] == 0 ? "Recharge successfully!" : "Post charge applied successfully."; |
|
| 1405 | 1405 | /***********************************************************************************************/ |
| 1406 | - echo json_encode(array("SUCCESS"=> $message)); |
|
| 1407 | - exit; |
|
| 1408 | - // } |
|
| 1409 | - } |
|
| 1410 | - $this->load->view('view_accounts_process_payment', $data); |
|
| 1411 | - } |
|
| 1412 | - |
|
| 1413 | - /** |
|
| 1414 | - * @param string $select |
|
| 1415 | - */ |
|
| 1416 | - function get_invoice_date($select,$accountid){ |
|
| 1406 | + echo json_encode(array("SUCCESS"=> $message)); |
|
| 1407 | + exit; |
|
| 1408 | + // } |
|
| 1409 | + } |
|
| 1410 | + $this->load->view('view_accounts_process_payment', $data); |
|
| 1411 | + } |
|
| 1412 | + |
|
| 1413 | + /** |
|
| 1414 | + * @param string $select |
|
| 1415 | + */ |
|
| 1416 | + function get_invoice_date($select,$accountid){ |
|
| 1417 | 1417 | $query = $this->db_model->select($select, "invoices", '',"id","DESC","1","0"); |
| 1418 | 1418 | if($query->num_rows >0){ |
| 1419 | 1419 | $invoiceid = $query->result_array(); |