示例#1
0
 public function MoveEmrAttachments($patientFrom, $patientTo, $attachments)
 {
     // Go through all records, make changes
     if (!is_array($attachments)) {
         return false;
     }
     $success = true;
     foreach ($attachments as $attachment) {
         // Resolve original id and table
         $resolve = $GLOBALS['sql']->queryRow("SELECT m.module_table AS 'table', m.module_class AS 'class', p.oid AS oid FROM patient_emr p LEFT OUTER JOIN modules m ON m.module_table = p.module WHERE p.patient = " . $GLOBALS['sql']->quote($patient) . " AND p.id = " . (int) $patientFrom);
         // Get patient field from meta data
         $patient_field = freemed::module_get_meta($resolve['class'], 'patient_field');
         // Move actual record
         $result = $GLOBALS['sql']->query("UPDATE " . $resolve['table'] . " SET {$patient_field} = " . $GLOBALS['sql']->quote((int) $patientTo) . " WHERE id = " . $GLOBALS['sql']->quote((int) $resolve['oid']));
         $success &= (bool) $result;
         // Move any annotations, if they exist
         $result = $GLOBALS['sql']->query("UPDATE annotations SET apatient = " . $GLOBALS['sql']->quote((int) $patientTo) . " WHERE apatient = " . $GLOBALS['sql']->quote((int) $patientFrom) . " AND atable = " . $GLOBALS['sql']->quote($resolve['table']) . " AND aid = " . $GLOBALS['sql']->quote((int) $resolve['oid']));
         $success &= (bool) $result;
         // Anything additional
         module_function($resolve['class'], 'additional_move', array($resolve['oid'], $patientFrom, $patientTo));
     }
     return $success;
 }
示例#2
0
文件: API.php 项目: rrsc/freemed
 public static function module_check_acl($module, $permission = '')
 {
     // Get meta value for acl
     $m_acl = freemed::module_get_meta($module, 'acl');
     if (!is_array($m_acl)) {
         // By default if there are no restrictions, allow
         return true;
     } else {
         // Check each individual ACL specified, if any work, ok
         foreach ($m_acl as $__grbge => $v) {
             if (!$permission) {
                 switch ($v) {
                     case 'bill':
                         $p = 'menu';
                         break;
                     default:
                         $p = 'view';
                         break;
                 }
             } else {
                 $p = $permission;
             }
             if (freemed::acl($v, $p)) {
                 return true;
             }
         }
         // end foreach m_acl
         // If nothing passes, we fail
         return false;
     }
     // end if not array
 }