Skip to content

Commit ca74418

Browse files
committed
Add the first form action to the UK1841 form, Occupation column
1 parent 0ceec78 commit ca74418

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Form/form_gb.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,33 @@
186186
<column>
187187
<_attribute>Occupation</_attribute>
188188
<size>25</size>
189+
<action title='Create Occupation event'>
190+
<enable_if>
191+
<![CDATA[
192+
True
193+
]]>
194+
</enable_if>
195+
<command>
196+
<![CDATA[
197+
# build the new OCCUPATION event
198+
event = Event()
199+
event.set_type(EventType.OCCUPATION)
200+
event.set_date_object(self.event.get_date_object())
201+
event.add_citation(self.citation.get_handle())
202+
event.set_description(value)
203+
with DbTxn("form_action", self.db) as trans:
204+
# add to the database
205+
self.db.add_event(event, trans)
206+
# Add new event reference to the Person record
207+
event_ref = EventRef()
208+
event_ref.ref = event.get_handle()
209+
event_ref.set_role(EventRoleType.PRIMARY)
210+
person = self.db.get_person_from_handle(object)
211+
person.add_event_ref(event_ref)
212+
self.db.commit_person(person, trans)
213+
]]>
214+
</command>
215+
</action>
189216
</column>
190217
<column>
191218
<_attribute>Where Born</_attribute>

0 commit comments

Comments
 (0)