Opened 16 years ago

Closed 13 years ago

#10756 closed Bug (fixed)

Correct PLNIPField

Reported by: remik Owned by: nobody
Component: contrib.localflavor Version: dev
Severity: Normal Keywords:
Cc: michal.modzelewski@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Valid forms are: XXX-XXX-YY-YY or XXX-XX-YY-YYY.

see http://pl.wikipedia.org/wiki/Nip

Attachments (2)

ticket10756.diff (3.1 KB ) - added by Michał Modzelewski 14 years ago.
patch that changes the accepted formats, details in the comments
ticket10756-2.diff (3.1 KB ) - added by Claude Paroz 13 years ago.
Updated to current trunk

Download all attachments as: .zip

Change History (8)

comment:1 by Jarek Zgoda, 15 years ago

Polish law does not specify any particular form of tax ID number, the only requirement is 10 digits. These formats are only enforced by paper forms and may vary. To be fair with current law, we should use a regex that allows any grouping (with no grouping as special case).

comment:2 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Chris Beaven, 14 years ago

Severity: Normal
Type: Bug

by Michał Modzelewski, 14 years ago

Attachment: ticket10756.diff added

patch that changes the accepted formats, details in the comments

comment:4 by Michał Modzelewski, 14 years ago

Cc: michal.modzelewski@… added
Easy pickings: unset
Has patch: set
Version: 1.0SVN

I've added a patch to fix this.
New accepted formats are XXX-XXX-XX-XX, XXX-XX-XX-XXX and XXXXXXXXXX based on http://pl.wikipedia.org/wiki/NIP, the historical wikipedia entry http://pl.wikipedia.org/w/index.php?title=NIP&oldid=18661745 and some polish legal forums that discussed the matter of validation.
Some translations from the wikipedia article:

Prefiks - trzy pierwsze cyfry każdego NIP oznaczają kod urzędu skarbowego, który nadał dany numer.

Prefix - the first three digits in each NIP signify the tax office that assigned the number.

W przeszłości NIP zwyczajowo zapisywało się, oddzielając grupy cyfr łącznikiem. Obecnie nadawany jest bez znaków łącznika.

In the past a NIP was commonly writen with dashes separating the digit groups. Currently numbers are assigned without dashes.

Translated excerpt from the historical artical:

Zwyczajowo NIP zapisuje się, oddzielając grupy cyfr łącznikiem. Dla osób fizycznych numer dzielony jest na grupy 123-456-78-90, a dla osób prawnych, bądź ułomnych osób prawnych, na grupy 123-45-67-890.

Commonly a NIP is written with dashes separating the digits into groups. For individuals the number is split into groups 123-456-78-90, and for legal personalities and restricted legal personalities into groups 123-45-67-890.

From the note on prefixes we can see that the previous accepted format of XX-XX-XXX-XXX was incorrect so I have removed it.
Apropos the comment by zgoda, since the current accepted format is without dashes, we only need to accept the current format and the two historical formats posted in the bug report by remik, and in the historical wikipedia entry.

We don't need to support the previously accepted format for backwards compatibility since the fields clean method stripped the dashes.

Version 0, edited 14 years ago by Michał Modzelewski (next)

by Claude Paroz, 13 years ago

Attachment: ticket10756-2.diff added

Updated to current trunk

comment:5 by Claude Paroz, 13 years ago

Triage Stage: AcceptedReady for checkin
UI/UX: unset

comment:6 by Aymeric Augustin, 13 years ago

Resolution: fixed
Status: newclosed

In [17346]:

Fixed #10756 -- Error in the formats accepted by PLNIPField. Thanks remik for the report, michalm for the patch and claudep for the review.

Note: See TracTickets for help on using tickets.
Back to Top