Viewing file: processEditPsInfo.php (4.79 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../link/function.php";
include_once "../class/clsTable.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsPerson.php";
include_once "../class/clsDepartmentPE.php";
include_once "../class/clsPersonPE.php";
include_once "../class/clsUmuser.php";
include_once "../class/clsUmUserGroup.php";
$oUs = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_UMS'], $GLOBALS['DBUSER_UMS'], $GLOBALS['DBPASS_UMS']);
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oPS = new person($oC);
$oUms= new umuser($oUs);
$oUms2= new umuser($oUs);
$oUg=new umusergroup($oUs);
if($method=="editinfo"){
$oPS->SearchByKey($ps);
if($oPS->GetRecord()=="1"){
$oPS->Edit();
$oPS->personId=$ps;
echo "personId".$oPS->personId."<br>";
$oPS->deptId=$deptId;
echo "deptId".$oPS->deptId."<br>";
$oPS->workGpId=$oPS->workGpId;
$oPS->prefixId=$prefixId;
echo "prefixId".$oPS->prefixId."<br>";
$oPS->fName=$fName;
echo "fName".$oPS->fName."<br>";
$oPS->lName=$lName;
echo "lName".$oPS->lName."<br>";
$oPS->fStatus=$oPS->fStatus;
$oPS->adminId=$adminId;
$oPS->fRetire=$oPS->fRetire;
$oPS->hireId=$hireId;
$oPS->Save();
//---------------------------add data to ums
echo "+++++umuser<br>";
$oUms->SearchByUsPsCode($ps);
$oUms->GetRecord();
$oUms->Edit();
$oUms->UsID=$oUms->UsID;
echo "UsID".$oUms->UsID."<br>";
$oUms->UsName=$fName." ".$lName;
echo "UsName".$oUms->UsName."<br>";
$oUms->UsLogin=$oUms->UsLogin;
echo "UsLogin".$oUms->UsLogin."<br>";
$oUms->UsPassword=$oUms->UsPassword;
$oUms->UsPsCode=$oUms->UsPsCode;
echo "UsPsCode".$oUms->UsPsCode."<br>";
//echo "personId".$oPe->personId."<br>";
$oUms->UsWgID='';
$oUms->UsQsID='';
$oUms->UsAnswer='';
$oUms->UsEmail='';
$oUms->UsActive='';
$oUms->UsAdmin='';
$oUms->UsDesc='';
$oUms->UsPwdExpDt='';
$oUms->UsUpdDt='';
$oUms->UsUpdUsID='';
$oUms->UsSessionID='';
$oUms->Save();
}
?>
<script language="JavaScript">
parent.location.href ="editPsInfo.php?s=1&ps=<? echo $ps; ?>";
</script>
<?
}else if($method=="addinfo"){
$oPS->SearchfNamelName($fName,$lName);
if($oPS->GetRecord()!=1){
$oUms2->SearchByUsLogin($loginName);
if($oUms2->GetRecord()!=1){
$oPS->AddNew();
$oPS->personId=$oPS->GetNextCode();
echo "personId".$oPS->personId."<br>";
$oPS->deptId=$deptId;
echo "deptId".$oPS->deptId."<br>";
$oPS->workGpId="";
$oPS->prefixId=$prefixId;
echo "prefixId".$oPS->prefixId."<br>";
$oPS->fName=$fName;
echo "fName".$oPS->fName."<br>";
$oPS->lName=$lName;
echo "lName".$oPS->lName."<br>";
$oPS->fStatus="1";
$oPS->adminId=$adminId;
$oPS->fRetire="0";
$oPS->hireId=$hireId;
$oPS->Save();
$oUms->AddNew();
$oUms->UsID=$oUms->GetNextCode();
echo "UsID".$oUms->UsID."<br>";
$oUms->UsName=$fName." ".$lName;
echo "UsName".$oUms->UsName."<br>";
$oUms->UsLogin=$loginName;
echo "UsLogin".$oUms->UsLogin."<br>";
$oUms->UsPassword=md5("O]O".strtolower(rtrim($loginName))."O[O");
$oUms->UsPsCode=$oPS->personId;
echo "UsPsCode".$oUms->UsPsCode."<br>";
//echo "personId".$oPe->personId."<br>";
$oUms->UsWgID='';
$oUms->UsQsID='';
$oUms->UsAnswer='';
$oUms->UsEmail='';
$oUms->UsActive='';
$oUms->UsAdmin='';
$oUms->UsDesc='';
$oUms->UsPwdExpDt='';
$oUms->UsUpdDt='';
$oUms->UsUpdUsID='';
$oUms->UsSessionID='';
$oUms->Save();
//---------------------------add data to ums
echo "+++++umusergroup <br>";
$oUg->AddNew();
$oUg->UgID=$oUg->GetNextCode();
echo "UsID".$oUg->UgID."<br>";
$oUg->UgGpID="108"; //ผู้ใข้ทั่วไปของสารบรรณ
echo "UgGpID".$oUg->UgGpID."<br>";
$oUg->UgUsID=$oUms->UsID;
echo "UgUsID".$oUg->UgUsID."<br>";
$oUg->Save();
echo "--------------------------------<br>";
?>
<script language="JavaScript">
parent.location.href ="addPsInfo.php?s=1";
</script>
<?
}else{
?>
<script language="JavaScript">
parent.location.href ="addPsInfo.php?e=2";
</script>
<?
}
}else{
?>
<script language="JavaScript">
parent.location.href ="addPsInfo.php?e=1";
</script>
<?
}
}
?>
|