From 27c503e1e63934b18a68929254155c5d4832ae30 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 25 Nov 2003 13:24:15 +0000 Subject: [PATCH] Ajout check du nom de la societe --- htdocs/societe.class.php | 45 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index 3c7d62fedde..3d99b58df36 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -38,7 +38,8 @@ class Societe { var $fournisseur; - Function Societe($DB, $id=0) { + Function Societe($DB, $id=0) + { global $config; $this->db = $DB; @@ -52,10 +53,8 @@ class Societe { * * */ - Function create() { - - print $this->url; - + Function create() + { $sql = "INSERT INTO llx_societe (nom, datec, datea, client) "; $sql .= " VALUES ('".trim($this->nom)."', now(), now(), $this->client);"; @@ -73,26 +72,30 @@ class Societe { * */ Function update($id) - { + { + if (strlen(trim($this->nom)) == 0) + { + $this->nom = "VALEUR MANQUANTE"; + } - $sql = "UPDATE llx_societe "; - $sql .= " SET nom = '" . trim($this->nom) ."'"; - $sql .= ",address = '" . trim($this->adresse) ."'"; - $sql .= ",cp = '" . trim($this->cp) ."'"; - $sql .= ",ville = '" . trim($this->ville) ."'"; - $sql .= ",tel = '" . trim($this->tel) ."'"; - $sql .= ",fax = '" . trim($this->fax) ."'"; - $sql .= ",url = '" . trim($this->url) ."'"; - $sql .= ",siren = '" . trim($this->siren) ."'"; - $sql .= ",client = " . $this->client ; - $sql .= ",fournisseur = " . $this->fournisseur ; - $sql .= " WHERE idp = " . $id .";"; - - if (! $this->db->query($sql)) + $sql = "UPDATE llx_societe "; + $sql .= " SET nom = '" . trim($this->nom) ."'"; + $sql .= ",address = '" . trim($this->adresse) ."'"; + $sql .= ",cp = '" . trim($this->cp) ."'"; + $sql .= ",ville = '" . trim($this->ville) ."'"; + $sql .= ",tel = '" . trim($this->tel) ."'"; + $sql .= ",fax = '" . trim($this->fax) ."'"; + $sql .= ",url = '" . trim($this->url) ."'"; + $sql .= ",siren = '" . trim($this->siren) ."'"; + $sql .= ",client = " . $this->client ; + $sql .= ",fournisseur = " . $this->fournisseur ; + $sql .= " WHERE idp = " . $id .";"; + + if (! $this->db->query($sql)) { print $this->db->error(); } - } + } /* * Suppression d'une societe.