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  42bd93c9575ba10dabed9a42cf3c827f79aaf68e (commit)
      from  babfe2fe0d6c2244ac7bdb693cd2268c1389709a (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=42bd93c9575ba10dabed9a42cf3c827f79aaf68e

commit 42bd93c9575ba10dabed9a42cf3c827f79aaf68e
Author: Marc-Etienne Vargenau <[email protected]>
Date:   Fri Mar 24 18:05:32 2017 +0100

    Disallow creating a category with an empty name

diff --git a/src/www/pm/admin/index.php b/src/www/pm/admin/index.php
index 1ed7801..956738b 100644
--- a/src/www/pm/admin/index.php
+++ b/src/www/pm/admin/index.php
@@ -84,20 +84,23 @@ if (getStringFromRequest('post_changes')) {
 
        } elseif ($add_cat) {
                $name = getStringFromRequest('name');
-
                /*
                        Add a project_category
                */
                session_require_perm ('pm', $pg->getID(), 'manager') ;
 
-               $pc = new ProjectCategory($pg);
-               if (!$pc || !is_object($pc)) {
-                       exit_error(_('Unable to create ProjectCategory 
Object'),'pm');
+               if (trim($name) == '') {
+                       $error_msg .= _('Name is required');
                } else {
-                       if (!$pc->create($name)) {
-                               $error_msg .= _('Insert Error')._(': 
').$pc->getErrorMessage();
+                       $pc = new ProjectCategory($pg);
+                       if (!$pc || !is_object($pc)) {
+                               exit_error(_('Unable to create ProjectCategory 
Object'),'pm');
                        } else {
-                               $feedback .= _('Category Inserted');
+                               if (!$pc->create($name)) {
+                                       $error_msg .= _('Insert Error')._(': 
').$pc->getErrorMessage();
+                               } else {
+                                       $feedback .= _('Category Inserted');
+                               }
                        }
                }
 
@@ -200,6 +203,9 @@ if ($add_cat && $group_project_id) {
        } else {
                echo $HTML->information(_('No categories defined'));
        }
+       ?>
+       <p class="important"><?php echo _('Once you add a category, it cannot 
be deleted') ?></p>
+       <?php
        echo $HTML->openForm(array('action' => 
'/pm/admin/?group_id='.$group_id, 'method' => 'post'));
        ?>
        <p>
@@ -210,7 +216,6 @@ if ($add_cat && $group_project_id) {
        </label>
        <input id="name" required="required" type="text" name="name" value="" />
        </p>
-       <p class="important"><?php echo _('Once you add a category, it cannot 
be deleted') ?></p>
        <p><input type="submit" name="post_changes" value="<?php echo 
_('Submit') ?>" /></p>
        <?php
        echo $HTML->closeForm();

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

Summary of changes:
 src/www/pm/admin/index.php | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 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