Beispiel #1
0
 function preprocess()
 {
     global $FANNIE_OP_DB;
     $id = FormLib::get_form_value('id', 0);
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $tags = new ShelftagsModel($dbc);
     $tags->id($id);
     $current_set = $tags->find();
     if (count($current_set) == 0) {
         $this->messages = '<div class="alert alert-info">
             Barcode table is already empty. <a href="ShelfTagIndex.php">Click here to continue</a>
             </div>';
         return true;
     }
     if (FormLib::get('submit', false) === '1') {
         /**
           Shelftags are not actually delete immediately
           Instead, the id field is negated so they disappear
           from view but can be manually retreived by IT if 
           someone comes complaining that they accidentally
           delete their tags (not that such a thing would
           ever occur). They're properly deleted by the 
           nightly.clipboard cron job.
         
           If the same user deletes the same UPC from tags
           multiple times in a day, the above procedure creates
           a primary key conflict. So any negative-id records
           that will create conflicts must be removed first.
         */
         $new_id = -1 * $id;
         if ($id == 0) {
             $new_id = -999;
         }
         $clear = new ShelftagsModel($dbc);
         $clear->id($new_id);
         foreach ($current_set as $tag) {
             // delete existing negative id tag for upc
             $clear->upc($tag->upc());
             $clear->delete();
             // save tag as negative id
             $old_id = $tag->id();
             $tag->id($new_id);
             $tag->save();
             $tag->id($old_id);
             $tag->delete();
         }
         $this->messages = '<div class="alert alert-success">
             Barcode table cleared <a href="ShelfTagIndex.php">Click here to continue</a>
             </div>';
         return true;
     } else {
         $this->messages = '<div class="alert alert-danger">
             <a href="DeleteShelfTags.php?id=' . $id . '&submit=1">Click 
             here to clear barcodes</a></div>';
         return true;
     }
     return true;
 }
Beispiel #2
0
 public function delete_id_upc_confirm_handler()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $tag = new ShelftagsModel($dbc);
     $tag->id($this->id);
     $tag->upc(BarcodeLib::padUPC($this->upc));
     $tag->delete();
     header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $this->id);
     return false;
 }
Beispiel #3
0
        /* create a shelftag */
        $tag = new ShelftagsModel($dbc);
        $tag->id($sid);
        $tag->upc($upc);
        $tag->description($info['description']);
        $tag->normal_price($price);
        $tag->brand($info['brand']);
        $tag->sku($info['sku']);
        $tag->size($info['size']);
        $tag->units($info['units']);
        $tag->vendor($info['vendor']);
        $tag->pricePerUnit($info['pricePerUnit']);
        $tag->save();
        break;
    case 'batchDel':
        $vid = FormLib::get_form_value('vendorID');
        $bid = FormLib::get_form_value('batchID');
        $sid = FormLib::get_form_value('queueID', 0);
        if ($sid == 99) {
            $sid = 0;
        }
        $model = new BatchListModel($dbc);
        $model->batchID($bid);
        $model->upc($upc);
        $model->delete();
        $tag = new ShelftagsModel($dbc);
        $tag->id($sid);
        $tag->upc($upc);
        $tag->delete();
        break;
}