tux...@adullact.net
unread,Aug 18, 2017, 10:33:57 AM8/18/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairi...@googlegroups.com
Author: tuxayo
Date: 2017-08-18 16:33:44 +0200 (Fri, 18 Aug 2017)
New Revision: 7438
Modified:
branches/new_col_nature_travaux/sql/pgsql/dossier_instruction.inc.php
Log:
Affichage de la colonne "nature des travaux" seulement sur 3 listings
Modified: branches/new_col_nature_travaux/sql/pgsql/dossier_instruction.inc.php
===================================================================
--- branches/new_col_nature_travaux/sql/pgsql/dossier_instruction.inc.php 2017-08-17 15:55:35 UTC (rev 7437)
+++ branches/new_col_nature_travaux/sql/pgsql/dossier_instruction.inc.php 2017-08-18 14:33:44 UTC (rev 7438)
@@ -68,7 +68,28 @@
LEFT JOIN ".DB_PREFIXE."om_collectivite
ON dossier.om_collectivite=om_collectivite.om_collectivite
LEFT OUTER JOIN ".DB_PREFIXE."arrondissement
- ON arrondissement.code_postal = dossier.terrain_adresse_code_postal
+ ON arrondissement.code_postal = dossier.terrain_adresse_code_postal
+";
+
+$max_chars = 40; // nombre max de caractères à afficher dans la colonne avant de
+ // tronquer et rajouter une ellipse (…)
+$nature_des_travaux_select = "
+CASE WHEN char_length(nature_des_travaux) <= $max_chars
+ THEN
+ CONCAT('<span title=\"',
+ nature_des_travaux,
+ '\">',
+ replace(nature_des_travaux, '\n', '<br/>'),
+ '</span>')
+ ELSE
+ CONCAT('<span title=\"',
+ nature_des_travaux,
+ '\">',
+ replace(left(nature_des_travaux, $max_chars), '\n', '<br/>') || '…',
+ '</span>')
+ END
+as \""._("nature des travaux").'"';
+$nature_des_travaux_from = "
INNER JOIN (
SELECT
-- description/nature des travaux. En cas de modif, bloc de code aussi
@@ -118,24 +139,20 @@
ON nature_des_travaux.dossier = dossier.dossier
";
-$max_chars = 40; // nombre max de caractères à afficher dans la colonne avant de
- // tronquer et rajouter une ellipse (…)
-$nature_des_travaux = "
-CASE WHEN char_length(nature_des_travaux) <= $max_chars
- THEN
- CONCAT('<span title=\"',
- nature_des_travaux,
- '\">',
- replace(nature_des_travaux, '\n', '<br/>'),
- '</span>')
- ELSE
- CONCAT('<span title=\"',
- nature_des_travaux,
- '\">',
- replace(left(nature_des_travaux, $max_chars), '\n', '<br/>') || '…',
- '</span>')
- END";
+// On ne veut cette colonne que dans les trois listings "Recherche",
+// "Mes encours" et "Tous les encours"
+$is_in_obj_whitelist = in_array($obj, ["dossier_instruction",
+ "dossier_instruction_mes_encours",
+ "dossier_instruction_tous_encours"]);
+$is_not_in_soustab = $retourformulaire === '';
+if($is_in_obj_whitelist && $is_not_in_soustab) {
+ $nature_des_travaux = [$nature_des_travaux_select];
+ $table .= $nature_des_travaux_from;
+} else {
+ $nature_des_travaux = []; // Sera ignorée
+}
+
/*Champs du début de la requête*/
$champAffiche_debut_commun = array(
'dossier.dossier as "'._("dossier").'"',
@@ -143,7 +160,8 @@
$case_demandeur.' as "'._("petitionnaire").'"',
$trim_concat_terrain,
'dossier_autorisation_type_detaille.libelle as "'._("nature_dossier").'"',
- $nature_des_travaux.' as "'._("nature des travaux").'"',
+);
+$champAffiche_debut_commun_dates = array(
'to_char(dossier.date_depot ,\'DD/MM/YYYY\') as "'._("date_depot").'"',
'to_char(dossier.date_complet ,\'DD/MM/YYYY\') as "'._("date_complet").'"',
'CASE WHEN dossier.incomplet_notifie IS TRUE AND dossier.incompletude IS TRUE
@@ -151,7 +169,13 @@
ELSE to_char(dossier.date_limite ,\'DD/MM/YYYY\')
END as "'._("date_limite").'"',
);
+$champAffiche_debut_commun = array_merge(
+ $champAffiche_debut_commun,
+ $nature_des_travaux,
+ $champAffiche_debut_commun_dates
+);
+
/*Champs de la fin de la requête*/
$champAffiche_fin_commun = array(
'etat.libelle as "'._("etat").'"',
@@ -173,11 +197,13 @@
$selection .= "AND groupe.code != 'CTX'";
/*Liste des champs affichés dans le tableau de résultat*/
-$champAffiche = array_merge($champAffiche_debut_commun,
- array('instructeur.nom as "'._("instructeur").'"',
- 'division.code as "'._("division").'"',
- ),
- $champAffiche_fin_commun);
+$champAffiche = array_merge(
+ $champAffiche_debut_commun,
+ array('instructeur.nom as "'._("instructeur").'"',
+ 'division.code as "'._("division").'"',
+ ),
+ $champAffiche_fin_commun
+);
// Suppression du bouton d'ajout, qui n'est pas affiché par défaut dans les listings de
// dossiers d'instruction
@@ -218,7 +244,7 @@
"display"=>false,
);
}
-if ( $retourformulaire == "dossier_autorisation"){
+if ( $retourformulaire == "dossier_autorisation") {
//
$tab_actions['left']["consulter"] =