Improvement fullName and labels - Audilog Kpi
This commit is contained in:
@@ -44,6 +44,9 @@ class Dashboard extends BaseDashboard
|
|||||||
$msg = 'Update ';
|
$msg = 'Update ';
|
||||||
$dashboard = DashboardPeer::retrieveByPK($data['DAS_UID']);
|
$dashboard = DashboardPeer::retrieveByPK($data['DAS_UID']);
|
||||||
}
|
}
|
||||||
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||||
|
$this->setUser($data['USR_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
G::LoadSystem('inputfilter');
|
G::LoadSystem('inputfilter');
|
||||||
$filter = new InputFilter();
|
$filter = new InputFilter();
|
||||||
@@ -89,6 +92,10 @@ class Dashboard extends BaseDashboard
|
|||||||
$criteria->add(DashboardIndicatorPeer::DAS_UID, $dasUid);
|
$criteria->add(DashboardIndicatorPeer::DAS_UID, $dasUid);
|
||||||
DashboardIndicatorPeer::doDelete($criteria);
|
DashboardIndicatorPeer::doDelete($criteria);
|
||||||
|
|
||||||
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||||
|
$this->setUser($data['USR_UID']);
|
||||||
|
}
|
||||||
|
|
||||||
$dashboard = DashboardPeer::retrieveByPK($dasUid);
|
$dashboard = DashboardPeer::retrieveByPK($dasUid);
|
||||||
if (!is_null($dashboard)) {
|
if (!is_null($dashboard)) {
|
||||||
$connection->begin();
|
$connection->begin();
|
||||||
@@ -96,7 +103,7 @@ class Dashboard extends BaseDashboard
|
|||||||
$result = $dashboard->delete();
|
$result = $dashboard->delete();
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
|
|
||||||
G::auditLog("Deletedashboard", "Dashboard Name: ". $dashboardData['DAS_TITLE']." Dashboard ID: (".$dasUid.") ");
|
G::auditLog("Delete", "Dashboard Name: ". $dashboardData['DAS_TITLE']." Dashboard ID: (".$dasUid.") ");
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
||||||
@@ -106,5 +113,12 @@ class Dashboard extends BaseDashboard
|
|||||||
throw $error;
|
throw $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser($usrId) {
|
||||||
|
$user = new Users ();
|
||||||
|
$user = $user->loadDetails($usrId);
|
||||||
|
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||||
|
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ class DashboardDasInd extends BaseDashboardDasInd
|
|||||||
$result = $dashboardDasInd->save();
|
$result = $dashboardDasInd->save();
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
|
|
||||||
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||||
|
$this->setUser($data['USR_UID']);
|
||||||
|
}
|
||||||
G::auditLog("Create", "Dashboard Owner: ". $data['OWNER_UID']." Dashboard ID: (".$dashboardDasInd->getDasUid().") ");
|
G::auditLog("Create", "Dashboard Owner: ". $data['OWNER_UID']." Dashboard ID: (".$dashboardDasInd->getDasUid().") ");
|
||||||
return $dashboardDasInd;
|
return $dashboardDasInd;
|
||||||
} else {
|
} else {
|
||||||
@@ -87,7 +90,7 @@ class DashboardDasInd extends BaseDashboardDasInd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove($dasUid, $owner)
|
public function remove($dasUid, $owner, $userLogged='')
|
||||||
{
|
{
|
||||||
$connection = Propel::getConnection(DashboardDasIndPeer::DATABASE_NAME);
|
$connection = Propel::getConnection(DashboardDasIndPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
@@ -97,7 +100,10 @@ class DashboardDasInd extends BaseDashboardDasInd
|
|||||||
$result = $dashboardDasInd->delete();
|
$result = $dashboardDasInd->delete();
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
|
|
||||||
G::auditLog("DeletedashboardIndicator", "Dashboard ID: ". $dasUid ." Dashboard owner ID: (".$owner.") ");
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && $userLogged != '') {
|
||||||
|
$this->setUser($userLogged);
|
||||||
|
}
|
||||||
|
G::auditLog("Delete", "Dashboard ID: ". $dasUid ." Dashboard owner ID: (".$owner.") ");
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
||||||
@@ -143,5 +149,12 @@ class DashboardDasInd extends BaseDashboardDasInd
|
|||||||
throw $error;
|
throw $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser($usrId) {
|
||||||
|
$user = new Users ();
|
||||||
|
$user = $user->loadDetails($usrId);
|
||||||
|
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||||
|
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,9 @@ class DashboardIndicator extends BaseDashboardIndicator
|
|||||||
$result = $dashboardIndicator->save();
|
$result = $dashboardIndicator->save();
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
|
|
||||||
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||||
|
$this->setUser($data['USR_UID']);
|
||||||
|
}
|
||||||
G::auditLog($msg, "Dashboard Indicator Name: ".$dashboardIndicator->getDasIndTitle()." Dashboard indicator ID: (".$dashboardIndicator->getDasIndUid() .") ");
|
G::auditLog($msg, "Dashboard Indicator Name: ".$dashboardIndicator->getDasIndTitle()." Dashboard indicator ID: (".$dashboardIndicator->getDasIndUid() .") ");
|
||||||
return $dashboardIndicator->getDasIndUid();
|
return $dashboardIndicator->getDasIndUid();
|
||||||
} else {
|
} else {
|
||||||
@@ -175,7 +178,7 @@ class DashboardIndicator extends BaseDashboardIndicator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove($dasIndUid)
|
public function remove($dasIndUid, $userLogged ='')
|
||||||
{
|
{
|
||||||
$connection = Propel::getConnection(DashboardIndicatorPeer::DATABASE_NAME);
|
$connection = Propel::getConnection(DashboardIndicatorPeer::DATABASE_NAME);
|
||||||
try {
|
try {
|
||||||
@@ -186,7 +189,10 @@ class DashboardIndicator extends BaseDashboardIndicator
|
|||||||
$result = $dashboardIndicator->delete();
|
$result = $dashboardIndicator->delete();
|
||||||
$connection->commit();
|
$connection->commit();
|
||||||
|
|
||||||
G::auditLog("DeletedashboardIndicator", "Dashboard Indicator Name: ". $dashboardIndicatorData['DAS_IND_TITLE']." Dashboard Instance ID: (".$dasIndUid.") ");
|
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && $userLogged != '') {
|
||||||
|
$this->setUser($userLogged);
|
||||||
|
}
|
||||||
|
G::auditLog("Delete", "Dashboard Indicator Name: ". $dashboardIndicatorData['DAS_IND_TITLE']." Dashboard Instance ID: (".$dasIndUid.") ");
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Error trying to delete: The row "' . $dasIndUid. '" does not exist.');
|
throw new Exception('Error trying to delete: The row "' . $dasIndUid. '" does not exist.');
|
||||||
@@ -196,5 +202,12 @@ class DashboardIndicator extends BaseDashboardIndicator
|
|||||||
throw $error;
|
throw $error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUser($usrId) {
|
||||||
|
$user = new Users ();
|
||||||
|
$user = $user->loadDetails($usrId);
|
||||||
|
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||||
|
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -327,15 +327,16 @@ class Dashboard {
|
|||||||
*
|
*
|
||||||
* @param string $das_uid
|
* @param string $das_uid
|
||||||
* @param string $owner_uid
|
* @param string $owner_uid
|
||||||
|
* * @param string $usr_uid
|
||||||
*
|
*
|
||||||
* return void
|
* return void
|
||||||
*
|
*
|
||||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||||
*/
|
*/
|
||||||
public function deleteDashboardOwner($das_uid, $owner_uid)
|
public function deleteDashboardOwner($das_uid, $owner_uid, $usr_uid)
|
||||||
{
|
{
|
||||||
$dashboard = new \DashboardDasInd();
|
$dashboard = new \DashboardDasInd();
|
||||||
$response = $dashboard->remove($das_uid, $owner_uid);
|
$response = $dashboard->remove($das_uid, $owner_uid, $usr_uid);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,15 +360,16 @@ class Dashboard {
|
|||||||
* Delete Indicator
|
* Delete Indicator
|
||||||
*
|
*
|
||||||
* @param string $das_ind_uid Unique id
|
* @param string $das_ind_uid Unique id
|
||||||
|
* @param string $usr_uid
|
||||||
*
|
*
|
||||||
* return void
|
* return void
|
||||||
*
|
*
|
||||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||||
*/
|
*/
|
||||||
public function delete($das_ind_uid)
|
public function delete($das_ind_uid, $usr_uid)
|
||||||
{
|
{
|
||||||
$dashboard = new \DashboardIndicator();
|
$dashboard = new \DashboardIndicator();
|
||||||
$response = $dashboard->remove($das_ind_uid);
|
$response = $dashboard->remove($das_ind_uid, $usr_uid);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->createDashboard($request_data);
|
$response = $dashboard->createDashboard($request_data);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -260,6 +261,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->createDashboard($request_data);
|
$response = $dashboard->createDashboard($request_data);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -279,6 +281,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->deletedashboard($das_uid);
|
$response = $dashboard->deletedashboard($das_uid);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -300,6 +303,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->createOwner($request_data);
|
$response = $dashboard->createOwner($request_data);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -320,7 +324,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
$response = $dashboard->deleteDashboardOwner($das_uid, $owner_uid);
|
$response = $dashboard->deleteDashboardOwner($das_uid, $owner_uid, $this->getUserId());
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
@@ -341,6 +345,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->createIndicator($request_data);
|
$response = $dashboard->createIndicator($request_data);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -363,6 +368,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
|
$request_data['USR_UID'] = $this->getUserId();
|
||||||
$response = $dashboard->createIndicator($request_data);
|
$response = $dashboard->createIndicator($request_data);
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -382,7 +388,7 @@ class Dashboard extends Api
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||||
$response = $dashboard->delete($ind_uid);
|
$response = $dashboard->delete($ind_uid, $this->getUserId());
|
||||||
return $response;
|
return $response;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
|||||||
Reference in New Issue
Block a user