function save() { global $DIA; if ($this->data[$this::$id_field]) { $this->data['key'] = $this->data[$this::$id_field]; } $this->data['key'] = $DIA->save($this::$table_name, $this->data); $this->data[$this::$id_field] = $this->data['key']; if ($this::$sync_method == 'supporter') { sync_person_monsterpants($this->data[$this::$id_field]); } else { sync_object_monsterpants_recent($this::$table_name); } }
<?php require_once "../boot.php"; $supporters = $_REQUEST['supporters']; $data = $_REQUEST; if ($_REQUEST['supporters']) { foreach ($supporters as $key) { $data['supporter_KEY'] = $key; $DIA->save('contact_history', $data); sync_person_monsterpants($key); } } else { $DIA->save('contact_history', $data); sync_person_monsterpants($data['supporter_KEY']); } #print_r($data); header("Location: ../" . $_REQUEST['jaguar_redirect']);
function update_supporter_field($supporter_KEY, $field, $field_value) { global $DIA; $d[$field] = $field_value; $d['key'] = $supporter_KEY; $DIA->save('supporter', $d); sync_person_monsterpants($supporter_KEY); }
<?php require_once '../_header.php'; if ($_REQUEST['date']) { $date = '/' . $_REQUEST['date']; } if ($_REQUEST['action'] == 'sync_supporter') { echo sync_person_monsterpants($_REQUEST['supporter_KEY']); echo 'Person Synced'; } if ($_REQUEST['action'] == 'sync_object') { sync_object_monsterpants($_REQUEST['object'], $date); } if ($_REQUEST['action'] == 'sync_object_recent') { sync_object_monsterpants_recent($_REQUEST['object']); } if ($_REQUEST['action'] == 'sync_all') { sync_all_monsterpants($_REQUEST['object'], $date); } echo $contents; ?> <h1>Sync the local databases</h1> <h3>Sync A Supporter</h3> <p>Put the supporter's supporter key to sync the supporter and all related objects to that supporter</p> <form action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <input type="hidden" name="action" value="sync_supporter"> Supporter KEY: <input name="supporter_KEY" value="">
function insert_uploaded_data($up, $groups_KEY = NULL) { global $DIA; $num = count($up); for ($c = 0; $c < $num; $c++) { unset($data[$c]); $data[$c]['Prefix'] = clean_crap($up[$c][0]); $data[$c]['First_Name'] = clean_crap($up[$c][1]); $data[$c]['Last_Name'] = clean_crap($up[$c][2]); $data[$c]['Suffix'] = clean_crap($up[$c][3]); $data[$c]['Occupation'] = clean_crap($up[$c][4]); $data[$c]['Organization'] = clean_crap($up[$c][5]); $data[$c]['TYPE'] = clean_crap($up[$c][6]); $data[$c]['sector'] = clean_crap($up[$c][7]); $data[$c]['Point_Person'] = clean_crap($up[$c][8]); $data[$c]['Email'] = clean_crap($up[$c][9]); $data[$c]['Phone'] = clean_crap($up[$c][10]); $data[$c]['Cell_Phone'] = clean_crap($up[$c][11]); $data[$c]['Work_Phone'] = clean_crap($up[$c][12]); $data[$c]['Street'] = clean_crap($up[$c][13]); $data[$c]['Street_2'] = clean_crap($up[$c][14]); $data[$c]['City'] = clean_crap($up[$c][15]); $data[$c]['State'] = clean_crap($up[$c][16]); $data[$c]['Zip'] = clean_crap($up[$c][17]); $data[$c]['Country'] = clean_crap($up[$c][18]); $data[$c]['twitter'] = clean_crap($up[$c][19]); $data[$c]['Web_Page'] = clean_crap($up[$c][20]); $data[$c]['skype'] = clean_crap($up[$c][21]); $data[$c]['Notes'] = clean_crap($up[$c][22]); if ($c != 0) { $campaign_manager_KEY = get_campaign_manager($data[$c]['Point_Person']); if (!$campaign_manager_KEY) { echo 'All fields need point person Error on line ' . $c . ', Person: ' . $data[$c]['First_Name'] . ' ' . $data[$c]['Last_Name']; return FALSE; } if ($data[$c]['Country']) { $data[$c]['Country'] = check_country($data[$c]['Country']); } if ($data[$c]['State']) { #$data[$c]['State'] = check_state($data[$c]['State']); } $data[$c]['point_campaign_manager_KEY'] = $campaign_manager_KEY; $data[$c]['campaign_manager_KEY'] = $campaign_manager_KEY; $data[$c]['Tracking_Code'] = 'Jaguar'; if ($data[$c]['TYPE']) { $data[$c][strtolower($data[$c]['TYPE'])] = 1; } else { echo 'All fields need a contact type that is valid Error on line ' . $c . ', Person: ' . $data[$c]['First_Name'] . ' ' . $data[$c]['Last_Name']; return FALSE; } if ($data[$c]['TYPE'] == 'corporate' or $data[$c]['TYPE'] == 'celebrity') { $data[$c]['Receive_Email'] = '-99'; } unset($supporter); if ($data[$c]['Email']) { $supporter = check_supporter($data[$c]['Email']); if ($supporter['supporter_KEY']) { $data[$c]['key'] = $supporter['supporter_KEY']; if ($supporter['Receive_Email']) { unset($data[$c]['Receive_Email']); } } } $data[$c] = remove_empty_data_fields($data[$c], $supporter); #echo '<pre>'; #print_r($data[$c]); #echo '</pre>'; } } $dnum = count($data); for ($x = 0; $x < $dnum; $x++) { if ($x != 0) { #print_r($data[$x]); $supporter_KEY = $DIA->save('supporter', $data[$x]); #save to group if ($groups_KEY) { $g_data['groups_KEY'] = $groups_KEY; $g_data['supporter_KEY'] = $supporter_KEY; #print_r($g_data); $DIA->save('supporter_groups', $g_data); } sync_person_monsterpants($supporter_KEY); } } echo $c - 1 . ' lines inserted<br>'; return TRUE; }