Add trigger to allow update of notes as well on contact_settings.
This commit is contained in:
		
							parent
							
								
									deb31e9c18
								
							
						
					
					
						commit
						225eb13674
					
				
					 1 changed files with 17 additions and 0 deletions
				
			
		|  | @ -378,6 +378,23 @@ CREATE VIEW UserOperation_contact_setting_change AS | |||
|    LEFT JOIN request_type rt ON rt.id = rr.request_type_id | ||||
|    ORDER BY dd.ledger_entity_id, rr.date_requested; | ||||
| 
 | ||||
| DROP TRIGGER  IF EXISTS contact_setting_note_updater; | ||||
| CREATE TRIGGER contact_setting_note_updater | ||||
| INSTEAD OF UPDATE OF note on UserOperation_contact_setting_change | ||||
| BEGIN | ||||
| SELECT CASE | ||||
|   WHEN ( OLD.setting_requested IS NULL ) | ||||
|   THEN RAISE(FAIL, "Invalid note setting; Cannot write note on when setting_requested is NULL") | ||||
|   END; | ||||
| 
 | ||||
| UPDATE request | ||||
|        SET notes = NEW.note | ||||
|      WHERE id = OLD.request_id | ||||
|        AND OLD.request_id is NOT NULL | ||||
|        AND OLD.donor_id = donor_id | ||||
|        AND request_type_id = 12; | ||||
| END; | ||||
| 
 | ||||
| DROP TRIGGER  IF EXISTS contact_setting_config_change_updater; | ||||
| CREATE TRIGGER contact_setting_config_change_updater | ||||
| INSTEAD OF UPDATE OF setting_requested on UserOperation_contact_setting_change | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn