Ignore:
Timestamp:
Dec 29, 2020, 11:11:12 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Modules dependencies evaluation.
  • Modified: Better installation/uninstallation of models in more modules.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Customer/Customer.php

    r887 r890  
    1111    $this->License = 'GNU/GPL';
    1212    $this->Description = 'Customer management';
    13     $this->Dependencies = array('User');
     13    $this->Dependencies = array('User', 'Finance');
    1414  }
    1515
     
    191191  }
    192192
     193  function DoInstall(): void
     194  {
     195    $this->InstallModel(Member::GetDesc());
     196    $this->InstallModel(MemberPayment::GetDesc());
     197    $this->InstallModel(SupportActivity::GetDesc());
     198    $this->InstallModel(ServiceCategory::GetDesc());
     199    $this->InstallModel(Service::GetDesc());
     200    $this->InstallModel(ServiceCustomerRel::GetDesc());
     201  }
     202
     203  function Uninstall(): void
     204  {
     205    $this->UninstallModel(ServiceCustomerRel::GetDesc());
     206    $this->UninstallModel(Service::GetDesc());
     207    $this->UninstallModel(ServiceCategory::GetDesc());
     208    $this->UninstallModel(SupportActivity::GetDesc());
     209    $this->UninstallModel(MemberPayment::GetDesc());
     210    $this->UninstallModel(Member::GetDesc());
     211  }
     212
    193213  function ShowDashboardItem(): string
    194214  {
     
    203223    return $Output;
    204224  }
    205 
    206 }
     225}
     226
     227class Member extends Model
     228{
     229  static function GetDesc(): ModelDesc
     230  {
     231    $Desc = new ModelDesc('Member');
     232    $Desc->AddString('Name');
     233    $Desc->AddReference('Subject', 'Subject');
     234    $Desc->AddReference('ResponsibleUser', 'User');
     235    $Desc->AddInteger('FamilyMemberCount');
     236    $Desc->AddDate('MembershipDate');
     237    $Desc->AddInteger('MemberState');
     238    $Desc->AddInteger('GPS');
     239    $Desc->AddReference('BillingPeriod', 'FinanceBillingPerios');
     240    $Desc->AddDate('BillingPeriodLastDate');
     241    $Desc->AddBoolean('Blocked');
     242    $Desc->AddInteger('PayDay');
     243    $Desc->AddChangeAction();
     244    return $Desc;
     245  }
     246}
     247
     248class MemberPayment extends Model
     249{
     250  static function GetDesc(): ModelDesc
     251  {
     252    $Desc = new ModelDesc('MemberPayment');
     253    $Desc->AddReference('Member', 'Member');
     254    $Desc->AddFloat('MonthlyTotal');
     255    $Desc->AddFloat('MonthlyInternet');
     256    $Desc->AddFloat('MonthlyConsumption');
     257    $Desc->AddFloat('MonthlyPlus');
     258    $Desc->AddFloat('Cash');
     259    return $Desc;
     260  }
     261}
     262
     263class Service extends Model
     264{
     265  static function GetDesc(): ModelDesc
     266  {
     267    $Desc = new ModelDesc('Service');
     268    $Desc->AddString('Name');
     269    $Desc->AddReference('Category', 'ServiceCategory');
     270    $Desc->AddInteger('Price');
     271    $Desc->AddInteger('VAT');
     272    $Desc->AddChangeAction();
     273    $Desc->AddBoolean('Public');
     274    $Desc->AddInteger('InternetSpeedMax');
     275    $Desc->AddInteger('InternetSpeedMin');
     276    $Desc->AddInteger('InternetUploadAsymmetry');
     277    $Desc->AddInteger('Memory');
     278    $Desc->AddInteger('MemorySwap');
     279    $Desc->AddInteger('Storage');
     280    $Desc->AddInteger('CPUCount');
     281    return $Desc;
     282  }
     283}
     284
     285class ServiceCategory extends Model
     286{
     287  static function GetDesc(): ModelDesc
     288  {
     289    $Desc = new ModelDesc('ServiceCategory');
     290    $Desc->AddString('Name');
     291    return $Desc;
     292  }
     293}
     294
     295class SupportActivity extends Model
     296{
     297  static function GetDesc(): ModelDesc
     298  {
     299    $Desc = new ModelDesc('SupportActivity');
     300    $Desc->AddDateTime('Time');
     301    $Desc->AddString('Description');
     302    $Desc->AddReference('Customer', 'Member');
     303    $Desc->AddReference('User', 'User');
     304    return $Desc;
     305  }
     306}
     307
     308class ServiceCustomerRel extends Model
     309{
     310  static function GetDesc(): ModelDesc
     311  {
     312    $Desc = new ModelDesc('ServiceCustomerRel');
     313    $Desc->AddReference('Service', 'Service');
     314    $Desc->AddReference('Customer', 'Member');
     315    $Desc->AddChangeAction();
     316    $Desc->AddInteger('SpeedLimit');
     317    return $Desc;
     318  }
     319}
Note: See TracChangeset for help on using the changeset viewer.