blob: 2df7a5789d2506fb6701b0c8819fd8c628e00130 [file] [log] [blame]
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05301# 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 Mehta1a355742012-02-23 11:46:28 +053017"""will be called by scheduler"""
18
19import webnotes
Anand Doshif9e4b162012-02-28 11:31:46 +053020from webnotes.utils import scheduler
Rushabh Mehta1a355742012-02-23 11:46:28 +053021
22def execute_all():
Anand Doshif9e4b162012-02-28 11:31:46 +053023 """
24 * get support email
25 * recurring invoice
26 """
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053027 # pull emails
28 from support.doctype.support_ticket import get_support_mails
29 run_fn(get_support_mails)
Anand Doshif9e4b162012-02-28 11:31:46 +053030
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053031 # run recurring invoices
32 from accounts.doctype.gl_control.gl_control import manage_recurring_invoices
33 run_fn(manage_recurring_invoices)
Anand Doshif9e4b162012-02-28 11:31:46 +053034
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053035 # bulk email
36 from webnotes.utils.email_lib.bulk import flush
37 run_fn(flush)
Rushabh Mehta1a355742012-02-23 11:46:28 +053038
39def execute_daily():
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053040 # email digest
41 from setup.doctype.email_digest.email_digest import send
42 run_fn(send)
43
44 # send bulk emails
Rushabh Mehta52006ca2012-08-03 14:15:25 +053045 from webnotes.utils.email_lib.bulk import clear_outbox
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053046 run_fn(clear_outbox)
Anand Doshif9e4b162012-02-28 11:31:46 +053047
48def execute_weekly():
49 pass
50
51def execute_monthly():
52 pass
53
54def execute_hourly():
55 pass
Rushabh Mehtaf0018b52012-08-02 18:03:12 +053056
57def run_fn(fn):
58 try:
59 fn()
60 except Exception, e:
61 scheduler.log(fn.func_name)