Bug Report: Issuing With Cron Invoices Does Not Work

Issuing With Cron Invoices Does Not Work

Issuing with CRON invoices does not work on the settings of the PL-PL region The problem will reach both settings: On Server Side (PHP) I also do not understand the message that is di

MM

Mateusz Mieszalski

Reported
Issuing with CRON invoices does not work on the settings of the PL-PL region

The problem will reach both settings:
On Server Side (PHP)

I also do not understand the message that is displayed all the time even on printed farms.
...
Recurring Invoice
The Will Be Automatically Generate New Invoice Every 6 Months (Semiannuly) system.
Cron job must be setup other invoice will be generated.
...

...
$ php82 artisan app:generate-invoice
...
...
Call to a member function subDays() on string

at app/Console/Commands/CreateRecurringInvoices.php:31
27▕ $query->whereNull('next_create_date')->orWhere('next_create_date', '<=', now()->format('Y-m-d'));
28▕ })->get()->filter(function ($recurring_invoice) {
29▕ $date = $recurring_invoice->last_created_at ? $recurring_invoice->last_created_at : $recurring_invoice->date;
30▕ if ($recurring_invoice->create_before) {
➜ 31▕ $date = $recurring_invoice->create_before == 1 ? $date->subDay() : $date->subDays($recurring_invoice->create_before);
32▕ }
33▕
34▕ if ($recurring_invoice->repeat) {
35▕ return $this->{$recurring_invoice->repeat}($date);

1 [internal]:0
App\Console\Commands\CreateRecurringInvoices::App\Console\Commands\{closure}(Object(App\Models\Invoice))
+2 vendor frames

4 app/Console/Commands/CreateRecurringInvoices.php:28
Illuminate\Support\Collection::filter(Object(Closure))
...
Attachments
  • MS

    Mian Saleem

    Answered
    Hello,

    The recurring alert is display on invoice that will be carted by system. This is for staff only.

    I have fixed the command and released update. Please download the file and update.

    Thank you
  • MM

    Mateusz Mieszalski

    Answered
    great, thank you, I'll check it and let you know
  • MM

    Mateusz Mieszalski

    Answered
    Well, not much has changed, now I can't execute the command, and the fireplace I had for the staff is still on PDF.
    Nothing happened, Cron didn't issue any invoices. and I set it for the next day for the test.
  • MM

    Mateusz Mieszalski

    Answered
    ...
    $ php82 artisan app:generate-invoice

    Carbon\Exceptions\InvalidFormatException

    Could not parse '8 paź 2024': Failed to parse time string (8 paź 2024) at position 0 (8): Unexpected character

    at vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:198
    194▕ }
    195▕ // @codeCoverageIgnoreEnd
    196▕
    197▕ if (!$date) {
    ➜ 198▕ throw new InvalidFormatException("Could not parse '$time': ".$exception->getMessage(), 0, $exception);
    199▕ }
    200▕
    201▕ return $date;
    202▕ }

    1 [internal]:0
    App\Console\Commands\CreateRecurringInvoices::App\Console\Commands\{closure}(Object(App\Models\Invoice))
    +1 vendor frames

    3 [internal]:0
    App\Console\Commands\CreateRecurringInvoices::App\Console\Commands\{closure}(Object(App\Models\Invoice))
    ...
  • MM

    Mateusz Mieszalski

    Answered
    the fix is ​​issued as I changed In Browser (Javascript). what will be the correct command for cron ?


    * * * * * cd /path-to-your-project && php82 artisan app:generate-invoice >> /dev/null 2>&1
  • MM

    Mateusz Mieszalski

    Answered
    Format and time zone, despite the PL_PL settings, I have invoices issued by the command from SSH for a test with 7:33 am and I sent around 09:00 in the morning.
  • MS

    Mian Saleem

    Answered
    Hello,

    I have fixed the cron job for non-english dates. For cron job please refer to the documentation.pdf in your download.

    Thank you
  • Login to Reply