# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Mantis is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------
# $Id: manage_custom_field_proj_add.php,v 1.2.2.1 2007-10-13 22:33:29 giallu Exp $
# --------------------------------------------------------
require_once 'core.php';
form_security_validate('manage_custom_field_proj_add');
auth_reauthenticate();
$f_field_id = gpc_get_int('field_id');
$f_project_id = gpc_get_int_array('project_id', array());
$f_sequence = gpc_get_int('sequence');
$t_manage_project_threshold = config_get('manage_project_threshold');
foreach ($f_project_id as $t_proj_id) {
    if (access_has_project_level($t_manage_project_threshold, $t_proj_id)) {
        if (!custom_field_is_linked($f_field_id, $t_proj_id)) {
            custom_field_link($f_field_id, $t_proj_id);
        }
        custom_field_set_sequence($f_field_id, $t_proj_id, $f_sequence);
    }
}
form_security_purge('manage_custom_field_proj_add');
print_header_redirect('manage_custom_field_edit_page.php?field_id=' . $f_field_id);
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_once 'custom_field_api.php';
form_security_validate('manage_proj_custom_field_update');
auth_reauthenticate();
$f_field_id = gpc_get_int('field_id');
$f_project_id = gpc_get_int('project_id');
$f_sequence = gpc_get_int('sequence');
# We should check both since we are in the project section and an
#  admin might raise the first threshold and not realize they need
#  to raise the second
access_ensure_project_level(config_get('manage_project_threshold'), $f_project_id);
access_ensure_project_level(config_get('custom_field_link_threshold'), $f_project_id);
custom_field_set_sequence($f_field_id, $f_project_id, $f_sequence);
form_security_purge('manage_proj_custom_field_update');
$t_redirect_url = 'manage_proj_edit_page.php?project_id=' . $f_project_id;
html_page_top(null, $t_redirect_url);
?>
<br />
<div align="center">
<?php 
echo lang_get('operation_successful') . '<br />';
print_bracket_link($t_redirect_url, lang_get('proceed'));
?>
</div>

<?php 
html_page_bottom();
Ejemplo n.º 3
0
function project_copy_custom_fields($p_destination_id, $p_source_id)
{
    $t_custom_field_ids = custom_field_get_linked_ids($p_source_id);
    foreach ($t_custom_field_ids as $t_custom_field_id) {
        if (!custom_field_is_linked($t_custom_field_id, $p_destination_id)) {
            custom_field_link($t_custom_field_id, $p_destination_id);
            $t_sequence = custom_field_get_sequence($t_custom_field_id, $p_source_id);
            custom_field_set_sequence($t_custom_field_id, $p_destination_id, $t_sequence);
        }
    }
}