Esempio n. 1
0
 * @subpackage dPpatients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GPLv2
 * @version    $Revision: 4983 $
 */
CCanDo::checkAdmin();
ini_set("auto_detect_line_endings", true);
global $dPconfig;
$dPconfig["object_handlers"] = array();
CAppUI::stepAjax("Désactivation du gestionnaire", UI_MSG_OK);
$start = CValue::post("start");
$count = CValue::post("count");
$callback = CValue::post("callback");
$date = CMbDT::date();
CApp::setTimeLimit(600);
CApp::setMemoryLimit("512M");
CMbObject::$useObjectCache = false;
$file_import = fopen(CAppUI::conf("root_dir") . "/tmp/rapport_import_patient_{$date}.txt", "a");
importFile(CAppUI::conf("dPpatients imports pat_csv_path"), $start, $count, $file_import);
fclose($file_import);
$start += $count;
file_put_contents(CAppUI::conf("root_dir") . "/tmp/import_patient.txt", "{$start};{$count}");
if ($callback) {
    CAppUI::js("{$callback}({$start},{$count})");
}
echo "<tr><td colspan=\"2\">MEMORY: " . memory_get_peak_usage(true) / (1024 * 1024) . " MB" . "</td>";
CMbObject::$useObjectCache = true;
CApp::rip();
/**
 * import the patient file
 *
<?php

/**
 * $Id: offline_prescriptions_multipart.php 27852 2015-04-03 09:55:15Z alexis_granger $
 *
 * @package    Mediboard
 * @subpackage Soins
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 27852 $
 */
ob_clean();
CApp::setMemoryLimit("1024M");
CApp::setTimeLimit(240);
$service_id = CValue::get("service_id");
$date = CValue::get("date", CMbDT::date());
$service = new CService();
$service->load($service_id);
$datetime_min = "{$date} 00:00:00";
$datetime_max = "{$date} 23:59:59";
$datetime_avg = "{$date} " . CMbDT::time();
$sejour = new CSejour();
$where = array();
$ljoin = array();
$ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
$where["sejour.entree"] = "<= '{$datetime_max}'";
$where["sejour.sortie"] = " >= '{$datetime_min}'";
$where["affectation.entree"] = "<= '{$datetime_max}'";
$where["affectation.sortie"] = ">= '{$datetime_min}'";
$where["affectation.service_id"] = " = '{$service_id}'";
/** @var CSejour[] $sejours */
<?php

/**
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CApp::setMemoryLimit("768M");
$where = array();
$ljoin = array();
$user_id = CValue::get("user_id");
$classes_atc = CValue::get("classes_atc");
$keywords_atc = CValue::get("keywords_atc");
$code_cis = CValue::get("code_cis");
$code_ucd = CValue::get("code_ucd");
$libelle_produit = CValue::get("libelle_produit");
$keywords_composant = CValue::get("keywords_composant");
$composant = CValue::get("composant");
$keywords_indication = CValue::get("keywords_indication");
$indication = CValue::get("indication");
$type_indication = CValue::get("type_indication");
$commentaire = CValue::get("commentaire");
$section = CValue::get("section_choose");
$export = CValue::get("export", 0);
CValue::setSession("produit", CValue::get("produit"));
CValue::setSession("user_id", $user_id);
CValue::setSession("classes_atc", $classes_atc);
Esempio n. 4
0
<?php

/**
 * $Id: export_ex_objects.php 28665 2015-06-22 10:33:47Z phenxdesign $
 *
 * @category Forms
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 28665 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
CStoredObject::$useObjectCache = false;
CApp::setMemoryLimit(1024);
CApp::setTimeLimit(600);
$ex_class_id = CValue::get("ex_class_id");
$concept_search = CValue::get("concept_search");
$date_min = CValue::get("date_min");
$date_max = CValue::get("date_max");
$group_id = CValue::get("group_id");
$limit = 10000;
$group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id;
$where = array("group_id = '{$group_id}' OR group_id IS NULL");
$ex_class = new CExClass();
$ex_class->load($ex_class_id);
foreach ($ex_class->loadRefsGroups() as $_group) {
    $_group->loadRefsFields();
    foreach ($_group->_ref_fields as $_field) {
        $_field->updateTranslation();
    }
 /**
  * Embed all the external resources of the current output buffer inside a single file and outputs it.
  *
  * @param string $path Path to save the files to
  * 
  * @return void|string
  */
 private static function allInOne($path = null, $options = array())
 {
     if ($path) {
         self::$_path = rtrim($path, "/\\") . "/";
     }
     CApp::setMemoryLimit("256M");
     self::$_fp_out = CMbPath::getTempFile();
     $re_img = "/<img([^>]*)src\\s*=\\s*[\"']([^\"']+)[\"']([^>]*)(>|\$)/i";
     $re_link = "/<link[^>]*rel=\"stylesheet\"[^>]*href\\s*=\\s*[\"']([^\"']+)[\"'][^>]*>/i";
     $re_script = "/<script[^>]*src\\s*=\\s*[\"']([^\"']+)[\"'][^>]*>\\s*<\\/script>/i";
     $re_a = "/<a([^>]*)href\\s*=\\s*[\"']embed:([^\"']+)[\"']([^>]*)>/i";
     $ignore_scripts = !empty($options["ignore_scripts"]);
     // End Output Buffering
     ob_end_clean();
     ob_start();
     rewind(self::$_fp_in);
     while (!feof(self::$_fp_in)) {
         $line = fgets(self::$_fp_in);
         $line = preg_replace_callback($re_img, array('self', 'replaceImgSrc'), $line);
         $line = preg_replace_callback($re_link, array('self', 'replaceStylesheet'), $line);
         if (!$ignore_scripts) {
             $line = preg_replace_callback($re_script, array('self', 'replaceScriptSrc'), $line);
         }
         if (self::$_path) {
             $line = preg_replace_callback($re_a, array('self', 'replaceAEmbed'), $line);
         }
         fwrite(self::$_fp_out, $line);
     }
     ob_end_clean();
     $length = 0;
     rewind(self::$_fp_out);
     $full_str = "";
     while (!feof(self::$_fp_out)) {
         $line = fgets(self::$_fp_out);
         $length += strlen($line);
         $line = str_replace("[[AIO-length]]", CMbString::toDecaBinary($length), $line);
         if (strpos($line, "[[AIO-memory]]") !== false) {
             $line = str_replace("[[AIO-memory]]", self::getOutputMemory(true), $line);
         }
         if ($path) {
             $full_str .= $line;
         } else {
             echo $line;
         }
     }
     return $full_str;
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage developpement
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
CApp::setMemoryLimit("256M");
// Checking out the result
$class = CValue::get("class");
$show = CValue::get("show", "errors");
$classes = CApp::getMbClasses();
$classes[] = "CMbObject";
// Looking for what is actually coded
$present = array();
foreach ($classes as $_class) {
    /** @var CMbObject $object */
    $object = new $_class();
    $object->makeAllBackSpecs();
    foreach ($object->_backSpecs as $backName => $backSpec) {
        if (!$backSpec->isInherited()) {
            $parts = explode(" ", $object->_backProps[$backName]);
            $present[$_class]["{$parts['0']} {$parts['1']}"] = $backName;
        }
    }
}
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$ratio = (double) CValue::get("ratio", 2);
CApp::setMemoryLimit('512M');
CApp::setTimeLimit(120);
$sql = new CRequest();
$sql->addTable("product_order_item");
$sql->addSelect("\r\n  product_order_item.order_item_id,\r\n  product_order_item.reference_id, \r\n  product_reference.price AS RP, \r\n  product_order_item.unit_price AS OP, \r\n  product_order_item.quantity AS OQ, \r\n  product_order.order_id, \r\n  product_order.order_number, \r\n  product_order.date_ordered");
$sql->addLJoin(array("product_reference" => "product_reference.reference_id = product_order_item.reference_id", "product_order" => "product_order.order_id = product_order_item.order_id"));
$sql->addWhere("\r\n  product_order.cancelled = '0' \r\n  AND (product_reference.cancelled = '0' OR product_reference.cancelled IS NULL)\r\n  AND product_reference.price != product_order_item.unit_price\r\n  AND (\r\n    product_order_item.unit_price > product_reference.price*{$ratio} OR \r\n    product_reference.price > product_order_item.unit_price*{$ratio}\r\n  )");
$sql->addOrder("product_reference.code");
$changes = $this->_spec->ds->loadList($sql->makeSelect());
$changes_struct = array();
$references = array();
$references_cahpp = array();
foreach ($changes as $_change) {
    if (!isset($references[$_change["reference_id"]])) {
        $_reference = new CProductReference();
        $_reference->load($_change["reference_id"]);
        $references[$_reference->_id] = $_reference;
        $article = new CCAHPPArticle();
<?php

/**
 * Vue offline des séjours
 *
 * @category soins
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CApp::setMemoryLimit("1200M");
CApp::setTimeLimit(240);
$service_id = CValue::get("service_id");
$date = CValue::get("date", CMbDT::date());
$embed = CValue::get("embed");
CView::enableSlave();
$service = new CService();
$service->load($service_id);
$datetime_min = "{$date} 00:00:00";
$datetime_max = "{$date} 23:59:59";
$datetime_avg = "{$date} " . CMbDT::time();
$group = CGroups::loadCurrent();
$sejour = new CSejour();
$where = array();
$ljoin = array();
$ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
$where["sejour.entree"] = "<= '{$datetime_max}'";
$where["sejour.sortie"] = " >= '{$datetime_min}'";
if ($service_id == "NP") {
Esempio n. 9
0
/**
 * Set memory limit alternative with a minimal value approach
 * Shoud *always* be used
 *
 * @param string $limit Memory limit with ini_set() syntax
 *
 * @return string The old value on success, false on failure
 * @TODO : DELETE if not called anymore (check for all modules)
 */
function set_min_memory_limit($limit)
{
    return CApp::setMemoryLimit($limit);
}