Ejemplo n.º 1
0
function updateDatabase()
{
    global $labConfigId, $DB_HOST, $DB_USER, $DB_PASS;
    $country = strtolower(LabConfig::getUserCountry($labConfigId));
    $saved_db = DbUtil::switchToCountry($country);
    $currentDir = getcwd();
    $mainBlisDir = substr($currentDir, $length, strpos($currentDir, "htdocs"));
    //$blisLabBackupFilePath = "\"".$mainBlisDir.$backup_folder."\blis_".$lab_config_id."\blis_".$lab_config_id."_backup.sql\"";
    $sqlFilePath = "\"" . $mainBlisDir . "htdocs\\export\\temp.sql\"";
    $mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\"";
    $dbname = "blis_" . $country;
    $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$sqlFilePath}";
    $command = "C: &" . $command;
    //the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes
    echo $command;
    system($command, $return_var);
    if ($return_var == 0) {
        echo "true";
    } else {
        echo "false";
    }
    DbUtil::switchRestore($saved_db);
}
Ejemplo n.º 2
0
 public static function checkNameExists($name, $country)
 {
     # Checks if the given patient name (or similar match) already exists
     $saved_db = DbUtil::switchToCountry($country);
     $query_string = "SELECT COUNT(patient_id) AS val FROM patient WHERE name LIKE '%{$name}%'";
     $resultset = query_associative_one($query_string);
     DbUtil::switchRestore($saved_db);
     if ($resultset == null || $resultset['val'] == 0) {
         return false;
     } else {
         return true;
     }
 }
Ejemplo n.º 3
0
<?php

include "../includes/db_lib.php";
include "../includes/script_elems.php";
$patientId = $_REQUEST['pid'];
$type = $_REQUEST['type'];
$script_elems = new ScriptElems();
$script_elems->enableTableSorter();
$script_elems->enableJQueryForm();
if ($type == 'national') {
    $user = get_user_by_id($_SESSION['user_id']);
    $country = strtolower($user->country);
    $saved_db = DbUtil::switchToCountry($country);
    $patient = Patient::getById($patientId);
    DbUtil::switchRestore($saved_db);
    $lab_config = LabConfig::getById($_SESSION['lab_config_id']);
    ?>
	<table class='hor-minimalist-b' <?php 
    if ($width != "") {
        echo " style='width:" . $width . "px;' ";
    }
    ?>
>
		<tbody>
				<tr>
					<td><u><?php 
    echo LangUtil::$generalTerms['NAME'];
    ?>
</u></td>
					<td><?php 
    echo $patient->getName();