Browse Source

Fix update legal terms - refs BT#11360

Angel Fernando Quiroz Campos 8 years ago
parent
commit
2c14b74acd
1 changed files with 10 additions and 1 deletions
  1. 10 1
      main/inc/lib/legal.lib.php

+ 10 - 1
main/inc/lib/legal.lib.php

@@ -31,6 +31,14 @@ class LegalManager
         $time = time();
 
         if ($last['content'] != $content) {
+            $maxLegalId = Database::getManager()
+                ->createQuery('
+                    SELECT MAX(l.legalId) FROM ChamiloCoreBundle:Legal l
+                ')
+                ->getSingleScalarResult();
+
+            $legalId = $maxLegalId + 1;
+
             $version = intval(LegalManager::get_last_condition_version($language));
             $version++;
             $params = [
@@ -39,7 +47,8 @@ class LegalManager
                 'changes' => $changes,
                 'type' => $type,
                 'version' => intval($version),
-                'date' => $time
+                'date' => $time,
+                'legal_id' => $legalId
             ];
             Database::insert($legal_table, $params);