[Koha-patches] [PATCH] Schema Changes for Email Checkout Slips

Daniel Sweeney daniel.sweeney at liblime.com
Tue Feb 3 23:01:58 CET 2009


From: John Beppu <john.beppu at liblime.com>

- new table, item_circulation_alert_preferences
- new data:
  - letter -- 2 new templates
  - message_transport_types -- feed
  - message_attributes -- Item Check-in and Item Checkout
  - message_transports -- for each attribute and for each transport_type...

Signed-off-by: Daniel Sweeney <daniel.sweeney at liblime.com>
---
 .../mysql/en/mandatory/message_transport_types.sql |    3 +-
 .../data/mysql/en/optional/sample_notices.sql      |    4 ++-
 .../optional/sample_notices_message_attributes.sql |    4 ++-
 .../optional/sample_notices_message_transports.sql |    8 ++++-
 .../1-Obligatoire/message_transport_types.sql      |    6 +++
 .../1-Obligatoire/message_transport_types.txt      |    2 +
 .../data/mysql/fr-FR/2-Optionel/sample_notices.sql |   15 ++++++++
 .../data/mysql/fr-FR/2-Optionel/sample_notices.txt |    1 +
 .../sample_notices_message_attributes.sql          |   10 +++++
 .../sample_notices_message_attributes.txt          |    2 +
 .../sample_notices_message_transports.sql          |   21 +++++++++++
 .../sample_notices_message_transports.txt          |    3 ++
 installer/data/mysql/kohastructure.sql             |   15 ++++++++
 installer/data/mysql/updatedatabase.pl             |   37 ++++++++++++++++++++
 kohaversion.pl                                     |    2 +-
 15 files changed, 128 insertions(+), 5 deletions(-)
 create mode 100644 installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
 create mode 100644 installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.txt
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices.sql
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices.txt
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.txt
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.sql
 create mode 100644 installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.txt

diff --git a/installer/data/mysql/en/mandatory/message_transport_types.sql b/installer/data/mysql/en/mandatory/message_transport_types.sql
index 517f5cc..e8c0027 100644
--- a/installer/data/mysql/en/mandatory/message_transport_types.sql
+++ b/installer/data/mysql/en/mandatory/message_transport_types.sql
@@ -2,4 +2,5 @@ INSERT INTO message_transport_types
 (message_transport_type)
 values
 ('email'),
-('sms');
+('sms')
+('feed');
diff --git a/installer/data/mysql/en/optional/sample_notices.sql b/installer/data/mysql/en/optional/sample_notices.sql
index ec9f84c..ad414b0 100644
--- a/installer/data/mysql/en/optional/sample_notices.sql
+++ b/installer/data/mysql/en/optional/sample_notices.sql
@@ -10,4 +10,6 @@ VALUES
 ('circulation','PREDUE','Advance Notice of Item Due','Advance Notice of Item Due','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item will be due soon:\r\n\r\n<<items.content>>'),
 ('circulation','PREDUEDGST','Advance Notice of Item Due (Digest)','Advance Notice of Item Due','You have <<count>> items due soon'),
 ('circulation','EVENT','Upcoming Library Event','Upcoming Library Event','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThis is a reminder of an upcoming library event in which you have expressed interest.'),
-('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>');
+('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>'),
+('circulation','CHECKINDGST','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n<<items.content>>'),
+('circulation','CHECKOUTDGST','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n<<items.content>>');
diff --git a/installer/data/mysql/en/optional/sample_notices_message_attributes.sql b/installer/data/mysql/en/optional/sample_notices_message_attributes.sql
index 8f89ff7..5d1ecb6 100644
--- a/installer/data/mysql/en/optional/sample_notices_message_attributes.sql
+++ b/installer/data/mysql/en/optional/sample_notices_message_attributes.sql
@@ -4,5 +4,7 @@ values
 (1, 'Item DUE', 0),
 (2, 'Advance Notice', 1),
 (3, 'Upcoming Events', 1),
-(4, 'Hold Filled', 0);
+(4, 'Hold Filled', 0),
+(5, 'Item Check-in', 0),
+(6, 'Item Checkout', 0);
 
diff --git a/installer/data/mysql/en/optional/sample_notices_message_transports.sql b/installer/data/mysql/en/optional/sample_notices_message_transports.sql
index bc796dc..b9d9f90 100644
--- a/installer/data/mysql/en/optional/sample_notices_message_transports.sql
+++ b/installer/data/mysql/en/optional/sample_notices_message_transports.sql
@@ -12,4 +12,10 @@ values
 (2, 'sms',   0, 'circulation', 'PREDUE'),
 (2, 'sms',   1, 'circulation', 'PREDUEDGST'),
 (3, 'sms',   0, 'circulation', 'EVENT'),
-(4, 'sms',   0, 'reserves',    'HOLD');
+(4, 'sms',   0, 'reserves',    'HOLD'),
+(5, 'email', 1, 'circulation', 'CHECKINDGST'),
+(5, 'sms',   1, 'circulation', 'CHECKINDGST'),
+(5, 'feed',  1, 'circulation', 'CHECKINDGST'),
+(6, 'email', 1, 'circulation', 'CHECKOUTDGST'),
+(6, 'sms',   1, 'circulation', 'CHECKOUTDGST'),
+(6, 'feed',  1, 'circulation', 'CHECKOUTDGST');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
new file mode 100644
index 0000000..e8c0027
--- /dev/null
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.sql
@@ -0,0 +1,6 @@
+INSERT INTO message_transport_types
+(message_transport_type)
+values
+('email'),
+('sms')
+('feed');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.txt b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.txt
new file mode 100644
index 0000000..3a8926a
--- /dev/null
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/message_transport_types.txt
@@ -0,0 +1,2 @@
+defines default message tranports for email, and sms.
+
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_notices.sql
new file mode 100644
index 0000000..ad414b0
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices.sql
@@ -0,0 +1,15 @@
+INSERT INTO `letter`
+(module, code, name, title, content)
+VALUES
+('circulation','ODUE','Overdue Notice','Item Overdue','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nAccording to our current records, you have items that are overdue.Your library does not charge late fines, but please return orrenew them as soon as possible.\r\n\r\n<<branches.branchname>><<branches.branchaddress1>><<branches.branchaddress2>><<branches.branchaddress3>><<branches.branchphone>><<branches.branchfax>><<branches.branchemail>>If you have registered a password with the library, you may use it withyour library card number to renew online. If an item becomes more than 30 days overdue, you will be unable to use your library card until the item is returned. The following item is currently overdue:\r\n\r\n<<items.content>>'),
+('claimacquisition','ACQCLAIM','Acquisition Claim','Item Not Received','<<aqbooksellers.name>>\r\n<<aqbooksellers.address1>>\r\n<<aqbooksellers.address2>>\r\n<<aqbooksellers.address3>>\r\n<<aqbooksellers.address4>>\r\n<<aqbooksellers.phone>>\r\n\r\nOrdernumber <<aqorders.ordernumber>> (<<aqorders.title>>) (<<aqorders.quantity>> ordered) ($<<aqorders.listprice>> each) has not been received.'),
+('serial','RLIST','Routing List','Serial is now available','<<borrowers.firstname>> <<borrowers.title>>,\r\n\r\nThe following issue is now available:\r\n\r\n<<items.content>>\r\n\r\nPlease pick it up at your convenience.'),
+('members','ACCTDETAILS','Account Details Template - DEFAULT','Your new Koha account details.','Hello <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>.\r\n\r\nYour new Koha account details are:\r\n\r\nUser:  <<borrowers.userid>>\r\nPassword: <<borrowers.password>>\r\n\r\nIf you have any problems or questions regarding your account, please contact your Koha Administrator.\r\n\r\nThank you,\r\nKoha Administrator\r\nkohaadmin at yoursite.org'),
+('circulation','DUE','Item Due Reminder','Item Due Reminder','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item is now due:\r\n\r\n<<items.content>>'),
+('circulation','DUEDGST','Item Due Reminder (Digest)','Item Due Reminder','You have <<count>> items due'),
+('circulation','PREDUE','Advance Notice of Item Due','Advance Notice of Item Due','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThe following item will be due soon:\r\n\r\n<<items.content>>'),
+('circulation','PREDUEDGST','Advance Notice of Item Due (Digest)','Advance Notice of Item Due','You have <<count>> items due soon'),
+('circulation','EVENT','Upcoming Library Event','Upcoming Library Event','Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nThis is a reminder of an upcoming library event in which you have expressed interest.'),
+('reserves', 'HOLD', 'Hold Available for Pickup', 'Hold Available for Pickup at <<branches.branchname>>', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\r\n\r\nYou have a hold available for pickup as of <<reserves.waitingdate>>:\r\n\r\nTitle: <<biblio.title>>\r\nAuthor: <<biblio.author>>\r\nCopy: <<items.copynumber>>\r\nLocation: <<branches.branchname>>\r\n<<branches.branchaddress1>>\r\n<<branches.branchaddress2>>\r\n<<branches.branchaddress3>>'),
+('circulation','CHECKINDGST','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n<<items.content>>'),
+('circulation','CHECKOUTDGST','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n<<items.content>>');
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices.txt b/installer/data/mysql/fr-FR/2-Optionel/sample_notices.txt
new file mode 100644
index 0000000..82e2ff8
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices.txt
@@ -0,0 +1 @@
+Sample Notices
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql
new file mode 100644
index 0000000..5d1ecb6
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.sql
@@ -0,0 +1,10 @@
+insert into `message_attributes`
+(`message_attribute_id`, message_name, `takes_days`)
+values
+(1, 'Item DUE', 0),
+(2, 'Advance Notice', 1),
+(3, 'Upcoming Events', 1),
+(4, 'Hold Filled', 0),
+(5, 'Item Check-in', 0),
+(6, 'Item Checkout', 0);
+
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.txt b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.txt
new file mode 100644
index 0000000..770bcac
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_attributes.txt
@@ -0,0 +1,2 @@
+defines default messages for items due, advance notices, and upcoming library events.
+
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.sql b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.sql
new file mode 100644
index 0000000..b9d9f90
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.sql
@@ -0,0 +1,21 @@
+insert into `message_transports`
+(`message_attribute_id`, `message_transport_type`, `is_digest`, `letter_module`, `letter_code`)
+values
+(1, 'email', 0, 'circulation', 'DUE'),
+(1, 'email', 1, 'circulation', 'DUEDGST'),
+(2, 'email', 0, 'circulation', 'PREDUE'),
+(2, 'email', 1, 'circulation', 'PREDUEDGST'),
+(3, 'email', 0, 'circulation', 'EVENT'),
+(4, 'email', 0, 'reserves',    'HOLD'),
+(1, 'sms',   0, 'circulation', 'DUE'),
+(1, 'sms',   1, 'circulation', 'DUEDGST'),
+(2, 'sms',   0, 'circulation', 'PREDUE'),
+(2, 'sms',   1, 'circulation', 'PREDUEDGST'),
+(3, 'sms',   0, 'circulation', 'EVENT'),
+(4, 'sms',   0, 'reserves',    'HOLD'),
+(5, 'email', 1, 'circulation', 'CHECKINDGST'),
+(5, 'sms',   1, 'circulation', 'CHECKINDGST'),
+(5, 'feed',  1, 'circulation', 'CHECKINDGST'),
+(6, 'email', 1, 'circulation', 'CHECKOUTDGST'),
+(6, 'sms',   1, 'circulation', 'CHECKOUTDGST'),
+(6, 'feed',  1, 'circulation', 'CHECKOUTDGST');
diff --git a/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.txt b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.txt
new file mode 100644
index 0000000..18e3431
--- /dev/null
+++ b/installer/data/mysql/fr-FR/2-Optionel/sample_notices_message_transports.txt
@@ -0,0 +1,3 @@
+Defines default message transports for sending item due messages,
+advance notice messages, and library event messages through email
+and SMS.
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 670539a..1678aaf 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2339,6 +2339,21 @@ CREATE TABLE branch_transfer_limits (
     PRIMARY KEY  (limitId)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
+--
+-- Table structure for table `item_circulation_alert_preferences`
+--
+
+DROP TABLE IF EXISTS `item_circulation_alert_preferences`;
+CREATE TABLE `item_circulation_alert_preferences` (
+  `id` int(11) NOT NULL auto_increment,
+  `branchcode` varchar(10) NOT NULL,
+  `categorycode` varchar(10) NOT NULL,
+  `item_type` varchar(10) NOT NULL,
+  `is_enabled` tinyint(1) NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  KEY `branchcode` (`branchcode`,`categorycode`,`item_type`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8
+
 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index a819f8f..87c7283 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2120,6 +2120,43 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'circulate_remaining_permissions', 'Remaining circulation permissions')");
     $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'override_renewals', 'Override blocked renewals')");
     print "Upgrade to $DBversion done (added subpermissions for circulate permission)\n";
+}
+
+$DBversion = '3.01.00.016';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("
+        CREATE TABLE item_circulation_alert_preferences (
+            id           int(11) AUTO_INCREMENT,
+            branchcode   varchar(10) NOT NULL,
+            categorycode varchar(10) NOT NULL,
+            item_type    varchar(10) NOT NULL,
+            is_enabled   tinyint(1)  NOT NULL DEFAULT 0,
+            PRIMARY KEY (id),
+            KEY (branchcode, categorycode, item_type)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+    ");
+    $dbh->do(q{
+        INSERT INTO `letter` (`module`, `code`, `name`, `title`, `content`) VALUES
+        ('circulation','CHECKINDGST','Item Check-in (Digest)','Check-ins','The following items have been checked in:\r\n<<items.content>>');
+    });
+    $dbh->do(q{
+        INSERT INTO `letter` (`module`, `code`, `name`, `title`, `content`) VALUES
+        ('circulation','CHECKOUTDGST','Item Check-out (Digest)','Checkouts','The following items have been checked out:\r\n<<items.content>>');
+    });
+
+    $dbh->do(q{INSERT INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (5, 'Item Check-in', 0);});
+    $dbh->do(q{INSERT INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (6, 'Item Checkout', 0);});
+
+    $dbh->do(q{INSERT INTO message_transport_types (message_transport_type) VALUES ('feed');});
+
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (5, 'email', 1, 'circulation', 'CHECKINDGST');});
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (5, 'sms',   1, 'circulation', 'CHECKINDGST');});
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (5, 'feed',  1, 'circulation', 'CHECKINDGST');});
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (6, 'email', 1, 'circulation', 'CHECKOUTDGST');});
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (6, 'sms',   1, 'circulation', 'CHECKOUTDGST');});
+    $dbh->do(q{INSERT INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES (6, 'feed',  1, 'circulation', 'CHECKOUTDGST');});
+
+    print "Upgrade to $DBversion done (data for Email Checkout Slips project)\n";
     SetVersion ($DBversion);
 }
 
diff --git a/kohaversion.pl b/kohaversion.pl
index cc7bd5b..fc73c47 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.012';
+    our $VERSION = '3.01.00.016';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.5.GIT



More information about the Koha-patches mailing list