Line 132... |
Line 132... |
132 |
}
|
132 |
}
|
133 |
c.load();
|
133 |
c.load();
|
134 |
|
134 |
|
135 |
}
|
135 |
}
|
136 |
final ComptaPropsConfiguration conf = posConf.createConnexion();
|
136 |
final ComptaPropsConfiguration conf = posConf.createConnexion();
|
- |
|
137 |
final TM erpTM = conf.getERP_TM();
|
137 |
|
138 |
|
138 |
final int userID = posConf.getUserID();
|
139 |
final int userID = posConf.getUserID();
|
139 |
final int posID = posConf.getPosID();
|
140 |
final int posID = posConf.getPosID();
|
140 |
final RegisterFiles registerFiles = new RegisterFiles(posConf.getRootDir(), true, posConf.getPosID());
|
141 |
final RegisterFiles registerFiles = new RegisterFiles(posConf.getRootDir(), true, posConf.getPosID());
|
141 |
final RegisterDB registerDB = new RegisterDB(conf.getDirectory(), conf.getProductInfo(), posConf.getPosID());
|
142 |
final RegisterDB registerDB = new RegisterDB(conf.getDirectory(), conf.getProductInfo(), posConf.getPosID());
|
142 |
// check if register exists
|
143 |
// check if register exists
|
143 |
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(new SQLRowValues(registerDB.getRegisterTable()));
|
144 |
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(new SQLRowValues(registerDB.getRegisterTable()));
|
144 |
if (fetcher.fetchOne(posID) == null) {
|
145 |
if (fetcher.fetchOne(posID) == null) {
|
145 |
SwingUtilities.invokeLater(() -> {
|
146 |
SwingUtilities.invokeLater(() -> {
|
146 |
JOptionPane.showMessageDialog(null, TM.tr("register.missing", posID), TM.tr("register.missing.title"), JOptionPane.ERROR_MESSAGE);
|
147 |
JOptionPane.showMessageDialog(null, erpTM.translate("register.missing", posID), erpTM.translate("register.missing.title"), JOptionPane.ERROR_MESSAGE);
|
147 |
});
|
148 |
});
|
148 |
posConf.closeConnexion();
|
149 |
posConf.closeConnexion();
|
149 |
return;
|
150 |
return;
|
150 |
}
|
151 |
}
|
151 |
// check before changing any state
|
152 |
// check before changing any state
|
152 |
final boolean quit = registerDB.fetchRegisterState().checkIfMoved();
|
153 |
final boolean quit = registerDB.fetchRegisterState().checkIfMoved(erpTM);
|
153 |
if (quit) {
|
154 |
if (quit) {
|
154 |
quit(posConf);
|
155 |
quit(posConf);
|
155 |
return;
|
156 |
return;
|
156 |
}
|
157 |
}
|
157 |
|
158 |
|
Line 167... |
Line 168... |
167 |
} catch (ReconcileException re) {
|
168 |
} catch (ReconcileException re) {
|
168 |
logger.log(Level.WARNING, "States couldn’t be reconciled, local : " + re.getLocalState() + ", remote : " + re.getRemoteState(), re);
|
169 |
logger.log(Level.WARNING, "States couldn’t be reconciled, local : " + re.getLocalState() + ", remote : " + re.getRemoteState(), re);
|
169 |
final String generalMsg;
|
170 |
final String generalMsg;
|
170 |
boolean onlyOptionPane = false;
|
171 |
boolean onlyOptionPane = false;
|
171 |
if (re instanceof OutsideMeddlingException) {
|
172 |
if (re instanceof OutsideMeddlingException) {
|
172 |
generalMsg = TM.tr("register.notReconciled.outsideMeddling") + '\n';
|
173 |
generalMsg = erpTM.translate("register.notReconciled.outsideMeddling") + '\n';
|
173 |
onlyOptionPane = true;
|
174 |
onlyOptionPane = true;
|
174 |
} else if (re instanceof ResumeException) {
|
175 |
} else if (re instanceof ResumeException) {
|
175 |
generalMsg = TM.tr("register.notReconciled.resumeFailed") + '\n';
|
176 |
generalMsg = erpTM.translate("register.notReconciled.resumeFailed") + '\n';
|
176 |
} else {
|
177 |
} else {
|
177 |
generalMsg = "";
|
178 |
generalMsg = "";
|
178 |
}
|
179 |
}
|
179 |
final String message = TM.getTM().trM("register.notReconciled." + re.getTranslationKey(), "localDate", re.getLocalState().copyDate(), "remoteDate", re.getRemoteState().copyDate());
|
180 |
final String message = erpTM.trM("register.notReconciled." + re.getTranslationKey(), "localDate", re.getLocalState().copyDate(), "remoteDate", re.getRemoteState().copyDate());
|
180 |
if (onlyOptionPane) {
|
181 |
if (onlyOptionPane) {
|
181 |
SwingUtilities.invokeLater(() -> {
|
182 |
SwingUtilities.invokeLater(() -> {
|
182 |
JOptionPane.showMessageDialog(null, generalMsg + message, TM.tr("register.notReconciled.title"), JOptionPane.ERROR_MESSAGE);
|
183 |
JOptionPane.showMessageDialog(null, generalMsg + message, erpTM.translate("register.notReconciled.title"), JOptionPane.ERROR_MESSAGE);
|
183 |
});
|
184 |
});
|
184 |
} else {
|
185 |
} else {
|
185 |
ExceptionHandler.handle(generalMsg + message, re);
|
186 |
ExceptionHandler.handle(generalMsg + message, re);
|
186 |
}
|
187 |
}
|
187 |
// ATTN this calls ComptaPropsConfiguration.tearDownLogging(), so even syserr is
|
188 |
// ATTN this calls ComptaPropsConfiguration.tearDownLogging(), so even syserr is
|