Jump to content

[SOLVED] more logic than anything


l0ve2hat3

Recommended Posts

I am designing a system that has "Tickets".  Someone submits a ticket and it get stored in the database blah blah blah...

 

I am trying to think of a way to handle recurring tickets. almost exactly like outlooks calendar.  But it doesnt make sense to prefill the database for every ticket in the future... that would be infinity...

 

Can someone help me out??

Link to comment
Share on other sites

It's been a half hour, which isn't much time at all.

On top of that, it's about 11PM on the west coast of the two Americas, and about 8AM in most European countries.

 

That means that most people are either in bed, or are just rolling out of bed.

So please, for the love of God... chill out, and don't bump your thread if you don't get the answer to a very complex problem while most of our users are asleep. Thank you.

Link to comment
Share on other sites

So please, for the love of God... chill out, and don't bump your thread if you don't get the answer to a very complex problem while most of our users are asleep.

 

Actually, don't bump at all unless you've shown some sort of progress or are able to provide additional information:

17. Users should not "bump" topics that are still on the first page of the forums. If you bump' date=' you [i']must[/i] provide additional information.
Link to comment
Share on other sites

I don't know what that has to do with tickets.  Tickets are just numbers issued for requests, such as support tickets.  What you've shown us is a recurring schedule.

 

Anyways the simplest way to store those in a database is:

id integer primary key

schedule text not null

last_run_tmz datetime null default null

next_run_tmz datetime null default null

created_tmz datetime not null

modified_tmz datetime not null

 

id should be self explanatory.  created_tmz and modified_tmz are just used to keep track of when the database record was created and / or last modified.

 

Instead of trying to create a database schema to match all of the possible things you can do with recurring schedules, just use a single text column called `schedule`.  Store a serialized PHP object that holds the scheduling information within it.

 

When you insert a record, insert the serialized object along with the date and time of the next time it should run (this goes in next_run_tmz.

 

Then you set up a cron job / scheduled task to run a php script that queries this table for all records where NOW()>=next_run_tmz.  The records returned will be the jobs that need to run.

 

Run the job, update the last_run_tmz to NOW() and update next_run_tmz to the next time it should run.

Link to comment
Share on other sites

bundyxc thank you for bumping the post :)

 

I guess tickets was the wrong word to use... its really a job management system where technicians go on jobs and the call center enters/schedules the "tickets" or "jobs"... But i really didnt want to get into detail because it didnt matter.

 

roopurt18

 

that seems perfect... although what if someone looks at the schedule in the future... that job has not been created by the cron yet...

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.