Bug 16276: Add a new pref TrackLastPatronActivity and new column borrowers.lastseen
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sun, 24 Apr 2016 15:03:49 +0000 (16:03 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 13 Sep 2016 17:27:42 +0000 (17:27 +0000)
Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Nicolas Legrand <nicolas.legrand@bulac.fr>
https://bugs.koha-community.org/show_bug.cgi?id=12276

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
installer/data/mysql/atomicupdate/bug_16276.sql [new file with mode: 0644]
installer/data/mysql/kohastructure.sql
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref

diff --git a/installer/data/mysql/atomicupdate/bug_16276.sql b/installer/data/mysql/atomicupdate/bug_16276.sql
new file mode 100644 (file)
index 0000000..eeecbe3
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER IGNORE TABLE borrowers ADD COLUMN lastseen datetime default NULL AFTER updated_on;
+ALTER IGNORE TABLE deletedborrowers ADD COLUMN lastseen datetime default NULL AFTER updated_on;
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('TrackLastPatronActivity', '0', 'If set, the field borrowers.lastseen will be updated everytime a patron is seen', NULL, 'YesNo');
index e72edaf..e38efc5 100644 (file)
@@ -621,6 +621,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower
   `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
   `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'.
   `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others)
+  `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
   KEY borrowernumber (borrowernumber),
   KEY `cardnumber` (`cardnumber`),
   KEY `sms_provider_id` (`sms_provider_id`)
@@ -1640,6 +1641,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
   `privacy_guarantor_checkouts` tinyint(1) NOT NULL DEFAULT '0', -- controls if relatives can see this patron's checkouts
   `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'.
   `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others)
+  `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface)
   UNIQUE KEY `cardnumber` (`cardnumber`),
   PRIMARY KEY `borrowernumber` (`borrowernumber`),
   KEY `categorycode` (`categorycode`),
index b0346dc..5dc6bb9 100644 (file)
@@ -508,6 +508,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('TraceCompleteSubfields','0','0','Force subject tracings to only match complete subfields.','YesNo'),
 ('TraceSubjectSubdivisions','0','1','Create searches on all subdivisions for subject tracings.','YesNo'),
 ('TrackClicks','0',NULL,'Track links clicked','Integer'),
+('TrackLastPatronActivity','0',NULL,'If set, the field borrowers.lastseen will be updated everytime a patron is seen','YesNo'),
 ('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'),
 ('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'),
 ('UNIMARCAuthorityField100','afrey50      ba0',NULL,'Define the contents of UNIMARC authority control field 100 position 08-35','Textarea'),
index 54d13fc..2f2faa0 100644 (file)
@@ -179,7 +179,13 @@ Patrons:
                yes: Show
                no: "Don't show"
          - "patron messaging setting on the OPAC (note: EnhancedMessagingPreferences must be enabled)."
-
+     -
+         - pref: TrackLastPatronActivity
+           choices:
+               yes: Do
+               no: "Don't"
+         - track last patron activity.
+         - Everytime a patron will connect, the borrowers.lastseen will be updated with the current time.
     "Norwegian patron database":
      -
          - pref: NorwegianPatronDBEnable