Remove the verifiers from the field list
[bugdar.git] / includes / api_priority.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright ©2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 require_once ISSO . '/Api.php';
23 require_once('./includes/functions_datastore.php');
24
25 /**
26 * API: Priority
27 *
28 * @author Blue Static
29 * @copyright Copyright ©2002 - 2007, Blue Static
30 * @version $Revision$
31 * @package Bugdar
32 *
33 */
34 class PriorityAPI extends BSApi
35 {
36 /**
37 * Fields
38 * @var array
39 */
40 protected $fields = array(
41 'priorityid' => array(TYPE_UINT, REQ_AUTO),
42 'priority' => array(TYPE_STR, REQ_YES),
43 'displayorder' => array(TYPE_INT, REQ_NO)
44 );
45
46 /**
47 * Database table
48 * @var string
49 */
50 protected $table = 'priority';
51
52 /**
53 * Table prefix
54 * @var string
55 */
56 protected $prefix = TABLE_PREFIX;
57
58 /**
59 * Post-insert
60 */
61 protected function post_insert()
62 {
63 build_priorities();
64 }
65
66 /**
67 * Post-update
68 */
69 protected function post_update()
70 {
71 build_priorities();
72 }
73
74 /**
75 * Post-delete
76 */
77 protected function post_delete()
78 {
79 build_priorities();
80 BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . bugdar::$options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']);
81 }
82
83 /**
84 * Validate: priorityid
85 */
86 protected function validate_priorityid($field)
87 {
88 return $this->_verifyIsNotZero($field);
89 }
90
91 /**
92 * Validate: priority
93 */
94 protected function validate_priority($field)
95 {
96 return $this->_verifyIsNotEmpty($field);
97 }
98 }
99
100 /*=====================================================================*\
101 || ###################################################################
102 || # $HeadURL$
103 || # $Id$
104 || ###################################################################
105 \*=====================================================================*/
106 ?>