mirror of
https://github.com/itflow-org/itflow
synced 2026-11-22 04:17:24 +00:00
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:
@@ -129,6 +129,13 @@ if (isset($_POST['billing_item_save'])) {
|
||||
$name = trim((string) $_POST['name']);
|
||||
logAudit(billingAuditType($type), 'Edit', escapeSql("$session_name " . ($item_id ? 'edited' : 'added') . " line $name " . ($item_id ? 'on' : 'to') . " $number"), $client_id, $doc_id);
|
||||
|
||||
// A quote line's picture - a new one, or taken off (functions/quote_images.php)
|
||||
$image_error = $type === 'quote' ? quoteImageSave('quote_items', $saved, $_POST, $_FILES) : '';
|
||||
if ($image_error !== '') {
|
||||
flashAlert('<strong>' . escapeHtml($name) . '</strong> ' . ($item_id ? 'updated' : 'added') . ', but its picture couldn\'t be added: ' . escapeHtml($image_error), 'warning');
|
||||
billingPostBack($type, $doc_id, "line-$saved");
|
||||
}
|
||||
|
||||
flashAlert('<strong>' . escapeHtml($name) . '</strong> ' . ($item_id ? 'updated' : 'added'));
|
||||
|
||||
billingPostBack($type, $doc_id, $item_id ? "line-$saved" : 'add-line');
|
||||
|
||||
@@ -304,8 +304,9 @@ if (isset($_GET['delete_client'])) {
|
||||
//Delete Quote and related items
|
||||
$sql = mysqli_query($mysqli, "SELECT quote_id FROM quotes WHERE quote_client_id = $client_id");
|
||||
while($row = mysqli_fetch_assoc($sql)) {
|
||||
$quote_id = $row['quote_id'];
|
||||
$quote_id = intval($row['quote_id']);
|
||||
|
||||
quoteImagesDeleteFor("item_quote_id = $quote_id");
|
||||
mysqli_query($mysqli, "DELETE FROM quote_items WHERE item_quote_id = $quote_id");
|
||||
}
|
||||
mysqli_query($mysqli, "DELETE FROM quotes WHERE quote_client_id = $client_id");
|
||||
|
||||
@@ -42,6 +42,13 @@ if (isset($_POST['add_product'])) {
|
||||
|
||||
logAudit("Product", "Create", "$session_name created " . strtolower($type_label) . " $name", 0, $product_id);
|
||||
|
||||
// Its picture (functions/quote_images.php)
|
||||
$image_error = quoteImageSave('products', $product_id, $_POST, $_FILES);
|
||||
if ($image_error !== '') {
|
||||
flashAlert("$type_label <strong>" . escapeHtml($product['product_name']) . "</strong> added, but its picture couldn't be added: " . escapeHtml($image_error), 'warning');
|
||||
redirect();
|
||||
}
|
||||
|
||||
flashAlert("$type_label <strong>" . escapeHtml($product['product_name']) . "</strong> added");
|
||||
|
||||
redirect();
|
||||
@@ -76,6 +83,13 @@ if (isset($_POST['edit_product'])) {
|
||||
}
|
||||
}
|
||||
|
||||
// Its picture (functions/quote_images.php)
|
||||
$image_error = quoteImageSave('products', $product_id, $_POST, $_FILES);
|
||||
if ($image_error !== '') {
|
||||
flashAlert("<strong>" . escapeHtml($product['product_name']) . "</strong> saved$price_note - but its picture couldn't be added: " . escapeHtml($image_error), 'warning');
|
||||
redirect();
|
||||
}
|
||||
|
||||
flashAlert("<strong>" . escapeHtml($product['product_name']) . "</strong> saved$price_note");
|
||||
|
||||
redirect();
|
||||
|
||||
@@ -105,7 +105,7 @@ if (isset($_POST['add_quote_copy'])) {
|
||||
mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Quote copied!', history_quote_id = $new_quote_id");
|
||||
|
||||
$sql_items = mysqli_query($mysqli,"SELECT item_description, item_id, item_name, item_order, item_price, item_quantity, item_subtotal,
|
||||
item_tax, item_tax_id, item_total, item_frequency, item_product_id" . (quotePricingReady() ? ', item_cost, item_price_method, item_price_percent' : '') . " FROM quote_items WHERE item_quote_id = $quote_id");
|
||||
item_tax, item_tax_id, item_total, item_frequency, item_product_id" . (quotePricingReady() ? ', item_cost, item_price_method, item_price_percent' : '') . (quoteImagesReady() ? ', item_image' : '') . " FROM quote_items WHERE item_quote_id = $quote_id");
|
||||
while($row = mysqli_fetch_assoc($sql_items)) {
|
||||
$item_id = intval($row['item_id']);
|
||||
$item_name = escapeSql($row['item_name']);
|
||||
@@ -124,7 +124,7 @@ if (isset($_POST['add_quote_copy'])) {
|
||||
if ($item_product_id && !getFieldById('products', $item_product_id, 'product_id')) {
|
||||
$item_product_id = 0;
|
||||
}
|
||||
$item_pricing = quotePricingCopySql($row);
|
||||
$item_pricing = quotePricingCopySql($row) . quoteImageCopySql($row);
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO quote_items SET item_name = '$item_name', item_description = '$item_description', item_quantity = $item_quantity, item_price = $item_price, item_subtotal = $item_subtotal, item_tax = $item_tax, item_total = $item_total, item_order = $item_order, item_tax_id = $tax_id, item_frequency = $item_frequency, item_product_id = $item_product_id$item_pricing, item_quote_id = $new_quote_id");
|
||||
}
|
||||
@@ -247,7 +247,8 @@ if (isset($_GET['delete_quote'])) {
|
||||
|
||||
mysqli_query($mysqli,"DELETE FROM quotes WHERE quote_id = $quote_id");
|
||||
|
||||
//Delete Items Associated with the Quote
|
||||
//Delete Items Associated with the Quote - and their pictures (functions/quote_images.php)
|
||||
quoteImagesDeleteFor("item_quote_id = $quote_id");
|
||||
$sql = mysqli_query($mysqli,"SELECT item_id FROM quote_items WHERE item_quote_id = $quote_id");
|
||||
while($row = mysqli_fetch_assoc($sql)) {;
|
||||
$item_id = intval($row['item_id']);
|
||||
|
||||
Reference in New Issue
Block a user