$t_total_sponsorship = bug_get_field($f_bug_id, 'sponsorship_total');
    if ($t_total_sponsorship > 0) {
        ?>
	<tr class="row-2">
		<th class="category" width="15%"><?php 
        echo lang_get('sponsors_list');
        ?>
</th>
		<td>
		<?php 
        echo sprintf(lang_get('total_sponsorship_amount'), sponsorship_format_amount($t_total_sponsorship));
        if (access_has_bug_level(config_get('view_sponsorship_details_threshold'), $f_bug_id)) {
            echo '<br /><br />';
            $i = 0;
            foreach ($t_sponsorship_ids as $id) {
                $t_sponsorship = sponsorship_get($id);
                $t_date_added = date(config_get('normal_date_format'), $t_sponsorship->date_submitted);
                echo $i > 0 ? '<br />' : '';
                $i++;
                echo sprintf(lang_get('label'), $t_date_added) . lang_get('word_separator');
                print_user($t_sponsorship->user_id);
                echo ' (' . sponsorship_format_amount($t_sponsorship->amount) . ')';
                if (access_has_bug_level(config_get('handle_sponsored_bugs_threshold'), $f_bug_id)) {
                    echo ' ' . get_enum_element('sponsorship', $t_sponsorship->paid);
                }
            }
        }
        ?>
		</td>
		</tr>
<?php 
Ejemplo n.º 2
0
    echo lang_get('amount');
    ?>
</td>
		<td class="form-title"><?php 
    echo lang_get('status');
    ?>
</td>
	</tr>
<?php 
    $t_bug_list = array();
    $t_total_owing = 0;
    $t_total_paid = 0;
    for ($i = 0; $i < $t_sponsor_count; ++$i) {
        $t_sponsor_row = $t_sponsors[$i];
        $t_bug = bug_get($t_sponsor_row['bug']);
        $t_sponsor = sponsorship_get($t_sponsor_row['sponsor']);
        $t_buglist[] = $t_sponsor_row['bug'] . ':' . $t_sponsor_row['sponsor'];
        # describe bug
        $t_status = string_attribute(get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id));
        $t_resolution = string_attribute(get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id));
        $t_version_id = version_get_id($t_bug->fixed_in_version, $t_bug->project_id);
        if (false !== $t_version_id && VERSION_RELEASED == version_get_field($t_version_id, 'released')) {
            $t_released_label = '<a title="' . lang_get('released') . '">' . $t_bug->fixed_in_version . '</a>';
        } else {
            $t_released_label = $t_bug->fixed_in_version;
        }
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        echo '<tr class="' . $t_status_label . '">';
        echo '<td><a href="' . string_get_bug_view_url($t_sponsor_row['bug']) . '">' . bug_format_id($t_sponsor_row['bug']) . '</a></td>';
        echo '<td>' . string_display_line(project_get_field($t_bug->project_id, 'name')) . '&#160;</td>';
Ejemplo n.º 3
0
/**
 * updates the paid field
 * @param int $p_sponsorship_id
 * @param int $p_paid
 * @return true
 */
function sponsorship_update_paid($p_sponsorship_id, $p_paid)
{
    $c_sponsorship_id = db_prepare_int($p_sponsorship_id);
    $t_sponsorship = sponsorship_get($c_sponsorship_id);
    $c_paid = db_prepare_int($p_paid);
    $t_sponsorship_table = db_get_table('sponsorship');
    $query = "UPDATE {$t_sponsorship_table}\n\t\t\t\t  SET last_updated= " . db_param() . ", paid=" . db_param() . "\n\t\t\t\t  WHERE id=" . db_param();
    db_query_bound($query, array(db_now(), $c_paid, $c_sponsorship_id));
    history_log_event_special($t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid);
    sponsorship_clear_cache($p_sponsorship_id);
    return true;
}
Ejemplo n.º 4
0
/**
 * Build the bug raw data visible for specified user to be translated and sent by email to the user
 * (Filter the bug data according to user access level)
 * return array with bug data. See usage in email_format_bug_message(...)
 * @param int $p_user_id
 * @param int $p_bug_id
 * @param string $p_message_id
 * @return array
 */
function email_build_visible_bug_data($p_user_id, $p_bug_id, $p_message_id)
{
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_user_access_level = user_get_access_level($p_user_id, $t_project_id);
    $t_user_bugnote_order = user_pref_get_pref($p_user_id, 'bugnote_order');
    $t_user_bugnote_limit = user_pref_get_pref($p_user_id, 'email_bugnote_limit');
    $row = bug_get_extended_row($p_bug_id);
    $t_bug_data = array();
    $t_bug_data['email_bug'] = $p_bug_id;
    if ($p_message_id !== 'email_notification_title_for_action_bug_deleted') {
        $t_bug_data['email_bug_view_url'] = string_get_bug_view_url_with_fqdn($p_bug_id);
    }
    if (access_compare_level($t_user_access_level, config_get('view_handler_threshold'))) {
        if (0 != $row['handler_id']) {
            $t_bug_data['email_handler'] = user_get_name($row['handler_id']);
        } else {
            $t_bug_data['email_handler'] = '';
        }
    }
    $t_bug_data['email_reporter'] = user_get_name($row['reporter_id']);
    $t_bug_data['email_project_id'] = $row['project_id'];
    $t_bug_data['email_project'] = project_get_field($row['project_id'], 'name');
    $t_category_name = category_full_name($row['category_id'], false);
    $t_bug_data['email_category'] = $t_category_name;
    $t_bug_data['email_date_submitted'] = $row['date_submitted'];
    $t_bug_data['email_last_modified'] = $row['last_updated'];
    $t_bug_data['email_status'] = $row['status'];
    $t_bug_data['email_severity'] = $row['severity'];
    $t_bug_data['email_priority'] = $row['priority'];
    $t_bug_data['email_reproducibility'] = $row['reproducibility'];
    $t_bug_data['email_resolution'] = $row['resolution'];
    $t_bug_data['email_fixed_in_version'] = $row['fixed_in_version'];
    if (!is_blank($row['target_version']) && access_compare_level($t_user_access_level, config_get('roadmap_view_threshold'))) {
        $t_bug_data['email_target_version'] = $row['target_version'];
    }
    $t_bug_data['email_summary'] = $row['summary'];
    $t_bug_data['email_description'] = $row['description'];
    $t_bug_data['email_additional_information'] = $row['additional_information'];
    $t_bug_data['email_steps_to_reproduce'] = $row['steps_to_reproduce'];
    $t_bug_data['set_category'] = '[' . $t_bug_data['email_project'] . '] ' . $t_category_name;
    $t_bug_data['custom_fields'] = custom_field_get_linked_fields($p_bug_id, $t_user_access_level);
    $t_bug_data['bugnotes'] = bugnote_get_all_visible_bugnotes($p_bug_id, $t_user_bugnote_order, $t_user_bugnote_limit, $p_user_id);
    # put history data
    if (ON == config_get('history_default_visible') && access_compare_level($t_user_access_level, config_get('view_history_threshold'))) {
        $t_bug_data['history'] = history_get_raw_events_array($p_bug_id, $p_user_id);
    }
    # Sponsorship Information
    if (config_get('enable_sponsorship') == ON && access_has_bug_level(config_get('view_sponsorship_total_threshold'), $p_bug_id, $p_user_id)) {
        $t_sponsorship_ids = sponsorship_get_all_ids($p_bug_id);
        $t_bug_data['sponsorship_total'] = sponsorship_get_amount($t_sponsorship_ids);
        if (access_has_bug_level(config_get('view_sponsorship_details_threshold'), $p_bug_id, $p_user_id)) {
            $t_bug_data['sponsorships'] = array();
            foreach ($t_sponsorship_ids as $id) {
                $t_bug_data['sponsorships'][] = sponsorship_get($id);
            }
        }
    }
    $t_bug_data['relations'] = relationship_get_summary_text($p_bug_id);
    return $t_bug_data;
}
Ejemplo n.º 5
0
require_api('gpc_api.php');
require_api('html_api.php');
require_api('lang_api.php');
require_api('print_api.php');
require_api('sponsorship_api.php');
if (!config_get('enable_sponsorship')) {
    trigger_error(ERROR_SPONSORSHIP_NOT_ENABLED, ERROR);
}
form_security_validate('account_sponsor_update');
auth_ensure_user_authenticated();
$f_bug_list = gpc_get_string('buglist', '');
$t_bug_list = explode(',', $f_bug_list);
foreach ($t_bug_list as $t_bug) {
    list($t_bug_id, $t_sponsor_id) = explode(':', $t_bug);
    $c_bug_id = (int) $t_bug_id;
    bug_ensure_exists($c_bug_id);
    # dies if bug doesn't exist
    access_ensure_bug_level(config_get('handle_sponsored_bugs_threshold'), $c_bug_id);
    # dies if user can't handle bug
    $t_bug = bug_get($c_bug_id);
    $t_sponsor = sponsorship_get((int) $t_sponsor_id);
    $t_new_payment = gpc_get_int('sponsor_' . $c_bug_id . '_' . $t_sponsor->id, $t_sponsor->paid);
    if ($t_new_payment != $t_sponsor->paid) {
        sponsorship_update_paid($t_sponsor_id, $t_new_payment);
    }
}
form_security_purge('account_sponsor_update');
$t_redirect_url = 'account_sponsor_page.php';
html_page_top(null, $t_redirect_url);
html_operation_successful($t_redirect_url, lang_get('payment_updated'));
html_page_bottom();
Ejemplo n.º 6
0
function sponsorship_update_paid($p_sponsorship_id, $p_paid)
{
    $c_sponsorship_id = db_prepare_int($p_sponsorship_id);
    $t_sponsorship = sponsorship_get($c_sponsorship_id);
    $c_paid = db_prepare_int($p_paid);
    $t_sponsorship_table = config_get('mantis_sponsorship_table');
    $query = "UPDATE {$t_sponsorship_table}\r\n\t\t\t\t  SET last_updated= " . db_now() . ", paid={$c_paid}\r\n\t\t\t\t  WHERE id='{$c_sponsorship_id}'";
    db_query($query);
    history_log_event_special($t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid);
    sponsorship_clear_cache($p_sponsorship_id);
    return true;
}
Ejemplo n.º 7
0
/**
 * updates the paid field
 * @param integer $p_sponsorship_id The sponsorship identifier to update.
 * @param integer $p_paid           The value to set to paid database field to.
 * @return boolean
 */
function sponsorship_update_paid($p_sponsorship_id, $p_paid)
{
    $t_sponsorship = sponsorship_get($p_sponsorship_id);
    $t_query = 'UPDATE {sponsorship} SET last_updated=' . db_param() . ', paid=' . db_param() . ' WHERE id=' . db_param();
    db_query($t_query, array(db_now(), (int) $p_paid, (int) $p_sponsorship_id));
    history_log_event_special($t_sponsorship->bug_id, BUG_PAID_SPONSORSHIP, $t_sponsorship->user_id, $p_paid);
    sponsorship_clear_cache($p_sponsorship_id);
    return true;
}