omfgppc - 2009-03-10

You have subscribed to a wiki page or wiki category on "xTuple" for change =
notification.

The "320to321.gz" page has been changed by pclark:

  =

  =3D 320to321.gz =3D
  =3D=3D Check for duplicate purchase order numbers =3D=3D
- Purchase Order records exist with duplicate numbers please ensure each Pu=
rchase Order has a unique number.
+ Purchase Order records exist with duplicate numbers please ensure each Pu=
rchase Order has a unique number. Find the suspect pohead_numbers.
- Find the suspect pohead_numbers.
+ =

  {{{
  SELECT pohead_number, count(*) FROM pohead GROUP BY pohead_number HAVING =
count(*) > 1;
+ =

+ pohead_number | count
+ --------------|-------
+     6000      |   2
+ =

- For example PO Number 6000 was returned with a duplicate.}}}
+ For example PO Number 6000 was returned with a duplicate.
+ }}}
  From that returned list, get a pohead_id for one of the duplicates.
+ =

  {{{
  SELECT pohead_id FROM pohead WHERE pohead_number =3D '6000';
  =

   pohead_id
  -----------
     345
-    346}}}
+    346
- You should investigate the actual hardcopy PO before modifying, and let p=
eople know there's been a number change.
- Let's renumber one of the duplicates using the fetchponumber() function.
+ }}}
+ You should investigate the hardcopy PO before modifying, and let people k=
now there's been a number change. Let's renumber one of the duplicates usin=
g the fetchponumber() function.
+ =

  {{{
  BEGIN;
  UPDATE pohead SET pohead_number =3D (SELECT fetchponumber()) WHERE pohead=
_id =3D 345;