Boat Drinks  

Go Back   Boat Drinks > General > Computer and Consoles

Reply
 
Thread Tools Display Modes
Old 11-11-2011, 11:33   #1
Desmo
The Last Airbender
 
Desmo's Avatar
 
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
Default Cron job to change database entry?

Hi clever programmer types

I'm setting up some software at work to make our workflow a little smoother, quicker and more automated. I'm using vtiger open source software to do this.

I've currently got a workflow setup so that when an "Email Supplier" tickbox is true, that supplier is emailed the quote. Trouble is, the supplier gets emailed every time the quote is modified and saved. This workflow is run with a cron jon.

What I'd like to do is have the "Email Supplier" tickbox set to false each time the cron job is run. I've found the entry in the sql database but not sure what to do next.
__________________
Desmo is offline   Reply With Quote
Old 11-11-2011, 11:41   #2
leowyatt
Chef extraordinaire
 
leowyatt's Avatar
 
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
Default

I would write a php script to loop through the database and set the field to false
__________________
"Dr Sheldon Cooper FTW!"
leowyatt is offline   Reply With Quote
Old 11-11-2011, 12:10   #3
Desmo
The Last Airbender
 
Desmo's Avatar
 
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
Default

Great....so how would I do that?
__________________
Desmo is offline   Reply With Quote
Old 11-11-2011, 12:14   #4
leowyatt
Chef extraordinaire
 
leowyatt's Avatar
 
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
Default

to MSN!

__________________
"Dr Sheldon Cooper FTW!"
leowyatt is offline   Reply With Quote
Old 12-11-2011, 00:52   #5
Mark
Screaming Orgasm
 
Join Date: Jul 2006
Location: Newbury
Posts: 15,194
Default

Kapow?

No need for a loop for this by the way - a single update would do it, which you can do just about any way you want.
Mark is offline   Reply With Quote
Old 12-11-2011, 21:04   #6
Garp
Preparing more tumbleweed
 
Garp's Avatar
 
Join Date: Jun 2006
Location: Hawaii
Posts: 6,038
Default

As Mark suggests, should be as simple as running something like:

UPDATE table SET field = FALSE WHERE somecondition=something;

If you're just trying to do the entire table you can ignore everything from WHERE (but don't forget the ';' mark)
__________________
Mal: Define "interesting"?
Wash: "Oh, God, oh, God, we're all gonna die"?
Garp is offline   Reply With Quote
Old 13-11-2011, 13:11   #7
leowyatt
Chef extraordinaire
 
leowyatt's Avatar
 
Join Date: Jul 2006
Location: Infinite Loop
Posts: 11,143
Default

I think we've almost cracked it I suggested a loop because I didn't know his db structure
__________________
"Dr Sheldon Cooper FTW!"
leowyatt is offline   Reply With Quote
Old 13-11-2011, 16:23   #8
Blighter
Dubious
 
Blighter's Avatar
 
Join Date: Sep 2008
Location: Northampton
Posts: 1,571
Default

Quote:
Originally Posted by leowyatt View Post
to MSN!

That cracked me up
__________________
Look at your signature, now back to mine, now back to yours, now back to mine.
Sadly, yours isn't mine.
But if you stopped writing about other things and made this your signature, yours could be like mine.
Look down, back up. Where are you?
You're on Boat Drinks, reading the signature your signature could be like.
I'm on a computer.
Blighter is offline   Reply With Quote
Old 19-11-2011, 12:26   #9
Desmo
The Last Airbender
 
Desmo's Avatar
 
Join Date: Jun 2006
Location: Pigmopad
Posts: 11,915
Default

Just thought I'd post up that with loads of help from Leo, I got all of this working spot on
The database changes work and it's also tied in to the current corn job so runs when it should.
__________________
Desmo is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 00:18.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.