Skip to content

Commit

Permalink
Merge pull request #127 from eurofurence/issue-122-dd-interface
Browse files Browse the repository at this point in the history
feat(#122): allow search for dealer
  • Loading branch information
Jumpy-Squirrel authored Feb 16, 2024
2 parents 5cc4fd9 + 59db9f1 commit 8802969
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions src/java/org/eurofurence/regsys/web/forms/SearchForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class SearchForm extends Form {
public static final String X_WAITING = "search_status_Xwait";
public static final String X_CANCELLED = "search_status_Xcanc";
public static final String SPONSOR_ITEMS = "search_sponsor_items";
public static final String DEALER = "search_dealer";
public static final String FLAG_BASE = "search_flag_"; // includes options
public static final String PACKAGE_BASE = "search_package_";

Expand Down Expand Up @@ -124,6 +125,15 @@ protected String getSearchSponsorItems() {
}
}

protected String getSearchDealer() {
String key = "dealerreg";
if (attendeeFinder.addInfo != null && attendeeFinder.addInfo.containsKey(key)) {
return Integer.toString(attendeeFinder.addInfo.get(key));
} else {
return "-1";
}
}

// --------- Business methods ----------------------

public static final String SEARCH_FORM_SESSION_KEY = "SearchForm_Session_Attendee";
Expand Down Expand Up @@ -456,6 +466,23 @@ private void setSearchSponsorItems(String t) {
}
}

private void setSearchDealer(String t) {
if (t == null || t.equals("")) t = "-1";
if (attendeeFinder.addInfo == null)
attendeeFinder.addInfo = new HashMap<>();
String key = "dealerreg";
int current = -1;
if (attendeeFinder.addInfo.containsKey(key)) {
current = attendeeFinder.addInfo.get(key);
}
int searchDealer = FormHelper.parseInt(getPage(), t, DEALER, current);
if (searchDealer == -1) {
attendeeFinder.addInfo.remove(key);
} else {
attendeeFinder.addInfo.put(key, searchDealer);
}
}

private void genericOptionSetter(HttpServletRequest request, OptionList list, Map<String, Integer> paramMap, String paramBaseName, String errorMessageFormat) {
for (Option o: list) {
String parname = paramBaseName + o.code;
Expand Down Expand Up @@ -505,6 +532,7 @@ public void parse(HttpServletRequest request) {
setSearchStatusXwait(nvl(request.getParameter(X_WAITING)));
setSearchStatusXcanc(nvl(request.getParameter(X_CANCELLED)));
setSearchSponsorItems(request.getParameter(SPONSOR_ITEMS));
setSearchDealer(request.getParameter(DEALER));
setSearchFlagsByCode(request);
setSearchOptionsByCode(request);
setSearchPackagesByCode(request);
Expand Down Expand Up @@ -631,6 +659,10 @@ public String fieldSponsorItems(String style) {
return anyNoYesSelector(SPONSOR_ITEMS, getSearchSponsorItems(), style);
}

public String fieldDealer(String style) {
return anyNoYesSelector(DEALER, getSearchDealer(), style);
}

public String getResetFormUrl() {
return "search?resetform=yes";
}
Expand Down
4 changes: 2 additions & 2 deletions src/tpl/common/pages/searchForm.vm
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ ${form.fieldXcancelled("check")}&nbsp;cancelled</TD>
</TR>

<TR>
<TD></TD>
<TD></TD>
<TD>Dealer</TD>
<TD class="input" ALIGN="left" VALIGN="middle">$form.fieldDealer("small")</TD>

<TD></TD>
<TD class="input" ALIGN="left" VALIGN="middle"><A HREF="$form.resetFormUrl">Reset Search Form</A></TD>
Expand Down

0 comments on commit 8802969

Please sign in to comment.