[Koha-devel] LOG and USERENV specific information

Henri-Damien LAURENT laurenthdl at alinto.com
Fri Aug 5 07:39:49 CEST 2005


Adding Log Facility.
Needs Two Update in database...
On more table (action_logs)
And One more syspref Activate_Log, with YesNo values.
Maintainance has been sweeped of previous Log functions
addbiblio.pl contains a sample of code using Log.pm
Could be generalized to Authorities, acquisitions, members soon.

Adding page to display log views.
can be called by admin/viewlog.pl
Works with C4/Log.pm
uses action_logs table

using C4::Log, you have access to :
- logstatus, a simple Boolean Function which returns True if Activate_Log is set false if off.
- logaction that takes :
	* usernumber returned by gettemplateanduser
	* modulename a string (acquisition, catalogue, asoasf)
	* actionname a developper defined string (add, modify, delete)
	* objectnumber, primary key of object modified
	* infos, if needed (not a DELETE action) should contain the informations stored)

- displaylog takes a modulename and a list of filters (list of hashes with keys name and value)
and returns a result list of hash-record and a count of records returned.
the information returned by displaylog should be different whether you modify a book or an order. 
That's Why a modulename is needed.

The userenv cookie is set in Auth.pm.
To get the userenv information, you must FIRST gettemplateanduser, which verifies whether the user is granted access to the demanded page, and set informations with decoding the cookie.
Then you can get :
 $ bornum,
 $ userid,
 $ cardnumber,
 $ firstname,
 $ surname,
 $ branchcode,
 $ userflags
of the active user calling the C4::Context->userenv
which returns a hash with number, id, cardnumber, firstname, surname, branch, and flags keys.
Any further information can be provided if needed.

Enjoy.
-- 
Henri-Damien LAURENT







More information about the Koha-devel mailing list