From 31113608909414cc5196244bf117ebc2f6115e58 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sat, 13 Nov 2010 16:50:30 -0500 Subject: [PATCH] bug 5127: database update to add the suggestion notification templates Being especially careful to not scribble over any ones that the library might have already defined. Signed-off-by: Galen Charlton --- installer/data/mysql/updatedatabase.pl | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index bf7acb60c2..01e6eced4b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3842,6 +3842,40 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = '3.03.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + my $count = $dbh->selectrow_array('SELECT COUNT(*) FROM letter WHERE module = ? AND code = ?', {}, 'suggestions', 'ACCEPTED'); + $dbh->do(q/ +INSERT INTO `letter` +(module, code, name, title, content) +VALUES +('suggestions','ACCEPTED','Suggestion accepted', 'Purchase suggestion accepted','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your suggestion today. The item will be ordered as soon as possible. You will be notified by mail when the order is completed, and again when the item arrives at the library.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>') +/) unless $count > 0; + $count = $dbh->selectrow_array('SELECT COUNT(*) FROM letter WHERE module = ? AND code = ?', {}, 'suggestions', 'AVAILABLE'); + $dbh->do(q/ +INSERT INTO `letter` +(module, code, name, title, content) +VALUES +('suggestions','AVAILABLE','Suggestion available', 'Suggested purchase available','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested is now part of the collection.\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>') +/) unless $count > 0; + $count = $dbh->selectrow_array('SELECT COUNT(*) FROM letter WHERE module = ? AND code = ?', {}, 'suggestions', 'ORDERED'); + $dbh->do(q/ +INSERT INTO `letter` +(module, code, name, title, content) +VALUES +('suggestions','ORDERED','Suggestion ordered', 'Suggested item ordered','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nWe are pleased to inform you that the item you requested has now been ordered. It should arrive soon, at which time it will be processed for addition into the collection.\n\nYou will be notified again when the book is available.\n\nIf you have any questions, please email us at <>\n\nThank you,\n\n<>') +/) unless $count > 0; + $count = $dbh->selectrow_array('SELECT COUNT(*) FROM letter WHERE module = ? AND code = ?', {}, 'suggestions', 'REJECTED'); + $dbh->do(q/ +INSERT INTO `letter` +(module, code, name, title, content) +VALUES +('suggestions','REJECTED','Suggestion rejected', 'Purchase suggestion declined','Dear <> <>,\n\nYou have suggested that the library acquire <> by <>.\n\nThe library has reviewed your request today, and has decided not to accept the suggestion at this time.\n\nThe reason given is: <>\n\nIf you have any questions, please email us at <>.\n\nThank you,\n\n<>') +/) unless $count > 0; + print "Upgrade to $DBversion done (bug 5127: add default templates for suggestion status change notifications)\n"; + SetVersion ($DBversion); +}; + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 2.39.2