* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) { return $RBAC_Response; } require_once 'classes/model/Department.php'; require_once 'classes/model/Users.php'; $oDpto = new Department(); if (!isset($_POST['DEP_UID'])) { return; } $ocriteria = new Criteria('workflow'); $ocriteria->addSelectColumn(DepartmentPeer::DEP_MANAGER); $ocriteria->add(DepartmentPeer::DEP_UID, $_POST['DEP_UID']); $oDataset = DepartmentPeer::doSelectRS($ocriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); $oCriteria1 = new Criteria('workflow'); $oCriteria1->add(UsersPeer::USR_REPORTS_TO, $aRow['DEP_MANAGER'], Criteria::EQUAL); $oCriteria2 = new Criteria('workflow'); $oCriteria2->add(UsersPeer::USR_REPORTS_TO, ''); BasePeer::doUpdate($oCriteria1, $oCriteria2, Propel::getConnection('workflow')); $oCriteriaA = new Criteria('workflow'); $oCriteriaA->add(UsersPeer::DEP_UID, $_POST['DEP_UID'], Criteria::EQUAL); $oCriteriaB = new Criteria('workflow'); $oCriteriaB->add(UsersPeer::DEP_UID, ''); BasePeer::doUpdate($oCriteriaA, $oCriteriaB, Propel::getConnection('workflow')); $oDpto->remove(urldecode($_POST['DEP_UID']));
echo '{success: false}'; } break; case 'canDeleteDepartment': global $RBAC; $aDEPTS = $RBAC->getAllUsersByDepartment(); if (isset($aDEPTS[$_POST['dep_uid']])) { echo '{success: false, users: ' . $aDEPTS[$_POST['dep_uid']] . '}'; } else { echo '{success: true}'; } break; case 'deleteDepartment': $DEP_UID = $_POST['DEP_UID']; $oDept = new Department(); $oDept->remove($DEP_UID); echo '{success: true}'; break; case 'assignedUsers': $filter = isset($_POST['textFilter']) ? $_POST['textFilter'] : ''; $dep_uid = $_REQUEST['dUID']; $oDept = new Department(); $oDept->Load($dep_uid); $manager = $oDept->getDepManager(); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(UsersPeer::USR_UID); $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(UsersPeer::USR_STATUS); $oCriteria->add(UsersPeer::DEP_UID, '');