Installing Conversion Script

To convert payment data from a bank statement to the CSV format, you need to write a special script, which will take all the necessary information from the statement and put in into the CSV file. For the detailed information on the requirement to such a script, see this CloudBlue Knowledge Base article: https://kb.cloudblue.com/en/119198.

For the information about an output file for such a script, see the CSV File Format section.

When the script is written, you can install it to your Billing installation to be able to convert data to the CSV format automatically, within the import procedure.

To enable applying your script on the import procedure:

  1. Place the script file into some folder, for example,

    /usr/local/bm/tools_customers

  2. Write the information about the script into Billing DB:
    1. Connect to DB:

      psql -U pba pba

    2. Make sure that there is no any script already existing in Billing DB:

      select * from "DocumentImportSettings" where "AccountID"=1;

      No information must be returned.

    3. Add a new line with this SQL command:

      insert into "DocumentImportSettings" ("AccountID", "ConversionUsed", "ConversionCommand", "ConversionName") values (1, 1, '<ConversionCommand>', '<ConversionName>');

      where

      ConversionUsed is a parameter that defines how the Conversion Script field is shown to a customer. The value can be one of the following:

      • 0 – not to show the conversion script at all.
      • 1 – to show in the field None by default. In this case, a customer can chose between not using a script (what requires preparing a CSV file externally) and selecting the necessary script from the drop-down list.
      • 2 – to show the conversion script in the field by default.

      ConversionCommand is the full path to the folder containing the conversion script, for example, '/usr/local/bm/tools_customers/scriptname.pl'.

      ConversionName is the name shown in UI as this conversion script name, for example, 'conversion script'.

      Note:If this row already exists in DB, you can change its values using the following command:
      update "DocumentImportSettings" set "ConversionName" = 'Sample script' where "AccountID" = 1;

      This command changes the script name shown in UI to "Sample script".

  3. The information about the script is written to Billing DB, now you can import payments right from a non-CSV file.