splitbrain / dokuwiki-plugin-bureaucracy

Create forms and generate pages or emails from them
http://www.dokuwiki.org/plugin:bureaucracy
GNU General Public License v2.0
43 stars 47 forks source link

Fix replacedate to handle empty input; see Issue #192 #236

Closed tomio13 closed 6 years ago

tomio13 commented 6 years ago

DATE() will return 1970-01-01 for an empty input. Now, if using a year or part of the date to create namespaces dynamically, this can throw things quite off. This patch adds a check if the supplied date is empty or the strototime() throws an error, and returns an empty string for this case.

This behavior is especially useful for complex forms, where multiple input is possible for the date, and either one or the other is valid only. In my example, running projects and planned projects evaluate differently, and the namespace is composed dynamically based on the input.