r42519 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42518‎ | r42519 | r42520 >
Date:23:46, 24 October 2008
Author:straussd
Status:old
Tags:
Comment:
Remove email domains
Modified paths:
  • /civicrm/trunk/sites/all/bin/public_reporting/synchronize.sql (modified) (history)
  • /civicrm/trunk/sites/all/bin/public_reporting/triggers.sql (modified) (history)

Diff [purge]

Index: civicrm/trunk/sites/all/bin/public_reporting/triggers.sql
@@ -6,12 +6,7 @@
77 BEGIN
88 DECLARE anonymous INTEGER;
99 DECLARE display_name VARCHAR(128);
10 - SET anonymous := (SELECT do_not_trade FROM civicrm_contact WHERE id = NEW.contact_id);
11 - IF anonymous THEN
12 - SET display_name := (SELECT display_name FROM civicrm_contact WHERE id = NEW.contact_id);
13 - ELSE
14 - SET display_name := NULL;
15 - END IF;
 10+ SET display_name := (SELECT IF(do_not_trade, NULL, SUBSTRING_INDEX(display_name, "@", 1)) FROM civicrm_contact WHERE id = NEW.contact_id);
1611 INSERT INTO public_reporting (contribution_id, contact_id, name, converted_amount, original_currency,
1712 original_amount, note, received)
1813 VALUES (NEW.id, NEW.contact_id, display_name, NEW.total_amount, SUBSTRING(NEW.source, 1, 3),
@@ -22,12 +17,7 @@
2318 BEGIN
2419 DECLARE anonymous INTEGER;
2520 DECLARE display_name VARCHAR(128);
26 - SET anonymous := (SELECT do_not_trade FROM civicrm_contact WHERE id = NEW.contact_id);
27 - IF anonymous THEN
28 - SET display_name := (SELECT display_name FROM civicrm_contact WHERE id = NEW.contact_id);
29 - ELSE
30 - SET display_name := NULL;
31 - END IF;
 21+ SET display_name := (SELECT IF(do_not_trade, NULL, SUBSTRING_INDEX(display_name, "@", 1)) FROM civicrm_contact WHERE id = NEW.contact_id);
3222 UPDATE public_reporting pr
3323 SET pr.contact_id = NEW.contact_id, pr.name = display_name, pr.converted_amount = NEW.total_amount,
3424 pr.original_currency = SUBSTRING(NEW.source, 1, 3), pr.original_amount = SUBSTRING(NEW.source, 5),
@@ -37,9 +27,7 @@
3828 //
3929 CREATE TRIGGER public_reporting_contact_update AFTER UPDATE ON civicrm_contact FOR EACH ROW
4030 BEGIN
41 - IF NEW.do_not_trade THEN
42 - UPDATE public_reporting pr SET pr.name = NULL WHERE pr.contact_id = NEW.id;
43 - ELSE
44 - UPDATE public_reporting pr SET pr.name = NEW.display_name WHERE pr.contact_id = NEW.id;
45 - END IF;
 31+ DECLARE display_name VARCHAR(128);
 32+ SET display_name := (SELECT IF(do_not_trade, NULL, SUBSTRING_INDEX(display_name, "@", 1)) FROM civicrm_contact WHERE id = NEW.id);
 33+ UPDATE public_reporting pr SET pr.name = display_name WHERE pr.contact_id = NEW.id;
4634 END
Index: civicrm/trunk/sites/all/bin/public_reporting/synchronize.sql
@@ -2,7 +2,7 @@
33 DELETE FROM public_reporting;
44 INSERT INTO public_reporting (contribution_id, contact_id, name, converted_amount, original_currency,
55 original_amount, note, received)
6 -SELECT cn.id, ct.id, IF(ct.do_not_trade, NULL, ct.display_name), cn.total_amount,
 6+SELECT cn.id, ct.id, IF(ct.do_not_trade, NULL, SUBSTRING_INDEX(ct.display_name, "@", 1)), cn.total_amount,
77 SUBSTRING(cn.source, 1, 3), CONVERT(SUBSTRING(cn.source, 5), DECIMAL(20,2)), cn.note, UNIX_TIMESTAMP(cn.receive_date)
88 FROM civicrm_contribution cn
99 INNER JOIN civicrm_contact ct ON cn.contact_id = ct.id

Status & tagging log