Gossamer Forum
Home : Products : DBMan : Customization :

Last Modified date on Records?

Quote Reply
Last Modified date on Records?
I have a field named "Last Modified" setup in %db_def in the default.cfg file. I am trying to get the date to be automatically added to that field whenever someone modify's their record. Anybody - help please?
Quote Reply
Re: Last Modified date on Records? In reply to
In html.pl, sub html_modify_form_record, just after the line that starts with

if (!%rec) { &html_modify_failure(

add

$rec{'Last Modified'} = &get_date;



------------------
JPD





Quote Reply
Re: Last Modified date on Records? In reply to
JPD -

Thanks so much it finally worked !!
Quote Reply
Re: Last Modified date on Records? In reply to
If you have a field called

LastModifiedBy

In html.pl, sub html_modify_form_record, just after the line that starts with

if (!%rec) { &html_modify_failure(

add

$rec{'LastModifiedBy'} = $db_userid;





------------------
JPD





Quote Reply
Re: Last Modified date on Records? In reply to
What about Users? I would like to show who modified the record last. Is this possible?
I would like this information to show up in the "Modification Form".

(Yes, I know that I could just look at the default.log file and get that information. But sifting through a long log file is not very economical.)

Any assistance would be quite helpful.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited May 13, 1999).]
Quote Reply
Re: Last Modified date on Records? In reply to
That makes sense. However, I am looking for a method that will automatically put the last modified user in the table. The suggestions you gave seem to be a manual way of keeping track of the last modifier. Is there a way to have the last modifier show up automatically?? I assume that there would have to be some tweaking with the db.cgi file.

Thanks for your suggestion, Carol.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Last Modified date on Records? In reply to
Ok, here's a puzzle, that I've started puzzling over...

What if I only want to run:

$rec{'Last Modified'} = &get_date;

ONLY after ONE particular field is modified?
i.e. $rec('registered') is set to yes by a user.

Thanx!
Quote Reply
Re: Last Modified date on Records? In reply to
Setting

$rec{'LastModifiedBy'} = $db_userid;

is about as automatic as it gets. You could do it in sub modify_record in db.cgi, in db.cgi if you wanted, but I'm not sure what the advantage would be. I try to avoid editing the db.cgi script if I can, because every time you do, you are limiting the use of the script for other databases. (This might not be a factor for you, but that's my modus operandi. Smile )

Quote:
What if I only want to run:

$rec{'Last Modified'} = &get_date;

ONLY after ONE particular field is modified?
i.e. $rec('registered') is set to yes by a user.

You mean you only want to write to the 'Last Modified' filed if the value of the 'registered' field has been changed? Boy, that's a real toughie.

The way the modify script is set up, there is no way to see what the record was before it was modified. This would take a major rewriting of the entire modify_record subroutine.


------------------
JPD





Quote Reply
Re: Last Modified date on Records? In reply to
Thanks, Carol! It worked like a charm...

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us