Exemplo n.º 1
0
 public function view_warehouseSubmit()
 {
     if (!isset($_SESSION['userName'])) {
         header('Location:index.php?mod=login&act=login');
     }
     $warehouseArr = array();
     if ($_GET['type'] == 'add') {
         if (isset($_POST['whNameInput']) && !empty($_POST['whNameInput'])) {
             $warehouseArr[] = "whName = '" . trim($_POST['whNameInput']) . "'";
         }
         if (isset($_POST['whCodeInput']) && !empty($_POST['whCodeInput'])) {
             $warehouseArr[] = "whCode = '" . trim($_POST['whCodeInput']) . "'";
         }
         if (isset($_POST['whAddressInput']) && !empty($_POST['whAddressInput'])) {
             $warehouseArr[] = "whAddress = '" . trim($_POST['whAddressInput']) . "'";
         }
         if (isset($_POST['whLocationInput']) && !empty($_POST['whLocationInput'])) {
             $warehouseArr[] = "whLocation = '" . trim($_POST['whLocationInput']) . "'";
         }
         $this->where = "SET " . implode(",", $warehouseArr);
     } else {
         if ($_GET['type'] == 'edit') {
             if (isset($_POST['whNameEdit']) && !empty($_POST['whNameEdit'])) {
                 $warehouseArr[] = "whName = '" . trim($_POST['whNameEdit']) . "'";
             }
             if (isset($_POST['whCodeEdit']) && !empty($_POST['whCodeEdit'])) {
                 $warehouseArr[] = "whCode = '" . trim($_POST['whCodeEdit']) . "'";
             }
             if (isset($_POST['whAddressEdit']) && !empty($_POST['whAddressEdit'])) {
                 $warehouseArr[] = "whAddress = '" . trim($_POST['whAddressEdit']) . "'";
             }
             if (isset($_POST['whLocationEdit']) && !empty($_POST['whLocationEdit'])) {
                 $warehouseArr[] = "whLocation = '" . trim($_POST['whLocationEdit']) . "'";
             }
             $this->where = "SET " . implode(",", $warehouseArr) . " where id = " . trim($_POST['key_id']);
         }
     }
     //echo $this->where;exit;
     $WarehouseManagement = new WarehouseManagementAct();
     $warehouseSubmitList = $WarehouseManagement->act_warehouseSubmit($this->where, $_GET['type']);
     if ($warehouseSubmitList) {
         $succeedLog = '操作成功!';
         header("location:index.php?mod=warehouseManagement&act=whStore&succeedLog={$succeedLog}");
     } else {
         $errorLog = '操作失败!';
         header("location:index.php?mod=warehouseManagement&act=whStore&errorLog={$errorLog}");
     }
 }