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

Материал из WiKi - UserSide
(Новая страница: «en | ru {{ActivEN}}»)
 
Нет описания правки
Строка 2: Строка 2:


{{ActivEN}}
{{ActivEN}}
'''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_EN|us_utm5]] module''' - See: [[Switching from us utm5 to usm utm5]]'''
'''Module Language:''' PHP
'''Current version:''' See: [[Modules_EN|Modules]]
'''Module Status:''' [https://www.userside.eu/en/pricing Paid]
For more information and a list of imported data, see the page: [[UTM5_EN|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_EN#Configuration Parameters|usm_billing]] module
$usersideUrl - URL to the ERP "UserSide"
$usersideApiKey - [[UserSide API Key_EN|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 - user name for access to the billing database
$billingDBPassword - password for access to the billing database
$billingDBBName - 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 users) with such service_data.service_type
$confRentId - ID of the field with user 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 users.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
$confIsImportBankInformation - flag - import user's bank details into the "Additional data" field
$confDontImportCustomerFromGroupId - flag - do not import users from this group (groups.id)
$confImportCustomerOnlyFromGroupId - import users ONLY from this group (groups.id)
$confImportCustomerExpr - condition for importing users. It allows importing only a part of users from billing (executed before WHERE)
$confImportCustomerExpr2 - condition for importing users. Allows importing only a part of users 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)
$confIsUsUseDhcpData - 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 user ID as contract number
$confIsSavePasswordToComment - flag - save user's password from billing in the "additional data" field
$confIsImportPaidHistory - flag - import data on user payments (payment_transactions)
$confVersionFramedIp - import type dhs_sessions_log.Framed_IP_Address [0|1]
$confIsImportHistoryTariff - flag - import history of tariff changes by user
$confCustomerAccountSrc - source of user 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 user's date of connection
$confIsImportAdditionalServices - flag - import additional services
$confIsImportSwitchCommutation - flag - import user's switching to equipment (routers_info table of billing)
$confIsImportSwitchTableCommutation - flag - import user switching to equipment (billing switches table)
$confImportPaidLimit - limit on the number of imports at one time of user 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)
$confIsSaveVpnPasswordToComment - flag - save vpn password in user's comments
$confAddressSrc - source of user'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 users
$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 user
$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 user account number ''(e.g.: 02000000)''
$confImportGateway - import user'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)''
$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+)''
$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)''
$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 user 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 user 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 user card
$additionalCustomerDataMerge[1] = 1; - [utm5.uaddparams_desc.paramid] = userside.id
$additionalCustomerDataMerge[2] = 2; - [utm5.uaddparams_desc.paramid] = userside.id

Версия от 14:31, 2 ноября 2023

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 - user name for access to the billing database
$billingDBPassword - password for access to the billing database
$billingDBBName - 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 users) with such service_data.service_type
$confRentId - ID of the field with user 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 users.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
$confIsImportBankInformation - flag - import user's bank details into the "Additional data" field
$confDontImportCustomerFromGroupId - flag - do not import users from this group (groups.id)
$confImportCustomerOnlyFromGroupId - import users ONLY from this group (groups.id)
$confImportCustomerExpr - condition for importing users. It allows importing only a part of users from billing (executed before WHERE)
$confImportCustomerExpr2 - condition for importing users. Allows importing only a part of users 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)
$confIsUsUseDhcpData - 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 user ID as contract number
$confIsSavePasswordToComment - flag - save user's password from billing in the "additional data" field
$confIsImportPaidHistory - flag - import data on user payments (payment_transactions)
$confVersionFramedIp - import type dhs_sessions_log.Framed_IP_Address [0|1]
$confIsImportHistoryTariff - flag - import history of tariff changes by user
$confCustomerAccountSrc - source of user 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 user's date of connection
$confIsImportAdditionalServices - flag - import additional services
$confIsImportSwitchCommutation - flag - import user's switching to equipment (routers_info table of billing)
$confIsImportSwitchTableCommutation - flag - import user switching to equipment (billing switches table)
$confImportPaidLimit - limit on the number of imports at one time of user 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)
$confIsSaveVpnPasswordToComment - flag - save vpn password in user's comments
$confAddressSrc - source of user'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 users
$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 user
$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 user account number (e.g.: 02000000)
$confImportGateway - import user'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)
$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+)
$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)
$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 user 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 user 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 user card
$additionalCustomerDataMerge[1] = 1; - [utm5.uaddparams_desc.paramid] = userside.id
$additionalCustomerDataMerge[2] = 2; - [utm5.uaddparams_desc.paramid] = userside.id