Start work on updating services
This commit is contained in:
@@ -33,7 +33,7 @@ class ServiceList extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$header = '|%13s|%-10s|%-35s|%-40s|%8s|%10s|%15s|%10s|%10s|%12s|%14s|';
|
||||
$header = '|%13s|%-14s|%-35s|%-40s|%8s|%17s|%12s|%12s|%12s|%12s|%14s|';
|
||||
|
||||
$this->warn(sprintf($header,
|
||||
'ID',
|
||||
@@ -58,24 +58,24 @@ class ServiceList extends Command
|
||||
if ($this->option('type') AND ($o->product->getProductTypeAttribute() !== $this->option('type')))
|
||||
continue;
|
||||
|
||||
$c = $o->invoice_items->filter(function($item) {return $item->item_type === 0; })->sortby('date_start')->first();
|
||||
$c = $o->invoice_items->filter(function($item) {return $item->item_type === 0; })->sortby('start_at')->first();
|
||||
|
||||
if ($this->option('fix') AND ! $o->date_start AND $c AND $c->date_start AND $o->type AND $o->type->service_connect_date AND $c->date_start->format('Y-m-d') == $o->type->service_connect_date->format('Y-m-d')) {
|
||||
$o->date_start = $o->type->service_connect_date;
|
||||
if ($this->option('fix') AND ! $o->start_at AND $c AND $c->start_at AND $o->type AND $o->type->connect_at AND $c->start_at->format('Y-m-d') == $o->type->connect_at->format('Y-m-d')) {
|
||||
$o->start_at = $o->type->connect_at;
|
||||
$o->save();
|
||||
}
|
||||
|
||||
$this->info(sprintf($header,
|
||||
$o->sid,
|
||||
$o->product->getProductTypeAttribute(),
|
||||
$o->product->getNameAttribute(),
|
||||
$o->name_short,
|
||||
substr($o->product->getNameAttribute(),0,35),
|
||||
substr($o->name_short,0,40),
|
||||
$o->active ? 'active' : 'inactive',
|
||||
$o->status,
|
||||
$o->invoice_next ? $o->invoice_next->format('Y-m-d') : NULL,
|
||||
$o->date_start ? $o->date_start->format('Y-m-d') : NULL,
|
||||
$o->date_end ? $o->date_end->format('Y-m-d') : NULL,
|
||||
($o->type AND $o->type->service_connect_date) ? $o->type->service_connect_date->format('Y-m-d') : NULL,
|
||||
$o->start_at ? $o->start_at->format('Y-m-d') : NULL,
|
||||
$o->stop_at ? $o->stop_at->format('Y-m-d') : NULL,
|
||||
($o->type AND $o->type->connect_at) ? $o->type->connect_at->format('Y-m-d') : NULL,
|
||||
($c && $c->date_start) ? $c->date_start->format('Y-m-d') : NULL,
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user