Exemplo n.º 1
0
        $own_query = $adb->pquery("SELECT reportname,owner FROM vtiger_report WHERE reportid=?", array($id_array[$i]));
        $owner = $adb->query_result($own_query, 0, "owner");
        if ($is_admin == true || in_array($owner, $subordinate_users) || $owner == $current_user->id) {
            DeleteReport($id_array[$i]);
        } else {
            $del_failed[] = $adb->query_result($own_query, 0, "reportname");
        }
    }
    if (!empty($del_failed)) {
        header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajax&module=Reports&del_denied=" . implode(",", $del_failed));
    } else {
        header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajax&module=Reports");
    }
} elseif (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
    $id = vtlib_purify($_REQUEST["record"]);
    DeleteReport($id);
    header("Location: index.php?action=ReportsAjax&file=ListView&mode=ajaxdelete&module=Reports");
}
/** To Delete a Report 
 * @param $reportid -- The report id
 * @returns nothing
 */
function DeleteReport($reportid)
{
    global $adb;
    $idelreportsql = "delete from vtiger_selectquery where queryid=?";
    $idelreportsqlresult = $adb->pquery($idelreportsql, array($reportid));
    $ireportsql = "delete from vtiger_report where reportid=?";
    $ireportsqlresult = $adb->pquery($ireportsql, array($reportid));
    $reportsql = 'DELETE FROM vtiger_scheduled_reports WHERE reportid=?';
    $adb->pquery($reportsql, array($reportid));
Exemplo n.º 2
0
        $root['settings']['short_table_name'] = GetTableURL($root['tables'][0]);
        if ($_POST['save'] == 1) {
            $_SESSION['webcharts']['tmp_active'] = "";
        }
        if (!is_wr_project() && (array_key_exists("table_relations", $arr) || array_key_exists("group_by_condition", $arr))) {
            update_chart_group_by_condition();
            update_chart_parameters();
        }
        save_sql("webcharts");
        $str_xml = $xml->array_to_xml($root);
        SaveChart($save_name, $root['settings']['name'], $root['settings']['title'], $root['settings']['status'], $str_xml, $saveas);
    }
    echo "OK";
} elseif (isset($_POST['del'])) {
    if ($_POST['web'] == "webreports") {
        $opStatus = DeleteReport(postvalue('name'));
    } else {
        $opStatus = DeleteChart(postvalue('name'));
    }
    echo "OK";
}
function comlete_report_session_default_values($isedit = "")
{
    $root =& $_SESSION["webreports"];
    $table = $root['tables'][0];
    $arr_fields = WRGetNBFieldsList($table);
    $arr_fields_all = WRGetFieldsList($table);
    $gfield = $arr_fields[0];
    if (is_wr_db()) {
        $gfield = $table . "." . $arr_fields[0];
    }