Beispiel #1
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();
         }
     }
 }
Beispiel #2
0
    } 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));
        }
    }
}
if (!empty($likeCode)) {
    if ($likeCode == -1) {
        $updateLikeQ = $sql->prepare("delete from upcLike where upc=?");