Fix broadband traffic import, when new services cannot be found. Fix broadband update so that start_at = connect_at

This commit is contained in:
Deon George
2022-09-29 11:22:16 +10:00
parent 5b4aa5c73e
commit 1667b8c1df
2 changed files with 14 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -391,6 +392,7 @@ class ServiceController extends Controller
* @param Request $request
* @param Service $o
* @return RedirectResponse
* @throws ValidationException
*/
public function update(Request $request,Service $o)
{
@@ -418,8 +420,17 @@ class ServiceController extends Controller
$o->invoice_next_at = $request->invoice_next_at;
// Also update our service start_at date.
// @todo We may want to make start_at/stop_at dynamic values calculated by the type records
if ($request->post('start_at'))
$o->start_at = $request->start_at;
else {
// For broadband, start_at is connect_at in the type record
switch ($o->category) {
case 'broadband':
$o->start_at = $o->type->connect_at;
break;
}
}
$o->save();