Esempio n. 1
0
	function doEditOk() {
		$lookup = LookupDao::byId($this->id);
		Bean::copy($this->lookup, $lookup, array("type", "code", "name", "description", "priority"));
		$this->lookup = $lookup;
		$this->save("lookup");

		if (!empty($this->messages)) {
			Msg::save($this->messages);
			Apu::redirect("lookup/edit");
		}
		if (empty($this->lookup["priority"])) {
			$this->lookup["priority"] = 0;
		}
		$this->lookup["updatedBy"] = LookupDao::loginUserName();
		$this->lookup["updatedTime"] = new Raw("now()");
		try {
			DB::persist("lookups", $this->lookup);
			$this->remove("lookup");
			Apu::redirect("lookup");
		} catch (Exception $e) {
			$this->addMsgString($e->getMessage());
			Msg::save($this->messages);
			Apu::redirect("lookup/edit");
		}
	}