Fix error 500 when cancelling and ordering broadband

This commit is contained in:
Deon George 2022-04-04 20:29:45 +10:00
parent 9659621ba0
commit ebf08ea414
4 changed files with 8 additions and 9 deletions

View File

@ -103,12 +103,12 @@ class OrderController extends Controller
// @todo Make this automatic // @todo Make this automatic
$so->site_id = config('site')->site_id; $so->site_id = config('site')->site_id;
$so->product_id = $request->input('product_id'); $so->product_id = $po->id;
$so->order_status = 'ORDER-SUBMIT'; $so->order_status = 'ORDER-SUBMIT';
$so->orderby_id = Auth::id(); $so->orderby_id = Auth::id();
$so->model = get_class($order); $so->model = $order ? get_class($order) : NULL;
if ($order->order_info) { if ($order && $order->order_info) {
$so->order_info = $order->order_info; $so->order_info = $order->order_info;
unset($order->order_info); unset($order->order_info);

View File

@ -17,7 +17,7 @@ final class Broadband extends Type implements ProductItem
protected $table = 'product_broadband'; protected $table = 'product_broadband';
// Information required during the order process // Information required during the order process
private array $order_attributes = [ protected array $order_attributes = [
'options.address'=>[ 'options.address'=>[
'request'=>'options.address', 'request'=>'options.address',
'key'=>'service_address', 'key'=>'service_address',

View File

@ -12,7 +12,7 @@ final class Voip extends Type implements ProductItem
{ {
protected $table = 'product_voip'; protected $table = 'product_voip';
protected $order_attributes = [ protected array $order_attributes = [
'options.phonenumber'=>[ 'options.phonenumber'=>[
'request'=>'options.phonenumber', 'request'=>'options.phonenumber',
'key'=>'service_number', 'key'=>'service_number',

View File

@ -18,6 +18,7 @@ use Leenooks\Carbon;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use App\Interfaces\IDs; use App\Interfaces\IDs;
use App\Traits\NextKey;
/** /**
* Class Service * Class Service
@ -38,7 +39,7 @@ use App\Interfaces\IDs;
// @todo All the methods/attributes in this file need to be checked. // @todo All the methods/attributes in this file need to be checked.
class Service extends Model implements IDs class Service extends Model implements IDs
{ {
use HasFactory; use HasFactory,NextKey;
const RECORD_ID = 'service'; const RECORD_ID = 'service';
public $incrementing = FALSE; public $incrementing = FALSE;
@ -786,7 +787,6 @@ class Service extends Model implements IDs
*/ */
public function getProductCategoryAttribute(): string public function getProductCategoryAttribute(): string
{ {
abort(500,'deprecated');
return $this->product->getProductTypeAttribute(); return $this->product->getProductTypeAttribute();
} }
@ -798,8 +798,7 @@ class Service extends Model implements IDs
*/ */
public function getProductNameAttribute(): string public function getProductNameAttribute(): string
{ {
abort(500,'deprecated'); return $this->product->getNameAttribute();
return $this->product->name($this->account->language);
} }
public function getRecurScheduleAttribute($value): int public function getRecurScheduleAttribute($value): int