#601 [EventPro] fix: use dictionary refusal reason as closure event title - #764
Open
evarisk-kilyan wants to merge 1 commit into
Open
evarisk-kilyan wants to merge 1 commit into
evarisk-kilyan wants to merge 1 commit into
Conversation
…ent title When closing an opportunity as lost, the user had to BOTH pick a refusal reason from the dictionary AND retype it in a mandatory free-text field. The dictionary reason was only stored in the opprefusal extrafield, never used for the closure event label. - Free comment is now optional: selecting a dictionary reason is enough to save. - The actioncomm label is built from the dictionary reason (c_refusal_reason); the handwritten comment now goes to the event description (note_private). - Replace hand-written SQL with native Dolibarr helpers: dol_getIdFromCode (c_lead_status), getDictionaryValue (c_refusal_reason), ActionComm::getActions + ->update($user), and extrafields via array_options/insertExtraFields. Drop the redundant raw projet_extrafields UPDATE. Fixes Eoxia#601 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Fixes #601
À la clôture d'une opportunité en Perdu, le widget imposait de choisir une raison dans le dictionnaire ET de la ré-écrire dans un champ texte libre (obligatoire). La raison du dico n'était stockée que dans l'extrafield
opprefusalet n'apparaissait jamais dans le libellé de l'event de clôture.Correctif fonctionnel
actions_reedcrm.class.php— validation + placeholders).PJ… - Clôturé - <raison du dico>.note_private), plus dans le titre.Nettoyage
$sql→ fonctions natives Dolibarr (ajax/close_record.php)SELECT … c_lead_status WHERE code=…dol_getIdFromCode($db, $statusStr, 'c_lead_status', 'code', 'rowid')SELECT … c_refusal_reason WHERE rowid=…getDictionaryValue('c_refusal_reason', 'ref'/'label', …)SELECT id FROM actioncomm …+UPDATE actioncomm SET label …ActionComm::getActions()+$event->update($user)INSERT … actioncomm_extrafields …$actioncomm->array_options['options_reedcrm_status_object'](persisté parcreate())UPDATE projet_extrafields SET opprefusal …(failsafe redondant)insertExtraFields()le fait déjà)Bénéfices : escaping/entité gérés, triggers déclenchés, cache dico, code plus court.
Notes
note_privatereçoit$comment(lu enGETPOST(..., 'alpha')). Comme il devient une vraie description, on pourrait passer à'restricthtml'pour préserver ponctuation/accents — laissé tel quel ici (hors périmètre), à voir en suivi.actioncomm_extrafields(migration plus risquée, hors périmètre de cette PR).Test
PJ… - Clôturé - <raison choisie>.