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();
|
||||
if (time() > Yii::$app->params["time"])
|
||||
$this->redirect(["/dashboard"]);
|
||||
|
||||
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
|
@ -89,7 +89,9 @@ class DepartmentController extends Controller {
|
|||
$oldCode = $model->code;
|
||||
$model->name = $data["Name"];
|
||||
$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();
|
||||
if ($model->save()) {
|
||||
Department::updateAll(["pid" => $data["Code"]], ["pid" => $oldCode]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user