function editSignItemsAction() { $eSigIds = Zend_Json::decode($this->_getParam('electronicSignatureIds')); if (strlen($eSigIds) <= 0) { $msg = __('No selected signature.'); throw new Exception($msg); } $eSigIds = explode(',', $eSigIds); $signature = $this->_getParam('signature'); foreach ($eSigIds as $eSigId) { if (strlen($eSigId) <= 0) { continue; } $esig = new ESignature(); $esig->eSignatureId = (int) $eSigId; $esig->populate(); $signedDate = date('Y-m-d H:i:s'); $esig->signedDateTime = $signedDate; $obj = new $esig->objectClass(); $obj->documentId = $esig->objectId; $obj->eSignatureId = $esig->eSignatureId; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; try { $esig->sign($obj, $signature); } catch (Exception $e) { $this->getResponse()->setHttpResponseCode(500); $json->direct(array('error' => $e->getMessage())); return; } $esig->persist(); $obj->populate(); $obj->eSignatureId = $esig->eSignatureId; $obj->persist(); } }
public function testInValidKey() { $signature = 'invalid_password'; $objects = array(); $clinicalNote = new ClinicalNote(); $clinicalNote->clinicalNoteDefinitionId = $this->_objects['noteDefinition']->clinicalNoteDefinitionId; $clinicalNote->personId = $this->_objects['person']->personId; $clinicalNote->persist(); $objects['clinicalNote'] = $clinicalNote; $eSig = new ESignature(); $eSig->signingUserId = $this->_objects['user']->personId; $eSig->objectClass = 'ClinicalNote'; $eSig->objectId = $clinicalNote->clinicalNoteId; $eSig->summary = 'Test, One #10026 - Transcription Note **Signed**'; $eSig->persist(); $objects['eSig'] = $eSig; $esig = new ESignature(); $esig->eSignatureId = (int) $eSig->eSignatureId; $esig->populate(); $signedDate = date('Y-m-d H:i:s'); $esig->signedDateTime = $signedDate; $obj = new $esig->objectClass(); $obj->documentId = $esig->objectId; $obj->eSignatureId = $esig->eSignatureId; try { $esig->sign($obj, $signature); $esig->persist(); $obj->populate(); $obj->eSignatureId = $esig->eSignatureId; $obj->persist(); } catch (Exception $e) { $this->assertTrue(true, $e->getMessage()); } $this->assertEquals($esig->signature, ''); $this->_cleanUpObjects($objects); }
function editSignItemsAction() { $eSigIds = Zend_Json::decode($this->_getParam('electronicSignatureIds')); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; if (strlen($eSigIds) <= 0) { $msg = __('No selected items to sign.'); WebVista::log($msg); $this->getResponse()->setHttpResponseCode(500); $json->direct(array('error' => $msg)); return; } $eSigIds = explode(',', $eSigIds); $signature = $this->_getParam('signature'); foreach ($eSigIds as $eSigId) { if (strlen($eSigId) <= 0) { continue; } $esig = new ESignature(); $esig->eSignatureId = (int) $eSigId; $esig->populate(); $objectClass = $esig->objectClass; if ($objectClass == 'Medication') { // check for possible eprescribed $medication = new Medication(); $medication->medicationId = (int) $esig->objectId; $medication->populate(); if ($medication->transmit == 'ePrescribe') { $result = $this->_checkCurrentLocation($medication); if ($result !== false) { $this->getResponse()->setHttpResponseCode(500); $json->direct(array('error' => $result)); return; } } } $signedDate = date('Y-m-d H:i:s'); $esig->signedDateTime = $signedDate; $obj = new $esig->objectClass(); $obj->documentId = $esig->objectId; $obj->eSignatureId = $esig->eSignatureId; try { $esig->sign($obj, $signature); } catch (Exception $e) { $this->getResponse()->setHttpResponseCode(500); $json->direct(array('error' => $e->getMessage())); return; } $esig->persist(); $obj->populate(); $obj->eSignatureId = $esig->eSignatureId; $obj->persist(); } }
/** * Attempts authentication of the signature * * @author KnowledgeTree Team * @access private * @param string $username The user's username * @param string $password The user's password * @param string $comment A comment on the action performed * @param string $action The action performed * @param string $details Details about the action performed * @return bool True if authenticated | False if rejected */ private function _authenticateSignature($username, $password, $comment, $action, $details) { $eSignature = new ESignature('api'); $result = $eSignature->sign($username, $password, $comment, $action, $details); if (!$result) { $this->esig_error = $eSignature->getError(); } return $result; }