From 1dad9e0456f8feb694b203d03a30d64ef50f5e32 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 6 Sep 2008 15:45:07 -0400 Subject: [PATCH] Update api_status.php --- includes/api_status.php | 78 ++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/includes/api_status.php b/includes/api_status.php index fea567d..697fe3d 100644 --- a/includes/api_status.php +++ b/includes/api_status.php @@ -19,7 +19,7 @@ || ################################################################### \*=====================================================================*/ -$GLOBALS['isso:callback']->load('api', null); +require_once ISSO . '/Api.php'; require_once('./includes/functions_datastore.php'); @@ -32,66 +32,70 @@ require_once('./includes/functions_datastore.php'); * @package Bugdar * */ -class StatusAPI extends API +class StatusAPI extends BSApi { /** - * Fields - * @var array - * @access private - */ - var $fields = array( - 'statusid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), - 'status' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + * Fields + * @var array + */ + protected $fields = array( + 'statusid' => array(TYPE_UINT, REQ_AUTO), + 'status' => array(TYPE_STR, REQ_YES), 'color' => array(TYPE_STR, REQ_NO), 'displayorder' => array(TYPE_INT, REQ_NO) ); /** - * Database table - * @var string - * @access private - */ - var $table = 'status'; + * Database table + * @var string + */ + protected $table = 'status'; /** - * Table prefix - * @var string - * @access private - */ - var $prefix = TABLE_PREFIX; + * Table prefix + * @var string + */ + protected $prefix = TABLE_PREFIX; - // ################################################################### /** - * Post-insert - * - * @access protected - */ + * Post-insert + */ function post_insert() { build_statuses(); } - // ################################################################### /** - * Post-update - * - * @access protected - */ - function post_update() + * Post-update + */ + protected function post_update() { build_statuses(); } - // ################################################################### /** - * Post-delete - * - * @access protected - */ - function post_delete() + * Post-delete + */ + protected function post_delete() { build_statuses(); - $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); + BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']); + } + + /** + * Validate: statusid + */ + protected function validate_statusid($field) + { + return $this->_verifyIsNotZero($field); + } + + /** + * Validate: status + */ + protected function validate_status($field) + { + return $this->_verifyIsNotEmpty($field); } } -- 2.22.5