Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • Yakforms Yakforms
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 11
    • Merge requests 11
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • YakformsYakforms
  • YakformsYakforms
  • Wiki
  • Expiration of webforms

Expiration of webforms · Changes

Page history
Update Expiration of webforms authored Feb 27, 2020 by theo lem's avatar theo lem
Hide whitespace changes
Inline Side-by-side
Expiration-of-webforms.md
View page @ 7b8360aa
......@@ -3,7 +3,7 @@
The webforms and their submissions should be automatically deleted under 6 months in the PostgreSQL database if no user action is taken.
The user should be notified 2 weeks in advance of their webform submission, and a link should enable them to give 6 more months of lifetime to their webform.
## SQL QUERY
## SQL QUERIES
**The following queries can be executed through a hook on webform access by a user, or on the Drupal hook_cron. The queries should be executed once a day.**
#### DELETE SUBMISSIONS
......@@ -26,10 +26,10 @@ delete from node where (type='form1' or type='webform') and to_timestamp(created
## USER NOTIFICATION
Possible process :
* each day, the Drupal automated cron launches a hook (defined in the framaforms module) which will check in the Postgres tables *node* (webforms) and *webform_submissions* (answers to forms) for rows aged over 6 months, minus two weeks (26 weeks). For each, it will set the "notified" field to 1 in a new "webforms_expiration" table (**to be created**) in the Postgres database.
* the hook will get the corresponding user emails and send them a preconfigured email notifying them of their webform expiration, and giving them a token to extend the webform's lifetime by 6 months.
* accessing this token will set the "notified" field to 2, corresponding to the user having extended the webform by six month (3 = second extension, 4 = fourth, etc.) That way the cron wil only delete every day the webforms aged of exactly 6 months, and whose "notified" field is set to 1 (the user was notified but did nothing).
* the cron should also perform the same process for rows aged over 6 months.
*check the possibility of adding a column to an existing table in postgres*
#### TIMELINE
![framaforms_lifetime_timeline](uploads/9c58483e9bab986776f6ecaf146a47d2/framaforms_lifetime_timeline.png)
#### PROCESS
* each day, the Drupal automated cron checks in the DB for rows aged over 6 months, minus two weeks (24 weeks). It will place their nid in a new row of the *framaforms_expired* table.
* Framaforms will get the corresponding user emails and notify them of their webform expiration, giving them the possibility to change the expiration date (always with a maximum of 6 months in the future). If the email was sent, the *notified* row in the *framaforms_expired* table will be set to 1.
* Framaforms will also check for webforms having reached their deletion date (35 weeks), whose owner was notified, but did nothing. In which case, the webform will be deleted, as well as the entry in the *framaforms_expired* table.
\ No newline at end of file
Clone repository
  • Changing an instance language
  • Common issues
  • Configuring Yakforms
  • Custom scripts
  • Enhancing Yakforms
  • Expiration of webforms
  • From Framaforms to Yakforms
  • Installing Yakforms through the installation profile
  • Module : yakforms
  • Module : yakforms_public_results
  • Module : yakforms_share_results
  • Module : yakforms_spam
  • Produce a release
  • Translating Yakforms
  • Working with the Yakforms feature
View All Pages