Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| QuotationsSentDateFallback | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Console\Commands; |
| 4 | |
| 5 | use App\Services\QuotationSendRecorder; |
| 6 | use Illuminate\Console\Command; |
| 7 | |
| 8 | /** |
| 9 | * Safety net for sent_date: any quotation that is Sent but has no send on |
| 10 | * record gets sent_date = issue_date (see |
| 11 | * QuotationSendRecorder::fallbackToIssueDate). The quote form applies it on |
| 12 | * save; this catches the other writers (G3W/Cofrai syncs, bulk updates). |
| 13 | * |
| 14 | * php artisan quotations:sent-date-fallback |
| 15 | */ |
| 16 | class QuotationsSentDateFallback extends Command |
| 17 | { |
| 18 | protected $signature = 'quotations:sent-date-fallback'; |
| 19 | |
| 20 | protected $description = 'Set sent_date = issue_date on Sent quotations with no recorded send'; |
| 21 | |
| 22 | public function handle(): int |
| 23 | { |
| 24 | $updated = QuotationSendRecorder::fallbackToIssueDate(); |
| 25 | $this->info("{$updated} quotations got sent_date = issue_date."); |
| 26 | |
| 27 | return self::SUCCESS; |
| 28 | } |
| 29 | } |