TavernerPOS - Source Code

Clone: 

git clone http://www.librarysmith.co.uk/tavernerPOS

 

viewgit/viewgit/inc/functions.php:49 Function create_function() is deprecated [8192]

Index » tavernerPOS : Commitdiff 5cbb1b

Add configurarion option to turn off/on auto open/save of tickets on login logout

Matt Smith [15-10-30 14:24]
Add configurarion option to turn off/on auto open/save of tickets on login logout
diff --git a/i18n/messages.properties b/i18n/messages.properties
index da58507..8a8af69 100755
--- a/i18n/messages.properties
+++ b/i18n/messages.properties
@@ -1170,8 +1170,6 @@ TicketListView.5=NEXT
 TicketListView.6=Guest
 TicketListView.8=PAID
 TicketListView.9=OPEN
-BARMOD_TicketListView.21=Are you sure you want to clear all item?
-BARMOD_TicketListView.20=Clear All Items?
 TicketReceiptView.0=Report viewing component could not be found.
 TicketView.20=Please select and item
 TicketView.21=Cooking instruction cannot be added to item already printed to kitchen
@@ -1303,3 +1301,6 @@ UserPermission.6=View Back Office
 UserPermission.7=Authorize Tickets
 UserPermission.8=Drawer Assignment
 UserPermission.9=Drawer Pull
+BARMOD_TicketListView.21=Are you sure you want to clear all item?
+BARMOD_TicketListView.20=Clear All Items?
+BARMOD_AutoSaveOpen.1=Automatically Save/Open Open take out tickets on Logout/Login?
diff --git a/src/com/floreantpos/config/TerminalConfig.java b/src/com/floreantpos/config/TerminalConfig.java
old mode 100644
new mode 100755
index aad09d1..29b2eb2
--- a/src/com/floreantpos/config/TerminalConfig.java
+++ b/src/com/floreantpos/config/TerminalConfig.java
@@ -43,6 +43,8 @@ public class TerminalConfig {
 	static final String TERMINAL_ID = "terminal_id"; //$NON-NLS-1$
 	static final String FULLSCREEN_MODE = "fullscreen_mode"; //$NON-NLS-1$

+	private static final String AUTOSAVEANDOPEN_TAKEOUT_TICKET = "auto_save_and_open";//$NON-NLS-1$
+
 	private static PropertiesConfiguration config = AppConfig.getConfig();

 	public static int getTerminalId() {
@@ -229,6 +231,15 @@ public class TerminalConfig {
 		return "27,112,0,25,250"; //$NON-NLS-1$
 	}

+	public static boolean isAutoSaveOpen() {
+		return config.getBoolean(AUTOSAVEANDOPEN_TAKEOUT_TICKET, false);
+	}
+
+	public static void setAutoSaveOpen(boolean autosaveandopen) {
+		config.setProperty(AUTOSAVEANDOPEN_TAKEOUT_TICKET, autosaveandopen);
+	}
+
+
 	public static char[] getDrawerControlCodesArray() {
 		String drawerControlCodes = getDefaultDrawerControlCodes();
 		if(StringUtils.isEmpty(drawerControlCodes)) {
diff --git a/src/com/floreantpos/config/ui/TerminalConfigurationView.java b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
old mode 100644
new mode 100755
index e184dd0..147cb9c
--- a/src/com/floreantpos/config/ui/TerminalConfigurationView.java
+++ b/src/com/floreantpos/config/ui/TerminalConfigurationView.java
@@ -38,6 +38,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 	private JCheckBox cbFullscreenMode = new JCheckBox(Messages.getString("TerminalConfigurationView.3")); //$NON-NLS-1$
 	private JCheckBox cbUseSettlementPrompt = new JCheckBox(Messages.getString("TerminalConfigurationView.4")); //$NON-NLS-1$
 	private JCheckBox cbShowDbConfiguration = new JCheckBox(Messages.getString("TerminalConfigurationView.5")); //$NON-NLS-1$
+	private JCheckBox cbAutoSaveOpen = new JCheckBox(Messages.getString("BARMOD_AutoSaveOpen.1")); //$NON-NLS-1$
+

 	private JComboBox<String> cbFonts = new JComboBox<String>();

@@ -89,6 +91,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 		add(new JLabel(Messages.getString("TerminalConfigurationView.16"))); //$NON-NLS-1$
 		add(tfLogoffTime, "wrap"); //$NON-NLS-1$

+		add(cbAutoSaveOpen,"newline, span"); //$NON-NLS-1$
+
 		add(cbTranslatedName, "span 2"); //$NON-NLS-1$
 		add(cbFullscreenMode, "newline, span"); //$NON-NLS-1$
 		add(cbUseSettlementPrompt, "newline, span"); //$NON-NLS-1$
@@ -237,6 +241,9 @@ public class TerminalConfigurationView extends ConfigurationView {

 		TerminalConfig.setAutoLogoffEnable(cbAutoLogoff.isSelected());
 		TerminalConfig.setAutoLogoffTime(tfLogoffTime.getInteger() <= 0 ? 10 : tfLogoffTime.getInteger());
+
+		TerminalConfig.setAutoSaveOpen(cbAutoSaveOpen.isSelected());
+
 		TerminalConfig.setUseSettlementPrompt(cbUseSettlementPrompt.isSelected());

 		POSMessageDialog.showMessage(com.floreantpos.util.POSUtil.getFocusedWindow(), Messages.getString("TerminalConfigurationView.40")); //$NON-NLS-1$
@@ -283,6 +290,8 @@ public class TerminalConfigurationView extends ConfigurationView {
 		tfLogoffTime.setText("" + TerminalConfig.getAutoLogoffTime()); //$NON-NLS-1$
 		tfLogoffTime.setEnabled(cbAutoLogoff.isSelected());

+		cbAutoSaveOpen.setSelected(TerminalConfig.isAutoSaveOpen());
+
 		initializeFontConfig();

 		Terminal terminal = Application.getInstance().refreshAndGetTerminal();
diff --git a/src/com/floreantpos/main/Application.java b/src/com/floreantpos/main/Application.java
index d4875d8..47d02f2 100755
--- a/src/com/floreantpos/main/Application.java
+++ b/src/com/floreantpos/main/Application.java
@@ -407,7 +407,7 @@ public class Application {
 		}
 		else {
 			rootView.showView(SwitchboardView.getInstance());
-			SwitchboardView.getInstance().loadPreviousOpenTicket();
+			if (TerminalConfig.isAutoSaveOpen())  SwitchboardView.getInstance().loadPreviousOpenTicket();
 		}
 	}

@@ -415,11 +415,12 @@ public class Application {
 		currentShift = null;
 		setCurrentUser(null);

-		RootView rootView = getRootView();
-		if (rootView.hasView(OrderView.VIEW_NAME)) {
-			if (rootView.getOrderView().isVisible()) rootView.getOrderView().ticketView.doJustSaveOrder(null);
-		}
-
+		if (TerminalConfig.isAutoSaveOpen()) {
+			RootView rootView = getRootView();
+				if (rootView.hasView(OrderView.VIEW_NAME)) {
+					if (rootView.getOrderView().isVisible()) rootView.getOrderView().ticketView.doJustSaveOrder(null);
+				}
+			}
 		RootView.getInstance().showView(LoginView.VIEW_NAME);
 	}

diff --git a/src/com/floreantpos/ui/HeaderPanel.java b/src/com/floreantpos/ui/HeaderPanel.java
old mode 100644
new mode 100755
index aeefeb1..f5b58ff
--- a/src/com/floreantpos/ui/HeaderPanel.java
+++ b/src/com/floreantpos/ui/HeaderPanel.java
@@ -91,7 +91,7 @@ public class HeaderPanel extends JPanel {

 	private void showHeader() {
 		StringBuilder sb = new StringBuilder();
-		sb.append(userString + ": " + Application.getCurrentUser().getFirstName()); //$NON-NLS-1$
+		sb.append(userString + ": " + Application.getCurrentUser().getFullName()); //$NON-NLS-1$
 		sb.append(", "); //$NON-NLS-1$
 		sb.append(terminalString + ": " + Application.getInstance().getTerminal().getName()); //$NON-NLS-1$
 		sb.append(", "); //$NON-NLS-1$

Add comment
These comments are moderated so so won't be published until reviewed.