Jump to content

Validation function not found. isTaxfederal


Recommended Posts

Hello,

I've tryed to add a new filed in customer table, TaxFederal for Canada Customers, but I didn't undestand how implement a type of validation.

 

I would like to add a Custom Type Validation, It'll check that the format of the string will be "00-00000000" (size=14)

Can you explain me how and where I must do the modify.

 

I modifyed ObjectModel.php class adding this :

    const TYPE_INT = 1;
    const TYPE_BOOL = 2;
    const TYPE_STRING = 3;
    const TYPE_FLOAT = 4;
    const TYPE_DATE = 5;
    const TYPE_TAXFEDERAL = 14;
    const TYPE_HTML = 6;
    const TYPE_NOTHING = 7;

and

public static function formatValue($value, $type, $with_quotes = false, $purify = true)
    {
        switch ($type)
        {
...
            case self::TYPE_TAXFEDERAL:
                if (!$value)
                    return '00-00000000000';


and modify authentication.tpl

 <div class="required form-group">
        <label for="taxfederal">{l s='TAXFEDERAL'} <sup>*</sup></label>
        <input type="text" class="is_required validate form-control" data-validate="isTaxfederal" id="taxfederal" name="taxfederal" value="{if isset($smarty.post.taxfederal)}{$smarty.post.taxfederal}{/if}" />
        <span class="form_info">{l s='(fortheen characters minimum)'}</span>
  </div>           
 

Link to comment
Share on other sites

×
×
  • Create New...