Quotes: a line can have a picture beside its name on the quote, guest link, portal and PDF, uploaded or pulled from a link to a picture or a product page's main picture, fetched only from public addresses and kept as ITFlow's own resized copy in uploads/quote_images; products keep a picture that a quote line added from them copies, Copy Quote copies them, and deleting a line, quote, client or product removes the files; Admin Settings Quotes can switch pictures off; database 3.8.8 adds quote_items.item_image, products.product_image and config_quote_show_images; 26.11.9 changelog entries

This commit is contained in:
johnnyq
2026-11-17 21:25:57 -05:00
parent bd62f4af22
commit 475f27fc7f
27 changed files with 619 additions and 15 deletions

View File

@@ -338,13 +338,16 @@ function productCopy($product_id) {
], 0, $error);
}
/** Delete a product, its stock and its price history. Lines it is on keep their text and amounts; license templates sold as it no longer are. */
/** Delete a product, its stock, its price history and its picture. Lines it is on keep their text and amounts; license templates sold as it no longer are. */
function productDelete($product_id) {
global $mysqli;
$product_id = intval($product_id);
mysqli_query($mysqli, "UPDATE software_templates SET software_template_product_id = 0, software_template_updated_at = software_template_updated_at WHERE software_template_product_id = $product_id");
mysqli_query($mysqli, "DELETE FROM product_stock WHERE stock_product_id = $product_id");
mysqli_query($mysqli, "DELETE FROM product_prices WHERE price_product_id = $product_id");
if (quoteImagesReady()) {
quoteImageDelete((string) (mysqli_fetch_row(mysqli_query($mysqli, "SELECT product_image FROM products WHERE product_id = $product_id"))[0] ?? ''));
}
mysqli_query($mysqli, "DELETE FROM products WHERE product_id = $product_id");
}