fix bug cây thư mục phòng ban
This commit is contained in:
parent
d8c061c73a
commit
f65c064f04
|
@ -21,7 +21,7 @@ class DepartmentController extends Controller {
|
||||||
parent::init();
|
parent::init();
|
||||||
if (time() > Yii::$app->params["time"])
|
if (time() > Yii::$app->params["time"])
|
||||||
$this->redirect(["/dashboard"]);
|
$this->redirect(["/dashboard"]);
|
||||||
|
|
||||||
if (Yii::$app->user->isGuest)
|
if (Yii::$app->user->isGuest)
|
||||||
return $this->redirect(['/site/login']);
|
return $this->redirect(['/site/login']);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,9 @@ class DepartmentController extends Controller {
|
||||||
$oldCode = $model->code;
|
$oldCode = $model->code;
|
||||||
$model->name = $data["Name"];
|
$model->name = $data["Name"];
|
||||||
$model->code = $data["Code"];
|
$model->code = $data["Code"];
|
||||||
$model->pid = $data["Pid"] !== "" ? $data["Pid"] : 0;
|
if ($model->pid != 1) {
|
||||||
|
$model->pid = $data["Pid"] !== "" ? $data["Pid"] : 0;
|
||||||
|
}
|
||||||
$model->modified_at = time();
|
$model->modified_at = time();
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
Department::updateAll(["pid" => $data["Code"]], ["pid" => $oldCode]);
|
Department::updateAll(["pid" => $data["Code"]], ["pid" => $oldCode]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user