From 1af7db0e33478569642df051c7ff3d8eb91f5d59 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 3 Dec 2006 12:29:18 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=E0=20jours=20des=20infos=20lors=20de=20?= =?UTF-8?q?la=20creation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/canvas/product.livre.class.php | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/htdocs/product/canvas/product.livre.class.php b/htdocs/product/canvas/product.livre.class.php index 73e59dd3c83..f5c644f95a3 100644 --- a/htdocs/product/canvas/product.livre.class.php +++ b/htdocs/product/canvas/product.livre.class.php @@ -48,20 +48,45 @@ class ProductLivre extends Product $this->description = "Gestion des livres"; $this->active = PRODUIT_SPECIAL_LIVRE; $this->menu_new = 'NewBook'; + $this->menu_clear = 1; } /** * \brief Creation - * \param id Id livre ('' par defaut) + * \param id Id livre */ - function CreateCanvas($id) + function CreateCanvas($user,$datas) { + $id = $this->create($user); + + $sql = " INSERT INTO ".MAIN_DB_PREFIX."product_cnv_livre (rowid)"; $sql.= " VALUES ('".$id."');"; $result = $this->db->query($sql) ; - $sql = " INSERT INTO ".MAIN_DB_PREFIX."product_cnv_livre_contrat (fk_cnv_livre)"; - $sql.= " VALUES ('".$id."');"; + if ( $result ) + { + $sql = " INSERT INTO ".MAIN_DB_PREFIX."product_cnv_livre_contrat (fk_cnv_livre)"; + $sql.= " VALUES ('".$id."');"; + + $result = $this->db->query($sql) ; + } + + if ( $result ) + { + $this->UpdateCanvas($datas); + } + + return $id; + } + /** + * \brief Supression + * \param id Id livre + */ + function DeleteCanvas($id) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_cnv_livre "; + $sql.= " WHERE rowid = '".$id."';"; $result = $this->db->query($sql) ;