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

Added option of free Sms receiving for selected users to system

Updated some translations
parent 5062a092
Branches
Tags
No related merge requests found
Showing
with 72 additions and 10 deletions
......@@ -269,6 +269,7 @@ public class UserController extends HttpServlet {
viewUser.setPhoneCountryCode(formValidation.getFormField("phoneCountryCode").getWebValue());
viewUser.setPhone(formValidation.getFormField("phone").getWebValue().replaceAll("[^0-9]", ""));
viewUser.setApprovesSmsBilling(formValidation.getFormField("approvesSmsBilling").getWebValue() != null);
viewUser.setFreeSms(formValidation.getFormField("freeSms").getWebValue() != null && formValidation.getFormField("freeSms").getWebValue().equals("true") );
viewUser.setPreferredLocale(formValidation.getFormField("preferredLocale").getWebValue());
if(user.isSuperUser())
{
......
......@@ -93,6 +93,7 @@ public class VipsLogicUser implements Serializable {
private Set<VipsLogicRole> vipsLogicRoles;
private Integer vipsCoreUserId;
private boolean approvesSmsBilling;
private boolean freeSms;
private UUID userUuid;
......@@ -463,4 +464,20 @@ public class VipsLogicUser implements Serializable {
public void setPhoneCountryCode(String phoneCountryCode) {
this.phoneCountryCode = phoneCountryCode;
}
/**
* @return the freeSms
*/
@Column(name="free_sms")
@JsonIgnore
public boolean isFreeSms() {
return freeSms;
}
/**
* @param freeSms the freeSms to set
*/
public void setFreeSms(boolean freeSms) {
this.freeSms = freeSms;
}
}
......@@ -32,6 +32,8 @@ import javax.persistence.Id;
public class MessageRecipient implements Serializable {
@Column(name = "preferred_locale")
private String preferredLocale;
@Column(name = "free_sms")
private Boolean freeSms;
private String type;
@Column(name = "msg_delivery_address")
private String msgDeliveryAddress;
......@@ -47,7 +49,8 @@ public class MessageRecipient implements Serializable {
String name,
String type,
String msgDeliveryAddress,
String preferredLocale
String preferredLocale,
boolean freeSms
)
{
this.recipientId = recipientId;
......@@ -55,6 +58,7 @@ public class MessageRecipient implements Serializable {
this.type=type;
this.msgDeliveryAddress = msgDeliveryAddress;
this.preferredLocale = preferredLocale;
this.freeSms = freeSms;
}
/**
......@@ -126,4 +130,18 @@ public class MessageRecipient implements Serializable {
public void setPreferredLocale(String preferredLocale) {
this.preferredLocale = preferredLocale;
}
/**
* @return the freeSms
*/
public Boolean getFreeSms() {
return freeSms;
}
/**
* @param freeSms the freeSms to set
*/
public void setFreeSms(Boolean freeSms) {
this.freeSms = freeSms;
}
}
......@@ -122,6 +122,7 @@ public class MessagingBean {
Query q = em.createNativeQuery(
"SELECT \n" +
" u.preferred_locale,\n" +
" u.free_sms, \n" +
" umf.format_name AS type,\n" +
" CASE mns.universal_message_format_id " +
" WHEN " + UniversalMessageFormat.FORMAT_EMAIL + " THEN u.email " +
......@@ -323,6 +324,7 @@ public class MessagingBean {
{
String sql = "SELECT \n" +
" u.preferred_locale,\n" +
" u.free_sms, \n" +
" umf.format_name AS type,\n" +
" CASE fns.universal_message_format_id " +
" WHEN " + UniversalMessageFormat.FORMAT_EMAIL + " THEN u.email " +
......@@ -406,6 +408,7 @@ public class MessagingBean {
Query q = em.createNativeQuery(
"SELECT \n" +
" u.preferred_locale,\n" +
" u.free_sms, \n" +
" umf.format_name AS type,\n" +
" CASE ons.universal_message_format_id " +
" WHEN " + UniversalMessageFormat.FORMAT_EMAIL + " THEN u.email " +
......
......@@ -358,3 +358,4 @@ myAccount=My account
emailNotVerified=You must verify your email address before the user approval process can proceed
pleaseAwaitApproval=Please await your user approval
userApproved=The user was approved
freeSms=Free SMS
......@@ -358,3 +358,4 @@ myAccount=My account
emailNotVerified=You must verify your email address before the user approval process can proceed
pleaseAwaitApproval=Please await your user approval
userApproved=The user was approved
freeSms=Free SMS
......@@ -357,3 +357,4 @@ myAccount=My account
emailNotVerified=You must verify your email address before the user approval process can proceed
pleaseAwaitApproval=Please await your user approval
userApproved=The user was approved
freeSms=Free SMS
......@@ -298,8 +298,8 @@ phone=Telefon
notificationSubscriptions=Meldingsabonnement
userAccountInformation=Brukerkontoinformasjon
notificationSubscriptionsUpdated=Meldingsabonnementene ble oppdatert
messageNotifications=Meldingsmeldinger
forecastNotifications=Varslingsmeldinger
messageNotifications=Meldingsnotiser
forecastNotifications=Varslingsnotiser
notificationSubscriptionDescription=Du kan abonnere p\u00e5 ulike typer meldinger nedenfor. Velg meldingsformat, for eksempel e-post eller SMS. For \u00e5 motta meldinger p\u00e5 SMS m\u00e5 du godta betalingsbetingelsene p\u00e5 brukerkontoinformasjonssiden.
messageFormat=Meldingsformat
Mail=E-post
......@@ -332,7 +332,7 @@ missingInDatabase=Ikke funnet i databasen
broadcastMessage=Kringkast denne meldingen
approvesSmsBilling=Godtar betaling for SMS-meldinger
approvesSmsBillingDescription=Ved \u00e5 krysse av her aksepterer du \u00e5 bli belastet p\u00e5 din mobilregning n\u00e5r du mottar SMS-meldinger fra v\u00e5re meldingstjenester. Prisen i Norge er 1 NOK/melding. Denne aksepten kan endres n\u00e5r som helst ved \u00e5 fjerne avkrysningen eller ved \u00e5 sende VIPS STOP til ditt lands kortnummer. For Norge er nummeret 1963. For \u00e5 velge type meldinger og format som du vil abonnere p\u00e5, vennligst velg "Meldingsabonnement" \u00f8verst p\u00e5 siden.
observationNotifications=Observasjonsmeldinger
observationNotifications=Observasjonsnotiser
editCropPests=Rediger skadegj\u00f8rere for kultur
includeAllChildCrops=Inkluder alle underarter, sorter og varianter
pestOrganismIds=Skadegj\u00f8rere
......@@ -358,3 +358,4 @@ myAccount=Min konto
emailNotVerified=Du m\u00e5 verifisere e-postadressen din f\u00f8r godkjenningsprosessen kan fortsette
pleaseAwaitApproval=Vennligst vent p\u00e5 din brukergodkjenning
userApproved=Brukeren ble godkjent
freeSms=Gratis SMS
......@@ -358,3 +358,4 @@ myAccount=My account
emailNotVerified=You must verify your email address before the user approval process can proceed
pleaseAwaitApproval=Please await your user approval
userApproved=The user was approved
freeSms=Free SMS
......@@ -38,6 +38,11 @@
"dataType" : "STRING",
"required" : false
},
{
"name" : "freeSms",
"dataType" : "STRING",
"required" : false
},
{
"name" : "firstName",
"dataType" : "STRING",
......
......@@ -200,7 +200,7 @@
</#macro>
<#macro page_contents>
<div class="singleBlockContainer">
<p><a href="/observation" class="btn btn-default back" role="button">${i18nBundle.back}</a></p>
<p><a href="/observation" class="btn btn-default back" role="button">${i18nBundle.back}</a><#if observation.observationId?has_content><a href="/observation?action=newObservationForm" class="btn btn-default" role="button">${i18nBundle.addNew}</a></#if></p>
<h1><#if observation.observationId?has_content>${i18nBundle.editObservation}<#else>${i18nBundle.newObservation}</#if></h1>
<div id="errorMsgEl" class="alert alert-danger" <#if !formValidation?has_content> style="display:none;"</#if>>
<#if formValidation?has_content>${formValidation.validationMessages?replace("\n", "<br>")}</#if>
......
......@@ -72,6 +72,18 @@
<p>${i18nBundle.approvesSmsBillingDescription}</p>
</div>
</div>
<#if user.isSuperUser() || user.isOrganizationAdmin()>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" value="true" name="freeSms"<#if viewUser.freeSms?has_content && viewUser.freeSms == false><#else>checked="checked"</#if>/>
</label>
${i18nBundle.freeSms}
</div>
</div>
<#else>
<input type="hidden" name="freeSms" value="<#if viewUser.freeSms?has_content && viewUser.freeSms == true>true<#else>false</#if>"/>
</#if>
<div class="form-group">
<label for="firstName">${i18nBundle.firstName}</label>
<input type="text" class="form-control" name="firstName" placeholder="${i18nBundle.firstName}" value="${viewUser.firstName!""}" onblur="validateField(this);"/>
......
......@@ -111,10 +111,10 @@ public class UniversalMessagingTest {
String[][] recipients = {
{"1","Tor-Einar Skog","Mail","tor-einar.skog@nibio.no","nb"},
{"2","Tor-Einar Skog","Mail","tor.einar.skog@gmail.com","en"},
{"3","Tor-Einar Skog","Mail","tor.einar.skog@gmail.com","bs"}//,
//{"1","Tor-Einar Skog","Sms","91303819"},
{"1","Tor-Einar Skog","Mail","tor-einar.skog@nibio.no","nb","true"},
{"2","Tor-Einar Skog","Mail","tor.einar.skog@gmail.com","en","false"},
{"3","Tor-Einar Skog","Mail","tor.einar.skog@gmail.com","bs","false"},
{"1","Tor-Einar Skog","Sms","91303819","nb","false"}
//{"2","Lars Aksel Opsahl", "Mail","lars.opsahl@nibio.no"}
};
......@@ -126,7 +126,8 @@ public class UniversalMessagingTest {
recipient[1],
recipient[2],
recipient[3],
recipient[4]
recipient[4],
recipient[5].equals("true")
)
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment