Skip to content

Commit

Permalink
Placed a Revision History tab on the moremember.tmpl
Browse files Browse the repository at this point in the history
The moremember.tmpl had additional patron info at the
bottom of the page such as "Checked out" and "On Holds".
I added a "Revision History" tab that shows brief info
about the librarian who added or modified the patron record,
what he or she did, and when it happened.
  • Loading branch information
dlbptfs authored and D Ruth Bavousett committed Oct 5, 2010
1 parent 6604860 commit 7125390
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 4 deletions.
44 changes: 40 additions & 4 deletions C4/Members.pm
Expand Up @@ -67,9 +67,9 @@ BEGIN {
&GetSortDetails
&GetTitles
&GetPatronImage
&PutPatronImage
&RmPatronImage
&GetPatronImage
&PutPatronImage
&RmPatronImage
&GetMemberAccountRecords
&GetBorNotifyAcctRecord
Expand All @@ -78,7 +78,7 @@ BEGIN {
&GetborCatFromCatType
&GetBorrowercategory
&GetBorrowercategoryList
&GetBorrowercategoryList
&GetBorrowersWhoHaveNotBorrowedSince
&GetBorrowersWhoHaveNeverBorrowed
Expand All @@ -90,6 +90,7 @@ BEGIN {
&DeleteMessage
&GetMessages
&GetMessagesCount
&GetMemberRevisions
);

#Modify data
Expand Down Expand Up @@ -1563,6 +1564,41 @@ sub GetExpiryDate {
return sprintf("%04d-%02d-%02d", Add_Delta_YM(@date,0,$enrolmentperiod));
}

=head2 GetMemberRevisions
=over 4
$revisions = &GetMemberRevisions($borrowernumber);
Looks up addition/modification occurences of a patron's
account by library staff via the action_logs table.
Uses patron's borrowernumber for database selection.
&GetMemberRevisions returns a reference-to array where each element
is a reference-to-hash whose keys are the fields of the action_logs
table.
=cut

#'
sub GetMemberRevisions {

my ($borrowernumber) = @_;
my $dbh = C4::Context->dbh;
my $sth;
my $select = "
SELECT *
FROM action_logs
WHERE object=?
";
$sth = $dbh->prepare($select);
$sth->execute($borrowernumber);
my $data = $sth->fetchall_arrayref({});
($data) and return ($data);

return undef;
}

=head2 checkuserpassword (OUEST-PROVENCE)
check for the password and login are not used
Expand Down
24 changes: 24 additions & 0 deletions koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
Expand Up @@ -465,6 +465,7 @@ function isValidDate(theField){
<!-- TMPL_IF NAME="CAN_user_reserveforothers_view_holds" -->
<li><a href="#onhold">On Hold</a></li>
<!-- /TMPL_IF -->
<li><a href="#revisionhistory">Revision History</a></li>
</ul>
</div>

Expand All @@ -478,6 +479,29 @@ function isValidDate(theField){
</div>
<!-- /TMPL_IF -->

<div id="revisionhistory">
<h2>Revision History</h2>
<!-- TMPL_IF NAME="revisionloop" -->
<table id="revisionst">
<thead><tr>
<th>Staff</th>
<th>Action</th>
<th>Date/Time</th>
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="revisionloop" -->
<tr>
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="staffnumber" -->" title="display detail for this librarian.">
<!-- TMPL_VAR NAME="staffnumber" --> </a></td>
<td><!-- TMPL_VAR NAME="staffaction" --></td>
<td><!-- TMPL_VAR NAME="timestamp" --></td>
</tr>
<!-- /TMPL_LOOP --></tbody>
</table>
<!-- TMPL_ELSE -->
<p>Patron has no revisions.</p>
<!-- /TMPL_IF -->
</div>

<!-- TMPL_IF NAME="CAN_user_circulate_view_checkout" -->
<div id="checkedout">
<!-- TMPL_IF NAME="issueloop" -->
Expand Down
13 changes: 13 additions & 0 deletions members/moremember.pl
Expand Up @@ -429,6 +429,19 @@ BEGIN

}

# extract staff activity on patron record
my $revisions = &GetMemberRevisions($borrowernumber);
my $revision_count = scalar(@$revisions);
my @revisiondata;
for ( my $i = 0; $i < $revision_count; $i++) {
my %row = %{ $revisions->[$i] };
$row{'staffnumber'} = $revisions->[$i]{'user'};
$row{'staffaction'} = $revisions->[$i]{'action'};
$row{'timestamp'} = $revisions->[$i]{'timestamp'};
push( @revisiondata, \%row );
}
$template->param( revisionloop => \@revisiondata );

# current alert subscriptions
my $alerts = getalert($borrowernumber);
foreach (@$alerts) {
Expand Down

0 comments on commit 7125390

Please sign in to comment.