Ejemplo n.º 1
0
 public function get_id_confirm_view()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $upc = BarcodeLib::padUPC($this->id);
     $model = new ProductsModel($dbc);
     $model->upc($upc);
     foreach ($model->find('store_id') as $obj) {
         $obj->delete();
     }
     if (substr($upc, 0, 3) == '002') {
         $scaleQ = $dbc->prepare_statement("DELETE FROM scaleItems WHERE plu=?");
         $dbc->exec_statement($scaleQ, array($upc));
         $plu = substr($upc, 3, 4);
         \COREPOS\Fannie\API\item\HobartDgwLib::deleteItemsFromScales($plu);
         \COREPOS\Fannie\API\item\EpScaleLib::deleteItemsFromScales($plu);
     }
     $userP = $dbc->prepare("DELETE FROM productUser WHERE upc=?");
     $dbc->execute($userP, array($upc));
     if ($dbc->tableExists('prodExtra')) {
         $extraP = $dbc->prepare("DELETE FROM prodExtra WHERE upc=?");
         $dbc->execute($extraP, array($upc));
     }
     return '<div class="alert alert-success">Item deleted</div>';
 }
Ejemplo n.º 2
0
    if ($graphics) {
        $item_info['Graphics'] = $graphics;
    }
    // normalize type + bycount; they need to match
    if ($item_info['ByCount'] && $s_type == 'Random Weight') {
        $item_info['Type'] = 'By Count';
    } else {
        if ($s_type == 'Fixed Weight') {
            $item_info['Type'] = 'Fixed Weight';
            $item_info['ByCount'] = 1;
        } else {
            $item_info['Type'] = 'Random Weight';
            $item_info['ByCount'] = 0;
        }
    }
    \COREPOS\Fannie\API\item\HobartDgwLib::writeItemsToScales($item_info);
}
$udesc = isset($_REQUEST['u_desc']) ? $_REQUEST['u_desc'] : '';
$ubrand = isset($_REQUEST['u_brand']) ? $_REQUEST['u_brand'] : '';
$usize = isset($_REQUEST['u_size']) ? $_REQUEST['u_size'] : '';
$utext = isset($_REQUEST['u_long_text']) ? $_REQUEST['u_long_text'] : '';
$utext = str_replace("\r", "", $utext);
$utext = str_replace("\n", "<br />", $utext);
$utext = preg_replace("/[^-]/", "", $utext);
// strip non-ASCII (word copy/paste artifacts)
$uonline = isset($_REQUEST['u_enableOnline']) ? 1 : 0;
$uexpires = isset($_REQUEST['u_expires']) ? $_REQUEST['u_expires'] : '';
if (!empty($udesc) || !empty($ubrand) || !empty($usize)) {
    include $FANNIE_ROOT . 'src/Credentials/OutsideDB.is4c.php';
    $dbs = array($sql);
    $q = $sql->prepare("SELECT special_price,discounttype FROM products WHERE upc=?");
Ejemplo n.º 3
0
 function post_sendupc_handler()
 {
     global $FANNIE_OP_DB;
     $model = new ScaleItemsModel(FannieDB::get($FANNIE_OP_DB));
     $model->plu(BarcodeLib::padUPC($this->sendupc));
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $chkMap = $dbc->prepare('
         SELECT upc
         FROM ServiceScaleItemMap
         WHERE serviceScaleID=?
             AND upc=?
     ');
     $addMap = $dbc->prepare('
         INSERT INTO ServiceScaleItemMap
             (serviceScaleID, upc)
         VALUES
             (?, ?)
     ');
     $scales = $this->scalesFromIDs(FormLib::get('scaleID', array()));
     if ($model->load() && is_array($scales)) {
         $item_info = $this->getItemInfo($model);
         // go through scales one at a time
         // check whether item is present on that
         // scale and do write or change as appropriate
         foreach ($scales as $scale) {
             $chk = $dbc->execute($chkMap, array($scale['id'], $this->sendupc));
             if ($dbc->num_rows($chk) == 0) {
                 $dbc->execute($addMap, array($scale['id'], $this->sendupc));
                 $item_info['RecordType'] = 'WriteOneItem';
             } else {
                 $item_info['RecordType'] = 'ChangeOneItem';
             }
             \COREPOS\Fannie\API\item\HobartDgwLib::writeItemsToScales($item_info, array($scale));
         }
         echo '{error:0}';
     } else {
         echo '{error:1}';
     }
     return false;
 }