diff --git a/htdocs/boutique/livre/fiche.php b/htdocs/boutique/livre/fiche.php index 895d62359e6..c4c764268e5 100644 --- a/htdocs/boutique/livre/fiche.php +++ b/htdocs/boutique/livre/fiche.php @@ -59,6 +59,12 @@ if ($action == 'delcat') $livre->unlinkcategorie($catid); } +if ($action == 'delauteur' && $auteurid) +{ + $livre = new Livre($db); + $livre->fetch($id); + $livre->auteur_unlink($auteurid); +} if ($action == "status") { @@ -160,17 +166,17 @@ else print 'Référence'; print "Description"; - print "Statut$livre->status_text"; - if ($livre->status == 0) - { - print '
Changer'; - } - else - { - print '
Changer'; - } - print "\n"; - + print "Statut$livre->status_text"; + if ($livre->status == 0) + { + print '
Changer'; + } + else + { + print '
Changer'; + } + print "\n"; + print '"; @@ -262,8 +268,11 @@ else print 'Auteur(s)'; foreach ($auteurs as $key => $value) - { - print ''.$value."
\n"; + { + print '
'; + print 'Supprimer '; + print ''; + print $value."
\n"; } print ""; print 'Prix'.price($livre->price).''; diff --git a/htdocs/boutique/livre/livre.class.php b/htdocs/boutique/livre/livre.class.php index a4929b9f68a..e32b8367efc 100644 --- a/htdocs/boutique/livre/livre.class.php +++ b/htdocs/boutique/livre/livre.class.php @@ -156,6 +156,27 @@ class Livre { print $this->db->error(); } } + /* + * + * + */ + Function auteur_unlink($auteur_id) + { + + $sql = "DELETE FROM llx_livre_to_auteur "; + + $sql .= " WHERE fk_livre=".$this->id; + $sql .= " AND fk_auteur=".$auteur_id; + + if ( $this->db->query($sql) ) + { + return 1; + } + else + { + print $this->db->error() . ' in ' . $sql; + } + } /* * *