Merge lp:~graeme-acm/sahana-eden/RMS into lp:sahana-eden

Proposed by Graeme Foster
Status: Merged
Merged at revision: 3037
Proposed branch: lp:~graeme-acm/sahana-eden/RMS
Merge into: lp:sahana-eden
Diff against target: 73 lines (+10/-12)
3 files modified
models/01_menu.py (+2/-4)
models/survey.py (+7/-7)
modules/s3/s3survey.py (+1/-1)
To merge this branch: bzr merge lp:~graeme-acm/sahana-eden/RMS
Reviewer Review Type Date Requested Status
Fran Boon Pending
Review via email: mp+85681@code.launchpad.net

Description of the change

Fixing the web form for ADAT:
 * fixing a display issue for linked types
 * ensuring that the onaccept is called for a newAssessment

Also fix for ticket 1080

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'models/01_menu.py'
2--- models/01_menu.py 2011-12-13 14:02:49 +0000
3+++ models/01_menu.py 2011-12-14 15:33:43 +0000
4@@ -669,10 +669,8 @@
5 "condition1": lambda: session.s3.hrm.mode is not None,
6 "conditional1": [
7 [ T("Profile"),
8- False,
9- lambda: aURL(f="person",
10- args=[str(s3_logged_in_person())],
11- vars=dict(mode="personal"))
12+ True,aURL(f="person",
13+ vars=dict(mode="personal"))
14 ]],
15
16 "condition2": lambda: (session.s3.hrm.mode is not None) and (session.s3.hrm.orgs or ADMIN in session.s3.roles),
17
18=== modified file 'models/survey.py'
19--- models/survey.py 2011-12-07 15:53:45 +0000
20+++ models/survey.py 2011-12-14 15:33:43 +0000
21@@ -1176,18 +1176,16 @@
22 This will also extract the default location question as
23 defined by the template and store this in the location field
24 """
25+ if form.vars.id:
26+ completeOnAccept(form.vars.id)
27+
28+ def completeOnAccept(id):
29 ##################################################################
30 # Get the basic data that is needed
31 ##################################################################
32 rtable = db.survey_complete
33 atable = db.survey_answer
34-
35- if form.vars.id:
36- record = rtable[form.vars.id]
37- else:
38- return
39-
40- id = record.id
41+ record = rtable[id]
42 series_id = record.series_id
43 if series_id == None:
44 return
45@@ -2033,11 +2031,13 @@
46 if complete_id == None:
47 # Insert into database
48 id = db.survey_complete.insert(series_id = series_id, answer_list = text)
49+ completeOnAccept(id)
50 return id
51 else:
52 # Update the complete_id record
53 table = db.survey_complete
54 db(table.id == complete_id).update(answer_list = text)
55+ completeOnAccept(complete_id)
56 return complete_id
57
58 def survey_get_series_questions(series_id):
59
60=== modified file 'modules/s3/s3survey.py'
61--- modules/s3/s3survey.py 2011-12-05 11:10:32 +0000
62+++ modules/s3/s3survey.py 2011-12-14 15:33:43 +0000
63@@ -1370,9 +1370,9 @@
64 self.typeDescription = T("Link")
65
66 def display(self, **attr):
67- S3QuestionTypeAbstractWidget.display(self, **attr)
68 type = self.get("Type")
69 realWidget = survey_question_type[type]()
70+ realWidget.question = self.question
71 return realWidget.display(**attr)
72
73 def getParentType(self):