function attachFile($aSource, $iIndex = -1) { if (($wo_task_id = DCL_Sanitize::ToInt($aSource['wo_task_id'])) === null) { trigger_error('Data sanitize failed.', E_USER_ERROR); return; } if ($this->oDB->Load($wo_task_id) == -1) { return; } if (($sFileName = DCL_Sanitize::ToFileName('userfile')) !== null) { $o =& CreateObject('dcl.boFile'); $o->iType = DCL_ENTITY_WORKORDER_TASK; $o->iKey1 = $wo_task_id; $o->sFileName = DCL_Sanitize::ToActualFileName('userfile'); $o->sTempFileName = $sFileName; $o->sRoot = $dcl_info['DCL_FILE_PATH'] . '/attachments'; $o->Upload(); } }
function doupload() { global $dcl_info, $g_oSec; commonHeader(); if (($iID = @DCL_Sanitize::ToInt($_REQUEST['jcn'])) === null || ($iSeq = @DCL_Sanitize::ToInt($_REQUEST['seq'])) === null) { trigger_error('Data sanitize failed.'); return; } if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ATTACHFILE, $iID, $iSeq)) { return PrintPermissionDenied(); } $oWO =& CreateObject('dcl.dbWorkorders'); if ($oWO->Load($iID, $iSeq) == -1) { return; } if (($sFileName = DCL_Sanitize::ToFileName('userfile')) === null) { return PrintPermissionDenied(); } $o = CreateObject('dcl.boFile'); $o->iType = DCL_ENTITY_WORKORDER; $o->iKey1 = $iID; $o->iKey2 = $iSeq; $o->sFileName = DCL_Sanitize::ToActualFileName('userfile'); $o->sTempFileName = $sFileName; $o->sRoot = $dcl_info['DCL_FILE_PATH'] . '/attachments'; $o->Upload(); $obj = CreateObject('dcl.htmlWorkOrderDetail'); $obj->Show($iID, $iSeq); }
function doupload() { global $dcl_info, $g_oSec; commonHeader(); if (($projectid = @DCL_Sanitize::ToInt($_REQUEST['projectid'])) === null) { trigger_error('Data sanitize failed.'); return; } if (!$g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ATTACHFILE, $projectid)) { return PrintPermissionDenied(); } if (($sFileName = DCL_Sanitize::ToFileName('userfile')) !== null) { $o =& CreateObject('dcl.boFile'); $o->iType = DCL_ENTITY_PROJECT; $o->iKey1 = $projectid; $o->sFileName = DCL_Sanitize::ToActualFileName('userfile'); $o->sTempFileName = $sFileName; $o->sRoot = $dcl_info['DCL_FILE_PATH'] . '/attachments'; $o->Upload(); } else { trigger_error('Invalid request'); return; } $objHTML =& CreateObject('dcl.htmlProjectsdetail'); $objHTML->Show($projectid, 0, 0); }
function dbadd() { global $dcl_info, $g_oSec; commonHeader(); if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION)) { return PrintPermissionDenied(); } $objTimecard =& CreateObject('dcl.dbTimeCards'); $objWorkorder =& CreateObject('dcl.dbWorkorders'); $oStatus =& CreateObject('dcl.dbStatuses'); $objTimecard->InitFromGlobals(); $objTimecard->actionby = $GLOBALS['DCLID']; if ($g_oSec->IsPublicUser()) { $objTimecard->is_public = 'Y'; } else { $objTimecard->is_public = @DCL_Sanitize::ToYN($_REQUEST['is_public']); } $objTimecard->inputon = DCL_NOW; if ($objWorkorder->Load($objTimecard->jcn, $objTimecard->seq) == -1) { return; } if (($targeted_version_id = @DCL_Sanitize::ToInt($_REQUEST['targeted_version_id'])) === null) { $targeted_version_id = 0; } if (($fixed_version_id = @DCL_Sanitize::ToInt($_REQUEST['fixed_version_id'])) === null) { $fixed_version_id = 0; } $status = $objWorkorder->status; $objTimecard->Add($targeted_version_id, $fixed_version_id); $notify = '4'; if ($status != $objTimecard->status) { $notify .= ',3'; if ($oStatus->GetStatusType($objTimecard->status) == 2) { $notify .= ',2'; // also need to close all incomplete tasks and warn user if it happens $this->closeIncompleteTasks($objTimecard->jcn, $objTimecard->seq); } elseif ($oStatus->GetStatusType($objTimecard->status) == 1 && $oStatus->GetStatusType($status) != 1) { $notify .= ',1'; } } // See if we modified some work order items // * Tags if (isset($_REQUEST['tags']) && $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_MODIFY)) { $oTag =& CreateObject('dcl.dbEntityTag'); $oTag->serialize(DCL_ENTITY_WORKORDER, $objWorkorder->jcn, $objWorkorder->seq, $_REQUEST['tags']); } // * Hotlists if (isset($_REQUEST['hotlist']) && $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_MODIFY)) { $oTag =& CreateObject('dcl.dbEntityHotlist'); $oTag->serialize(DCL_ENTITY_WORKORDER, $objWorkorder->jcn, $objWorkorder->seq, $_REQUEST['hotlist']); } // * Organizations - only if multiple are allowed to improve workflow if ($g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_MODIFY) && $dcl_info['DCL_WO_SECONDARY_ACCOUNTS_ENABLED'] == 'Y') { $oWOA =& CreateObject('dcl.dbWorkOrderAccount'); if (isset($_REQUEST['secaccounts'])) { $aAccounts = @DCL_Sanitize::ToIntArray($_REQUEST['secaccounts']); if ($aAccounts === null) { $aAccounts = array(); } $oWOA->DeleteByWorkOrder($objWorkorder->jcn, $objWorkorder->seq, join(',', $aAccounts)); // Add the new ones if (count($aAccounts) > 0) { $oWOA->wo_id = $objWorkorder->jcn; $oWOA->seq = $objWorkorder->seq; for ($i = 0; $i < count($aAccounts); $i++) { if ($aAccounts[$i] > 0) { $oWOA->account_id = $aAccounts[$i]; $oWOA->Add(); } } } } else { $oWOA->DeleteByWorkOrder($objWorkorder->jcn, $objWorkorder->seq); } } // * Project if ($g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ADDTASK)) { if (($iProjID = @DCL_Sanitize::ToInt($_REQUEST['projectid'])) !== null && $iProjID > 0) { $oProjectMap =& CreateObject('dcl.dbProjectmap'); if ($oProjectMap->LoadByWO($objWorkorder->jcn, $objWorkorder->seq) == -1 || $oProjectMap->projectid != $iProjID) { $oProject = CreateObject('dcl.boProjects'); $aSource = array(); $aSource['selected'] = array($objWorkorder->jcn . '.' . $objWorkorder->seq); $aSource['projectid'] = $iProjID; $oProject->batchMove($aSource); } } } // * File attachment if (($sFileName = DCL_Sanitize::ToFileName('userfile')) !== null && $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ATTACHFILE)) { $o =& CreateObject('dcl.boFile'); $o->iType = DCL_ENTITY_WORKORDER; $o->iKey1 = $objWorkorder->jcn; $o->iKey2 = $objWorkorder->seq; $o->sFileName = DCL_Sanitize::ToActualFileName('userfile'); $o->sTempFileName = $sFileName; $o->sRoot = $dcl_info['DCL_FILE_PATH'] . '/attachments'; $o->Upload(); } $objWtch =& CreateObject('dcl.boWatches'); // Reload before sending since time card modifies the work order $objWorkorder->Load($objTimecard->jcn, $objTimecard->seq); $objWtch->sendNotification($objWorkorder, $notify); // if BuildManager is used, find info on who submitted the WO if ($dcl_info['DCL_BUILD_MANAGER_ENABLED'] == 'Y') { // $oBM = CreateObject('dcl.dbBuildManager'); // $oBM->CheckDepartmentSubmit($objTimecard->jcn, $objTimecard->seq, $objWorkorder->product); } $objWO =& CreateObject('dcl.htmlWorkOrderDetail'); $objWO->Show($objTimecard->jcn, $objTimecard->seq); }
function doupload() { global $dcl_info, $g_oSec; commonHeader(); if (!$g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ATTACHFILE)) { return PrintPermissionDenied(); } if (($iID = @DCL_Sanitize::ToInt($_REQUEST['ticketid'])) === null) { trigger_error('Data sanitize failed.'); return; } $objTicket =& CreateObject('dcl.dbTickets'); if ($objTicket->Load($iID) == -1) { return; } if (($sFileName = DCL_Sanitize::ToFileName('userfile')) === null) { return PrintPermissionDenied(); } $o =& CreateObject('dcl.boFile'); $o->iType = DCL_ENTITY_TICKET; $o->iKey1 = $iID; $o->sFileName = DCL_Sanitize::ToActualFileName('userfile'); $o->sTempFileName = $sFileName; $o->sRoot = $dcl_info['DCL_FILE_PATH'] . '/attachments'; $o->Upload(); $obj =& CreateObject('dcl.htmlTicketDetail'); $obj->Show($objTicket); }