Announcement

Collapse
No announcement yet.

Preventing customers entering commas into the address fields

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Preventing customers entering commas into the address fields

    Some companies need to export csv (comma separated value) files to supply to third parties and when customers enter commas into the address fields this can cause problems when exporting these files.

    It is possible by editing one of the Perl scripts to prevent this happening.

    Version 10
    Browse to your Site* folder (if there is only one site within the software it will be called 'Site1', if there are multiple sites within the software you will need to browse to the site folder name corresponding to the current site you are using) and open the file: -

    OrderScript.pl

    in a plain text editor (such as 'Notepad').

    Scroll down and locate the lines: -

    Code:
    if (exists $::g_pFieldSizes->{$sKey} &&
            (length $$pHash{$sKey} > $::g_pFieldSizes->{$sKey}))
            {
            if ($sFormat ne 'text')
                    {
                    $sError .= ACTINIC::GetLengthFailureMessage($nPhase, $pMapping->{$sKey}, $::g_pFieldSizes->{$sKey});
                    }
            else
                    {
                    $sError .= ACTINIC::GetLengthFailureMessageAsText($nPhase, $pMapping->{$sKey}, $::g_pFieldSizes->{$sKey});
                    }
            }
    and add the following lines beneath: -

    Code:
    if ($sKey =~ /^ADDRESS/ && $$pHash{$sKey} ne '' &&         # and they supplied something
                            $$pHash{$sKey} =~ /,/)
                            {
                            $sError .= "<br>The field <b>\"" . ACTINIC::GetPhrase($nPhase, $pMapping->{$sKey}) . "\"</b> cannot contain commas.<br>";
                            }
    Save and close the file.

    Upload the site and if a customer enters a comma into the address fields an error message will be displayed.

    Version 9
    Browse to your Site* folder (if there is only one site within the software it will be called 'Site1', if there are multiple sites within the software you will need to browse to the site folder name corresponding to the current site you are using) and open the file: -

    OrderScript.pl

    in a plain text editor (such as 'Notepad').

    Scroll down and locate the lines: -

    Code:
    if ((ACTINIC::IsPromptRequired(0, 12) ||                # if e-mail address is required
                    length $::g_BillContact{'EMAIL'} > 0)   &&      # or the e-mail field has value
                    $::g_BillContact{'EMAIL'} !~ /\@/)                      # and it is not in the expected format
                    {
                    $sPreValidationError .= ACTINIC::GetPhrase(-1, 2378);
                    }
    Just beneath that add: -

    Code:
    if (length $::g_BillContact{'ADDRESS1'} > 0     &&      # filled in at all
                    $::g_BillContact{'ADDRESS1'} =~ /,/)                    # and it is not in the expected format
                    {
                    $sPreValidationError .= "<br>The Address line 1 field cannot contain commas.<br>";
                    }
    Then scroll down and locate the lines: -

    Code:
    if ((ACTINIC::IsPromptRequired(1, 12) ||                # if e-mail address is required
                    length $::g_ShipContact{'EMAIL'} > 0)   &&      # or the e-mail field has value
                    $::g_ShipContact{'EMAIL'} !~ /\@/)                      # and it is not in the expected format
                    {
                    $sError.= ACTINIC::GetPhrase(-1, 2378);
                    }
    Just beneath add the lines: -

    Code:
    if (length $::g_ShipContact{'ADDRESS1'} > 0     &&      # filled in at all
            $::g_ShipContact{'ADDRESS1'} =~ /,/)                    # it is not in the expected format
            {
            $sError .= "<br>The Address line 1 field cannot contain commas.<br>";
            }
    Save and close the file.

    Upload the site for the changes to take place.

    * Depending on the installation option chosen or operating system used, the 'Site' folder can be found in either 'My Documents', 'Documents', 'Shared Documents' or 'Program Files' in the folder 'Actinic vX\Sites\' (with X replacing the version number).
    NOTE: All versions after v11.03 will have a file path of 'C:\Program Files\SellerDeck xxxx'.

    NOTE: SellerDeck is not able to provide any detailed support for script changes made. If you find that there is a problem, an original copy of the script can be found within the 'Original' folder in your installation. Copy this into your site folder.
Working...
X