Exemplo n.º 1
0
 protected function post_delete_id_handler()
 {
     global $FANNIE_OP_DB;
     $json = array('error' => 0, 'msg' => 'Deleted batch #' . $this->id);
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $batch = new BatchesModel($dbc);
     $batch->forceStopBatch($this->id);
     $delQ = $dbc->prepare_statement("delete from batches where batchID=?");
     $batchR = $dbc->exec_statement($delQ, array($this->id));
     $delQ = $dbc->prepare_statement("delete from batchList where batchID=?");
     $itemR = $dbc->exec_statement($delQ, array($this->id));
     if ($itemR !== false && $batchR === false) {
         $json['error'] = 1;
         $json['msg'] = 'Items were unsaled and removed from the batch, but the batch could not be deleted';
     } elseif ($itemR === false && $batchR !== false) {
         $json['error'] = 1;
         $json['msg'] = 'Items were unsaled and the batch was deleted, but some orphaned items remain in the batchList table.' . ' This probably is not a big deal unless it happens often.';
     } elseif ($itemR === false && $batchR === false) {
         $json['error'] = 1;
         $json['msg'] = 'Items were unsaled but an error occurred deleting the batch.';
     }
     echo json_encode($json);
     return false;
 }
Exemplo n.º 2
0
     $out .= '`';
     $out .= showBatchDisplay($id);
     break;
 case 'redisplay':
     $mode = $_GET['mode'];
     $out .= batchListDisplay('', $mode);
     break;
 case 'forceBatch':
     $id = $_GET['id'];
     $model = new BatchesModel($sql);
     $model->forceStartBatch($id);
     break;
 case 'unsale':
     $id = $_GET['id'];
     $model = new BatchesModel($sql);
     $model->forceStopBatch($id);
     break;
 case 'switchToLC':
     $out .= addItemLCInput();
     break;
 case 'switchFromLC':
     $out .= addItemUPCInput();
     break;
 case 'redisplayWithOrder':
     $id = $_GET['id'];
     $order = $_GET['order'];
     $out .= showBatchDisplay($id, $order);
     break;
 case 'expand':
     $likecode = $_GET['likecode'];
     $saleprice = $_GET['saleprice'];
Exemplo n.º 3
0
 protected function post_id_unsale_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $model = new BatchesModel($dbc);
     $model->forceStopBatch($this->id);
     $json = array('error' => 0, 'msg' => 'Batch items taken off sale');
     echo json_encode($json);
     return false;
 }