Usm utm5 EN: различия между версиями

Материал из WiKi - UserSide
Нет описания правки
Нет описания правки
 
(не показана 1 промежуточная версия этого же участника)
Строка 63: Строка 63:
   
   
  $billingDBHost      - address of the billing server
  $billingDBHost      - address of the billing server
  $billingDBUser      - user name for access to the billing database
  $billingDBUser      - customer name for access to the billing database
  $billingDBPassword  - password for access to the billing database
  $billingDBPassword  - password for access to the billing database
  $billingDBName      - billing database name
  $billingDBName      - billing database name
Строка 71: Строка 71:
  $confServiceData                        - use service mappings instead of tariff mappings (0 - service mappings, 1 - tariff mappings, 2 - both)
  $confServiceData                        - use service mappings instead of tariff mappings (0 - service mappings, 1 - tariff mappings, 2 - both)
  $confIsHideShablonsFromTariffList      - flag - do not include templates in tariff imports
  $confIsHideShablonsFromTariffList      - flag - do not include templates in tariff imports
  $confServiceDataServiceTypeRestrict    - import tariffs (and users) with such service_data.service_type
  $confServiceDataServiceTypeRestrict    - import tariffs (and customers) with such service_data.service_type
  $confRentId                            - ID of the field with user fee for the tariff (services_data.service_type in billing)
  $confRentId                            - ID of the field with customer fee for the tariff (services_data.service_type in billing)
  $confDontImportTariffWithComment        - do NOT import tariffs with this comment
  $confDontImportTariffWithComment        - do NOT import tariffs with this comment
  $confMultiplicationTariffFees          - multiplication factor for subscription fees in tariffs (1.20 - 20% VAT, etc.)
  $confMultiplicationTariffFees          - multiplication factor for subscription fees in tariffs (1.20 - 20% VAT, etc.)
   
   
  $confIsUseDateConnect                  - use users.connect_date field to get the date of connection to the network (0 - users.create_date, 1 - users.connect_date).
  $confIsUseDateConnect                  - use customers.connect_date field to get the date of connection to the network (0 - users.create_date, 1 - users.connect_date).
  $confIsCustomerConnectFix              - flag - add information about users' connection to switches to additional data
  $confIsCustomerConnectFix              - flag - add information about customers' connection to switches to additional data
  $confIsImportBankInformation            - flag - import user's bank details into the "Additional data" field
  $confIsImportBankInformation            - flag - import customer's bank details into the "Additional data" field
  $confDontImportCustomerFromGroupId      - flag - do not import users from this group (groups.id)
  $confDontImportCustomerFromGroupId      - flag - do not import customers from this group (groups.id)
  $confImportCustomerOnlyFromGroupId      - import users ONLY from this group (groups.id)
  $confImportCustomerOnlyFromGroupId      - import customers ONLY from this group (groups.id)
  $confImportCustomerExpr                - condition for importing users. It allows importing only a part of users from billing (executed before WHERE)
  $confImportCustomerExpr                - condition for importing customers. It allows importing only a part of customers from billing (executed before WHERE)
  $confImportCustomerExpr2                - condition for importing users. Allows importing only a part of users from the billing (executed after WHERE)
  $confImportCustomerExpr2                - condition for importing customers. Allows importing only a part of customers from the billing (executed after WHERE)
  $confTrafficRxClass                    - class of incoming traffic  
  $confTrafficRxClass                    - class of incoming traffic  
  $confTrafficTxClass                    - class of outgoing traffic (several comma separated)
  $confTrafficTxClass                    - class of outgoing traffic (several comma separated)
Строка 93: Строка 93:
  $confIsBlockType1IsPause                - flag - consider block_info.block_type #1 as PAUSE
  $confIsBlockType1IsPause                - flag - consider block_info.block_type #1 as PAUSE
  $confIsBlockType2IsStop                - flag - consider block_info.block_type #2 as STOP
  $confIsBlockType2IsStop                - flag - consider block_info.block_type #2 as STOP
  $confIsUseIdToAgreement                - use user ID as contract number
  $confIsUseIdToAgreement                - use customer ID as contract number
  $confIsSavePasswordToComment            - flag - save user's password from billing in the "additional data" field
  $confIsSavePasswordToComment            - flag - save customer's password from billing in the "additional data" field
  $confIsImportPaidHistory                - flag - import data on user payments (payment_transactions)
  $confIsImportPaidHistory                - flag - import data on customer payments (payment_transactions)
  $confVersionFramedIp                    - import type dhs_sessions_log.Framed_IP_Address [0|1]
  $confVersionFramedIp                    - import type dhs_sessions_log.Framed_IP_Address [0|1]
  $confIsImportHistoryTariff              - flag - import history of tariff changes by user
  $confIsImportHistoryTariff              - flag - import history of tariff changes by customer
  $confCustomerAccountSrc                - source of user account number [accounts.external_id|accounts.id|users.basic_account]
  $confCustomerAccountSrc                - source of customer account number [accounts.external_id|accounts.id|users.basic_account]
  $confImportCustomerUnlimited            - import "accounts.unlimited" field into UserSide ''(need to specify additional field id)''' additional data
  $confImportCustomerUnlimited            - import "accounts.unlimited" field into UserSide ''(need to specify additional field id)''' additional data
  $confImportCustomerPassport            - import passport data into additional data UserSide ''(need to specify additional field id)''
  $confImportCustomerPassport            - import passport data into additional data UserSide ''(need to specify additional field id)''
  $confIsDontUpdateDateConnect            - flag - do not import user's date of connection
  $confIsDontUpdateDateConnect            - flag - do not import customer's date of connection
  $confIsImportAdditionalServices        - flag - import additional services
  $confIsImportAdditionalServices        - flag - import additional services
  $confIsImportSwitchCommutation          - flag - import user's switching to equipment (routers_info table of billing)
  $confIsImportSwitchCommutation          - flag - import customer's switching to equipment (routers_info table of billing)
  $confIsImportSwitchTableCommutation    - flag - import user switching to equipment (billing switches table)
  $confIsImportSwitchTableCommutation    - flag - import customer switching to equipment (billing switches table)
  $confImportPaidLimit                    - limit on the number of imports at one time of user payments (default: 5000)
  $confImportPaidLimit                    - limit on the number of imports at one time of customer payments (default: 5000)
  $confIsImportLessPhone                  - flag - whether to import empty phone numbers of users (this allows to erase in UserSide the numbers that are no longer in billing)
  $confIsImportLessPhone                  - flag - whether to import empty phone numbers of customers (this allows to erase in UserSide the numbers that are no longer in billing)
  $confIsSaveVpnPasswordToComment        - flag - save vpn password in user's comments
  $confIsSaveVpnPasswordToComment        - flag - save vpn password in customer's comments
  $confAddressSrc                        - source of user's address (0 - users.house_id, 1 - users.actual_address)
  $confAddressSrc                        - source of customer's address (0 - users.house_id, 1 - users.actual_address)
  $confExprIpImport                      - condition for importing IP addresses
  $confExprIpImport                      - condition for importing IP addresses
  $lastPaidIdPlus                        - initial counter for importing payments
  $lastPaidIdPlus                        - initial counter for importing payments
  $confIsSkipCustomerBuilding            - flag - do not import building number for users
  $confIsSkipCustomerBuilding            - flag - do not import building number for customers
  $confImportPaidDisableMethod            - list of ignored payment methods in import
  $confImportPaidDisableMethod            - list of ignored payment methods in import
  $confIsSkipDhsSessionsLogTraffic        - flag - ignore traffic data from dhs_sessions_log table
  $confIsSkipDhsSessionsLogTraffic        - flag - ignore traffic data from dhs_sessions_log table
  $confIsImportServiceWithAddressAsAliasCustomer - flag - import service with address as child record of user
  $confIsImportServiceWithAddressAsAliasCustomer - flag - import service with address as child record of customer
  $confIsIgnoreHouseBlock                - flag - ignore house block
  $confIsIgnoreHouseBlock                - flag - ignore house block
  $confAdditionalFieldWithAgreementNumber - optional billing field with contract number
  $confAdditionalFieldWithAgreementNumber - optional billing field with contract number
Строка 120: Строка 120:
  $confImportCustomerAllowedCid          - import "User Allowed Cid" into additional data of UserSide ''(need to specify id of additional field)''
  $confImportCustomerAllowedCid          - import "User Allowed Cid" into additional data of UserSide ''(need to specify id of additional field)''
  $confImportCustomerPassword            - import subscriber's password into additional data of UserSide ''(need to specify additional field id)''
  $confImportCustomerPassword            - import subscriber's password into additional data of UserSide ''(need to specify additional field id)''
  $confAccountPattern                    - template when importing user account number ''(e.g.: 02000000)''
  $confAccountPattern                    - template when importing customer account number ''(e.g.: 02000000)''
  $confImportGateway                      - import user's gateway into UserSide additional data ''(need to specify id of additional field)''
  $confImportGateway                      - import customer's gateway into UserSide additional data ''(need to specify id of additional field)''
  $confImportMask                        - import user's mask into UserSide ''(need to specify additional field id)''
  $confImportMask                        - import customer's mask into UserSide ''(need to specify additional field id)''
  $confIsRegionAddressSystem              - flag - import regions/regions from billing address system ''(only when $confAddressSrc = 0)''
  $confIsRegionAddressSystem              - flag - import regions/regions from billing address system ''(only when $confAddressSrc = 0)''
  $confIsImportServiceLinksAsChild        - flag - import service links as child records of users''(only for UTM+)''
  $confIsImportServiceLinksAsChild        - flag - import service links as child records of customers''(only for UTM+)''
  $confIsImportWorkPhoneToPhone          - flag - import work phone as "normal" phone
  $confIsImportWorkPhoneToPhone          - flag - import work phone as "normal" phone
  $confImportCustomerUnlimited            - import unlimited fact into UserSide ''(need to specify id of additional field)''
  $confImportCustomerUnlimited            - import unlimited fact into UserSide ''(need to specify id of additional field)''
  $confImportCustomerVlanId              - import VlanID into additional data UserSide ''(need to specify additional field id)''
  $confImportCustomerVlanId              - import VlanID into additional data UserSide ''(need to specify additional field id)''
$confImportCustomerTaxNumber            - import tax number into additional data UserSide ''(need to specify additional field id)'''
   
   
  $confAddressRemoveStr1              - string #1 to replace in the text address
  $confAddressRemoveStr1              - string #1 to replace in the text address
Строка 133: Строка 134:
  $confAddressRemoveStr3              - string #3 to replace in text address
  $confAddressRemoveStr3              - string #3 to replace in text address
   
   
  // If it is necessary to import an internal IP address for a user when importing an external IP address - fill in the following parameters
  // If it is necessary to import an internal IP address for a customer when importing an external IP address - fill in the following parameters
  $confIpGrayNet                      - which IP address subnet to consider as external - e.g.: "172.16.0.0" or "0" - do not process it  
  $confIpGrayNet                      - which IP address subnet to consider as external - e.g.: "172.16.0.0" or "0" - do not process it  
  $confIpWhiteNet                    - which IP address subnet to add - e.g. "10.0.0.0.0" or "0" - do not add it
  $confIpWhiteNet                    - which IP address subnet to add - e.g. "10.0.0.0.0" or "0" - do not add it
   
   
  // You can configure additional marks on the user depending on the value of the additional field in billing
  // You can configure additional marks on the customer depending on the value of the additional field in billing
  $markMerge[6]['id']    = 1; - [utm5.uaddparams_desc.paramid]['id'] = userside.id
  $markMerge[6]['id']    = 1; - [utm5.uaddparams_desc.paramid]['id'] = userside.id
  $markMerge[6]['value']  = 'test_string'; - [utm5.uaddparams_desc.paramid]['value'] = Compare String
  $markMerge[6]['value']  = 'test_string'; - [utm5.uaddparams_desc.paramid]['value'] = Compare String
Строка 143: Строка 144:
  // It is possible to configure import of additional fields from billing to additional fields of ERP "UserSide" user (if necessary)
  // It is possible to configure import of additional fields from billing to additional fields of ERP "UserSide" user (if necessary)
  // The $additionalDataMerge array ''(for userside 3.13 and earlier)'' or $additionalCustomerDataMerge array ''(for userside 3.14 and later)'' is filled in. You can add your own fields. If the field code value is null - import is not performed
  // The $additionalDataMerge array ''(for userside 3.13 and earlier)'' or $additionalCustomerDataMerge array ''(for userside 3.14 and later)'' is filled in. You can add your own fields. If the field code value is null - import is not performed
  // Import is performed into already created additional fields. I.e. beforehand - this additional field must be created in UserSide for the user card
  // Import is performed into already created additional fields. I.e. beforehand - this additional field must be created in UserSide for the customer card
  $additionalCustomerDataMerge[1] = 1; - [utm5.uaddparams_desc.paramid] = userside.id
  $additionalCustomerDataMerge[1] = 1; - [utm5.uaddparams_desc.paramid] = userside.id
  $additionalCustomerDataMerge[2] = 2; - [utm5.uaddparams_desc.paramid] = userside.id
  $additionalCustomerDataMerge[2] = 2; - [utm5.uaddparams_desc.paramid] = userside.id

Текущая версия от 07:55, 1 апреля 2024

en | ru

This function is one of the possibilities
to update the activity date of an object

usm_utm5 - module to organise import of data from UTM5 billing system into ERP UserSide

This module is a replacement for the deprecated us_utm5 module - See: Switching from us utm5 to usm utm5

Module Language: PHP

Current version: See: Modules

Module Status: Paid

For more information and a list of imported data, see the page: UTM5

Information on installing the module

Make sure that the php_mysqli library is present on the system where the module will be running

The usm_utm5.zip archive contains the files

usm_utm5.php
usm_utm5.conf.php-example

1. On any server (no difference - billing server, userside or third machine) allocate a separate (arbitrary) directory for the module and place these files in it

2. Allocate a separate directory for the module logs. Give write permissions to this directory.

3. Rename the sample configuration file usm_utm5.conf.php-example to usm_utm5.conf.php and make the required changes (the list of parameters is given below) in it

4. Run the module manually several times (*) with the command

php usm_utm5.php

It should work without error and return the data:

usm_utm5
====================================
 Start module at 2015-11-22 17:32:03
Finish module at 2015-11-22 17:32:14
====================================

* - At the first run - many objects will be pre-created only. The more objects the module imports - the longer it will take. The second and subsequent runs will reconcile the changed data and only these will be updated. The second run will also take a long time, because after the first run the newly created objects do not contain any data. But the third and subsequent runs will run much faster.

5. Visually verify the completeness of the imported data in the ERP "UserSide"

6. When it is clear that the module works stably - add it to the system cron for periodic operation (specify the necessary paths).

*/10 * * * * php usm_utm5.php

Configuration parameters

The module is configured in the usm_utm5.conf.php file

You can also use the default parameters from the usm_billing module

$usersideUrl         - URL to the ERP "UserSide"
$usersideApiKey      - API-key of ERP "UserSide"
$billingId           - The billing number in ERP "UserSide" ("Settings - Billings")
$logPath             - Path for logging
$isSilence           - Silence Mode flag (hide the output of information messages from the module to the console)

$billingDBHost       - address of the billing server
$billingDBUser       - customer name for access to the billing database
$billingDBPassword   - password for access to the billing database
$billingDBName       - billing database name
$billingCodePage     - billing database encoding
$billingDbProvider   - DBMS type [mysql|postgresql] (default: mysql)
$confServiceData                        - use service mappings instead of tariff mappings (0 - service mappings, 1 - tariff mappings, 2 - both)
$confIsHideShablonsFromTariffList       - flag - do not include templates in tariff imports
$confServiceDataServiceTypeRestrict     - import tariffs (and customers) with such service_data.service_type
$confRentId                             - ID of the field with customer fee for the tariff (services_data.service_type in billing)
$confDontImportTariffWithComment        - do NOT import tariffs with this comment
$confMultiplicationTariffFees           - multiplication factor for subscription fees in tariffs (1.20 - 20% VAT, etc.)

$confIsUseDateConnect                   - use customers.connect_date field to get the date of connection to the network (0 - users.create_date, 1 - users.connect_date).
$confIsCustomerConnectFix               - flag - add information about customers' connection to switches to additional data
$confIsImportBankInformation            - flag - import customer's bank details into the "Additional data" field
$confDontImportCustomerFromGroupId      - flag - do not import customers from this group (groups.id)
$confImportCustomerOnlyFromGroupId      - import customers ONLY from this group (groups.id)
$confImportCustomerExpr                 - condition for importing customers. It allows importing only a part of customers from billing (executed before WHERE)
$confImportCustomerExpr2                - condition for importing customers. Allows importing only a part of customers from the billing (executed after WHERE)
$confTrafficRxClass                     - class of incoming traffic 
$confTrafficTxClass                     - class of outgoing traffic (several comma separated)
$confUseIpMethod                        - operation variant (it is recommended not to change it)
$confIsUseDhcpData                      - load DHCP data from the dhs_sessions_log table (0 - do not load, 2 - dhs_sessons_log)
$confDhcpServiceLinkId                  - service link ID from "dhs_sessions_log.Acct_Status_Type" (default: 3)
$confIsHostByteOrder                    - flag - host byte order in dhs_sessions_log.Framed_IP_Address (Relevant for UTM5 versions >=5.3 update 3. Don't switch it on if you don't know what it's about) 
$confIsActiveAllDhcp                    - flag - use current date for active dhs_sessions_log entries
$confIsDhcpLeasesLogUse                 - load DHCP data from dhcp_leases_log table (0 - do not load, 1 - load).
$confIsBlockType1IsPause                - flag - consider block_info.block_type #1 as PAUSE
$confIsBlockType2IsStop                 - flag - consider block_info.block_type #2 as STOP
$confIsUseIdToAgreement                 - use customer ID as contract number
$confIsSavePasswordToComment            - flag - save customer's password from billing in the "additional data" field
$confIsImportPaidHistory                - flag - import data on customer payments (payment_transactions)
$confVersionFramedIp                    - import type dhs_sessions_log.Framed_IP_Address [0|1]
$confIsImportHistoryTariff              - flag - import history of tariff changes by customer
$confCustomerAccountSrc                 - source of customer account number [accounts.external_id|accounts.id|users.basic_account]
$confImportCustomerUnlimited            - import "accounts.unlimited" field into UserSide (need to specify additional field id)' additional data
$confImportCustomerPassport             - import passport data into additional data UserSide (need to specify additional field id)
$confIsDontUpdateDateConnect            - flag - do not import customer's date of connection
$confIsImportAdditionalServices         - flag - import additional services
$confIsImportSwitchCommutation          - flag - import customer's switching to equipment (routers_info table of billing)
$confIsImportSwitchTableCommutation     - flag - import customer switching to equipment (billing switches table)
$confImportPaidLimit                    - limit on the number of imports at one time of customer payments (default: 5000)
$confIsImportLessPhone                  - flag - whether to import empty phone numbers of customers (this allows to erase in UserSide the numbers that are no longer in billing)
$confIsSaveVpnPasswordToComment         - flag - save vpn password in customer's comments
$confAddressSrc                         - source of customer's address (0 - users.house_id, 1 - users.actual_address)
$confExprIpImport                       - condition for importing IP addresses
$lastPaidIdPlus                         - initial counter for importing payments
$confIsSkipCustomerBuilding             - flag - do not import building number for customers
$confImportPaidDisableMethod            - list of ignored payment methods in import
$confIsSkipDhsSessionsLogTraffic        - flag - ignore traffic data from dhs_sessions_log table
$confIsImportServiceWithAddressAsAliasCustomer - flag - import service with address as child record of customer
$confIsIgnoreHouseBlock                 - flag - ignore house block
$confAdditionalFieldWithAgreementNumber - optional billing field with contract number
$confAdditionalFieldWithAgreementDate   - additional billing field with contract date
$confImportCustomerAllowedCid           - import "User Allowed Cid" into additional data of UserSide (need to specify id of additional field)
$confImportCustomerPassword             - import subscriber's password into additional data of UserSide (need to specify additional field id)
$confAccountPattern                     - template when importing customer account number (e.g.: 02000000)
$confImportGateway                      - import customer's gateway into UserSide additional data (need to specify id of additional field)
$confImportMask                         - import customer's mask into UserSide (need to specify additional field id)
$confIsRegionAddressSystem              - flag - import regions/regions from billing address system (only when $confAddressSrc = 0)
$confIsImportServiceLinksAsChild        - flag - import service links as child records of customers(only for UTM+)
$confIsImportWorkPhoneToPhone           - flag - import work phone as "normal" phone
$confImportCustomerUnlimited            - import unlimited fact into UserSide (need to specify id of additional field)
$confImportCustomerVlanId               - import VlanID into additional data UserSide (need to specify additional field id)
$confImportCustomerTaxNumber            - import tax number into additional data UserSide (need to specify additional field id)'

$confAddressRemoveStr1              - string #1 to replace in the text address
$confAddressRemoveStr2              - string #2 to replace in text address
$confAddressRemoveStr3              - string #3 to replace in text address

// If it is necessary to import an internal IP address for a customer when importing an external IP address - fill in the following parameters
$confIpGrayNet                      - which IP address subnet to consider as external - e.g.: "172.16.0.0" or "0" - do not process it 
$confIpWhiteNet                     - which IP address subnet to add - e.g. "10.0.0.0.0" or "0" - do not add it

// You can configure additional marks on the customer depending on the value of the additional field in billing
$markMerge[6]['id']     = 1; - [utm5.uaddparams_desc.paramid]['id'] = userside.id
$markMerge[6]['value']  = 'test_string'; - [utm5.uaddparams_desc.paramid]['value'] = Compare String

// It is possible to configure import of additional fields from billing to additional fields of ERP "UserSide" user (if necessary)
// The $additionalDataMerge array (for userside 3.13 and earlier) or $additionalCustomerDataMerge array (for userside 3.14 and later) is filled in. You can add your own fields. If the field code value is null - import is not performed
// Import is performed into already created additional fields. I.e. beforehand - this additional field must be created in UserSide for the customer card
$additionalCustomerDataMerge[1] = 1; - [utm5.uaddparams_desc.paramid] = userside.id
$additionalCustomerDataMerge[2] = 2; - [utm5.uaddparams_desc.paramid] = userside.id