Sometimes we need to make changes to the T&C that should not cause the user to re-accept the T&C. Usually these changes are small like grammatical errors etc.

Sollution could be to place checkbox above the submit button with the text "Do not create a new version".

CommentFileSizeAuthor
#2 1897458-2.patch4.77 KBthedavidmeister

Comments

JayShoe’s picture

I agree with this. I'm currently only in Dev, but I already have like 5 revisions from just toying with it.

thedavidmeister’s picture

Version: 6.x-8.5 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs work
StatusFileSize
new4.77 KB

Here's a janky patch that includes stuff from (and requires the patch from) #226117: Input filters support but gets things moving.

geek-merlin’s picture

+++ b/legal.admin.inc
@@ -250,20 +256,40 @@ function legal_administration_submit($form, &$form_state) {
+    if (!empty($values['new_revision'])) {
+      $version = legal_version($values['version_handling'], $values['language']);
+
+      db_insert('legal_conditions')
+        ->fields(array(
+        'version'    => $version['version'],
+        'revision'   => $version['revision'],
+        'language'   => $values['language'],
+        'conditions' => $values['conditions']['value'],
+        'format'     => $values['conditions']['format'],
+        'date'       => time(),
+        'extras'     => serialize($values['extras']),
+        'changes'    => $values['changes'],
+      ))
+        ->execute();
+    }
+    else {
+      $version = legal_version($values['version_handling'], $values['language'], FALSE);
+
+      db_update('legal_conditions')
+        ->fields(array(
+          'version' => $version['version'],
+          'revision' => $version['revision'],
+          'language' => $values['language'],
+          'conditions' => $values['conditions']['value'],
+          'format' => $values['conditions']['format'],
+          'date' => time(),
+          'extras' => serialize($values['extras']),
+          'changes' => $values['changes'],
+      ))
+        ->condition('version', $version['version'], '=')
+        ->condition('revision', $version['revision'], '=')
+        ->execute();
+    }
 

So this will silently overwrite the last revision with whatever was entered, thereby dropping revision safety / traceability of changes?

I see major objections with this.

Imho the approach should be
* to always save new revisins, but mark some revisions as non-substantial
* filter them out in legal_get_conditions()
* change legal_version_check() to >=

avpaderno’s picture

Status: Needs work » Needs review