src/models/Price.php
public function getUnitOptions()
    {
        $unitGroup = [
            'speed' => ['bps', 'kbps', 'mbps', 'gbps', 'tbps'],
            'size' => ['mb', 'mb10', 'mb100', 'gb', 'tb'],
        ];

        $availableUnitsByPriceType = [
            'overuse,ip_num' => ['items'],
            'overuse,support_time' => ['hour'],
            'overuse,backup_du' => $unitGroup['size'],
            'overuse,server_traf_max' => $unitGroup['size'],
            'overuse,server_traf95_max' => $unitGroup['speed'],
            'overuse,server_du' => $unitGroup['size'],
            'overuse,server_ssd' => $unitGroup['size'],
            'overuse,server_sata' => $unitGroup['size'],
            'overuse,backup_traf' => $unitGroup['size'],
            'overuse,domain_traf' => $unitGroup['size'],
            'overuse,domain_num' => ['items'],
            'overuse,ip_traf_max' => $unitGroup['size'],
            'overuse,account_traf' => $unitGroup['size'],
            'overuse,account_du' => $unitGroup['size'],
            'overuse,mail_num' => ['items'],
            'overuse,mail_du' => $unitGroup['size'],
            'overuse,db_num' => ['items'],
        ];

        $units = Ref::getList('type,unit', 'hipanel.finance.units', [
            'with_recursive' => 1,
            'select' => 'oname_label',
            'mapOptions' => ['from' => 'oname'],
        ]);

        $possibleTypes = $availableUnitsByPriceType[$this->type] ?? [];

        return array_intersect_key($units, array_combine($possibleTypes, $possibleTypes));
    }
public function getUnitOptions()
    {
        $unitGroup = [
            'speed' => ['bps', 'kbps', 'mbps', 'gbps', 'tbps'],
            'size' => ['mb', 'mb10', 'mb100', 'gb', 'tb'],
        ];

        $availableUnitsByPriceType = [
            'overuse,ip_num' => ['items'],
            'overuse,support_time' => ['hour'],
            'overuse,backup_du' => $unitGroup['size'],
            'overuse,server_traf_max' => $unitGroup['size'],
            'overuse,server_traf95_max' => $unitGroup['speed'],
            'overuse,server_du' => $unitGroup['size'],
            'overuse,server_ssd' => $unitGroup['size'],
            'overuse,server_sata' => $unitGroup['size'],
            'overuse,backup_traf' => $unitGroup['size'],
            'overuse,domain_traf' => $unitGroup['size'],
            'overuse,domain_num' => ['items'],
            'overuse,ip_traf_max' => $unitGroup['size'],
            'overuse,account_traf' => $unitGroup['size'],
            'overuse,account_du' => $unitGroup['size'],
            'overuse,mail_num' => ['items'],
            'overuse,mail_du' => $unitGroup['size'],
            'overuse,db_num' => ['items'],
        ];

        $units = Ref::getList('type,unit', 'hipanel.finance.units', [
            'with_recursive' => 1,
            'select' => 'oname_label',
            'mapOptions' => ['from' => 'oname'],
        ]);

        $possibleTypes = $availableUnitsByPriceType[$this->type] ?? [];

        return array_intersect_key($units, array_combine($possibleTypes, $possibleTypes));
    }
public function getUnitOptions ( ) { $ unitGroup = [ 'speed' => [ 'bps' , 'kbps' , 'mbps' , 'gbps' , 'tbps' ] , 'size' => [ 'mb' , 'mb10' , 'mb100' , 'gb' , 'tb' ] , ] ; $ availableUnitsByPriceType = [ 'overuse,ip_num' => [ 'items' ] , 'overuse,support_time' => [ 'hour' ] , 'overuse,backup_du' => $ unitGroup [ 'size' ] , 'overuse,server_traf_max' => $ unitGroup [ 'size' ] , 'overuse,server_traf95_max' => $ unitGroup [ 'speed' ] , 'overuse,server_du' => $ unitGroup [ 'size' ] , 'overuse,server_ssd' => $ unitGroup [ 'size' ] , 'overuse,server_sata' => $ unitGroup [ 'size' ] , 'overuse,backup_traf' => $ unitGroup [ 'size' ] , 'overuse,domain_traf' => $ unitGroup [ 'size' ] , 'overuse,domain_num' => [ 'items' ] , 'overuse,ip_traf_max' => $ unitGroup [ 'size' ] , 'overuse,account_traf' => $ unitGroup [ 'size' ] , 'overuse,account_du' => $ unitGroup [ 'size' ] , 'overuse,mail_num' => [ 'items' ] , 'overuse,mail_du' => $ unitGroup [ 'size' ] , 'overuse,db_num' => [ 'items' ] , ] ; $ units = Ref :: getList ( 'type,unit' , 'hipanel.finance.units' , [ 'with_recursive' => 1 , 'select' => 'oname_label' , 'mapOptions' => [ 'from' => 'oname' ] , ] ) ; $ possibleTypes = $ availableUnitsByPriceType [ $ this -> type ] ?? [ ] ; return array_intersect_key ( $ units , array_combine ( $ possibleTypes , $ possibleTypes ) ) ; }
Returns array of unit option, that are available for this price
depending on price type.

@return array
Returns array of unit option that are available for this price depending on price type .