<commit_before>{*
* Created by PhpStorm.
* User: jesper
* Date: 15-03-17
* Time: 13:01
* @author <NAME> <EMAIL>
* @copyright Billmate AB 2015
*}
<p class="text">
    <span>{l s='Personal / Corporate number' mod='billmategateway'}</span>
    <input type="text" id="pno" name="pno"/>
    <button id="getaddress" class="btn btn-default"><span>{l s="Get Address" mod='billmategateway'}</span></button>
</p>
<script type="text/javascript">
    var getaddressurl = "{$link->getModuleLink('billmategateway','getaddress', ['ajax'=> 0], true)}";
    var errormessage = '{l s='We couldnt find your address, please enter manually' mod='billmategateway'}';
    {literal}
    $(document).ready(function(){
        $('#getaddress').click(function(e) {
            e.preventDefault();
            var pno = $('#pno').val();
            if(pno != ''){
                $.ajax({
                    url: getaddressurl,
                    data: {pno: pno},
                    success: function(response){
                        response = JSON.parse(response);
                        if(response.success){
                            $('input[name="firstname"]').val(response.data.firstname);
                            $('input[name="lastname"]').val(response.data.lastname);
                            $('input[name="company"]').val(response.data.company);
                            $('input[name="address1"]').val(response.data.street);
                            $('input[name="city"]').val(response.data.city);
                            $('input[name="postcode"]').val(response.data.zip);
                            $('input[name="id_country"]').val(response.data.id_country);
                        } else {
                            alert(errormessage);
                        }
                    }
                })
            }
        })
    })
    {/literal}
</script><commit_msg>Validate fields on getAddress Fixes #150<commit_after>{*
* Created by PhpStorm.
* User: jesper
* Date: 15-03-17
* Time: 13:01
* @author <NAME> <EMAIL>
* @copyright Billmate AB 2015
*}
<p class="text">
    <span>{l s='Personal / Corporate number' mod='billmategateway'}</span>
    <input type="text" id="pno" name="pno"/>
    <button id="getaddress" class="btn btn-default"><span>{l s="Get Address" mod='billmategateway'}</span></button>
</p>
<script type="text/javascript">
    var getaddressurl = "{$link->getModuleLink('billmategateway','getaddress', ['ajax'=> 0], true)}";
    var errormessage = '{l s='We couldnt find your address, please enter manually' mod='billmategateway'}';
    {literal}
    $(document).ready(function(){
        $('#getaddress').click(function(e) {
            e.preventDefault();
            var pno = $('#pno').val();
            if(pno != ''){
                $.ajax({
                    url: getaddressurl,
                    data: {pno: pno},
                    success: function(response){
                        response = JSON.parse(response);
                        if(response.success){
                            $('input[name="firstname"]').val(response.data.firstname);
                            $('input[name="firstname"]').trigger('change');
                            $('input[name="lastname"]').val(response.data.lastname);
                            $('input[name="lastname"]').trigger('change');
                            $('input[name="company"]').val(response.data.company);
                            $('input[name="company"]').trigger('change');
                            $('input[name="address1"]').val(response.data.street);
                            $('input[name="address1"]').trigger('change');
                            $('input[name="city"]').val(response.data.city);
                            $('input[name="city"]').trigger('change');
                            $('input[name="postcode"]').val(response.data.zip);
                            $('input[name="postcode"]').trigger('change');
                            $('input[name="id_country"]').val(response.data.id_country);
                            $('input[name="id_country"]').trigger('change');
                        } else {
                            alert(errormessage);
                        }
                    }
                })
            }
        })
    })
    {/literal}
</script>
{'fraction_non_alphanumeric': 0.17697277341947393, 'fraction_numerical': 0.008306414397784956, 'mean_word_length': 1.7436708860759493, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1080504', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1170, 'n_words': 183}