From 0989ce7cb8b132b7824c1b934c8ed88d0522a400 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 6 Sep 2008 15:50:37 -0400 Subject: [PATCH] Update api_severity.php --- includes/api_severity.php | 80 ++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/includes/api_severity.php b/includes/api_severity.php index cfff5c2..103ad80 100644 --- a/includes/api_severity.php +++ b/includes/api_severity.php @@ -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); } } -- 2.22.5