We found that they are some scripts useful - email_expire_services_to_representatives.php
Can we can use it in scheduled jobs?
We found that they are some scripts useful - email_expire_services_to_representatives.php
Can we can use it in scheduled jobs?
Hello,
I see no reason why you could not.
Regards,
Marc
Hello Marc.
Is it possible to be more specific āstep by stepā how to add scheduled job for script email_expire_services_to_customers.php ?
Thanks in advance,
George
Hi Georges,
This will depend on your environment. Under linux (preferred), you will add a task in the crontab, something like :
0 8 * * * apache /home/dolibarr/scripts/contracts/email_expire_services_to_customers.php test contacts
Replace the ā/home/dolibarr
ā with the path to your installation and apache
by the user that runs php in your website. Then, look at the script for proper options (you probably want to replace test
by confirm
and specify dates). And look at cron manual for adequate perodicity. The example above will run everyday at 8am.
On windows, you have to define a scheduled task, I am not familiar with that but it would work the same way.
Hope this helps,
Kind regards,
Marc
Hello Marc.
Still I canāt make it work.
I have a hosting on PLESK panel (under Linux).
I have added crontab https://prntscr.com/1qevxj0 to run every 5 minutes. Also replaced the ā/home/dolibarrā with the path of my installation(/var/www/vhosts/scripts/contracts/email_expire_services_to_customers.php) and apache by the user (/opt/plesk/php/7.4/bin/php)
Command
/opt/plesk/php/7.4/bin/php /var/www/vhosts/scripts/contracts/email_expire_services_to_customers.php
I donāt understand the third part to look at the script for proper options āyou probably want to replace test
by confirm
and specify datesā .
Iām sorry if Iām hard to understand. Iām completely newbie to Dolibarr.
Thanks in advance.
George
Hi Georges,
On top of the script, you find these drivers :
print "Usage: $script_file (test|confirm) (thirdparties|contacts) [delay] [after]\n";
print "\n";
print "Send an email to customers to remind all contracts services to expire or expired.\n";
print "If you choose 'test' mode, no emails are sent.\n";
print "If you add param delay (nb of days), only services with expired date < today + delay are i
ncluded.\n";
print "If you add param after (nb of days), only services with expired date >= today + delay are
included.\n";
This may help adjust the command line parameters.
Could you be more explicit on āit daesānt workā => error messages, screenshots, logfile excerpts, whatever may helpā¦
Regards,
Marc
Hi Marc.
Well, I feel like something is missing in the whole process.
I have Dolibarr ver. 14.0.0 and the installation is in httpdocs folder. The āscriptsā folder is outside of it.
I have not specified anywhere in Dolibarr where is located āscriptsā folder.
How is it referenced to the data?
When I said, āStill I canāt make it work.ā I meant that cronjob that I specify returned me an error(Screenshot by Lightshot) .
I thought it would be almost the same process as setting up Scheduled Jobs from Admins Tools with a URL that check and launch qualified cron jobs from a browser.
Thanks.
Regards,
George
Looks like you havenāt specified 2 mandatory arguments, that is
Regards
Marc
Hi Marc.
I really appreciate your help. Thank you.
I just fixed it with the below command:
/opt/plesk/php/7.4/bin/php /var/www/vhosts/scripts/domain/contracts/email_expire_services_to_customers.php confirm thirdparties
and Ī also had error on file āemail_expire_services_to_customers.phpā line 55 on required path.
require $path."ā¦/ā¦/htdocs/master.inc.php";
I would like to ask you if is there a possibility to send notification emails 30, 15, 7 and 2 days before the end of the service as well as if there is a possibility to record it on event reports.
Thanks in advance.
Regards,
George
Hello @simicar
Is it possible, when the script(contracts/email_expire_services_to_customers.php) is executing, to record it on agenda event reports in order to display it on Third party notifications tab (List of all automatic email notifications sent)?
Thanks in advance
Regards
George
Hi George,
For this you will have to extend the script to add the action event definitions, as is done in htdocs/core/actions_sendmails.inc.php, and call the trigger CONTRACT_SENTBYMAIL that should do the job.
Regards,
Marc
hi,
i am using dolibarr 19.0.1 in windows environment.
can anybody help me to setup the script that will send emails automatically when a contract is going to be expired.
thanks in advance.
hi,
i tried it and is functioning in windows environment.
i would like to know how to add parameter that i want to send the email 30 days before the expiry date of the contract.
thanks
Hi can you please let me know the steps and how to do it in windows environment. The parameters and fields
Thanks
hi
make a batch file with command like
@echo off
D:\dolibarr\bin\php\php7.3.33\phpD:/dolibarr/www/dolibarr/scripts/contracts/email_expire_services_to_customers.php test thirdparties
exit
save the batch file and execute.
it will run the script.
you can also add this batch file in windows > task scheduler
Thanks for the reply