$items_added items: $summary");
} else {
flashAlert("Nothing to add - everything in that selection is already here", 'info');
}
redirect();
}
if (isset($_POST['update_starter_ticket_templates'])) {
// The starter ticket templates already here, brought up to this version
validateCSRFToken();
require_once 'starter_content_model.php';
$counts = starterUpdateTicketTemplates();
if ($counts['replaced']) {
logAudit("Starter Content", "Edit", "$session_name brought {$counts['replaced']} starter ticket templates up to date");
flashAlert("Brought {$counts['replaced']} starter ticket templates up to date" . ($counts['forms'] ? " - {$counts['forms']} have a request form, turned off until you turn it on in their Client portal tab" : ''));
} else {
flashAlert("None of the starter ticket templates are here to update - add them instead", 'info');
}
redirect();
}
if (isset($_POST['update_starter_canned_responses'])) {
// The starter canned responses already here, brought up to this version
validateCSRFToken();
require_once 'starter_content_model.php';
$counts = starterUpdateCannedResponses();
if ($counts['replaced']) {
logAudit("Starter Content", "Edit", "$session_name brought {$counts['replaced']} starter canned responses up to date");
flashAlert("Brought {$counts['replaced']} starter canned responses up to date");
} else {
flashAlert("None of the starter canned responses are here to update - add them instead", 'info');
}
redirect();
}
if (isset($_POST['update_starter_document_templates'])) {
// The starter document templates already here, brought up to this version
validateCSRFToken();
require_once 'starter_content_model.php';
$counts = starterUpdateDocumentTemplates();
if ($counts['replaced']) {
logAudit("Starter Content", "Edit", "$session_name brought {$counts['replaced']} starter document templates up to date");
flashAlert("Brought {$counts['replaced']} starter document templates up to date");
} else {
flashAlert("None of the starter document templates are here to update - add them instead", 'info');
}
redirect();
}
if (isset($_POST['update_starter_license_templates'])) {
// The starter license templates already here, brought up to this version
validateCSRFToken();
require_once 'starter_content_model.php';
$counts = starterUpdateLicenseTemplates();
if ($counts['replaced']) {
logAudit("Starter Content", "Edit", "$session_name brought {$counts['replaced']} starter license templates up to date");
flashAlert("Brought {$counts['replaced']} starter license templates up to date" . ($counts['vendors'] ? " - with {$counts['vendors']} vendor template" . ($counts['vendors'] === 1 ? '' : 's') . " they come from" : ''));
} else {
flashAlert("None of the starter license templates are here to update - add them instead", 'info');
}
redirect();
}
if (isset($_POST['load_demo_data'])) {
validateCSRFToken();
require_once 'demo_data_model.php';
$counts = demoDataLoad($mysqli);
if (!$counts['clients']) {
flashAlert("Nothing to add - every demo client is already here", 'info');
redirect();
}
$summary = "{$counts['clients']} clients, {$counts['contacts']} contacts, {$counts['assets']} assets, {$counts['documentation']} documentation records, {$counts['tickets']} tickets, {$counts['projects']} projects, {$counts['billing']} billing records, {$counts['company']} company records";
logAudit("Demo Data", "Create", "$session_name loaded demo data - $summary");
if ($counts['skipped_credentials']) {
flashAlert("Added demo data: $summary. Credentials were skipped - the credential vault did not open for this session", 'warning');
} else {
flashAlert("Added demo data: $summary");
}
redirect();
}
if (isset($_POST['remove_demo_data'])) {
validateCSRFToken();
require_once 'demo_data_model.php';
$clients_removed = demoDataRemove($mysqli);
if ($clients_removed) {
logAudit("Demo Data", "Delete", "$session_name removed demo data - $clients_removed demo clients and all associated records");
flashAlert("Removed $clients_removed demo clients and everything associated with them", 'error');
} else {
flashAlert("No demo clients found - nothing to remove", 'info');
}
redirect();
}