Merged in bugfix/HOR-3279 (pull request #5688)

HOR-3279

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Ronald Henry Quenta Apaza
2017-05-31 20:02:28 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 17 additions and 6 deletions

View File

@@ -29,6 +29,18 @@ class Designer extends Controller
$client = $this->getClientCredentials();
if (isset($httpData->tracker_designer) && $httpData->tracker_designer == 1) {
try {
if (!isset($_SESSION['CASE']) && !isset($_SESSION['PIN'])) {
throw (new \Exception(
\G::LoadTranslation('ID_CASE_NOT_EXISTS') . "\n" . \G::LoadTranslation('ID_PIN_INVALID')
));
}
\ProcessMaker\BusinessModel\Light\Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']);
} catch (\Exception $e) {
Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], SYS_SYS, 'processmaker.log');
\G::header('Location: /errors/error403.php');
die();
}
$client["tracker_designer"] = 1;
}

View File

@@ -13,14 +13,14 @@ class Tracker
}
/**
* authenticaction for case tracker
* Authentication for case tracker
*
* @param $case numbre case
* @param $pin code pin access for case tracek
* @param int $case number case
* @param int $pin code pin access for case track
* @return array
* @throws \Exception
*/
public function authentication($case, $pin)
public static function authentication($case, $pin)
{
$cases = new \Cases();
$response = array();

View File

@@ -21,8 +21,7 @@ class Tracker extends Api
public function Authentication($case, $pin)
{
try {
$oMobile = new \ProcessMaker\BusinessModel\Light\Tracker();
$response = $oMobile->authentication($case, $pin);
$response = \ProcessMaker\BusinessModel\Light\Tracker::authentication($case, $pin);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}