Skip to content
Snippets Groups Projects
Commit 3ed5af04 authored by Florian Azizian's avatar Florian Azizian
Browse files

FIX #5596 rm call to mlb_coll_ext + use sub_entities in get_entity_vol

parent 4c4f7dff
No related branches found
No related tags found
No related merge requests found
<?php
/*
* Copyright 2008,20015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Maarch Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
* @brief get_entity_vol
* @author dev <dev@maarch.org>
* @ingroup entities
*/
require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php");
......@@ -31,9 +22,9 @@ $_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
$graph = new graphics();
$req = new request();
$db = new Database();
$sec = new security();
$req = new request();
$db = new Database();
$sec = new security();
$entities_chosen = explode("#", $_POST['entities_chosen']);
if($_REQUEST['sub_entities'] == 'true'){
......
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
......@@ -15,16 +16,29 @@ require_once "core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_manag
require_once "apps".DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_list_show.php";
require_once 'modules'.DIRECTORY_SEPARATOR.'reports'.DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_graphics.php";
require_once 'modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'entities_tables.php';
require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_users_entities_Abstract.php');
$_ENV['date_pattern'] = "/^[0-3][0-9]-[0-1][0-9]-[1-2][0-9][0-9][0-9]$/";
$graph = new graphics();
$req = new request();
$db = new Database();
$sec = new security();
$req = new request();
$db = new Database();
$sec = new security();
$entities_chosen = explode("#", $_POST['entities_chosen']);
if($_REQUEST['sub_entities'] == 'true'){
$sub_entities = [];
foreach($entities_chosen as $value){
$sub_entities[] = users_entities_Abstract::getEntityChildren($value);
}
$sub_entities1 = "'";
for( $i=0; $i< count($sub_entities ); $i++){
$sub_entities1 .= implode("','",$sub_entities[$i]);
$sub_entities1 .= "','";
}
$sub_entities1 = substr($sub_entities1, 0, -2);
}
$entities_chosen = "'" . join("','", $entities_chosen) . "'";
$status_chosen = '';
......@@ -66,6 +80,8 @@ $str_status = preg_replace('/,$/', ')', $str_status);
//Récupération de l'ensemble des types de documents
if (!$_REQUEST['entities_chosen']) {
$stmt = $db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' order by short_label");
}elseif($_REQUEST['sub_entities'] == 'true'){
$stmt = $db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' and entity_id IN (".$entities_chosen.") or entity_id IN (".$sub_entities1.") order by short_label");
} else {
$stmt = $db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' and entity_id IN (".$entities_chosen.") order by short_label",array());
}
......@@ -215,7 +231,7 @@ $totalCourrier=array();
$totalEntities = count($entities);
for ($i=0; $i<$totalEntities;$i++) {
$stmt = $db->query("select count(*) as total from ".$view." inner join mlb_coll_ext on ".$view.".res_id = mlb_coll_ext.res_id where destination = ? and ".$view.".status not in ('DEL','BAD') ".$where_date." ".$where_status." ".$where_priority . $where_clause." ", array($entities[$i]['ID']));
$stmt = $db->query("select count(*) as total from ".$view." where destination = ? and ".$view.".status not in ('DEL','BAD') ".$where_date." ".$where_status." ".$where_priority . $where_clause." ", array($entities[$i]['ID']));
//$db->show();
$res = $stmt->fetchObject();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment