예제 #1
0
파일: item_service.php 프로젝트: noikiy/vis
 public function saveItem($data)
 {
     $item = new Item_model();
     $item->productCode = $data['productCode'];
     $item->description = $data['itemName'];
     $item->itemTypeId = $data['itemTypeId'];
     $item->categoryId = $data['categoryId'];
     $item->suggestedSellingPrice = $data['price'];
     $item->active = 1;
     $query = $this->db->get_where('Item', array('productCode' => $data['productCode']));
     if ($query->num_rows() > 0) {
         throw new DuplicateRecordException('The product code ' . $data['productCode'] . ' already exists.');
     }
     return $item->insert();
 }