Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16848

Database Activity - Required Viewing setting is incorrectly preventing users from viewing database entries

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.9.2
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux server, apache
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE

      Description

      When participants view a database setup to require 1 entry for a user, but that is set to allow them to see other entries without first posting, the database activity is preventing them from viewing those entries with the following error message:

      "You must add 1 more entry/entries before you can view other participants' entries."

      This message should only be appearing if the database activity is set to require users to post an entry first. An example of a database activity where this is occurring is attached.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              apiedras Antonio Piedras Morente added a comment -

              To solve this i think is needed to change code in /mod/data/view.php

              Change this block

              // Check the number of entries required against the number of entries already made (doesn't apply to teachers)
              $requiredentries_allowed = true;
              $numentries = data_numentries($data);
              if ($data->requiredentries > 0 && $numentries < $data->requiredentries && !has_capability('mod/data:manageentries', $context))

              { $data->entriesleft = $data->requiredentries - $numentries; $strentrieslefttoadd = get_string('entrieslefttoadd', 'data', $data); notify($strentrieslefttoadd); $requiredentries_allowed = false; }

              by the next two

              // Check the number of entries required to view other participants' entries against the number of entries already made (doesn't apply to teachers)
              $requiredentries_allowed = true;
              $numentries = data_numentries($data);
              if ($data->requiredentriestoview > 0 && $numentries < $data->requiredentriestoview && !has_capability('mod/data:manageentries', $context))

              { $data->entriesleft = $data->requiredentriestoview - $numentries; $strentrieslefttoadd = get_string('entrieslefttoadd', 'data', $data); notify($strentrieslefttoadd); $requiredentries_allowed = false; }

              // Check the number of entries required against the number of entries already made (doesn't apply to teachers)
              if ($data->requiredentries > 0 && $numentries < $data->requiredentries && !has_capability('mod/data:manageentries', $context))

              { $requiredentries = get_string('requiredentries', 'data') . ': ' . $data->requiredentries; notify($requiredentries); }

              maybe then message of the second block must be better and show how many entries required and how many entries already made.

              Bye

              Show
              apiedras Antonio Piedras Morente added a comment - To solve this i think is needed to change code in /mod/data/view.php Change this block // Check the number of entries required against the number of entries already made (doesn't apply to teachers) $requiredentries_allowed = true; $numentries = data_numentries($data); if ($data->requiredentries > 0 && $numentries < $data->requiredentries && !has_capability('mod/data:manageentries', $context)) { $data->entriesleft = $data->requiredentries - $numentries; $strentrieslefttoadd = get_string('entrieslefttoadd', 'data', $data); notify($strentrieslefttoadd); $requiredentries_allowed = false; } by the next two // Check the number of entries required to view other participants' entries against the number of entries already made (doesn't apply to teachers) $requiredentries_allowed = true; $numentries = data_numentries($data); if ($data->requiredentriestoview > 0 && $numentries < $data->requiredentriestoview && !has_capability('mod/data:manageentries', $context)) { $data->entriesleft = $data->requiredentriestoview - $numentries; $strentrieslefttoadd = get_string('entrieslefttoadd', 'data', $data); notify($strentrieslefttoadd); $requiredentries_allowed = false; } // Check the number of entries required against the number of entries already made (doesn't apply to teachers) if ($data->requiredentries > 0 && $numentries < $data->requiredentries && !has_capability('mod/data:manageentries', $context)) { $requiredentries = get_string('requiredentries', 'data') . ': ' . $data->requiredentries; notify($requiredentries); } maybe then message of the second block must be better and show how many entries required and how many entries already made. Bye
              Hide
              jerome Jérôme Mouneyrac added a comment -

              This is a duplicate of MDL-16999

              Show
              jerome Jérôme Mouneyrac added a comment - This is a duplicate of MDL-16999

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: