Suggestions for making a task scheduler
Posted: Tue Dec 18, 2012 8:09 pm
Hi
I need to make something like a task scheduler in my nuBuilder project.
I have some cars and I need to make a planning for maintenance.
So I created a subform that refers to a table with these columns: car_id, date, maintenance type (oil, tyres, etc.) and a boolean field, default '0', that becomes '1' when the maintenance is done.
But since I need to do maintenance every year, I'm searching for a function that inserts a new task with same values but date increased by one year when the previous task is done.
I tried to create a button on subform to do this, but I think it's not possible to run a sql query from JavaScript to insert a new row in the maintenance table.
Neither I know a way to run PHP from a button.
Other possibilities are:
1) Populate the field directly on subform in javascript, then save the record, but I don't know how insert a new subform row from javascript.
2) Use a PHP procedure (Add Activity) to insert new row directly into the database (nuRunQuery), but it seems too intricate and it opens a new blank window... comfortless!
3) Implement a cron job that does the task each year at 1st january.
Any suggestions?
Thank you
Alex
I need to make something like a task scheduler in my nuBuilder project.
I have some cars and I need to make a planning for maintenance.
So I created a subform that refers to a table with these columns: car_id, date, maintenance type (oil, tyres, etc.) and a boolean field, default '0', that becomes '1' when the maintenance is done.
But since I need to do maintenance every year, I'm searching for a function that inserts a new task with same values but date increased by one year when the previous task is done.
I tried to create a button on subform to do this, but I think it's not possible to run a sql query from JavaScript to insert a new row in the maintenance table.
Neither I know a way to run PHP from a button.
Other possibilities are:
1) Populate the field directly on subform in javascript, then save the record, but I don't know how insert a new subform row from javascript.
2) Use a PHP procedure (Add Activity) to insert new row directly into the database (nuRunQuery), but it seems too intricate and it opens a new blank window... comfortless!
3) Implement a cron job that does the task each year at 1st january.
Any suggestions?
Thank you
Alex