def generate_email_body(template, loan_id, ill=0): """ Generate the body of an email for loan recalls. @param template: email template @type template: string @param loan_id: identify the loan. Primary key of crcLOAN. @type loan_id: int @return email(body) """ if ill: # Inter library loan. out = template else: recid = db.get_loan_recid(loan_id) (book_title, book_year, book_author, book_isbn, book_editor) = book_information_from_MARC(int(recid)) out = template % (book_title, book_year, book_author, book_isbn, book_editor) return out
def generate_email_body(template, loan_id, ill=0): """ Generate the body of an email for loan recalls. @param template: email template @type template: string @param loan_id: identify the loan. Primary key of crcLOAN. @type loan_id: int @return email(body) """ if ill: # Inter library loan. out = template else: recid = db.get_loan_recid(loan_id) (book_title, book_year, book_author, book_isbn, book_editor) = book_information_from_MARC(int(recid)) due_date = db.get_due_date(loan_id) lib_id = db.get_library_for_loan(loan_id) library_details = db.get_library_details(lib_id) (library_id, name, address, email, phone, lib_type, notes) = library_details out = template % (book_title, book_year, book_author, book_isbn, book_editor, due_date, name, name, phone, email) return out