Commit 5437c64b by Tuukka Kivilahti

Merge branch 'releaseplace' into 'master'

minor updates

Check commit messages

See merge request !179
2 parents 39f25ee8 7cd6dac8
......@@ -126,4 +126,8 @@ public interface PlaceBeanLocal {
List<PlaceSlot> getPlaceslots(EventUser user);
boolean lockSlot(PlaceSlot row);
boolean releaseSlot(PlaceSlot row);
}
......@@ -801,4 +801,26 @@ public class PlaceBean implements PlaceBeanLocal {
return placeSlotFacade.finForUser(user);
}
@Override
public boolean lockSlot(PlaceSlot row) {
row = placeSlotFacade.reload(row);
if (row.getPlace() == null && row.getUsed() == null) {
row.setUsed(new Date());
}else {
return false;
}
return true;
}
@Override
public boolean releaseSlot(PlaceSlot row) {
row = placeSlotFacade.reload(row);
if (row.getPlace() == null && row.getUsed() != null) {
row.setUsed(null);
}else {
return false;
}
return true;
}
}
......@@ -76,7 +76,7 @@
<dependency>
<groupId>fi.iudex</groupId>
<artifactId>utils-standalone</artifactId>
<version>1.0.10</version>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
......
......@@ -44,11 +44,13 @@
<h:outputText value="#{queueManageView.now}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
<h2>Currently reserving</h2>
<p:dataTable var="u" value="#{queueManageView.userReserving}">
<p:column>
<h:outputText value="#{u.user.user.login}" />
<p:link outcome="/user/edit" value="#{u.user.user.login}">
<f:param name="userid" value="#{u.user.id}" />
</p:link>
</p:column>
<p:column headerText="Created">
<h:outputText value="#{u.created}">
......@@ -56,7 +58,7 @@
</h:outputText>
</p:column>
<p:column headerText="Reservation timeout">
<h:outputText value="#{u.reservationTimeout}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
......@@ -65,10 +67,12 @@
<h2>In queue</h2>
Queue size: #{queueManageView.userQueue.size()}<br/>
Queue size: #{queueManageView.userQueue.rowCount}<br />
<p:dataTable var="u" value="#{queueManageView.userQueue}">
<p:column>
<h:outputText value="#{u.user.user.login}" />
<p:link outcome="/user/edit" value="#{u.user.user.login}">
<f:param name="userid" value="#{u.user.id}" />
</p:link>
</p:column>
<p:column headerText="Created">
<h:outputText value="#{u.created}">
......
......@@ -65,6 +65,7 @@
</h:form>
<h2>Place slots</h2>
<h:form>
<p:dataTable var="slot" value="#{placeGroupView.placeslots}">
<p:column headerText="#{i18n['placeslot.id']}">
<h:outputText value="#{slot.id}" />
......@@ -88,8 +89,12 @@
<f:param name="billid" value="#{slot.bill.id}" />
</h:link>
</p:column>
<p:column >
<h:commandButton rendered="#{empty slot.place and empty slot.used}" value="#{i18n['placeslot.lockSlot']}" ajax="false" action="#{placeGroupView.lockSlot}" />
<h:commandButton rendered="#{empty slot.place and not empty slot.used}" value="#{i18n['placeslot.releaseSlot']}" ajax="false" action="#{placeGroupView.releaseSlot}" />
</p:column>
</p:dataTable>
</h:form>
......
......@@ -40,8 +40,7 @@
<f:facet name="header">
<h:outputText value="#{i18n['bill.payer']}" />
</f:facet>
<h:link rendered="#{billListView.canWriteBill}"
outcome="/useradmin/edit" value="#{bill.addr1}">
<h:link rendered="#{billListView.canWriteBill}" outcome="/useradmin/edit" value="#{bill.user.user.login}">
<f:param name="userid" value="#{bill.user.user.id}" />
</h:link>
<h:outputText rendered="#{not billListView.canWriteBill}"
......@@ -58,6 +57,12 @@
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.id']}" />
</f:facet>
<h:outputText value="#{bill.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="${i18n['bill.billNumber']}" />
</f:facet>
<h:outputText value="#{bill.billNumber}" />
......@@ -131,13 +136,7 @@
value="#{i18n['bill.isNotPaid']}" />
</p:column>
<p:column rendered="#{billListView.canWriteBill and not empty billListView.paytrailMerchantId}">
<form target="_blank" action="https://payment.paytrail.com/check-payment" method="post">
<input name="MERCHANT_ID" type="hidden" value="#{billListView.paytrailMerchantId}" />
<input name="ORDER_NUMBER" type="hidden" value="#{bill.id}" />
<input name="AUTHCODE" type="hidden" value="#{billListView.getAuthcodeForBill(bill.id)}" />
<input name="VERSION" type="hidden" value="2" />
<input name="submit" type="submit" value="Check payment state" />
</form>
<button onclick="showPaymentstatus('#{bill.id}'); return false;"><h:outputText value="#{i18n['bill.checkPaytrail']}" /></button>
</p:column>
......@@ -153,7 +152,31 @@
</p:dataTable>
</h:form>
<form id="paymentcheckform" target="_blank" action="https://payment.paytrail.com/check-payment" method="post">
<input name="MERCHANT_ID" type="hidden" value="#{billListView.paytrailMerchantId}" />
<input id="paymentordernr" name="ORDER_NUMBER" type="hidden" value="" />
<input id="paymentauthcode" name="AUTHCODE" type="hidden" value="" />
<input name="VERSION" type="hidden" value="2" />
</form>
<script type="text/javascript" >
function showPaymentstatus(id) {
$("#paymentordernr").val(id);
$("#paymentauthcode").val(authcodes[id]);
$("#paymentcheckform").submit();
return false;
}
var authcodes ={};
<ui:repeat var="ac" value="#{billListView.paytrailAuthcodes}">
<h:outputText value="authcodes['#{ac.key}'] ='#{ac.value}';" />
</ui:repeat>
alert("Parsed javascript");
</script>
</composite:implementation>
</html>
......
......@@ -49,6 +49,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.jerklib.Profile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -94,13 +96,17 @@ public class IrcServlet extends HttpServlet {
*/
public void init(ServletConfig config) throws ServletException {
startBot();
}
private void startBot() {
String ircserver = SystemProperty.MOYA_IRC_SERVER.getValueOrDefault();
logger.info("Got irc server system property {}", ircserver);
if (ircserver != null)
{
logger.info("Starting IRC client with server {}", ircserver);
IrcBot bot = new IrcBot(ircserver, 6667, SystemProperty.MOYA_IRC_SERVERPASS.getValueOrNull() ,SystemProperty.MOYA_IRC_CHANNEL.getValueOrDefault(), "moya-bot");
IrcBot bot = new IrcBot(ircserver, 6667, SystemProperty.MOYA_IRC_SERVERPASS.getValueOrNull(), SystemProperty.MOYA_IRC_CHANNEL.getValueOrDefault(), new Profile("moyabot", "Moya bot", "moya-bot"));
botbean.add(bot);
bots.add(bot);
bot.start();
......@@ -125,17 +131,15 @@ public class IrcServlet extends HttpServlet {
for (IrcBot b : bots) {
try {
b.stop();
} catch (Throwable t) {
logger.info("Error stopping bot", t);
}
b.start();
}
bots.clear();
startBot();
// String msg = request.getParameter("msg");
// if (msg != null && !msg.isEmpty())
// for (IrcBot b : bots) {
// b.say(msg);
// }
}
/**
......
......@@ -79,6 +79,8 @@ public class PlacegroupView extends GenericCDIView {
@EJB
private PlaceBeanLocal placeslotBean;
private ListDataModel<PlaceSlot> placeslots;
public String editGroup() {
setGroup(placegroups.getRowData());
setPlacelist(new ListDataModel<Place>(group.getPlaces()));
......@@ -90,7 +92,6 @@ public class PlacegroupView extends GenericCDIView {
return eventBean.getPropertyBoolean(LanEventPropertyKey.USE_ETICKET);
}
public boolean isPrintOnlyOwn() {
return eventBean.getPropertyBoolean(LanEventPropertyKey.PLACECODE_PRINT_ONLY_OWN);
}
......@@ -151,10 +152,11 @@ public class PlacegroupView extends GenericCDIView {
return false;
}
public List<PlaceSlot> getPlaceslots()
public ListDataModel<PlaceSlot> getPlaceslots()
{
return placeslotBean.getPlaceslots(user);
if (placeslots == null)
placeslots = new ListDataModel<>(placeslotBean.getPlaceslots(user));
return placeslots;
}
public boolean isCurrentReleaseAllowed() {
......@@ -209,6 +211,20 @@ public class PlacegroupView extends GenericCDIView {
return null;
}
public String lockSlot() {
PlaceSlot row = placeslots.getRowData();
placeslotBean.lockSlot(row);
placeslots = null;
return null;
}
public String releaseSlot() {
PlaceSlot row = placeslots.getRowData();
placeslotBean.releaseSlot(row);
placeslots = null;
return null;
}
public ListDataModel<PlaceGroup> getPlacegroups() {
if (placegroups == null) {
List<PlaceGroup> retlist = new ArrayList<PlaceGroup>();
......
......@@ -96,7 +96,9 @@ public class QueueManageView extends GenericCDIView {
{
ret.add(queue.getEntry(u));
}
return new ListDataModel<>(ret);
ListDataModel<MapReservationQueueEntry> retMod = new ListDataModel<>(ret);
return retMod;
}
public ListDataModel<MapReservationQueueEntry> getUserReserving() {
......
......@@ -20,8 +20,11 @@ package fi.codecrew.moya.web.cdiview.shop;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
......@@ -93,6 +96,11 @@ public class BillListView extends GenericCDIView {
}
}
public Object[] getPaytrailAuthcodes() {
Set<Entry<Integer, String>> ret = paytrailAuthcodes.entrySet();
return ret.toArray();
}
public String getAuthcodeForBill(Integer id) {
return paytrailAuthcodes.get(id);
}
......
......@@ -72,6 +72,7 @@ bill.billMarkedPaidMail.subject = Bill marked paid
bill.billNumber = Order number
bill.billPaidDate = Paid date
bill.cancel = Cancel bill
bill.checkPaytrail = Check payment
bill.deliveryTerms = Delivery terms
bill.edit = edit
bill.expires = Expires
......@@ -954,8 +955,10 @@ placegroupview.token = Placecode / user
placeslot.bill = Bill
placeslot.id = ID
placeslot.lockSlot = Lock slot
placeslot.place = Place
placeslot.product = Slot product
placeslot.releaseSlot = Release slot lock
placeslot.showBill = Show bill
placeslot.state = State
placeslot.state.expired = Expired
......
......@@ -72,6 +72,7 @@ bill.billMarkedPaidMail.subject = Lasku merkitty maksetuksi
bill.billNumber = Tilausnumero
bill.billPaidDate = Maksup\u00E4iv\u00E4
bill.cancel = Peruuta lasku
bill.checkPaytrail = Tarkista maksu
bill.deliveryTerms = Toimitusehdot
bill.edit = Muokkaa
bill.expires = Vanhentuu
......@@ -937,8 +938,10 @@ placegroupview.token = Paikkakoodi / k\u00E4ytt\u00E4j\u00E4
placeslot.bill = Lasku
placeslot.id = ID
placeslot.lockSlot = Lukitse
placeslot.place = Paikka
placeslot.product = Tuote
placeslot.releaseSlot = Vapauta lukko
placeslot.showBill = N\u00E4yt\u00E4 lasku
placeslot.state = Tila
placeslot.state.expired = Vanhentunut
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!