]>
src.bluestatic.org Git - bugdar.git/blob - api_bug.php
66c62a32fdfb1aada851766aebc3a77fe3167284
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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 [#]gpl[#] of the License.
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
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 \*=====================================================================*/
22 $GLOBALS['isso:callback']->load('api', null);
27 * Note: When priority, severity, status, and resolution should throw a
28 * verification error, they actually set it to the default value
31 * @copyright Copyright ©2002 - [#]year[#], Blue Static
36 class BugAPI
extends API
44 'bugid' => array(TYPE_UINT
, REQ_AUTO
, 'verify_nozero'),
45 'userid' => array(TYPE_UINT
, REQ_NO
),
46 'username' => array(TYPE_STR
, REQ_NO
),
47 'dateline' => array(TYPE_UINT
, REQ_SET
),
48 'product' => array(TYPE_UINT
, REQ_YES
, ':self'),
49 'component' => array(TYPE_UINT
, REQ_NO
, ':self'),
50 'version' => array(TYPE_UINT
, REQ_YES
, ':self'),
51 'summary' => array(TYPE_STR
, REQ_YES
, 'verify_noempty'),
52 'priority' => array(TYPE_UINT
, REQ_NO
, ':self'),
53 'severity' => array(TYPE_UINT
, REQ_NO
, ':self'),
54 'status' => array(TYPE_UINT
, REQ_NO
, ':self'),
55 'resolution' => array(TYPE_UINT
, REQ_NO
, ':self'),
56 'assignedto' => array(TYPE_UINT
, REQ_NO
, ':self', array('includes/api_user.php', 'UserAPI')),
57 'duplicateof' => array(TYPE_STR
, REQ_NO
),
58 'dependency' => array(TYPE_STR
, REQ_NO
),
59 'hidden' => array(TYPE_BOOL
, REQ_NO
),
60 'initialreport' => array(TYPE_UINT
, REQ_NO
),
61 'lastposttime' => array(TYPE_UINT
, REQ_NO
),
62 'lastpostby' => array(TYPE_UINT
, REQ_NO
),
63 'lastpostbyname' => array(TYPE_STR
, REQ_NO
),
64 'hiddenlastposttime' => array(TYPE_UINT
, REQ_NO
),
65 'hiddenlastpostby' => array(TYPE_UINT
, REQ_NO
),
66 'hiddenlastpostbyname' => array(TYPE_STR
, REQ_NO
)
81 var $prefix = TABLE_PREFIX
;
83 // ###################################################################
89 function set_dateline()
91 $this->set('dateline', time());
94 // ###################################################################
100 function post_insert()
102 $this->registry
->db
->query("INSERT INTO " . TABLE_PREFIX
. "vote (bugid, votefor, voteagainst) VALUES (" . $this->insertid
. ", 0, 0)");
105 // ###################################################################
111 function post_delete()
113 $this->registry
->db
->query("DELETE FROM " . TABLE_PREFIX
. "bugvaluefill WHERE bugid = " . $this->values
['bugid']);
114 $this->registry
->db
->query("DELETE FROM " . TABLE_PREFIX
. "comment WHERE bugid = " . $this->values
['bugid']);
115 $this->registry
->db
->query("DELETE FROM " . TABLE_PREFIX
. "favorite WHERE bugid = " . $this->values
['bugid']);
116 $this->registry
->db
->query("DELETE FROM " . TABLE_PREFIX
. "history WHERE bugid = " . $this->values
['bugid']);
117 $this->registry
->db
->query("DELETE FROM " . TABLE_PREFIX
. "vote WHERE bugid = " . $this->values
['bugid']);
120 // ###################################################################
126 function verify_product()
128 if (!($nozero = $this->verify_nozero('product')))
133 if (!$this->registry
->datastore
['product'][ $this->values
['product'] ])
140 // ###################################################################
142 * Verify: componentid
146 function verify_component()
148 if ($this->values
['component'] != 0)
150 $component = $this->registry
->datastore
['component'][ $this->values
['component'] ];
151 $product = $this->registry
->datastore
['product'][ $this->values
['product'] ];
152 $version = $this->registry
->datastore
['version'][ $this->values
['version'] ];
153 if ($component['parentid'] != $product['productid'])
157 if (($version['productid'] != $component['productid'] AND $version['productid'] != $product['productid']) AND $version['productid'] != 0)
165 // ###################################################################
171 function verify_version()
173 if (!($nozero = $this->verify_nozero('version')))
178 if (!$this->registry
->datastore
['version'][ $this->values
['version'] ])
185 // ###################################################################
191 function verify_priority()
193 if (!$this->registry
->datastore
['priority'][ $this->values
['priority'] ])
195 $this->set('priority', $this->registry
->options
['defaultpriority']);
200 // ###################################################################
206 function verify_severity()
208 if (!$this->registry
->datastore
['severity'][ $this->values
['severity'] ])
210 $this->set('severity', $this->registry
->options
['defaultseverity']);
215 // ###################################################################
221 function verify_status()
223 if (!$this->registry
->datastore
['status'][ $this->values
['status'] ])
225 $this->set('status', $this->registry
->options
['defaultstatus']);
230 // ###################################################################
236 function verify_resolution()
238 if (!$this->registry
->datastore
['resolution'][ $this->values
['resolution'] ])
240 $this->set('resolution', $this->registry
->options
['defaultresolve']);
245 // ###################################################################
251 function verify_assignedto()
253 if (!$this->registry
->datastore
['assignto'][ $this->values
['assignedto'] ] AND $this->values
['assignedto'] != 0)
255 $this->set('assignedto', $this->registry
->options
['defaultassign']);
261 /*=====================================================================*\
262 || ###################################################################
265 || ###################################################################
266 \*=====================================================================*/