-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from chris18890/cleanup
- Loading branch information
Showing
25 changed files
with
100 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -22,7 +23,7 @@ | |
// Save path of directory containing index.php | ||
$crm_root = dirname(__FILE__); | ||
|
||
// Bootstrap the crm | ||
// Bootstrap the site | ||
require_once('include/crm.inc.php'); | ||
|
||
header('Content-type: text/csv'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -96,7 +97,7 @@ function crm_error ($text) { | |
} | ||
|
||
/** | ||
* Parse and return the version of the CRM as specified in crm.inc.php under £crm_version. | ||
* Parse and return the version of the CRM as specified in crm.inc.php under $crm_version. | ||
* @return A string representation of the array | ||
*/ | ||
function crm_version() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -144,22 +144,23 @@ function contact_data ($opts = array()) { | |
} | ||
} | ||
$sql .= " | ||
ORDER BY `lastName`, `firstName`, `middleName` ASC"; | ||
ORDER BY `lastName`, `firstName`, `middleName` ASC | ||
"; | ||
$res = mysql_query($sql); | ||
if (!$res) crm_error(mysql_error()); | ||
// Store data | ||
$contacts = array(); | ||
$row = mysql_fetch_assoc($res); | ||
while (!empty($row)) { | ||
$contacts[] = array( | ||
'cid' => $row['cid'], | ||
'firstName' => $row['firstName'], | ||
'middleName' => $row['middleName'], | ||
'lastName' => $row['lastName'], | ||
'email' => $row['email'], | ||
'phone' => $row['phone'], | ||
'emergencyName' => $row['emergencyName'], | ||
'emergencyPhone' => $row['emergencyPhone'] | ||
'cid' => $row['cid'] | ||
, 'firstName' => $row['firstName'] | ||
, 'middleName' => $row['middleName'] | ||
, 'lastName' => $row['lastName'] | ||
, 'email' => $row['email'] | ||
, 'phone' => $row['phone'] | ||
, 'emergencyName' => $row['emergencyName'] | ||
, 'emergencyPhone' => $row['emergencyPhone'] | ||
); | ||
$row = mysql_fetch_assoc($res); | ||
} | ||
|
@@ -171,7 +172,9 @@ function contact_data ($opts = array()) { | |
* Saves a contact. | ||
*/ | ||
function contact_save ($contact) { | ||
$fields = array('cid', 'firstName', 'middleName', 'lastName', 'email', 'phone', 'emergencyName', 'emergencyPhone'); | ||
$fields = array( | ||
'cid', 'firstName', 'middleName', 'lastName', 'email', 'phone', 'emergencyName', 'emergencyPhone' | ||
); | ||
$escaped = array(); | ||
foreach ($fields as $field) { | ||
$escaped[$field] = mysql_real_escape_string($contact[$field]); | ||
|
@@ -201,7 +204,8 @@ function contact_save ($contact) { | |
INSERT INTO `contact` | ||
(`firstName`,`middleName`,`lastName`,`email`,`phone`,`emergencyName`,`emergencyPhone`) | ||
VALUES | ||
('$escaped[firstName]','$escaped[middleName]','$escaped[lastName]','$escaped[email]','$escaped[phone]','$escaped[emergencyName]','$escaped[emergencyPhone]')"; | ||
('$escaped[firstName]','$escaped[middleName]','$escaped[lastName]','$escaped[email]','$escaped[phone]','$escaped[emergencyName]','$escaped[emergencyPhone]') | ||
"; | ||
$res = mysql_query($sql); | ||
if (!$res) crm_error(mysql_error()); | ||
$contact['cid'] = mysql_insert_id(); | ||
|
@@ -586,7 +590,10 @@ function contact_page (&$page_data, $page_name) { | |
if (user_access('contact_view')) { | ||
$opts = array( | ||
'show_export'=>true | ||
, 'exclude'=>array('emergencyName', 'emergencyPhone') | ||
, 'exclude'=>array( | ||
'emergencyName', | ||
'emergencyPhone' | ||
) | ||
); | ||
$view = theme('table', crm_get_table('contact', $opts)); | ||
page_add_content_top($page_data, $view, 'View'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -94,9 +94,6 @@ function command_member_add () { | |
); | ||
$member = array('membership' => $membership); | ||
$contact['member'] = $member; | ||
// Add user fields | ||
$user = array('username' => $username); | ||
$contact['user'] = $user; | ||
// Save to database | ||
$contact = contact_save($contact); | ||
|
||
|
@@ -213,8 +210,6 @@ function command_member_membership_add () { | |
return crm_url('members'); | ||
} | ||
|
||
// Add membership | ||
|
||
// Construct membership object and save | ||
$membership = array( | ||
'sid' => $_POST['sid'] | ||
|
@@ -225,7 +220,7 @@ function command_member_membership_add () { | |
); | ||
member_membership_save($membership); | ||
|
||
return crm_url("contact&cid=$_POST[cid]"); | ||
return crm_url("contact&cid=$_POST[cid]&tab=plan"); | ||
} | ||
|
||
/** | ||
|
@@ -275,7 +270,7 @@ function command_member_membership_delete () { | |
// Delete membership | ||
member_membership_delete($esc_post['sid']); | ||
|
||
return crm_url("contact&cid=$_POST[cid]"); | ||
return crm_url("contact&cid=$_POST[cid]&tab=plan"); | ||
} | ||
|
||
/** | ||
|
@@ -431,9 +426,6 @@ function command_member_import () { | |
); | ||
$member = array('membership' => $membership); | ||
$contact['member'] = $member; | ||
// Add user | ||
$user = array('username' => $username); | ||
$contact['user'] = $user; | ||
|
||
$contact = contact_save($contact); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -82,14 +82,14 @@ function member_data ($opts = array()) { | |
$member = array( | ||
'cid' => $row['cid'], | ||
'contact' => array( | ||
'cid' => $row['cid'], | ||
'firstName' => $row['firstName'], | ||
'middleName' => $row['middleName'], | ||
'lastName' => $row['lastName'], | ||
'email' => $row['email'], | ||
'phone' => $row['phone'], | ||
'emergencyName' => $row['emergencyName'], | ||
'emergencyPhone' => $row['emergencyPhone'] | ||
'cid' => $row['cid'] | ||
, 'firstName' => $row['firstName'] | ||
, 'middleName' => $row['middleName'] | ||
, 'lastName' => $row['lastName'] | ||
, 'email' => $row['email'] | ||
, 'phone' => $row['phone'] | ||
, 'emergencyName' => $row['emergencyName'] | ||
, 'emergencyPhone' => $row['emergencyPhone'] | ||
), | ||
'user' => array( | ||
'cid' => $row['cid'], | ||
|
@@ -228,7 +228,8 @@ function member_contact_api ($contact, $op) { | |
INSERT INTO `user_role` | ||
(`cid`, `rid`) | ||
VALUES | ||
('$esc_cid', '$esc_rid')"; | ||
('$esc_cid', '$esc_rid') | ||
"; | ||
$res = mysql_query($sql); | ||
if (!$res) crm_error(mysql_error()); | ||
} | ||
|
@@ -310,7 +311,7 @@ function member_plan_data ($opts = array()) { | |
|
||
/** | ||
* Generates an associative array mapping membership plan pids to | ||
* strings describing those membership plan. | ||
* strings describing those membership plans. | ||
* | ||
* @param $opts Options to be passed to member_plan_data(). | ||
* @return The associative array of membership plan descriptions. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -262,6 +262,9 @@ function member_membership_add_form ($cid) { | |
return NULL; | ||
} | ||
|
||
// Generate default start date, first of current month | ||
$start = date("Y-m-d"); | ||
|
||
// Create form structure | ||
$form = array( | ||
'type' => 'form', | ||
|
@@ -285,7 +288,8 @@ function member_membership_add_form ($cid) { | |
'type' => 'text', | ||
'label' => 'Start', | ||
'name' => 'start', | ||
'class' => 'date' | ||
'class' => 'date', | ||
'value' => $start | ||
), | ||
array( | ||
'type' => 'text', | ||
|
@@ -510,7 +514,19 @@ function member_import_form () { | |
, 'fields' => array( | ||
array( | ||
'type' => 'message' | ||
, 'value' => '<p>To import members, upload a csv. The csv should have a header row with the following fields:</p><ul><li>First Name</li><li>Middle Name</li><li>Last Name</li><li>Email</li><li>Phone</li><li>Emergency Name</li><li>Emergency Phone</li><li>Username</li><li>Plan</li><li>Start Date</li></ul>' | ||
, 'value' => '<p>To import members, upload a csv. The csv should have a header row with the following fields:</p> | ||
<ul> | ||
<li>First Name</li> | ||
<li>Middle Name</li> | ||
<li>Last Name</li> | ||
<li>Email</li> | ||
<li>Phone</li> | ||
<li>Emergency Name</li> | ||
<li>Emergency Phone</li> | ||
<li>Username</li> | ||
<li>Plan</li> | ||
<li>Start Date</li> | ||
</ul>' | ||
) | ||
, array( | ||
'type' => 'file' | ||
|
@@ -537,7 +553,13 @@ function plan_import_form () { | |
, 'fields' => array( | ||
array( | ||
'type' => 'message' | ||
, 'value' => '<p>To import plans, upload a csv. The csv should have a header row with the following fields:</p><ul><li>Plan Name</li><li>Price</li><li>Active (Set to 1/0 signalling Y/N)</li><li>Voting (Set to 1/0 signalling Y/N)</li></ul>' | ||
, 'value' => '<p>To import plans, upload a csv. The csv should have a header row with the following fields:</p> | ||
<ul> | ||
<li>Plan Name</li> | ||
<li>Price</li> | ||
<li>Active (Set to 1/0 signalling Y/N)</li> | ||
<li>Voting (Set to 1/0 signalling Y/N)</li> | ||
</ul>' | ||
) | ||
, array( | ||
'type' => 'file' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -60,7 +60,10 @@ function member_page (&$page_data, $page_name, $options) { | |
$opts = array( | ||
'filter'=>$_SESSION['member_filter'] | ||
, 'show_export'=>true | ||
, 'exclude'=>array('emergencyName', 'emergencyPhone') | ||
, 'exclude'=>array( | ||
'emergencyName', | ||
'emergencyPhone' | ||
) | ||
); | ||
$view .= theme('table', crm_get_table('member', $opts)); | ||
page_add_content_top($page_data, $view, 'View'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?php | ||
<?php | ||
|
||
/* | ||
Copyright 2009-2014 Edward L. Platt <[email protected]> | ||
|
@@ -177,7 +177,7 @@ function member_voting_report_table () { | |
$table['columns'][] = array('title'=>'D','class'=>''); | ||
$table['columns'][] = array('title'=>'E','class'=>''); | ||
} | ||
|
||
// Loop through member data | ||
foreach ($members as $member) { | ||
|
||
|
@@ -370,11 +370,11 @@ function member_contact_table ($opts) { | |
|
||
// Add row | ||
$table['rows'][] = array( | ||
theme('contact_name', $contact), | ||
$contact['email'], | ||
$contact['phone'], | ||
$contact['emergencyName'], | ||
$contact['emergencyPhone'] | ||
theme('contact_name', $contact) | ||
, $contact['email'] | ||
, $contact['phone'] | ||
, $contact['emergencyName'] | ||
, $contact['emergencyPhone'] | ||
); | ||
|
||
return $table; | ||
|
Oops, something went wrong.