| @@ 3495-3509 (lines=15) @@ | ||
| 3492 | * @param string $field campo cnpjCpf da CT-e |
|
| 3493 | * @return string |
|
| 3494 | */ |
|
| 3495 | protected function zFormatCNPJCPF($field) |
|
| 3496 | { |
|
| 3497 | if (!isset($field)) { |
|
| 3498 | return ''; |
|
| 3499 | } |
|
| 3500 | $cnpj = !empty($field->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
| 3501 | $field->getElementsByTagName("CNPJ")->item(0)->nodeValue : ""; |
|
| 3502 | if ($cnpj != "" && $cnpj != "00000000000000") { |
|
| 3503 | $cnpj = $this->pFormat($cnpj, '###.###.###/####-##'); |
|
| 3504 | } else { |
|
| 3505 | $cnpj = !empty($field->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 3506 | $this->pFormat($field->getElementsByTagName("CPF")->item(0)->nodeValue, '###.###.###.###-##') : ''; |
|
| 3507 | } |
|
| 3508 | return $cnpj; |
|
| 3509 | } //fim formatCNPJCPF |
|
| 3510 | ||
| 3511 | /** |
|
| 3512 | * zFormatFone |
|
| @@ 3284-3298 (lines=15) @@ | ||
| 3281 | * @param string $field campo cnpjCpf da CT-e |
|
| 3282 | * @return string |
|
| 3283 | */ |
|
| 3284 | protected function zFormatCNPJCPF($field) |
|
| 3285 | { |
|
| 3286 | if (!isset($field)) { |
|
| 3287 | return ''; |
|
| 3288 | } |
|
| 3289 | $cnpj = !empty($field->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
| 3290 | $field->getElementsByTagName("CNPJ")->item(0)->nodeValue : ""; |
|
| 3291 | if ($cnpj != "" && $cnpj != "00000000000000") { |
|
| 3292 | $cnpj = $this->pFormat($cnpj, '###.###.###/####-##'); |
|
| 3293 | } else { |
|
| 3294 | $cnpj = !empty($field->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
| 3295 | $this->pFormat($field->getElementsByTagName("CPF")->item(0)->nodeValue, '###.###.###.###-##') : ''; |
|
| 3296 | } |
|
| 3297 | return $cnpj; |
|
| 3298 | } //fim formatCNPJCPF |
|
| 3299 | ||
| 3300 | /** |
|
| 3301 | * zFormatFone |
|