From f6c563b395b14c1fd531351b2d820054e09d9ae8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Aug 2004 23:39:22 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Corrections=20register=5Fglobals=20Ajout?= =?UTF-8?q?=20lien=20rendez-vous=20sur=20liste=20contacts=20des=20fiches?= =?UTF-8?q?=20client=20et=20compta.=20Meilleur=20gestion=20des=20fiches=20?= =?UTF-8?q?de=20cr=E9ation=20d'action.=20Code=20mieux=20comment=E9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/actioncomm.class.php | 21 ++++++--- htdocs/cactioncomm.class.php | 29 ++++++++++++ htdocs/html.form.class.php | 87 ++++++++++++++++++++++++++---------- htdocs/societe.class.php | 28 ++++++------ htdocs/socnote.php | 4 +- 5 files changed, 126 insertions(+), 43 deletions(-) diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index 8d73b9114b6..56b3b4e6a27 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * $Id$ * $Source$ @@ -56,17 +57,26 @@ class ActionComm */ Function add($author) { - if (!strlen($this->contact)) + if (! $this->contact) { $this->contact = 0; } - if (!strlen($this->propalrowid)) + if (! $this->propalrowid) { $this->propalrowid = 0; } + if (! $this->percent) + { + $this->percent = 0; + } + if (! $this->priority) + { + $this->priority = 0; + } + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author, fk_user_action, fk_contact, percent, note,priority,propalrowid) "; $sql .= " VALUES ('$this->date', $this->type, $this->societe, $author->id,"; - $sql .= $this->user->id . ", $this->contact, $this->percent, '$this->note', $this->priority, $this->propalrowid);"; + $sql .= $this->user->id . ", $this->contact, '$this->percent', '$this->note', $this->priority, $this->propalrowid);"; if ($this->db->query($sql) ) { @@ -74,7 +84,7 @@ class ActionComm } else { - print $this->db->error() . "
" . $sql; + dolibarr_print_error($this->db); } } /* @@ -117,7 +127,7 @@ class ActionComm } else { - print $this->db->error(); + dolibarr_print_error($this->db); } } /** @@ -162,5 +172,6 @@ class ActionComm return 1; } } + } ?> diff --git a/htdocs/cactioncomm.class.php b/htdocs/cactioncomm.class.php index 3ca200b99d7..e393be24250 100644 --- a/htdocs/cactioncomm.class.php +++ b/htdocs/cactioncomm.class.php @@ -96,5 +96,34 @@ class CActioncomm { print $this->db->error(); } } + + + /* + * Renvoie le nom d'une action a partir d'un id + * + */ + Function get_nom($id) + { + + $sql = "SELECT libelle nom FROM ".MAIN_DB_PREFIX."c_actioncomm WHERE id='$id';"; + + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object($result , 0); + return $obj->nom; + } + $this->db->free(); + } + else { + dolibarr_print_error($db); + } + + } + + } ?> diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index c25a93b65ca..0fb532536e5 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -42,8 +42,6 @@ class Form */ Function select_departement($selected='') { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -83,11 +82,11 @@ class Form $i++; } } + print ''; } else { - print "Erreur : $sql : ".$this->db->error(); + dolibarr_print_error($this->db); } - print ''; } /* @@ -96,13 +95,12 @@ class Form */ Function select_pays($selected='') { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -121,24 +119,24 @@ class Form $i++; } } - } print ''; + } } /* * Retourne la liste déroulante des sociétés * */ - Function select_societes($selected='') + Function select_societes($selected='',$htmlname='soc_id') { // On recherche les societes $sql = "SELECT s.idp, s.nom FROM "; $sql .= MAIN_DB_PREFIX ."societe as s "; $sql .= "ORDER BY nom ASC"; - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -157,13 +155,55 @@ class Form $i++; } } + print ''; } else { - print "Erreur : $sql : ".$this->db->error(); + dolibarr_print_error($this->db); } - print ''; } + /* + * Retourne la liste déroulante des contacts d'une société donnée + * + */ + Function select_contacts($socid,$selected='',$htmlname='contactid') + { + // On recherche les societes + $sql = "SELECT s.idp, s.name, s.firstname FROM "; + $sql .= MAIN_DB_PREFIX ."socpeople as s"; + $sql .= " WHERE fk_soc=".$socid; + $sql .= " ORDER BY s.name ASC"; + + if ($this->db->query($sql)) + { + print ''; + } + else { + dolibarr_print_error($this->db); + } + } + + /* * Retourne le nom d'un pays * @@ -180,15 +220,14 @@ class Form if ($num) { $obj = $this->db->fetch_object(0); - print $obj->libelle; + return $obj->libelle; } else { - print "Non définit"; + return "Non définit"; } } - print ''; } @@ -200,13 +239,12 @@ class Form Function select_civilite($selected='') { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -225,8 +263,12 @@ class Form $i++; } } - } print ''; + } + else { + dolibarr_print_error($this->db); + } + } /* @@ -236,8 +278,6 @@ class Form */ Function select_forme_juridique($selected='') { - print ''; $num = $this->db->num_rows(); $i = 0; if ($num) @@ -275,11 +316,11 @@ class Form $i++; } } - } - else { - print "Erreur : $sql : ".$this->db->error(); - } print ''; + } + else { + dolibarr_print_error($this->db); + } } /* diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 6a54523286d..3a0f814eaac 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -409,12 +409,11 @@ class Societe { return $this->db->query($sql); } } + /* - * - * + * Renvoie le nom d'une societe a partir d'un id * */ - Function get_nom($id) { @@ -424,16 +423,19 @@ class Societe { if ($result) { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object($result , 0); - - $this->nom = $obj->nom; - - } - $this->db->free(); - } - } + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object($result , 0); + return $obj->nom; + } + $this->db->free(); + } + else { + dolibarr_print_error($db); + } + + } + /* * * diff --git a/htdocs/socnote.php b/htdocs/socnote.php index f26759be974..c9fa7ee4534 100644 --- a/htdocs/socnote.php +++ b/htdocs/socnote.php @@ -73,7 +73,7 @@ if ($_GET["socid"] > 0) { $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; $head[$h][1] = 'Note'; - $a = $h; + $hselected = $h; $h++; if ($user->societe_id == 0) @@ -86,7 +86,7 @@ if ($_GET["socid"] > 0) { $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; $head[$h][1] = 'Notifications'; - dolibarr_fiche_head($head, $a); + dolibarr_fiche_head($head, $hselected, $societe->nom); print_titre($societe->nom);