[opencourrier-Commits] r921 - in branches/test_5.0.0-a1: . obj sql/pgsql

2 views
Skip to first unread message

fray...@adullact.net

unread,
May 31, 2017, 11:35:14 AM5/31/17
to openmairie-...@googlegroups.com
Author: fraynaud
Date: 2017-05-31 17:35:11 +0200 (Wed, 31 May 2017)
New Revision: 921

Modified:
branches/test_5.0.0-a1/HISTORY.txt
branches/test_5.0.0-a1/obj/courrier_arrivee.class.php
branches/test_5.0.0-a1/obj/courrier_arrivee_diffusion.class.php
branches/test_5.0.0-a1/obj/courrier_arrivee_en_cours.class.php
branches/test_5.0.0-a1/obj/diffusion.class.php
branches/test_5.0.0-a1/obj/diffusion_envoi.class.php
branches/test_5.0.0-a1/obj/diffusion_non_envoi.class.php
branches/test_5.0.0-a1/obj/dossier.class.php
branches/test_5.0.0-a1/obj/om_dbform.class.php
branches/test_5.0.0-a1/sql/pgsql/courrier.inc.php
branches/test_5.0.0-a1/sql/pgsql/courrier_arrivee_diffusion.inc.php
Log:

ajout des methodes suivants et precedents
correction de bugs



Modified: branches/test_5.0.0-a1/HISTORY.txt
===================================================================
--- branches/test_5.0.0-a1/HISTORY.txt 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/HISTORY.txt 2017-05-31 15:35:11 UTC (rev 921)
@@ -34,10 +34,23 @@
- voir bouton cloturer/decloturer de diffusion : intéret ?
- mettre l option su menu "courrier" apres

+demande rto : faire un om_parametre affichage banette 23/03/2017


-demande rto : faire un om_parametre affichage banette 23/03/2017
-
+FAIT
+* utilisation de suivant/precedent 30/05/2016:
+ - sur dossier -> ok
+ - sur diffusion.class bug de la methode dans l utilisation d ajout de copie de courrier
+ donc utilisation dans diffusion_envoi.class et diffusion_non_envoi.class
+ - sur courrier_arrivee.class bugs sur l'appel dans courrier.inc des methodes f->isCourrierDepartActived
+ en ajout et modification de courrier
+ Error: Call to a member function isCourrierDepartActivated() on null in
+ /var/www/html/opencourrier/branches/test_5.0.0-a1/sql/pgsql/courrier.inc.php on line 59l
+ -> seule l inibition de la méthode permet un fonctionnement
+ ne pas passer par courri
+
+
+* correction bug courrier arrivée si pas de scan (dossier inexistant pour création de diffusion) 30/05/2016
* correction bug app/combo.php pb de recherche avec une apostrophe 13/04/2017 fr
* a quoi sert app/changerservice.php et workservice.class.php ?
* restriction widget courrier service sur sessio serviec 24-03-2017 fr

Modified: branches/test_5.0.0-a1/obj/courrier_arrivee.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/courrier_arrivee.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/courrier_arrivee.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -104,8 +104,12 @@
// champ traitement_diffusion prealable a la diffusion
// si diffusion traitement_diffusion devient traitement
if ($this->f->getParameter("dematerialisation") == "true"){
+ if($val["lib_scan_pdf"]!=""){
$this->insert_diffusion_automatique($this->valF['courrier'],$db,$val,
$this->valF['traitement_diffusion'], "traitement", $DEBUG);
+ }else{
+ $this->addToMessage(_("pas de diffusion creee car pas de scan"));
+ }
}
//
return true;

Modified: branches/test_5.0.0-a1/obj/courrier_arrivee_diffusion.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/courrier_arrivee_diffusion.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/courrier_arrivee_diffusion.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -53,7 +53,8 @@
"condition" => array(
"is_not_en_cours",
),
- );
+ );
+ // $this->preparePrecSuiv();
}



Modified: branches/test_5.0.0-a1/obj/courrier_arrivee_en_cours.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/courrier_arrivee_en_cours.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/courrier_arrivee_en_cours.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -23,6 +23,7 @@

function init_class_actions() {
parent::init_class_actions();
+
// pas de possibilite de supprimer
$this->class_actions[2] = array();
$this->class_actions[4] = array(

Modified: branches/test_5.0.0-a1/obj/diffusion.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/diffusion.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/diffusion.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -46,6 +46,8 @@
);
*/

+
+
$this->class_actions[5] = array(
"identifier" => "cloturer",
"portlet" => array(
@@ -251,23 +253,27 @@
function verifier_arrivee($val) {
$table = "dossier";
$primary_key = "dossier";
- //
- $sql = " SELECT ".$table.".typedossier";
- $sql .= " FROM ".DB_PREFIXE."".$table." ";
- $sql .= " WHERE ".$table.".dossier=".$val['dossier']." ";
- // Exécution de la requête
- $res = $this->f->db->getOne($sql);
- // Logger
- $this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE);
- // Vérification d'une éventuelle erreur de base de données
- $this->f->isDatabaseError($res);
- if($res != "arrive"){
+ if(is_numeric($val['dossier'])){
+ $sql = " SELECT ".$table.".typedossier";
+ $sql .= " FROM ".DB_PREFIXE."".$table." ";
+ $sql .= " WHERE ".$table.".dossier=".$val['dossier']." ";
+ // Exécution de la requête
+ $res = $this->f->db->getOne($sql);
+ // Logger
+ $this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE);
+ // Vérification d'une éventuelle erreur de base de données
+ $this->f->isDatabaseError($res);
+ if($res != "arrive"){
+ $this->correct = false;
+ $msg = _("Le document n est pas un document arrivé ".
+ "et il n'est pas possible de le mettre en traitement");
+ $msg .= " "._("pour le courrier")." : ".$val["courrier"]." ";
+ $this->addToMessage($msg);
+ }
+ }else{ // cas ou la clé n est pas numérique (cas ajout diffusiocourrier si pas de scan/dossier bloqué en amont)
+ $this->addToMessage(_("pk dossier non numerique"));
$this->correct = false;
- $msg = _("Le document n est pas un document arrivé ".
- "et il n'est pas possible de le mettre en traitement");
- $msg .= " "._("pour le courrier")." : ".$val["courrier"]." ";
- $this->addToMessage($msg);
- }
+ }
}



Modified: branches/test_5.0.0-a1/obj/diffusion_envoi.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/diffusion_envoi.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/diffusion_envoi.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -19,6 +19,7 @@
$this->class_actions [0]= array();
$this->class_actions [1]= array();
$this->class_actions [2]= array();
+ $this->preparePrecSuiv();

}


Modified: branches/test_5.0.0-a1/obj/diffusion_non_envoi.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/diffusion_non_envoi.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/diffusion_non_envoi.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -10,6 +10,7 @@

var $activate_class_action = true;

+
function diffusion_envoi($id,&$db,$debug) {
$this->constructeur($id,$db,$debug);
}// fin constructeur
@@ -21,6 +22,7 @@
$this->class_actions [2]= array();
$this->class_actions [4]= array();
$this->class_actions [5]= array();
+ $this->preparePrecSuiv();
}

function setType(&$form,$maj) {

Modified: branches/test_5.0.0-a1/obj/dossier.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/dossier.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/dossier.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -18,7 +18,15 @@
)
;
var $activate_class_action = true;
-
+
+ function init_class_actions() {
+ // On récupère les actions génériques définies dans la méthode
+ // d'initialisation de la classe parente
+ parent::init_class_actions();
+ //$this->preparePrecSuiv();
+
+ }
+
function get_typedossier (){
return $this->valF['typedossier'];
}

Modified: branches/test_5.0.0-a1/obj/om_dbform.class.php
===================================================================
--- branches/test_5.0.0-a1/obj/om_dbform.class.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/obj/om_dbform.class.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -27,7 +27,179 @@
*/
var $om_formulaire = "om_formulaire";

+ function preparePrecSuiv() {
+ (isset($this -> f -> submitted_get_value['idx']) ? $id = $this -> f -> submitted_get_value['idx'] : $id = "");
+ (isset($this -> f -> submitted_get_value['obj']) ? $obj = $this -> f -> submitted_get_value['obj'] : $obj = "");
+ (isset($this -> f -> submitted_get_value['premier']) ? $premier = $this -> f -> submitted_get_value['premier'] : $premier = 0);
+ (isset($this -> f -> submitted_get_value['tricol']) ? $tricol = $this -> f -> submitted_get_value['tricol'] : $tricol = "");
+ (isset($this -> f -> submitted_get_value['advs_id']) ? $advs_id = $this -> f -> submitted_get_value['advs_id'] : $advs_id = "");
+ (isset($this -> f -> submitted_get_value['valide']) ? $valide = $this -> f -> submitted_get_value['valide'] : $valide = "");
+ (isset($this -> f -> submitted_get_value['recherche']) ? $recherche = $this -> f -> submitted_get_value['recherche'] : $recherche = "");
+ (isset($this -> f -> submitted_get_value['selectioncol']) ? $selectioncol = $this -> f -> submitted_get_value['selectioncol'] : $selectioncol = "");
+ (isset($this -> f -> submitted_get_value['retourformulaire']) ? $retourformulaire = $this -> f -> submitted_get_value['retourformulaire'] : $retourformulaire = "");
+ (isset($this -> f -> submitted_get_value['idxformulaire']) ? $idxformulaire = $this -> f -> submitted_get_value['idxformulaire'] : $idxformulaire = "");
+ (isset($this -> f -> submitted_get_value['retour']) ? $retour = $this -> f -> submitted_get_value['retour'] : $retour = "");
+ // Liste des options
+ // -----------------
+ if (!isset($options)) {
+ $options = array();
+ }
+ // Dictionnaire des actions
+ // ------------------------
+ // Ancien tableau (retro-compatibilite)
+ $href = array();
+ // Declaration du dictionnaire
+ $tab_actions = array(
+ 'corner' => array(),
+ 'left' => array(),
+ 'content' => array(),
+ 'specific_content' => array(),
+ );
+ $extra_parameters = array();

+ // surcharge globale
+ if (file_exists('../dyn/tab.inc.php')) {
+ require_once '../dyn/tab.inc.php';
+ }
+ if (file_exists('../dyn/custom.inc.php')) {
+ require '../dyn/custom.inc.php';
+ }
+ if(isset($custom['tab'][$obj]) and file_exists($custom['tab'][$obj])){
+ require $custom['tab'][$obj];
+ }else{
+ // surcharge specifique des objets
+ if (file_exists("../sql/".OM_DB_PHPTYPE."/".$obj.".inc.php")) {
+ require "../sql/".OM_DB_PHPTYPE."/".$obj.".inc.php";
+ } else {
+ require "../sql/".OM_DB_PHPTYPE."/".$obj.".inc";
+ }
+ }
+ $edition = "";
+ $om_validite = false;
+ if (!isset($options)) {
+ $options = array();
+ }
+ // on ne prend que la première colonne
+ $champAffiche[0]=substr($champAffiche[0], 0, strpos(strtolower($champAffiche[0]), " as "))." as idx";
+ // Instanciation d'om_table
+ require_once "../obj/om_table.class.php";
+ $tb = new om_table(
+ "../scr/tab.php",
+ $table,
+ $serie,
+ $champAffiche,
+ $champRecherche,
+ $tri,
+ $selection,
+ $edition,
+ $options,
+ $advs_id,
+ $om_validite
+ );
+ $params = array(
+ "obj" => $obj,
+ "premier" => $premier,
+ "recherche" => $recherche,
+ "selectioncol" => $selectioncol,
+ "tricol" => $tricol,
+ "advs_id" => $advs_id,
+ "valide" => $valide,
+ );
+ // Ajout de paramètre spécifique
+ $params = array_merge($params, $extra_parameters);
+ $tb->setParams($params);
+ // Methode permettant de definir si la recherche doit etre faite
+ // sur la recherche simple ou avncee
+ $tb->composeSearchTab();
+ // Generation de la requete de recherche
+ $tb->composeQuery();
+ // récupération de la requête générée
+ $limit=$tb ->serie+2;
+ if ($premier-1 >= 0)
+ $offset=$premier - 1;
+ else
+ $offset=0;
+ $sql= "SELECT array_agg(idx) FROM (SELECT idx FROM (".$tb->sql.") lst LIMIT ".$limit." OFFSET ".$offset.") a";
+ $tb->__destruct();
+ $idxs=$this ->f -> db -> getOne($sql);
+ $aidxs=explode(",",str_replace("{","",str_replace("}","",($idxs))));
+ $pos=array_search($id, $aidxs,true);
+ $prec=$pos-1;
+ $suiv=$pos+1;
+ if ($suiv == sizeof($aidxs))
+ $suiv=-1;
+ $premier_prec=$premier;
+ $premier_suiv=$premier;
+ if ($premier_prec > 0 && $prec==0)
+ $premier_prec=$premier_prec-$tb ->serie;
+ if ($premier_suiv == 0 && $suiv==$tb ->serie)
+ $premier_suiv=$premier_suiv+$tb ->serie;
+ if ($premier_suiv > 0 && $suiv>$tb ->serie)
+ $premier_suiv=$premier_suiv+$tb ->serie;
+ if ( $prec >=0) {
+ if ($this->f->submitted_get_value['retourformulaire'] != null)
+ $url_prec='../scr/sousform.php?obj='.$obj.'&action=3&idx='.$aidxs[$prec].'&premiersf='.$premier_prec.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idxformulaire.'&retour='.$retour;
+ else
+ $url_prec='../scr/form.php?obj='.$obj.'&action=3&idx='.$aidxs[$prec].'&advs_id='.$advs_id.'&premier='.$premier_prec.'&recherche='.$recherche.'&selectioncol='.$selectioncol.'&tricol='.$tricol.'&valide='.$valide.'&retour='.$retour;
+ } else {
+ $url_prec="";
+ }
+ if ( $suiv >=0) {
+ if ($this->f->submitted_get_value['retourformulaire'] != null)
+ $url_suiv='../scr/sousform.php?obj='.$obj.'&action=3&idx='.$aidxs[$suiv].'&premiersf='.$premier_suiv.'&retourformulaire='.$retourformulaire.'&idxformulaire='.$idxformulaire.'&retour='.$retour;
+ else
+ $url_suiv='../scr/form.php?obj='.$obj.'&action=3&idx='.$aidxs[$suiv].'&advs_id='.$advs_id.'&premier='.$premier_suiv.'&recherche='.$recherche.'&selectioncol='.$selectioncol.'&tricol='.$tricol.'&valide='.$valide.'&retour='.$retour;
+ } else {
+ $url_suiv="";
+ }
+ $prev_suiv = array(
+ "idx" => $id,
+ "prec_idx" => $prec,
+ "prec_premier" => $premier_prec,
+ "prec_url" => $url_prec,
+ "suiv_idx" => $suiv,
+ "suiv_premier" => $premier_suiv,
+ "suiv_url" => $url_suiv
+ );
+ if ($prev_suiv['idx'] != '' && $prev_suiv["prec_idx"] >=0) {
+ array_push(
+ $this->class_actions,
+ array(
+ "identifier" => "nav_prec",
+ "portlet" => array(
+ "type" => "action-self",
+ 'libelle' => _('précédent'),
+ //'ajax' => false,
+ "class" => "prev-16",
+ 'order' => 30,
+ 'url' => $prev_suiv["prec_url"]
+ //'id' => '',
+ )
+ )
+ );
+ }
+ if ($prev_suiv['idx'] != '' && $prev_suiv["suiv_idx"] >=0) {
+ array_push(
+ $this->class_actions,
+ array(
+ "identifier" => "nav_suiv",
+ "portlet" => array(
+ 'libelle' => _('suivant'),
+ "type" => "action-self",
+ //'ajax' => false,
+ "class" => "suiv-16",
+ 'ordre' => 101,
+ 'url' => $prev_suiv["suiv_url"]
+ //'id' => '',
+ ),
+ )
+ );
+ }
+ return $prev_suiv;
+ }
+
+
+
}

?>

Modified: branches/test_5.0.0-a1/sql/pgsql/courrier.inc.php
===================================================================
--- branches/test_5.0.0-a1/sql/pgsql/courrier.inc.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/sql/pgsql/courrier.inc.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -55,7 +55,7 @@
'courrier.courrier as "'._("courrier").'"',
);

-// Si l'option des courriers départ est activiée
+// Si l'option des courriers départ est activée
if ($f->isCourrierDepartActivated() == 'true') {

$champAfficheBis = array(
@@ -87,7 +87,7 @@
"courrier",
);

-// Si l'option des courriers départ est activiée
+// Si l'option des courriers départ est activée
if ($f->isCourrierDepartActivated() == 'true') {

$champRechercheBis = array(

Modified: branches/test_5.0.0-a1/sql/pgsql/courrier_arrivee_diffusion.inc.php
===================================================================
--- branches/test_5.0.0-a1/sql/pgsql/courrier_arrivee_diffusion.inc.php 2017-05-12 11:09:05 UTC (rev 920)
+++ branches/test_5.0.0-a1/sql/pgsql/courrier_arrivee_diffusion.inc.php 2017-05-31 15:35:11 UTC (rev 921)
@@ -6,8 +6,58 @@
* @author nhaye
*
*/
-include('../sql/pgsql/courrier_arrivee.inc.php');
+//include('../sql/pgsql/courrier_arrivee.inc.php');
+//Liste des champs affiches dans la liste des courriers
+include('../gen/sql/pgsql/courrier.inc.php');

+$table = DB_PREFIXE."courrier
+ LEFT JOIN ".DB_PREFIXE."categorie_courrier
+ ON courrier.categorie_courrier=categorie_courrier.categorie_courrier
+ LEFT JOIN ".DB_PREFIXE."civilite
+ ON courrier.civilite=civilite.civilite
+ LEFT JOIN ".DB_PREFIXE."emetteur
+ ON courrier.emetteur=emetteur.emetteur
+ LEFT JOIN ".DB_PREFIXE."service as service
+ ON courrier.traitement=service.service
+ LEFT JOIN ".DB_PREFIXE."service as service2
+ ON courrier.traitement_diffusion=service2.service
+ LEFT JOIN ".DB_PREFIXE."type_correspondant
+ ON courrier.type_correspondant=type_correspondant.type_correspondant ";
+
+$champAffiche=array(
+ 'courrier.courrier as "'._("courrier").'"',
+ 'registre as "'._("registre").'"',
+ 'nature as "'._("nature").'"',
+ 'to_char(datearrivee ,\'DD/MM/YYYY\') as "'._("date d'arrivee").'"',
+ 'to_char(datecourrier ,\'DD/MM/YYYY\') as "'._("date courrier").'"',
+ 'courrier.emetteurnom ||
+ CASE WHEN courrier.emetteurprenom IS NULL
+ THEN \'\'
+ ELSE \' \'
+ END
+ || COALESCE(courrier.emetteurprenom, \'\') as "'._("emetteur").'"',
+ 'service.servicelib as "'._("traitement").'"',
+ 'categorie_courrier.libelle as "'._("categorie").'"',
+ 'substring(courrier.objetcourrier, 1,50) as "'._("objet courrier").'"',
+ 'nbtache as "'._("Tache(s)").'"'
+ );
+
+$champRecherche = array(
+ "courrier",
+ "registre",
+ "service.servicelib as traitement",
+ "nature",
+ "courrier.emetteurnom || COALESCE(courrier.emetteurprenom, '') || COALESCE(to_char(courrier.emetteur, '999'), '') as emetteur",
+ "courrier.emetteurad1 || COALESCE(courrier.emetteurad2,'') || COALESCE(courrier.emetteurcp, '') || COALESCE(courrier.emetteurville, '') as emetteur adresse",
+ "courrier.objetcourrier as objet courrier",
+ "courrier.copiea as copie à",
+ "courrier.diffusion as diffusion",
+);
+
+
+
+
+
// Fil d'Ariane
$ent = _("banette")." -> "._("proposition");
if (isset($idx) && $idx != ']' && trim($idx) != '') {

Reply all
Reply to author
Forward
0 new messages