GemsTracker / gemstracker-library

GEneric Medical Survey Tracker, main library
http://gemstracker.org
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

EmailSubscribeSnippet: Don't use 'no mail' code when subscribing #788

Closed rvm-peercode closed 1 year ago

rvm-peercode commented 1 year ago

In my database, the first mail code is 0, where gmc_mail_cause_target is Never mail. I assume this is not the correct code to use when subscribing, as this code is also used when unsubscribing.

This change ensures we use the second mail code (which has id 100 and gmc_mail_cause_target Mail), as I assume was the intention here.

Another option would be to use a hardcoded class value, like is done in https://github.com/GemsTracker/gemstracker-library/blob/master/classes/Gems/Snippets/Unsubscribe/EmailUnsubscribeSnippet.php#L61

If the database contents are different in live situations than this fix is incorrect; IMHO a better solution would not to rely on the order of mailcodes in the database, but to select the first mailcode where gmc_mail_to_target is Yes, or where gmc_for_surveys is 1. Please advise.

mddejong commented 1 year ago

Merged met verkeerde versie

rvm-peercode commented 1 year ago

Hoi Matijs, het was wel de bedoeling om deze met master te mergen, aangezien het probleem dat wordt opgelost ook in master zit, volgens mij. Zou je daar nog eens naar kunnen kijken? Alvast bedankt!