Exemple #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;
 }
Exemple #2
0
 public function get_queueID_handler()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $tags = new ShelftagsModel($dbc);
     $tags->id($this->queueID);
     $this->u = array();
     foreach ($tags->find() as $tag) {
         $this->u[] = $tag->upc();
     }
     return $this->post_u_handler();
 }
Exemple #3
0
        $tag->pricePerUnit($ppo);
        $tag->save();
    }
    header("Location: index.php");
    return;
}
echo "<html><head><title>Edit shelftags</title>\n<style type=text/css>\n.one {\n    background: #ffffff;\n}\n.two {\n    background: #ffffcc;\n}\n</style></head>";
echo "<form action=edit.php method=post>";
echo "<table cellspacing=0 cellpadding=4 border=1>";
echo "<tr><th>UPC</th><th>Desc</th><th>Price</th><th>Brand</th><th>SKU</th>";
echo "<th>Size</th><th>Units</th><th>Vendor</th><th>PricePer</th></tr>";
$class = array("one", "two");
$c = 1;
$tags = new ShelftagsModel($sql);
$tags->id($id);
foreach ($tags->find() as $tag) {
    echo "<tr class={$class[$c]}>";
    echo "<td>" . $tag->upc() . "</td><input type=hidden name=upc[] value=\"" . $tag->upc() . "\" />";
    echo "<td><input type=text name=desc[] value=\"" . $tag->description() . "\" size=25 /></td>";
    echo "<td><input type=text name=price[] value=\"" . $tag->normal_price() . "\" size=5 /></td>";
    echo "<td><input type=text name=brand[] value=\"" . $tag->brand() . "\" size=13 /></td>";
    echo "<td><input type=text name=sku[] value=\"" . $tag->sku() . "\" size=6 /></td>";
    echo "<td><input type=text name=size[] value=\"" . $tag->size() . "\" size=6 /></td>";
    echo "<td><input type=text name=units[] value=\"" . $tag->units() . "\" size=4 /></td>";
    echo "<td><input type=text name=vendor[] value=\"" . $tag->vendor() . "\" size=7 /></td>";
    echo "<td><input type=text name=ppo[] value=\"" . $tag->pricePerUnit() . "\" size=10 /></td>";
    echo "</tr>";
    $c = ($c + 1) % 2;
}
echo "</table>";
echo "<input type=hidden name=id value=\"{$id}\" />";
Exemple #4
0
    public function get_id_view()
    {
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $template = <<<HTML
<form action=EditShelfTags.php method=post>
<table class="table table-striped table-bordered small">
    <tr>
        <th>UPC</th><th>Desc</th><th>Price</th><th>Brand</th><th>SKU</th>
        <th>Size</th><th>Units</th><th>Vendor</th><th>PricePer</th><th># Tags</th>
    </tr>
    {%
    <tr>
        <td>{{ tag.upc }}</td>
        <input type="hidden" name="upc[]" value="{{ tag.upc }}" /> 
        <td><input type="text" name="desc[]" value="{{ tag.description }}"
            class="form-control input-sm" /></td>
        <td><div class="input-group">
            <span class="input-group-addon">\$</span>
            <input type=text name=price[] value="{{ tag.normal_price }}" 
                class="form-control price-field input-sm" />
            </div>
        </td>
        <td><input type=text name=brand[] value="{{ tag.brand }}"
                class="form-control input-sm" /></td>
        <td><input type=text name=sku[] value="{{ tag.sku }}"
                class="form-control input-sm" /></td>
        <td><input type=text name=size[] value="{{ tag.size }}"
                class="form-control input-sm" /></td>
        <td><input type=text name=units[] value="{{ tag.units }}"
                class="form-control input-sm price-field" /></td>
        <td><input type=text name=vendor[] value="{{ tag.vendor }}"
                class="form-control input-sm" /></td>
        <td><input type=text name=ppo[] value="{{ tag.pricePerUnit }}"
                class="form-control input-sm" /></td>
        <td><input type=number name=counts[] value="{{ tag.count }}"
                class="form-control input-sm price-field" /></td>
        <td><a href="?_method=delete&id={{ id }}&upc={{ tag.upc }}"
                class="btn btn-danger">
                {{ deleteIcon }}
        </a></td>
    </tr>
    %}
</table>
<input type=hidden name=id value="{{ id }}" />
<p>
    <button type=submit name=submit value="1"
        class="btn btn-default">Update Shelftags</button>
</p>
</form>
HTML;
        $tags = new ShelftagsModel($dbc);
        $tags->id($this->id);
        $data = array('id' => $this->id, 'tag' => $tags->find(), 'deleteIcon' => \COREPOS\Fannie\API\lib\FannieUI::deleteIcon('Delete Tag OR Change Queues'));
        /*
        $t = new \COREPOS\common\CoreTemplate($template);
        return $t->render($data);
        */
        $ret = "<form action=EditShelfTags.php method=post>";
        $ret .= "<table class=\"table table-striped table-bordered small\">";
        $ret .= "<tr><th>UPC</th><th>Desc</th><th>Price</th><th>Brand</th><th>SKU</th>";
        $ret .= "<th>Size</th><th>Units</th><th>Vendor</th><th>PricePer</th><th># Tags</th></tr>";
        foreach ($tags->find() as $tag) {
            $ret .= '<tr>';
            $ret .= "<td>" . $tag->upc() . "</td><input type=hidden name=upc[] value=\"" . $tag->upc() . "\" />";
            $ret .= "<td><input type=text name=desc[] value=\"" . $tag->description() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><div class=\"input-group\">\n                    <span class=\"input-group-addon\">\$</span>\n                    <input type=text name=price[] value=\"" . $tag->normal_price() . "\" \n                        class=\"form-control price-field input-sm\" />\n                    </div></td>";
            $ret .= "<td><input type=text name=brand[] value=\"" . $tag->brand() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><input type=text name=sku[] value=\"" . $tag->sku() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><input type=text name=size[] value=\"" . $tag->size() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><input type=text name=units[] value=\"" . $tag->units() . "\" \n                        class=\"form-control input-sm price-field\" /></td>";
            $ret .= "<td><input type=text name=vendor[] value=\"" . $tag->vendor() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><input type=text name=ppo[] value=\"" . $tag->pricePerUnit() . "\" \n                        class=\"form-control input-sm\" /></td>";
            $ret .= "<td><input type=number name=counts[] value=\"" . $tag->count() . "\" \n                        class=\"form-control input-sm price-field\" /></td>";
            $ret .= '<td><a href="?_method=delete&id=' . $this->id . '&upc=' . $tag->upc() . '"
                        class="btn btn-danger">' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon('Delete OR Change Queue') . '</a></td>';
            $ret .= "</tr>";
        }
        $ret .= "</table>";
        $ret .= "<input type=hidden name=id value=\"" . $this->id . "\" />";
        $ret .= '<p>';
        $ret .= "<button type=submit name=submit value=\"1\" \n            class=\"btn btn-default\">Update Shelftags</button>";
        $ret .= '</p>';
        $ret .= "</form>";
        return $ret;
    }