form_key = self::getNewFormKey();
} else {
list(
$this->system_id,
$this->flow_id,
$this->form_id,
$this->form_key,
$this->flow_code,
$this->flow_code_seq,
$this->back_code
)
= DB::fields("SELECT system_id,flow_id,form_id,form_key,flow_code,flow_code_seq,back_code
FROM flow where form_key ='$formKey'");
// echo " FLow 33:" . "SELECT system_id,flow_id,form_id,form_key,flow_code,flow_code_seq,back_code
// FROM flow where form_key ='$formKey'";
}
}
public function getParentKey()
{
list($parent_key) = DB::fields("select parent_key from workflow_subflow
where form_key='" . $this->form_key . "' ");
return $parent_key;
}
public static function getParentFormKey($formKey)
{
list($parent_key) = DB::fields("select parent_key from workflow_subflow
where form_key='" . $formKey . "' ");
return $parent_key;
}
public static function getSplitFlowCode()
{
}
/**
* @param $formKey
* @param $flowCode
*/
static function updateFlowCode($formKey, $flowCode)
{
$where = "form_key = '" . $formKey . "'";
DB::update_table("flow", array(
"flow_code" => $flowCode
), $where);
}
/**
* 生成新的formkey
* @return string
*/
public static function getNewFormKey()
{
// list($curvalformKey) = DB::fields("SELECT appwms.currval('form_key') form_key");
// echo " curvalformKey line69 :" . $curvalformKey."
";
list($formKey) = DB::fields("SELECT appwms.nextval('form_key') form_key");
// echo " formKey line77:" . $formKey."
";
return $formKey;
}
public function insert()
{
DB::insert_table("flow", array(
"form_key" => $this->form_key,
"system_id" => $this->system_id,
"flow_id" => $this->flow_id,
"form_id" => $this->form_id,
"flow_code" => $this->flow_code,
"flow_code_seq" => $this->flow_code_seq,
"back_code" => $this->back_code
));
}
public function save()
{
list($cnt) = DB::fields("select count(*) from flow where form_key='" . $this->form_key . "' ");
if ($cnt == 0) {
// echo "CNT : ".$cnt;
DB::insert_table("flow", array(
"form_key" => $this->form_key,
"system_id" => $this->system_id,
"flow_id" => $this->flow_id,
"form_id" => $this->form_id,
"flow_code" => $this->flow_code,
"flow_code_seq" => $this->flow_code_seq,
"back_code" => $this->back_code
));
} else {
$where = "form_key = '" . $this->form_key . "'";
DB::update_table("flow", array(
"flow_code" => $this->flow_code ,
"flow_code_seq" => $this->flow_code_seq ,
"back_code" => $this->back_code
), $where);
}
}
/**
* @return string
*/
public function getFormKey()
{
return $this->form_key;
}
/**
* @return mixed
*/
public function getFormId()
{
return $this->form_id;
}
/**
* @return mixed
*/
public function getFlowId()
{
return $this->flow_id;
}
/**
* @return mixed
*/
public function getSystemId()
{
return $this->system_id;
}
/**
* @param mixed $system_id
* @return Flow
*/
public function setSystemId($system_id)
{
$this->system_id = $system_id;
return $this;
}
/**
* @param mixed $flow_id
* @return Flow
*/
public function setFormId($form_id)
{
$this->form_id = $form_id;
return $this;
}
/**
* @param mixed $flow_code
* @return Flow
*/
public function setFlowCode($flow_code)
{
$this->flow_code = $flow_code;
return $this;
}
/**
* @return mixed
*/
public function setFlowId($flow_id)
{
$this->flow_id = $flow_id;
return $this;
}
/**
* @return mixed
*/
public function getFlowCode()
{
return $this->flow_code;
}
}