Merge lp:~graeme-acm/sahana-eden/LA into lp:sahana-eden/la

Proposed by Graeme Foster
Status: Merged
Merged at revision: 2689
Proposed branch: lp:~graeme-acm/sahana-eden/LA
Merge into: lp:sahana-eden/la
Diff against target: 179 lines (+91/-19)
5 files modified
models/vol.py (+24/-14)
private/prepopulate/demo/LA/tasks.cfg (+4/-3)
private/prepopulate/demo/LA/vol_application.csv (+1/-1)
private/prepopulate/demo/LA/vol_assignment.csv (+1/-1)
static/formats/s3csv/vol/contact.xsl (+61/-0)
To merge this branch: bzr merge lp:~graeme-acm/sahana-eden/LA
Reviewer Review Type Date Requested Status
Fran Boon Pending
Review via email: mp+73378@code.launchpad.net

Description of the change

fix pre-populate: imported vol assignments were not appearing because they were not make owners of the record. The "report to" was not appearing because that value was not copied over to the vol_assignment table, now both done in application_manage_totals(). Emergency contact details not appearing now set up in the vol_contatc table

Minor change to the look of the vol assignment pdf

To post a comment you must log in.
lp:~graeme-acm/sahana-eden/LA updated
2400. By graeme-acm

redo the certificate

2401. By graeme-acm

merge trunk

2402. By graeme-acm

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'models/vol.py'
2--- models/vol.py 2011-08-30 08:38:20 +0000
3+++ models/vol.py 2011-08-30 14:17:35 +0000
4@@ -257,15 +257,16 @@
5
6 req_id = record.req_req.id
7
8+ _req = db(rrtable.id == req_id).select(rrtable.request_for_id,
9+ limitby=(0, 1)).first()
10+ if _req:
11+ report_to = _req.request_for_id
12+ else:
13+ report_to = None
14+
15 if person_id != None:
16 # Only do this for non-CSV imports
17 # Lookup the Report To
18- _req = db(rrtable.id == req_id).select(rrtable.request_for_id,
19- limitby=(0, 1)).first()
20- if _req:
21- report_to = _req.request_for_id
22- else:
23- report_to = None
24
25 # Add Assignment
26 if auth.user.organisation_id:
27@@ -277,7 +278,12 @@
28 assign = vastable.insert(req_id = req_id,
29 person_id = person_id,
30 report_to_id = report_to)
31- else:
32+ else: # for CSV imports
33+ db(vastable.req_id == req_id).update(report_to_id = report_to,
34+ created_by = vastable.person_id,
35+ modified_by = vastable.person_id,
36+ owned_by_user = vastable.person_id,
37+ )
38 assign = None
39
40 # Calculate the number of people assigned to a request
41@@ -1023,11 +1029,15 @@
42 col2 = 20
43 col1 = (width - col2) *.5
44 col3 = (width - col2) *.5
45- style = [("VALIGN", (0, 0), (-1, -1), "TOP"),
46- ("SPAN",(0, 0), (1, 0)),
47- ]
48- table1 = pdf.getStyledTable(cell1, colWidths=[col1*.3, col1*.7], style=style)
49- table2 = pdf.getStyledTable(cell2, colWidths=[col3*.3, col3*.7], style=style)
50+ style1 = [("VALIGN", (0, 0), (-1, -1), "TOP"),
51+ ("SPAN",(0, 0), (1, 0)),
52+ ]
53+ style2 = [("VALIGN", (0, 0), (-1, -1), "TOP"),
54+ ("SPAN",(0, 0), (1, 0)),
55+ ("SPAN",(0,1),(0,2)),
56+ ]
57+ table1 = pdf.getStyledTable(cell1, colWidths=[col1*.3, col1*.7], style=style1)
58+ table2 = pdf.getStyledTable(cell2, colWidths=[col3*.3, col3*.7], style=style2)
59 style1_1 = [("VALIGN", (0, 0), (-1, -1), "TOP"),
60 ("BOX", (0, 0), (0, 0), 1, "#000000"),
61 ("BOX", (2, 0), (2, 0), 1, "#000000"),
62@@ -1038,8 +1048,8 @@
63 colWidths=[col1, col2, col3],
64 style=style1_1
65 )
66- table3 = pdf.getStyledTable(cell3, colWidths=[col1*.3, col1*.7], style=style)
67- table4 = pdf.getStyledTable(cell4, colWidths=[col3*.3, col3*.7], style=style)
68+ table3 = pdf.getStyledTable(cell3, colWidths=[col1*.3, col1*.7], style=style1)
69+ table4 = pdf.getStyledTable(cell4, colWidths=[col3*.3, col3*.7], style=style1)
70 tableC = pdf.getStyledTable([[table3, "", table4]],
71 colWidths=[col1, col2, col3],
72 style=style1_1)
73
74=== modified file 'private/prepopulate/demo/LA/tasks.cfg'
75--- private/prepopulate/demo/LA/tasks.cfg 2011-08-30 04:38:26 +0000
76+++ private/prepopulate/demo/LA/tasks.cfg 2011-08-30 14:17:35 +0000
77@@ -26,6 +26,7 @@
78 req,req,req_req.csv,req.xsl
79 req,req_item,req_item.csv,req_item.xsl
80 req,req_skill,req_skill.csv,req_skill.xsl
81-#vol,application,vol_application.csv,application.xsl
82-#vol,assignment,vol_application.csv,assignment.xsl
83-#*,vol_application_onaccept_csv,req_req.csv
84+vol,application,vol_application.csv,application.xsl
85+vol,assignment,vol_application.csv,assignment.xsl
86+vol,contact,vol_application.csv,contact.xsl
87+*,vol_application_onaccept_csv,req_req.csv
88
89=== modified file 'private/prepopulate/demo/LA/vol_application.csv'
90--- private/prepopulate/demo/LA/vol_application.csv 2011-08-09 10:26:21 +0000
91+++ private/prepopulate/demo/LA/vol_application.csv 2011-08-30 14:17:35 +0000
92@@ -2,7 +2,7 @@
93 "LAUREL_CANYON*07_2011#04","Jane","Doe","Wynne","Parent","3024587621"
94 "LAUREL_CANYON*07_2011#05","Jim","Jones","Audra","Parent","3034587621"
95 "LAUREL_CANYON*07_2011#05","Cecilia","Key","Jonas","Parent","3044587621"
96-"LAUREL_CANYON*07_2011#05","Emerald","Potter","Dennis","Parent","3054587621"
97+"LAUREL_CANYON*07_2011#05","Wendy","Moses","Dennis","Parent","3054587621"
98 "LAUREL_CANYON*07_2011#05","Bethany","Poole","Harlan","Parent","3064587621"
99 "LAUREL_CANYON*07_2011#05","Odette","Combs","Allistair","Parent","3074587621"
100 "LAUREL_CANYON*07_2011#05","Mia","Rivera","Kirk","Parent","3084587621"
101
102=== modified file 'private/prepopulate/demo/LA/vol_assignment.csv'
103--- private/prepopulate/demo/LA/vol_assignment.csv 2011-08-07 16:17:38 +0000
104+++ private/prepopulate/demo/LA/vol_assignment.csv 2011-08-30 14:17:35 +0000
105@@ -2,7 +2,7 @@
106 "LAUREL_CANYON*07_2011#04","Jane","Doe",,"2011-08-05 21:10:00","2011-08-05 21:18:00",5
107 "LAUREL_CANYON*07_2011#05","Jim","Jones",,"2011-08-05 21:18:00","2011-08-05 21:23:00",
108 "LAUREL_CANYON*07_2011#05","Cecilia","Key",,,,
109-"LAUREL_CANYON*07_2011#05","Emerald","Potter",,"2011-08-05 21:10:00","2011-08-05 21:18:00",4
110+"LAUREL_CANYON*07_2011#05","Wendy","Moses,,"2011-08-05 21:10:00","2011-08-05 21:18:00",4
111 "LAUREL_CANYON*07_2011#05","Bethany","Poole",,,,
112 "LAUREL_CANYON*07_2011#05","Odette","Combs",,,,
113 "LAUREL_CANYON*07_2011#05","Mia","Rivera",,,,
114
115=== added file 'static/formats/s3csv/vol/contact.xsl'
116--- static/formats/s3csv/vol/contact.xsl 1970-01-01 00:00:00 +0000
117+++ static/formats/s3csv/vol/contact.xsl 2011-08-30 14:17:35 +0000
118@@ -0,0 +1,61 @@
119+<?xml version="1.0"?>
120+<xsl:stylesheet
121+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
122+
123+ <!-- **********************************************************************
124+ Request Items - CSV Import Stylesheet
125+
126+ - example raw URL usage:
127+ Let URLpath be the URL to Sahana Eden appliation
128+ Let Resource be vol/contact/create
129+ Let Type be s3csv
130+ Let CSVPath be the path on the server to the CSV file to be imported
131+ Let XSLPath be the path on the server to the XSL transform file
132+ Then in the browser type:
133+
134+ URLpath/Resource.Type?filename=CSVPath&transform=XSLPath
135+
136+ You can add a third argument &ignore_errors
137+ CSV fields:
138+ First Name......................pr_person.first_name (lookup only)
139+ Last Name.......................pr_person.last_name (lookup only)
140+ Emergency Contact Name..........vol_contact.emergency_contact_name
141+ Emergency Contact Relationship..vol_contact.emergency_contact_relationship
142+ Emergency Contact Phone.........vol_contact.emergency_contact_phone
143+
144+ *********************************************************************** -->
145+
146+ <xsl:output method="xml"/>
147+
148+ <xsl:template match="/">
149+ <s3xml>
150+ <!-- Create each record -->
151+ <xsl:for-each select="table/row">
152+
153+ <!-- Person record -->
154+ <xsl:variable name="FName"><xsl:value-of select="col[@field='First Name']"/></xsl:variable>
155+ <xsl:variable name="LName"><xsl:value-of select="col[@field='Last Name']"/></xsl:variable>
156+ <xsl:variable name="Person"><xsl:value-of select="concat($FName, $LName)"/></xsl:variable>
157+ <resource name="pr_person">
158+ <xsl:attribute name="tuid">
159+ <xsl:value-of select="$Person"/>
160+ </xsl:attribute>
161+ <data field="first_name"><xsl:value-of select="$FName"/></data>
162+ <data field="last_name"><xsl:value-of select="$LName"/></data>
163+ </resource>
164+
165+ <!-- Volunteer Application -->
166+ <resource name="vol_contact">
167+ <reference field="person_id" resource="pr_person">
168+ <xsl:attribute name="tuid">
169+ <xsl:value-of select="$Person"/>
170+ </xsl:attribute>
171+ </reference>
172+ <data field="emergency_contact_name"><xsl:value-of select="col[@field='Emergency Contact Name']"/></data>
173+ <data field="emergency_contact_relationship"><xsl:value-of select="col[@field='Emergency Contact Relationship']"/></data>
174+ <data field="emergency_contact_phone"><xsl:value-of select="col[@field='Emergency Contact Phone']"/></data>
175+ </resource>
176+ </xsl:for-each>
177+ </s3xml>
178+ </xsl:template>
179+</xsl:stylesheet>

Subscribers

People subscribed via source and target branches

to all changes: