Rushabh Mehta | 3966f1d | 2012-02-23 12:35:32 +0530 | [diff] [blame] | 1 | # ERPNext - web based ERP (http://erpnext.com) |
| 2 | # Copyright (C) 2012 Web Notes Technologies Pvt Ltd |
| 3 | # |
| 4 | # This program is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU General Public License as published by |
| 6 | # the Free Software Foundation, either version 3 of the License, or |
| 7 | # (at your option) any later version. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 17 | """will be called by scheduler""" |
| 18 | |
| 19 | import webnotes |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 20 | from webnotes.utils import scheduler |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 21 | |
| 22 | def execute_all(): |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 23 | """ |
| 24 | * get support email |
| 25 | * recurring invoice |
| 26 | """ |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 27 | # pull emails |
| 28 | from support.doctype.support_ticket import get_support_mails |
| 29 | run_fn(get_support_mails) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 30 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 31 | # run recurring invoices |
| 32 | from accounts.doctype.gl_control.gl_control import manage_recurring_invoices |
| 33 | run_fn(manage_recurring_invoices) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 34 | |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 35 | # bulk email |
| 36 | from webnotes.utils.email_lib.bulk import flush |
| 37 | run_fn(flush) |
Rushabh Mehta | 1a35574 | 2012-02-23 11:46:28 +0530 | [diff] [blame] | 38 | |
| 39 | def execute_daily(): |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 40 | # email digest |
| 41 | from setup.doctype.email_digest.email_digest import send |
| 42 | run_fn(send) |
| 43 | |
| 44 | # send bulk emails |
Rushabh Mehta | 52006ca | 2012-08-03 14:15:25 +0530 | [diff] [blame] | 45 | from webnotes.utils.email_lib.bulk import clear_outbox |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 46 | run_fn(clear_outbox) |
Anand Doshi | f9e4b16 | 2012-02-28 11:31:46 +0530 | [diff] [blame] | 47 | |
| 48 | def execute_weekly(): |
| 49 | pass |
| 50 | |
| 51 | def execute_monthly(): |
| 52 | pass |
| 53 | |
| 54 | def execute_hourly(): |
| 55 | pass |
Rushabh Mehta | f0018b5 | 2012-08-02 18:03:12 +0530 | [diff] [blame] | 56 | |
| 57 | def run_fn(fn): |
| 58 | try: |
| 59 | fn() |
| 60 | except Exception, e: |
| 61 | scheduler.log(fn.func_name) |