From 393f25cd88b76e61086797a2c4db6e666a62c3e2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 24 Apr 2011 17:36:12 +0200 Subject: [PATCH] fixed a bug where a song's author/topic/songbooks might not be saved --- openlp/plugins/songs/forms/songmaintenanceform.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 48e614eeb..c1437ce0e 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -386,7 +386,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): existing_author = self.manager.get_object_filtered(Author, and_(Author.first_name == old_author.first_name, Author.last_name == old_author.last_name, - Author.display_name == old_author.display_name)) + Author.display_name == old_author.display_name, + Author.id != old_author.id)) # Find the songs, which have the old_author as author. songs = self.manager.get_all_objects(Song, Song.authors.contains(old_author)) @@ -408,7 +409,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): """ # Find the duplicate. existing_topic = self.manager.get_object_filtered(Topic, - Topic.name == old_topic.name) + and_(Topic.name == old_topic.name, Topic.id != old_topic.id)) # Find the songs, which have the old_topic as topic. songs = self.manager.get_all_objects(Song, Song.topics.contains(old_topic)) @@ -431,7 +432,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): # Find the duplicate. existing_book = self.manager.get_object_filtered(Book, and_(Book.name == old_book.name, - Book.publisher == old_book.publisher)) + Book.publisher == old_book.publisher, + Book.id != old_book.id)) # Find the songs, which have the old_book as book. songs = self.manager.get_all_objects(Song, Song.song_book_id == old_book.id) @@ -503,4 +505,5 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): editButton.setEnabled(False) else: deleteButton.setEnabled(True) - editButton.setEnabled(True) \ No newline at end of file + editButton.setEnabled(True) +