public static void useInvNumber(String invNumber) { Merchant merchant = MallUtil.getCurrentMerchant(); String dir = merchant.getAbsolutePath() + "/invoiceCodes" + "/" + invNumber; try { Value val = (Value) SpringUtil.getRepositoryService().getFile(dir, Util.getRemoteUser()); val.setStatus(40); val.save(); } catch (FileNotFoundException fne) { } }
public static String checkInvNumber(String invNumber) { Merchant merchant = MallUtil.getCurrentMerchant(); String dir = merchant.getAbsolutePath() + "/invoiceCodes" + "/" + invNumber; try { Value val = (Value) SpringUtil.getRepositoryService().getFile(dir, Util.getRemoteUser()); if (val.getStatus() == 40) { return "used"; } else if (val.getStatus() == File.STATE_PUBLISHED) { return "ok"; } else { return "notprinted"; } } catch (FileNotFoundException fne) { Order order = getOrder(invNumber); if (order != null) { return "used"; } else { return "ok"; } } }