forked from science-ation/science-ation
- Add a primary contact field to the award contacts
- Use the primary contact in award reports
This commit is contained in:
parent
4c9d23e513
commit
dcfcd358fc
@ -71,7 +71,7 @@
|
||||
else
|
||||
$id=$_POST['id'];
|
||||
|
||||
|
||||
$p = ($_POST['primary']=='yes')?'yes':'no';
|
||||
$exec="UPDATE award_contacts SET ".
|
||||
"salutation='".mysql_escape_string(stripslashes($_POST['salutation']))."', ".
|
||||
"firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ".
|
||||
@ -82,7 +82,8 @@
|
||||
"phonehome='".mysql_escape_string(stripslashes($_POST['phonehome']))."', ".
|
||||
"fax='".mysql_escape_string(stripslashes($_POST['fax']))."', ".
|
||||
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
|
||||
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."' ".
|
||||
"notes='".mysql_escape_string(stripslashes($_POST['notes']))."', ".
|
||||
"`primary`='$p' ".
|
||||
"WHERE id='$id'";
|
||||
mysql_query($exec);
|
||||
|
||||
@ -134,6 +135,12 @@
|
||||
echo "<tr><td>".i18n("Fax")."</td><td><input type=\"text\" name=\"fax\" value=\"".htmlspecialchars($r->fax)."\" size=\"16\" maxlength=\"32\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"email\" value=\"".htmlspecialchars($r->email)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Notes")."</td><td><textarea name=\"notes\" rows=\"8\" cols=\"60\">".htmlspecialchars($r->notes)."</textarea></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Primary Contact")."</td><td><select name=\"primary\">";
|
||||
$sel = ($r->primary == 'yes') ? 'selected="selected"': '';
|
||||
echo "<option value=\"yes\" $sel>".i18n('Yes')."</option>";
|
||||
$sel = ($r->primary == 'no') ? 'selected="selected"': '';
|
||||
echo "<option value=\"no\" $sel>".i18n('No')."</option>";
|
||||
echo "</select></td></tr>\n";
|
||||
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
|
||||
|
||||
echo "</table>\n";
|
||||
|
@ -114,19 +114,96 @@ $report_awards_fields = array(
|
||||
'table' => 'award_sponsors.confirmed',
|
||||
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
|
||||
|
||||
'pcontact_salutation' => array(
|
||||
'name' => 'Primary Contact -- Salutation',
|
||||
'header' => 'Cnct. Salutation',
|
||||
'width' => 1.0,
|
||||
'table' => 'PRIMARYCONTACT.salutation' ),
|
||||
|
||||
'pcontact_last_name' => array(
|
||||
'name' => 'Primary Contact -- Last Name',
|
||||
'header' => 'Cnct. Last Name',
|
||||
'width' => 1.0,
|
||||
'table' => 'PRIMARYCONTACT.lastname' ),
|
||||
|
||||
'pcontact_first_name' => array(
|
||||
'name' => 'Primary Contact -- First Name',
|
||||
'header' => 'Cnct. First Name',
|
||||
'width' => 1.0,
|
||||
'table' => 'PRIMARYCONTACT.firstname' ),
|
||||
|
||||
'pcontact_name' => array(
|
||||
'name' => 'Primary Contact -- Full Name (last, first)',
|
||||
'header' => 'Contact Name',
|
||||
'width' => 1.75,
|
||||
'table' => "CONCAT(PRIMARYCONTACT.lastname, ', ', PRIMARYCONTACT.firstname)",
|
||||
'table_sort'=> 'PRIMARYCONTACT.lastname' ),
|
||||
|
||||
'pcontact_namefl' => array(
|
||||
'name' => 'Primary Contact -- Full Name (salutation first last)',
|
||||
'header' => 'Contact Name',
|
||||
'width' => 1.75,
|
||||
'table' => "CONCAT(PRIMARYCONTACT.salutation, ' ', PRIMARYCONTACT.firstname, ' ', PRIMARYCONTACT.lastname)",
|
||||
'table_sort'=> 'PRIMARYCONTACT.lastname' ),
|
||||
|
||||
'pcontact_position' => array(
|
||||
'name' => 'Primary Contact -- Position',
|
||||
'header' => 'Cnct. Position',
|
||||
'width' => 1.25,
|
||||
'table' => 'PRIMARYCONTACT.position'),
|
||||
|
||||
'pcontact_email' => array(
|
||||
'name' => 'Primary Contact -- Email',
|
||||
'header' => 'Cnct. Email',
|
||||
'width' => 2.0,
|
||||
'table' => 'PRIMARYCONTACT.email'),
|
||||
|
||||
'pcontact_hphone' => array(
|
||||
'name' => 'Primary Contact -- Home Phone',
|
||||
'header' => 'Cnct. Home',
|
||||
'width' => 1,
|
||||
'table' => 'PRIMARYCONTACT.phonehome' ),
|
||||
|
||||
'pcontact_wphone' => array(
|
||||
'name' => 'Primary Contact -- Work Phone',
|
||||
'header' => 'Cnct. Work',
|
||||
'width' => 1,
|
||||
'table' => 'PRIMARYCONTACT.phonework' ),
|
||||
|
||||
'pcontact_cphone' => array(
|
||||
'name' => 'Primary Contact -- Cell Phone',
|
||||
'header' => 'Cnct. Cell',
|
||||
'width' => 1,
|
||||
'table' => 'PRIMARYCONTACT.phonecell' ),
|
||||
|
||||
'pcontact_fax' => array(
|
||||
'name' => 'Primary Contact -- Fax',
|
||||
'header' => 'Cnct. Fax',
|
||||
'width' => 1,
|
||||
'table' => 'PRIMARYCONTACT.fax' ),
|
||||
|
||||
'pcontact_notes' => array(
|
||||
'name' => 'Primary Contact -- Notes',
|
||||
'header' => 'Contact Notes',
|
||||
'width' => 3,
|
||||
'table' => 'PRIMARYCONTACT.notes' ),
|
||||
|
||||
'judgeteamname' => array(
|
||||
'components' => array('judgingteam'),
|
||||
'name' => 'Judging Team -- Name',
|
||||
'header' => 'Judging Team',
|
||||
'width' => 3.0,
|
||||
'table' => 'judges_teams.name'),
|
||||
|
||||
'judgeteamnum' => array(
|
||||
'components' => array('judgingteam'),
|
||||
'name' => 'Judging Team -- Number',
|
||||
'header' => 'Team',
|
||||
'width' => 0.5,
|
||||
'table' => 'judges_teams.num'),
|
||||
|
||||
'judgeteammembers' => array(
|
||||
'components' => array('judgingteam'),
|
||||
'name' => 'Judging Team -- Members (REQUIRES MySQL 5.0)',
|
||||
'header' => 'Team Members',
|
||||
'width' => 3.0,
|
||||
@ -146,29 +223,31 @@ $report_awards_fields = array(
|
||||
|
||||
$judges_join = '';
|
||||
$judges_where = '';
|
||||
|
||||
if(in_array('judgeteammembers', $report['col'])
|
||||
|| in_array('judgeteammembers', $report['group']) ) {
|
||||
$judges_join = ', judges_teams_link, judges';
|
||||
$judges_where = 'AND judges_teams_link.id=judges_teams.id
|
||||
|
||||
if(in_array('judgingteam', $components)) {
|
||||
$judges_join = ', judges_teams_awards_link, judges_teams,
|
||||
judges_teams_link, judges';
|
||||
$judges_where = 'AND judges_teams_awards_link.award_awards_id=award_awards.id
|
||||
AND judges_teams.id=judges_teams_awards_link.judges_teams_id
|
||||
AND judges_teams_link.id=judges_teams.id
|
||||
AND judges.id=judges_teams_link.judges_id';
|
||||
}
|
||||
|
||||
$q = " FROM
|
||||
award_awards
|
||||
LEFT JOIN award_sponsors ON (
|
||||
award_sponsors.id=award_awards.award_sponsors_id
|
||||
AND award_sponsors.year='$year'),
|
||||
judges_teams_awards_link, judges_teams,
|
||||
award_awards LEFT JOIN award_sponsors ON (
|
||||
award_sponsors.id=award_awards.award_sponsors_id
|
||||
AND award_sponsors.year=award_awards.year)
|
||||
LEFT JOIN award_contacts AS PRIMARYCONTACT ON (
|
||||
PRIMARYCONTACT.award_sponsors_id=award_sponsors.id
|
||||
AND PRIMARYCONTACT.year=award_awards.year
|
||||
AND PRIMARYCONTACT.`primary`='yes'),
|
||||
award_types
|
||||
$judges_join
|
||||
WHERE
|
||||
award_awards.year='$year'
|
||||
AND judges_teams_awards_link.award_awards_id=award_awards.id
|
||||
AND judges_teams.id=judges_teams_awards_link.judges_teams_id
|
||||
AND award_types.id=award_types_id
|
||||
AND award_types.year='$year'
|
||||
$judges_where
|
||||
$judges_where
|
||||
";
|
||||
|
||||
return $q;
|
||||
|
@ -1,6 +1,7 @@
|
||||
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
|
||||
('', '37', 'Awards -- Award Sponsor Information', 'Sponsor information for each award. This is a large report so the default format is CSV.', 'The Grant Brothers', 'award');
|
||||
ALTER TABLE `award_contacts` ADD `primary` ENUM( 'no', 'yes' ) NOT NULL DEFAULT 'no' AFTER `notes` ;
|
||||
|
||||
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
|
||||
('', '37', 'Awards -- Award Sponsor Information', 'Sponsor information for each award with the primary contact. This is a large report so the default format is CSV.', 'The Grant Brothers', 'award');
|
||||
INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES
|
||||
('', LAST_INSERT_ID(), 'option', 0, 'type', 'csv', 0, 0, 0, 0, 0, '', ''),
|
||||
('', LAST_INSERT_ID(), 'option', 1, 'group_new_page', 'no', 0, 0, 0, 0, 0, '', ''),
|
||||
@ -19,4 +20,14 @@ INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`
|
||||
('', LAST_INSERT_ID(), 'col', 7, 'sponsor_postal', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 8, 'sponsor_notes', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 9, 'sponsor_confirmed', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 10, 'pcontact_salutation', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 11, 'pcontact_namefl', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 12, 'pcontact_position', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 13, 'pcontact_email', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 14, 'pcontact_hphone', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 15, 'pcontact_wphone', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 16, 'pcontact_cphone', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 17, 'pcontact_fax', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'col', 18, 'pcontact_notes', '', 0, 0, 0, 0, 0, '', ' '),
|
||||
('', LAST_INSERT_ID(), 'sort', 0, 'name', '', 0, 0, 0, 0, 0, '', ' ');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user