forked from science-ation/science-ation
Various fixes towards fundraising
This commit is contained in:
parent
4f935e5818
commit
bb807eab04
@ -146,6 +146,7 @@ switch(get_value_from_array($_GET, 'action')) {
|
||||
$q->execute();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
|
||||
|
||||
if($q->rowCount()) {
|
||||
echo "<table class=\"tableview\">";
|
||||
echo "<thead>";
|
||||
@ -929,21 +930,11 @@ $(document).ready(function() {
|
||||
*/
|
||||
|
||||
$("#editor_tabs").tabs({
|
||||
show: function(event, ui) {
|
||||
switch(ui.panel.id) {
|
||||
case 'editor_tab_organization':
|
||||
update_organizationinfo();
|
||||
break;
|
||||
case 'editor_tab_sponsorship':
|
||||
update_sponsorshipinfo();
|
||||
break;
|
||||
case 'editor_tab_contacts':
|
||||
update_contactsinfo();
|
||||
break;
|
||||
case 'editor_tab_activity':
|
||||
update_activityinfo();
|
||||
break;
|
||||
}
|
||||
create: function( event, ui ) {
|
||||
update_organizationinfo();
|
||||
update_sponsorshipinfo();
|
||||
update_contactsinfo();
|
||||
update_activityinfo();
|
||||
},
|
||||
selected: 0
|
||||
});
|
||||
@ -982,7 +973,7 @@ function open_editor(id) {
|
||||
$("#organizationinfo_proposalsubmissiondate").val("");
|
||||
$("#organizationinfo_notes").val("");
|
||||
|
||||
$("#organizationinfo_save_button").attr('disabled','disabled');
|
||||
$("#update_contactsinfoorganizationinfo_save_button").attr('disabled','disabled');
|
||||
$("[name=donortype]").attr('checked','');
|
||||
|
||||
}
|
||||
@ -1072,7 +1063,9 @@ function update_contactsinfo()
|
||||
var id=sponsor_id;
|
||||
$("#editor_tab_contacts").load("<?=$_SERVER['PHP_SELF']?>?action=contactsinfo_load&id="+id, null,
|
||||
function() {
|
||||
$("#contactaccordion").accordion();
|
||||
$("#contactaccordion").accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -1082,7 +1075,9 @@ function contactsinfo_save(uid) {
|
||||
print(id);
|
||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_save&id="+id, $("#contact_" + uid).serializeArray(),
|
||||
function() {
|
||||
$("#contactaccordion").accordion();
|
||||
$("#contactaccordion").accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
update_contactsinfo();
|
||||
});
|
||||
return false;
|
||||
@ -1092,7 +1087,9 @@ function contactsinfo_delete(uid) {
|
||||
var id=sponsor_id;
|
||||
$("#debug").load("<?$_SERVER['PHP_SELF']?>?action=contactsinfo_delete&id="+id, $("#contact_" + uid).serializeArray(),
|
||||
function() {
|
||||
$("#contactaccordion").accordion();
|
||||
$("#contactaccordion").accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
update_contactsinfo();
|
||||
});
|
||||
return false;
|
||||
|
@ -90,10 +90,10 @@ $q->execute();
|
||||
|
||||
$goalq=$pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'");
|
||||
$goalq->execute();
|
||||
$goalr=$goalq->fetch(PDO:FETCH_OBJ);
|
||||
$goalr=$goalq->fetch(PDO::FETCH_OBJ);
|
||||
$recq=$pdo->prepare("SELECT SUM(value) AS received FROM fundraising_donations WHERE fundraising_campaigns_id='$r->id' AND fiscalyear='{$config['FISCALYEAR']}' AND status='received'");
|
||||
$recq->execute();
|
||||
show_pdo_errors_if_any();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
$recr=$recq->fetch(PDO::FETCH_OBJ);
|
||||
$received=$recr->received;
|
||||
if($r->target)
|
||||
@ -102,6 +102,11 @@ $q->execute();
|
||||
$percent=0;
|
||||
$col=colour_to_percent($percent);
|
||||
|
||||
if (!$goalr) {
|
||||
$goalr = new stdClass();
|
||||
$goalr->name = '';
|
||||
}
|
||||
|
||||
echo "<tr style=\"cursor:pointer;\" onclick=\"window.location.href='fundraising_campaigns.php?manage_campaign=$r->id'\">\n";
|
||||
echo " <td>$r->name</td>\n";
|
||||
echo " <td>$r->type</td>\n";
|
||||
|
@ -95,7 +95,6 @@ switch(get_value_from_array($_GET, 'action')){
|
||||
$q=$pdo->prepare("SELECT * FROM fundraising_campaigns WHERE fiscalyear='{$config['FISCALYEAR']}'");
|
||||
$q->execute();
|
||||
while($r=$q->fetch(PDO::FETCH_OBJ)) {
|
||||
|
||||
$goalq=$pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='{$r->fundraising_goal}' AND fiscalyear='{$config['FISCALYEAR']}'");
|
||||
$goalq->execute();
|
||||
$goalr=$goalq->fetch(PDO::FETCH_OBJ);
|
||||
@ -110,6 +109,11 @@ $q->execute();
|
||||
$percent=0;
|
||||
$col=colour_to_percent($percent);
|
||||
|
||||
if (!$goalr) {
|
||||
$goalr = new stdClass();
|
||||
$goalr->name = '';
|
||||
}
|
||||
|
||||
echo "<tr style=\"cursor:pointer;\" onclick=\"return managecampaign($r->id)\">\n";
|
||||
echo " <td>$r->name</td>\n";
|
||||
echo " <td>$r->type</td>\n";
|
||||
@ -518,7 +522,7 @@ $q->execute();
|
||||
}
|
||||
|
||||
function save_campaign_info(){
|
||||
global $config;
|
||||
global $config, $pdo;
|
||||
if(!$_POST['name']){
|
||||
error_("Appeal Name is required");
|
||||
return;
|
||||
@ -526,8 +530,8 @@ function save_campaign_info(){
|
||||
if(!$_POST['startdate']) $startdate=date("Y-m-d"); else $startdate=$_POST['startdate'];
|
||||
|
||||
if(!$_GET['id']) {
|
||||
$query = "INSERT INTO fundraising_campaigns (name,fiscalyear) VALUES (
|
||||
'".stripslashes($_POST['name'])."','{$config['FISCALYEAR']}')";
|
||||
$query = "INSERT INTO fundraising_campaigns (name, fiscalyear) VALUES ('".stripslashes($_POST['name'])."','{$config['FISCALYEAR']}')";
|
||||
echo $query;
|
||||
$stmt = $pdo->prepare($query);
|
||||
$stmt->execute();
|
||||
$id = $pdo->lastInsertId();
|
||||
@ -600,14 +604,12 @@ function managecampaignsfinish() {
|
||||
}
|
||||
|
||||
function managecampaignfinish() {
|
||||
$("#editor_tabs").tabs({
|
||||
$("#editor_tabs").tabs({
|
||||
create: function( event, ui ) {
|
||||
|
||||
update_tab_overview();
|
||||
update_tab_donations();
|
||||
update_tab_prospects();
|
||||
update_tab_communications();
|
||||
|
||||
},
|
||||
|
||||
selected: 0
|
||||
|
@ -3,10 +3,10 @@ $campaign_types=array("Mail","Email","Phone","Personal Visit","Event","Other");
|
||||
$salutations=array("Mr.","Mrs.","Ms","Dr.","Professor");
|
||||
|
||||
function getGoal($goal) {
|
||||
global $config;
|
||||
global $config, $pdo;
|
||||
$q=$pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}' LIMIT 1");
|
||||
$q->execute();
|
||||
return $q->rowCount();
|
||||
return $q->fetch(PDO::FETCH_OBJ);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -251,7 +251,7 @@
|
||||
|
||||
case "goal_save":
|
||||
$id=$_POST['id'];
|
||||
if(! ($_POST['name'] && $_POST['budget'])) {
|
||||
if(!($_POST['name'] && $_POST['budget'])) {
|
||||
error_("Purpose name and budget are required");
|
||||
exit;
|
||||
}
|
||||
@ -268,7 +268,8 @@
|
||||
}
|
||||
else {
|
||||
$goal=strtolower($_POST['name']);
|
||||
$goal=ereg_replace("[^a-z]","",$goal);
|
||||
$goal=preg_replace("[^a-z]","",$goal);
|
||||
echo "SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'";
|
||||
$q=$pdo->prepare("SELECT * FROM fundraising_goals WHERE goal='$goal' AND fiscalyear='{$config['FISCALYEAR']}'");
|
||||
$q->execute();
|
||||
show_pdo_errors_if_any($pdo);
|
||||
@ -345,11 +346,9 @@ $(document).ready(function() {
|
||||
|
||||
$("#editor_tabs").tabs({
|
||||
create: function( event, ui ) {
|
||||
|
||||
update_levels();
|
||||
update_goals();
|
||||
update_setup();
|
||||
|
||||
},
|
||||
selected: 0
|
||||
});
|
||||
@ -380,7 +379,9 @@ $(document).ready(function() {
|
||||
function update_levels() {
|
||||
$("#editor_tab_levels").load("fundraising_setup.php?gettab=levels",null,
|
||||
function() {
|
||||
$("#levelaccordion").accordion();
|
||||
$("#levelaccordion").accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -404,7 +405,9 @@ function level_delete(id) {
|
||||
function update_goals() {
|
||||
$("#editor_tab_goals").load("fundraising_setup.php?gettab=goals",null,
|
||||
function() {
|
||||
$("#goalaccordion").accordion();
|
||||
$("#goalaccordion").accordion({
|
||||
heightStyle: "content"
|
||||
});
|
||||
$("[name=deadline]").datepicker({ dateFormat: 'yy-mm-dd'});
|
||||
}
|
||||
);
|
||||
@ -435,7 +438,7 @@ function goal_delete(id) {
|
||||
}
|
||||
|
||||
function charitychange() {
|
||||
if($("input[@name='registeredcharity']:checked").val()=="yes") {
|
||||
if($("input[name='registeredcharity']:checked").val()=="yes") {
|
||||
$("#charitynumber").attr("disabled","");
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user