Merged in norah/processmaker/BUG-12021 (pull request #872)
Corrections Audit Log
This commit is contained in:
@@ -115,6 +115,14 @@ class Groups
|
||||
$oGrp->setGrpUid($GrpUid);
|
||||
$oGrp->setUsrUid($UsrUid);
|
||||
$oGrp->Save();
|
||||
|
||||
$oGrpwf = new Groupwf();
|
||||
$grpName = $oGrpwf->loadByGroupUid($GrpUid);
|
||||
|
||||
$oUsr = new Users();
|
||||
$usrName = $oUsr->load($UsrUid);
|
||||
|
||||
G::auditLog("AssignUsersToGroup", "Assign user ". $usrName['USR_USERNAME'] ." (".$UsrUid.") to group ".$grpName['CON_VALUE']." (".$GrpUid.") ");
|
||||
}
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
@@ -39,6 +39,7 @@ class serverConf
|
||||
private $_aProperties = array();
|
||||
private $_aHeartbeatConfig = array();
|
||||
private $_aWSapces = array();
|
||||
private $_auditLogConfig = array();
|
||||
private $aWSinfo = array();
|
||||
private $pluginsA = array();
|
||||
private $errors = array();
|
||||
@@ -465,6 +466,52 @@ class serverConf
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* With this is possible to save a property that will be saved in the properties
|
||||
* array of this class.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $propertyValue
|
||||
* @param string $workspace
|
||||
*/
|
||||
public function setAuditLogProperty($propertyName, $propertyValue, $workspace)
|
||||
{
|
||||
$this->_auditLogConfig[$workspace][$propertyName] = $propertyValue;
|
||||
$this->saveSingleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* To unset a defined property.
|
||||
* If it doesn't exist then it does nothing.
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @param string $workspace
|
||||
* @return void
|
||||
*/
|
||||
public function unsetAuditLogProperty($propertyName, $workspace)
|
||||
{
|
||||
if (isset($this->_auditLogConfig[$workspace][$propertyName])) {
|
||||
unset($this->_auditLogConfig[$workspace][$propertyName]);
|
||||
}
|
||||
$this->saveSingleton();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a defined property.
|
||||
* If it doesn't exist then returns null
|
||||
*
|
||||
* @param string $propertyName
|
||||
* @return string/null
|
||||
*/
|
||||
public function getAuditLogProperty($propertyName, $workspace)
|
||||
{
|
||||
if (isset($this->_auditLogConfig[$workspace][$propertyName])) {
|
||||
return $this->_auditLogConfig[$workspace][$propertyName];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function isRtl($lang = SYS_LANG)
|
||||
{
|
||||
$lang = substr($lang, 0, 2);
|
||||
|
||||
@@ -200,6 +200,8 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
'APP_UID' => '',
|
||||
'SHD_DATE' => date('Y-m-d H:i:s')));
|
||||
*/
|
||||
|
||||
G::auditLog("CreatePMTable", $aData['ADD_TAB_NAME']);
|
||||
return $aData['ADD_TAB_UID'];
|
||||
} else {
|
||||
$sMessage = '';
|
||||
@@ -226,6 +228,7 @@ class AdditionalTables extends BaseAdditionalTables
|
||||
$oConnection->begin();
|
||||
$iResult = $oAdditionalTables->save();
|
||||
$oConnection->commit();
|
||||
G::auditLog("UpdatePMTable", $aData['ADD_TAB_NAME']." (".$aData['ADD_TAB_UID'].") ");
|
||||
} else {
|
||||
$sMessage = '';
|
||||
$aValidationFailures = $oAdditionalTables->getValidationFailures();
|
||||
|
||||
@@ -253,7 +253,11 @@ class CalendarDefinition extends BaseCalendarDefinition
|
||||
if (! (is_object( $tr ) && get_class( $tr ) == 'CalendarDefinition')) {
|
||||
$tr = new CalendarDefinition();
|
||||
$tr->setCalendarCreateDate( 'now' );
|
||||
G::auditLog("CreateCalendar", $aData['CALENDAR_NAME']);
|
||||
} else {
|
||||
G::auditLog("UpdateCalendar", $aData['CALENDAR_NAME']." (".$CalendarUid.") ");
|
||||
}
|
||||
|
||||
$tr->setCalendarUid( $CalendarUid );
|
||||
$tr->setCalendarName( $CalendarName );
|
||||
$tr->setCalendarUpdateDate( 'now' );
|
||||
@@ -315,6 +319,8 @@ class CalendarDefinition extends BaseCalendarDefinition
|
||||
if ($tr->validate()) {
|
||||
// we save it, since we get no validation errors, or do whatever else you like.
|
||||
$res = $tr->save();
|
||||
$deletedCalendar = $tr->getCalendarName();
|
||||
G::auditLog("DeleteCalendar", $deletedCalendar." (".$CalendarUid.") ");
|
||||
} else {
|
||||
// Something went wrong. We can now get the validationFailures and handle them.
|
||||
$msg = '';
|
||||
|
||||
@@ -57,8 +57,10 @@ class DashletInstance extends BaseDashletInstance
|
||||
$data['DAS_INS_UID'] = G::generateUniqueID();
|
||||
$data['DAS_INS_CREATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$dashletInstance = new DashletInstance();
|
||||
$msg = 'CreateDashletInstance';
|
||||
} else {
|
||||
$dashletInstance = DashletInstancePeer::retrieveByPK($data['DAS_INS_UID']);
|
||||
$msg = 'UpdateDashletInstance';
|
||||
}
|
||||
$data['DAS_INS_UPDATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$dashletInstance->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
@@ -66,6 +68,10 @@ class DashletInstance extends BaseDashletInstance
|
||||
$connection->begin();
|
||||
$result = $dashletInstance->save();
|
||||
$connection->commit();
|
||||
|
||||
$dashletData = $this->load($data['DAS_INS_UID']);
|
||||
G::auditLog($msg, $dashletData['DAS_INS_TITLE']." (".$dashletData['DAS_INS_UID'].") ");
|
||||
|
||||
return $data['DAS_INS_UID'];
|
||||
} else {
|
||||
$message = '';
|
||||
@@ -88,8 +94,11 @@ class DashletInstance extends BaseDashletInstance
|
||||
$dashletInstance = DashletInstancePeer::retrieveByPK($dasInsUid);
|
||||
if (!is_null($dashletInstance)) {
|
||||
$connection->begin();
|
||||
$dashletData = $this->load($dasInsUid);
|
||||
$result = $dashletInstance->delete();
|
||||
$connection->commit();
|
||||
|
||||
G::auditLog("DeleteDashletInstance", $dashletData['DAS_INS_TITLE']." (".$dasInsUid.") ");
|
||||
return $result;
|
||||
} else {
|
||||
throw new Exception('Error trying to delete: The row "' . $dasInsUid. '" does not exist.');
|
||||
|
||||
@@ -61,6 +61,12 @@ class Department extends BaseDepartment
|
||||
$this->setDepUid( G::generateUniqueID() );
|
||||
}
|
||||
|
||||
if (isset( $aData['DEP_PARENT'] ) && ($aData['DEP_PARENT'] =='')) {
|
||||
$msgLog = 'Departament';
|
||||
} else {
|
||||
$msgLog = 'SubDepartament';
|
||||
}
|
||||
|
||||
if (isset( $aData['DEP_PARENT'] )) {
|
||||
$this->setDepParent( $aData['DEP_PARENT'] );
|
||||
} else {
|
||||
@@ -108,6 +114,9 @@ class Department extends BaseDepartment
|
||||
$res = $this->save();
|
||||
|
||||
$con->commit();
|
||||
|
||||
G::auditLog("Create ".$msgLog, $aData['DEP_TITLE']);
|
||||
|
||||
return $this->getDepUid();
|
||||
} else {
|
||||
$msg = '';
|
||||
@@ -277,8 +286,11 @@ class Department extends BaseDepartment
|
||||
|
||||
$oPro = DepartmentPeer::retrieveByPK( $ProUid );
|
||||
if (! is_null( $oPro )) {
|
||||
$dptoTitle = $this->Load($oPro->getDepUid());
|
||||
Content::removeContent( 'DEPO_TITLE', '', $oPro->getDepUid() );
|
||||
Content::removeContent( 'DEPO_DESCRIPTION', '', $oPro->getDepUid() );
|
||||
|
||||
G::auditLog("DeleteDepartament", $dptoTitle['DEPO_TITLE']." (".$oPro->getDepUid().") ");
|
||||
return $oPro->delete();
|
||||
} else {
|
||||
throw (new Exception( "The row '$ProUid' in table Group doesn't exist!" ));
|
||||
@@ -320,10 +332,11 @@ class Department extends BaseDepartment
|
||||
}
|
||||
|
||||
public function updateDepartmentManager ($depId)
|
||||
{
|
||||
{
|
||||
$managerId = '';
|
||||
$depParent = '';
|
||||
$oDept = DepartmentPeer::retrieveByPk( $depId );
|
||||
|
||||
if (is_object( $oDept ) && get_class( $oDept ) == 'Department') {
|
||||
$managerId = $oDept->getDepManager();
|
||||
$depParent = $oDept->getDepParent();
|
||||
@@ -353,7 +366,12 @@ class Department extends BaseDepartment
|
||||
}
|
||||
$oUser->save();
|
||||
}
|
||||
|
||||
|
||||
if ($managerId) {
|
||||
$user = $oUser->loadDetailed ($managerId);
|
||||
$dptoTitle = $oDept->Load($depId);
|
||||
G::auditLog("AssignManagerToDepartament", "Assign Manager ".$user['USR_USERNAME']." (".$managerId.") to ".$dptoTitle['DEPO_TITLE']." (".$depId.") ");
|
||||
}
|
||||
// get children departments to update the reportsTo of these children
|
||||
$childrenCriteria = new Criteria( 'workflow' );
|
||||
$childrenCriteria->add( DepartmentPeer::DEP_PARENT, $depId );
|
||||
@@ -378,9 +396,13 @@ class Department extends BaseDepartment
|
||||
try {
|
||||
//update the field in user table
|
||||
$oUser = UsersPeer::retrieveByPk( $userId );
|
||||
$user = $oUser->loadDetailed ($userId);
|
||||
$dptoTitle = $this->Load($depId);
|
||||
|
||||
if (is_object( $oUser ) && get_class( $oUser ) == 'Users') {
|
||||
$oUser->setDepUid( $depId );
|
||||
$oUser->save();
|
||||
G::auditLog("AssignUsersToDepartament", "Assign user ".$user['USR_USERNAME']." (".$userId.") to departament ".$dptoTitle['DEPO_TITLE']." (".$depId.") ");
|
||||
}
|
||||
|
||||
//if the user is a manager update Department Table
|
||||
@@ -549,11 +571,16 @@ class Department extends BaseDepartment
|
||||
);
|
||||
try {
|
||||
$oUser = UsersPeer::retrieveByPk( $UsrUid );
|
||||
$user = $oUser->loadDetailed ($UsrUid);
|
||||
$dptoTitle = $this->Load($DepUid);
|
||||
|
||||
if (is_object( $oUser ) && get_class( $oUser ) == 'Users') {
|
||||
//$oDepto = new Users();
|
||||
$oUser->setDepUid( '' );
|
||||
$oUser->setUsrReportsTo( '' );
|
||||
$oUser->save();
|
||||
|
||||
G::auditLog("RemoveUsersFromDepartament", "Remove user ".$user['USR_USERNAME']."( ".$UsrUid.") from departament ".$dptoTitle['DEPO_TITLE']." (".$DepUid.") ");
|
||||
}
|
||||
} catch (exception $oError) {
|
||||
throw ($oError);
|
||||
|
||||
@@ -91,6 +91,15 @@ class GroupUser extends BaseGroupUser
|
||||
$oConnection->begin();
|
||||
$iResult = $oGroupUser->delete();
|
||||
$oConnection->commit();
|
||||
|
||||
$oGrpwf = new Groupwf();
|
||||
$grpName = $oGrpwf->loadByGroupUid($sGrpUid);
|
||||
|
||||
$oUsr = new Users();
|
||||
$usrName = $oUsr->load($sUserUid);
|
||||
|
||||
G::auditLog("AssignUsersToGroup", "Remove user ". $usrName['USR_USERNAME'] ." (".$sUserUid.") from group ".$grpName['CON_VALUE']." (".$sGrpUid.") ");
|
||||
|
||||
return $iResult;
|
||||
} else {
|
||||
throw (new Exception( 'This row doesn\'t exist!' ));
|
||||
|
||||
@@ -272,6 +272,26 @@ class Groupwf extends BaseGroupwf
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function loadByGroupUid ($UidGroup)
|
||||
{
|
||||
$c = new Criteria( 'workflow' );
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( ContentPeer::CON_VALUE );
|
||||
|
||||
$c->add( ContentPeer::CON_CATEGORY, 'GRP_TITLE' );
|
||||
$c->add( ContentPeer::CON_ID, $UidGroup );
|
||||
$c->add( ContentPeer::CON_LANG, SYS_LANG );
|
||||
|
||||
$dataset = ContentPeer::doSelectRS( $c );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$dataset->next();
|
||||
$row = $dataset->getRow();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function getAll ($start = null, $limit = null, $search = null)
|
||||
{
|
||||
$totalCount = 0;
|
||||
|
||||
@@ -301,6 +301,8 @@ class Language extends BaseLanguage
|
||||
$results->headers = $POHeaders;
|
||||
$results->errMsg = $errorMsg;
|
||||
|
||||
G::auditLog("UploadLanguage", $languageID);
|
||||
|
||||
return $results;
|
||||
} catch (Exception $oError) {
|
||||
throw ($oError);
|
||||
@@ -549,6 +551,7 @@ class Language extends BaseLanguage
|
||||
}
|
||||
} //end foreach
|
||||
}
|
||||
G::auditLog("ExportLanguage", $_GET['LOCALE']);
|
||||
G::streamFile( $sPOFile, true );
|
||||
}
|
||||
public function updateLanguagePlugin ($plugin, $idLanguage)
|
||||
|
||||
@@ -55,6 +55,22 @@ class ProcessCategory extends BaseProcessCategory
|
||||
return $aRow;
|
||||
}
|
||||
|
||||
public function loadByCategoryId($sCategoryUid)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn( ProcessCategoryPeer::CATEGORY_NAME);
|
||||
|
||||
$c->add(ProcessCategoryPeer::CATEGORY_UID, $sCategoryUid);
|
||||
$dataset = ProcessCategoryPeer::doSelectRS($c);
|
||||
$dataset->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
return $aRow['CATEGORY_NAME'];
|
||||
}
|
||||
|
||||
public function exists ($catUid)
|
||||
{
|
||||
$oProCat = ProcessCategoryPeer::retrieveByPk( $catUid );
|
||||
|
||||
@@ -454,6 +454,7 @@ class Translation extends BaseTranslation
|
||||
if (file_exists( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' )) {
|
||||
G::rm_dir( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' );
|
||||
}
|
||||
G::auditLog("DeleteLanguage", $locale);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user