Commit f1c0934d authored by Maria Sorica's avatar Maria Sorica Committed by Cecilia Vela Gurovic
Browse files

Bug 1746259: Add the T&C to the site_content_version table

1. Add the site T&C to the 'site_content_version' table during installation

2. Display just the privacy statement on the privacy pages for now.
The logic to display the T&C will be added in a future patch.

    behatnotneeded

Change-Id: I70c1477c974b5790762a371d37107819d3c685b6
parent 35a117ac
......@@ -29,7 +29,7 @@ $data = get_records_sql_assoc("
SELECT s.id, s.version, u.firstname, u.lastname, u.id AS userid, s.content, s.ctime
FROM {site_content_version} s
LEFT JOIN {usr} u ON s.author = u.id
WHERE s.institution = ?
WHERE s.type = 'privacy' AND s.institution = ?
ORDER BY s.id DESC", array('mahara'));
if ($versionid) {
......
......@@ -57,7 +57,7 @@ $privacies = get_records_sql_assoc("
SELECT s.id, s.version, u.firstname, u.lastname, u.id AS userid, s.content, s.ctime
FROM {site_content_version} s
LEFT JOIN {usr} u ON s.author = u.id
WHERE s.institution = ?
WHERE s.type = 'privacy' AND s.institution = ?
ORDER BY s.id DESC", array($institution));
$form = false;
......@@ -143,7 +143,7 @@ function editsitepage_submit(Pieform $form, $values) {
$siteprivacycontent = get_record_sql("
SELECT s.content, s.ctime
FROM {site_content_version} s
WHERE s.institution = ?
WHERE s.type = 'privacy' AND s.institution = ?
ORDER BY s.id DESC
LIMIT 1", array('mahara'));
......
......@@ -820,6 +820,9 @@ function core_install_lastcoredata_defaults() {
// Accept the user privacy agreement on install
$sitecontentid = get_field('site_content_version', 'id', 'type', 'privacy', 'institution', 'mahara');
save_user_reply_to_agreement($user->id, $sitecontentid, 1);
// Accept the user T&C on install
$sitecontentid = get_field('site_content_version', 'id', 'type', 'termsandconditions', 'institution', 'mahara');
save_user_reply_to_agreement($user->id, $sitecontentid, 1);
handle_event('createuser', $user, array('password'));
activity_add_admin_defaults(array($user->id));
db_commit();
......
......@@ -3251,9 +3251,10 @@ function get_latest_privacy_versions($institutions = array(), $ignoreagreevalue
FROM {site_content_version} s
INNER JOIN (SELECT MAX(id) as current, institution
FROM {site_content_version}
WHERE type = 'privacy'
GROUP BY institution) s2 ON s.institution = s2.institution AND s.id = s2.current
" . $useragreementsql . "
WHERE s.institution IN (" . join(',',array_map('db_quote', $institutions)) . ")
" . $useragreementsql . "
WHERE s.type = 'privacy' AND s.institution IN (" . join(',',array_map('db_quote',$institutions)) . ")
ORDER BY type", $params);
return $latestversions;
......
......@@ -3213,7 +3213,7 @@ function site_menu() {
* @return array of names
*/
function site_content_pages() {
return array('about', 'home', 'loggedouthome', 'termsandconditions');
return array('about', 'home', 'loggedouthome');
}
/**
......@@ -3221,7 +3221,7 @@ function site_content_pages() {
* @return array of names
*/
function site_content_version_pages() {
return array('privacy');
return array('privacy', 'termsandconditions');
}
function get_site_page_content($pagename) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment