Code

Opened 5 years ago

Closed 3 years ago

#10756 closed Bug (fixed)

Correct PLNIPField

Reported by: remik Owned by: nobody
Component: contrib.localflavor Version: master
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 michalm 3 years ago.
patch that changes the accepted formats, details in the comments
ticket10756-2.diff (3.1 KB) - added by claudep 3 years ago.
Updated to current trunk

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by zgoda

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 5 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 3 years ago by SmileyChris

  • Severity set to Normal
  • Type set to Bug

Changed 3 years ago by michalm

patch that changes the accepted formats, details in the comments

comment:4 Changed 3 years ago by michalm

  • Cc michal.modzelewski@… added
  • Easy pickings unset
  • Has patch set
  • Version changed from 1.0 to SVN

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.

Last edited 3 years ago by michalm (previous) (diff)

Changed 3 years ago by claudep

Updated to current trunk

comment:5 Changed 3 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin
  • UI/UX unset

comment:6 Changed 3 years ago by aaugustin

  • Resolution set to fixed
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.