Project

General

Profile

Bug #61652

action commentaire : vider la donnée comment_xxx quand un commentaire vide est soumis

Added by Thomas Noël over 1 year ago. Updated over 1 year ago.

Status:
Information nécessaire
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
10 February 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Si un commentaire vide (aucun commentaire) n'est soumis, alors la donnée « comment_xxx » n'est pas modifiée et reste à la valeur d'un précédent commentaire éventuel.

Mon avis est que lors qu'un commentaire vide est soumis, on devrait vider la donnée correspondante.

History

#2

Updated by Frédéric Péters over 1 year ago

comment_whatever c'est du truc nul stocké dans workflow_data pas d'avenir.

#4

Updated by Thomas Noël over 1 year ago

Oui pour la partie workflow_data, mais je pensais en fait "globalement" à la notion de commentaire, avec quelque chose comme ça

diff --git a/wcs/workflows.py b/wcs/workflows.py
index 04580c011..cd2d2dd75 100644
--- a/wcs/workflows.py
+++ b/wcs/workflows.py
@@ -2799,13 +2799,13 @@ class CommentableWorkflowStatusItem(WorkflowStatusItem):
     def submit_form(self, form, formdata, user, evo):
         if form.get_widget('comment'):
             comment = form.get_widget('comment').parse()
-            if comment:
-                comment_part = WorkflowCommentPart(comment, varname=self.varname)
-                evo.add_part(comment_part)
-                if self.varname:
-                    formdata.update_workflow_data(
-                        {'comment_%s' % self.varname: comment_part.get_as_plain_text()}
-                    )
+            # peut-être ici genre un comment = (comment or '').strip()
+            comment_part = WorkflowCommentPart(comment, varname=self.varname)
+            evo.add_part(comment_part)
+            if self.varname:
+                formdata.update_workflow_data(
+                    {'comment_%s' % self.varname: comment_part.get_as_plain_text()}
+                )

     def submit_admin_form(self, form):
         for f in self.get_parameters():

(mais rien essayé encore)

#5

Updated by Frédéric Péters over 1 year ago

Le workflow dans le ticket lié a juste cinq statuts mais demanderait quand même pas mal d'explications.

  • demande reçue, avec une action commentaire ("agent")
  • un bouton pour envoyer vers demande validée, qui pose dans une donnée de traitemente {{form_comment}} puis envoie le contenu de cette donnée de traitement par mail
  • dans "demande reçue" un bouton similaire pour envoyer vers demande rejetée, avec le même fonctionnement.

Dans les deux cas, pourquoi ne pas simplement taper {{form_comment}} dans le gabarit de l'email ?

Note : form_comment n'est pas le comment_xxx de l'intitulé de ce ticket.

Dans le workflow, l'autre partie, c'et l'envoi de demande reçue vers "information nécessaire", qui a la même affaire de donnée de traitement + courriel; puis qui a une action commentaire ("usager"). De ce statut, où l'usager est obligé de laisser un commentaire, renvoie vers "demande reçue".

Et dans "demande reçue", action courriel qui reprend {{comment_usager}}.

Je ne vois pas où ce ticket interviendrait et changerait quoique ce soit.

#7

Updated by Frédéric Péters over 1 year ago

Et je dégage #61624 en ticket lié ne mêlons pas trop de choses.

#8

Updated by Frédéric Péters over 1 year ago

  • Status changed from Nouveau to Information nécessaire

Bref je pense que ça s'est emballé sur un faux problème, qu'il y avait juste à utiliser {{form_comment}}.

Also available in: Atom PDF