~michael-howden/sahana-eden/eden

« back to all changes in this revision

Viewing changes to controllers/event.py

  • Committer: Michael Howden
  • Date: 2012-01-18 02:46:12 UTC
  • mfrom: (2653.1.486 eden)
  • Revision ID: michael@sahanafoundation.org-20120118024612-70bahuqx9rezd8w7
Merge Trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
 
192
192
    """ Send message to people/teams """
193
193
 
194
 
    if "hrm_id" in request.vars:
195
 
        id = request.vars.hrm_id
 
194
    vars = request.vars
 
195
 
 
196
    if "hrm_id" in vars:
 
197
        id = vars.hrm_id
196
198
        fieldname = "hrm_id"
197
199
        table = s3db.pr_person
198
200
        htable = s3db.hrm_human_resource
199
201
        pe_id_query = (htable.id == id) & \
200
202
                      (htable.person_id == table.id)
201
203
        title = T("Send a message to this person")
 
204
    else:
 
205
        session.error = T("Record not found")
 
206
        redirect(URL(f="index"))
202
207
 
203
208
    pe = db(pe_id_query).select(table.pe_id,
204
209
                                limitby=(0, 1)).first()
207
212
        redirect(URL(f="index"))
208
213
 
209
214
    pe_id = pe.pe_id
210
 
    request.vars.pe_id = pe_id
211
215
 
212
216
    # Get the individual's communications options & preference
213
217
    table = s3db.pr_contact
220
224
        session.error = T("No contact method found")
221
225
        redirect(URL(f="index"))
222
226
 
223
 
    return eden.msg.msg_compose(redirect_module = module,
224
 
                                redirect_function = "compose",
225
 
                                redirect_vars = {fieldname: id},
226
 
                                title_name = title)
 
227
    # URL to redirect to after message sent
 
228
    url = URL(c=module,
 
229
              f="compose",
 
230
              vars={fieldname: id})
 
231
 
 
232
    # Create the form
 
233
    output = msg.compose(recipient = pe_id,
 
234
                         url = url)
 
235
    
 
236
    output["title"] = title
 
237
    response.view = "msg/compose.html"
 
238
    return output
227
239
 
228
240
# =============================================================================
229
241
# Components - no longer needed with new link-table support?