本文整理汇总了PHP中CRequest::addWhereClause方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::addWhereClause方法的具体用法?PHP CRequest::addWhereClause怎么用?PHP CRequest::addWhereClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRequest
的用法示例。
在下文中一共展示了CRequest::addWhereClause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countMatchingList
/**
* Size of the list of objects matching the $this properties
*
* @param array|string $group Group by SQL statement
* @param array $ljoin Left join SQL statement collection
* @param array|string $index Force index
*
* @return integer The count
*/
function countMatchingList($group = null, $ljoin = null, $index = null)
{
$request = new CRequest();
$request->addLJoin($ljoin);
$request->addGroup($group);
$request->addForceIndex($index);
$this->updatePlainFields();
$fields = $this->getPlainFields();
foreach ($fields as $key => $value) {
if ($value !== null) {
$request->addWhereClause($key, "= '{$value}'");
}
}
return $this->countList($request->where, $request->group, $request->ljoin, $request->forceindex);
}
示例2: explode
$filter->_notes = CValue::get("_notes", 0);
$filter->_nb_days = CValue::get("_nb_days", 0);
$filter->_by_date = CValue::get("_by_date", 0);
if ($filter->_nb_days) {
$filter->_date_max = CMbDT::date("+{$filter->_nb_days} days", CMbDT::date($filter->_date_min)) . " 21:00:00";
}
$filter->_service = explode(",", $filter->_service);
$filter->praticien_id = explode(",", $filter->praticien_id);
CMbArray::removeValue(0, $filter->praticien_id);
CMbArray::removeValue(0, $filter->_service);
$total = 0;
$sejours = new CSejour();
$sejourReq = new CRequest();
$sejourReq->addLJoinClause("patients", "patients.patient_id = sejour.patient_id");
$sejourReq->addLJoinClause("users", "users.user_id = sejour.praticien_id");
$sejourReq->addWhereClause("sejour.{$filter->_horodatage}", "BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'");
$sejourReq->addWhereClause("sejour.group_id", "= '{$group->_id}'");
$sejourReq->addWhereClause("sejour.annule", "= '0'");
// On supprime les sejours d'urgence
$sejourReq->addWhereClause("sejour.type", "!= 'urg'");
// Clause de filtre par spécialité / chir
if ($filter->_specialite or $filter->praticien_id) {
$speChirs = new CMediusers();
$speChirs = $speChirs->loadList(array("function_id" => "= '{$filter->_specialite}'"));
if (count($filter->praticien_id)) {
$sejourReq->addWhereClause("sejour.praticien_id", CSQLDataSource::prepareIn($filter->praticien_id));
} else {
$sejourReq->addWhereClause("sejour.praticien_id", CSQLDataSource::prepareIn(array_keys($speChirs)));
}
}
if ($filter->_filter_type) {
示例3: CRequest
$join["prescription"] = "prescription.prescription_id = prescription_line_element.prescription_id";
$where["prescription.type"] = "= 'sejour'";
$where["prescription.object_class"] = "= 'CSejour'";
$where["prescription.object_id"] = $ds->prepareIn($sejour_ids);
$line_ids = $line->loadIds($where, null, null, null, $join);
// Prescriptions exécutables
$query = new CRequest();
$query->addSelect("DISTINCT prescription_id");
$query->addTable("prescription_line_element");
$query->addWhereClause("prescription_line_element_id", $ds->prepareIn($line_ids));
$prescription_ids = $ds->loadColumn($query->makeSelect());
// Séjours planifiables
$query = new CRequest();
$query->addSelect("DISTINCT object_id");
$query->addTable("prescription");
$query->addWhereClause("prescription_id", $ds->prepareIn($prescription_ids));
$sejour_ids = $ds->loadColumn($query->makeSelect());
$where = array();
$where["sejour_id"] = $ds->prepareIn($sejour_ids);
$join = array();
$join["patients"] = "patients.patient_id = sejour.patient_id";
$order = "nom, prenom";
if ($mode == "count") {
$counts["plannable"] = $sejour->countList($where, null, $join);
} else {
$sejours = $sejour->loadList($where, $order, null, null, $join);
}
}
}
// Mode count
if ($mode == "count") {
示例4: CRHS
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage SSR
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkEdit();
// Liste des RHSs
$rhs = new CRHS();
$req = new CRequest();
$req->addTable("rhs");
$req->addLJoinClause("sejour", "sejour.sejour_id = rhs.sejour_id");
$req->addColumn("date_monday", "mondate");
$req->addColumn("COUNT(*)", "count");
$req->addWhereClause("rhs.facture", " = '0'");
$req->addWhereClause("sejour.annule", " = '0'");
$req->addGroup("date_monday");
$ds = $rhs->_spec->ds;
$rhs_counts = $ds->loadList($req->makeSelect());
foreach ($rhs_counts as &$_rhs_count) {
$_rhs_count["sundate"] = CMbDT::date("+6 DAYS", $_rhs_count["mondate"]);
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("rhs_counts", $rhs_counts);
$smarty->display("vw_facturation_rhs.tpl");
示例5: CMediusersStats
* @version $Revision$
*/
CCanDo::checkAdmin();
$type = CValue::get("type", "CEvenementSSR");
$date = CValue::get("date");
$period = CValue::get("period", "month");
$stats = new CMediusersStats($date, $period, "DATE(debut)", 18);
$consult = new CConsultation();
$ds = $consult->_spec->ds;
$group = CGroups::loadCurrent();
$query = new CRequest();
$query->addColumn("COUNT(*) total");
$query->addColumn("therapeute_id", "user_id");
$query->addColumn($stats->sql_date, "refdate");
$query->addWhere("{$stats->sql_date} BETWEEN '{$stats->min_date}' AND '{$stats->max_date}'");
$query->addWhereClause("functions_mediboard.group_id", "= '{$group->_id}'");
$query->addGroup("therapeute_id, refdate");
$query->addOrder("refdate DESC");
$totals = array();
switch ($type) {
case "CEvenementSSR":
$query->addTable("`evenement_ssr`");
$query->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
$query->addLJoinClause("users_mediboard", "users_mediboard.user_id = evenement_ssr.therapeute_id");
$query->addLJoinClause("functions_mediboard", "functions_mediboard.function_id = users_mediboard.function_id");
// Réalisés
$query1 = clone $query;
$query1->addWhereClause("evenement_ssr.realise", "= '1'");
foreach ($ds->loadList($query1->makeSelect()) as $_row) {
$stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"], "realises");
}
示例6: count
$query->addColumn("COUNT( plageop_id )", "plage_count");
$query->addColumn("date");
$query->addGroup("date");
$query->addColumn("debut");
$query->addGroup("debut");
$query->addColumn("fin");
$query->addGroup("fin");
$query->addColumn("chir_id");
$query->addGroup("chir_id");
$query->addColumn("spec_id");
$query->addGroup("spec_id");
$query->addColumn("plagesop.salle_id");
$query->addGroup("plagesop.salle_id");
$query->addLJoinClause("sallesbloc", "sallesbloc.salle_id = plagesop.salle_id");
$query->addLJoinClause("bloc_operatoire", "bloc_operatoire.bloc_operatoire_id = sallesbloc.bloc_id");
$query->addWhereClause("bloc_operatoire.group_id", "= '{$group->_id}'");
$query->addOrder("plagesop.date");
$query->addHaving("plage_count > 1");
$ds = $plage->_spec->ds;
$duplicates = $ds->loadColumn($query->makeSelect($plage));
$count = count($duplicates);
$success_count = 0;
$failures = array();
$i = $max;
if ($merge) {
foreach ($duplicates as $_plage_ids) {
if (!$i--) {
break;
}
$plage_ids = explode("-", $_plage_ids);
$plages = $plage->loadAll($plage_ids);
示例7: getPeriodicalStatsDetails
/**
* @see parent::getPeriodicalStatsDetails();
*/
function getPeriodicalStatsDetails($user_ids, $depth = 8)
{
$period_types = array("yearly" => array("format" => "%Y", "unit" => "YEAR"), "monthly" => array("format" => "%m/%Y", "unit" => "MONTH"), "weekly" => array("format" => "%Y S%U", "unit" => "WEEK"), "daily" => array("format" => "%d/%m", "unit" => "DAY"), "hourly" => array("format" => "%d %Hh", "unit" => "HOUR"));
$details = array();
$now = CMbDT::dateTime();
$doc = new self();
$ds = $doc->_spec->ds;
$deeper = $depth + 1;
foreach ($period_types as $_type => $_period_info) {
$format = $_period_info["format"];
$unit = $_period_info["unit"];
$request = new CRequest();
$request->addColumn("DATE_FORMAT(`file_date`, '{$format}')", "period");
$request->addColumn("COUNT(`file_id`)", "count");
$request->addColumn("SUM(`doc_size`)", "weight");
$date_min = CMbDT::dateTime("- {$deeper} {$unit}", $now);
$request->addWhereClause("file_date", " > '{$date_min}'");
if (count($user_ids)) {
$request->addWhereClause("author_id", CSQLDataSource::prepareIn($user_ids));
}
$request->addGroup("period");
$results = $ds->loadHashAssoc($request->makeSelect($doc));
foreach (range($depth, 0) as $i) {
$period = CMbDT::transform("-{$i} {$unit}", $now, $format);
$details[$_type][$period] = isset($results[$period]) ? $results[$period] : 0;
}
}
return $details;
}
示例8: graphOpAnnulees
/**
* Récuparation du graphique du nombre d'interventions annulées le jour même
*
* @param string $date_min Date de début
* @param string $date_max Date de fin
* @param int $prat_id Identifiant du praticien
* @param int $salle_id Identifiant de la salle
* @param int $bloc_id Identifiant du bloc
* @param string $code_ccam Code CCAM
* @param string $type_sejour Type de séjour
* @param bool $hors_plage Prise en charge des hors plage
*
* @return array
*/
function graphOpAnnulees($date_min = null, $date_max = null, $prat_id = null, $salle_id = null, $bloc_id = null, $code_ccam = null, $type_sejour = null, $hors_plage = false)
{
$miner = new COperationWorkflow();
$miner->warnUsage();
if (!$date_min) {
$date_min = CMbDT::date("-1 YEAR");
}
if (!$date_max) {
$date_max = CMbDT::date();
}
$date_min = CMbDT::format($date_min, "%Y-%m-01");
$date_max = CMbDT::transform("+1 MONTH", $date_max, "%Y-%m-01");
$prat = new CMediusers();
$prat->load($prat_id);
$serie_total = array('label' => 'Total', 'data' => array(), 'markers' => array('show' => true), 'bars' => array('show' => false));
$salles = CSalle::getSallesStats($salle_id, $bloc_id);
$query = new CRequest();
$query->addColumn("salle_id");
$query->addColumn("DATE_FORMAT(date_operation, '%Y-%m')", "mois");
$query->addColumn("COUNT(DISTINCT(operations.operation_id))", "total");
$query->addTable("operations");
$query->addLJoinClause("operation_workflow", "operation_workflow.operation_id = operations.operation_id");
$query->addWhere("DATE(date_cancellation) = DATE(date_operation)");
$query->addWhereClause("date_operation", "BETWEEN '{$date_min}' AND '{$date_max}'");
$query->addWhereClause("salle_id", CSQLDataSource::prepareIn(array_keys($salles)));
$query->addGroup("mois, salle_id");
$query->addOrder("mois, salle_id");
// Filtre sur hors plage
if (!$hors_plage) {
$query->addWhereClause("plageop_id", "IS NOT NULL");
}
// Filtre sur le praticien
if ($prat_id) {
$query->addWhereClause("operations.chir_id", "= '{$prat_id}'");
}
// Filtre sur les codes CCAM
if ($code_ccam) {
$query->addWhereClause("operations.codes_ccam", "LIKE '%{$code_ccam}%'");
}
// Filtre sur le type d'hospitalisation
if ($type_sejour) {
$query->addLJoinClause("sejour", "sejour.sejour_id = operations.sejour_id");
$query->addWhereClause("sejour.type", "= '{$type_sejour}'");
}
// Query result
$ds = CSQLDataSource::get("std");
$tree = $ds->loadTree($query->makeSelect());
// Build horizontal ticks
$months = array();
$ticks = array();
for ($_date = $date_min; $_date < $date_max; $_date = CMbDT::date("+1 MONTH", $_date)) {
$count_ticks = count($ticks);
$ticks[] = array($count_ticks, CMbDT::format($_date, "%m/%Y"));
$months[CMbDT::format($_date, "%Y-%m")] = $count_ticks;
$serie_total['data'][] = array(count($serie_total['data']), 0);
}
// Build series
$series = array();
$total = 0;
foreach ($salles as $_salle) {
$_serie = array("label" => utf8_encode($bloc_id ? $_salle->nom : $_salle->_view));
$data = array();
foreach ($months as $_month => $_tick) {
$value = isset($tree[$_salle->_id][$_month]) ? $tree[$_salle->_id][$_month] : 0;
$data[] = array($_tick, $value);
$serie_total["data"][$_tick][1] += $value;
$total += $value;
}
$_serie["data"] = $data;
$series[] = $_serie;
}
$series[] = $serie_total;
// Set up the title for the graph
$title = "Interventions annulées le jour même";
$subtitle = "{$total} interventions";
if ($prat_id) {
$subtitle .= " - Dr {$prat->_view}";
}
if ($salle_id) {
$salle = reset($salles);
$subtitle .= " - {$salle->_view}";
}
if ($code_ccam) {
$subtitle .= " - CCAM : {$code_ccam}";
}
if ($type_sejour) {
//.........这里部分代码省略.........
示例9: CRequest
* $Id$
*
* @category dPurgences
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
$nb_month = CValue::get("month_maintenance", "1");
$date = CMbDT::dateTime("-" . $nb_month . "MONTH");
$crequest = new CRequest();
$crequest->addSelect(array("`sejour`.`sejour_id`", "`sejour`.`sortie`"));
$crequest->addTable("`sejour`");
$crequest->addLJoinClause("rpu", "`sejour`.`sejour_id` = `rpu`.`sejour_id`");
$crequest->addWhereClause("sejour.entree", "> '{$date}'");
$crequest->addGroup(array("`sejour_id`"));
$crequest->addHaving(array("COUNT(`sejour`.`sejour_id`)>1"));
$sejour = new CSejour();
$ds = $sejour->getDS();
$list_id_sejour = $ds->loadList($crequest->makeSelect());
usort($list_id_sejour, function ($a, $b) {
return -strnatcmp($a["sortie"], $b["sortie"]);
});
$list_sejour = array();
$patients = array();
$guesses = array();
foreach ($list_id_sejour as $_id_sejour) {
$sejour = new CSejour();
$sejour->load($_id_sejour["sejour_id"]);
$sejour->loadBackRefs("rpu");
示例10: updateMontants
/**
* Mise à jour du montant du tarif
*
* @return integer|null
**/
function updateMontants()
{
if (!$this->_update_montants) {
return $this->secteur1;
}
$types_code = array("codes_ccam" => "CActeCCAM", "codes_ngap" => "CActeNGAP");
if (CModule::getActive("tarmed")) {
$types_code["codes_tarmed"] = "CActeTarmed";
$types_code["codes_caisse"] = "CActeCaisse";
}
$this->loadRefsFwd();
$this->completeField(array_keys($types_code));
if (!$this->codes_ngap && !$this->codes_ccam && !$this->codes_tarmed && !$this->codes_caisse) {
return $this->secteur1;
}
$this->secteur1 = 0.0;
$secteur2 = $this->secteur2;
foreach ($types_code as $codes => $class_acte) {
$_codes = "_" . $codes;
$this->{$_codes} = explode("|", $this->{$codes});
CMbArray::removeValue("", $this->{$_codes});
foreach ($this->{$_codes} as &$_code) {
/** @var CActe $acte */
$acte = new $class_acte();
if ($this->chir_id) {
$acte->executant_id = $this->chir_id;
} elseif ($this->function_id) {
/* Recupération de l'id du premier praticien de la fonction dont la spécialité est renseignée */
$ds = CSQLDataSource::get('std');
$query = new CRequest();
$query->addColumn('user_id');
$query->addTable('users_mediboard');
$query->addWhereClause('function_id', "= {$this->function_id}");
$query->addWhereClause('spec_cpam_id', 'IS NOT NULL');
$result = $ds->loadColumn($query->makeSelect(), 1);
if (!empty($result)) {
$acte->executant_id = $result[0];
}
}
$acte->setFullCode($_code);
$this->secteur1 += $acte->updateMontantBase();
// Affectation du secteur 2 au dépassement du premier acte principal trouvé
if ($secteur2) {
switch ($class_acte) {
case 'CActeNGAP':
if ($acte->lettre_cle) {
$acte->montant_depassement = $secteur2;
$secteur2 = 0;
}
break;
default:
$acte->montant_depassement = $secteur2;
$secteur2 = 0;
}
}
$_code = $acte->makeFullCode();
}
$this->{$codes} = implode("|", $this->{$_codes});
}
return $this->secteur1;
}
示例11: graphWorkflowOperation
/**
* Récuparation du graphique du nombre d'interventions annulées le jour même
*
* @param string $date_min Date de début
* @param string $date_max Date de fin
* @param int $prat_id Filtre du praticien
* @param int $salle_id Filtre de la salle
* @param int $bloc_id Filtre du bloc
* @param int $func_id Filtre sur un cabinet
* @param int $discipline_id Filtre sur une discipline
* @param string $code_ccam Code CCAM
* @param string $type_sejour Type de séjour
* @param bool $hors_plage Prise en charge des hors plage
*
* @return array
*/
function graphWorkflowOperation($date_min = null, $date_max = null, $prat_id = null, $salle_id = null, $bloc_id = null, $func_id = null, $discipline_id = null, $code_ccam = null, $type_sejour = null, $hors_plage = false)
{
$miner = new COperationWorkflow();
$miner->warnUsage();
if (!$date_min) {
$date_min = CMbDT::date("-1 YEAR");
}
if (!$date_max) {
$date_max = CMbDT::date();
}
$date_min = CMbDT::format($date_min, "%Y-%m-01");
$date_max = CMbDT::transform("+1 MONTH", $date_max, "%Y-%m-01");
// Series declarations
$labels = array("op_count" => utf8_encode("Nombre d'interventions"), "creation" => utf8_encode("Planification intervention"), "consult_chir" => utf8_encode("Consultation chirurgicale"), "consult_anesth" => utf8_encode("Consultation anesthésiste"), "visite_anesth" => utf8_encode("Visite anesthésiste"), "creation_consult_chir" => utf8_encode("RDV de consultation chirurgicale"), "creation_consult_anesth" => utf8_encode("RDV de consultation anesthésiste"));
$salles = CSalle::getSallesStats($salle_id, $bloc_id);
$query = new CRequest();
$query->addColumn("DATE_FORMAT(date_operation, '%Y-%m')", "mois");
$query->addColumn("COUNT(operations.operation_id)", "op_count");
// Prévention des données négatives aberrantes
$tolerance_in_days = 0;
$columns = array("creation", "consult_chir", "consult_anesth", "visite_anesth", "creation_consult_chir", "creation_consult_anesth");
foreach ($columns as $_column) {
$field = "date_{$_column}";
$diff = "DATEDIFF(ow.date_operation, ow.{$field})";
$query->addColumn("AVG (IF({$diff} > {$tolerance_in_days}, {$diff}, NULL))", $_column);
$query->addColumn("COUNT(IF({$diff} > {$tolerance_in_days}, {$diff}, NULL))", "count_{$_column}");
}
$query->addTable("operations");
$query->addLJoin("operation_workflow AS ow ON ow.operation_id = operations.operation_id");
$query->addWhereClause("date_operation", "BETWEEN '{$date_min}' AND '{$date_max}'");
$query->addWhereClause("salle_id", CSQLDataSource::prepareIn(array_keys($salles)));
$query->addGroup("mois");
$query->addOrder("mois");
$subtitle = "";
// Filtre sur hors plage
if (!$hors_plage) {
$query->addWhereClause("plageop_id", "IS NOT NULL");
$subtitle .= " - sans hors plage";
}
// Filtre sur le salle (pas besoin de clause supplémentaire)
if ($salle_id) {
$salle = reset($salles);
$subtitle .= " - {$salle->_view}";
}
// Filtre sur le praticien
if ($prat_id) {
$query->addWhereClause("operations.chir_id", "= '{$prat_id}'");
$prat = new CMediusers();
$prat->load($prat_id);
$subtitle .= " - Dr {$prat->_view}";
}
// Filtre sur le cabinet
if ($func_id) {
$query->addLJoinClause("users_mediboard", "operations.chir_id = users_mediboard.user_id");
$query->addWhereClause("users_mediboard.function_id", "= '{$func_id}'");
$func = new CFunctions();
$func->load($func_id);
$subtitle .= " - {$func->_view}";
}
// Filtre sur la discipline
if ($discipline_id) {
$discipline = new CDiscipline();
$discipline->load($discipline_id);
$query->addLJoinClause("users_mediboard", "operations.chir_id = users_mediboard.user_id");
$query->addWhereClause("users_mediboard.discipline_id", "= '{$discipline_id}'");
$subtitle .= " - {$discipline->_view}";
}
// Filtre sur les codes CCAM
if ($code_ccam) {
$query->addWhereClause("operations.codes_ccam", "LIKE '%{$code_ccam}%'");
$subtitle .= " - CCAM: {$code_ccam}";
}
// Filtre sur le type d'hospitalisation
if ($type_sejour) {
$query->addLJoinClause("sejour", "sejour.sejour_id = operations.sejour_id");
$query->addWhereClause("sejour.type", "= '{$type_sejour}'");
$subtitle .= " - " . CAppUI::tr("CSejour.type.{$type_sejour}");
}
// Query result
$ds = CSQLDataSource::get("std");
$all_values = $ds->loadHashAssoc($query->makeSelect());
// Build horizontal ticks
$months = array();
$ticks = array();
//.........这里部分代码省略.........
示例12: CRequest
/**
* $Id$
*
* @package Mediboard
* @subpackage PlanningOp
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkAdmin();
// Tous les libelllés
$query = new CRequest();
$query->addTable("sejour");
$query->addColumn("COUNT(libelle)", "libelle_count");
$query->addColumn("libelle");
$query->addWhereClause("type", "= 'ssr'");
$query->addOrder("libelle_count DESC");
$query->addGroup("libelle");
$sejour = new CSejour();
$ds = $sejour->_spec->ds;
$libelle_counts = array();
foreach ($ds->loadList($query->makeSelect()) as $row) {
$libelle_counts[$row["libelle"]] = $row["libelle_count"];
}
unset($libelle_counts[""]);
// Libellés disponibles
$colors = CColorLibelleSejour::loadAllFor(array_keys($libelle_counts));
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("libelle_counts", $libelle_counts);
$smarty->assign("colors", $colors);
示例13: CSejour
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
CCanDo::checkAdmin();
global $dPconfig;
$dPconfig["sa"]["trigger_sejour"] = "facture";
$limit = CValue::get("limit", 10);
$day = CValue::get("day", 3);
$sejour = new CSejour();
$ds = $sejour->getDS();
$request = new CRequest();
$request->addSelect("sejour.sejour_id");
$request->addTable("sejour");
$request->addLJoinClause("rpu", "rpu.sejour_id = sejour.sejour_id");
$request->addWhereClause("annule", "!='1'");
$request->addWhereClause("facture", "!='1'");
$request->addWhereClause("sortie_reelle", "BETWEEN '" . CMbDT::dateTime("-{$day}DAY") . "' AND '" . CMbDT::dateTime() . "'");
$request->addWhereClause("rpu.sejour_id", "IS NOT NULL");
$request->addGroup("sejour.sejour_id");
$request->addHaving("count(*) = 1");
$request->setLimit($limit);
$list_sejour = $ds->loadList($request->makeSelect());
foreach ($list_sejour as $_sejour_id) {
$sejour = new CSejour();
$sejour->load($_sejour_id["sejour_id"]);
if (!($nda = $sejour->getTagNDA())) {
continue;
}
$rpu = $sejour->loadRefRPU();
if ($rpu->mutation_sejour_id) {
示例14: foreach
$_table_info = $class_to_table[$_object_class];
$_table = $_table_info["table"];
$_key = $_table_info["key"];
foreach ($inserts as $_insert) {
/** @var callable $callback */
list($object_class, $type, $fields, $callback) = $_insert;
if ($fields === $_fields && $object_class === $_object_class && $type === $_type) {
$_query = $callback($ds, $_row);
$ds->exec($_query);
$counts["insert"] += $ds->affectedRows();
}
}
}
// Delete user logs entries
$request = new CRequest();
$request->addWhereClause("user_log_id", "BETWEEN {$min} AND {$max}");
$request->addForceIndex("PRIMARY");
$request->addWhere($where);
$query = $request->makeDelete($log);
$ds->exec($query);
$counts["insert"] = $ds->affectedRows();
} else {
$query = $request->makeSelectCount($log);
$counts["insert"] = $ds->loadResult($query);
}
//</editor-fold>
$offset = $max + 1;
// Stop auto if end is reached
$log->loadMatchingObject("user_log_id DESC");
if ($log->_id < $offset) {
$auto = 0;
示例15: CRequest
* @package Mediboard
* @subpackage SSR
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkEdit();
$date = CValue::getOrSession("date", CMbDT::date());
$date_min = CMbDT::date("last monday", CMbDT::date("+1 day", $date));
$date_max = CMbDT::date("+7 DAY", $date_min);
// Comptage des événements hors-séjours
$group = "sejour.sejour_id";
$query = new CRequest();
$query->addTable("evenement_ssr");
$query->addColumn("COUNT(evenement_ssr_id)", "evenements_count");
$query->addWhereClause("debut", "BETWEEN '{$date_min}' AND '{$date_max}'");
$query->addWhereClause("type", "= 'ssr'");
$query->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
$query->addColumn("sejour.sejour_id");
$query->addWhereClause(null, "debut NOT BETWEEN DATE(entree) AND DATE(ADDDATE(sortie, 1))");
$query->addWhereClause("sejour.annule", "!= '1'");
$query->addGroup("sejour.sejour_id");
$sejour = new CSejour();
$ds = $sejour->_spec->ds;
$evenements_counts = array();
foreach ($ds->loadList($query->makeSelect()) as $row) {
$evenements_counts[$row["sejour_id"]] = $row["evenements_count"];
}
// Chargement des séjours concernés
/** @var CSejour[] $sejours */
$sejours = $sejour->loadAll(array_keys($evenements_counts));