From 2763dfee255e91637d28457f6ec49c0a7b85a6e4 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Sun, 20 Jul 2008 18:35:16 +0000 Subject: [PATCH] shortcut ##userPref:## macros now work even if shortcut is not under a dashboard --- docs/changelog/7.x.x.txt | 3 +++ lib/WebGUI/Asset/Shortcut.pm | 33 +++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 32836fe9f..3d3143e19 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,9 @@ - fixed: Manage Subscription Code Batches: Names of Batches not Displayed - fixed: Manage Subscription Codes: No way to Select - fixed: Self registration that does not require passwords, now allows multiple users with empty passwords. This means that users can self register without a password and might cause downstream bugs with other wobjects. + - fixed: Calendar now uses the correct method to get the current user's time-zone + - Shortcut ##userPref:## macros now work even if Shortcut is not + under a Dashboard 7.5.17 - fixed: Payment Methods Hover Help Incomplete diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 839eed230..c73aa889a 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -424,22 +424,23 @@ sub getOverrides { } else { $self->session->errorHandler->warn("Original asset could not be instanciated by shortcut ".$self->getId); } - if ($self->isDashlet) { - my $u = WebGUI::User->new($self->session, $self->discernUserId); - my @userPrefs = $self->getPrefFieldsToImport; - foreach my $fieldId (@userPrefs) { - my $field = WebGUI::ProfileField->new($self->session,$fieldId); - next unless $field; - my $fieldName = $field->getId; - my $fieldValue = $u->profileField($field->getId); - $overrides{userPrefs}{$fieldName}{value} = $fieldValue; - $overrides{userPrefs}{$fieldName}{parsedValue} = $fieldValue; - # 'myTemplateId is ##userPref:myTemplateId##', for example. - foreach my $overr (keys %{$overrides{overrides}}) { - $overrides{overrides}{$overr}{parsedValue} =~ s/\#\#userPref\:${fieldName}\#\#/$fieldValue/gm; - } - } - } + + # Process shortcut macros + my $u = WebGUI::User->new($self->session, $self->discernUserId); + my @userPrefs = $self->getPrefFieldsToImport; + foreach my $fieldId (@userPrefs) { + my $field = WebGUI::ProfileField->new($self->session,$fieldId); + next unless $field; + my $fieldName = $field->getId; + my $fieldValue = $u->profileField($field->getId); + $overrides{userPrefs}{$fieldName}{value} = $fieldValue; + $overrides{userPrefs}{$fieldName}{parsedValue} = $fieldValue; + # 'myTemplateId is ##userPref:myTemplateId##', for example. + foreach my $overr (keys %{$overrides{overrides}}) { + $overrides{overrides}{$overr}{parsedValue} =~ s/\#\#userPref\:${fieldName}\#\#/$fieldValue/gm; + } + } + $cache->set(\%overrides, 60*60); $overridesRef = \%overrides; }