diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f5ddfcfe2..ee9f574f7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -41,6 +41,7 @@ - fixed: Tickets on add to badge screen now show the time at the event's timezone - It was possible to run multiple singleton workflows at the same time. - fixed: WebGUI Password Recovery email subject hard-coded + - rfe: Add url to list of attributes tracked in assetHistory 7.5.22 - fixed: Layout template now gets prepared correctly diff --git a/docs/upgrades/upgrade_7.5.21-7.6.0.pl b/docs/upgrades/upgrade_7.5.21-7.6.0.pl index 5e07d577e..b85d5efc2 100644 --- a/docs/upgrades/upgrade_7.5.21-7.6.0.pl +++ b/docs/upgrades/upgrade_7.5.21-7.6.0.pl @@ -28,6 +28,7 @@ my $quiet; # this line required my $session = start(); # this line required +addUrlToAssetHistory ( $session ); ##This sub MUST GO FIRST removeDoNothingOnDelete( $session ); fixIsPublicOnTemplates ( $session ); addEMSBadgeTemplate ( $session ); @@ -49,6 +50,14 @@ sub addEMSBadgeTemplate { print "Done.\n" unless $quiet; } +#---------------------------------------------------------------------------- +sub addUrlToAssetHistory { + my $session = shift; + print "\tAdding URL column to assetHistory" unless $quiet; + $session->db->write('ALTER TABLE assetHistory ADD COLUMN url VARCHAR(255)'); + print "Done.\n" unless $quiet; +} + #---------------------------------------------------------------------------- sub removeDoNothingOnDelete { my $session = shift; diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index ef5a4b82f..3a95195b3 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -491,10 +491,11 @@ If not specified, current user is used. sub updateHistory { my $self = shift; + my $session = $self->session; my $action = shift; - my $userId = shift || $self->session->user->userId || '3'; - my $dateStamp =$self->session->datetime->time(); - $self->session->db->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp) values (".$self->session->db->quote($self->getId).", ".$self->session->db->quote($userId).", ".$self->session->db->quote($action).", ".$dateStamp.")"); + my $userId = shift || $session->user->userId || '3'; + my $dateStamp =$session->datetime->time(); + $session->db->write("insert into assetHistory (assetId, userId, actionTaken, dateStamp, url) values (?,?,?,?,?)", [$self->getId, $userId, $action, $dateStamp, $self->get('url')]); }