Moodle
  1. Moodle
  2. MDL-7660

Unable to delete database activity entry attachment

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Test steps

      1. Create a database activity.
      2. Add two fields - File and Picture.
      3. Save the templates and add an entry.
        • Try dragging and dropping a file into the load area (should be marked with a large blue arrow).
        • Do the same with the picture.
      4. Click on view list and then click on the edit icon to edit your entry.
        • Check that you can delete the file and the picture (click on the image of the file and then select delete).
      5. Try adding files with out drag and drop (There should be an icon with a page with a plus sign on it).
        • Save the entry and check that the file is uploaded.
      6. Turn off JavaScript and delete and add files and pictures.
        • Check that no errors or problems occur.
      Show
      Test steps Create a database activity. Add two fields - File and Picture. Save the templates and add an entry. Try dragging and dropping a file into the load area (should be marked with a large blue arrow). Do the same with the picture. Click on view list and then click on the edit icon to edit your entry. Check that you can delete the file and the picture (click on the image of the file and then select delete). Try adding files with out drag and drop (There should be an icon with a page with a plus sign on it). Save the entry and check that the file is uploaded. Turn off JavaScript and delete and add files and pictures. Check that no errors or problems occur.
    • Affected Branches:
      MOODLE_16_STABLE, MOODLE_20_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-7660-master
    • Rank:
      17314

      Description

      If you upload a file in a database entry and then wish to delete that file there is no way to do so in the UI.

      If you delete the file from the backend (i.e. going into the course files area or via ftp etc.) the link remains and an error is thrown (just stating the obvious i.e. can't find file).

      You can get rid of the link (as long as you only enter a space in the the link optional file name field), and therefore, the error message, but can not get rid of the file icon.

        Issue Links

          Activity

          Hide
          Petr Škoda added a comment -

          Workaround is to delete the entry itself and add it again without the file.

          Show
          Petr Škoda added a comment - Workaround is to delete the entry itself and add it again without the file.
          Hide
          Harry Smith added a comment -

          Hi Petr

          Thanks for the reply. Came to the same conclusion

          In the majority of cases this may not be such a problem, and may teach people to get it right in the first place. That said, when you have multiple file uploads in one database entry and the files concerned are large this workaround can cost hours not minutes.

          Perhaps this is a feature request rather than a bug? I.e. add a way to delete an uploaded file in the database activity UI.

          Show
          Harry Smith added a comment - Hi Petr Thanks for the reply. Came to the same conclusion In the majority of cases this may not be such a problem, and may teach people to get it right in the first place. That said, when you have multiple file uploads in one database entry and the files concerned are large this workaround can cost hours not minutes. Perhaps this is a feature request rather than a bug? I.e. add a way to delete an uploaded file in the database activity UI.
          Hide
          Robert Allerstorfer added a comment -

          I think if the GUI allows to upload a file, it should also allow to remove it, otherwise this feature seems incomplete to me.

          Show
          Robert Allerstorfer added a comment - I think if the GUI allows to upload a file, it should also allow to remove it, otherwise this feature seems incomplete to me.
          Hide
          Robert Allerstorfer added a comment -

          Is this issue not going to be addressed (Fix Version/s)?

          Show
          Robert Allerstorfer added a comment - Is this issue not going to be addressed (Fix Version/s)?
          Hide
          Helen Foster added a comment -

          Just updating this issue as it seems to still be a problem in Moodle 2.0.

          Reassigning to moodle.com for consideration.

          Show
          Helen Foster added a comment - Just updating this issue as it seems to still be a problem in Moodle 2.0. Reassigning to moodle.com for consideration.
          Hide
          Helen Foster added a comment -

          Sorry this issue is still not fixed. It remains a problem in 2.0.3.

          Show
          Helen Foster added a comment - Sorry this issue is still not fixed. It remains a problem in 2.0.3.
          Hide
          Sue Kurt added a comment -

          We are still having this issue as well and cant find a way around it other than replacing the file

          Show
          Sue Kurt added a comment - We are still having this issue as well and cant find a way around it other than replacing the file
          Hide
          Carol Dobson added a comment -

          I definitely need this. If I delete the whole entry, I will need to re-enter comments (from other people as well as my own).

          Show
          Carol Dobson added a comment - I definitely need this. If I delete the whole entry, I will need to re-enter comments (from other people as well as my own).
          Hide
          Andrew Davis added a comment -

          This seems to still be an issue. I created a database containing a file, a picture and a text field (which includes an uploaded video). I can't see any way to delete the files.

          Show
          Andrew Davis added a comment - This seems to still be an issue. I created a database containing a file, a picture and a text field (which includes an uploaded video). I can't see any way to delete the files.
          Hide
          Rosario Carcò added a comment - - edited

          We are working with 2.3 and it still remains unresolved. Please make an effort on this.

          Show
          Rosario Carcò added a comment - - edited We are working with 2.3 and it still remains unresolved. Please make an effort on this.
          Hide
          Helen Foster added a comment -

          Adding 2.4 as affects version and assigning to Adrian as database activity module component lead.

          Show
          Helen Foster added a comment - Adding 2.4 as affects version and assigning to Adrian as database activity module component lead.
          Hide
          Adrian Greeve added a comment -

          While working on this issue I noticed that I was removing the only calls to some functions in mod/data/data.js. I've added a deprecated tag to these functions and if the integrators agree I'll create an issue in MDL-35024 to remove them.

          Show
          Adrian Greeve added a comment - While working on this issue I noticed that I was removing the only calls to some functions in mod/data/data.js. I've added a deprecated tag to these functions and if the integrators agree I'll create an issue in MDL-35024 to remove them.
          Hide
          Damyon Wiese added a comment -

          Hi Adrian,

          I think this is a nice improvement. I also think deprecating those functions is correct - only because it is possible that someone has written some custom database field types that use them.

          There were a couple of minor coding style issues:

          mod/data/field/file/field.class.php line 83 - missing capitalisation in comment
          mod/data/field/file/field.class.php line 94 - very long line
          mod/data/field/picture/field.class.php line 91 - missing capitalisation in comment
          mod/data/field/picture/field.class.php line 108 - very long line
          mod/data/field/picture/field.class.php line 119 - multiple empty lines

          [N] Syntax
          [Y] Output
          [N] Whitespace
          [-] Language
          [-] Databases
          [Y] Testing
          [-] Security
          [-] Documentation
          [Y] Git
          [Y] Sanity check

          Thanks, Damyon

          Show
          Damyon Wiese added a comment - Hi Adrian, I think this is a nice improvement. I also think deprecating those functions is correct - only because it is possible that someone has written some custom database field types that use them. There were a couple of minor coding style issues: mod/data/field/file/field.class.php line 83 - missing capitalisation in comment mod/data/field/file/field.class.php line 94 - very long line mod/data/field/picture/field.class.php line 91 - missing capitalisation in comment mod/data/field/picture/field.class.php line 108 - very long line mod/data/field/picture/field.class.php line 119 - multiple empty lines [N] Syntax [Y] Output [N] Whitespace [-] Language [-] Databases [Y] Testing [-] Security [-] Documentation [Y] Git [Y] Sanity check Thanks, Damyon
          Hide
          Adrian Greeve added a comment -

          Thanks Daymon,

          I fixed up the coding style issues.

          I'm not sure whether this should be back ported. And if it isn't, whether I should come up with a different solution for the earlier branches.

          Show
          Adrian Greeve added a comment - Thanks Daymon, I fixed up the coding style issues. I'm not sure whether this should be back ported. And if it isn't, whether I should come up with a different solution for the earlier branches.
          Hide
          Damyon Wiese added a comment -

          Thanks Adrian, your fixes are all good.

          My vote is that this is an improvement and shouldn't be backported - lets see what the integrators think.

          Cheers, Damyon

          Show
          Damyon Wiese added a comment - Thanks Adrian, your fixes are all good. My vote is that this is an improvement and shouldn't be backported - lets see what the integrators think. Cheers, Damyon
          Hide
          Adrian Greeve added a comment -

          Thanks Damyon,

          I just realised that I've been spelling your name wrong (super sorry!).

          Submitting to integration.

          Show
          Adrian Greeve added a comment - Thanks Damyon, I just realised that I've been spelling your name wrong (super sorry!). Submitting to integration.
          Hide
          Sam Hemelryk added a comment -

          Hi guys,

          I've looked over this now.
          Code looks fine, I was a little thrown off by the use of form_filemanager outside of a form but having looked at that component despite its location and name it holds no dependency to formslib.

          In regards to backporting after really considering it I agree that this is an improvement, and although it solves the issue it also changes UI. Really this is a master only change.
          Should anyone feel very strongly about this feel free to create a tracker issue to get this backported. We can discuss it more there.
          For the time being this is landing master only.

          Many thanks
          Sam

          Show
          Sam Hemelryk added a comment - Hi guys, I've looked over this now. Code looks fine, I was a little thrown off by the use of form_filemanager outside of a form but having looked at that component despite its location and name it holds no dependency to formslib. In regards to backporting after really considering it I agree that this is an improvement, and although it solves the issue it also changes UI. Really this is a master only change. Should anyone feel very strongly about this feel free to create a tracker issue to get this backported. We can discuss it more there. For the time being this is landing master only. Many thanks Sam
          Hide
          Michael de Raadt added a comment -

          Test result: Success!

          Tested in Master only. Works nicely.

          Show
          Michael de Raadt added a comment - Test result: Success! Tested in Master only. Works nicely.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And your fantastic code has met core, hope they become good friends for a long period.

          Closing, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - And your fantastic code has met core, hope they become good friends for a long period. Closing, thanks!
          Hide
          Helen Foster added a comment -

          Removing docs_required label as FAQ 'How can I delete a file attached to a database entry?' removed from http://docs.moodle.org/25/en/Database_activity_FAQ

          As this issue fix is a usability improvement, I don't think it needs documenting specially.

          Show
          Helen Foster added a comment - Removing docs_required label as FAQ 'How can I delete a file attached to a database entry?' removed from http://docs.moodle.org/25/en/Database_activity_FAQ As this issue fix is a usability improvement, I don't think it needs documenting specially.

            People

            • Votes:
              16 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: