function getEdgeTape() { set_time_limit(0); $this->autoRender = false; $sql = "SELECT id, number, item_title, Department FROM `items` where Department = 'Edgetape'"; $datas = $this->Cabinet->query($sql); // pr($datas); App::uses("ItemsOption", "Inventory.Model"); foreach ($datas as $data) { $item_option['ItemsOption']['inventory_lookup_id'] = 117; $item_option['ItemsOption']['item_id'] = $data['items']['id']; $ItemOption_model = new ItemsOption(); if (!$ItemOption_model->save($item_option)) { pr($ItemOption_model->validationErrors); } } }
function getEdgeTapeForCabParts($id = null, $code = null) { App::import('Model', 'Inventory.ItemsOption'); $ItemsOption_Model = new ItemsOption(); $data = $ItemsOption_Model->find('first', array('conditions' => array('ItemsOption.item_id' => $id))); if (!empty($data)) { return $code; } else { return ""; } }