public function save($id = NULL, $db_array = NULL)
 {
     $db_array = $db_array ? $db_array : $this->db_array();
     $id = parent::save($id, $db_array);
     $this->db->query('ALTER TABLE `' . $db_array['custom_field_table'] . '` ADD `' . $db_array['custom_field_column'] . '` VARCHAR( 255 ) NOT NULL');
     return $id;
 }
Ejemplo n.º 2
0
 public function save($db_array, $user_id = NULL)
 {
     unset($db_array['passwordv']);
     unset($db_array['client_id_autocomplete_label']);
     $db_array['password'] = md5($db_array['password']);
     parent::save($db_array, $user_id);
 }
Ejemplo n.º 3
0
 function db_install()
 {
     $return = array();
     $this->load->database();
     $this->db->db_debug = 0;
     if ($this->db_install_tables()) {
         $return[] = $this->lang->line('install_database_success');
     } else {
         $return[] = $this->lang->line('install_database_problem');
         return $return;
     }
     $db_array = parent::db_array();
     $db_array['password'] = md5($db_array['password']);
     $db_array['global_admin'] = 1;
     unset($db_array['passwordv']);
     if (parent::save($db_array, NULL, FALSE)) {
         $return[] = $this->lang->line('install_admin_account_success');
     } else {
         $return[] = $this->lang->line('install_admin_account_problem');
         return $return;
     }
     $return[] = $this->lang->line('installation_complete');
     $return[] = $this->lang->line('install_delete_folder');
     $return[] = APPPATH . 'modules_core/setup';
     $return[] = anchor('sessions/login', $this->lang->line('log_in'));
     $this->mdl_mcb_modules->refresh();
     return $return;
 }
Ejemplo n.º 4
0
Archivo: tag.php Proyecto: ak826843/bmf
 public function find_or_create($tag)
 {
     $in = $this->where('tag', $tag)->find(NULL, 1);
     if (empty($in)) {
         $in['id'] = parent::save(array('tag' => $tag));
     }
     return $in['id'];
 }
Ejemplo n.º 5
0
 public function salvar($dados, $id)
 {
     $countLogin = $this->verificarDuplicidadeLogin($dados['login'], $id);
     if ($countLogin > 0) {
         return -2;
     }
     return parent::save($dados, $id);
 }
Ejemplo n.º 6
0
 public function save()
 {
     $db_array = $this->db_array();
     if (!$this->input->post('provider_active')) {
         $db_array['provider_active'] = 0;
     }
     parent::save($db_array, uri_assoc('provider_id', 4));
 }
Ejemplo n.º 7
0
 public function save($db_array, $user_id = NULL)
 {
     parent::save($db_array, $user_id);
     if (!$user_id) {
         $user_id = $this->db->insert_id();
     }
     return $user_id;
 }
Ejemplo n.º 8
0
 public function save($db_array, $id = NULL, $initial_stock_quantity = NULL)
 {
     parent::save($db_array, $id);
     if ($initial_stock_quantity) {
         $inventory_id = $this->db->insert_id();
         $this->mdl_inventory_stock->adjust($inventory_id, $initial_stock_quantity, 0, $this->lang->line('initial_stock_quantity'));
     }
 }
Ejemplo n.º 9
0
 public function save()
 {
     $now_in_mysql_format = date('Y-m-d H:i:s');
     $this->updated = $now_in_mysql_format;
     if (!($this->id > 0)) {
         $this->created = $now_in_mysql_format;
     }
     return parent::save();
 }
 public function save_custom($invoice_id, $db_array)
 {
     $invoice_custom_id = null;
     $db_array['invoice_id'] = $invoice_id;
     $invoice_custom = $this->where('invoice_id', $invoice_id)->get();
     if ($invoice_custom->num_rows()) {
         $invoice_custom_id = $invoice_custom->row()->invoice_custom_id;
     }
     parent::save($invoice_custom_id, $db_array);
 }
 public function save_custom($payment_id, $db_array)
 {
     $payment_custom_id = null;
     $db_array['payment_id'] = $payment_id;
     $payment_custom = $this->where('payment_id', $payment_id)->get();
     if ($payment_custom->num_rows()) {
         $payment_custom_id = $payment_custom->row()->payment_custom_id;
     }
     parent::save($payment_custom_id, $db_array);
 }
Ejemplo n.º 12
0
 function save($db_array, $invoice_group_id)
 {
     if (!isset($db_array['invoice_group_prefix_year'])) {
         $db_array['invoice_group_prefix_year'] = 0;
     }
     if (!isset($db_array['invoice_group_prefix_month'])) {
         $db_array['invoice_group_prefix_month'] = 0;
     }
     parent::save($db_array, $invoice_group_id);
 }
Ejemplo n.º 13
0
 public function save_custom($user_id, $db_array)
 {
     $user_custom_id = NULL;
     $db_array['user_id'] = $user_id;
     $user_custom = $this->where('user_id', $user_id)->get();
     if ($user_custom->num_rows()) {
         $user_custom_id = $user_custom->row()->user_custom_id;
     }
     parent::save($user_custom_id, $db_array);
 }
Ejemplo n.º 14
0
 public function save_custom($quote_id, $db_array)
 {
     $quote_custom_id = NULL;
     $db_array['quote_id'] = $quote_id;
     $quote_custom = $this->where('quote_id', $quote_id)->get();
     if ($quote_custom->num_rows()) {
         $quote_custom_id = $quote_custom->row()->quote_custom_id;
     }
     parent::save($quote_custom_id, $db_array);
 }
Ejemplo n.º 15
0
 public function save_custom($client_id, $db_array)
 {
     $client_custom_id = NULL;
     $db_array['client_id'] = $client_id;
     $client_custom = $this->where('client_id', $client_id)->get();
     if ($client_custom->num_rows()) {
         $client_custom_id = $client_custom->row()->client_custom_id;
     }
     parent::save($client_custom_id, $db_array);
 }
Ejemplo n.º 16
0
 public function save($db_array, $invoice_item_id = NULL)
 {
     /* Transformar aquestes dues variables a format numèric estàndard */
     $db_array['item_qty'] = standardize_number($db_array['item_qty']);
     $db_array['item_price'] = standardize_number($db_array['item_price']);
     parent::save($db_array, $invoice_item_id);
     if ($this->input->post('save_as_inventory')) {
         $db_array = array('inventory_name' => $db_array['item_name'], 'inventory_unit_price' => $db_array['item_price'], 'inventory_description' => $db_array['item_description']);
         $this->db->insert('mcb_inventory', $db_array);
     }
 }
Ejemplo n.º 17
0
 public function save($db_array, $invoice_item_id = NULL)
 {
     /* Transform these two vars to standard number format */
     $db_array['item_qty'] = standardize_number($db_array['item_qty']);
     $db_array['item_price'] = standardize_number($db_array['item_price']);
     parent::save($db_array, $invoice_item_id);
     if ($this->input->post('save_as_inventory') and $db_array['inventory_id'] == 'please_select') {
         $db_array = array('inventory_name' => $db_array['item_name'], 'inventory_unit_price' => $db_array['item_price'], 'inventory_description' => $db_array['item_description']);
         $this->db->insert('mcb_inventory', $db_array);
     }
 }
Ejemplo n.º 18
0
 public function save()
 {
     $db_array = $this->db_array();
     parent::save($db_array, uri_assoc('payment_id'));
     if (isset($db_array['payment_method_id']) and $db_array['payment_method_id'] == '9999') {
         $this->db->select('client_id');
         $this->db->where('invoice_id', $db_array['invoice_id']);
         $client_id = $this->db->get('mcb_invoices')->row()->client_id;
         $credit_db_array = array('client_credit_client_id' => $client_id, 'client_credit_amount' => $db_array['payment_amount'] * -1, 'client_credit_date' => $db_array['payment_date']);
         $this->db->insert('mcb_client_credits', $credit_db_array);
     }
 }
Ejemplo n.º 19
0
 public function save($data, $id = NULL)
 {
     if ($id !== NULL) {
         return parent::save($data, $id);
     } else {
         $perm_id = $data['perm_id'];
         $role_id = $data['role_id'];
         $roleperm = $this->is_role_permitted($perm_id, $role_id);
         if ($roleperm) {
             return $roleperm;
         } else {
             return parent::save($data);
         }
     }
 }
Ejemplo n.º 20
0
 function log_first($data, $form_certi, $to_certi, $send_status)
 {
     $request_data = get_post(NULL);
     $rs = array();
     $rs['order_bn'] = $data['order_bn'];
     $rs['from_method'] = $data['from_method'];
     $rs['node_type'] = $data['node_type'];
     $rs['response_data'] = serialize($data['response_data']);
     $rs['request_data'] = serialize($request_data);
     $rs['createtime'] = time();
     $rs['form_certi'] = $form_certi;
     $rs['to_certi'] = $to_certi;
     $rs['send_status'] = $send_status;
     return parent::save($rs);
 }
Ejemplo n.º 21
0
 public function save($data, $id = NULL)
 {
     if ($id !== NULL) {
         return parent::save($data, $id);
     } else {
         $postid = $data['post_id'];
         $loadedpostid = $data['loaded_post_id'];
         $loadedpost = $this->is_post_loaded($postid, $loadedpostid);
         if ($loadedpost) {
             return $loadedpost;
         } else {
             return parent::save($data);
         }
     }
 }
Ejemplo n.º 22
0
 function save()
 {
     $db_array = parent::db_array();
     if (!uri_assoc('task_id', 3)) {
         $db_array['user_id'] = $this->session->userdata('user_id');
     }
     if (isset($db_array['due_date']) and $db_array['due_date']) {
         $db_array['due_date'] = strtotime(standardize_date($db_array['due_date']));
     }
     if (isset($db_array['complete_date']) and $db_array['complete_date']) {
         $db_array['complete_date'] = strtotime(standardize_date($db_array['complete_date']));
     }
     $db_array['start_date'] = strtotime(standardize_date($db_array['start_date']));
     parent::save($db_array, uri_assoc('task_id', 3));
 }
Ejemplo n.º 23
0
 public function save()
 {
     $db_array = parent::db_array();
     $field_id = uri_assoc('field_id');
     if (!$field_id) {
         $field_index = $this->get_next_field_index($db_array['object_id']);
         $column_name = $this->column_prefixes[$db_array['object_id']] . 'custom_' . $field_index;
         $this->add_column($db_array['object_id'], $column_name);
     } else {
         $field_index = $this->get_current_field_index($field_id);
         $column_name = $this->column_prefixes[$db_array['object_id']] . 'custom_' . $field_index;
     }
     $db_array['field_index'] = $field_index;
     $db_array['column_name'] = $column_name;
     parent::save($db_array, $field_id);
 }
Ejemplo n.º 24
0
 /**
  * 
  * 
  * @param type $post
  * @return type 
  */
 public function save($post)
 {
     if (empty($post[$this->pkey])) {
         $post['added_at'] = now2mysql();
     }
     unset($post['login'], $post['email'], $post['avatar'], $post['banned'], $post['role']);
     $post[$this->pkey] = parent::save($post);
     // after that check tags, add them and link with our new post
     if (!empty($post['tags'])) {
         $post['type'] = blog_type('post');
         if (!isset($this->tag)) {
             $this->load->model('tag');
         }
         $post['tags'] = $this->tag->save($post);
         parent::save($post);
     }
     return $post['id'];
 }
Ejemplo n.º 25
0
 public function save($id = NULL, $db_array = NULL)
 {
     if ($id) {
         // Get the original record before saving
         $original_record = $this->get_by_id($id);
     }
     // Create the record
     $db_array = $db_array ? $db_array : $this->db_array();
     // Save the record to ip_custom_fields
     $id = parent::save($id, $db_array);
     if (isset($original_record)) {
         if ($original_record->custom_field_column != $db_array['custom_field_column']) {
             // The column name differs from the original - rename it
             $this->rename_column($db_array['custom_field_table'], $original_record->custom_field_column, $db_array['custom_field_column']);
         }
     } else {
         // This is a new column - add it
         $this->add_column($db_array['custom_field_table'], $db_array['custom_field_column']);
     }
     return $id;
 }
 function save($datos)
 {
     return parent::save('alertas', $datos);
 }
Ejemplo n.º 27
0
 public function save($force_update = false)
 {
     if (isset($this->last_seen)) {
         $replacement = "VBX_User::setting('last_seen', new MY_ModelLiteral('UTC_TIMESTAMP()'))";
         _deprecated_notice(__CLASS__ . '::$last_seen', '1.1.2', $replacement);
     }
     if (strlen($this->email) < 0) {
         throw new VBX_UserException('Email is a required field.');
     }
     if (!(strpos($this->email, '@') > 0)) {
         throw new VBX_UserException('Valid email address is required');
     }
     if (!strlen($this->voicemail)) {
         $this->voicemail = '';
     }
     $ci =& get_instance();
     if (is_string($this->auth_type) && !is_numeric($this->auth_type)) {
         $results = $ci->db->from('auth_types')->where('description', $this->auth_type)->get()->result();
         if (empty($results)) {
             throw new VBX_UserException('AuthType does not exist.');
         }
         $this->auth_type = $results[0]->id;
     }
     return parent::save($force_update);
 }
Ejemplo n.º 28
0
 public function save()
 {
     $db_array = parent::db_array();
     if (!$this->input->post('client_active')) {
         $db_array['client_active'] = 0;
     }
     parent::save($db_array, uri_assoc('client_id'));
 }
Ejemplo n.º 29
0
 function save()
 {
     if (!strlen($this->name)) {
         throw new VBX_DeviceException('Name is empty');
     }
     try {
         PhoneNumber::validatePhoneNumber($this->value);
     } catch (PhoneNumberException $e) {
         throw new VBX_DeviceException($e->getMessage());
     }
     return parent::save();
 }
Ejemplo n.º 30
0
 public function save()
 {
     if (strlen($this->name) < 3) {
         throw new VBX_GroupException('Group name must be at least 3 characters long');
     }
     parent::save();
 }