Ignore:
Timestamp:
May 3, 2021, 9:48:26 PM (4 years ago)
Author:
chronos
Message:
  • Added: Support for customer address places.
  • Added: Limit direct traffic to router.
File:
1 edited

Legend:

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

    r908 r909  
    1313    $this->Dependencies = array(ModuleUser::GetName(), ModuleFinance::GetName());
    1414    $this->Models = array(Member::GetClassName(), MemberPayment::GetClassName(), SupportActivity::GetClassName(), ServiceCategory::GetClassName(),
    15       Service::GetClassName(), ServiceCustomerRel::GetClassName(), UserCustomerRel::GetClassName());
     15      Service::GetClassName(), ServiceCustomerRel::GetClassName(), UserCustomerRel::GetClassName(), AddressPlace::GetClassName());
    1616  }
    1717
     
    2626        'ResponsibleUser' => array('Type' => 'TUser', 'Caption' => 'Zodpovědný uživatel', 'Default' => ''),
    2727        'Subject' => array('Type' => 'TSubject', 'Caption' => 'Subjekt', 'Default' => ''),
     28        'AddressPlace' => array('Type' => 'TAddressPlace', 'Caption' => 'Adresní místo', 'Default' => '', 'Null' => true),
    2829        'FamilyMemberCount' => array('Type' => 'String', 'Caption' => 'Bydlících osob', 'Default' => '0', 'Suffix' => 'osob'),
    2930        'MembershipDate' => array('Type' => 'Date', 'Caption' => 'Datum členství', 'Default' => ''),
     
    115116      ),
    116117    ));
     118    $this->System->FormManager->RegisterClass('AddressPlace', array(
     119      'Title' => 'Adresní místno',
     120      'Table' => 'AddressPlace',
     121      'DefaultSortColumn' => 'HouseNumber',
     122      'DefaultSortOrder' => 1,
     123      'Items' => array(
     124        'Town' => array('Type' => 'String', 'Caption' => 'Město', 'Default' => ''),
     125        'Street' => array('Type' => 'String', 'Caption' => 'Ulice', 'Default' => ''),
     126        'HouseNumber' => array('Type' => 'Integer', 'Caption' => 'Číslo domu', 'Default' => ''),
     127        'HouseNumberType' => array('Type' => 'THouseNumberType', 'Caption' => 'Typ čísla', 'Default' => ''),
     128        'Psc' => array('Type' => 'Integer', 'Caption' => 'PSČ', 'Default' => ''),
     129        'RuianCode' => array('Type' => 'Integer', 'Caption' => 'Kód Ruian', 'Default' => ''),
     130        'Customers' => array('Type' => 'TCustomerListAddressPlace', 'Caption' => 'Zákazníci', 'Default' => '', 'Null' => true, 'NotInList' => true),
     131      ),
     132    ));
     133    $this->System->FormManager->RegisterFormType('TAddressPlace', array(
     134      'Type' => 'Reference',
     135      'Table' => 'AddressPlace',
     136      'Id' => 'Id',
     137      'Name' => 'CONCAT_WS(" ", NULLIF(AddressPlace.Town, ""), REPLACE(REPLACE(AddressPlace.HouseNumberType, "0", ""), 1, "e.v."), NULLIF(AddressPlace.HouseNumber, ""))',
     138      'Filter' => '1',
     139    ));
     140    $this->System->FormManager->RegisterFormType('THouseNumberType', array(
     141      'Type' => 'Enumeration',
     142      'States' => array(0 => 'Popisné', 1 => 'Evidenční'),
     143    ));
     144    $this->System->FormManager->RegisterFormType('TCustomerListAddressPlace', array(
     145      'Type' => 'ManyToOne',
     146      'Table' => 'Member',
     147      'Id' => 'Id',
     148      'Ref' => 'AddressPlace',
     149      'Filter' => '1',
     150    ));
    117151    $this->System->FormManager->RegisterFormType('TServiceCategory', array(
    118152      'Type' => 'Reference',
     
    387421  }
    388422}
     423
     424class AddressPlace extends Model
     425{
     426  static function GetModelDesc(): ModelDesc
     427  {
     428    $Desc = new ModelDesc(self::GetClassName());
     429    $Desc->AddString('Town');
     430    $Desc->AddString('Street');
     431    $Desc->AddString('HouseNumber');
     432    $Desc->AddEnum('HouseNumberType', array('Popisné', 'Evidenční'));
     433    $Desc->AddString('Psc');
     434    $Desc->AddInteger('RuianCode');
     435    return $Desc;
     436  }
     437}
Note: See TracChangeset for help on using the changeset viewer.