Topic: Missing function 'delete_image' when trying to delete an Item

When I try to delete an item, it throws an error about a missing function:

Unhandled exception [0]: Call to undefined function delete_image(). in file: /xxx/xxx/fa/inventory/manage/items.php at line 338

It will still remove the item while throwing this error.
Thanks

Re: Missing function 'delete_image' when trying to delete an Item

Which version of FA, PHP and MySQL are you using?

Line 338 of inventory/manage/items.php is:

        delete_image($stock_id);

The said function literal is absent in whole of the FA codebase and wonder how the image gets deleted.

Re: Missing function 'delete_image' when trying to delete an Item

Looks like it should be del_image instead of delete_image.

The function is defined in inventory/manage/items.php at 59 to 67:

function del_image($stock_id)
{
    foreach (array('jpg', 'png', 'gif') as $ext) {
        $filename = company_path().'/images/'.item_img_name($stock_id).".".$ext;
        if (file_exists($filename) && !unlink($filename))
            return false;
    }
    return true;
}

Re: Missing function 'delete_image' when trying to delete an Item

@joe: Kindly fix this.

Re: Missing function 'delete_image' when trying to delete an Item

Fixed and committed to stable.

Thanks for finding this.

/Joe

Re: Missing function 'delete_image' when trying to delete an Item

The committed fix now renames the function del_image to delete_image as used in the codebase. The re-run of the commit now changes the usage to del_image and rolls back the function name change.

This error in coding occurred as the earlier function name was used as the $_POST variable from the form.

Such usages are in some extensions as well - additional_fields and fronthrm but mostly as $_POST variables.