diff --git a/fannie/item/ajax.php b/fannie/item/ajax.php index 7e16877e24..3914b0c4cb 100644 --- a/fannie/item/ajax.php +++ b/fannie/item/ajax.php @@ -1,5 +1,6 @@ diff --git a/fannie/item/insertItem_WEFC_Toronto.php b/fannie/item/insertItem_WEFC_Toronto.php index af06f2c470..061cbf5f9b 100644 --- a/fannie/item/insertItem_WEFC_Toronto.php +++ b/fannie/item/insertItem_WEFC_Toronto.php @@ -22,7 +22,7 @@ *********************************************************************************/ /* --FUNCTIONALITY- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * These lines grepped in from this listing: !!grep "^/. [0-9]\." % + * These lines grepped in from this listing: !!grep "^/. [0-9]*\." % */ /* 1. Insert or update coop-specific product data */ /* 2. Replace likecode. */ @@ -31,8 +31,9 @@ /* 5. Insert to prodExtra */ /* 6. Insert to prodUpdate, an audit table. */ /* 7. Insert to scaleItem */ -/* 8. Delete and re-add to product-related tables on the lanes. */ -/* 9. Display the post-update values and an input for the next edit. */ +/* 8. Delete and re-add to product-related tables on the lanes. */ +/* 9. Display the post-update values and an input for the next edit. */ +/* 10. If requested on the capture form, pop a window for making a shelf tag. */ /* --COMMENTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ @@ -463,6 +464,7 @@ echo ""; + /* 10. If requested on the capture form, pop a window for making a shelf tag. */ if (isset($_REQUEST['newshelftag'])){ echo " - - - -Edit Item"; -echo ""; -echo "
"; -echo " Enter - or product name here
"; - -echo " "; -echo "
"; -} - -include ('../src/footer.html'); - -?> diff --git a/fannie/item/itemMaint.php b/fannie/item/itemMaint.php new file mode 120000 index 0000000000..8bfbeb73ed --- /dev/null +++ b/fannie/item/itemMaint.php @@ -0,0 +1 @@ +itemMaint_WEFC_Toronto.php \ No newline at end of file diff --git a/fannie/item/itemMaint_orig.php b/fannie/item/itemMaint_orig.php new file mode 100644 index 0000000000..ff0f87e434 --- /dev/null +++ b/fannie/item/itemMaint_orig.php @@ -0,0 +1,91 @@ + + + + + +Edit Item"; +echo ""; +echo "
"; +if ( isset($FANNIE_COOP_ID) && $FANNIE_COOP_ID == "WEFC_Toronto" ) { +echo "

Please use the WEFC Toronto Editor

"; +} else { +echo " Enter + or product name here
"; + +echo " "; +} +echo "
"; +} + +include ('../src/footer.html'); + +?> diff --git a/fannie/item/prodFunction.php b/fannie/item/prodFunction.php index 736622ba9e..3a6f1854e0 100644 --- a/fannie/item/prodFunction.php +++ b/fannie/item/prodFunction.php @@ -24,54 +24,66 @@ *********************************************************************************/ // TODO -- Add javascript for batcher product entry popup window ~joel 2007-08-21 +/* --COMMENTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + * 22Feb2013 Eric Lee Add support for editing + * products.quantity, .groupprice, .pricemethod, .mixmatchcode + * products.size, .unitofmeasure + * 10Feb2013 Eric Lee In itemParse add FANNIE_STORE_ID to globals. + +*/ + + include_once('../src/mysql_connect.php'); include_once('../auth/login.php'); include_once('ajax.php'); function itemParse($upc){ global $dbc,$FANNIE_URL; + global $FANNIE_STORE_ID; + global $FANNIE_COOP_ID; $logged_in = checkLogin(); $queryItem = ""; $numType = (isset($_REQUEST['ntype'])?$_REQUEST['ntype']:'UPC'); if(is_numeric($upc)){ - switch($numType){ - case 'UPC': - $upc = str_pad($upc,13,0,STR_PAD_LEFT); - $savedUPC = $upc; - $queryItem = "SELECT p.*,x.distributor,x.manufacturer - FROM products as p left join - prodExtra as x on p.upc=x.upc - WHERE (p.upc = '$upc' or x.upc = '$upc') - AND p.store_id=0"; - break; - case 'SKU': - $queryItem = "SELECT p.*,x.distributor,x.manufacturer - FROM products as p inner join - vendorItems as v ON p.upc=v.upc - left join prodExtra as x on p.upc=x.upc - WHERE v.sku='$upc' - AND p.store_id=0"; - break; - case 'Brand Prefix': - $queryItem = "SELECT p.*,x.distributor,x.manufacturer - FROM products as p left join - prodExtra as x on p.upc=x.upc - WHERE p.upc like '%$upc%' - AND p.store_id=0 - ORDER BY p.upc"; - break; - } + switch($numType){ + case 'UPC': + $upc = str_pad($upc,13,0,STR_PAD_LEFT); + $savedUPC = $upc; + $queryItem = "SELECT p.*,x.distributor,x.manufacturer + FROM products as p left join + prodExtra as x on p.upc=x.upc + WHERE (p.upc = '$upc' or x.upc = '$upc') + AND p.store_id=0"; + break; + case 'SKU': + $queryItem = "SELECT p.*,x.distributor,x.manufacturer + FROM products as p inner join + vendorItems as v ON p.upc=v.upc + left join prodExtra as x on p.upc=x.upc + WHERE v.sku='$upc' + AND p.store_id=0"; + break; + case 'Brand Prefix': + $queryItem = "SELECT p.*,x.distributor,x.manufacturer + FROM products as p left join + prodExtra as x on p.upc=x.upc + WHERE p.upc like '%$upc%' + AND p.store_id=0 + ORDER BY p.upc"; + break; + } }else{ + /* note: only search by HQ records (store_id=0) to avoid duplicates */ $queryItem = "SELECT p.*,x.distributor,x.manufacturer - FROM products AS p LEFT JOIN - prodExtra AS x ON p.upc=x.upc - WHERE description LIKE '%$upc%' - AND p.store_id=0 - ORDER BY description"; + FROM products AS p LEFT JOIN + prodExtra AS x ON p.upc=x.upc + WHERE description LIKE '%$upc%' + AND p.store_id=0 + ORDER BY description"; } - /* note: only search by HQ records (store_id=0) to avoid duplicates */ $resultItem = $dbc->query($queryItem); $num = $dbc->num_rows($resultItem); @@ -655,8 +667,13 @@ function itemParse($upc){ echo ''; echo "
"; - echo "Margin"; - MarginFS($rowItem['upc'],$rowItem['cost'],$rowItem['department']); + if ( isset($FANNIE_COOP_ID) && $FANNIE_COOP_ID == "WEFC_Torontx" ) { + echo "Markup"; + MarkupFS($rowItem['upc'],$rowItem['cost'],$rowItem['department']); + } else { + echo "Margin"; + MarginFS($rowItem['upc'],$rowItem['cost'],$rowItem['department']); + } echo "
"; echo '
'; diff --git a/fannie/item/prodFunction_WEFC_Toronto.php b/fannie/item/prodFunction_WEFC_Toronto.php index 278db7a032..6fb24f2fca 100644 --- a/fannie/item/prodFunction_WEFC_Toronto.php +++ b/fannie/item/prodFunction_WEFC_Toronto.php @@ -148,6 +148,7 @@ function itemParse($upc){ echo "testwindow.moveTo(50,50);"; echo "}"; echo ""; + echo ""; // 3. No match. Compose form for creation of a new item. if($num == 0 || !$num){ @@ -461,10 +462,10 @@ function itemParse($upc){ echo ""; echo ""; - echo ""; + echo ""; echo ""; - echo ""; + echo ""; echo ""; // This should really be in the db and be per-coop-configurable. @@ -885,7 +886,8 @@ function itemParse($upc){ "display:" . (array_search('Operations',$Fannie_Item_Modules) !== False?'block':'none') . ";'>"; echo "
Operations"; echo "
"; @@ -981,10 +983,10 @@ function itemParse($upc){ echo "
Start Date
End Date
Sale for
"; echo ""; - echo ""; + echo ""; echo ""; - echo ""; + echo ""; echo ""; // This should really be in the db and be per-coop-configurable. diff --git a/fannie/item/updateItems.php b/fannie/item/updateItems.php index 2dbd35f9dd..8680c4cb41 100644 --- a/fannie/item/updateItems.php +++ b/fannie/item/updateItems.php @@ -20,6 +20,23 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *********************************************************************************/ + +/* --FUNCTIONALITY- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * This piece of code does quite a few things. Items below are grepped from the listing. + +/* Xel. Validate credentials of the operator. */ +/* Xel. Notify dept manager of the new values. */ +/* Xel. Insert or update products */ +/* Xel. Apply HQ updates to non-HQ records */ +/* Xel. Insert or update prodExtra */ +/* Xel. Insert or update prodUpdate */ +/* Xel. Insert or update scaleItems */ +/* Xel. Update product-related tables on the lanes. */ +/* Xel. Update likecodes */ +/* Xel. Display the post-update values. */ + +/* */ + include('../config.php'); require_once('../src/mysql_connect.php'); @@ -35,6 +52,10 @@ $upc = str_pad($_REQUEST['upc'],'0',13,STR_PAD_LEFT); +/* Establish values for all products fields + formatted for writing to the database + either from the form or defaults suitable for a new record. +*/ $up_array = array(); $up_array['tax'] = isset($_REQUEST['tax'])?$_REQUEST['tax']:0; $up_array['foodstamp'] = isset($_REQUEST['FS'])?1:0; @@ -100,6 +121,7 @@ if ($dbc->num_rows($sR) > 0) $sID = array_pop($dbc->fetch_row($sR)); +/* Xel. Validate credentials of the operator. */ $uid = 0; if (!$validatedUser && !$auditedUser && $logged_in){ $validatedUser = validateUserQuiet('pricechange',$subdepartment); @@ -112,12 +134,14 @@ $auditedUID = getUID($auditedUser); $uid = $auditedUID; include('audit.php'); +/* Xel. Notify dept manager of the new values. */ if (!empty($likeCode)) audit($sID,$auditedUser,$upc,$descript,$price,$tax,$FS,$Scale,$NoDisc,$likeCode); else audit($sID,$auditedUser,$upc,$descript,$price,$tax,$FS,$Scale,$NoDisc); } +/* Xel. Insert or update products */ if ($up_array['store_id'] == $FANNIE_STORE_ID){ // record exists so update it $dbc->smart_update('products',$up_array,"upc='$upc'"); @@ -132,7 +156,9 @@ $up_array['specialpricemethod'] = 0; $up_array['specialgroupprice'] = 0.00; $up_array['specialquantity'] = 0; + // EL When these are assignable don't use defaults $up_array['mixmatchcode'] = "'0'"; + // $up_array['discounttype'] = 0; $up_array['start_date'] = "'1900-01-01'"; $up_array['end_date'] = "'1900-01-01'"; @@ -141,9 +167,9 @@ $dbc->smart_insert('products',$up_array); } +/* Xel. Apply HQ updates to non-HQ records */ // apply HQ updates to non-HQ records -// where the current value matches the old -// HQ value +// where the current value matches the old HQ value if ($FANNIE_STORE_ID==0 && count($CHANGES) > 0){ foreach($CHANGES as $col => $values){ $v_old = is_numeric($values['old']) ? $values['old'] : $dbc->escape($values['old']); @@ -158,6 +184,7 @@ } } +/* Xel. Insert or update prodExtra */ if ($dbc->table_exists('prodExtra')){ $arr = array(); $arr['manufacturer'] = $dbc->escape($_REQUEST['manufacturer']); @@ -180,6 +207,7 @@ $dbc->smart_update('prodExtra',$arr,"upc='$upc'"); } } +/* Xel. Insert or update prodUpdate: audit trail */ if ($dbc->table_exists("prodUpdate")){ $puarray = array( 'upc' => $dbc->escape($upc), @@ -198,6 +226,7 @@ ); $dbc->smart_insert('prodUpdate',$puarray); } +/* Xel. Insert or update scaleItems */ if(isset($_REQUEST['s_plu'])){ $s_plu = substr($_REQUEST['s_plu'],3,4); $scale_array = array(); @@ -247,10 +276,12 @@ $scale_array['label'],($scale_array['graphics']==1)?121:0); } +/* Xel. Update product-related tables on the lanes. */ /* push updates to the lanes */ include('laneUpdates.php'); updateProductAllLanes($upc); +/* Xel. Update likecodes */ /* update the item's likecode if specified also update other items in the likecode if the appropriate box isn't checked */ @@ -275,6 +306,7 @@ } +/* Xel. Display the post-update values. */ $query1 = "SELECT upc,description,normal_price,department,subdept, foodstamp,scale,qttyEnforced,discount,inUse,deposit FROM products WHERE upc = '$upc'"; @@ -283,7 +315,7 @@ echo "
Start Date
End Date
Sale for
"; echo ""; - echo ""; + echo ""; echo "
UPC".$row['upc']."
Description{$row['description']}
DescriptionNew{$row['description']}Price\${$row['normal_price']}
"; echo ""; echo "
DeptsubDeptFSScaleQtyFrcNoDiscinUsedeposit"; @@ -336,7 +368,8 @@ echo "
"; echo "
"; echo "
"; - echo " Enter UPC/PLU here
"; + echo " Enter UPC/PLU here
"; + echo "To add a new item enter its UPC/PLU.
"; echo ""; echo "
"; ?> diff --git a/fannie/item/updateItems_WEFC_Toronto.php b/fannie/item/updateItems_WEFC_Toronto.php index 96e5413130..5ee350cdb0 100644 --- a/fannie/item/updateItems_WEFC_Toronto.php +++ b/fannie/item/updateItems_WEFC_Toronto.php @@ -35,6 +35,7 @@ /* 9. Insert or update scaleItems */ /* 10. Delete and re-add to product-related tables on the lanes. */ /* 11. Display the post-update values and an input for the next edit. */ +/* 12. If requested on the capture form, pop a window for making a shelf tag. */ /* * This code INSERTs when the record for the fields doesn't exist, @@ -545,6 +546,14 @@ echo promptForUPC($upc); echo ""; + + /* 12. If requested on the capture form, pop a window for making a shelf tag. */ + if (isset($_REQUEST['newshelftag'])){ + echo ""; + } ?>