SimpleInvoices Group Forum › Forums › Fearless359 SimpleInvoices Discussion Group › Recurring invoices
Tagged: recurring invoices
- This topic has 7 replies, 2 voices, and was last updated 3 years, 10 months ago by RRowley.
-
AuthorPosts
-
January 11, 2021 at 11:50 am #1310jorgeParticipant
First of all, thank you for your efforts to keep this software alive. It’s a great job.
I have recently updated to 2019 version (because I can’t install php 7,4 in my server) from a very old version and finally I’ve made nearly everything work (I had problems with Spanish accents in names in the manage tables script, btw).
Then, my question now is that I want to establish a recurring invoice but when cron runs is gives me an error:
<array> <cron_message>Cron started</cron_message> <cron_message_2>Cron ID: 2 - Cron for Factura 20098 with start date of 2021-01-10 and no end date that runs each 1 day, was run today :: Info diff=1</cron_message_2> <email_message>One or more required fields is missing</email_message> </array>
It seems as it was looking somewhere for the e-mail body content. Is it? In that case, Where can I set the e-mail body for a recurring invoice? Also, do the recurring invoices generate a new “normal” invoice with it’s new invoice number and dates?
I have tested the email with pdf attach delivery and it works. What it doesn’t is the recurring one.ç
January 12, 2021 at 7:28 am #1311RRowleyParticipantThe email body is automatically set by the code. I don’t think that is the problem. However, I don’t know which field is empty. I’ve made a modified version of the Email.php file that will put info in the tmp/log/php.log (aka error log) file indicating which email field is empty.
Extract the Email.php file from the zip file and save it in your Inc/Claz folder over the version that is there. If you run cron, you can see what it puts in the error log and let me know.
Attachments:
January 12, 2021 at 10:02 am #1313jorgeParticipantHmmm, it looks like there is something more.
I have tried to create a new invoice to do the recurring, as I realized that I had done the testing with an imported one, but it doesn’t work.
So I’m going to see what else is going on and I’ll keep you updated. Thanks.January 12, 2021 at 11:37 am #1314jorgeParticipantThis is what the logs are saying:
[12-Jan-2021 20:09:13 Europe/Madrid] PHP Notice: Undefined index: tax_id in /var/www/vhosts/mydomain.es/httpdocs/fact2/Inc/Claz/Invoice.php on line 1344 [12-Jan-2021 20:09:13 Europe/Madrid] PHP Warning: explode() expects parameter 2 to be string, array given in /var/www/vhosts/mydomain.es/httpdocs/fact2/Inc/Claz/Email.php on line 424 [12-Jan-2021 20:09:13 Europe/Madrid] PHP Warning: array_filter() expects parameter 1 to be array, null given in /var/www/vhosts/mydomain.es/httpdocs/fact2/Inc/Claz/Email.php on line 424 [12-Jan-2021 20:09:13 Europe/Madrid] PHP Notice: Array to string conversion in /var/www/vhosts/mydomain.es/httpdocs/fact2/Inc/Claz/Email.php on line 435 [12-Jan-2021 20:09:13 Europe/Madrid] Email::setTo() - Invalid TO address[Array] [12-Jan-2021 20:09:13 Europe/Madrid] to is empty [12-Jan-2021 20:09:13 Europe/Madrid] Email::send() - One or more required fields is missing
the “To” field should not be empty, as there is an e-mail in the e-mail field of the client. My mail has a “.es” domain (Not sure if could be related).
January 13, 2021 at 9:47 am #1315RRowleyParticipantThe “to” field is set to the customer and/or the biller email depending on the option to send to either one or both in the recurrence record.
The error for the tax_id field is a bug in the code. I’ve attached new Email.zip file that contains updated Email.php and Invoice.php files. The first removes the debug statements I added in the previous change, but the Invoice.php contains a fix for the tax_id issue. Extract both of these to the Inc/Claz directory.
At this point, I’m not able to test that changes, so I ask that you do and let me know the result so I can hopefully at them to the next version of 2019.2
- This reply was modified 3 years, 11 months ago by RRowley.
Attachments:
January 19, 2021 at 5:03 am #1322jorgeParticipantHello, I managed to make it work:
In Inc/Claz/Email.php
function setTo($to)
is assuming that $to is a string, but it has already been converted to array in previous function at Cron.php (getEmailSendAddresses).
To make it work I added $to = implode(“;”, $to); to the begining of setTo function:
public function setTo($to) { $to = implode(";", $to);
January 19, 2021 at 11:39 am #1323jorgeParticipantI’ve made another fix, as this led to break the “normal” invoice e-mail functionality. So now I check that the $to variable is an array before converting it:
public function setTo($to) { if (is_array ($to)){ $to = implode(";", $to); } ...
February 2, 2021 at 6:55 pm #1333RRowleyParticipantSorry it took so long. I had to complete work I was doing on master_2020 to get back to master_2019.2. Anyway, I’ve attached a zip file with three files that go in your Inc/Claz directory. I took a different approach than you did but I believe it implements the changes needed. If you could test this and let me know how it works.
Attachments:
-
AuthorPosts
- You must be logged in to reply to this topic.
Recent Comments