From 9e0ea3bafd268920c21a58f8fc4469e37b75989a Mon Sep 17 00:00:00 2001 From: james Date: Fri, 16 Oct 2009 18:18:38 +0000 Subject: [PATCH] - Properly specify the filter for reports --- admin/fundraising_campaigns.php | 16 ++++++++++------ admin/reports.inc.php | 3 +++ admin/reports_gen.php | 22 ++++++++++++---------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php index e9e7273..985db16 100644 --- a/admin/fundraising_campaigns.php +++ b/admin/fundraising_campaigns.php @@ -421,12 +421,15 @@ switch($_GET['action']){ echo ""; echo ""; echo "\n"; echo "\n"; echo "\n"; @@ -713,7 +716,7 @@ function comm_dialog_edit_cancel() { function opensendlabelsdialog(reports_id,fcid) { $("#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() { }); } @@ -721,7 +724,8 @@ function opensendlabelsdialog(reports_id,fcid) { function opensendmaildialog(fcid,key) { var dlargs = "fundraising_campaigns_id="+fcid+"&key="+key; var dlurl = "/admin/reports_appeal_letters.php?"+dlargs; - $('#content').attr('src',dlurl); + window.location.href = dlurl; +// $('#content').attr('src',dlurl); return false; } diff --git a/admin/reports.inc.php b/admin/reports.inc.php index b96c7a7..f99f1d8 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -701,6 +701,9 @@ foreach($report_stock as $n=>$v) { $q = "SELECT $sel $q $filter_query $group_query ORDER BY $order"; $r = mysql_query($q); +// print_r($report['filter']); +// echo "$q"; + if($r == false) { echo "The report database query has failed. This is unfortunate but not your fault. Please send the following to diff --git a/admin/reports_gen.php b/admin/reports_gen.php index 993cd45..c41bc91 100644 --- a/admin/reports_gen.php +++ b/admin/reports_gen.php @@ -43,15 +43,18 @@ $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']) { 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; - } - } ?>
"; + //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 ""; + echo "
\n"; if($email->lastsent) { list($date,$time)=split(" ",$email->lastsent); - echo i18n("Sent %1 at %2",array(format_date($date), $time)); - } else { - echo ""; - } + echo i18n("Last Sent"); + echo "
".format_date($date); + echo "
".format_time($time); + } echo "