From: Jason Etheridge Date: Fri, 5 Aug 2011 10:56:36 +0000 (-0400) Subject: Add an actor.usr.last_update_date column X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cc5f1528feac70bcd8eb26a8326f8499531952d6;p=contrib%2FConifer.git Add an actor.usr.last_update_date column Though should we call it edit_date, like on asset.copy? :) Also added trigger, and some display definitions in the staff client. Signed-off-by: Jason Etheridge Signed-off-by: Thomas Berezansky --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 3204a80812..15e15845e6 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -2593,6 +2593,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/005.schema.actors.sql b/Open-ILS/src/sql/Pg/005.schema.actors.sql index 71171572bf..f9e8c3d1f1 100644 --- a/Open-ILS/src/sql/Pg/005.schema.actors.sql +++ b/Open-ILS/src/sql/Pg/005.schema.actors.sql @@ -63,7 +63,8 @@ CREATE TABLE actor.usr ( alert_message TEXT, create_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), expire_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT (now() + '3 years'::INTERVAL), - claims_never_checked_out_count INT NOT NULL DEFAULT 0 + claims_never_checked_out_count INT NOT NULL DEFAULT 0, + last_update_date TIMESTAMP WITH TIME ZONE ); COMMENT ON TABLE actor.usr IS $$ User objects @@ -116,6 +117,18 @@ CREATE FUNCTION actor.crypt_pw_update () RETURNS TRIGGER AS $$ END; $$ LANGUAGE PLPGSQL; +CREATE OR REPLACE FUNCTION actor.au_updated() +RETURNS TRIGGER AS $$ +BEGIN + NEW.last_update_date := now(); + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER au_update_trig + BEFORE UPDATE ON actor.usr + FOR EACH ROW EXECUTE PROCEDURE actor.au_updated(); + CREATE TRIGGER actor_crypt_pw_update_trigger BEFORE UPDATE ON actor.usr FOR EACH ROW EXECUTE PROCEDURE actor.crypt_pw_update (); diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties index 7f586bb1a7..fd84c89dbb 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties @@ -140,6 +140,7 @@ staff.au_alert_message_label=Alert staff.au_claims_returned_count_label=Returns Claimed staff.au_create_date_label=Created On staff.au_expire_date_label=Expires On +staff.au_last_update_date_label=Updated On staff.au_home_library_label=Home Library staff.au_home_library_fullname_label=Home Library (Full Name) staff.au_credit_forward_balance_label=Credit diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index db13be5a04..e21fee1566 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -110,8 +110,8 @@ staff.patron.display.init.network_request.error_showing_alert=Error showing patr staff.patron.display.render_search_form.patron_search=Patron Search staff.patron.display.tab_name=Patron: staff.patron.display.no_alerts_or_messages=No Alerts, Blocks, or Messages -# Field 1 = actor.usr.id, Field 2 = actor.usr.create_date -staff.patron.display.db_data=Database ID: %1$s Create Date: %2$s +# Field 1 = actor.usr.id, Field 2 = actor.usr.create_date, Field 3 = actor.usr.last_update_date +staff.patron.display.db_data=Database ID: %1$s Create Date: %2$s Last Updated: %3$s staff.patron.hold_notices.tooltiptext=ID: %1$s Hold ID: %2$s Notifying Staff ID: %3$s staff.patron.hold_notices.new_notification_record=New Notification Record staff.patron.hold_notices.method=Method diff --git a/Open-ILS/xul/staff_client/server/patron/display.js b/Open-ILS/xul/staff_client/server/patron/display.js index e1b4fbe177..bc84ae662e 100644 --- a/Open-ILS/xul/staff_client/server/patron/display.js +++ b/Open-ILS/xul/staff_client/server/patron/display.js @@ -514,7 +514,10 @@ patron.display.prototype = { 'staff.patron.display.db_data', [ obj.patron.id(), - obj.patron.create_date() + obj.patron.create_date(), + obj.patron.last_update_date() + ? obj.patron.last_update_date() + : '' ] ); e.setAttribute('tooltiptext',tooltiptext); diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index 8968e0ab12..82a6e28373 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -446,6 +446,13 @@ patron.util.columns = function(modify,params) { ,'sort_value' : function(my) { return util.date.db_date2Date( my.au.create_date() ).getTime(); } }, { + 'persist' : 'hidden width ordinal', 'id' : 'au_last_update_date', 'label' : commonStrings.getString('staff.au_last_update_date_label'), 'flex' : 1, + 'sort_type' : 'date', + 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.last_update_date(), "%{localized}" ); } + ,'sort_value' : function(my) { return util.date.db_date2Date( my.au.last_update_date() ).getTime(); } + }, + + { 'persist' : 'hidden width ordinal', 'id' : 'expire_date', 'label' : commonStrings.getString('staff.au_expire_date_label'), 'flex' : 1, 'sort_type' : 'date', 'primary' : false, 'hidden' : true, 'editable' : false, 'render' : function(my) { return util.date.formatted_date( my.au.expire_date(), "%{localized_date}" ); }