// we need the ID of the Mailinglist $strQuery = "SELECT nMailingListId\n\t\t\t\t\tFROM cf_circulationform\n\t\t\t\t\tWHERE nID = '{$nCirculationFormId}' LIMIT 1;"; $nResult = mysql_query($strQuery); if ($nResult) { $arrRow = mysql_fetch_array($nResult, MYSQL_ASSOC); $nMailinglistId = $arrRow['nMailingListId']; } // get the next User $arrNextUser = getNextUserInList($nUserId, $nMailinglistId, $nSlotId); // send the message if ($arrNextUser[0] != '') { // set current user state to "skipped" $strQuery = "\tUPDATE cf_circulationprocess \n\t\t\t\t\t\tSET nDecissionState = '4',\n\t\t\t\t\t\t\tdateDecission = '{$TStoday}' \n\t\t\t\t\t\tWHERE nID = '{$nCirculationProcessId}'"; mysql_query($strQuery, $nConnection); // send sendToUser($arrNextUser[0], $nCirculationFormId, $arrNextUser[1], 0, $nCirculationHistoryId); if ($arrNextUser[2] !== false) { // Slot has changed // Send a notification if this is wished $strQuery = "SELECT * FROM cf_circulationform WHERE nID=" . $nCirculationFormId; $nResult = mysql_query($strQuery, $nConnection); if ($nResult) { if (mysql_num_rows($nResult) > 0) { $arrRow = mysql_fetch_array($nResult); //print_r($arrRow); $nSenderId = $arrRow["nSenderId"]; $strCircName = $arrRow["strName"]; $nEndAction = $arrRow["nEndAction"]; } } $strQuery = "SELECT * FROM cf_formslot WHERE nID=" . $arrNextUser[2];
$nCURMailinglistID = $_REQUEST['nCURMailinglistID']; $nUserID = $_REQUEST['nUserID']; // Id of selected User $objMyCirculation = new CCirculation(); $nCirculationHistoryID = $objMyCirculation->getCirculationHistoryID($nCURCirculationProcessID); //----------------------------------------------- //--- set user state to "skipped" //----------------------------------------------- $strQuery = "UPDATE cf_circulationprocess set nDecissionState = 8, dateDecission = '{$TStoday}' WHERE nID = '{$nCURCirculationProcessID}'"; mysql_query($strQuery, $nConnection); // - get the UserId of the current Station $arrCURCirculationProcess = $objMyCirculation->getMyCirculationProcess($nCURCirculationProcessID); $nCURStation_UserID = $arrCURCirculationProcess['nUserId']; $nSlotID = $arrCURCirculationProcess['nSlotId']; // send sendToUser($nUserID, $nCirculationFormID, $nSlotID, $nCURCirculationProcessID, $nCirculationHistoryID); //? //$strQuery = "INSERT INTO cf_circulationprocess VALUES(null, '$nCirculationFormID', '$nSlotID', '$nUserID', time(), 0, '$nCURStation_UserID', '$nCirculationHistoryID')"; //echo "Query: ".$strQuery."<br>"; //mysql_query($strQuery, $nConnection); ?> <script src="../lib/RPL/Encryption/aamcrypt.js" type="text/javascript" language="JavaScript"></script> <script src="../lib/RPL/Encryption/boxes.js?<?php echo time(); ?> " type="text/javascript" language="JavaScript"></script> <script language="javascript"> var strParams = "circid=<?php echo $nCirculationFormID; ?> &language=<?php
if ($arrUsers[$nUserId]['nID'] != '') { $arrUser = $arrUsers[$nUserId]; $SP_UNIT = $arrUser['strSubstituteTimeUnit']; $SP_VALUE = $arrUser['nSubstituteTimeValue']; switch ($SP_UNIT) { case 'DAYS': $SP_MINUTES = $SP_VALUE * 24 * 60; break; case 'HOURS': $SP_MINUTES = $SP_VALUE * 60; break; case 'MINUTES': $SP_MINUTES = $SP_VALUE; break; } $tsCurrentSendSP = mktime(date("H"), date("i") - $SP_MINUTES, date("s"), date("m"), date("d"), date("Y")); } if ($dateInProcessSince < $tsCurrentSendSP) { //--- change decission state $strQuery = "UPDATE cf_circulationprocess SET nDecissionState = '8', dateDecission = '{$TStoday}' WHERE nID = '{$nCirculationProcessId}'"; mysql_query($strQuery, $nConnection); //--- send substitute mail sendToUser($nSubstituteId, $nCirculationFormId, $nSlotId, $nCirculationProcessId, $nCirculationHistoryId); } } $nIndex2 = $nMax2; } } } } }
// write table cf_circulationform $query = "INSERT INTO cf_circulationform values (null, '{$senderId}', '{$circulationTitle}', '{$mailinglistId}', 0, '{$endAction}', 0)"; $result = @mysql_query($query); // get the circulationform Id $query = "SELECT MAX(nID) as cfId FROM cf_circulationform WHERE bDeleted = 0"; $result = @mysql_query($query); $row = @mysql_fetch_array($result, MYSQL_ASSOC); $cfId = $row['cfId']; // write table cf_circulationhistory $query = "INSERT INTO cf_circulationhistory values (null, 1, " . time() . ", '" . $circulationHistory['strAdditionalText'] . "', '{$cfId}')"; $result = @mysql_query($query); // get the circulationhistory Id $query = "SELECT MAX(nID) as chId FROM cf_circulationhistory"; $result = @mysql_query($query); $row = @mysql_fetch_array($result, MYSQL_ASSOC); $chId = $row['chId']; $fieldvalues = $circulation->getFieldValues($oldCfId, $oldChId); foreach ($fieldvalues as $key => $value) { $inputfieldId = $value['nInputFieldId']; $inputfield = arGetInputfield($inputfieldId); $fieldValue = $inputfield['strStandardValue']; $split = explode('_', $key); $slotId = $split[1]; $query = "INSERT INTO cf_fieldvalue values (null, '{$inputfieldId}', '{$fieldValue}', '{$slotId}', '{$cfId}', '{$chId}')"; $result = @mysql_query($query); } // send the circulation to the first receiver require_once '../pages/send_circulation.php'; $arrNextUser = getNextUserInList(-1, $mailinglistId, -1); sendToUser($arrNextUser[0], $cfId, $arrNextUser[1], 0, $chId);
if (mysql_num_rows($nResult) > 0) { $arrRow = mysql_fetch_array($nResult); $nListId = $arrRow[0]; } } //----------------------------------------------- //--- remove user entry in process information //--- cause send_mail() adds a new one after //--- sending the mail //----------------------------------------------- $strQuery = "DELETE FROM cf_circulationprocess WHERE nID=" . $_REQUEST["cpid"]; mysql_query($strQuery, $nConnection); //----------------------------------------------- //--- send mail to next user in mailing list //----------------------------------------------- sendToUser($arrProcessInfo["nUserId"], $arrProcessInfo["nCirculationFormId"], $arrProcessInfo["nSlotId"], $arrProcessInfo["nIsSubstitiuteOf"], $arrProcessInfo["nCirculationHistoryId"]); } } ?> <html> <head> <meta http-equiv="content-type" content="text/html; charset=<?php echo $DEFAULT_CHARSET; ?> "> <script language="JavaScript"> <!-- function siteLoaded() { var strParams = "circid=<?php echo $_REQUEST["circid"];
$result = mysql_query($strQuery, $nConnection); $arrResult = mysql_fetch_array($result, MYSQL_ASSOC); $strQuery = "SELECT nUserId FROM cf_circulationprocess WHERE nCirculationFormId = '{$nCirculationFormId}' AND dateInProcessSince = '" . $arrResult['nMaxDateInProcessSince'] . "' LIMIT 1;"; $result = mysql_query($strQuery, $nConnection); $arrResult = mysql_fetch_array($result, MYSQL_ASSOC); $nSubsUserId = $arrResult['nUserId']; $arrNextUser = getNextUserInList($nSubsUserId, $nListId, $nSlotId); } if ($arrNextUser[0] != "") { if ($arrNextUser[0] == -2) { // let's get the Sender User ID $objCirculation = new CCirculation(); $arrSender = $objCirculation->getSenderDetails($nCirculationFormId); $arrNextUser[0] = $arrSender['nID']; } sendToUser($arrNextUser[0], $arrProcessInfo["nCirculationFormId"], $arrNextUser[1], 0, $arrProcessInfo["nCirculationHistoryId"]); if ($arrNextUser[2] !== false) { // Slot has changed // Send a notification if this is wished $strQuery = "SELECT * FROM cf_circulationform WHERE nID=" . $arrProcessInfo["nCirculationFormId"]; $nResult = mysql_query($strQuery, $nConnection); if ($nResult) { if (mysql_num_rows($nResult) > 0) { $arrRow = mysql_fetch_array($nResult); $nSenderId = $arrRow["nSenderId"]; $strCircName = $arrRow["strName"]; $nEndAction = $arrRow["nEndAction"]; } } $strQuery = "SELECT * FROM cf_formslot WHERE nID=" . $arrNextUser[2]; $nResult = mysql_query($strQuery, $nConnection);
if ($arrCurCOMBOEntries['nMyState'] == $nCounter) { $nCurState = 1; } $nFieldId = $arrCurCOMBOEntries['nFieldId']; $nSlotId = $arrCurCOMBOEntries['nSlotId']; $nFormId = $arrCurCOMBOEntries['nFormId']; $strCrazyValue = $strCrazyValue . '---' . $strCurName . '---' . $nCurState; $nCounter++; } $strQuery = "UPDATE cf_fieldvalue SET strFieldValue='{$strCrazyValue}' WHERE nInputFieldId= '{$nFieldId}' AND nSlotId= '{$nSlotId}' AND nFormId = '{$nCirculationFormID}' AND nCirculationHistoryId = '{$nCirculationHistoryID}'; "; mysql_query($strQuery, $nConnection); } } include "send_circulation.php"; $arrNextUser = getNextUserInList(-1, $_REQUEST["listid"], -1); sendToUser($arrNextUser[0], $cfid, $arrNextUser[1], 0, $chid); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <?php echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=" . $DEFAULT_CHARSET . "\" />"; ?> <script language="JavaScript"> <!-- function siteLoaded() { location.href = "showcirculation.php?language=<?php echo $_REQUEST['language'];
$nIndex++; } } } $nStart = sizeof($arrCirculationProcess); $nMax = 1000; $tsDateInProcessSince = time(); $tsDateDecission = time() + 2; $objMyCirculation->setStationToSkipped($nCURCirculationProcessID); for ($nIndex = $nStart; $nIndex < $nMax; $nIndex++) { $arrCurPosition = $arr1337[$nIndex]; $nCurSlotID = $arrCurPosition['nSlotID']; $nCurUserID = $arrCurPosition['nUserID']; $nCurPosition = $arrCurPosition['nPosition']; if ($nCurSlotID == $nMySlotID && $nCurUserID == $nMyUserID && $nCurPosition == $nMyPosition) { sendToUser($nCurUserID, $nCirculationFormID, $nCurSlotID, $nCURCirculationProcessID, $nCirculationHistoryID, $tsDateInProcessSince); $nIndex = 10000; } else { $objMyCirculation->addCirculationProcess($nCirculationFormID, $nCirculationHistoryID, $nCurSlotID, $nCurUserID, $tsDateInProcessSince, $tsDateDecission); } $tsDateInProcessSince++; $tsDateDecission++; } ?> <script language="javascript"> var strParams = 'circid=<?php echo $nCirculationFormID; ?> &language=<?php echo $language; ?>