Ejemplo n.º 1
0
 $account['email'] = $this->input->post('email');
 $account['address'] = $this->input->post('address');
 $account['county'] = $this->input->post('county');
 $account['city'] = $this->input->post('city');
 $account['description'] = $this->input->post('description');
 // if the barcode is empty, auto-create
 if ($account['code'] == '') {
     $account['code'] = replace_text_for_utf8($this->input->post('name'));
     // Have barcode?
     for ($i = is_account_code($account['code']); $i > 0; $i++) {
         $account['code'] = replace_text_for_utf8($this->input->post('name')) . '-' . $i;
         $i = is_account_code($account['code']);
     }
 } else {
     // Have barcode?
     if (is_account_code($account['code'])) {
         alertbox('alert-danger', get_lang('This barcode is found in the database.'));
         $continue = false;
     }
 }
 if ($continue) {
     $account_id = add_account($account);
     if ($account_id > 0) {
         alertbox('alert-success', get_lang('Operation is Successful'), '');
         $log['date'] = $this->input->post('log_time');
         $log['type'] = 'account';
         $log['title'] = get_lang('Account');
         $log['description'] = get_lang('Created a new account card.');
         $log['account_id'] = $account_id;
         add_log($log);
     } else {
Ejemplo n.º 2
0
 $account['email'] = $this->input->post('email');
 $account['address'] = $this->input->post('address');
 $account['county'] = $this->input->post('county');
 $account['city'] = $this->input->post('city');
 $account['description'] = $this->input->post('description');
 // if the barcode is empty, auto-create
 if ($account['code'] == '') {
     $account['code'] = replace_text_for_utf8($this->input->post('name'));
     // Have barcode?
     for ($i = is_account_code($account['code']); $i > 0; $i++) {
         $account['code'] = replace_text_for_utf8($this->input->post('name')) . '-' . $i;
         $i = is_account_code($account['code'], $account_id);
     }
 } else {
     // Have barcode?
     if (is_account_code($account['code'], $account_id)) {
         alertbox('alert-danger', get_lang('This barcode is found in the database.'));
         $continue = false;
     }
 }
 if ($continue) {
     if (update_account($account['id'], $account)) {
         alertbox('alert-success', get_lang('Operation is Successful'), '');
         $log['date'] = $this->input->post('log_time');
         $log['type'] = 'account';
         $log['title'] = get_lang('Account');
         $log['description'] = get_lang('Account card has been updated.');
         $log['account_id'] = $account_id;
         add_log($log);
     } else {
         alertbox('alert-danger', get_lang('Error!'));