Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Each common propery is now saved to surveypro_item #963

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kordan
Copy link
Owner

@kordan kordan commented Apr 15, 2024

When "content_among_basics" (that saves content and contentformat to surveypro_item and no longer into db tables of item plugins) and this PR will land to mastwer, I hope all will be ready to start to modify surveypro to let it correctly run in php8.2 and 8.3.

With this PR the situation of properties should be:

                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON   | RATE            | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
id (h)           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
surveyproid (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
type (h)         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
plugin (h)       | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

content          | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | NO          | √         | NO        |
contentformat    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |

required         | √             | NO          | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
indent           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
position         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
customnumber     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
hideinstructions | √             | NO          | NO             | √            | √               | √              | √              | NO         | √             | √               | √             | NO            | √               | √              | NO             | √              | √          | √              | NO            | NO          | NO        | NO        |

variable         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
extranote        | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |

hidden           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
insearchform     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
reserved         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

sortindex (h)    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
formpage (h)     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

parentid         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
parentvalue      | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

timecreated (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
timemodified (h) | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

All the properties in the first column are relative to a field of the table surveypro_item.
All the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.
Not all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);
If $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).
Marked with (h) are properties hidden to user.

In the next table the list of specific properties item per item.
These properties are save in surveypro(field|format)_.
Yes, some of them coincide, but the number of plugins sharing the same property is too low and even the semantic is too specific of each single plugin so
I decided to save these properties among the fields of the child table and not in surveypro_item.

                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON    | RATE           | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
                 | defaultoption | hiddenfield | defaultoption  | trimonsave   | options         | defaultoption  | step           | maxfiles   | defaultoption | options         | defaultvalue  | options        | options        | defaultoption  | options        | defaultoption  | trimonsave | step           | defaultstatus |             | fullwidth |
                 | defaultvalue  | element01   | defaultvalue   | defaultvalue | labelother      | defaultvalue   | defaultvalue   | maxbytes   | defaultvalue  | defaultvalue    | signed        | labelother     | rates          | defaultvalue   | labelother     | defaultvalue   | useeditor  | defaultoption  |                             | leftlabel |
                 | lowerbound    | element02   | downloadformat | pattern      | defaultvalue    | downloadformat | defaultvalue   | filetypes  | lowerbound    | noanswerdefault | lowerbound    | defaultoption  | defaultoption  | downloadformat | defaultoption  | downloadformat | arearows   | defaultvalue   |
                 | upperbound    | element03   | style          | minlength    | noanswerdefault | lowerbound     | downloadformat |            | upperbound    | downloadformat  | upperbound    | defaultvalue   | defaultvalue   | lowerbound     | defaultvalue   | lowerbound     | areacols   | downloadformat |
                                 | element04   |                | maxlength    | downloadformat  | upperbound     | lowerbound     |                            | minimumrequired | decimals      | downloadformat | downloadformat | upperbound     | downloadformat | upperbound     | minlength  | lowerbound     |
                                 | element05   |                               | minimumrequired |                | upperbound     |                            | maximumrequired |               | adjustment     | style          |                                                  | maxlength  | upperbound     |
                                                                               | maximumrequired |                                                              | heightinrows    |                                | differentrates |
                                                                               | adjustment      |

kordan added 3 commits March 23, 2024 20:39
As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address.
The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item.
There are two reflections related to this problem:
- theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned;
- I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform".
The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.)
I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform".
So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table.

The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.

Two details:
1. I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:
- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;
- upgrade your surveypro;
- regenerate each usertemplate and each mastertemplate.
2. obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one).
When "content_among_basics" (that saves content and contentformat to surveypro_item and no longer into db tables of item plugins) and this PR will land to mastwer, I hope all will be ready to start to modify surveypro to let it correctly run in php8.2 and 8.3.

With this PR the situation of properties should be:
```
                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON   | RATE            | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
id (h)           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
surveyproid (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
type (h)         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
plugin (h)       | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

content          | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | NO          | √         | NO        |
contentformat    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |

required         | √             | NO          | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
indent           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
position         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
customnumber     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
hideinstructions | √             | NO          | NO             | √            | √               | √              | √              | NO         | √             | √               | √             | NO            | √               | √              | NO             | √              | √          | √              | NO            | NO          | NO        | NO        |

variable         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
extranote        | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |

hidden           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
insearchform     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
reserved         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

sortindex (h)    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
formpage (h)     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

parentid         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
parentvalue      | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

timecreated (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
timemodified (h) | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
All the properties in the first column are relative to a field of the table surveypro_item.
All the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.
Not all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[<property>] = (false|true);
If $this->insetupform[<property>] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).
Marked with (h) are properties hidden to user.

In the next table the list of specific properties item per item.
These properties are save in surveypro(field|format)_<plugin>.
Yes, some of them coincide, but the number of plugins sharing the same property is too low and even the semantic is too specific of each single plugin so
I decided to save these properties among the fields of the child table and not in surveypro_item.
                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON    | RATE           | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
                 | defaultoption | hiddenfield | defaultoption  | trimonsave   | options         | defaultoption  | step           | maxfiles   | defaultoption | options         | defaultvalue  | options        | options        | defaultoption  | options        | defaultoption  | trimonsave | step           | defaultstatus |             | fullwidth |
                 | defaultvalue  | element01   | defaultvalue   | defaultvalue | labelother      | defaultvalue   | defaultvalue   | maxbytes   | defaultvalue  | defaultvalue    | signed        | labelother     | rates          | defaultvalue   | labelother     | defaultvalue   | useeditor  | defaultoption  |                             | leftlabel |
                 | lowerbound    | element02   | downloadformat | pattern      | defaultvalue    | downloadformat | defaultvalue   | filetypes  | lowerbound    | noanswerdefault | lowerbound    | defaultoption  | defaultoption  | downloadformat | defaultoption  | downloadformat | arearows   | defaultvalue   |
                 | upperbound    | element03   | style          | minlength    | noanswerdefault | lowerbound     | downloadformat |            | upperbound    | downloadformat  | upperbound    | defaultvalue   | defaultvalue   | lowerbound     | defaultvalue   | lowerbound     | areacols   | downloadformat |
                                 | element04   |                | maxlength    | downloadformat  | upperbound     | lowerbound     |                            | minimumrequired | decimals      | downloadformat | downloadformat | upperbound     | downloadformat | upperbound     | minlength  | lowerbound     |
                                 | element05   |                               | minimumrequired |                | upperbound     |                            | maximumrequired |               | adjustment     | style          |                                                  | maxlength  | upperbound     |
                                                                               | maximumrequired |                                                              | heightinrows    |                                | differentrates |
                                                                               | adjustment      |
```
@kordan kordan marked this pull request as draft April 15, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant