]>
src.bluestatic.org Git - bugdar.git/blob - api_bug.php
9f07233b7c6567f8f2a5f68c8062f4a380fa9596
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
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, esverity, status, and resolution should throw a
28 * verification error, they actually set it to the default value
30 * @author Iris Studios, Inc.
31 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
36 class BugAPI
extends API
44 'bugid' => array(TYPE_UINT
, REQ_AUTO
, 'verify_nozero'),
45 'userid' => array(TYPE_UINT
, REQ_NO
),
46 'dateline' => array(TYPE_UINT
, REQ_SET
),
47 'productid' => array(TYPE_UINT
, REQ_YES
, ':self'),
48 'componentid' => array(TYPE_UINT
, REQ_NO
, ':self'),
49 'versionid' => array(TYPE_UINT
, REQ_YES
, ':self'),
50 'summary' => array(TYPE_STR
, REQ_YES
, 'verify_noempty'),
51 'priority' => array(TYPE_UINT
, REQ_NO
, ':self'),
52 'severity' => array(TYPE_UINT
, REQ_NO
, ':self'),
53 'status' => array(TYPE_UINT
, REQ_NO
, ':self'),
54 'resolution' => array(TYPE_UINT
, REQ_NO
, ':self'),
55 'assignedto' => array(TYPE_UINT
, REQ_NO
, ':self', array('includes/api_user.php', 'UserAPI')),
56 'duplicateof' => array(TYPE_STR
, REQ_NO
),
57 'dependency' => array(TYPE_STR
, REQ_NO
),
58 'hidden' => array(TYPE_BOOL
, REQ_NO
),
59 'initialreport' => array(TYPE_UINT
, REQ_NO
),
60 'lastposttime' => array(TYPE_UINT
, REQ_NO
),
61 'lastpostby' => array(TYPE_UINT
, REQ_NO
),
62 'hiddenlastposttime' => array(TYPE_UINT
, REQ_NO
),
63 'hiddenlastpostby' => array(TYPE_UINT
, REQ_NO
)
78 var $prefix = TABLE_PREFIX
;
80 // ###################################################################
86 function set_dateline()
88 $this->set('dateline', time());
91 // ###################################################################
97 function post_insert()
99 $this->registry
->db
->query("INSERT INTO " . TABLE_PREFIX
. "vote (bugid, votefor, voteagainst) VALUES (" . $this->insertid
. ", 0, 0)");
102 // ###################################################################
108 function verify_productid()
110 $this->verify_nozero('productid');
112 if (!$this->registry
->datastore
['product'][ $this->values
['productid'] ])
119 // ###################################################################
121 * Verify: componentid
125 function verify_componentid()
127 if ($this->values
['componentid'] != 0)
129 $product = $this->registry
->datastore
['product'][ $this->values
['product'] ];
130 $version = $this->registry
->datastore
['version'][ $this->values
['version'] ];
131 if ($component['componentmother'] != $product['productid'])
135 if (($version['productid'] != $component['productid'] AND $version['productid'] != $product['productid']) AND $version['productid'] != 0)
143 // ###################################################################
149 function verify_versionid()
151 $this->verify_nozero('versionid');
153 if (!$this->registry
->datastore
['version'][ $this->values
['versionid'] ])
160 // ###################################################################
166 function verify_priority()
168 if (!$this->registry
->datastore
['priority'][ $this->values
['priority'] ])
170 $this->set('priority', $this->registry
->options
['defaultpriority']);
175 // ###################################################################
181 function verify_severity()
183 if (!$this->registry
->datastore
['severity'][ $this->values
['severity'] ])
185 $this->set('severity', $this->registry
->options
['defaultseverity']);
190 // ###################################################################
196 function verify_status()
198 if (!$this->registry
->datastore
['status'][ $this->values
['status'] ])
200 $this->set('status', $this->registry
->options
['defaultstatus']);
205 // ###################################################################
211 function verify_resolution()
213 if (!$this->registry
->datastore
['resolution'][ $this->values
['resolution'] ])
215 $this->set('resolution', $this->registry
->options
['defaultresolve']);
220 // ###################################################################
226 function verify_assignedto()
228 if (!$this->registry
->datastore
['assignto'][ $this->values
['assignedto'] ] AND $this->values
['assignedto'] != 0)
230 $this->set('assignedto', $this->registry
->options
['defaultassign']);
236 /*=====================================================================*\
237 || ###################################################################
240 || ###################################################################
241 \*=====================================================================*/