Item2020: actionnotify ignores ACTIONTRACKERPLUGIN_EXTRAS

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: ActionTrackerPlugin
Branches:
Reported By: PhilippLeufke
Waiting For:
Last Change By: CrawfordCurrie

Description

EXTRAS defined for ActionTrackerPlugin seem to be ignored by actionnotify.

How to reproduce

  • Set the EXTRAS in SitePreferences to contain more fields like e.g. priority or summary:
   * Set ACTIONTRACKERPLUGIN_EXTRAS = |state,select,1,"open","suspended","canceled","closed"|priority,select,"normal","high","low"|summary,text,60| 
   * Set ACTIONTRACKERPLUGIN_TABLEHEADER = | Assigned to | Due date | Priority | Description | State | Notify | |
   * Set ACTIONTRACKERPLUGIN_TABLEFORMAT = | $who | $due | $priority | *$summary* $text $link | $state | $notify | $edit |
   * Set ACTIONTRACKERPLUGIN_EDITHEADER = | Assigned to | Due date | Priority | State | Notify | Summary | Description |
   * Set ACTIONTRACKERPLUGIN_EDITFORMAT = | $who | $due | $priority | $state | $notify | $summary | $text | 
  • Fill some actions using the priority and/or summary fields:
  • Call actionnotify and tell it where to put $priority and $summary.
    (The listing below is copy-pasted from the crontab, so there are escaped characters...)
cd /var/lib/foswiki/bin

/var/lib/foswiki/tools/actionnotify \
'state=open' 'within=8' 'web=(?!Sandbox|System|Trash|TWiki).*' \
"header=\"| Assigned to | Due date | Priority |  Description | State |\"" \
format=\"'| $who | $due | $priority | $summary $text [$edit] | $state |'\"

Now the Priority column will just show empty fields and the summary is empty as well!

Is this a real bug or do we need to handle these custom fields in a different way in actionnotify?


actionnotify uses exactly the same code as ACTIONSEARCH, so I can't understand how this can happen. If the settings were in WebPreferences, then i could put it down to the web context, but you say they are in SitePreferences. Hmmm.

It's quite a lot of work to generate a unit testcase for this, so I'm going to have to back-burner it until I have time (or someone else isolates and fixes it)

-- CrawfordCurrie - 05 Nov 2009

Came across this error as well.

This is what I did:

  1. added a subject field to EXTRAS (|subject,text,20|)
  2. created an action with subject=Vaderness
  3. fired up perl ../tools/actionnotify subject=Vaderness DEBUG=on

No result.

The %ACTION attributes are passed to the Action constructor which adds them to the object's properties. Before, it tries to get the "type" of an attribute. If an attribute is unknown, it will get the type "noload" which means that it won't be added to the object. The type information is collected during extendTypes() which in turn is called by _lazyInit(). However, actionnotify never calls _lazyInit or extendTypes. Therefor any extra action property won't ever be added to the action and thus the match() during actionnotify will never be able to return true if such a custom property is being used as a filter.

Possible solution: either extendTypes or all of _lazyInit() has to be called during actionnotify

ActionTrackerPlugin:db9c968488bb

-- MichaelDaum - 27 Jan 2010

Here is an additional patch to support web-specific EXTRAS for a single web:
Index: ActionNotify.pm
===================================================================
--- ActionNotify.pm     (revision 6192)
+++ ActionNotify.pm     (working copy)
@@ -45,6 +45,10 @@
     # Assign SESSION so that Func methods work
     $Foswiki::Plugins::SESSION = $session;
 
+    if ($expr =~ /\bweb="([^" ,*]+)"/) {
+        Foswiki::Func::pushTopicContext($1, 'WebHome');
+    }
+
     Foswiki::Plugins::ActionTrackerPlugin::lazyInit($session->{webName}, $session->{topicName});
 
     if ( $expr =~ s/DEBUG//o ) {

... and this lets the tests pass on my machine, where servertime is not the same as gmtime:
Index: ActionNotifyTests.pm
===================================================================
--- ActionNotifyTests.pm        (revision 6143)
+++ ActionNotifyTests.pm        (working copy)
@@ -22,6 +22,9 @@
     $this->SUPER::set_up();
     $Foswiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1;
 
+       # Make the test work when the local timezone is not GMT
+       $Foswiki::cfg{DisplayTimeValues} = 'servertime';
+
     # Need this to get the actionnotify template
     foreach my $lib (@INC) {
         my $d = "$lib/../templates";

May I check these in?

-- MichaelTempest - 30 Jan 2010

Please!

-- CrawfordCurrie - 30 Jan 2010

Done - ActionTrackerPlugin:3fdc8f41ac39

-- MichaelTempest - 30 Jan 2010

This was fixed by Micha - not sure why he didn't close this report before now.

-- CrawfordCurrie - 27 Jan 2011

ItemTemplate edit

Summary actionnotify ignores ACTIONTRACKERPLUGIN_EXTRAS
ReportedBy PhilippLeufke
Codebase 1.0.6
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component ActionTrackerPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins ActionTrackerPlugin:db9c968488bb ActionTrackerPlugin:3fdc8f41ac39
TargetRelease n/a
ReleasedIn n/a
Topic revision: r11 - 27 Jan 2011, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy