From: Janusz Dobrowolski Date: Sun, 31 Aug 2008 17:12:54 +0000 (+0000) Subject: Fixed item image file upload X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=5bb9ebf301870346d76fc3bfdc64161436d81e35;p=textcart.git Fixed item image file upload --- diff --git a/inventory/manage/items.php b/inventory/manage/items.php index 24335de..f842065 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -67,7 +67,6 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '') } elseif (file_exists($filename)) { - display_notification(_('Attempting to overwrite an existing item image')); $result = unlink($filename); if (!$result) { @@ -79,7 +78,6 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '') if ($upload_file == 'Yes') { $result = move_uploaded_file($_FILES['pic']['tmp_name'], $filename); - $message = ($result)?_('File url') ."$filename" : "Somthing is wrong with uploading a file."; } /* EOF Add Image upload for New Item - by Ori */ } @@ -149,7 +147,6 @@ if (isset($_POST['addupdate'])) display_notification(_("Item has been updated.")); set_focus('stock_id'); - $Ajax->activate('details'); //update image if any } else { //it is a NEW part @@ -165,8 +162,8 @@ if (isset($_POST['addupdate'])) $_POST['stock_id'] = $_POST['NewStockID']; $new_item = false; set_focus('stock_id'); - $Ajax->activate('_page_body'); } + $Ajax->activate('_page_body'); } } @@ -260,7 +257,7 @@ table_section_title(_("Item")); //------------------------------------------------------------------------------------ -if (!isset($_POST['NewStockID']) || $new_item) +if ($new_item) { /*If the page was called without $_POST['NewStockID'] passed to page then assume a new item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden stock_id field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/ @@ -322,14 +319,18 @@ start_table("$table_style2 width=40%"); start_row(); label_cells(_("Image File (.jpg)") . ":", ""); // Add Image upload for New Item - by Joe +$stock_img_link = "[";
 if (isset($_POST["; + // 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D. + $stock_img_link .= $_POST['NewStockID'].".jpg". + "]' src='$comp_path/$user_comp/images/".$_POST['NewStockID'].".jpg?nocache=".rand()."'"; } else { - $stock_img_link = "No Image"; + $stock_img_link .= _("No image"). "]'"; } +$stock_img_link .= " width='$pic_width' height='$pic_height' border='0'>"; label_cell($stock_img_link, "valign=top align=center rowspan=5"); end_row();