Switch the 'modify' code of admin/field.php to use templates
[bugdar.git] / editreport.php
index ea84e938f33f86ce788e11887a4046c4733ab779..09d941e46e1c4a76a984cab299131140433c990f 100644 (file)
@@ -19,7 +19,6 @@
 || ###################################################################
 \*=====================================================================*/
 
-define('SVN', '$Id$');
 
 $focus['showreport'] = 'focus';
 
@@ -29,9 +28,6 @@ require_once('./includes/class_notification.php');
 require_once('./includes/api_bug.php');
 require_once('./includes/api_comment.php');
 
-require_once('./includes/class_api_error.php');
-APIError(array(new API_Error_Handler($message), 'user_cumulative'));
-
 $bug = $db->queryFirst("
        SELECT bug.*, user.email, user.displayname, user.showemail
        FROM " . TABLE_PREFIX . "bug AS bug
@@ -52,15 +48,13 @@ if (!check_bug_permissions($bug))
 
 // setup logging
 require_once('./includes/class_logging.php');
-$log = new Logging;
-$log->set_bugid($bug['bugid']);
+$log = new Logging();
+$log->setBugId($bug['bugid']);
 
-$notif = new NotificationCenter;
+$notif = new NotificationCenter();
 
 $bugapi = new BugAPI();
-$bugapi->set('bugid',          $input->in['bugid']);
-$bugapi->set_condition();
-$bugapi->dorelations = array();
+$bugapi->set('bugid', $input->in['bugid']);
 $bugapi->fetch();
 
 // ###################################################################
@@ -72,7 +66,7 @@ if ($_POST['do'] == 'kill')
                $message->errorPermission();
        }
        
-       $bugapi->delete();
+       $bugapi->remove();
        
        $message->redirect(T('The entire bug has been deleted.'), 'index.php');
 }
@@ -93,12 +87,12 @@ if ($_REQUEST['do'] == 'delete')
 
 if ($_POST['do'] == 'update')
 {
-       if (!((can_perform('caneditown', $bug['product']) AND bugdar::$userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND bugdar::$userinfo['userid'] != $bug['userid'])) AND !can_perform('canpostcomments', $bug['product']))
+       if (!((can_perform('caneditown', $bug['product']) && bugdar::$userinfo['userid'] == $bug['userid']) || (can_perform('caneditother', $bug['product']) && bugdar::$userinfo['userid'] != $bug['userid'])) && !can_perform('canpostcomments', $bug['product']))
        {
                $message->errorPermission();
        }
        
-       $log->add_data(true, $bugapi->record, $log->getCommonFields(), true);
+       $log->addData(true, $bugapi->record, $log->getCommonFields(), true);
        
        // -------------------------------------------------------------------
        // handle automations
@@ -152,8 +146,8 @@ if ($_POST['do'] == 'update')
                $comment->insert();
                
                // we redefine the bug data later, but it needs to be here in order to generate the user list
-               $notif->set_bug_data($bugapi->record);
-               $notif->send_new_comment_notice($comment->values);
+               $notif->setBugData($bugapi->record);
+               $notif->sendNewCommentNotice($comment->values);
                
                $bugapi->set('lastposttime',                    $comment->values['dateline']);
                $bugapi->set('lastpostby',                              bugdar::$userinfo['userid']);
@@ -175,7 +169,7 @@ if ($_POST['do'] == 'update')
        $dependencies = preg_split('#([^0-9].*?)#', $input->in['dependency'], -1, PREG_SPLIT_NO_EMPTY);
        $dependencies = ((sizeof($dependencies) < 1) ? '' : implode(', ', $dependencies));
        
-       if ((can_perform('caneditown', $bug['product']) AND bugdar::$userinfo['userid'] == $bug['userid']) OR (can_perform('caneditother', $bug['product']) AND bugdar::$userinfo['userid'] != $bug['userid']))
+       if ((can_perform('caneditown', $bug['product']) && bugdar::$userinfo['userid'] == $bug['userid']) || (can_perform('caneditother', $bug['product']) && bugdar::$userinfo['userid'] != $bug['userid']))
        {
                $bugapi->set('summary',         $input->in['summary']);
                $bugapi->set('severity',        $input->in['severity']);
@@ -205,8 +199,8 @@ if ($_POST['do'] == 'update')
        // -------------------------------------------------------------------
        // handle logging and perform updates
        
-       $notif->set_bug_data($bugapi->record, array_merge($bugapi->record, $bugapi->values));
-       $log->add_data(false, $bugapi->values, $log->getCommonFields(), true);
+       $notif->setBugData($bugapi->record, array_merge($bugapi->record, $bugapi->values));
+       $log->addData(false, $bugapi->values, $log->getCommonFields(), true);
        
        if (!$message->hasErrors())
        {
@@ -220,19 +214,13 @@ if ($_POST['do'] == 'update')
        // -------------------------------------------------------------------
        // do diff history
 
-       $log->update_history();
+       $log->updateHistory();
        
-       $notif->send_bug_changes_notice();
+       $notif->sendBugChangeNotice();
        
        $notif->finalize();
        
        $message->redirect(T('Your changes to the bug have been saved.'), "showreport.php?bugid=$bug[bugid]");
 }
 
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
 ?>
\ No newline at end of file