[opendebitdeboisson-commits] r373 - in branches/2.1.0-develop: . app obj sql/pgsql tests tests/data/pgsql

0 views
Skip to first unread message

sof...@adullact.net

unread,
Jul 10, 2019, 1:15:44 PM7/10/19
to openmairie-ope...@googlegroups.com
Author: softime
Date: 2019-07-10 19:15:42 +0200 (Wed, 10 Jul 2019)
New Revision: 373

Added:
branches/2.1.0-develop/app/widget_statistiques_licences_par_type_filtre.php
branches/2.1.0-develop/sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php
Modified:
branches/2.1.0-develop/HISTORY.txt
branches/2.1.0-develop/obj/demande_licence.class.php
branches/2.1.0-develop/tests/410_import_export.robot
branches/2.1.0-develop/tests/data/pgsql/install_tests.sql
branches/2.1.0-develop/tests/documentation.robot
Log:
* Ajout d'un widget de statistique affichant le nombre de licences par type filtr?\195?\169 par date de fin de validit?\195?\169 et sans les demandes de transfert. Ticket #9256.


Modified: branches/2.1.0-develop/HISTORY.txt
===================================================================
--- branches/2.1.0-develop/HISTORY.txt 2019-07-10 15:50:13 UTC (rev 372)
+++ branches/2.1.0-develop/HISTORY.txt 2019-07-10 17:15:42 UTC (rev 373)
@@ -6,7 +6,9 @@

* Évolution : Ajout d'une requête mémorisée listant les demandes de licence avec toutes les informations de l'établissement lié. Ticket #9255.

+* Évolution : Ajout d'un widget de statistique affichant le nombre de licences par type filtré par date de fin de validité et sans les demandes de transfert. Ticket #9256.

+
2.0.0 (07/01/2019)
------------------


Added: branches/2.1.0-develop/app/widget_statistiques_licences_par_type_filtre.php
===================================================================
--- branches/2.1.0-develop/app/widget_statistiques_licences_par_type_filtre.php (rev 0)
+++ branches/2.1.0-develop/app/widget_statistiques_licences_par_type_filtre.php 2019-07-10 17:15:42 UTC (rev 373)
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Ce script permet d'interfacer le widget de tableau de bord 'stats'.
+ *
+ * @package opendebitdeboisson
+ * @version SVN : $Id$
+ */
+
+require_once "../obj/opendebitdeboisson.class.php";
+if (isset($f) !== true) {
+ $f = new opendebitdeboisson("nohtml");
+}
+
+$inst_util__demande_licence = $f->get_inst__om_dbform(array(
+ "obj" => "demande_licence",
+));
+$inst_util__demande_licence->view_widget_statistiques_licences_par_type_filtre();


Property changes on: branches/2.1.0-develop/app/widget_statistiques_licences_par_type_filtre.php
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Modified: branches/2.1.0-develop/obj/demande_licence.class.php
===================================================================
--- branches/2.1.0-develop/obj/demande_licence.class.php 2019-07-10 15:50:13 UTC (rev 372)
+++ branches/2.1.0-develop/obj/demande_licence.class.php 2019-07-10 17:15:42 UTC (rev 373)
@@ -854,10 +854,10 @@
}
}
};
- window.onload = function() {
+ window.addEventListener("load", function() {
var ctx = document.getElementById("chart-area").getContext("2d");
window.myPie = new Chart(ctx, config);
- };
+ });
</script>
<div id="canvas-holder" style="width:100%%">
<canvas id="chart-area"></canvas>
@@ -869,4 +869,99 @@
$labels
);
}
+
+ /**
+ *
+ */
+ function view_widget_statistiques_licences_par_type_filtre() {
+ //
+ include "../sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php";
+ $query = $reqmo["sql"];
+ $res = $this->f->db->query($query);
+ $this->f->addToLog(__METHOD__."(): db->query(\"".$query."\");", VERBOSE_MODE);
+ $this->f->isDatabaseError($res);
+ //
+ $results = array();
+ while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) {
+ $results[] = $row;
+ }
+ //
+ $data = array();
+ foreach ($results as $key => $value) {
+ $data[$key] = $value["nombre_licence"];
+ }
+ $data = implode(",", $data);
+ //
+ $labels = array();
+ foreach ($results as $key => $value) {
+ $labels[$key] = "\"".$value["type_licence"]."\"";
+ }
+ $labels = implode(",", $labels);
+ //
+ printf(
+ '
+ <h4>Nombre de licences par type filtré par la date de fin de validité et sans les demandes de transfert</h4>
+ <style>
+ #canvas2-holder{
+ width: 100%% !important;
+ min-width: 300px;
+ height: auto !important;
+ }
+ </style>
+ <script type="text/javascript">
+ window.chartColors = {
+ red: "rgb(255, 99, 132)",
+ orange: "rgb(255, 159, 64)",
+ yellow: "rgb(255, 205, 86)",
+ green: "rgb(75, 192, 192)",
+ blue: "rgb(54, 162, 235)",
+ purple: "rgb(153, 102, 255)",
+ grey: "rgb(201, 203, 207)"
+ };
+ var randomScalingFactor = function() {
+ return Math.round(Math.random() * 100);
+ };
+ var config2 = {
+ type: "pie",
+ data: {
+ datasets: [{
+ data: [%1$s],
+ backgroundColor: [%2$s
+ window.chartColors.red,
+ window.chartColors.orange,
+ window.chartColors.yellow,
+ window.chartColors.green,
+ window.chartColors.blue,
+ window.chartColors.purple,
+ window.chartColors.grey,
+ ],
+ label: "Dataset 1"
+ }],
+ labels: [%3$s]
+ },
+ options: {
+ responsive: true,
+ animation: {
+ animateRotate: false
+ },
+ legend: {
+ position: "right"
+ }
+ }
+ };
+ window.addEventListener("load", function() {
+ var ctx2 = document.getElementById("chart2-area").getContext("2d");
+ window.myPie2 = new Chart(ctx2, config2);
+ });
+ </script>
+ <div id="canvas2-holder" style="width:100%%">
+ <canvas id="chart2-area"></canvas>
+ </div>
+ <a href="../app/index.php?module=reqmo&obj=statistiques_licences_par_type_filtre" title="Export CSV"><span class="om-icon om-icon-25 csv-25">Export CSV</span></a>
+ ',
+ $data,
+ "",
+ $labels
+ );
+ }
}

Added: branches/2.1.0-develop/sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php
===================================================================
--- branches/2.1.0-develop/sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php (rev 0)
+++ branches/2.1.0-develop/sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php 2019-07-10 17:15:42 UTC (rev 373)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * ...
+ *
+ * @package opendebitdeboisson
+ * @version SVN : $Id$
+ */
+
+//
+$reqmo["sql"] = sprintf(
+ 'SELECT
+ type_licence.libelle as type_licence,
+ COUNT(*) as nombre_licence
+ FROM
+ %1$sdemande_licence
+ INNER JOIN %1$setablissement
+ ON demande_licence.etablissement = etablissement.etablissement
+ LEFT JOIN %1$stype_licence
+ ON demande_licence.type_licence = type_licence.type_licence
+ INNER JOIN %1$sterme
+ ON demande_licence.terme = terme.terme
+ INNER JOIN %1$stype_demande
+ ON demande_licence.type_demande = type_demande.type_demande
+ WHERE
+ LOWER(terme.code) = \'perm\'
+ AND LOWER(type_demande.code) != \'trs\'
+ AND demande_licence.date_fin_validite > CURRENT_DATE
+ GROUP BY
+ type_licence.libelle
+ ORDER BY
+ type_licence',
+ DB_PREFIXE
+);
\ No newline at end of file


Property changes on: branches/2.1.0-develop/sql/pgsql/statistiques_licences_par_type_filtre.reqmo.inc.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Modified: branches/2.1.0-develop/tests/410_import_export.robot
===================================================================
--- branches/2.1.0-develop/tests/410_import_export.robot 2019-07-10 15:50:13 UTC (rev 372)
+++ branches/2.1.0-develop/tests/410_import_export.robot 2019-07-10 17:15:42 UTC (rev 373)
@@ -151,6 +151,55 @@
Element Should Contain css=table.tab-tab ${etablissement_permanent.ancien_proprietaire}


+Reqmo nombre de licence par type filtré par la date de fin de validité et sans les demandes de transfert
+ [Documentation] ....
+ Depuis la page d'accueil admin admin
+
+ #
+ &{type_licence_values} = Create Dictionary
+ ... libelle=${testid}TYPELICENCELIB004
+ ... contrainte_proximite=true
+ ${type_licence_id} = Ajouter le type de licence ${type_licence_values}
+ #
+ &{etablissement_permanent} = Create Dictionary
+ ... raison_sociale=${testid}ETABPERM04RS
+ ... enseigne=${testid}ETABPERM04ENS
+ ${etablissement_permanent_id} = Ajouter l'établissement ${etablissement_permanent}
+ #
+ &{demande_licence_01} = Create Dictionary
+ ... etablissement_id=${etablissement_permanent_id}
+ ... type_demande=D'OUVERTURE
+ ... type_licence=${testid}TYPELICENCELIB001
+ ... terme=Permanente
+ ... date_debut_validite=10/01/2017
+ ... date_fin_validite=10/01/2018
+ ${demande_licence_01_id} = Ajouter la demande de licence sur l'établissement ${demande_licence_01}
+ #
+ &{demande_licence_02} = Create Dictionary
+ ... etablissement_id=${etablissement_permanent_id}
+ ... type_demande=DE TRANSFERT
+ ... type_licence=${testid}TYPELICENCELIB001
+ ... terme=Permanente
+ ... date_debut_validite=10/01/2017
+ ... date_fin_validite=10/01/2030
+ ${demande_licence_02_id} = Ajouter la demande de licence sur l'établissement ${demande_licence_02}
+ #
+ &{demande_licence_03} = Create Dictionary
+ ... etablissement_id=${etablissement_permanent_id}
+ ... type_demande=D'OUVERTURE
+ ... type_licence=${testid}TYPELICENCELIB001
+ ... terme=Permanente
+ ... date_debut_validite=10/01/2017
+ ... date_fin_validite=10/01/2030
+ ${demande_licence_03_id} = Ajouter la demande de licence sur l'établissement ${demande_licence_03}
+
+ Depuis l'écran principal du module 'Reqmo'
+ Click On Link statistiques_licences_par_type
+ Click On Submit Button In Reqmo
+ Element Should Contain css=table.tab-tab ${demande_licence_03.type_licence}
+ Element Should Contain css=table.tab-tab 1
+
+
Import des établissements
[Documentation] ....
Depuis la page d'accueil admin admin

Modified: branches/2.1.0-develop/tests/data/pgsql/install_tests.sql
===================================================================
--- branches/2.1.0-develop/tests/data/pgsql/install_tests.sql 2019-07-10 15:50:13 UTC (rev 372)
+++ branches/2.1.0-develop/tests/data/pgsql/install_tests.sql 2019-07-10 17:15:42 UTC (rev 373)
@@ -397,6 +397,8 @@
INSERT INTO om_widget (om_widget, libelle, lien, texte, type, script, arguments) VALUES
(nextval('om_widget_seq'), 'Statistiques', '', '', 'file', 'statistiques_licences_par_type', '');
INSERT INTO om_widget (om_widget, libelle, lien, texte, type, script, arguments) VALUES
+(nextval('om_widget_seq'), 'Autres statistiques', '', '', 'file', 'statistiques_licences_par_type_filtre', '');
+INSERT INTO om_widget (om_widget, libelle, lien, texte, type, script, arguments) VALUES
(nextval('om_widget_seq'), 'Les 10 dernières demandes de licence', '', '', 'file', 'dernieres_demandes', '');
--
INSERT INTO om_dashboard (om_dashboard, om_profil, bloc, position, om_widget) VALUES
@@ -420,6 +422,13 @@
1,
(SELECT om_widget FROM om_widget WHERE libelle='Statistiques')
);
+INSERT INTO om_dashboard (om_dashboard, om_profil, bloc, position, om_widget) VALUES
+(nextval('om_dashboard_seq'),
+ (SELECT om_profil FROM om_profil WHERE libelle='ADMINISTRATEUR'),
+ 'C3',
+ 2,
+ (SELECT om_widget FROM om_widget WHERE libelle='Autres statistiques')
+);
--
INSERT INTO perimetre (perimetre, libelle, longueur_exclusion_metre, geom) VALUES
(nextval('perimetre_seq'), 'CIMETIERE', 150, '01010000206A0800002D9DD540592224416431280EB22D5A41'),

Modified: branches/2.1.0-develop/tests/documentation.robot
===================================================================
--- branches/2.1.0-develop/tests/documentation.robot 2019-07-10 15:50:13 UTC (rev 372)
+++ branches/2.1.0-develop/tests/documentation.robot 2019-07-10 17:15:42 UTC (rev 373)
@@ -147,6 +147,8 @@
... css=div.widget_dernieres_demandes
Capture and crop page screenshot screenshots/ergonomie/a_widget_statistiques_licences_par_type.png
... css=div.widget_statistiques_licences_par_type
+ Capture and crop page screenshot screenshots/ergonomie/a_widget_statistiques_licences_par_type_filtre.png
+ ... css=div.widget_statistiques_licences_par_type_filtre


Instruction

Reply all
Reply to author
Forward
0 new messages