Bug 131560 - Data/Form provides access to cells that are protected
Summary: Data/Form provides access to cells that are protected
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 158211 (view as bug list)
Depends on:
Blocks: Calc-DataForm
  Show dependency treegraph
 
Reported: 2020-03-25 11:23 UTC by Paul Hodgson
Modified: 2023-11-29 00:31 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example spreadsheet (9.44 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-03-29 13:03 UTC, Paul Hodgson
Details
Screenshot 1 related to example (72.40 KB, image/jpeg)
2020-03-29 13:03 UTC, Paul Hodgson
Details
Screenshot 2 related to example (61.37 KB, image/jpeg)
2020-03-29 13:04 UTC, Paul Hodgson
Details
Screenshot 3 related to example (53.52 KB, image/jpeg)
2020-03-29 13:04 UTC, Paul Hodgson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Hodgson 2020-03-25 11:23:13 UTC
Description:
I have a database table in Calc, some columns contain formulas but (to prevent changing within the main sheet) they are also protected. I would like to be able to use Data\Forms to enter new rows in the table but (I would have expected) the cells that are protected and/or containing formulae to be protected in the form, and show the results (I have not checked, but I would expect that hidden cells/columns within the table should not appear on the form).
I also have "Data Validation..." on some cells in the sheet (using lookups from other named ranges or lists) and would like that functionality to propagate to the form.

Steps to Reproduce:
1. Create a database in a sheet (A1 = "Width", B1 = "Height", C1 = "Area", C2 = "=A2*B2")
2. Select A1:C2 and name the Area "DB"
3. Protect column C (click on column header, Ctrl-1 to format and protect the cells of the column, then Right click on the sheet tab and select "Protect Sheet...", unselect the check on "Select protected cells"). If you now click on a cell in column C the cursor does not move there.
4. Position the cursor in A1 and Open Data\Form...

Actual Results:
The "Area" Field is open for data entry... no calculation is done when data is entered

Expected Results:
The field for the cell in the protected column should be protected because:
1. It is a protected cell - this should be protected in the form
2. It is a formula, this formula should be propagated to new cells and when data is entered the calculation should present results.


Reproducible: Always


User Profile Reset: No



Additional Info:
The form should inherit the attributes of the main sheet...
1. Protected columns should be protected
2. Hidden columns should be hidden
3. Formula cells should inherit the formula used in existing rows
4. Validation should be inherited from existing rows (e.e. if I has a list of values for the "Length" column, the form should provide a combo control with the same list of values.
Comment 1 Oliver Brinzing 2020-03-28 09:30:32 UTC
Thank you for reporting the bug. 

Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 Paul Hodgson 2020-03-29 13:03:13 UTC
Created attachment 159117 [details]
Example spreadsheet

Assumptions concerning desired function:
1. When creating a database which contains 'derived vales' (e.g. a column with a value computed from other columns in the row) the user should only have to need the formula in the rows that are currently present, and the system should replicate the formulae to new rows when added. The user should not need to copy the formula down to future rows to some indeterminate row number.
2. Similarly for data validation, cell format, protection etc.

The spreadsheet (Data Form example.ods) contains a sheet designed to be used  as a table to record values and provide a total of values in some of the cells. It also provides lookup for data validation on 2 of the entries (Class numbers based on a selection in the second sheet). It has formulae for lookup of the teacher names (VLOOKUP from the second sheet). It has a formulae for calculating the Total performance. The total performance cells are protected, The sheet is protected, but allows the insertion of new rows.

When opening Data/Form (see screenshot "Data form example 1.jpg"):
1. The protected cell is open for entry, meaning you can change a protected value (that you could not do in the sheet)
2. The cells with formulae are open for entry (see screenshot "Data form example 2.jpg"). And the value can be changed irrespective of the formula. And the formula is not applied so no calculation is done and the value entered may violate the formula relationship (Note: formulae are handled as disabled fields and show the calculated value in Excel)
3. No validation is applied to the cells that have it in the main sheet, so any value may be entered despite the validation applied in the main sheet (see screenshot "Data form example 3.jpg").

Ancillary noted items (unrelated) found whilst preparing the example:
1. If I click the "Clone Formatting.." button in the ribbon bar the cursor turns to a 'Paint Pot', if I right click on a cell and select "Clone Formatting" it does not.
Comment 3 Paul Hodgson 2020-03-29 13:03:50 UTC
Created attachment 159118 [details]
Screenshot 1 related to example
Comment 4 Paul Hodgson 2020-03-29 13:04:16 UTC
Created attachment 159119 [details]
Screenshot 2 related to example
Comment 5 Paul Hodgson 2020-03-29 13:04:33 UTC
Created attachment 159120 [details]
Screenshot 3 related to example
Comment 6 Paul Hodgson 2020-03-29 13:08:10 UTC
Note... I have upgraded to 6.4.2.2 (x64) to see if the issue has been addressed, and the example was prepared in that version, however I had seen exactly the same behaviour in 6.3.5.2, from which I had upgraded.
Comment 7 Paul Hodgson 2020-03-29 16:25:50 UTC
Hi,
I have found an extension that appears to try to do some of what I am trying to achieve (https://extensions.libreoffice.org/extensions/enhanced-form). I have tried it and found a couple of limitations/bugs which I will report to the author to see if he can deal with them, but it is good for visualisation of the need:
1. Validation does not work in the form when the "Data Validation" is "Allow"="Cell Range", and "Source"=a named range. The validation takes the name of the range minus it's first character as the only entry in the list, so I replaced it with the explicit range of cells (in the form $Sheet.$A$1:$A$63), however that exposed a second bug:
2. The code is incorrect in the module 'ListFiltre' line 145 "Redim Preserve ListFiltre(x)" is using x (I cannot see where this is declared/set, but just happened to have an unchanging value of 56) for this array which is being set with the allowable values. As my array is 63 lines long, this causes an error, my belief is the code should say "Redim Preserve ListFiltre(xf)", as xf is counting the number of values that will appear in the list.
3. It is not passing values back to the main cell properly (Particularly from the cells with data validation!
Many thanks for your help.
Paul
Comment 8 Buovjaga 2020-06-16 17:11:22 UTC
(In reply to Paul Hodgson from comment #2)
> Created attachment 159117 [details]
> Example spreadsheet
> 1. The protected cell is open for entry, meaning you can change a protected
> value (that you could not do in the sheet)

Reproduced with the document.

1. Data - Form
2. Change the value of Total score
3. click New

All the way in version 3.3.0.

Arch Linux 64-bit
Version: 7.1.0.0.alpha0+
Build ID: 43bdac0ebd65dfc32a0b8cf2c42fde88ad585e3f
CPU threads: 8; OS: Linux 5.7; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 15 June 2020
Comment 9 QA Administrators 2022-06-17 03:32:49 UTC Comment hidden (obsolete)
Comment 10 Paul Hodgson 2022-06-19 18:44:59 UTC
Tried to retest in 7.3.4.2, as requested, using the "Example spreadsheet" I posted initially.
1. After highlighting a column "Format cells..." is not available! (No "Ctrl-1", No "Format\Cells") so I could not even protect a column, so continued test by just selecting D1:D3 and protecting those, then selecting G1:G3 and protecting those. I toggled sheet protected off then on again.
2. In the spreadsheet when I try to enter data in C2 or G3, for example, it says the cells are protected, but in Data\Form the fields labelled "Teacher Y1" and "Teacher Yr2" are unprotected in the form, although:
2.1 If I change, for example, "Teacher Yr 1", overtyping "Adam" with "Daphne", the form shows "Daphne" until I change records away and then change records back (e.g. pressing "Next Record" then pressing "Previous Record", when "Alex" is redisplayed).
2.2 If I change "Class Yr1", say from "1A" to "1B", the formula that is dependent on this change is not invoked (i.e. "Teacher Yr1" does not change from "Adam") and when I return to the sheet I find that, not only does it still display "Adam", but the formula that was in D2 has been replaced with the fixed text "Adam".

I do not believe that the bug is fixed.  

The link in the Build number on the Help\About LibreOffice screen is: https://git.libreoffice.org/core/+log/728fec16bd5f605073805c3c9e7c4212a0120dc5
Comment 11 Buovjaga 2023-11-28 12:23:55 UTC
Discussing this in live bug streaming, the idea came up to disable the fields in the Form dialog that correspond to protected cells.
Comment 12 Buovjaga 2023-11-28 12:26:21 UTC
*** Bug 158211 has been marked as a duplicate of this bug. ***
Comment 13 Hossein 2023-11-28 12:56:51 UTC
In MS Excel, these things happen:

1. If the sheet is protected, no text edit is shown when the next rows are protected. Otherwise, you can edit in the region that is not protected. "New" for adding new record is also disabled in a protected sheet. Hidden columns are hidden.

2. If the number of selected columns is too much, it says "Too many fields in the data form". The maximum number of columns is 32, as clarified in these links:

https://answers.microsoft.com/en-us/msoffice/forum/all/too-many-fields-in-the-data-form/4ad69e07-524b-40c7-a520-746f4562bc01

https://www.timeatlas.com/excel-data-form/

3. When things are not clear according to the row/column selection, an extra dialog box appears.