From 34f687e04e5bfeede6c327a50c8578ea10b74b94 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 3 Aug 2003 10:45:03 +0000 Subject: [PATCH] =?UTF-8?q?Gestion=20de=20l'=E9dition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/projet/fiche.php3 | 36 +++++++++++++++++++-------- htdocs/comm/projet/project.class.php3 | 23 +++++++++++++---- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/projet/fiche.php3 b/htdocs/comm/projet/fiche.php3 index ddb54792aa9..5389e8ca239 100644 --- a/htdocs/comm/projet/fiche.php3 +++ b/htdocs/comm/projet/fiche.php3 @@ -19,14 +19,23 @@ * $Source$ * */ - require("./pre.inc.php3"); require("./project.class.php3"); require("../propal.class.php3"); +$db = new Db(); + +if ($HTTP_POST_VARS["action"] == 'update') +{ + $projet = new Project($db); + $projet->id = $id; + $projet->ref = $HTTP_POST_VARS["ref"]; + $projet->title = $HTTP_POST_VARS["title"]; + $projet->update(); +} + llxHeader("","../"); -$db = new Db(); if ($action == 'create') { @@ -68,21 +77,21 @@ if ($action == 'create') $projet->fetch($id); $projet->societe->fetch($projet->societe->id); - if ($action == 'edit') { + print '
'; + print ''; print ''; - print ''; - - print ''; - print ''; - print '
Société'.$projet->societe->nom.'
Ref'.$projet->ref.'
Titre'.$projet->title.'
'; + print 'Société'.$projet->societe->nom.''; + print 'Ref'; + print 'Titre'; + print '
'; } else { print ''; - print ''; + print ''; print ''; print ''; @@ -134,7 +143,14 @@ if ($action == 'create') print "

Société'.$projet->societe->nom.'
Société'.$projet->societe->nom.'
Ref'.$projet->ref.'
Titre'.$projet->title.'
"; - print ""; + if ($action == "edit") + { + print ""; + } + else + { + print ""; + } print ""; diff --git a/htdocs/comm/projet/project.class.php3 b/htdocs/comm/projet/project.class.php3 index e0ccc9d3d1f..55aadc1e747 100644 --- a/htdocs/comm/projet/project.class.php3 +++ b/htdocs/comm/projet/project.class.php3 @@ -42,16 +42,29 @@ class Project { Function create($creatorid) { - $sql = "INSERT INTO llx_projet (ref, title, fk_soc, fk_user_creat, dateo) "; $sql .= " VALUES ('$this->ref', '$this->title', $this->socidp, $creatorid, now()) ;"; if (!$this->db->query($sql) ) { - print ''.$sql.'
'.$this->db->error(); - - } - + print ''.$sql.'
'.$this->db->error(); + } + } + /* + * + * + * + */ + Function update() + { + $sql = "UPDATE llx_projet "; + $sql .= " SET ref = '$this->ref', title = '$this->title'"; + $sql .= " WHERE rowid = $this->id"; + + if (!$this->db->query($sql) ) + { + print ''.$sql.'
'.$this->db->error(); + } } /* *
EditerAnnulerEditer-