public function update_asset() { $id = $this->input->get('asset_id'); $details = Assets_info_model::assetsDetails(); $asset = Assets_info_model::find($id); if ($asset->update_attributes($details)) { $this->session->set_userdata('edited', 1); redirect("ams/view_asset_details?asset_id={$id}"); } }
public function add_asset_info() { $this->form_validation->set_rules('txtAssetID', 'Asset ID', 'trim|required'); $this->form_validation->set_rules('txtAssetName', 'Asset Name', 'trim|required'); $this->form_validation->set_rules('txtDescription', 'Description', 'trim|required'); $this->form_validation->set_rules('txtVendor', 'Asset Vendor', 'trim|required'); $this->form_validation->set_rules('txtCategory', 'Asset Category', 'trim'); $this->form_validation->set_rules('txtDateAcquired', 'Date Acquired', 'trim|required'); if ($this->form_validation->run()) { $details = Assets_info_model::assetsDetails(); if (Assets_info_model::create($details)) { Assets_model::newAssets(); $this->session->set_userdata('added', 1); Audit_trail_model::auditNewAsset($details); redirect('ams/view_assets'); } } }