1693 lines
86 KiB
PHP
1693 lines
86 KiB
PHP
<?php
|
|
|
|
include "db.php";
|
|
include "table.php";
|
|
include "include/logging-functions.php";
|
|
include "include/functions.php";
|
|
|
|
// startLog("school-setup.php");
|
|
|
|
if (array_key_exists('school_num',$_GET)) $school_num = intval($_GET['school_num']);
|
|
if (array_key_exists('school_num',$_POST)) $school_num = intval($_POST['school_num']);
|
|
if (isset($new_school_num)) $school_num = $new_school_num;
|
|
|
|
|
|
// Create other entries for a new school
|
|
if (!isset($school_num)) {
|
|
$school_num = 20324;
|
|
}
|
|
|
|
|
|
|
|
// Get school name
|
|
$results = db_query("select * from schools where record_num = $school_num");
|
|
$school = db_fetch_array($results);
|
|
|
|
// Check the school status
|
|
$SchoolStatus = $school['status'];
|
|
if ($school['status'] != 'Pending' && $school['status'] != 'Linked' && $school['status'] != 'Special') {
|
|
echo("Current School Status is: " . $school['status']) . "<br><br>";
|
|
}
|
|
|
|
$school_name = trim($school['school_name']);
|
|
$country = $school['country'];
|
|
$pac_name = trim($school['pac_name']);
|
|
$url = $school['url'];
|
|
$orgType = $school['type'];
|
|
$reseller = $school['reseller'];
|
|
|
|
// Check if this URL is in use already
|
|
$url = db_escape_string($url);
|
|
$results = db_query("SELECT * FROM schools WHERE url = '$url' AND status IN ('Active','Special')");
|
|
if (db_num_rows($results) > 0) {
|
|
echo("ERROR: Duplicate URL - $url<br>");
|
|
exit();
|
|
}
|
|
|
|
$siteType = "hotlunch";
|
|
if (strpos($url,'fundraiserorders.com') !== false) $siteType = 'fundraising';
|
|
if (strpos($url,'payschoolfees.net') !== false) $siteType = 'schoolfees';
|
|
if (strpos($url,'registrationnow.net') !== false) $siteType = 'registration';
|
|
|
|
// if ($siteType == "hotlunch" && strpos($url, "hotlunches.net") === false) $url = "www.$url";
|
|
|
|
$URLparts = explode('.',str_replace('www','',trim($url)));
|
|
if (count($URLparts) != 3 || $URLparts[0] == 'www') {
|
|
echo("INVALID URL - $url\n");
|
|
echo(count($URLparts)."\n");
|
|
echo("UNABLE to configure site\n");
|
|
exit();
|
|
}
|
|
|
|
$base_url = $URLparts[1].'.'.$URLparts[2];
|
|
|
|
|
|
echo("$school_name<br>\n");
|
|
echo("$pac_name<br>\n");
|
|
|
|
|
|
$date_added = date("Y-m-d",time());
|
|
$date_modified = $date_added;
|
|
|
|
|
|
// Check for colour scheme and other values
|
|
$default_language = 'English';
|
|
$school['default_language'] = 'English';
|
|
|
|
|
|
if (strlen($school['system_configuration']) == 0) $school['system_configuration'] = 'Full';
|
|
if ($school['system_configuration'] == 'Full') $other_modules_flag = 'Y';
|
|
else $other_modules_flag = 'N';
|
|
|
|
$schoolStatus = $school['status'];
|
|
if ($school['status'] == 'Linked') {
|
|
$other_modules_flag = 'N';
|
|
}
|
|
|
|
$school['site_active'] = 'Y';
|
|
$school['display'] = 'Y';
|
|
$school['display_linked_sites'] = 'Y';
|
|
$school['login_form_location'] = 'Default';
|
|
$school['rep'] = 'R';
|
|
|
|
$school['welcome_email_sent'] = 'N';
|
|
$school['followup_email_sent'] = 'N';
|
|
$school['testimonial'] = 'N';
|
|
$school['renewal_contact'] = 'N';
|
|
$school['demo_scheduled_date'] = '';
|
|
|
|
$school['email_system'] = $other_modules_flag;
|
|
$school['email_system_expires'] = 'N';
|
|
$school['email_system_expiry_date'] = '';
|
|
$school['other_modules'] = $other_modules_flag;
|
|
$school['event_calendar'] = $other_modules_flag;
|
|
$school['classified_ads'] = $other_modules_flag;
|
|
$school['photo_gallery'] = $other_modules_flag;
|
|
$school['math_worksheets'] = 'N';
|
|
$school['document_admin'] = 'Y';
|
|
$school['email_processing'] = 'N';
|
|
$school['email_aliases_file'] = '';
|
|
$school['max_email_aliases'] = 20;
|
|
$school['maillist_pop_account'] = '';
|
|
$school['use_access_code'] = 'Y';
|
|
|
|
$school['date_format'] = 'F j, Y';
|
|
|
|
$school['orders_for'] = 'Participants';
|
|
$school['registrants_are'] = 'Parents';
|
|
$school['participants_are'] = 'Students';
|
|
$school['participant_grouping'] = 'Class';
|
|
$school['group_leaders'] = 'Teachers';
|
|
|
|
$school['template'] = 'template-wide-menu.html';
|
|
$school['menu_color'] = '000000';
|
|
$school['menu_text_color'] = 'FFFFFF';
|
|
$school['menu_hover'] = '808080';
|
|
$school['hover_text_color'] = 'FFFFFF';
|
|
$school['data_odd'] = 'EEEEEE';
|
|
$school['data_odd_text'] = 'Black';
|
|
$school['data_even'] = 'CCCCCC';
|
|
$school['data_even_text'] = 'Black';
|
|
|
|
$school['small_school_discount'] = 'N';
|
|
$school['display_facebook'] = 'Y';
|
|
|
|
$school['logo_image'] = 'HotLunchLogo.jpg';
|
|
$school['logo_url'] = 'www.hotlunches.net';
|
|
|
|
$school['enable_parent_registration'] = 'Y';
|
|
$school['registrations_permitted'] = 'Parent';
|
|
$school['allow_duplicate_accounts'] = 'N';
|
|
$school['enable_customers'] = 'N';
|
|
$school['allow_parent_login'] = 'Y';
|
|
$school['allow_guest_login'] = 'Y';
|
|
$school['enable_participant_registration'] = 'N';
|
|
$school['enable_customer_registration'] = 'N';
|
|
$school['registration_userid'] = 'UserID';
|
|
$school['registration_second_parent'] = 'No';
|
|
$school['parent_field_titles'] = 'Mother and Father';
|
|
$school['registration_phone'] = 'Required';
|
|
$school['registration_daytime_phone'] = 'No';
|
|
$school['registration_cell_phone'] = 'No';
|
|
$school['registration_email'] = 'Required';
|
|
$school['registration_address'] = 'No';
|
|
$school['registration_language_selection'] = 'Y';
|
|
$school['registration_guest_student_info'] = 'Y';
|
|
$school['send_registation_email_with_paper_orders'] = 'Y';
|
|
|
|
$school['school_directory_permission'] = 'N';
|
|
$school['school_directory_text'] = 'Include in school directory?';
|
|
$school['email_list_permission'] = 'N';
|
|
$school['email_list_text'] = 'Include in school email list?';
|
|
$school['enable_class_parents'] = 'N';
|
|
|
|
$school['allow_parents_to_edit_students'] = 'Y';
|
|
$school['allow_duplicate_students'] = 'N';
|
|
|
|
$school['collect_student_number'] = 'N';
|
|
$school['collect_student_birthdate'] = 'N';
|
|
$school['collect_student_age'] = 'N';
|
|
$school['collect_student_sex'] = 'N';
|
|
$school['collect_student_grade'] = 'N';
|
|
$school['collect_permission'] = 'N';
|
|
|
|
$school['division_class_num_text'] = "Div";
|
|
$school['user_defined_values'] = 'N';
|
|
$school['max_schedules'] = 3;
|
|
$school['max_teachers_per_class'] = 2;
|
|
$school['staff_titles'] = 'N';
|
|
$school['default_staff_language'] = 'English';
|
|
$school['staff_meals_to_classroom'] = 'Y';
|
|
$school['display_staff_list'] = 'Y';
|
|
$school['display_class_lists'] = 'N';
|
|
$school['display_pac_info'] = 'N';
|
|
$school['display_parent_instructions'] = 'Y';
|
|
$school['allow_userid_change'] = 'N';
|
|
$school['display_user_account_balance'] = 'Y';
|
|
$school['minimum_display_balance'] = 5;
|
|
$school['maximum_order_balance'] = 0.00;
|
|
$school['balance_calculation_days_ago'] = 30;
|
|
$school['allow_ordering_with_balance_owing'] = 'Y';
|
|
$school['balance_calculation_for'] = 'All';
|
|
$school['previous_balances_post'] = "Post Automatically";
|
|
$school['previous_balances_post_message'] = "Previous Year Balance Posted";
|
|
$school['no_ordering_message'] = 'You will not be able to place orders at this time. Please contact the lunch team to correct the problem with your account.';
|
|
$school['implement_generated_charge'] = 'N';
|
|
$school['generated_charge_amount'] = 0.00;
|
|
$school['generated_charge_note'] = 'Generated fee to offset costs';
|
|
$school['generated_charge_occurrence'] = 'Once';
|
|
$school['implement_generated_credit'] = 'N';
|
|
$school['generated_credit_amount'] = 0.00;
|
|
$school['generated_credit_note'] = 'Generated credit for first order';
|
|
$school['generated_credit_occurrence'] = 'Once';
|
|
$school['allow_edit_of_paid_orders'] = 'N';
|
|
$school['allow_edit_of_complimentary_orders'] = 'N';
|
|
$school['order_confirmation_pop_up'] = 'N';
|
|
$school['products_per_menu_item'] = 10;
|
|
$school['display_bc_food_guidelines'] = 'N';
|
|
$school['enable_volunteer_signup'] = 'N';
|
|
$school['volunteer_signup_days_prior'] = 0;
|
|
$school['enable_volunteer_management'] = 'Y';
|
|
$school['send_volunteer_reminders'] = 'Y';
|
|
$school['volunteer_sorting'] = 'Last Name';
|
|
$school['include_volunteer_details'] = 'N';
|
|
$school['max_volunteers'] = 8;
|
|
$school['default_volunteer_message'] = "If you are able to assist as a volunteer on this lunch day please check this box";
|
|
if ($school['province'] == 'BC') $school['display_bc_food_guidelines'] = 'Y';
|
|
|
|
$school['paypal_enabled'] = 'N';
|
|
$school['bambora_enabled'] = 'N';
|
|
$school['display_bambora_form'] = 'Immediately';
|
|
|
|
$school['menu_item_font_size'] = '14px';
|
|
$school['menu_item_color'] = '000000';
|
|
$school['volunteer_msg_font'] = 'ddeddd';
|
|
$school['volunteer_msg_color'] = 'ddeddd';
|
|
|
|
$school['group_a_color'] = "10D010";
|
|
$school['group_b_color'] = "1010D0";
|
|
$school['group_c_color'] = "D01010";
|
|
$school['group_d_color'] = "D0D010";
|
|
$school['group_e_color'] = "10D0D0";
|
|
$school['group_f_color'] = "FFAE78";
|
|
$school['group_g_color'] = "A7FFA1";
|
|
$school['group_h_color'] = "0F8FFF";
|
|
$school['group_i_color'] = "E875FF";
|
|
$school['group_j_color'] = "F7FF8C";
|
|
$school['group_k_color'] = "D9EBFF";
|
|
$school['group_l_color'] = "A70FFF";
|
|
$school['group_m_color'] = "75BFFF";
|
|
$school['schedule_required_on_post'] = 'Y';
|
|
$school['post_with_recent_schedule'] = 'N';
|
|
$school['select_orders_on_post'] = 'N';
|
|
$school['select_transactions_on_post'] = 'Y';
|
|
$school['send_payment_notification'] = 'N';
|
|
$school['send_order_email'] = 'All Orders';
|
|
$school['allow_account_deposits'] = 'N';
|
|
|
|
$school['display_group_colors'] = 'Y';
|
|
$school['display_group_letters'] = 'Y';
|
|
$school['cafeteria_ordering'] = 'N';
|
|
$school['cafeteria_balance_limit'] = 0.00;
|
|
|
|
$school['implement_meal_locations'] = 'N';
|
|
|
|
$school['delivery_report_students'] = 'With Orders';
|
|
$school['delivery_report_staff'] = 'Y';
|
|
$school['delivery_report_row_height'] = 'Normal';
|
|
$school['paper_order_form_size'] = 'Letter';
|
|
$school['paper_order_form_name_fields'] = 'First';
|
|
$school['directory_sort'] = 'Class';
|
|
$school['implement_delivery_groups'] = 'N';
|
|
$school['include_revenue_in_details_csv'] = 'Y';
|
|
|
|
$school['schedule_team_access_reports'] = 'Y';
|
|
|
|
$school['label_print_school_name'] = 'N';
|
|
$school['label_separate_options'] = 'N';
|
|
|
|
$school['paypal_enabled'] = 'N';
|
|
$school['paypal_verified'] = 'N';
|
|
$school['paypal_minimum_amount'] = 0.00;
|
|
$school['paypal_code'] = '';
|
|
$school['paypal_mode'] = 'Live';
|
|
$school['paypal_currency'] = 'CAD';
|
|
$school['paypal_button_text'] = 'Pay With PayPal';
|
|
$school['paypal_fee'] = 0;
|
|
$school['paypal_percentage'] = 0;
|
|
$school['paypal_fee_message'] = '';
|
|
$school['paypal_donation'] = 'N';
|
|
$school['paypal_donation_message'] = '';
|
|
|
|
$school['exact_enabled'] = 'N';
|
|
$school['exact_code'] = '';
|
|
$school['exact_currency'] = 'CAD';
|
|
$school['exact_button_text'] = 'Pay With PayPal';
|
|
|
|
$school['currency_symbol'] = '$';
|
|
$school['check_register_sort'] = 'Date';
|
|
$school['display_remittance_button'] = 'Y';
|
|
$school['remittance_button_text'] = 'Print Remittance Form';
|
|
$school['accept_check'] = 'Y';
|
|
$school['accept_cash'] = 'Y';
|
|
$school['display_remittance_msg_with_button'] = 'N';
|
|
$school['remittance_form_fee'] = 0.00;
|
|
$school['display_print_order_button'] = 'Y';
|
|
$school['delete_inactive_orders_email_subject'] = 'Your Inactive Order Has Been Deleted';
|
|
$school['default_event_status'] = 'Approved';
|
|
$school['can_parents_post_events'] = 'Y';
|
|
$school['num_reminder_events'] = 5;
|
|
$school['public_event_calendar'] = 'N';
|
|
$school['default_classified_status'] = 'Approved';
|
|
$school['classified_duration'] = 28;
|
|
$school['additional_pages_title'] = 'Additional Pages';
|
|
$school['implement_page_tabs'] = 'N';
|
|
$school['calculate_supplier_costs'] = 'Y';
|
|
$school['supplier_costs_decimals'] = 2;
|
|
$school['verified_only_class_list'] = 'Y';
|
|
if (strlen($school['contact_email'])) $school['support_email'] = $school['contact_email'];
|
|
$school['reply_email'] = $school['contact_email'];
|
|
$school['reply_description'] = $school['pac_name'];
|
|
$school['email_title'] = $school['pac_name'] . " E-News";
|
|
$school['schedule_sort'] = 'sequence';
|
|
$school['special_item_prices'] = 'N';
|
|
$school['complimentary_item_processing'] = 'N';
|
|
$school['implement_multiple_item_prices'] = 'N';
|
|
$school['limit_access_to_flex_prices'] = 'N';
|
|
$school['taxable_items'] = 'None';
|
|
$school['registration_form_message'] = "By registering for an account you agree that your information may be used by the " .
|
|
"assigned administrators of the web site for the purposes of managing orders and payments " .
|
|
"in the system. Your information will be kept private and never shared with third parties.";
|
|
$school['email_broadcast_optional'] = 'Y';
|
|
$school['email_reminder_optional'] = 'Y';
|
|
$school['email_reminder_title'] = "Weekly Lunch Email Reminder";
|
|
$school['email_reminder_day'] = "Sun";
|
|
if ($siteType != "hotlunch") $school['email_reminder_day'] = "None";
|
|
$school['type'] = "School";
|
|
$school['email_reminder_weeks'] = 1;
|
|
$school['email_reminder_description'] = "N";
|
|
$school['email_reminders_to'] = "Everyone";
|
|
$school['volunteer_reminder_title'] = "Weekly Volunteer Reminder";
|
|
$school['volunteer_reminder_day'] = "None";
|
|
|
|
|
|
if ($schoolStatus == 'Pending') {
|
|
db_query("DELETE FROM formatted_content WHERE school_num = $school_num");
|
|
echo("Formatted Content Cleared<br>");
|
|
}
|
|
|
|
|
|
|
|
switch ($country) {
|
|
case 'Canada':
|
|
$paypal_currency = 'CAD';
|
|
break;
|
|
|
|
case 'USA':
|
|
$paypal_currency = 'USD';
|
|
break;
|
|
|
|
case 'UK':
|
|
$paypal_currency = 'GBP';
|
|
break;
|
|
}
|
|
|
|
|
|
if ($school['status'] != 'Linked') {
|
|
$school['bg_color'] = '#EEEEEE';
|
|
$school['background'] = 'boxes-grey.png';
|
|
$school['colour_scheme'] = 'black.css';
|
|
$school['application_title'] = "Welcome to the " . $school['school_name'] . " Lunch Web Site";
|
|
$school['p_display_teachers'] = 'Y';
|
|
$school['p_display_program'] = 'Y';
|
|
$school['p_display_grade'] = 'Y';
|
|
$school['p_display_division'] = 'Y';
|
|
$school['p_display_description'] = 'N';
|
|
$school['i_display_teachers'] = 'Y';
|
|
$school['i_display_program'] = 'Y';
|
|
$school['i_display_grade'] = 'Y';
|
|
$school['i_display_division'] = 'Y';
|
|
$school['i_display_description'] = 'N';
|
|
$school['c_display_name'] = 'Y';
|
|
$school['c_display_home_phone'] = 'Y';
|
|
$school['c_display_work_phone'] = 'Y';
|
|
$school['c_display_cell_phone'] = 'Y';
|
|
$school['c_display_home_email'] = 'Y';
|
|
$school['default_order_status'] = 'Unpaid';
|
|
$school['default_order_status_special1'] = 'Unpaid';
|
|
$school['default_order_status_special2'] = 'Unpaid';
|
|
$school['default_order_status_special3'] = 'Unpaid';
|
|
$school['delete_inactive_orders_hours'] = 0;
|
|
}
|
|
|
|
if ($siteType == 'schoolfees' || $siteType == 'registration') {
|
|
$kword = "Registration";
|
|
if ($siteType == 'schoolfees') $kword = "Fees";
|
|
$school['application_title'] = "Welcome to the " . $school['school_name'] . " $kword Site";
|
|
$school['default_order_status'] = 'Inactive';
|
|
$school['delete_inactive_orders_hours'] = 48;
|
|
$school['use_access_code'] = 'N';
|
|
$school['delivery_report_students'] = 'All Students';
|
|
$school['delivery_report_staff'] = 'N';
|
|
|
|
$school['enable_volunteer_signup'] = 'N';
|
|
$school['enable_volunteer_management'] = 'N';
|
|
$school['include_volunteer_details'] = 'N';
|
|
$school['max_volunteers'] = 0;
|
|
}
|
|
|
|
$month = date("m",time());
|
|
$school['expiry_date'] = date("Y-07-31",time());
|
|
if ($month >= '07' || $month <= '03') {
|
|
$school['expiry_date'] = date("Y-m-d",time() + 60 * 60 * 24 * 61);
|
|
}
|
|
|
|
|
|
//
|
|
// Handle reseller overrides
|
|
//
|
|
if ($SchoolStatus == 'Pending' && $reseller != "hotlunch") {
|
|
$results = db_query("SELECT * FROM resellers WHERE reseller_code = '$reseller'");
|
|
|
|
if (db_num_rows($results)) {
|
|
$overrides = db_fetch_assoc($results);
|
|
$reseller_source_school_num = $overrides['source_school_num'];
|
|
$src_school = array();
|
|
echo("Reseller: $reseller ($reseller_source_school_num)<br>\n");
|
|
|
|
if ($reseller_source_school_num > 0) {
|
|
echo("Reseller Source School: $reseller_source_school_num<br>\n");
|
|
$results = db_query("SELECT * FROM schools WHERE record_num = $reseller_source_school_num");
|
|
if (db_num_rows($results)) $src_school = db_fetch_assoc($results);
|
|
|
|
|
|
// Get any additional pages and copy them
|
|
db_query("DELETE FROM formatted_content WHERE school_num = $school_num AND content_type = 'A'");
|
|
$results = db_query("SELECT * FROM formatted_content WHERE school_num = $reseller_source_school_num AND content_type = 'A'");
|
|
if (db_num_rows($results)) {
|
|
$formatted_content = new Table('formatted_content');
|
|
$date_added = date("Y-m-d",time());
|
|
while ($additional = db_fetch_array($results)) {
|
|
$content_id = $additional['content_id'];
|
|
$content_type = $additional['content_type'];
|
|
$sequence = $additional['sequence'];
|
|
$content = $additional['content'];
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$Fields = array(
|
|
"bill_to_address",
|
|
"bill_to_city",
|
|
"bill_to_province",
|
|
"bill_to_country",
|
|
"bill_to_postal",
|
|
"bill_to_phone",
|
|
"registrants_are",
|
|
"participants_are",
|
|
"participant_grouping",
|
|
"group_leaders",
|
|
"template",
|
|
"bg_color",
|
|
"colour_scheme",
|
|
"background",
|
|
"menu_color",
|
|
"menu_text_color",
|
|
"menu_hover",
|
|
"hover_text_color",
|
|
"data_odd",
|
|
"data_odd_text",
|
|
"data_even",
|
|
"data_even_text",
|
|
"menu_dates_on_holidays",
|
|
"system_configuration",
|
|
"email_system",
|
|
"other_modules",
|
|
"event_calendar",
|
|
"classified_ads",
|
|
"photo_gallery",
|
|
"use_access_code",
|
|
"login_form_location",
|
|
"enable_parent_registration",
|
|
"registrations_permitted",
|
|
"enable_customers",
|
|
"customer_address",
|
|
"customer_phone",
|
|
"customer_email",
|
|
"allow_parent_login",
|
|
"allow_guest_login",
|
|
"enable_participant_registration",
|
|
"enable_customer_registration",
|
|
"registration_userid",
|
|
"registration_second_parent",
|
|
"parent_field_titles",
|
|
"registration_phone",
|
|
"registration_email",
|
|
"registration_daytime_phone",
|
|
"registration_cell_phone",
|
|
"registration_address",
|
|
"additional_registration_data_field1",
|
|
"additional_registration_data_field2",
|
|
"registration_form_message",
|
|
"send_registation_email_with_paper_orders",
|
|
"school_directory_permission",
|
|
"school_directory_text",
|
|
"email_list_permission",
|
|
"email_list_text",
|
|
"enable_class_parents",
|
|
"collect_student_birthdate",
|
|
"collect_student_age",
|
|
"collect_student_sex",
|
|
"collect_student_grade",
|
|
"collect_student_number",
|
|
"collect_permission",
|
|
"permission_prompt",
|
|
"permission_description",
|
|
"p_display_teachers",
|
|
"p_display_program",
|
|
"p_display_grade",
|
|
"p_display_division",
|
|
"p_display_description",
|
|
"i_display_teachers",
|
|
"i_display_program",
|
|
"i_display_grade",
|
|
"i_display_division",
|
|
"i_display_description",
|
|
"c_display_name",
|
|
"c_display_home_phone",
|
|
"c_display_work_phone",
|
|
"c_display_cell_phone",
|
|
"c_display_home_email",
|
|
"student_button_text",
|
|
"student_class_text",
|
|
"division_class_num_text",
|
|
"user_defined_values",
|
|
"user_defined_title",
|
|
"user_defined_values2",
|
|
"user_defined_title2",
|
|
"class_sort",
|
|
"max_schedules",
|
|
"menu_dates_on_holidays",
|
|
"max_teachers_per_class",
|
|
"staff_meals_to_classroom",
|
|
"display_staff_list",
|
|
"display_class_lists",
|
|
"display_pac_info",
|
|
"allow_userid_change",
|
|
"display_user_account_balance",
|
|
"minimum_display_balance",
|
|
"maximum_order_balance",
|
|
"balance_calculation_days_ago",
|
|
"allow_ordering_with_balance_owing",
|
|
"previous_balances_post",
|
|
"previous_balances_post_message",
|
|
"no_ordering_message",
|
|
"verified_only_class_list",
|
|
"allow_edit_of_paid_orders",
|
|
"allow_edit_of_complimentary_orders",
|
|
"order_entered_message",
|
|
"schedule_sort",
|
|
"special_item_prices",
|
|
"taxable_items",
|
|
"display_bc_food_guidelines",
|
|
"label_print_school_name",
|
|
"enable_volunteer_signup",
|
|
"volunteer_signup_days_prior",
|
|
"enable_volunteer_management",
|
|
"volunteer_sorting",
|
|
"include_volunteer_details",
|
|
"max_volunteers",
|
|
"default_volunteer_message",
|
|
"group_a_color",
|
|
"group_b_color",
|
|
"group_c_color",
|
|
"group_d_color",
|
|
"group_e_color",
|
|
"group_f_color",
|
|
"group_g_color",
|
|
"group_h_color",
|
|
"group_i_color",
|
|
"group_j_color",
|
|
"group_k_color",
|
|
"group_l_color",
|
|
"group_m_color",
|
|
"display_group_colors",
|
|
"display_group_letters",
|
|
"implement_meal_locations",
|
|
"delivery_report_students",
|
|
"delivery_report_staff",
|
|
"delivery_report_row_height",
|
|
"paper_order_form_size",
|
|
"paper_order_form_name_fields",
|
|
"directory_sort",
|
|
"implement_delivery_groups",
|
|
"include_revenue_in_details_csv",
|
|
"schedule_team_access_reports",
|
|
"allow_staff_to_post_payments",
|
|
"schedule_required_on_post",
|
|
"post_with_recent_schedule",
|
|
"select_orders_on_post",
|
|
"send_payment_notification",
|
|
"calculate_supplier_costs",
|
|
"supplier_costs_decimals",
|
|
"logo_image",
|
|
"logo_url",
|
|
"receipt_image",
|
|
"receipt_title",
|
|
"display_staff_list",
|
|
"display_class_lists",
|
|
"display_pac_info",
|
|
"menu_item_font_size",
|
|
"menu_item_color",
|
|
"check_register_sort",
|
|
"display_user_account_balance",
|
|
"minimum_display_balance",
|
|
"maximum_order_balance",
|
|
"balance_calculation_days_ago",
|
|
"allow_ordering_with_balance_owing",
|
|
"previous_balances_post",
|
|
"previous_balances_post_message",
|
|
"exact_enabled",
|
|
"exact_code",
|
|
"exact_currency",
|
|
"exact_button_text",
|
|
"display_remittance_button",
|
|
"remittance_button_text",
|
|
"accept_check",
|
|
"accept_cash",
|
|
"display_remittance_msg_with_button",
|
|
"remittance_form_fee",
|
|
"display_print_order_button",
|
|
"default_student_status",
|
|
"default_order_status",
|
|
"delete_inactive_orders_hours",
|
|
"default_event_status",
|
|
"num_reminder_events",
|
|
"public_event_calendar",
|
|
"default_classified_status",
|
|
"classified_duration",
|
|
"additional_pages_title",
|
|
"support_email",
|
|
"reply_email",
|
|
"reply_description",
|
|
"email_title",
|
|
"email_footer",
|
|
"email_broadcast_optional",
|
|
"email_reminder_optional",
|
|
"email_reminder_title",
|
|
"email_reminder_day",
|
|
"volunteer_reminder_title",
|
|
"volunteer_reminder_day"
|
|
);
|
|
|
|
for ($i = 0; $i < count($Fields); $i++) {
|
|
$field = $Fields[$i];
|
|
|
|
if (in_array($field,$overrides) && strlen($overrides[$field])) {
|
|
if ($overrides[$field] == "none") $school[$field] = '';
|
|
else $school[$field] = $overrides[$field];
|
|
}
|
|
|
|
if (is_array($src_school) && array_key_exists($field,$src_school)) {
|
|
$school[$field] = $src_school[$field];
|
|
// echo("$field: " . $src_school[$field] . "<br>\n");
|
|
}
|
|
}
|
|
}
|
|
|
|
$school['expiry_date'] = date("Y-07-31",time() + 60 * 60 * 24 * 200);
|
|
}
|
|
|
|
|
|
extract($school);
|
|
echo("$expiry_date<br>\n");
|
|
echo("$url<br>\n");
|
|
$record_num = $school_num;
|
|
|
|
if ($school['status'] != 'Linked') {
|
|
$document_path = sprintf("%08d",$record_num);
|
|
if (!is_dir("files/$document_path")) mkdir("files/$document_path",0777);
|
|
|
|
$subdirs = array("attachments","documents","galleries","image","product_images","orders","admin","admin/lists","admin/aliases",".thumbs");
|
|
for ($i = 0; $i < count($subdirs); $i++) {
|
|
$sdir = $subdirs[$i];
|
|
if (!is_dir("files/$document_path/$sdir")) mkdir("files/$document_path/$sdir",0777);
|
|
}
|
|
|
|
// Copy images from source if required
|
|
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
|
|
$source_path = sprintf("%08d",$reseller_source_school_num);
|
|
for ($i = 0; $i < count($subdirs); $i++) {
|
|
$sdir = $subdirs[$i];
|
|
$dir = opendir("files/$source_path/$sdir");
|
|
while ($file = readdir($dir)) {
|
|
if ($file == ".") continue;
|
|
if ($file == "..") continue;
|
|
|
|
if (is_file("files/$source_path/$sdir/$file")) copy("files/$source_path/$sdir/$file","files/$document_path/$sdir/$file");
|
|
}
|
|
closedir($dir);
|
|
}
|
|
}
|
|
}
|
|
|
|
$bambora_parent_id = '';
|
|
|
|
|
|
$schools = array();
|
|
if (isset($school_name)) $schools['school_name'] = $school_name;
|
|
if (isset($address)) $schools['address'] = $address;
|
|
if (isset($city)) $schools['city'] = $city;
|
|
if (isset($province)) $schools['province'] = $province;
|
|
if (isset($country)) $schools['country'] = $country;
|
|
if (isset($postal)) $schools['postal'] = $postal;
|
|
if (isset($phone)) $schools['phone'] = $phone;
|
|
if (isset($principal)) $schools['principal'] = $principal;
|
|
if (isset($principal_email)) $schools['principal_email'] = $principal_email;
|
|
if (isset($pac_president)) $schools['pac_president'] = $pac_president;
|
|
if (isset($pac_email)) $schools['pac_email'] = $pac_email;
|
|
if (isset($contact_name)) $schools['contact_name'] = $contact_name;
|
|
if (isset($contact_email)) $schools['contact_email'] = $contact_email;
|
|
if (isset($contact_phone)) $schools['contact_phone'] = $contact_phone;
|
|
if (isset($contact2_name)) $schools['contact2_name'] = $contact2_name;
|
|
if (isset($contact2_email)) $schools['contact2_email'] = $contact2_email;
|
|
if (isset($contact2_phone)) $schools['contact2_phone'] = $contact2_phone;
|
|
if (isset($pac_name)) $schools['pac_name'] = $pac_name;
|
|
if (isset($bill_to_address)) $schools['bill_to_address'] = $bill_to_address;
|
|
if (isset($bill_to_city)) $schools['bill_to_city'] = $bill_to_city;
|
|
if (isset($bill_to_province)) $schools['bill_to_province'] = $bill_to_province;
|
|
if (isset($bill_to_country)) $schools['bill_to_country'] = $bill_to_country;
|
|
if (isset($bill_to_postal)) $schools['bill_to_postal'] = $bill_to_postal;
|
|
if (isset($bill_to_phone)) $schools['bill_to_phone'] = $bill_to_phone;
|
|
if (isset($bill_to_email)) $schools['bill_to_email'] = $bill_to_email;
|
|
if (isset($listing_city)) $schools['listing_city'] = $listing_city;
|
|
if (isset($type)) $schools['type'] = $type;
|
|
if (isset($starting_grade)) $schools['starting_grade'] = $starting_grade;
|
|
if (isset($ending_grade)) $schools['ending_grade'] = $ending_grade;
|
|
if (isset($timezone)) $schools['timezone'] = $timezone;
|
|
if (isset($date_format)) $schools['date_format'] = $date_format;
|
|
if (isset($time_format)) $schools['time_format'] = $time_format;
|
|
if (isset($default_language)) $schools['default_language'] = $default_language;
|
|
if (isset($application_title)) $schools['application_title'] = $application_title;
|
|
if (isset($orders_for)) $schools['orders_for'] = $orders_for;
|
|
if (isset($registrants_are)) $schools['registrants_are'] = $registrants_are;
|
|
if (isset($participants_are)) $schools['participants_are'] = $participants_are;
|
|
if (isset($participant_grouping)) $schools['participant_grouping'] = $participant_grouping;
|
|
if (isset($group_leaders)) $schools['group_leaders'] = $group_leaders;
|
|
if (isset($default_url_code)) $schools['default_url_code'] = $default_url_code;
|
|
if (isset($url)) $schools['url'] = $url;
|
|
if (isset($alt_url)) $schools['alt_url'] = $alt_url;
|
|
if (isset($base_url)) $schools['base_url'] = $base_url;
|
|
if (isset($application_url)) $schools['application_url'] = $application_url;
|
|
if (isset($secure_certificate)) $schools['secure_certificate'] = $secure_certificate;
|
|
if (isset($linked_site)) $schools['linked_site'] = $linked_site;
|
|
if (isset($site_active)) $schools['site_active'] = $site_active;
|
|
if (isset($link_title)) $schools['link_title'] = $link_title;
|
|
if (isset($link_sequence)) $schools['link_sequence'] = $link_sequence;
|
|
if (isset($locker_school_num)) $schools['locker_school_num'] = $locker_school_num;
|
|
if (isset($counsellor_school_num)) $schools['counsellor_school_num'] = $counsellor_school_num;
|
|
if (isset($scantracker_school_num)) $schools['scantracker_school_num'] = $scantracker_school_num;
|
|
if (isset($school_appointments_school_num)) $schools['school_appointments_school_num'] = $school_appointments_school_num;
|
|
if (isset($student_signup_school_num)) $schools['student_signup_school_num'] = $student_signup_school_num;
|
|
if (isset($start_date)) $schools['start_date'] = $start_date;
|
|
if (isset($expiry_date)) $schools['expiry_date'] = $expiry_date;
|
|
if (isset($status)) $schools['status'] = $status;
|
|
if (isset($support_level)) $schools['support_level'] = $support_level;
|
|
if (isset($welcome_email_sent)) $schools['welcome_email_sent'] = $welcome_email_sent;
|
|
if (isset($followup_email_sent)) $schools['followup_email_sent'] = $followup_email_sent;
|
|
if (isset($demos_scheduled)) $schools['demos_scheduled'] = $demos_scheduled;
|
|
if (isset($demo_scheduled_date)) $schools['demo_scheduled_date'] = $demo_scheduled_date;
|
|
if (isset($demo_date)) $schools['demo_date'] = $demo_date;
|
|
if (isset($demo_count)) $schools['demo_count'] = $demo_count;
|
|
if (isset($followup1_date)) $schools['followup1_date'] = $followup1_date;
|
|
if (isset($followup2_date)) $schools['followup2_date'] = $followup2_date;
|
|
if (isset($followup_note1)) $schools['followup_note1'] = $followup_note1;
|
|
if (isset($followup_note2)) $schools['followup_note2'] = $followup_note2;
|
|
if (isset($last_contact_date)) $schools['last_contact_date'] = $last_contact_date;
|
|
if (isset($testimonial)) $schools['testimonial'] = $testimonial;
|
|
if (isset($renewal_contact)) $schools['renewal_contact'] = $renewal_contact;
|
|
if (isset($rep)) $schools['rep'] = $rep;
|
|
if (isset($data_current_application_contacts)) $schools['data_current_application_contacts'] = $data_current_application_contacts;
|
|
if (isset($data_current_school_contacts)) $schools['data_current_school_contacts'] = $data_current_school_contacts;
|
|
if (isset($reseller)) $schools['reseller'] = $reseller;
|
|
if (isset($logo_image)) $schools['logo_image'] = $logo_image;
|
|
if (isset($logo_url)) $schools['logo_url'] = $logo_url;
|
|
if (isset($receipt_image)) $schools['receipt_image'] = $receipt_image;
|
|
if (isset($receipt_title)) $schools['receipt_title'] = $receipt_title;
|
|
if (isset($display)) $schools['display'] = $display;
|
|
if (isset($referred_by)) $schools['referred_by'] = $referred_by;
|
|
if (isset($payment_status)) $schools['payment_status'] = $payment_status;
|
|
if (isset($balance_owing)) $schools['balance_owing'] = $balance_owing;
|
|
if (isset($document_path)) $schools['document_path'] = $document_path;
|
|
if (isset($background)) $schools['background'] = $background;
|
|
if (isset($bg_color)) $schools['bg_color'] = $bg_color;
|
|
if (isset($colour_scheme)) $schools['colour_scheme'] = $colour_scheme;
|
|
if (isset($template)) $schools['template'] = $template;
|
|
if (isset($navigation_mode)) $schools['navigation_mode'] = $navigation_mode;
|
|
if (isset($menu_color)) $schools['menu_color'] = $menu_color;
|
|
if (isset($menu_text_color)) $schools['menu_text_color'] = $menu_text_color;
|
|
if (isset($menu_hover)) $schools['menu_hover'] = $menu_hover;
|
|
if (isset($hover_text_color)) $schools['hover_text_color'] = $hover_text_color;
|
|
if (isset($data_odd)) $schools['data_odd'] = $data_odd;
|
|
if (isset($data_odd_text)) $schools['data_odd_text'] = $data_odd_text;
|
|
if (isset($data_even)) $schools['data_even'] = $data_even;
|
|
if (isset($data_even_text)) $schools['data_even_text'] = $data_even_text;
|
|
if (isset($system_configuration)) $schools['system_configuration'] = $system_configuration;
|
|
if (isset($small_school_discount)) $schools['small_school_discount'] = $small_school_discount;
|
|
if (isset($additional_invoice_fee_text)) $schools['additional_invoice_fee_text'] = $additional_invoice_fee_text;
|
|
if (isset($additional_invoice_fee_type)) $schools['additional_invoice_fee_type'] = $additional_invoice_fee_type;
|
|
if (isset($additional_invoice_fee_amount)) $schools['additional_invoice_fee_amount'] = $additional_invoice_fee_amount;
|
|
if (isset($display_facebook)) $schools['display_facebook'] = $display_facebook;
|
|
if (isset($email_system)) $schools['email_system'] = $email_system;
|
|
if (isset($prev_email_system)) $schools['prev_email_system'] = $prev_email_system;
|
|
if (isset($email_system_expires)) $schools['email_system_expires'] = $email_system_expires;
|
|
if (isset($email_system_expiry_date)) $schools['email_system_expiry_date'] = $email_system_expiry_date;
|
|
if (isset($other_modules)) $schools['other_modules'] = $other_modules;
|
|
if (isset($event_calendar)) $schools['event_calendar'] = $event_calendar;
|
|
if (isset($classified_ads)) $schools['classified_ads'] = $classified_ads;
|
|
if (isset($photo_gallery)) $schools['photo_gallery'] = $photo_gallery;
|
|
if (isset($math_worksheets)) $schools['math_worksheets'] = $math_worksheets;
|
|
if (isset($document_admin)) $schools['document_admin'] = $document_admin;
|
|
if (isset($email_processing)) $schools['email_processing'] = $email_processing;
|
|
if (isset($email_aliases_file)) $schools['email_aliases_file'] = $email_aliases_file;
|
|
if (isset($email_broadcast_addresses)) $schools['email_broadcast_addresses'] = $email_broadcast_addresses;
|
|
if (isset($maillist_pop_account)) $schools['maillist_pop_account'] = $maillist_pop_account;
|
|
if (isset($use_access_code)) $schools['use_access_code'] = $use_access_code;
|
|
if (isset($system_access_code)) $schools['system_access_code'] = $system_access_code;
|
|
if (isset($login_form_location)) $schools['login_form_location'] = $login_form_location;
|
|
if (isset($enable_parent_registration)) $schools['enable_parent_registration'] = $enable_parent_registration;
|
|
if (isset($registrations_permitted)) $schools['registrations_permitted'] = $registrations_permitted;
|
|
if (isset($allow_duplicate_accounts)) $schools['allow_duplicate_accounts'] = $allow_duplicate_accounts;
|
|
if (isset($enable_customers)) $schools['enable_customers'] = $enable_customers;
|
|
if (isset($customer_address)) $schools['customer_address'] = $customer_address;
|
|
if (isset($customer_phone)) $schools['customer_phone'] = $customer_phone;
|
|
if (isset($customer_email)) $schools['customer_email'] = $customer_email;
|
|
if (isset($allow_parent_login)) $schools['allow_parent_login'] = $allow_parent_login;
|
|
if (isset($allow_guest_login)) $schools['allow_guest_login'] = $allow_guest_login;
|
|
if (isset($enable_participant_registration)) $schools['enable_participant_registration'] = $enable_participant_registration;
|
|
if (isset($enable_customer_registration)) $schools['enable_customer_registration'] = $enable_customer_registration;
|
|
if (isset($registration_userid)) $schools['registration_userid'] = $registration_userid;
|
|
if (isset($registration_second_parent)) $schools['registration_second_parent'] = $registration_second_parent;
|
|
if (isset($parent_field_titles)) $schools['parent_field_titles'] = $parent_field_titles;
|
|
if (isset($registration_phone)) $schools['registration_phone'] = $registration_phone;
|
|
if (isset($registration_daytime_phone)) $schools['registration_daytime_phone'] = $registration_daytime_phone;
|
|
if (isset($registration_cell_phone)) $schools['registration_cell_phone'] = $registration_cell_phone;
|
|
if (isset($registration_email)) $schools['registration_email'] = $registration_email;
|
|
if (isset($registration_address)) $schools['registration_address'] = $registration_address;
|
|
if (isset($registration_language_selection)) $schools['registration_language_selection'] = $registration_language_selection;
|
|
if (isset($registration_volunteer_list)) $schools['registration_volunteer_list'] = $registration_volunteer_list;
|
|
if (isset($registration_guest_student_info)) $schools['registration_guest_student_info'] = $registration_guest_student_info;
|
|
if (isset($additional_registration_data_field1)) $schools['additional_registration_data_field1'] = $additional_registration_data_field1;
|
|
if (isset($additional_registration_data_field2)) $schools['additional_registration_data_field2'] = $additional_registration_data_field2;
|
|
if (isset($registration_form_message)) $schools['registration_form_message'] = $registration_form_message;
|
|
if (isset($send_registation_email_with_paper_orders)) $schools['send_registation_email_with_paper_orders'] = $send_registation_email_with_paper_orders;
|
|
if (isset($school_directory_permission)) $schools['school_directory_permission'] = $school_directory_permission;
|
|
if (isset($school_directory_text)) $schools['school_directory_text'] = $school_directory_text;
|
|
if (isset($email_list_permission)) $schools['email_list_permission'] = $email_list_permission;
|
|
if (isset($email_list_text)) $schools['email_list_text'] = $email_list_text;
|
|
if (isset($enable_class_parents)) $schools['enable_class_parents'] = $enable_class_parents;
|
|
if (isset($allow_parents_to_edit_students)) $schools['allow_parents_to_edit_students'] = $allow_parents_to_edit_students;
|
|
if (isset($allow_duplicate_students)) $schools['allow_duplicate_students'] = $allow_duplicate_students;
|
|
if (isset($collect_student_birthdate)) $schools['collect_student_birthdate'] = $collect_student_birthdate;
|
|
if (isset($collect_student_age)) $schools['collect_student_age'] = $collect_student_age;
|
|
if (isset($collect_student_sex)) $schools['collect_student_sex'] = $collect_student_sex;
|
|
if (isset($collect_student_grade)) $schools['collect_student_grade'] = $collect_student_grade;
|
|
if (isset($collect_student_number)) $schools['collect_student_number'] = $collect_student_number;
|
|
if (isset($collect_permission)) $schools['collect_permission'] = $collect_permission;
|
|
if (isset($permission_prompt)) $schools['permission_prompt'] = $permission_prompt;
|
|
if (isset($permission_description)) $schools['permission_description'] = $permission_description;
|
|
if (isset($p_display_teachers)) $schools['p_display_teachers'] = $p_display_teachers;
|
|
if (isset($p_display_program)) $schools['p_display_program'] = $p_display_program;
|
|
if (isset($p_display_grade)) $schools['p_display_grade'] = $p_display_grade;
|
|
if (isset($p_display_division)) $schools['p_display_division'] = $p_display_division;
|
|
if (isset($p_display_description)) $schools['p_display_description'] = $p_display_description;
|
|
if (isset($i_display_teachers)) $schools['i_display_teachers'] = $i_display_teachers;
|
|
if (isset($i_display_program)) $schools['i_display_program'] = $i_display_program;
|
|
if (isset($i_display_grade)) $schools['i_display_grade'] = $i_display_grade;
|
|
if (isset($i_display_division)) $schools['i_display_division'] = $i_display_division;
|
|
if (isset($i_display_description)) $schools['i_display_description'] = $i_display_description;
|
|
if (isset($c_display_name)) $schools['c_display_name'] = $c_display_name;
|
|
if (isset($c_display_home_phone)) $schools['c_display_home_phone'] = $c_display_home_phone;
|
|
if (isset($c_display_work_phone)) $schools['c_display_work_phone'] = $c_display_work_phone;
|
|
if (isset($c_display_cell_phone)) $schools['c_display_cell_phone'] = $c_display_cell_phone;
|
|
if (isset($c_display_home_email)) $schools['c_display_home_email'] = $c_display_home_email;
|
|
if (isset($c_display_home_address)) $schools['c_display_home_address'] = $c_display_home_address;
|
|
if (isset($student_button_text)) $schools['student_button_text'] = $student_button_text;
|
|
if (isset($student_class_text)) $schools['student_class_text'] = $student_class_text;
|
|
if (isset($division_class_num_text)) $schools['division_class_num_text'] = $division_class_num_text;
|
|
if (isset($user_defined_values)) $schools['user_defined_values'] = $user_defined_values;
|
|
if (isset($user_defined_values_required)) $schools['user_defined_values_required'] = $user_defined_values_required;
|
|
if (isset($user_defined_title)) $schools['user_defined_title'] = $user_defined_title;
|
|
if (isset($user_defined_values2)) $schools['user_defined_values2'] = $user_defined_values2;
|
|
if (isset($user_defined_values2_required)) $schools['user_defined_values2_required'] = $user_defined_values2_required;
|
|
if (isset($user_defined_title2)) $schools['user_defined_title2'] = $user_defined_title2;
|
|
if (isset($user_defined_values3)) $schools['user_defined_values3'] = $user_defined_values3;
|
|
if (isset($user_defined_values3_required)) $schools['user_defined_values3_required'] = $user_defined_values3_required;
|
|
if (isset($user_defined_title3)) $schools['user_defined_title3'] = $user_defined_title3;
|
|
if (isset($send_no_order_reminders)) $schools['send_no_order_reminders'] = $send_no_order_reminders;
|
|
if (isset($implement_diet_requests)) $schools['implement_diet_requests'] = $implement_diet_requests;
|
|
if (isset($student_disclaimer)) $schools['student_disclaimer'] = $student_disclaimer;
|
|
if (isset($class_sort)) $schools['class_sort'] = $class_sort;
|
|
if (isset($max_schedules)) $schools['max_schedules'] = $max_schedules;
|
|
if (isset($menu_dates_on_holidays)) $schools['menu_dates_on_holidays'] = $menu_dates_on_holidays;
|
|
if (isset($max_teachers_per_class)) $schools['max_teachers_per_class'] = $max_teachers_per_class;
|
|
if (isset($staff_userid)) $schools['staff_userid'] = $staff_userid;
|
|
if (isset($default_staff_category)) $schools['default_staff_category'] = $default_staff_category;
|
|
if (isset($staff_titles)) $schools['staff_titles'] = $staff_titles;
|
|
if (isset($default_staff_language)) $schools['default_staff_language'] = $default_staff_language;
|
|
if (isset($staff_meals_to_classroom)) $schools['staff_meals_to_classroom'] = $staff_meals_to_classroom;
|
|
if (isset($staff_can_have_children)) $schools['staff_can_have_children'] = $staff_can_have_children;
|
|
if (isset($display_staff_list)) $schools['display_staff_list'] = $display_staff_list;
|
|
if (isset($display_class_lists)) $schools['display_class_lists'] = $display_class_lists;
|
|
if (isset($display_pac_info)) $schools['display_pac_info'] = $display_pac_info;
|
|
if (isset($display_parent_instructions)) $schools['display_parent_instructions'] = $display_parent_instructions;
|
|
if (isset($allow_userid_change)) $schools['allow_userid_change'] = $allow_userid_change;
|
|
if (isset($display_students_button)) $schools['display_students_button'] = $display_students_button;
|
|
if (isset($display_user_account_balance)) $schools['display_user_account_balance'] = $display_user_account_balance;
|
|
if (isset($minimum_display_balance)) $schools['minimum_display_balance'] = $minimum_display_balance;
|
|
if (isset($maximum_order_balance)) $schools['maximum_order_balance'] = $maximum_order_balance;
|
|
if (isset($balance_calculation_days_ago)) $schools['balance_calculation_days_ago'] = $balance_calculation_days_ago;
|
|
if (isset($balance_calculation_for)) $schools['balance_calculation_for'] = $balance_calculation_for;
|
|
if (isset($allow_ordering_with_balance_owing)) $schools['allow_ordering_with_balance_owing'] = $allow_ordering_with_balance_owing;
|
|
if (isset($previous_balances_post)) $schools['previous_balances_post'] = $previous_balances_post;
|
|
if (isset($previous_balances_post_message)) $schools['previous_balances_post_message'] = $previous_balances_post_message;
|
|
if (isset($balance_post_limit)) $schools['balance_post_limit'] = $balance_post_limit;
|
|
if (isset($no_ordering_message)) $schools['no_ordering_message'] = $no_ordering_message;
|
|
if (isset($implement_generated_charge)) $schools['implement_generated_charge'] = $implement_generated_charge;
|
|
if (isset($generated_charge_amount)) $schools['generated_charge_amount'] = $generated_charge_amount;
|
|
if (isset($generated_charge_note)) $schools['generated_charge_note'] = $generated_charge_note;
|
|
if (isset($generated_charge_occurrence)) $schools['generated_charge_occurrence'] = $generated_charge_occurrence;
|
|
if (isset($implement_generated_credit)) $schools['implement_generated_credit'] = $implement_generated_credit;
|
|
if (isset($generated_credit_amount)) $schools['generated_credit_amount'] = $generated_credit_amount;
|
|
if (isset($generated_credit_note)) $schools['generated_credit_note'] = $generated_credit_note;
|
|
if (isset($generated_credit_occurrence)) $schools['generated_credit_occurrence'] = $generated_credit_occurrence;
|
|
if (isset($implement_donation_option)) $schools['implement_donation_option'] = $implement_donation_option;
|
|
if (isset($donation_charity)) $schools['donation_charity'] = $donation_charity;
|
|
if (isset($verified_only_class_list)) $schools['verified_only_class_list'] = $verified_only_class_list;
|
|
if (isset($allow_edit_of_paid_orders)) $schools['allow_edit_of_paid_orders'] = $allow_edit_of_paid_orders;
|
|
if (isset($allow_edit_of_complimentary_orders)) $schools['allow_edit_of_complimentary_orders'] = $allow_edit_of_complimentary_orders;
|
|
if (isset($order_entered_message)) $schools['order_entered_message'] = $order_entered_message;
|
|
if (isset($enable_substution_requests)) $schools['enable_substution_requests'] = $enable_substution_requests;
|
|
if (isset($schedule_sort)) $schools['schedule_sort'] = $schedule_sort;
|
|
if (isset($special_item_prices)) $schools['special_item_prices'] = $special_item_prices;
|
|
if (isset($complimentary_item_processing)) $schools['complimentary_item_processing'] = $complimentary_item_processing;
|
|
if (isset($taxable_items)) $schools['taxable_items'] = $taxable_items;
|
|
if (isset($products_per_menu_item)) $schools['products_per_menu_item'] = $products_per_menu_item;
|
|
if (isset($display_bc_food_guidelines)) $schools['display_bc_food_guidelines'] = $display_bc_food_guidelines;
|
|
if (isset($label_print_school_name)) $schools['label_print_school_name'] = $label_print_school_name;
|
|
if (isset($label_separate_options)) $schools['label_separate_options'] = $label_separate_options;
|
|
if (isset($enable_volunteer_signup)) $schools['enable_volunteer_signup'] = $enable_volunteer_signup;
|
|
if (isset($volunteer_signup_days_prior)) $schools['volunteer_signup_days_prior'] = $volunteer_signup_days_prior;
|
|
if (isset($enable_volunteer_management)) $schools['enable_volunteer_management'] = $enable_volunteer_management;
|
|
if (isset($send_volunteer_reminders)) $schools['send_volunteer_reminders'] = $send_volunteer_reminders;
|
|
if (isset($volunteer_sorting)) $schools['volunteer_sorting'] = $volunteer_sorting;
|
|
if (isset($include_volunteer_details)) $schools['include_volunteer_details'] = $include_volunteer_details;
|
|
if (isset($max_volunteers)) $schools['max_volunteers'] = $max_volunteers;
|
|
if (isset($default_volunteer_message)) $schools['default_volunteer_message'] = $default_volunteer_message;
|
|
if (isset($menu_item_font_size)) $schools['menu_item_font_size'] = $menu_item_font_size;
|
|
if (isset($menu_item_color)) $schools['menu_item_color'] = $menu_item_color;
|
|
if (isset($volunteer_msg_font)) $schools['volunteer_msg_font'] = $volunteer_msg_font;
|
|
if (isset($volunteer_msg_color)) $schools['volunteer_msg_color'] = $volunteer_msg_color;
|
|
if (isset($group_a_color)) $schools['group_a_color'] = $group_a_color;
|
|
if (isset($group_b_color)) $schools['group_b_color'] = $group_b_color;
|
|
if (isset($group_c_color)) $schools['group_c_color'] = $group_c_color;
|
|
if (isset($group_d_color)) $schools['group_d_color'] = $group_d_color;
|
|
if (isset($group_e_color)) $schools['group_e_color'] = $group_e_color;
|
|
if (isset($group_f_color)) $schools['group_f_color'] = $group_f_color;
|
|
if (isset($group_g_color)) $schools['group_g_color'] = $group_g_color;
|
|
if (isset($group_h_color)) $schools['group_h_color'] = $group_h_color;
|
|
if (isset($group_i_color)) $schools['group_i_color'] = $group_i_color;
|
|
if (isset($group_j_color)) $schools['group_j_color'] = $group_j_color;
|
|
if (isset($group_k_color)) $schools['group_k_color'] = $group_k_color;
|
|
if (isset($group_l_color)) $schools['group_l_color'] = $group_l_color;
|
|
if (isset($group_m_color)) $schools['group_m_color'] = $group_m_color;
|
|
if (isset($display_group_colors)) $schools['display_group_colors'] = $display_group_colors;
|
|
if (isset($display_group_letters)) $schools['display_group_letters'] = $display_group_letters;
|
|
if (isset($cafeteria_ordering)) $schools['cafeteria_ordering'] = $cafeteria_ordering;
|
|
if (isset($cafeteria_balance_limit)) $schools['cafeteria_balance_limit'] = $cafeteria_balance_limit;
|
|
if (isset($implement_meal_locations)) $schools['implement_meal_locations'] = $implement_meal_locations;
|
|
if (isset($delivery_report_students)) $schools['delivery_report_students'] = $delivery_report_students;
|
|
if (isset($delivery_report_staff)) $schools['delivery_report_staff'] = $delivery_report_staff;
|
|
if (isset($delivery_report_row_height)) $schools['delivery_report_row_height'] = $delivery_report_row_height;
|
|
if (isset($paper_order_form_size)) $schools['paper_order_form_size'] = $paper_order_form_size;
|
|
if (isset($paper_order_form_font_size)) $schools['paper_order_form_font_size'] = $paper_order_form_font_size;
|
|
if (isset($paper_order_form_name_fields)) $schools['paper_order_form_name_fields'] = $paper_order_form_name_fields;
|
|
if (isset($paper_order_form_footer)) $schools['paper_order_form_footer'] = $paper_order_form_footer;
|
|
if (isset($directory_sort)) $schools['directory_sort'] = $directory_sort;
|
|
if (isset($implement_delivery_groups)) $schools['implement_delivery_groups'] = $implement_delivery_groups;
|
|
if (isset($meal_ticket_headers)) $schools['meal_ticket_headers'] = $meal_ticket_headers;
|
|
if (isset($include_revenue_in_details_csv)) $schools['include_revenue_in_details_csv'] = $include_revenue_in_details_csv;
|
|
if (isset($schedule_team_access_reports)) $schools['schedule_team_access_reports'] = $schedule_team_access_reports;
|
|
if (isset($default_payment_method)) $schools['default_payment_method'] = $default_payment_method;
|
|
if (isset($allow_staff_to_post_payments)) $schools['allow_staff_to_post_payments'] = $allow_staff_to_post_payments;
|
|
if (isset($schedule_required_on_post)) $schools['schedule_required_on_post'] = $schedule_required_on_post;
|
|
if (isset($post_with_recent_schedule)) $schools['post_with_recent_schedule'] = $post_with_recent_schedule;
|
|
if (isset($select_orders_on_post)) $schools['select_orders_on_post'] = $select_orders_on_post;
|
|
if (isset($select_transactions_on_post)) $schools['select_transactions_on_post'] = $select_transactions_on_post;
|
|
if (isset($send_payment_notification)) $schools['send_payment_notification'] = $send_payment_notification;
|
|
if (isset($send_order_email)) $schools['send_order_email'] = $send_order_email;
|
|
if (isset($allow_account_deposits)) $schools['allow_account_deposits'] = $allow_account_deposits;
|
|
if (isset($paypal_enabled)) $schools['paypal_enabled'] = $paypal_enabled;
|
|
if (isset($paypal_verified)) $schools['paypal_verified'] = $paypal_verified;
|
|
if (isset($paypal_minimum_amount)) $schools['paypal_minimum_amount'] = $paypal_minimum_amount;
|
|
if (isset($paypal_code)) $schools['paypal_code'] = $paypal_code;
|
|
if (isset($paypal_mode)) $schools['paypal_mode'] = $paypal_mode;
|
|
if (isset($paypal_currency)) $schools['paypal_currency'] = $paypal_currency;
|
|
if (isset($paypal_button_text)) $schools['paypal_button_text'] = $paypal_button_text;
|
|
if (isset($paypal_fee)) $schools['paypal_fee'] = $paypal_fee;
|
|
if (isset($paypal_percentage)) $schools['paypal_percentage'] = $paypal_percentage;
|
|
if (isset($paypal_fee_title)) $schools['paypal_fee_title'] = $paypal_fee_title;
|
|
if (isset($paypal_fee_message)) $schools['paypal_fee_message'] = $paypal_fee_message;
|
|
if (isset($paypal_donation)) $schools['paypal_donation'] = $paypal_donation;
|
|
if (isset($paypal_donation_message)) $schools['paypal_donation_message'] = $paypal_donation_message;
|
|
if (isset($bambora_enabled)) $schools['bambora_enabled'] = $bambora_enabled;
|
|
if (isset($bambora_minimum_amount)) $schools['bambora_minimum_amount'] = $bambora_minimum_amount;
|
|
if (isset($bambora_parent_id)) $schools['bambora_parent_id'] = $bambora_parent_id;
|
|
if (isset($bambora_merchant_id)) $schools['bambora_merchant_id'] = $bambora_merchant_id;
|
|
if (isset($bambora_api_key)) $schools['bambora_api_key'] = $bambora_api_key;
|
|
if (isset($bambora_currency)) $schools['bambora_currency'] = $bambora_currency;
|
|
if (isset($bambora_fee)) $schools['bambora_fee'] = $bambora_fee;
|
|
if (isset($bambora_percentage)) $schools['bambora_percentage'] = $bambora_percentage;
|
|
if (isset($bambora_fee_title)) $schools['bambora_fee_title'] = $bambora_fee_title;
|
|
if (isset($bambora_fee_message)) $schools['bambora_fee_message'] = $bambora_fee_message;
|
|
if (isset($display_bambora_form)) $schools['display_bambora_form'] = $display_bambora_form;
|
|
if (isset($exact_enabled)) $schools['exact_enabled'] = $exact_enabled;
|
|
if (isset($exact_code)) $schools['exact_code'] = $exact_code;
|
|
if (isset($exact_currency)) $schools['exact_currency'] = $exact_currency;
|
|
if (isset($exact_button_text)) $schools['exact_button_text'] = $exact_button_text;
|
|
if (isset($exact_fee)) $schools['exact_fee'] = $exact_fee;
|
|
if (isset($exact_percentage)) $schools['exact_percentage'] = $exact_percentage;
|
|
if (isset($exact_fee_message)) $schools['exact_fee_message'] = $exact_fee_message;
|
|
if (isset($merchant_account_enabled)) $schools['merchant_account_enabled'] = $merchant_account_enabled;
|
|
if (isset($merchant_account_key_id)) $schools['merchant_account_key_id'] = $merchant_account_key_id;
|
|
if (isset($merchant_account_key_text)) $schools['merchant_account_key_text'] = $merchant_account_key_text;
|
|
if (isset($merchant_account_currency)) $schools['merchant_account_currency'] = $merchant_account_currency;
|
|
if (isset($merchant_account_order_description)) $schools['merchant_account_order_description'] = $merchant_account_order_description;
|
|
if (isset($merchant_account_button_text)) $schools['merchant_account_button_text'] = $merchant_account_button_text;
|
|
if (isset($merchant_account_fee)) $schools['merchant_account_fee'] = $merchant_account_fee;
|
|
if (isset($merchant_account_percentage)) $schools['merchant_account_percentage'] = $merchant_account_percentage;
|
|
if (isset($merchant_account_fee_message)) $schools['merchant_account_fee_message'] = $merchant_account_fee_message;
|
|
if (isset($merchant_account_thanks_message)) $schools['merchant_account_thanks_message'] = $merchant_account_thanks_message;
|
|
if (isset($school_account_enabled)) $schools['school_account_enabled'] = $school_account_enabled;
|
|
if (isset($school_account_button_text)) $schools['school_account_button_text'] = $school_account_button_text;
|
|
if (isset($school_account_title)) $schools['school_account_title'] = $school_account_title;
|
|
if (isset($school_account_text)) $schools['school_account_text'] = $school_account_text;
|
|
if (isset($school_account_message)) $schools['school_account_message'] = $school_account_message;
|
|
if (isset($school_account_notification_email)) $schools['school_account_notification_email'] = $school_account_notification_email;
|
|
if (isset($currency_symbol)) $schools['currency_symbol'] = $currency_symbol;
|
|
if (isset($check_register_sort)) $schools['check_register_sort'] = $check_register_sort;
|
|
if (isset($display_remittance_button)) $schools['display_remittance_button'] = $display_remittance_button;
|
|
if (isset($remittance_button_text)) $schools['remittance_button_text'] = $remittance_button_text;
|
|
if (isset($accept_check)) $schools['accept_check'] = $accept_check;
|
|
if (isset($accept_cash)) $schools['accept_cash'] = $accept_cash;
|
|
if (isset($accept_other)) $schools['accept_other'] = $accept_other;
|
|
if (isset($display_remittance_msg_with_button)) $schools['display_remittance_msg_with_button'] = $display_remittance_msg_with_button;
|
|
if (isset($remittance_form_fee)) $schools['remittance_form_fee'] = $remittance_form_fee;
|
|
if (isset($display_print_order_button)) $schools['display_print_order_button'] = $display_print_order_button;
|
|
if (isset($calculate_supplier_costs)) $schools['calculate_supplier_costs'] = $calculate_supplier_costs;
|
|
if (isset($supplier_costs_decimals)) $schools['supplier_costs_decimals'] = $supplier_costs_decimals;
|
|
if (isset($tax_number)) $schools['tax_number'] = $tax_number;
|
|
if (isset($default_student_status)) $schools['default_student_status'] = $default_student_status;
|
|
if (isset($default_order_status)) $schools['default_order_status'] = $default_order_status;
|
|
if (isset($default_order_status_special1)) $schools['default_order_status_special1'] = $default_order_status_special1;
|
|
if (isset($default_order_status_special2)) $schools['default_order_status_special2'] = $default_order_status_special2;
|
|
if (isset($default_order_status_special3)) $schools['default_order_status_special3'] = $default_order_status_special3;
|
|
if (isset($delete_inactive_orders_hours)) $schools['delete_inactive_orders_hours'] = $delete_inactive_orders_hours;
|
|
if (isset($delete_inactive_orders_email_subject)) $schools['delete_inactive_orders_email_subject'] = $delete_inactive_orders_email_subject;
|
|
if (isset($delete_inactive_orders_email)) $schools['delete_inactive_orders_email'] = $delete_inactive_orders_email;
|
|
if (isset($default_event_status)) $schools['default_event_status'] = $default_event_status;
|
|
if (isset($can_parents_post_events)) $schools['can_parents_post_events'] = $can_parents_post_events;
|
|
if (isset($num_reminder_events)) $schools['num_reminder_events'] = $num_reminder_events;
|
|
if (isset($public_event_calendar)) $schools['public_event_calendar'] = $public_event_calendar;
|
|
if (isset($default_classified_status)) $schools['default_classified_status'] = $default_classified_status;
|
|
if (isset($classified_duration)) $schools['classified_duration'] = $classified_duration;
|
|
if (isset($additional_pages_title)) $schools['additional_pages_title'] = $additional_pages_title;
|
|
if (isset($implement_page_tabs)) $schools['implement_page_tabs'] = $implement_page_tabs;
|
|
if (isset($support_email)) $schools['support_email'] = $support_email;
|
|
if (isset($reply_email)) $schools['reply_email'] = $reply_email;
|
|
if (isset($reply_description)) $schools['reply_description'] = $reply_description;
|
|
if (isset($email_title)) $schools['email_title'] = $email_title;
|
|
if (isset($email_footer)) $schools['email_footer'] = $email_footer;
|
|
if (isset($email_broadcast_optional)) $schools['email_broadcast_optional'] = $email_broadcast_optional;
|
|
if (isset($email_reminder_optional)) $schools['email_reminder_optional'] = $email_reminder_optional;
|
|
if (isset($email_reminder_title)) $schools['email_reminder_title'] = $email_reminder_title;
|
|
if (isset($email_reminder_day)) $schools['email_reminder_day'] = $email_reminder_day;
|
|
if (isset($email_reminder_weeks)) $schools['email_reminder_weeks'] = $email_reminder_weeks;
|
|
if (isset($email_reminder_description)) $schools['email_reminder_description'] = $email_reminder_description;
|
|
if (isset($email_reminders_to)) $schools['email_reminders_to'] = $email_reminders_to;
|
|
if (isset($volunteer_reminder_email)) $schools['volunteer_reminder_email'] = $volunteer_reminder_email;
|
|
if (isset($volunteer_reminder_title)) $schools['volunteer_reminder_title'] = $volunteer_reminder_title;
|
|
if (isset($volunteer_reminder_day)) $schools['volunteer_reminder_day'] = $volunteer_reminder_day;
|
|
if (isset($notes)) $schools['notes'] = $notes;
|
|
if (isset($payment_detail)) $schools['payment_detail'] = $payment_detail;
|
|
if (isset($renewal_invoice_issued)) $schools['renewal_invoice_issued'] = $renewal_invoice_issued;
|
|
if (isset($renewal_invoice_paid)) $schools['renewal_invoice_paid'] = $renewal_invoice_paid;
|
|
if (isset($locker_school)) $schools['locker_school'] = $locker_school;
|
|
if (isset($record_num)) $schools['record_num'] = $record_num;
|
|
|
|
|
|
if ($SchoolStatus != 'Active') {
|
|
$schools = new Table("schools");
|
|
$query = $schools->BuildUpdate();
|
|
db_query($query);
|
|
echo("SCHOOL RECORD UPDATED<br>");
|
|
writeLog("School Record Updated");
|
|
}
|
|
|
|
|
|
// Check if there is an admin user
|
|
if ($SchoolStatus != 'Active' && $school['status'] != 'Linked') {
|
|
$query = "select * from users where school_num = $school_num and userid = 'admin'";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
// Create an admin user
|
|
writeLog("Create admin account");
|
|
$userid = "admin";
|
|
$password = "admin";
|
|
$password_crypt = encrypt_password($password);
|
|
$type = "System Administrator";
|
|
$status = "Active";
|
|
$first_name = "Administrator";
|
|
|
|
$users = new Table("users");
|
|
$query = $users->BuildInsert();
|
|
writeLog($query);
|
|
db_query($query);
|
|
echo("Admin account created<br>");
|
|
}
|
|
|
|
|
|
// Insert staff categories
|
|
$staff_categories = array('Principal','Vice Principal','Administration','Teacher','Support Staff','SEA','Librarian','Other Staff');
|
|
for ($i = 0; $i < count($staff_categories); $i++) {
|
|
$scat = $staff_categories[$i];
|
|
$seq = $i + 1;
|
|
|
|
// Check if this category exists
|
|
$query = "select * from staff_categories " .
|
|
"where school_num = $school_num " .
|
|
"and category_title = '$scat'";
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
$query = "insert into staff_categories (school_num,category_title,sequence) " .
|
|
"values ($school_num,'$scat',$seq)";
|
|
db_query($query);
|
|
|
|
if ($scat == 'Teacher') {
|
|
$dnum = db_insert_id();
|
|
db_query("update schools set default_staff_category = $dnum where record_num = $school_num");
|
|
}
|
|
}
|
|
}
|
|
echo("Staff categories entered<br>");
|
|
}
|
|
|
|
|
|
// Setup default content
|
|
$formatted_content = new Table("formatted_content");
|
|
|
|
// Create login screen message
|
|
$content_type = 'C';
|
|
$content_id = "Login Page";
|
|
|
|
if ($SchoolStatus == 'Pending') {
|
|
$query = "delete from formatted_content where school_num = $school_num and content_id = '$content_id'";
|
|
db_query($query);
|
|
}
|
|
|
|
$content = "";
|
|
$query = "select content from formatted_content where school_num = $school_num and content_id = '$content_id'";
|
|
$results = db_query($query);
|
|
$nRows = db_num_rows($results);
|
|
if (db_num_rows($results)) {
|
|
$r = db_fetch_assoc($results);
|
|
$content = $r['content'];
|
|
}
|
|
|
|
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
|
|
$content = db_getVal("SELECT content FROM formatted_content WHERE school_num = $reseller_source_school_num AND content_id = '$content_id'");
|
|
}
|
|
|
|
if ($nRows == 0 && strlen($content) == 0) {
|
|
writeLog("Create Login Page content");
|
|
switch ($siteType) {
|
|
case 'hotlunch':
|
|
$content = "<p>Welcome to the $pac_name and Lunch web site. On this site parents will be " .
|
|
"able to place lunch orders for their children.</p>\n" .
|
|
"<p>We believe that by involving and informing parents we will have a more supportive and effective school " .
|
|
"environment for our children. It is up to us to work together to ensure our children have the best " .
|
|
"possible school experience.</p>\n";
|
|
break;
|
|
|
|
case 'fundraising':
|
|
$content = "<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
|
|
"place fund raising orders for our $orgType.</p>\n";
|
|
break;
|
|
|
|
case 'schoolfees':
|
|
$content = "<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
|
|
"register children for fieldtrips.</p>\n";
|
|
break;
|
|
|
|
case 'registration':
|
|
$content = "<p>Welcome to the $pac_name registration web site.</p>\n";
|
|
break;
|
|
}
|
|
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
echo("$content_id - content created<br>");
|
|
}
|
|
|
|
|
|
// Create login screen message
|
|
$content_type = 'C';
|
|
$content_id = "Welcome Page";
|
|
|
|
if ($SchoolStatus == 'Pending') {
|
|
$query = "delete from formatted_content where school_num = $school_num and content_id = '$content_id'";
|
|
db_query($query);
|
|
}
|
|
|
|
$content = "";
|
|
$query = "select content from formatted_content where school_num = $school_num and content_id = '$content_id'";
|
|
$results = db_query($query);
|
|
$nRows = db_num_rows($results);
|
|
if (db_num_rows($results)) {
|
|
$r = db_fetch_assoc($results);
|
|
$content = $r['content'];
|
|
}
|
|
|
|
if (isset($reseller_source_school_num) && $reseller_source_school_num > 0) {
|
|
$content = db_getVal("SELECT content FROM formatted_content WHERE school_num = $reseller_source_school_num AND content_id = '$content_id'");
|
|
}
|
|
|
|
if ($nRows == 0 && strlen($content) == 0) {
|
|
writeLog("Create Welcome Page content");
|
|
switch ($siteType) {
|
|
case 'hotlunch':
|
|
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
|
|
"<p>Welcome to the lunch on-line system. This application is meant to " .
|
|
"facilitate the ordering and management of school lunch orders for both " .
|
|
"parents and the $pac_name. Please feel free to contact us with any suggestions " .
|
|
"or problems you have with the system.</p>\n";
|
|
break;
|
|
|
|
case 'fundraising':
|
|
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
|
|
"<p>Welcome to the $pac_name fund raising web site. On this site parents will be " .
|
|
"place fund raising orders for our $orgType.</p>\n";
|
|
break;
|
|
|
|
case 'schoolfees':
|
|
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
|
|
"<p>Welcome to the $pac_name school fees web site. On this site parents will be able to pay school fees and " .
|
|
"register children for fieldtrips.</p>\n";
|
|
break;
|
|
|
|
case 'registration':
|
|
$content = "<p><span style='font-size: medium;'><strong>Welcome</strong></span></p>\n" .
|
|
"<p>Welcome to the $pac_name registration web site.</p>\n";
|
|
break;
|
|
}
|
|
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
echo("$content_id - content created<br>");
|
|
}
|
|
|
|
|
|
|
|
if ($school['status'] != 'Linked') {
|
|
if ($reseller == 'hotlunch') {
|
|
writeLog("Create additional content");
|
|
// Setup page content entries
|
|
if ($siteType == 'hotlunch') {
|
|
$pages = array('Council Information');
|
|
for ($i = 0; $i < count($pages); $i++) {
|
|
$page = $pages[$i];
|
|
|
|
// Check if this page has already been created
|
|
$query = "select * from formatted_content " .
|
|
"where school_num = $school_num " .
|
|
"and content_type = 'C' " .
|
|
"and content_id = '$page'";
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
$query = "insert into formatted_content (school_num,content_id,content_type) " .
|
|
"values ($school_num,'$page','C')";
|
|
db_query($query);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Create no access to class list message
|
|
if ($siteType == 'hotlunch') {
|
|
$content_type = 'C';
|
|
$content_id = "Access to Class List Denied";
|
|
$query = "select * from formatted_content where school_num = $school_num and content_id = '$content_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$content = "<p>You have accessed the contact list for your child's class, but your child " .
|
|
"has not yet been verified in the system. In order to protect our children " .
|
|
"we only allow access to the class lists once your child has been verified. " .
|
|
"As parents we are sure you understand our caution.</p>\n" .
|
|
"<p>Please bear with us as we are processing the registrations and verifying " .
|
|
"the students as fast as possible.</p>\n" .
|
|
"<p>$pac_name</p>";
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
echo("$content_id - content created<br>");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the default events email message
|
|
if ($siteType == 'hotlunch') {
|
|
$content_type = 'Events';
|
|
$content_id = db_escape_string("$pac_name Event Calendar");
|
|
$query = "select * from formatted_content where school_num = $school_num and content_type = '$content_type'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$content_id = "$pac_name Event Calendar";
|
|
$content = "<p>Dear Parent,</p>\n<p>The following are the upcoming school and community events from the on-line event calendar on " .
|
|
"our $pac_name web site. We invite you to visit the site and post any child and family friendly events to our event calendar " .
|
|
"to share with the other parents at $school_name.</p>\n<p>We will send a list of events to all parents monthly.</p>\n<br>\n";
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
echo("$content_id - content created<br>");
|
|
}
|
|
}
|
|
|
|
|
|
// Create the reminder email
|
|
if ($siteType == 'hotlunch') {
|
|
$content_type = 'Reminder';
|
|
$content_id = db_escape_string("$pac_name Web Password Reminder");
|
|
$query = "select * from formatted_content where school_num = $school_num and content_type = '$content_type'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$content_id = "$pac_name Web Password Reminder";
|
|
$content = "<p>Dear Parent,</p>\n<p>The following is your user id and a link to set your password to access our $pac_name web site.</p>\n" .
|
|
"<p>User ID: <b>{userid}</b><br>\n" .
|
|
"Link: <b>{link}</b></p>\n" .
|
|
"<p>You will need this information to access the web site, place lunch orders, view the event calendar, " .
|
|
"post free classified ads and view the on-line bulletin boards.</p>\n" .
|
|
"<p>$pac_name</p>\n";
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
echo("$content_id - content created<br>");
|
|
}
|
|
}
|
|
|
|
|
|
// Create document type records
|
|
if ($siteType == 'hotlunch') {
|
|
$fp = fopen("document_types.txt","r");
|
|
$sequence = 1;
|
|
while (!feof($fp)) {
|
|
$cat = trim(fgets($fp,1000));
|
|
if (strlen($cat) > 0) {
|
|
$results = db_query("select * from document_categories where school_num = $school_num and category = '$cat'");
|
|
if (db_num_rows($results) == 0) {
|
|
db_query("insert into document_categories (school_num,category,sequence) values($school_num,'$cat',$sequence)");
|
|
$sequence++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Create default email messages
|
|
if ($siteType == 'hotlunch') {
|
|
writeLog("Create email messages");
|
|
$content_type = 'E';
|
|
$content_id = db_escape_string("$school_name Lunch Money Due");
|
|
$query = "select * from formatted_content " .
|
|
"where school_num = $school_num " .
|
|
"and content_type = '$content_type' " .
|
|
"and content_id = '$content_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$content_id = "$school_name Lunch Money Due";
|
|
$content = "<p>Dear Parent,</p>\n<p>We want to thank you for placing an order with the $pac_name Lunch Program. " .
|
|
"This is a reminder that payment is now due for the lunch orders.</p>\n" .
|
|
"<p>According to our records you have an outstanding balance at this time. If this is incorrect " .
|
|
"please notify us so that we can correct our records.</p>\n" .
|
|
"<p>System User ID: <b>{userid}</b></p>\n" .
|
|
"Balance Owing: <b>" . '$' . "{account_balance}</b></p>\n" .
|
|
"<p>Payment should be sent with your child to the school for processing.</p>\n" .
|
|
"<p><b>Thank You $pac_name</b></p>\n";
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
}
|
|
|
|
|
|
$content_type = 'E';
|
|
$content_id = db_escape_string("Your User Account is Setup");
|
|
$query = "select * from formatted_content " .
|
|
"where school_num = $school_num " .
|
|
"and content_type = '$content_type' " .
|
|
"and content_id = '$content_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
writeLog("$content_id message");
|
|
$content = "<p>Dear {first_name},</p>\n<p>We have created an account for you to access our new online system.</p>" .
|
|
"<p>Web Address: {SCHOOL_URL}</p>" .
|
|
"<p>User ID: {userid}<br>" .
|
|
"Password: {password}</p>" .
|
|
"<p>Please login and change your password as soon as possible.</p>" .
|
|
"<p>Regards<br>" .
|
|
"$pac_name</p>" .
|
|
"<p> </p>";
|
|
$query = $formatted_content->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create text data entries
|
|
$text_data_tbl = new Table("text_data");
|
|
|
|
$date_added = date("Y-m-d",time());
|
|
$date_modified = date("Y-m-d",time());
|
|
|
|
$text_id = "Remittance Form";
|
|
$data_code = "Remittance";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
writeLog($text_id);
|
|
if ($siteType == 'registration') {
|
|
$text_data = "When submitting payment please provide a single payment for all outstanding orders and please pay the full balance that is outstanding.\n\n" .
|
|
"Payment can be made at the office.";
|
|
}
|
|
else {
|
|
$text_data = "When submitting payment please provide a single payment for all outstanding orders and please pay the full balance that is outstanding.\n\n" .
|
|
"Payment can be given to any teacher or handed in at the school office.";
|
|
}
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Payment Posted";
|
|
$data_code = "Message";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
writeLog($text_id);
|
|
$text_data = "Your payment has been posted to your account.\n\n" .
|
|
"Thank You\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Order Will Be Deleted Soon";
|
|
$data_code = "Message";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
writeLog($text_id);
|
|
$text_data = "An order entered into the system will deleted soon as payment has not been received.\n\n" .
|
|
"We apologize for any inconvenience.\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Order Deleted";
|
|
$data_code = "Message";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
writeLog($text_id);
|
|
$text_data = "An order entered into the system has been deleted as payment has not been received. " .
|
|
"If ordering is still open you may place this order again and make payment.\n\n" .
|
|
"We apologize for any inconvenience.\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
if ($siteType == 'hotlunch') {
|
|
$text_id = "Lunch Reminder";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Lunch Reminder";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Note: This is a reminder of your lunch order for the coming week.\n" .
|
|
"\n" .
|
|
"If you do not wish to receive the weekly lunch email reminder,\n" .
|
|
"please login into your account at our site: https://$url\n" .
|
|
"and edit your profile to disable the email message.\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Lunch Reminder - No Service This Week";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Lunch Reminder";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Note: There is no lunch service offered at school for the coming week.\n" .
|
|
"\n" .
|
|
"If you do not wish to receive the weekly lunch email reminder,\n" .
|
|
"please login into your account at our site: https://$url\n" .
|
|
"and edit your profile to disable the email message.\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Parent Reminder";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Parent Reminder";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Welcome to the $school_name Lunch Web Site. We have created a user account and password for you " .
|
|
"when we entered your child's lunch order that you submitted as a paper order. If you wish to place " .
|
|
"your lunch order using our on-line system for the upcoming session you will need the following user " .
|
|
"id and password information.\n" .
|
|
"\n" .
|
|
"Once you login you will be able to update your password and place lunch orders.\n" .
|
|
"\n" .
|
|
"To access the Lunch web site:\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Volunteer Reminder";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Volunteer Reminder";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Just reminder that you are scheduled as a lunch volunteer this week. We look forward to seeing you.";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Registration Message";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Registration";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Thank you for registering for a user account at the $school_name lunch web site. " .
|
|
"You can now login to the web site. You will be able to update your contact information and register your students in the system for lunch ordering. " .
|
|
"Registered users will be able to place lunch orders for their children and will receive email notices from the $pac_name.";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Staff Notice";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id.' - 1');
|
|
$data_code = "Staff";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Welcome to the $pac_name Lunch Web Site. As a teacher on our site you will " .
|
|
"be able to login and change your user id, update your password, place lunch orders " .
|
|
"and view the on-line class list for your class.\n\n" .
|
|
"The on-line class list will be generated from the set of students who participate in the " .
|
|
"Lunch Program and may not be complete.\n\n" .
|
|
"To access the Lunch web site:\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
}
|
|
else {
|
|
$text_id = "Registration Message";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Registration";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Thank you for registering for a user account at the $school_name web site. " .
|
|
"You can now login to the web site.";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Parent Reminder";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id);
|
|
$data_code = "Parent Reminder";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Welcome to the $school_name Fees Web Site. We have created a user account and password for you. " .
|
|
"If you wish to access our on-line system for the upcoming session you will need the following user " .
|
|
"id and password information.\n" .
|
|
"\n" .
|
|
"Once you login you will be able to change your password, place orders, and make payments.\n" .
|
|
"\n" .
|
|
"To access the web site:\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
$text_id = "Staff Notice";
|
|
db_query("DELETE FROM text_data WHERE school_num = $school_num and text_id = '$text_id'");
|
|
writeLog($text_id.' - 2');
|
|
$data_code = "Staff";
|
|
$query = "select * from text_data where school_num = $school_num and text_id = '$text_id'";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results) == 0) {
|
|
$text_data = "Welcome to the $school_name Fees Web Site. As a teacher on our site you will " .
|
|
"be able to login and update your password, place lunch orders " .
|
|
"and view the on-line class list for your class.\n\n" .
|
|
"The on-line class list will be generated from the set of students who participate in the " .
|
|
"on-line program and may not be complete.\n\n" .
|
|
"To access the web site:\n\n";
|
|
$query = $text_data_tbl->BuildInsert();
|
|
db_query($query);
|
|
}
|
|
}
|
|
|
|
|
|
if ($SchoolStatus == 'Pending' && $event_calendar == 'Y') {
|
|
db_query("DELETE FROM event_types WHERE school_num = $school_num");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Holiday','N','Y','Y','FFFFFF','FF0000')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Special Event','Y','Y','N','FF0000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Council Event','Y','Y','N','FF0000','DDDDDD')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Other','Y','Y','N','000000','FFFFFF')");
|
|
|
|
|
|
if ($orgType == 'School' || $orgType == 'Elementary' || $orgType == 'Private') {
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Lunch','Y','Y','N','000000','F0D060')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'School Event','Y','Y','N','000000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Early Dismissal','Y','Y','N','000000','FF8000')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Professional Day','N','Y','Y','FF0000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Family Fun','Y','Y','N','FFFFFF','00A000')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Kid Friendly Activity','N','Y','N','FFFFFF','00A000')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Dance Event','Y','Y','N','000000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Musical Event','Y','Y','N','000000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Sporting Event','Y','Y','N','000000','FFFFFF')");
|
|
|
|
db_query("INSERT INTO event_types (school_num,event_type_title,school_in_session,hotlunch_menu_on_date,display_on_order_form,text_color,bg_color) " .
|
|
"VALUES ($school_num,'Theatrical Event','Y','Y','N','000000','FFFFFF')");
|
|
|
|
}
|
|
}
|
|
|
|
?>
|