Uploaded image for project: 'mod-orders'
  1. mod-orders
  2. MODORDERS-188

Cryptic error returned when trying to add a POLine to an Open PO

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • P3
    • Resolution: Done
    • None
    • 4.0.0
    • ACQ Sprint 59
    • 2
    • Thunderjet

    Description

      Overview:
      A cryptic error (see below for details) is returned when adding a POLine to a PO which has status Open or Closed. Here the "genericError" code is used, but should probably be replaced with a code specific to this scenario.

      Acceptance Criteria:

      • Appropriate error message and code are returned in this scenario
      • A test case has been added to the unit tests to exercise this scenario
      • Test coverage on new code is 80%+
      • A test case has been added to the API tests to exercise this scenario

      Reproducer:

      1. Goto folio-testing and login
      2. Create a PO
      3. Scenario 1:
        • Transition the PO to Open
        • Add a PoLine to the PO
      4. Scenario 2:
        • Transition the PO to Closed
        • Add a PoLine to the PO
      ## Create PO ##
      curl 'http://folio-testing-backend01.aws.indexdata.com:9130/orders/composite-orders' -H "X-Okapi-Token: $TOKEN" -H 'Content-Type: application/json' -w '\n' --data-binary '{
      >    "id" : "15d97111-ed48-4369-b8eb-269363aabf43",
      >    "po_number" : "MODORDERS188",
      >    "order_type" : "One-Time",
      >    "vendor" : "4837d297-443c-48f2-b3b2-4eda69da8ef3",
      >    "workflow_status" : "Pending",
      >    "compositePoLines" : [ ],
      >    "metadata" : {
      >      "createdDate" : "2019-03-07T21:30:09.547+0000",
      >      "createdByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f",
      >      "updatedDate" : "2019-03-07T21:30:09.547+0000",
      >      "updatedByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f"
      >    }
      >  }'
      {
        "id" : "15d97111-ed48-4369-b8eb-269363aabf43",
        "notes" : [ ],
        "po_number" : "MODORDERS188",
        "order_type" : "One-Time",
        "vendor" : "4837d297-443c-48f2-b3b2-4eda69da8ef3",
        "workflow_status" : "Pending",
        "compositePoLines" : [ ],
        "metadata" : {
          "createdDate" : "2019-03-07T21:36:12.419+0000",
          "createdByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f",
          "updatedDate" : "2019-03-07T21:36:12.419+0000",
          "updatedByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f"
        }
      }
      
      ## Transition to Open ##
      curl 'http://folio-testing-backend01.aws.indexdata.com:9130/orders/composite-orders/15d97111-ed48-4369-b8eb-269363aabf43' -H "X-Okapi-Token: $TOKEN" -H 'Content-Type: application/json' -w '\n' -XPUT --data-binary '
      > {
      >   "id" : "15d97111-ed48-4369-b8eb-269363aabf43",
      >   "notes" : [ ],
      >   "po_number" : "MODORDERS188",
      >   "order_type" : "One-Time",
      >   "vendor" : "4837d297-443c-48f2-b3b2-4eda69da8ef3",
      >   "workflow_status" : "Open",
      >   "compositePoLines" : [ ]
      > }'
      
      ## Sanity Check ##
      curl 'http://folio-testing-backend01.aws.indexdata.com:9130/orders/composite-orders/15d97111-ed48-4369-b8eb-269363aabf43' -H "X-Okapi-Token: $TOKEN" -H 'Content-Type: application/json' -w '\n' -XGET
      {
        "id" : "15d97111-ed48-4369-b8eb-269363aabf43",
        "dateOrdered" : "2019-03-07T21:37:40.208+0000",
        "notes" : [ ],
        "po_number" : "MODORDERS188",
        "order_type" : "One-Time",
        "vendor" : "4837d297-443c-48f2-b3b2-4eda69da8ef3",
        "workflow_status" : "Open",
        "compositePoLines" : [ ],
        "metadata" : {
          "createdDate" : "2019-03-07T21:36:12.441+0000",
          "createdByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f",
          "updatedDate" : "2019-03-07T21:37:40.221+0000",
          "updatedByUserId" : "49e74bca-d8c2-5399-be7c-379fffa1aa6f"
        }
      }
      
      ## Add a POLine ##
      curl 'http://folio-testing-backend01.aws.indexdata.com:9130/orders/order-lines' -H "X-Okapi-Token: $TOKEN" -H 'Content-Type: application/json' -w'\n' --data-binary '{  
      >    "source":{  
      >       "code":"FOLIO"
      >    },
      >    "cost":{  
      >       "currency":"USD",
      >       "list_price":"5.99",
      >       "quantity_physical":1
      >    },
      >    "vendor_detail":{  
      >       "instructions":""
      >    },
      >    "purchase_order_id":"15d97111-ed48-4369-b8eb-269363aabf43",
      >    "acquisition_method":"Gift",
      >    "order_format":"Physical Resource",
      >    "title":"Grass",
      >    "contributors":[  
      >       {  
      >          "contributor":"Sheri S. Tepper"
      >       }
      >    ],
      >    "details":{  
      >       "product_ids":[  
      >          {  
      >             "product_id":"9788675309",
      >             "product_id_type":"ISBN"
      >          }
      >       ],
      >       "material_types":[  
      >          "1a54b431-2e4f-452d-9cae-9cee66c9a892"
      >       ]
      >    },
      >    "locations":[  
      >       {  
      >          "location_id":"53cf956f-c1df-410b-8bea-27f712cca7c0",
      >          "quantity_physical":1
      >       }
      >    ]
      > }' 
      {
        "errors" : [ {
          "message" : "ErrorMessage(fields=Map(Position -> 23, Line -> 420, File -> namespace.c, SQLSTATE -> 42P01, Routine -> RangeVarGetRelidExtended, V -> ERROR, Message -> relation \"polNumber_15d97111-ed48-4369-b8eb-269363aabf43\" does not exist, Severity -> ERROR))",
          "code" : "genericError",
          "parameters" : [ ]
        } ]
      }
      

      See UIOR-144 for additional details

      TestRail: Results

        Attachments

          1. AddPoLineToClosedOrder.png
            AddPoLineToClosedOrder.png
            78 kB
          2. API_Tests.png
            API_Tests.png
            61 kB
          3. PUT_OpenOrder.png
            PUT_OpenOrder.png
            86 kB

          Issue Links

            Activity

              People

                cmcnally Craig McNally
                cmcnally Craig McNally
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases