Bug 96612 - %date% and %time% not being parsed
Summary: %date% and %time% not being parsed
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.3.2
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-09 02:00 UTC by Pedro Algarvio
Modified: 2007-04-06 12:07 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch for #96612 (1.06 KB, patch)
2007-02-16 14:20 UTC, Antoine Dopffer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Algarvio 2005-01-09 02:00:28 UTC
Version:           1.3.2 (using KDE KDE 3.2.3)
Installed from:    Mandrake RPMs
OS:                Linux

%date% and %time% not being parsed when generating code for php.
This happens for the version that I'm submitting the error, and also for the rpm's provided by mandrake, I think v1.2.2?
Comment 1 Pedro Algarvio 2005-01-09 02:08:43 UTC
Prior to this version, I had the ones provided by mandrake, I then compiled the new one over the old.

Also, the code generation wizzard doesn't seem to work, but if i just tell umbrello to generate the code, it will
Comment 2 Jonathan Riddell 2005-01-09 04:53:13 UTC
Other code generators do not parse these variables either.  Works for C++ though.
Comment 3 Haeber 2005-11-11 03:08:30 UTC
Still this does not work in Umbrello 1.4.92. Java and C++ will parse %date% and %time% correctly, PHP and PHP5 does not. Any other variables work.

Best regards
Thomas
Comment 4 sanjeev 2006-06-30 11:26:06 UTC
I see its not parsing the %date% %time% in php.
Also can the comments be wrapped to 70 characters?
Comment 5 Antoine Dopffer 2007-02-16 14:20:34 UTC
Created attachment 19707 [details]
patch for #96612

The modified file is codegenerationpolicy.cpp
The function getHeading now replaces the variables %date% and %time% by their
values.

There was a comment which said "the replace filepath, time parts are now in the
code document updateHeader method (which you may override as needed).."
But :
1) the function updateHeader was never called during the execution of the code
generators
2) this function is non virtual

Have a nice day
Comment 6 Oliver Kellogg 2007-02-16 19:17:58 UTC
SVN commit 634255 by okellogg:

getHeadingFile(): Attachment 19707 [details] from Antoine Dopffer adds substitution of
 %time% and %date% with the current time and date.
BUG:96612


 M  +1 -0      ChangeLog  
 M  +1 -0      THANKS  
 M  +5 -1      umbrello/codegenerationpolicy.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #634254:634255
@@ -1,6 +1,7 @@
 Version 1.5.7
 
 * Bugs fixed from http://bugs.kde.org:
+* %date% and %time% not being parsed (96612)
 * Relationships for entities do not live outside of an entity relationship diagram (125146)
 * Javascript Code Generation creates bad format methods (135540)
 * Crash when deleting the link between a package and a class (141602)
--- branches/KDE/3.5/kdesdk/umbrello/THANKS #634254:634255
@@ -26,6 +26,7 @@
 Albert Astals Cid <tsdgeos @terra.es>
 Richard Dale <duke @tipitina.demon.co.uk>
 Vincent Decorges <vincent.decorges @eivd.ch>
+Antoine Dopffer <adopffer @nerdshack.com>
 Alan Ezust <alan.ezust @gmail.com>
 Jean-Remy Falleri <jr.falleri @gmail.com>
 Andi Fischer <andi.fischer @hispeed.ch>
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerationpolicy.cpp #634254:634255
@@ -24,6 +24,7 @@
 #include <qstringlist.h>
 #include <qregexp.h>
 #include <qtextstream.h>
+#include <qdatetime.h>
 
 // kde includes
 #include <kconfig.h>
@@ -551,7 +552,10 @@
     //do variable substitution
     retstr.replace( QRegExp("%author%"),QString(getenv("USER")));  //get the user name from some where else
     retstr.replace( QRegExp("%headingpath%"),filename );
-    //the replace filepath, time parts are now in the code document updateHeader method (which you may override as needed)...
+    retstr.replace( QRegExp("%time%"), QTime::currentTime().toString());
+    retstr.replace( QRegExp("%date%"), QDate::currentDate().toString());
+    // the replace filepath, time parts are also in the code document updateHeader method
+    // (which is not a virtual function)...
 
     return retstr;
 }
Comment 7 Haeber 2007-03-25 18:35:52 UTC
Hi one question: In which version of Umbrello is this fix gone? In 1.5.6 this bug still exists. Is it only available for KDE 4?

Best Regards
Thomas
Comment 8 Oliver Kellogg 2007-03-27 12:45:43 UTC
> In which version of Umbrello is this fix gone?

1.5.7 was not yet released but you can grab the SVN wavefront, see

  http://uml.sourceforge.net/install.php#source-code

Comment 9 Haeber 2007-04-06 12:07:32 UTC
I tested the svn version and it works. Thanks.

Best Regards
Thomas