$stock_id = $_POST['NewStockID'];
$result = $_FILES['pic']['error'];
$upload_file = 'Yes'; //Assume all is well to start off with
- $filename = $comp_path . "/$user_comp/images";
+ $filename = company_path().'/images';
if (!file_exists($filename))
{
mkdir($filename);
{
if (check_value('del_image'))
{
- $filename = $comp_path . "/$user_comp/images/".item_img_name($_POST['NewStockID']).".jpg";
+ $filename = company_path().'/images/'.item_img_name($_POST['NewStockID']).".jpg";
if (file_exists($filename))
unlink($filename);
}
$stock_id = $_POST['NewStockID'];
delete_item($stock_id);
- $filename = $comp_path . "/$user_comp/images/".item_img_name($stock_id).".jpg";
+ $filename = company_path().'/images/'.item_img_name($stock_id).".jpg";
if (file_exists($filename))
unlink($filename);
display_notification(_("Selected item has been deleted."));
if (db_has_stock_items())
{
- start_table("class='tablestyle_noborder'");
+ start_table(TABLESTYLE_NOBORDER);
start_row();
stock_items_list_cells(_("Select an item:"), 'stock_id', null,
_('New item'), true, check_value('show_inactive'));
}
div_start('details');
-start_outer_table($table_style2, 5);
+start_outer_table(TABLESTYLE2);
table_section(1);
}
else
{ // Must be modifying an existing item
+ if (!isset($_POST['NewStockID'])) {
$_POST['NewStockID'] = $_POST['stock_id'];
$myrow = get_item($_POST['NewStockID']);
$_POST['del_image'] = 0;
$_POST['inactive'] = $myrow["inactive"];
$_POST['editable'] = $myrow["editable"];
- label_row(_("Item Code:"),$_POST['NewStockID']);
- hidden('NewStockID', $_POST['NewStockID']);
- set_focus('description');
+ }
+ label_row(_("Item Code:"),$_POST['NewStockID']);
+ hidden('NewStockID', $_POST['NewStockID']);
+ set_focus('description');
}
text_row(_("Name:"), 'description', null, 52, 50);
table_section_title(_("Other"));
// Add image upload for New Item - by Joe
-label_row(_("Image File (.jpg)") . ":", "<input type='file' id='pic' name='pic'>");
+file_row(_("Image File (.jpg)") . ":", 'pic', 'pic');
// Add Image upload for New Item - by Joe
$stock_img_link = "";
$check_remove_image = false;
-if (isset($_POST['NewStockID']) && file_exists("$comp_path/$user_comp/images/"
+if (isset($_POST['NewStockID']) && file_exists(company_path().'/images/'
.item_img_name($_POST['NewStockID']).".jpg"))
{
// 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
$stock_img_link .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
- "]' src='$comp_path/$user_comp/images/".item_img_name($_POST['NewStockID']).".jpg?nocache=".rand()."'".
- " height='$pic_height' border='0'>";
- $check_remove_image = true;
+ "]' src='".company_path().'images/'.item_img_name($_POST['NewStockID']).
+ ".jpg?nocache=".rand()."'"." height='$pic_height' border='0'>";
+ $check_remove_image = true;
}
else
{