Files
opensourcepos/application/models/item_kit_items.php
pappastech ecdf3a5aa1 Version 2.0_RC1. Upgrade to CI 2.1.0.
Tom

git-svn-id: svn+ssh://jekkos@svn.code.sf.net/p/opensourcepos/code/@24 c3eb156b-1dc0-44e1-88ae-e38439141b53
2012-01-16 02:16:01 +00:00

44 lines
934 B
PHP

<?php
class Item_kit_items extends CI_Model
{
/*
Gets item kit items for a particular item kit
*/
function get_info($item_kit_id)
{
$this->db->from('item_kit_items');
$this->db->where('item_kit_id',$item_kit_id);
//return an array of item kit items for an item
return $this->db->get()->result_array();
}
/*
Inserts or updates an item kit's items
*/
function save(&$item_kit_items_data, $item_kit_id)
{
//Run these queries as a transaction, we want to make sure we do all or nothing
$this->db->trans_start();
$this->delete($item_kit_id);
foreach ($item_kit_items_data as $row)
{
$row['item_kit_id'] = $item_kit_id;
$this->db->insert('item_kit_items',$row);
}
$this->db->trans_complete();
return true;
}
/*
Deletes item kit items given an item kit
*/
function delete($item_kit_id)
{
return $this->db->delete('item_kit_items', array('item_kit_id' => $item_kit_id));
}
}
?>