Update api_severity.php
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 19:50:37 +0000 (15:50 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 19:50:37 +0000 (15:50 -0400)
includes/api_severity.php

index cfff5c2700389162382b8a1c460412e6e2f9791e..103ad809a79f52972427dbdcd668e9064eee6ce0 100644 (file)
@@ -19,7 +19,7 @@
 || ###################################################################
 \*=====================================================================*/
 
-$GLOBALS['isso:callback']->load('api', null);
+require_once ISSO . '/Api.php';
 
 require_once('./includes/functions_datastore.php');
 
@@ -32,65 +32,69 @@ require_once('./includes/functions_datastore.php');
 * @package             Bugdar
 * 
 */
-class SeverityAPI extends API
+class SeverityAPI extends BSApi
 {
        /**
-       * Fields
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'severityid'    => array(TYPE_UINT,             REQ_AUTO,       'verify_nozero'),
-               'severity'              => array(TYPE_STR,              REQ_YES,        'verify_noempty'),
+        * Fields
+        * @var array
+        */
+       protected $fields = array(
+               'severityid'    => array(TYPE_UINT,             REQ_AUTO),
+               'severity'              => array(TYPE_STR,              REQ_YES),
                'displayorder'  => array(TYPE_INT,              REQ_NO)
        );
        
        /**
-       * Database table
-       * @var  string
-       * @access       private
-       */
-       var $table = 'severity';
+        * Database table
+        * @var string
+        */
+       protected $table = 'severity';
        
        /**
-       * Table prefix
-       * @var  string
-       * @access       private
-       */
-       var $prefix = TABLE_PREFIX;
+        * Table prefix
+        * @var string
+        */
+       protected $prefix = TABLE_PREFIX;
        
-       // ###################################################################
        /**
-       * Post-insert
-       *
-       * @access       protected
-       */
-       function post_insert()
+        * Post-insert
+        */
+       protected function post_insert()
        {
                build_severities();
        }
        
-       // ###################################################################
        /**
-       * Post-update
-       *
-       * @access       protected
-       */
-       function post_update()
+        * Post-update
+        */
+       protected function post_update()
        {
                build_severities();
        }
        
-       // ###################################################################
        /**
-       * Post-delete
-       *
-       * @access       protected
-       */
-       function post_delete()
+        * Post-delete
+        */
+       protected function post_delete()
        {
                build_severities();
-               $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . bugdar::$options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']);
+               BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET severity = " . bugdar::$options['defaultseverity'] . " WHERE severity = " . $this->values['severityid']);
+       }
+       
+       /**
+        * Validate: severityid
+        */
+       protected function validate_statusid($field)
+       {
+               return $this->_verifyIsNotZero($field);
+       }
+       
+       /**
+        * Validate: severity
+        */
+       protected function validate_status($field)
+       {
+               return $this->_verifyIsNotEmpty($field);
        }
 }