Language: JavaScript
Label: safe
CWE: CWE-352 \u2014 Cross-Site Request Forgery (CSRF)
The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request.

Code:
      unit: $(selector).closest("tr").find(".productItemUnit").val()
    }, product => {

      if(product["error"] !== undefined && product["error"] === true) {

        $(that).val(product.stq); // Set the product quantity with Stock Quantity
        Quantity = product.stq;

        // Display the error message
        Swal.fire({
            title: "Error!",
            text: product["msg"],
            icon: "error"
        });

      }

      // Check if product[0] isset, if not the use direct product
      // Because If there is any error then the product details come with the error
      var product = product[0] ? product[0] : product;

      // change product background color while changing qty and when out of stock
      if(product.so) {

        $(selector).closest("tr").css("background-color", "pink");

      } else {

        $(selector).closest("tr").css("background-color", "white");

      }

      // Display Subtotal for each product
      $(SubtotalRow).html((BMS.FUNCTIONS.calculateDiscount(netSalesPrice,Discount) * Quantity).toFixed(2));

      // Update the packet
      var packet = 0;
      if(Number(product.pq) > 0) {
        packet = (Quantity / Number(product.pq)).toFixed(2);
      }
      packetSelector.val( packet );

      // Call the grand total
      this.grandTotal();
    
    });

  },