Skip to content

[Bug]: Deleting an item that has stock shows “Could not delete selected Item(s)… have sales”, but the item is deleted #4830

Open

Description

@skyrush1

🐛 Bug Description

When deleting an item that still has stock, OSPOS shows the red error
"Could not delete selected Item(s), one or more of the selected Items have
sales." The item has no sales. After reloading the page, the item IS
deleted (hidden and quantity set to 0), so only the message is wrong.

It happens whether the stock was entered on the item form or added through
a receiving. Our setup has 4 stock locations, and the item had stock in
only 1 of them. The CodeIgniter log (writable/logs) shows no errors at the
time of the delete.

It looks like Item::delete_list() returns transStatus() = false even though
the delete succeeds, possibly from the Inventory::reset_quantity() step that
only runs when the item still has stock.

📋 Steps to Reproduce

  1. Have more than one stock location (we have 4).
  2. Go to Items > New Item and create an item, entering a quantity
    (e.g. 5) for only 1 of the locations. Leave the others at 0.
  3. Save the item.
  4. Select the item in the Items list and click Delete.
  5. See the red error "Could not delete selected Item(s), one or more of the
    selected Items have sales."
  6. Reload the page and see that the item is gone (it was deleted).

✅ Expected Behavior

Expected: a success message, since the item has no sales and is deleted.

📦 OpenSourcePOS Version

OpenSourcePOS 3.4.1

🔧 PHP Version

PHP 8.3

🌐 Browser(s)

Chrome

🖥️ Server Operating System

Debian GNU/Linux 12 (bookworm)

🗄️ Database

10.11.20-MariaDB

🌍 Web Server

Apache + Nginx (Cloudways stack), PHP-FPM

📊 System Information Report

OSPOS Installation Info: 3.4.1 - 5f395d
Language Code: en

Extensions & Modules:
» GD: Enabled ✓
» BC Math: Enabled ✓
» INTL: Enabled ✓
» OpenSSL: Enabled ✓
» MBString: Enabled ✓
» Curl: Enabled ✓
» Json: Enabled ✓

» Xml: Enabled ✓

User Configuration:
.Browser: Chrome 157.0.0.0
Server Software: Apache/2.4.71 (Debian)
PHP Version: 8.3.36
DB Version: 10.11.20-MariaDB-deb12-log
Server Port: 80
OS: Linux 6.1.0-52-cloud-amd64



File Permissions:
» [writeable/logs:] - 0775 | Writable ✓ | Vulnerable or Incorrect Permissions ✗
» [writable/uploads:] - 0775 | Writable ✓ | Vulnerable or Incorrect Permissions ✗
» [writable/uploads/item_pics:] - 0775 | Writable ✓ | Vulnerable or Incorrect Permissions ✗
» [importCustomers.csv:] - 0664 | Readable ✓ | Vulnerable or Incorrect Permissions ✗

Security Vulnerability Warning
Incorrect permissions leaves this software at risk.

» [writeable/logs:] is writable, but the permissions are incorrectly set. Please set it to 750 and refresh.
» [writable/uploads:] is writable, but the permissions are incorrectly set. Please set it to 750 and refresh.
» [writable/uploads/item_pics:] is writable, but the permissions are incorrectly set. Please set it to 750 and refresh.
» [importCustomers.csv:] is readable, but the permissions are incorrectly set. Please set it to 640 or 660 and refresh.

📜 Relevant Log Output

📸 Screenshots

No response

✓ Confirmation

  • I certify that this is an unmodified copy of OpenSourcePOS
  • I have searched existing issues to ensure this bug has not already been reported
  • I have provided all the information requested above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions