Viewing file: processSendDocNewSR.php (8.77 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 "../class/clsDepartment.php";
include_once "../class/clsPerson.php";
include_once "../link/function.php";
include_once "../link/functionshow.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocSpeedLevel.php";
include_once "../class/clsDocSecreLevel.php";
include_once "../class/clsDocattatchesTmp.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocattatches.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsRunningDoc.php";
include_once "funct.php";
include_once "../class/clspsdept.php";
include_once "../class/clsDocSendtoPsTmp.php";
include_once "../class/clsCollegeDetail.php";
include_once "../class/clsSendReceive.php";
include_once "programTSR.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP2 = new Department($oC);
$oDP3 = new Department($oC);
$oDP4 = new Department($oC);
$oDP5 = new Department($oC);
$oDPt = new Department($oC);
$oDPt2 = new Department($oC);
$oDPt3 = new Department($oC);
$oDPt4 = new Department($oC);
$oDPt = new Department($oC);
$oDPt2 = new Department($oC);
$oDPt3 = new Department($oC);
$oDPt4 = new Department($oC);
$oPS = new person($oC);
$oPS2 = new person($oC);
$oPS3 = new person($oC);
$oPS4 = new person($oC);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oDlp1 = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDsl = new DocSpeedLevel($oC);
$oDcl = new DocSecretLevel($oC);
$oDtmp = new DocattatchesTmp($oC);
$oDoc = new Documents($oC);
$oDoc2 = new Documents($oC);
$oDoc3 = new Documents($oC);
$oDoc4 = new Documents($oC);
$oDoc5 = new Documents($oC);
$oDatt = new Docattatches($oC);
$oDatt2 = new Docattatches($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs3 = new DocReceiveSend($oC);
$oRs4 = new DocReceiveSend($oC);
$oRs5 = new DocReceiveSend($oC);
$oRd = new runningdoc($oC);
$oStmp=new DocSendToPsTmp($oC);
$oPSd = new psdept($oC);
$oCd = new collegedetail($oC);
$oTsr = new sendreceive($oC);
$oTsr2 = new sendreceive($oC);
$oTsr3 = new sendreceive($oC);
$oTsre = new sendreceive($oC);
$MaxDocGroup=$oDP->SearchMaxDocGroup();
if($method=="AddSendNewSR"){
$flagCommit = true;
$checkflagCommit= true;
$oC->BeginTrans();
$timesend=getNowDateTh()." ".date('H:i:s');
$oTsr->SearchDocSend($GLOBALS["COLLEGEID"],$DocID);
$oTsr->GetRecord();
//echo $oTsr->tsr_id;
$oCd->RScollegeSR2($GLOBALS["COLLEGEID"]);
while($oCd->GetRecord()){
if($collegeSR[$oCd->collegeID]==$oCd->collegeID){
$oTsr2->AddNew();
//echo '<br><br>-------------insert TSR '.$oCd->collegeName.'['.$oCd->collegeID.']----------------<br>';
$oTsr2->tsr_fr_node=$oTsr->tsr_fr_node;
//echo '<b>tsr_fr_node=</b>'.$oTsr2->tsr_fr_node=$oTsr->tsr_fr_node;
$oTsr2->tsr_fr_node_date=$timesend;
//echo '<br><b>tsr_fr_node_date=</b>'.$oTsr2->tsr_fr_node_date=$timesend;
$oTsr2->tsr_to_node=$oCd->collegeID;
//echo '<br><b>tsr_to_node=</b>'.$oTsr2->tsr_to_node=$oCd->collegeID;
$oTsr2->tsr_docid=$DocID;
//echo '<br><b>tsr_docid=</b>'.$oTsr2->tsr_docid=$DocID;
$oTsr2->tsr_doc_url=$oTsr->tsr_doc_url;
//echo '<br><b>tsr_doc_url=</b>'.$oTsr2->tsr_doc_url=$oTsr->tsr_doc_url;
$oTsr2->tsr_doc_chksum=$oTsr->tsr_doc_chksum;
//echo '<br><b>tsr_doc_chksum=</b>'.$oTsr2->tsr_doc_chksum=$oTsr->tsr_doc_chksum;
$oTsr2->tsr_status='s1';
//echo '<br><b>tsr_status=</b>'.$oTsr2->tsr_status='s1';
$oTsr2->tsr_docgroup=$oTsr->tsr_docgroup;
//echo '<br><b>tsr_docgroup=</b>'.$oTsr2->tsr_docgroup=$oTsr->tsr_docgroup;
$oTsr2->tsr_DrsID=$oTsr->tsr_DrsID;
//echo '<br><b>tsr_DrsID=</b>'.$oTsr2->tsr_DrsID=$oTsr->tsr_DrsID;
$oTsr2->tsr_DocSubject=th2a($oTsr->tsr_DocSubject);
//echo '<br><b>tsr_DocSubject=</b>'.$oTsr2->tsr_DocSubject=th2a($oTsr->tsr_DocSubject);
$oTsr2->tsr_DocNo=th2a($oTsr->tsr_DocNo);
//echo '<br><b>tsr_DocNo=</b>'.$oTsr2->tsr_DocNo=th2a($oTsr->tsr_DocNo);
$oTsr2->tsr_DocDate=$oTsr->tsr_DocDate;
//echo '<br><b>tsr_DocDate=</b>'.$oTsr2->tsr_DocDate=$oTsr->tsr_DocDate;
$oTsr2->tsr_DocFrom=th2a($oTsr->tsr_DocFrom);
//echo '<br><b>tsr_DocFrom=</b>'.$oTsr2->tsr_DocFrom=th2a($oTsr->tsr_DocFrom);
$oTsr2->tsr_DocTo=th2a($oTsr->tsr_DocTo);
//echo '<br><b>tsr_DocTo=</b>'.$oTsr2->tsr_DocTo=th2a($oTsr->tsr_DocTo);
$oTsr2->tsr_DocRef=th2a($oTsr->tsr_DocRef);
//echo '<br><b>tsr_DocRef=</b>'.$oTsr2->tsr_DocRef=th2a($oTsr->tsr_DocRef);
$oTsr2->tsr_DocOther=th2a($oTsr->tsr_DocOther);
//echo '<br><b>tsr_DocOther=</b>'.$oTsr2->tsr_DocOther=th2a($oTsr->tsr_DocOther);
$oTsr2->tsr_DslID=$oTsr->tsr_DslID;
//echo '<br><b>tsr_DslID=</b>'.$oTsr2->tsr_DslID=$oTsr->tsr_DslID;
$oTsr2->tsr_DclID=$oTsr->tsr_DclID;
//echo '<br><b>tsr_DclID=</b>'.$oTsr2->tsr_DclID=$oTsr->tsr_DclID;
$oTsr2->tsr_DocShortDesc=th2a($oTsr->tsr_DocShortDesc);
//echo '<br><b>tsr_DocShortDesc=</b>'.$oTsr2->tsr_DocShortDesc=th2a($oTsr->tsr_DocShortDesc);
$oTsr2->tsr_PtID=$oTsr->tsr_PtID;
//echo '<br><b>tsr_PtID=</b>'.$oTsr2->tsr_PtID=$oTsr->tsr_PtID;
$oTsr2->tsr_DlcID=$DlcIDlogin;
//echo '<br><b>tsr_DlcID=</b>'.$oTsr2->tsr_DlcID=$DlcIDlogin;
$oTsr2->tsr_personId=$personId;
//echo '<br><b>tsr_personId=</b>'.$oTsr2->tsr_personId=$personId;
$oTsr2->tsr_DtID=$oTsr->tsr_DtID;
//echo '<br><b>tsr_DtID=</b>'.$oTsr2->tsr_DtID=$oTsr->tsr_DtID;
$oTsr2->tsr_docname=$oTsr->tsr_docname;
//echo '<br><b>tsr_docname=</b>'.$oTsr2->tsr_docname=$oTsr->tsr_docname;
$oTsr2->tsr_DrsDocDueDate=$oTsr->tsr_DrsDocDueDate;
//echo '<br><b>tsr_DrsDocDueDate=</b>'.$oTsr2->tsr_DrsDocDueDate=$oTsr->tsr_DrsDocDueDate;
$oTsr2->tsr_statusDocAtt=$oTsr->tsr_statusDocAtt;
//echo '<br><b>tsr_statusDocAtt=</b>'.$oTsr2->tsr_statusDocAtt=$oTsr->tsr_statusDocAtt;
$checkflagCommit = $oTsr2->Save();
$oTsre->SearchBytsr_docid_tsr_to_node_tsr_fr_node_date2($DocID,$oCd->collegeID,$timesend);
$oTsre->GetRecord();
//senddocSR($oTsre->tsr_id);
$realpath = sendTor1($oTsre->tsr_id);
//echo "<br> REAL PATH:".$realpath."<br><br>";
$areal[$oTsre->tsr_id] = $realpath;
//print_r($areal).'<br>';
//$checkupdate++;
}
} //while CollegeDetail
/*********** curl stuff for recieve some joice shit from anywhere ************/
$curlHandle = curl_multi_init();
if($curlHandle){
$i = 1;
//echo "Yes I am handle".$curlHandle."<br>";
foreach($areal as $key => $value){
//echo "Key:$key; Value: $value<br>";
$curl[$key] = addHandle($curlHandle,$value);
$i++;
}//end foreach
//echo "After add<br>";
ExecHandle($curlHandle); //This is the adventage of multi curl instead of dumb filegetcontent
// echo "After Execute<br>";
foreach($curl as $key => $value){
$output[$key] = curl_multi_getcontent($value);
curl_multi_remove_handle($curlHandle,$value);
}
/*
for($j = 1;$j < $i ;$j++){
$output[$i] = curl_multi_getcontent($curl[$i]);
//echo $output[$i]."------ >output<br>";
curl_multi_remove_handle($curlHandle,$curl[$i]);
}
*/
curl_multi_close($curlHandle);
foreach($output as $id => $answer){
if($answer == 'mr'){
$oTsr3->SearchByKey($id);
$oTsr3->GetRecord();
//echo "<br>-------------update status = s2--------------<br>";
$oTsr3->Edit();
//echo '<b>tsr_status=</b>'.$oTsr->tsr_status='s2';
$oTsr3->tsr_status='s2';
//echo '<br>';
$checkflagCommit = $oTsr3->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}else{
//donotthing
}
}
}else{
echo "Cannot use multi curl<br>";
}
/*********** curl stuff************/
//}
//}
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
?>
<script language="JavaScript">
parent.location.href ="sendDoc.php";
</script>
<?
}
?>
|