Exemple #1
0
 public function post_id_handler()
 {
     $dbc = FannieDB::get($this->config->get('OP_DB'));
     $new = FormLib::get('new-upc');
     if ($new == '') {
         $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'danger', 'New UPC cannot be blank');\n");
         return true;
     }
     $new = BarcodeLib::padUPC($new);
     $model = new ProductsModel($dbc);
     $model->upc($new);
     if ($model->load()) {
         $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'danger', 'New item {$new} already exists');\n");
         return true;
     }
     $model->reset();
     $model->upc(BarcodeLib::padUPC($this->id));
     if (!$model->load()) {
         $this->addOnloadCommand("showBootstrapAlert('#alert-area', 'danger', 'Source item " . $model->upc() . " not found');\n");
         return true;
     }
     $model->upc($new);
     $description = substr('CLONE ' . $model->description(), 0, 30);
     $model->description($description);
     $model->store_id(1);
     $model->save();
     if ($dbc->tableExists('prodExtra')) {
         $extra = new ProdExtraModel($dbc);
         $extra->upc(BarcodeLib::padUPC($this->id));
         $extra->load();
         $extra->upc($new);
         $extra->save();
     }
     if ($dbc->tableExists('productUser')) {
         $user = new ProductUserModel($dbc);
         $user->upc(BarcodeLib::padUPC($this->id));
         $user->load();
         $user->upc($new);
         $user->save();
     }
     header('Location: ItemEditorPage.php?searchupc=' . $new);
     return false;
 }
Exemple #2
0
 public function SaveFormData($upc)
 {
     $local = $this->db();
     $upc = BarcodeLib::padUPC($upc);
     $pu = new ProductUserModel($local);
     $pu->upc($upc);
     $pu->enableOnline(FormLib::get('u_online') == 1 ? 1 : 0);
     $pu->soldOut(FormLib::get('u_soldout') == 1 ? 1 : 0);
     $pu->save();
     include dirname(__FILE__) . '/../../src/Credentials/OutsideDB.tunneled.php';
     $remote = $dbc;
     $pu->load();
     if ($pu->enableOnline() && $remote->isConnected()) {
         $pu->setConnection($remote);
         $pu->save();
         $prod = new ProductsModel($local);
         $prod->upc($upc);
         $prod->load();
         $prod->setConnection($remote);
         $prod->save();
     } elseif (FormLib::get('u_already_online') && $remote->isConnected()) {
         $prod = new ProductsModel($remote);
         $prod->upc($upc);
         $prod->delete();
     }
     if ($local->tableExists('productExpires')) {
         $e = new ProductExpiresModel($local);
         $e->upc($upc);
         $e->expires(FormLib::getDate('u_expires', date('Y-m-d')));
         $e->save();
         if ($e->expires() && $remote->isConnected()) {
             $e->setConnection($remote);
             $e->save();
         }
     }
 }
Exemple #3
0
 $w = $sql->fetch_row($r);
 if ($uonline == 0) {
     $del = $dbc->prepare("DELETE FROM productUser WHERE upc=?");
     $dbc->execute($del, array($upc));
     $del = $dbc->prepare("DELETE FROM productExpires WHERE upc=?");
     $dbc->execute($del, array($upc));
 } else {
     $dbs[] = $dbc;
     $del = $dbc->prepare("DELETE FROM products WHERE upc=?");
     $dbc->execute($del, array($upc));
     $query99 = $dbc->prepare("INSERT INTO products (upc,description,normal_price,pricemethod,groupprice,quantity,special_price,specialpricemethod,\n                specialgroupprice,specialquantity,start_date,end_date,department,size,tax,foodstamp,scale,scaleprice,mixmatchcode,\n                modified,tareweight,discount,discounttype,unitofmeasure,wicable,qttyEnforced,idEnforced,cost,inUse,numflag,\n                subdept,deposit,local)\n                VALUES(?,?,?,0,0.00,0,?,0,0.00,0,'','',?,0,?,?,?,0,0,now(),0,?,\n                ?,0,0,0,0,0.00,1,\n                0,0,0.00,?)");
     $dbc->execute($query99, array($upc, $descript, $price, $w['special_price'], $dept, $tax, $FS, $Scale, $NoDisc, $w['discounttype'], $local));
 }
 foreach ($dbs as $con) {
     $char = strstr($utext, "start");
     $pu_model = new ProductUserModel($con);
     $pu_model->upc($upc);
     $pu_model->brand($ubrand);
     $pu_model->description($udesc);
     $pu_model->sizing($usize);
     $pu_model->long_text($utext);
     $pu_model->enableOnline($uonline);
     $pu_model->save();
     $prep = $con->prepare("SELECT * FROM productExpires WHERE upc=?");
     $chk = $con->execute($prep, array($upc));
     if ($con->num_rows($chk) == 0) {
         $ins = $con->prepare("INSERT INTO productExpires (upc,expires) VALUES (?, ?)");
         $con->execute($ins, array($upc, $uexpires));
     } else {
         $up = $con->prepare("UPDATE productExpires SET expires=? WHERE upc=?");
         $con->execute($up, array($uexpires, $upc));
Exemple #4
0
 /**
   Log deletes to prodUpdate
   Delete corresponding records from other tables
 */
 public function delete()
 {
     $update = new ProdUpdateModel($this->connection);
     $update->upc($this->upc());
     $update->logUpdate(ProdUpdateModel::UPDATE_DELETE);
     $try = parent::delete();
     if ($try) {
         if ($this->connection->tableExists('prodExtra')) {
             $extra = new ProdExtraModel($this->connection);
             $extra->upc($this->upc());
             $extra->delete();
         }
         $user = new ProductUserModel($this->connection);
         $user->upc($this->upc());
         $user->delete();
     }
     return $try;
 }
Exemple #5
0
 function ajax_response()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     switch (FormLib::get_form_value('ajax')) {
         case 'save':
             $upc = FormLib::get_form_value('upc');
             $store_id = FormLib::get('store_id');
             $upc = BarcodeLib::padUPC($upc);
             $values = array();
             $model = new ProductsModel($dbc);
             $model->upc($upc);
             $model->store_id($store_id);
             $brand = FormLib::get('brand');
             if ($brand !== '') {
                 $model->brand($brand);
             }
             $desc = FormLib::get_form_value('desc');
             if ($desc !== '') {
                 $model->description($desc);
             }
             $dept = FormLib::get_form_value('dept');
             if ($dept !== '') {
                 $model->department($dept);
             }
             $price = rtrim(FormLib::get_form_value('price'), ' ');
             if ($price !== '') {
                 $model->normal_price($price);
             }
             $cost = rtrim(FormLib::get_form_value('cost'), ' ');
             if ($cost !== '') {
                 $model->cost($cost);
             }
             $tax = FormLib::get_form_value('tax');
             if ($tax !== '') {
                 $model->tax($tax);
             }
             $fsx = FormLib::get_form_value('fs');
             if ($fsx !== '') {
                 $model->foodstamp($fsx);
             }
             $disc = FormLib::get_form_value('disc');
             if ($disc !== '') {
                 $model->discount($disc);
             }
             $wgt = FormLib::get_form_value('wgt');
             if ($wgt !== '') {
                 $model->scale($wgt);
             }
             $loc = FormLib::get_form_value('local');
             if ($loc !== '') {
                 $model->local($loc);
             }
             $supplier = FormLib::get_form_value('supplier');
             /**
               Normalize free-form supplier text
               Look up corresponding vendor ID
             */
             $vendorID = '';
             $vendors = new VendorsModel($dbc);
             $vendors->vendorName($supplier);
             foreach ($vendors->find() as $obj) {
                 $vendorID = $obj->vendorID();
                 break;
             }
             if ($vendorID !== '') {
                 $model->default_vendor_id($vendorID);
             }
             $model->save();
             $chkP = $dbc->prepare('SELECT upc FROM prodExtra WHERE upc=?');
             $chkR = $dbc->execute($chkP, array($upc));
             if ($dbc->num_rows($chkR) > 0) {
                 $extraP = $dbc->prepare_statement('UPDATE prodExtra SET manufacturer=?, distributor=? WHERE upc=?');
                 $dbc->exec_statement($extraP, array($brand, $supplier, $upc));
             } else {
                 $extraP = $dbc->prepare('INSERT INTO prodExtra
                             (upc, variable_pricing, margin, manufacturer, distributor)
                             VALUES
                             (?, 0, 0, ?, ?)');
                 $dbc->execute($extraP, array($upc, $brand, $supplier));
             }
             if ($vendorID !== '') {
                 $item = new VendorItemsModel($dbc);
                 $item->createIfMissing($upc, $vendorID);
                 $item->updateCostByUPC($upc, $cost, $vendorID);
             }
             updateProductAllLanes($upc);
             break;
         case 'deleteCheck':
             $upc = FormLib::get_form_value('upc');
             $upc = BarcodeLib::padUPC($upc);
             $encoded_desc = FormLib::get_form_value('desc');
             $desc = base64_decode($encoded_desc);
             $fetchP = $dbc->prepare_statement("select normal_price,\n                special_price,t.description,\n                case when foodstamp = 1 then 'Yes' else 'No' end as fs,\n                case when scale = 1 then 'Yes' else 'No' end as s\n                from products as p left join taxrates as t\n                on p.tax = t.id\n                where upc=? and p.description=?");
             $fetchR = $dbc->exec_statement($fetchP, array($upc, $desc));
             $fetchW = $dbc->fetch_array($fetchR);
             $ret = "Delete item {$upc} - {$desc}?\n";
             $ret .= "Normal price: " . rtrim($fetchW[0]) . "\n";
             $ret .= "Sale price: " . rtrim($fetchW[1]) . "\n";
             $ret .= "Tax: " . rtrim($fetchW[2]) . "\n";
             $ret .= "Foodstamp: " . rtrim($fetchW[3]) . "\n";
             $ret .= "Scale: " . rtrim($fetchW[4]) . "\n";
             $json = array('alertBox' => $ret, 'upc' => ltrim($upc, '0'), 'enc_desc' => $encoded_desc);
             echo json_encode($json);
             break;
         case 'doDelete':
             $upc = FormLib::get_form_value('upc');
             $upc = BarcodeLib::padUPC($upc);
             $desc = base64_decode(FormLib::get_form_value('desc'));
             $update = new ProdUpdateModel($dbc);
             $update->upc($upc);
             $update->logUpdate(ProdUpdateModel::UPDATE_DELETE);
             $model = new ProductsModel($dbc);
             $model->upc($upc);
             $model->delete();
             $model = new ProductUserModel($dbc);
             $model->upc($upc);
             $model->delete();
             $model = new ScaleItemsModel($dbc);
             $model->plu($upc);
             $model->delete();
             $delP = $dbc->prepare_statement("delete from prodExtra where upc=?");
             $delXR = $dbc->exec_statement($delP, array($upc));
             $delP = $dbc->prepare_statement("DELETE FROM upcLike WHERE upc=?");
             $delR = $dbc->exec_statement($delP, array($upc));
             deleteProductAllLanes($upc);
             break;
         default:
             echo 'Unknown Action';
             break;
     }
 }
Exemple #6
0
 public function process_file($linedata)
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $upc_index = $this->get_column_index('upc');
     $desc_index = $this->get_column_index('desc');
     $size_index = $this->get_column_index('size');
     $brand_index = $this->get_column_index('brand');
     $sku_index = $this->get_column_index('sku');
     if ($desc_index === false && $brand_index === false) {
         $this->error_details = 'Neither brand nor description provided; nothing to import!';
         return false;
     }
     $ret = true;
     $checks = FormLib::get_form_value('checks') == 'yes' ? true : false;
     $normalize = FormLib::get_form_value('norm') == 'yes' ? true : false;
     $model = new ProductUserModel($dbc);
     $verifyP = $dbc->prepare('
         SELECT p.upc
         FROM products AS p
         WHERE p.upc = ?
     ');
     $skuP = $dbc->prepare('
         SELECT p.upc
         FROM vendorItems AS v
             INNER JOIN products AS p ON v.upc=p.upc AND p.default_vendor_id=v.vendorID
         WHERE v.sku = ?
     ');
     foreach ($linedata as $line) {
         $upc = $line[$upc_index];
         // upc cleanup
         $upc = str_replace(" ", "", $upc);
         $upc = str_replace("-", "", $upc);
         if (!is_numeric($upc)) {
             continue;
         }
         // skip header(s) or blank rows
         $this->stats['total']++;
         if ($checks) {
             $upc = substr($upc, 0, strlen($upc) - 1);
         }
         $upc = BarcodeLib::padUPC($upc);
         $verifyR = $dbc->execute($verifyP, array($upc));
         if ($dbc->num_rows($verifyR) == 0) {
             if ($sku_index !== false) {
                 $skuR = $dbc->execute($skuP, array($line[$sku_index]));
                 if ($dbc->num_rows($skuR) == 0) {
                     // no UPC match, no vendor sku match
                     continue;
                 } else {
                     $skuW = $dbc->fetch_row($skuR);
                     $upc = $skuW['upc'];
                 }
             } else {
                 // item does not exist, no vendor sku provided
                 continue;
             }
         }
         $model->reset();
         $model->upc($upc);
         $model->load();
         $changed = false;
         if ($model->brand() == '' && $brand_index !== false && !empty($line[$brand_index])) {
             $brand = $line[$brand_index];
             if ($normalize) {
                 $brand = ucwords(strtolower($brand));
             }
             $model->brand($brand);
             $changed = true;
         }
         if ($model->description() == '' && $desc_index !== false && !empty($line[$desc_index])) {
             $desc = $line[$desc_index];
             if ($normalize) {
                 $desc = ucwords(strtolower($desc));
             }
             $model->description($desc);
             if ($upc == '0002529300278') {
                 var_dump($model->description());
             }
             $changed = true;
         }
         if ($model->sizing() == '' && $size_index !== false && !empty($line[$size_index])) {
             $size = $line[$size_index];
             $model->sizing($size);
             $changed = true;
         }
         // possible that columns exist for brand and/or description
         // but are blank for the given row. No need to update.
         if ($changed) {
             $model->save();
             $this->stats['here']++;
         }
     }
     return $ret;
 }
Exemple #7
0
 protected function updateRealItem($upc, $brand, $description)
 {
     $dbc = $this->getDB();
     $model = new \ProductUserModel($dbc);
     $model->upc(\BarcodeLib::padUPC($upc));
     $model->brand($brand);
     $model->description($description);
     $model->save();
     $model = new \ProductsModel($dbc);
     $model->upc(\BarcodeLib::padUPC($upc));
     foreach ($model->find('store_id') as $obj) {
         $obj->brand($brand);
         $obj->save();
     }
 }
Exemple #8
0
 function SaveFormData($upc)
 {
     $upc = BarcodeLib::padUPC($upc);
     $brand = FormLib::get('lf_brand');
     $desc = FormLib::get('lf_desc');
     $origin = FormLib::get('origin', 0);
     $floorID = FormLib::get('floor-id', 0);
     $text = FormLib::get('lf_text');
     $text = str_replace("\r", '', $text);
     $text = str_replace("\n", '<br />', $text);
     // strip non-ASCII (word copy/paste artifacts)
     $text = preg_replace("/[^-]/", "", $text);
     $signs = FormLib::get('sign-count', 1);
     if ($signs < 1) {
         $signs = 1;
     }
     $dbc = $this->db();
     $loc = new ProdPhysicalLocationModel($dbc);
     $loc->upc($upc);
     $loc->floorSectionID($floorID);
     $loc->save();
     $model = new ProductUserModel($dbc);
     $model->upc($upc);
     $model->brand($brand);
     $model->description($desc);
     $model->long_text($text);
     $model->signCount($signs);
     $multiOrigin = FormLib::get('otherOrigin', array());
     $originMap = array();
     if ($origin != 0) {
         $originMap[] = $origin;
     }
     foreach ($multiOrigin as $originID) {
         if ($originID != 0) {
             $originMap[] = $originID;
         }
     }
     $mapP = $dbc->prepare('DELETE FROM ProductOriginsMap WHERE upc=?');
     $addP = $dbc->prepare('INSERT INTO ProductOriginsMap
                             (originID, upc, active)
                             VALUES (?, ?, 1)');
     $lcP = $dbc->prepare('SELECT u.upc
                         FROM upcLike AS u
                             ' . DTrans::joinProducts('u', 'p', 'INNER') . '
                         WHERE u.likeCode IN (
                             SELECT l.likeCode
                             FROM upcLike AS l
                             WHERE l.upc = ?
                         )');
     $lcR = $dbc->execute($lcP, array($upc));
     $items = array($upc);
     while ($w = $dbc->fetch_row($lcR)) {
         if ($w['upc'] == $upc) {
             continue;
         }
         $items[] = $w['upc'];
     }
     $prod = new ProductsModel($dbc);
     $stores = new StoresModel($dbc);
     foreach ($items as $item) {
         $prod->upc($item);
         $prod->store_id(1);
         $prod->current_origin_id($origin);
         $prod->save();
         $dbc->execute($mapP, array($item));
         foreach ($originMap as $originID) {
             $dbc->execute($addP, array($originID, $item));
         }
     }
     return $model->save();
 }
Exemple #9
0
 function SaveFormData($upc)
 {
     $FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
     $upc = BarcodeLib::padUPC($upc);
     $dbc = $this->db();
     $model = new ProductsModel($dbc);
     $model->upc($upc);
     if (!$model->load()) {
         // fully init new record
         $model->special_price(0);
         $model->specialpricemethod(0);
         $model->specialquantity(0);
         $model->specialgroupprice(0);
         $model->advertised(0);
         $model->tareweight(0);
         $model->start_date('0000-00-00');
         $model->end_date('0000-00-00');
         $model->discounttype(0);
         $model->wicable(0);
         $model->scaleprice(0);
         $model->inUse(1);
     }
     $stores = FormLib::get('store_id', array());
     for ($i = 0; $i < count($stores); $i++) {
         $model->store_id($stores[$i]);
         $taxes = FormLib::get('tax');
         if (isset($taxes[$i])) {
             $model->tax($taxes[$i]);
         }
         $fs = FormLib::get('FS', array());
         if (in_array($stores[$i], $fs)) {
             $model->foodstamp(1);
         } else {
             $model->foodstamp(0);
         }
         $scale = FormLib::get('Scale', array());
         if (in_array($stores[$i], $scale)) {
             $model->scale(1);
         } else {
             $model->scale(0);
         }
         $qtyFrc = FormLib::get('QtyFrc', array());
         if (in_array($stores[$i], $qtyFrc)) {
             $model->qttyEnforced(1);
         } else {
             $model->qttyEnforced(0);
         }
         $wic = FormLib::get('prod-wicable', array());
         if (in_array($stores[$i], $wic)) {
             $model->wicable(1);
         } else {
             $model->wicable(0);
         }
         $discount_setting = FormLib::get('discount');
         if (isset($discount_setting[$i])) {
             switch ($discount_setting[$i]) {
                 case 0:
                     $model->discount(0);
                     $model->line_item_discountable(0);
                     break;
                 case 1:
                     $model->discount(1);
                     $model->line_item_discountable(1);
                     break;
                 case 2:
                     $model->discount(1);
                     $model->line_item_discountable(0);
                     break;
                 case 3:
                     $model->discount(0);
                     $model->line_item_discountable(1);
                     break;
             }
         }
         $price = FormLib::get('price');
         if (isset($price[$i])) {
             $model->normal_price($price[$i]);
         }
         $cost = FormLib::get('cost');
         if (isset($cost[$i])) {
             $model->cost($cost[$i]);
         }
         $desc = FormLib::get('descript');
         if (isset($desc[$i])) {
             $model->description(str_replace("'", '', $desc[$i]));
         }
         $brand = FormLib::get('manufacturer');
         if (isset($brand[$i])) {
             $model->brand(str_replace("'", '', $brand[$i]));
         }
         $model->pricemethod(0);
         $model->groupprice(0.0);
         $model->quantity(0);
         $dept = FormLib::get('department');
         if (isset($dept[$i])) {
             $model->department($dept[$i]);
         }
         $size = FormLib::get('size');
         if (isset($size[$i])) {
             $model->size($size[$i]);
         }
         $model->modified(date('Y-m-d H:i:s'));
         $unit = FormLib::get('unitm');
         if (isset($unit[$i])) {
             $model->unitofmeasure($unit[$i]);
         }
         $subdept = FormLib::get('subdept');
         if (isset($subdept[$i])) {
             $model->subdept($subdept[$i]);
         }
         // lookup vendorID by name
         $vendorID = 0;
         $v_input = FormLib::get('distributor');
         if (isset($v_input[$i])) {
             $vendor = new VendorsModel($dbc);
             $vendor->vendorName($v_input[$i]);
             foreach ($vendor->find('vendorID') as $obj) {
                 $vendorID = $obj->vendorID();
                 break;
             }
         }
         $model->default_vendor_id($vendorID);
         $inUse = FormLib::get('prod-in-use', array());
         if (in_array($stores[$i], $inUse)) {
             $model->inUse(1);
         } else {
             $model->inUse(0);
         }
         $idEnf = FormLib::get('id-enforced', array());
         if (isset($idEnf[$i])) {
             $model->idEnforced($idEnf[$i]);
         }
         $local = FormLib::get('prod-local');
         if (isset($local[$i])) {
             $model->local($local[$i]);
         }
         $deposit = FormLib::get('deposit-upc');
         if (isset($deposit[$i])) {
             if ($deposit[$i] == '') {
                 $deposit[$i] = 0;
             }
             $model->deposit($deposit[$i]);
         }
         /* products.formatted_name is intended to be maintained automatically.
          * Get all enabled plugins and standard modules of the base.
          * Run plugins first, then standard modules.
          */
         $formatters = FannieAPI::ListModules('ProductNameFormatter');
         $fmt_name = "";
         $fn_params = array('index' => $i);
         foreach ($formatters as $formatter_name) {
             $formatter = new $formatter_name();
             $fmt_name = $formatter->compose($fn_params);
             if (isset($formatter->this_mod_only) && $formatter->this_mod_only) {
                 break;
             }
         }
         $model->formatted_name($fmt_name);
         $model->save();
     }
     /**
       If a vendor is selected, intialize
       a vendorItems record
     */
     if ($vendorID != 0) {
         $vitem = new VendorItemsModel($dbc);
         $vitem->vendorID($vendorID);
         $vitem->upc($upc);
         $sku = FormLib::get('vendorSKU');
         if (empty($sku)) {
             $sku = $upc;
         } else {
             /**
               If a SKU is provided, update any
               old record that used the UPC as a
               placeholder SKU.
             */
             $existsP = $dbc->prepare('
                 SELECT sku
                 FROM vendorItems
                 WHERE sku=?
                     AND upc=?
                     AND vendorID=?');
             $existsR = $dbc->execute($existsP, array($sku, $upc, $vendorID));
             if ($dbc->numRows($existsR) > 0 && $sku != $upc) {
                 $delP = $dbc->prepare('
                     DELETE FROM vendorItems
                     WHERE sku =?
                         AND upc=?
                         AND vendorID=?');
                 $dbc->execute($delP, array($upc, $upc, $vendorID));
             } else {
                 $fixSkuP = $dbc->prepare('
                     UPDATE vendorItems
                     SET sku=?
                     WHERE sku=?
                         AND vendorID=?');
                 $dbc->execute($fixSkuP, array($sku, $upc, $vendorID));
             }
         }
         $vitem->sku($sku);
         $vitem->size($model->size());
         $vitem->description($model->description());
         $vitem->brand($model->brand());
         $vitem->units(FormLib::get('caseSize', 1));
         $vitem->cost($model->cost());
         $vitem->save();
     }
     if ($dbc->table_exists('prodExtra')) {
         $extra = new ProdExtraModel($dbc);
         $extra->upc($upc);
         if (!$extra->load()) {
             $extra->variable_pricing(0);
             $extra->margin(0);
             $extra->case_quantity('');
             $extra->case_cost(0.0);
             $extra->case_info('');
         }
         $brand = FormLib::get('manufacturer');
         if (isset($brand[0])) {
             $extra->manufacturer(str_replace("'", '', $brand[0]));
         }
         $dist = FormLib::get('distributor');
         if (isset($dist[0])) {
             $extra->distributor(str_replace("'", '', $dist[0]));
         }
         $cost = FormLib::get('cost');
         if (isset($cost[0])) {
             $extra->cost($cost[0]);
         }
         $extra->save();
     }
     if (!isset($FANNIE_PRODUCT_MODULES['ProdUserModule'])) {
         if ($dbc->table_exists('productUser')) {
             $ldesc = FormLib::get_form_value('puser_description');
             $model = new ProductUserModel($dbc);
             $model->upc($upc);
             $model->description($ldesc);
             $model->save();
         }
     }
 }