/** Save batch and redirect to display */ public function post_id_handler() { $dbc = $this->connection; $dbc->selectDB($this->config->get('OP_DB')); $list = new BatchListModel($dbc); $upcs = FormLib::get('upc', array()); $prices = FormLib::get('price', array()); $groups = FormLib::get('groupPrice', array()); $methods = FormLib::get('priceMethod', array()); $qtys = FormLib::get('quantity', array()); for ($i = 0; $i < count($upcs); $i++) { $list->reset(); $list->batchID($this->id); $list->upc($upcs[$i]); $changed = false; if (isset($prices[$i])) { $list->salePrice($prices[$i]); $changed = true; } if (isset($groups[$i])) { $list->groupSalePrice($groups[$i]); $changed = true; } if (isset($methods[$i])) { $list->pricemethod($methods[$i]); $changed = true; } if (isset($qtys[$i])) { $list->quantity($qtys[$i]); $changed = true; } if ($changed) { $list->save(); } } header('Location: ?id=' . $this->id); return false; }