Skip to content
Snippets Groups Projects
Commit b71a53bf authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Moving observedAttacksDescription to each trapsiteregistration

Also, making it mandatory.
Keeping old structure of data before 2022
parent 9eb7afb6
Branches
No related tags found
No related merge requests found
...@@ -299,6 +299,8 @@ public class BarkbeetleController extends HttpServlet { ...@@ -299,6 +299,8 @@ public class BarkbeetleController extends HttpServlet {
tr.setTrap3Remarks(request.getParameter(week + "_trap3Remarks")); tr.setTrap3Remarks(request.getParameter(week + "_trap3Remarks"));
tr.setTrap4Remarks(request.getParameter(week + "_trap4Remarks")); tr.setTrap4Remarks(request.getParameter(week + "_trap4Remarks"));
tr.setObservedAttacksDescription(request.getParameter(week +"_observedAttacksDescription") != null ? request.getParameter(week +"_observedAttacksDescription") : "");
String registrationStatusTypeIdFieldValue = request.getParameter(week + "_registrationStatusTypeId"); String registrationStatusTypeIdFieldValue = request.getParameter(week + "_registrationStatusTypeId");
if(registrationStatusTypeIdFieldValue != null && ! registrationStatusTypeIdFieldValue.isBlank()) if(registrationStatusTypeIdFieldValue != null && ! registrationStatusTypeIdFieldValue.isBlank())
{ {
......
...@@ -85,6 +85,8 @@ public class TrapsiteRegistration implements Serializable, Comparable { ...@@ -85,6 +85,8 @@ public class TrapsiteRegistration implements Serializable, Comparable {
private String trap4Remarks; private String trap4Remarks;
@Column(name = "registration_status_type_id") @Column(name = "registration_status_type_id")
private Integer registrationStatusTypeId; private Integer registrationStatusTypeId;
@Column(name = "observed_attacks_description")
private String observedAttacksDescription;
@JoinColumn(name = "season_trapsite_id", referencedColumnName = "season_trapsite_id", insertable = false, updatable = false) @JoinColumn(name = "season_trapsite_id", referencedColumnName = "season_trapsite_id", insertable = false, updatable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private SeasonTrapsite seasonTrapsite; private SeasonTrapsite seasonTrapsite;
...@@ -265,5 +267,19 @@ public class TrapsiteRegistration implements Serializable, Comparable { ...@@ -265,5 +267,19 @@ public class TrapsiteRegistration implements Serializable, Comparable {
return counter > 0 ? sum/counter : null; return counter > 0 ? sum/counter : null;
} }
/**
* @return the observedAttacksDescription
*/
public String getObservedAttacksDescription() {
return observedAttacksDescription;
}
/**
* @param observedAttacksDescription the observedAttacksDescription to set
*/
public void setObservedAttacksDescription(String observedAttacksDescription) {
this.observedAttacksDescription = observedAttacksDescription;
}
} }
<#-- <#--
Copyright (c) 2020 NIBIO <http://www.nibio.no/>. Copyright (c) 2022 NIBIO <http://www.nibio.no/>.
This file is part of VIPSLogic. This file is part of VIPSLogic.
VIPSLogic is free software: you can redistribute it and/or modify VIPSLogic is free software: you can redistribute it and/or modify
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<#list trapsiteRegistrations as reg> <#list trapsiteRegistrations as reg>
<#assign tooEarly = reg.trapsiteRegistrationPK.week gt currentWeek && ! (currentWeek == 27 && reg.trapsiteRegistrationPK.week == 28)> <#assign tooEarly = reg.trapsiteRegistrationPK.week gt currentWeek && ! (currentWeek == 27 && reg.trapsiteRegistrationPK.week == 28)>
<tr> <tr>
<td rowspan="2">${reg.trapsiteRegistrationPK.week} (${reg?counter})</td> <td rowspan="<#if seasonTrapsite.season gt 2021>3<#else>2</#if>">${reg.trapsiteRegistrationPK.week} (${reg?counter})</td>
<td rowspan="2"><input class="form-control" type="date" name="${reg.trapsiteRegistrationPK.week}_dateRegistration" value="${reg.dateRegistration!""}"<#if tooEarly> disabled="disabled"<#else> required="required"</#if>/></td> <td rowspan="2"><input class="form-control" type="date" name="${reg.trapsiteRegistrationPK.week}_dateRegistration" value="${reg.dateRegistration!""}"<#if tooEarly> disabled="disabled"<#else> required="required"</#if>/></td>
<td><input class="form-control squeezemenot" type="number" name="${reg.trapsiteRegistrationPK.week}_trap1_ml" onblur="setCalculatedAmount(this);" value=""<#if tooEarly> disabled="disabled"</#if>/></td> <td><input class="form-control squeezemenot" type="number" name="${reg.trapsiteRegistrationPK.week}_trap1_ml" onblur="setCalculatedAmount(this);" value=""<#if tooEarly> disabled="disabled"</#if>/></td>
<td><input class="form-control squeezemenot" type="text" onblur="validateRegField(this, true);" name="${reg.trapsiteRegistrationPK.week}_trap1" value="${reg.trap1!"M"}"<#if tooEarly> disabled="disabled"</#if>/></td> <td><input class="form-control squeezemenot" type="text" onblur="validateRegField(this, true);" name="${reg.trapsiteRegistrationPK.week}_trap1" value="${reg.trap1!"M"}"<#if tooEarly> disabled="disabled"</#if>/></td>
...@@ -125,15 +125,25 @@ ...@@ -125,15 +125,25 @@
<td colspan="2"><input class="form-control" type="text" name="${reg.trapsiteRegistrationPK.week}_trap4Remarks" placeholder="Kommentar felle 4" value="${reg.trap4Remarks!""}"<#if tooEarly || isExtended> disabled="disabled"</#if>/></td> <td colspan="2"><input class="form-control" type="text" name="${reg.trapsiteRegistrationPK.week}_trap4Remarks" placeholder="Kommentar felle 4" value="${reg.trap4Remarks!""}"<#if tooEarly || isExtended> disabled="disabled"</#if>/></td>
</tr> </tr>
<#if seasonTrapsite.season gt 2021>
<tr>
<td>Er det observert angrep av stor granbarkbille på stående gran i nærområdet/kommunen? Beskriv hva som er observert (omfang, sted m.m.)</td>
<td colspan="8">
<textarea class="form-control" name="${reg.trapsiteRegistrationPK.week}_observedAttacksDescription"<#if tooEarly> disabled="disabled"</#if>>${reg.observedAttacksDescription!""}</textarea>
</td>
</tr>
</#if>
</#list> </#list>
</tbody> </tbody>
</table> </table>
</div> </div>
<#if seasonTrapsite.season lte 2021>
<div class="form-group" style="padding-left: 5px; padding-right: 5px;"> <div class="form-group" style="padding-left: 5px; padding-right: 5px;">
<label for="observedAttacksDescription">Er det observert angrep av stor granbarkbille på stående gran i nærområdet/kommunen? <label for="observedAttacksDescription">Er det observert angrep av stor granbarkbille på stående gran i nærområdet/kommunen?
Beskriv hva som er observert (omfang, når, m.m.)</label> Beskriv hva som er observert (omfang, når, m.m.)</label>
<textarea class="form-control" name="observedAttacksDescription">${seasonTrapsite.observedAttacksDescription!""}</textarea> <textarea class="form-control" name="observedAttacksDescription">${seasonTrapsite.observedAttacksDescription!""}</textarea>
</div> </div>
</#if>
<div class="form-group" style="padding-left: 5px; padding-right: 5px; display: <#if currentWeek gte 33>block<#else>none</#if>;"> <div class="form-group" style="padding-left: 5px; padding-right: 5px; display: <#if currentWeek gte 33>block<#else>none</#if>;">
<label for="maintenanceDescription">Registrer felledeler som må fornyes før neste sesong. Oppgi hva <label for="maintenanceDescription">Registrer felledeler som må fornyes før neste sesong. Oppgi hva
slags felledel (oppsamlerkopp, låsepinne, oppsamlerkopp, jordspyd, kryss, trakt, midtrør, sil, hel slags felledel (oppsamlerkopp, låsepinne, oppsamlerkopp, jordspyd, kryss, trakt, midtrør, sil, hel
...@@ -210,9 +220,16 @@ ...@@ -210,9 +220,16 @@
return false; return false;
} }
} }
<#if seasonTrapsite.season gt 2021>
if(weeks[wi] <= ${currentWeek} && theForm[weeks[wi] + "_observedAttacksDescription"].value.trim().length == 0)
{
alert("FEIL: Angrepsregistrering for alle utførte tømmerunder må være utfylt. Skriv eventuelt \"Ingen angrep registrert\".");
return false;
}
</#if>
} }
<#if currentWeek gte 33> <#if currentWeek gte 33>
// Check if maintenance description has content, issue warning if not // Check if maintenance description has content, issue warning and refuse submit if not
if(theForm["maintenanceDescription"].value.trim() == "") if(theForm["maintenanceDescription"].value.trim() == "")
{ {
alert("Etter endt sesong skal behov for reservedeler oppgis, også hvis det ikke er behov for det (skriv i så fall f.eks. \"Ikke behov for reservedeler\".)"); alert("Etter endt sesong skal behov for reservedeler oppgis, også hvis det ikke er behov for det (skriv i så fall f.eks. \"Ikke behov for reservedeler\".)");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment