This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  aae19fa8f9296e676cbc0252c41063f3a7308698 (commit)
       via  0c54dfee1d9d5937a4ac3487c615a68adfb4dc78 (commit)
      from  f2189356391c823f39ec9dfc8011fd837f3b6103 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=aae19fa8f9296e676cbc0252c41063f3a7308698

commit aae19fa8f9296e676cbc0252c41063f3a7308698
Merge: f218935 0c54dfe
Author: Franck Villaume <[email protected]>
Date:   Thu Apr 20 22:49:24 2017 +0200

    Merge remote-tracking branch 'bredt/master'


https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=0c54dfee1d9d5937a4ac3487c615a68adfb4dc78

commit 0c54dfee1d9d5937a4ac3487c615a68adfb4dc78
Author: Stéphane-Eymeric Bredthauer <[email protected]>
Date:   Thu Apr 20 15:29:57 2017 +0200

    Tracker: new function datetime_sub for formula

diff --git a/src/common/tracker/ArtifactExpression.class.php 
b/src/common/tracker/ArtifactExpression.class.php
index 00aa49a..c939dba 100644
--- a/src/common/tracker/ArtifactExpression.class.php
+++ b/src/common/tracker/ArtifactExpression.class.php
@@ -60,14 +60,16 @@ class ArtifactExpression extends FFError {
 
        public function __construct()
        {
-               $this->functionsDescription['in_array'] = _('Test if a value is 
in an (json) array');
-               $this->functionsDescription['datetime_add'] = _('Add to a 
date/time a duration (duration in ISO 8601 Format)');
+               $this->functionsDescription['in_array'] = _('Checks if a value 
exists in an (json) array');
+               $this->functionsDescription['datetime_add'] = _('Adds to a 
date/time a duration (duration in ISO 8601 Format)');
+               $this->functionsDescription['datetime_sub'] = _('Subtracts to a 
date/time a duration (duration in ISO 8601 Format)');
                $this->functionsDescription['intval'] = _('Get the integer 
value of a variable');
                $this->expression = new Expression;
                $this->expression->suppress_errors = true;
                $this->expression->fb = array();
                $this->expression->functions ['in_array'] = 'expr_in_array';
                $this->expression->functions ['datetime_add'] = 
'expr_datetime_add';
+               $this->expression->functions ['datetime_sub'] = 
'expr_datetime_sub';
                $this->expression->functions ['intval'] = 'expr_intval';
        }
 
@@ -148,6 +150,22 @@ function expr_datetime_add($datetime, $interval) {
        return $dateTimeObj->format(_('Y-m-d H:i'));
 }
 
+function expr_datetime_sub($datetime, $interval) {
+       if (!trim($datetime)) {
+               return '';
+       }
+       $dateTimeObj = DateTime::createFromFormat(_('Y-m-d H:i'), $datetime);
+       if (!$dateTimeObj) {
+               return '';
+       }
+       $intervalObj = new DateInterval($interval);
+       if (!$intervalObj) {
+               return '';
+       }
+       $dateTimeObj->sub($intervalObj);
+       return $dateTimeObj->format(_('Y-m-d H:i'));
+}
+
 function expr_intval($value) {
        return intval($value);
 }

-----------------------------------------------------------------------

Summary of changes:
 src/common/tracker/ArtifactExpression.class.php | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to