forked from science-ation/science-ation
- Properly specify the filter for reports
This commit is contained in:
parent
1d92fd27f0
commit
9e0ea3bafd
@ -421,12 +421,15 @@ switch($_GET['action']){
|
|||||||
echo "<tr><td colspan=\"2\">";
|
echo "<tr><td colspan=\"2\">";
|
||||||
echo "<table style=\"width: 100%;\"><tr>";
|
echo "<table style=\"width: 100%;\"><tr>";
|
||||||
echo "<td style=\"text-align: center;\">";
|
echo "<td style=\"text-align: center;\">";
|
||||||
|
//we let them always send it again for now... might change this back later, but i think just notifying them of when it was last sent is enough and keeps teh form more consistent
|
||||||
|
echo "<input type=\"button\" onclick=\"return opensendemaildialog()\" value=\"".i18n("Send as email")."\" />";
|
||||||
|
echo "<br />\n";
|
||||||
if($email->lastsent) {
|
if($email->lastsent) {
|
||||||
list($date,$time)=split(" ",$email->lastsent);
|
list($date,$time)=split(" ",$email->lastsent);
|
||||||
echo i18n("Sent %1 at %2",array(format_date($date), $time));
|
echo i18n("Last Sent");
|
||||||
} else {
|
echo "<br />".format_date($date);
|
||||||
echo "<input type=\"button\" onclick=\"return opensendemaildialog()\" value=\"".i18n("Send as email")."\" />";
|
echo "<br />".format_time($time);
|
||||||
}
|
}
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendmaildialog($campaign_id,'$key')\" value=\"".i18n("Generate PDF for mailing")."\" /></td>\n";
|
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendmaildialog($campaign_id,'$key')\" value=\"".i18n("Generate PDF for mailing")."\" /></td>\n";
|
||||||
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendlabelsdialog(47,$campaign_id)\" value=\"".i18n("Generate mailing labels")."\" /></td>\n";
|
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendlabelsdialog(47,$campaign_id)\" value=\"".i18n("Generate mailing labels")."\" /></td>\n";
|
||||||
@ -713,7 +716,7 @@ function comm_dialog_edit_cancel() {
|
|||||||
|
|
||||||
function opensendlabelsdialog(reports_id,fcid) {
|
function opensendlabelsdialog(reports_id,fcid) {
|
||||||
$("#dialog").empty();
|
$("#dialog").empty();
|
||||||
var args = "action=dialog_gen&sid="+reports_id+"&filter[fundraising_campaigns_id]="+fcid;
|
var args = "action=dialog_gen&sid="+reports_id+"&filter[0][field]=fundraising_campaigns_id&filter[0][x]=0&filter[0][value]="+fcid;
|
||||||
$("#dialog").load("reports_gen.php?"+args,null,function() {
|
$("#dialog").load("reports_gen.php?"+args,null,function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -721,7 +724,8 @@ function opensendlabelsdialog(reports_id,fcid) {
|
|||||||
function opensendmaildialog(fcid,key) {
|
function opensendmaildialog(fcid,key) {
|
||||||
var dlargs = "fundraising_campaigns_id="+fcid+"&key="+key;
|
var dlargs = "fundraising_campaigns_id="+fcid+"&key="+key;
|
||||||
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_appeal_letters.php?"+dlargs;
|
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_appeal_letters.php?"+dlargs;
|
||||||
$('#content').attr('src',dlurl);
|
window.location.href = dlurl;
|
||||||
|
// $('#content').attr('src',dlurl);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,6 +701,9 @@ foreach($report_stock as $n=>$v) {
|
|||||||
$q = "SELECT $sel $q $filter_query $group_query ORDER BY $order";
|
$q = "SELECT $sel $q $filter_query $group_query ORDER BY $order";
|
||||||
$r = mysql_query($q);
|
$r = mysql_query($q);
|
||||||
|
|
||||||
|
// print_r($report['filter']);
|
||||||
|
// echo "$q";
|
||||||
|
|
||||||
if($r == false) {
|
if($r == false) {
|
||||||
echo "The report database query has failed. This is
|
echo "The report database query has failed. This is
|
||||||
unfortunate but not your fault. Please send the following to
|
unfortunate but not your fault. Please send the following to
|
||||||
|
@ -43,15 +43,18 @@
|
|||||||
$id = $r['id'];
|
$id = $r['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$report = report_load($id);
|
||||||
|
/* Add a custom filter if specified */
|
||||||
|
$filter_args = '';
|
||||||
|
if(is_array($_GET['filter'])) {
|
||||||
|
foreach($_GET['filter'] as $f=>$v) {
|
||||||
|
$report['filter'][] = array('field'=>$v['field'],'x'=>$v['x'],'value'=>$v['value']);
|
||||||
|
$filter_args.="&filter[$f][field]={$v['field']}&filter[$f][x]={$v['x']}&filter[$f][value]={$v['value']}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch($_GET['action']) {
|
switch($_GET['action']) {
|
||||||
case 'dialog_gen':
|
case 'dialog_gen':
|
||||||
/* Add a custom filter */
|
|
||||||
$report = report_load($id);
|
|
||||||
if(is_array($_GET['filter'])) {
|
|
||||||
foreach($_GET['filter'] as $f=>$v) {
|
|
||||||
$report['options']['filter'][$f] = $v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<div id="report_dialog_gen" title="Generate Report" style="display: none">
|
<div id="report_dialog_gen" title="Generate Report" style="display: none">
|
||||||
<form id="report_dialog_form" >
|
<form id="report_dialog_form" >
|
||||||
@ -127,8 +130,9 @@ case 'dialog_gen':
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#report_dialog_gen_pdf_button").click(function () {
|
$("#report_dialog_gen_pdf_button").click(function () {
|
||||||
var dlargs = $('#report_dialog_form').serialize();
|
var dlargs = $('#report_dialog_form').serialize()+"<?=$filter_args?>";
|
||||||
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
|
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
|
||||||
|
// alert(dlurl);
|
||||||
// $('#content').attr('src',dlurl);
|
// $('#content').attr('src',dlurl);
|
||||||
window.location.href=dlurl;
|
window.location.href=dlurl;
|
||||||
$('#report_dialog_gen').dialog("close");
|
$('#report_dialog_gen').dialog("close");
|
||||||
@ -159,7 +163,6 @@ case 'dialog_gen':
|
|||||||
|
|
||||||
if($show_options == false) {
|
if($show_options == false) {
|
||||||
if($id && $year) {
|
if($id && $year) {
|
||||||
$report = report_load($id);
|
|
||||||
$report['year'] = $year;
|
$report['year'] = $year;
|
||||||
if($type != '') $report['option']['type'] = $type;
|
if($type != '') $report['option']['type'] = $type;
|
||||||
if($stock != '') $report['option']['stock'] = $stock;
|
if($stock != '') $report['option']['stock'] = $stock;
|
||||||
@ -171,7 +174,6 @@ case 'dialog_gen':
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$report = report_load($id);
|
|
||||||
|
|
||||||
send_header('Report Options', array(
|
send_header('Report Options', array(
|
||||||
'Committee Main' => 'committee_main.php',
|
'Committee Main' => 'committee_main.php',
|
||||||
|
Loading…
Reference in New Issue
Block a user