();
String nastri_type = request().stringFormValueForKey("nastri_type");
String nastri_prod_lenght = request().stringFormValueForKey("nastri_prod_lenght");
String nastri_prod_width = request().stringFormValueForKey("nastri_prod_width");
String nastri_prod_height = request().stringFormValueForKey("nastri_prod_height");
String nastri_prod_direction = request().stringFormValueForKey("nastri_prod_direction");
String nastri_weight_trans = request().stringFormValueForKey("nastri_weight_trans");
String nastri_prod_number = request().stringFormValueForKey("nastri_prod_number");
String nastri_direction = request().stringFormValueForKey("nastri_direction");
String nastri_direction_mono_sub = request().stringFormValueForKey("nastri_direction_mono_sub");
String nastri_lenght = request().stringFormValueForKey("nastri_lenght");
String nastri_width = request().stringFormValueForKey("nastri_width");
String motoriduttore_option = request().stringFormValueForKey("motoriduttore_option");
String nastri_speed = request().stringFormValueForKey("nastri_speed");
String nastri_engine = request().stringFormValueForKey("nastri_engine");
String nastri_rinvio = request().stringFormValueForKey("nastri_rinvio");
String nastri_lamiera = request().stringFormValueForKey("nastri_lamiera");
String nastri_acc_prod = request().stringFormValueForKey("nastri_acc_prod");
String nastri_acc_prod_numero = request().stringFormValueForKey("nastri_acc_prod_numero");
String nastri_uso_alim = request().stringFormValueForKey("nastri_uso_alim");
String nastri_tip_tap = request().stringFormValueForKey("nastri_tip_tap");
String input_altro = request().stringFormValueForKey("input_altro");
String nastri_sost = request().stringFormValueForKey("nastri_sost");
String nastri_hi = request().stringFormValueForKey("nastri_hi");
String nastri_hu = request().stringFormValueForKey("nastri_hu");
String nastri_terminali = request().stringFormValueForKey("nastri_terminali");
String nastri_guida_lat = request().stringFormValueForKey("nastri_guida_lat");
String note = request().stringFormValueForKey("note");
String name = request().stringFormValueForKey("name");
String surname = request().stringFormValueForKey("surname");
String company = request().stringFormValueForKey("company");
String address = request().stringFormValueForKey("address");
String province = request().stringFormValueForKey("province");
String phone = request().stringFormValueForKey("phone");
String email = request().stringFormValueForKey("email");
String privacy = request().stringFormValueForKey("privacy");
NSTimestamp requestDate = new NSTimestamp();
String s = new SimpleDateFormat("dd/MM/yyyy").format(requestDate);
boolean subscribe = privacy != null && (privacy.equalsIgnoreCase("checked") || privacy.equalsIgnoreCase("on") || privacy.equalsIgnoreCase("true"));
if ((email != null) && (subscribe)) {
try {
// @formatter:off
String intro_for_user = null;
String intro_for_admin = null;
String html = null;
String html_for_admin = null;
if (languageCode().equals("ita")) {
intro_for_user = ""
+ "
Gentile utente, grazie per la tua richiesta al sito Alutec.
"
+ "
Di seguito trovi il riepilogo dei dati della tua richiesta:
" + "
";
html = (name != null ? "
Nome: " + name + "
" : "")
+ (surname != null ? "
Cognome: " + surname + "
" : "")
+ (company != null ? "
Azienda: " + company + "
" : "")
+ (company != null ? "
Indirizzo: " + address + "
" : "")
+ (company != null ? "
Provincia: " + province + "
" : "")
+ (phone != null ? "
Telefono: " + phone + "
" : "")
+ (email != null ? "
Email: " + email + "" : "") + "
"
+ (nastri_type != null ? "
Tipologia di prodotto trasportato: " + nastri_type + "
" : "")
+ (nastri_prod_lenght != null ? "
Lunghezza prodotto trasportato (mm): " + nastri_prod_lenght + "
" : "")
+ (nastri_prod_width != null ? "
Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "")
+ (nastri_prod_height != null ? "
Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "")
+ (nastri_prod_direction != null ? "
Direzione prodotto trasportato (mm): " + nastri_prod_direction + "
" : "")
+ (nastri_weight_trans != null ? "
Peso prodotto trasportato (kg): " + nastri_weight_trans + "
" : "")
+ (nastri_prod_number != null ? "
Numero prodotti trasportati: " + nastri_prod_number + "
" : "")
+ "
"
+ (nastri_direction != null ? "
Direzione di avanzamento: " + nastri_direction + "
" : "")
+ (nastri_direction_mono_sub != null ? "
Tiro/Spinta: " + nastri_direction_mono_sub + "
" : "")
+ (nastri_lenght != null ? "
Lunghezza nastro (mm): " + nastri_lenght + "
" : "")
+ (nastri_width != null ? "
Larghezza nastro (mm): " + nastri_width + "
" : "")
+ (motoriduttore_option != null ? "
Completo di motoriduttore: " + motoriduttore_option + "
" : "")
+ (nastri_speed != null ? "
Velocità di trasporto (m/min): " + nastri_speed + "
" : "")
+ "
"
+ (nastri_engine != null ? "
Motorizzazione: " + nastri_engine + "
" : "")
+ (nastri_rinvio != null ? "
Rinvio a penna: " + nastri_rinvio + "
" : "")
+ "
"
+ (nastri_lamiera != null ? "
Lamiera di scorrimento: " + nastri_lamiera + "
" : "")
+ (nastri_acc_prod != null ? "
Accumulo prodotti: " + nastri_acc_prod + "
" : "")
+ (nastri_acc_prod_numero != null ? "
Accumulo prodotti (numero): " + nastri_acc_prod_numero + "
" : "")
+ (nastri_uso_alim != null ? "
Uso alimentare: " + nastri_uso_alim + "
" : "")
+ (nastri_tip_tap != null ? "
Tipologia di tappeto: " + nastri_tip_tap + "
" : "")
+ (input_altro != null ? "
Tipologia di tappeto (ALTRO): " + input_altro + "
" : "")
+ "
"
+ (nastri_sost != null ? "
Struttura di sostegno: " + nastri_sost + "
" : "")
+ (nastri_hi != null ? "
Altezza in ingresso: " + nastri_hi + "
" : "")
+ (nastri_hu != null ? "
Altezza in uscita: " + nastri_hu + "
" : "")
+ (nastri_terminali != null ? "
Appoggio gambe di sostegno: " + nastri_terminali + "
" : "")
+ (nastri_guida_lat != null ? "
Guida laterale di contenimento: " + nastri_guida_lat + "
" : "")
+ "
"
+ (note != null ? "
Messaggio: " + note + "" : "") + "
";
}
else if (languageCode().equals("eng")) {
intro_for_user = ""
+ "
Dear user, thank you for your request to the Alutec site.
"
+ "
Below you will find a summary of your request data:
" + "
";
html = (name != null ? "
Name: " + name + "
" : "")
+ (surname != null ? "
Surname: " + surname + "
" : "")
+ (company != null ? "
Company: " + company + "
" : "")
+ (company != null ? "
Address: " + address + "
" : "")
+ (company != null ? "
Province: " + province + "
" : "")
+ (phone != null ? "
Telephone: " + phone + "
" : "")
+ (email != null ? "
Email: " + email + "" : "") + "
"
+ (nastri_type != null ? "
Type of product transported: " + nastri_type + "
" : "")
+ (nastri_prod_lenght != null ? "
Length of transported product (mm): " + nastri_prod_lenght + "
" : "")
+ (nastri_prod_width != null ? "
Width of transported product (mm): " + nastri_prod_width + "
" : "")
+ (nastri_prod_height != null ? "
Height of transported product (mm): " + nastri_prod_height + "
" : "")
+ (nastri_prod_direction != null ? "
Direction of transported product (mm): " + nastri_prod_direction + "
" : "")
+ (nastri_weight_trans != null ? "
Product weight transported (kg): " + nastri_weight_trans + "
" : "")
+ "
"
+ (nastri_direction != null ? "
Direction of advance: " + nastri_direction + "
" : "")
+ (nastri_direction_mono_sub != null ? "
Shot/Push: " + nastri_direction_mono_sub + "
" : "")
+ (nastri_lenght != null ? "
Ribbon length (mm): " + nastri_lenght + "
" : "")
+ (nastri_width != null ? "
Ribbon width (mm): " + nastri_width + "
" : "")
+ (motoriduttore_option != null ? "
Complete with gearmotor: " + motoriduttore_option + "
" : "")
+ (nastri_speed != null ? "
Transport speed (m/min): " + nastri_speed + "
" : "")
+ "
"
+ (nastri_engine != null ? "
Motorisation: " + nastri_engine + "
" : "")
+ (nastri_rinvio != null ? "
Pen reference: " + nastri_rinvio + "
" : "")
+ "
"
+ (nastri_lamiera != null ? "
Sliding plate: " + nastri_lamiera + "
" : "")
+ (nastri_prod_number != null ? "
Number of products transported: " + nastri_prod_number + "
" : "")
+ (nastri_acc_prod != null ? "
Product accumulation: " + nastri_acc_prod + "
" : "")
+ (nastri_acc_prod_numero != null ? "
Product accumulation (number): " + nastri_acc_prod_numero + "
" : "")
+ (nastri_uso_alim != null ? "
Food use: " + nastri_uso_alim + "
" : "")
+ (nastri_tip_tap != null ? "
Type of carpet: " + nastri_tip_tap + "
" : "")
+ (input_altro != null ? "
Type of carpet (OTHER): " + input_altro + "
" : "")
+ "
"
+ (nastri_sost != null ? "
Support structure: " + nastri_sost + "
" : "")
+ (nastri_hi != null ? "
Entrance height: " + nastri_hi + "
" : "")
+ (nastri_hu != null ? "
Output height: " + nastri_hu + "
" : "")
+ (nastri_terminali != null ? "
Support leg rest: " + nastri_terminali + "
" : "")
+ (nastri_guida_lat != null ? "
Side containment guide: " + nastri_guida_lat + "
" : "")
+ "
"
+ (note != null ? "
Messaggio: " + note + "" : "") + "
";
}
else if (languageCode().equals("deu")) {
intro_for_user = ""
+ "
Sehr geehrter Benutzer, vielen Dank für Ihre Anfrage an die Alutec-Website..
"
+ "
Nachfolgend finden Sie eine Zusammenfassung Ihrer Anfragedaten:
" + "
";
html = (name != null ? "
Name: " + name + "
" : "")
+ (surname != null ? "
Surname: " + surname + "
" : "")
+ (company != null ? "
Company: " + company + "
" : "")
+ (company != null ? "
Address: " + address + "
" : "")
+ (company != null ? "
Province: " + province + "
" : "")
+ (phone != null ? "
Telephone: " + phone + "
" : "")
+ (email != null ? "
Email: " + email + "" : "") + "
"
+ (nastri_type != null ? "
Art des transportierten Produkts: " + nastri_type + "
" : "")
+ (nastri_prod_lenght != null ? "
Länge des transportierten Produkts (mm): " + nastri_prod_lenght + "
" : "")
+ (nastri_prod_width != null ? "
Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "")
+ (nastri_prod_height != null ? "
Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "")
+ (nastri_prod_direction != null ? "
Richtung des transportierten Produkts (mm): " + nastri_prod_direction + "
" : "")
+ (nastri_weight_trans != null ? "
Gewicht des transportierten Produkts (kg): " + nastri_weight_trans + "
" : "")
+ "
"
+ (nastri_direction != null ? "
Vorwärtsrichtung: " + nastri_direction + "
" : "")
+ (nastri_direction_mono_sub != null ? "
Schuss/Stoß: " + nastri_direction_mono_sub + "
" : "")
+ (nastri_lenght != null ? "
Bandlänge (mm): " + nastri_lenght + "
" : "")
+ (nastri_width != null ? "
Bandbreite (mm): " + nastri_width + "
" : "")
+ (motoriduttore_option != null ? "
Komplett mit Getriebemotor: " + motoriduttore_option + "
" : "")
+ (nastri_speed != null ? "
Transportgeschwindigkeit (m/min): " + nastri_speed + "
" : "")
+ "
"
+ (nastri_engine != null ? "
Motorisierung: " + nastri_engine + "
" : "")
+ (nastri_rinvio != null ? "
Stiftreferenz: " + nastri_rinvio + "
" : "")
+ "
"
+ (nastri_lamiera != null ? "
Gleitplatte: " + nastri_lamiera + "
" : "")
+ (nastri_prod_number != null ? "
Anzahl der transportierten Produkte: " + nastri_prod_number + "
" : "")
+ (nastri_acc_prod != null ? "
Produktakkumulation: " + nastri_acc_prod + "
" : "")
+ (nastri_acc_prod_numero != null ? "
Produktakkumulation (Anzahl): " + nastri_acc_prod_numero + "
" : "")
+ (nastri_uso_alim != null ? "
Lebensmittelverwendung: " + nastri_uso_alim + "
" : "")
+ (nastri_tip_tap != null ? "
Art des Teppichs: " + nastri_tip_tap + "
" : "")
+ (input_altro != null ? "
Teppichart (ANDERE): " + input_altro + "
" : "")
+ "
"
+ (nastri_sost != null ? "
Stützstruktur: " + nastri_sost + "
" : "")
+ (nastri_hi != null ? "
Eingangshöhe: " + nastri_hi + "
" : "")
+ (nastri_hu != null ? "
Ausgabehöhe: " + nastri_hu + "
" : "")
+ (nastri_terminali != null ? "
Stützbeinstütze: " + nastri_terminali + "
" : "")
+ (nastri_guida_lat != null ? "
Guida laterale di contenimento: " + nastri_guida_lat + "
" : "")
+ "
"
+ (note != null ? "
Nachricht: " + note + "" : "") + "
";
}
intro_for_admin = ""
+ "
Buongiorno Tecnico Alutec,
"
+ "
hai ricevuto una richiesta dal configuratore del sito per il prodotto \"Nastri di trasporto\", di seguito il riepilogo dei dati della richiesta:
" + "
";
html_for_admin = (name != null ? "
Nome: " + name + "
" : "")
+ (surname != null ? "
Cognome: " + surname + "
" : "")
+ (company != null ? "
Azienda: " + company + "
" : "")
+ (company != null ? "
Indirizzo: " + address + "
" : "")
+ (company != null ? "
Provincia: " + province + "
" : "")
+ (phone != null ? "
Telefono: " + phone + "
" : "")
+ (email != null ? "
Email: " + email + "" : "") + "
"
+ (nastri_type != null ? "
Tipologia di prodotto trasportato: " + nastri_type + "
" : "")
+ (nastri_prod_lenght != null ? "
Lunghezza prodotto trasportato (mm): " + nastri_prod_lenght + "
" : "")
+ (nastri_prod_width != null ? "
Larghezza prodotto trasportato (mm): " + nastri_prod_width + "
" : "")
+ (nastri_prod_height != null ? "
Altezza prodotto trasportato (mm): " + nastri_prod_height + "
" : "")
+ (nastri_prod_direction != null ? "
Direzione prodotto trasportato (mm): " + nastri_prod_direction + "
" : "")
+ (nastri_weight_trans != null ? "
Peso prodotto trasportato (kg): " + nastri_weight_trans + "
" : "")
+ "
"
+ (nastri_direction != null ? "
Direzione di avanzamento: " + nastri_direction + "
" : "")
+ (nastri_direction_mono_sub != null ? "
Tiro/Spinta: " + nastri_direction_mono_sub + "
" : "")
+ (nastri_lenght != null ? "
Lunghezza nastro (mm): " + nastri_lenght + "
" : "")
+ (nastri_width != null ? "
Larghezza nastro (mm): " + nastri_width + "
" : "")
+ (nastri_speed != null ? "
Velocità di trasporto (m/min): " + nastri_speed + "
" : "")
+ "
"
+ (nastri_engine != null ? "
Motorizzazione: " + nastri_engine + "
" : "")
+ (nastri_rinvio != null ? "
Rinvio a penna: " + nastri_rinvio + "
" : "")
+ "
"
+ (nastri_lamiera != null ? "
Lamiera di scorrimento: " + nastri_lamiera + "
" : "")
+ (nastri_prod_number != null ? "
Numero prodotti trasportati: " + nastri_prod_number + "
" : "")
+ (nastri_acc_prod != null ? "
Accumulo prodotti: " + nastri_acc_prod + "
" : "")
+ (nastri_acc_prod_numero != null ? "
Accumulo prodotti (numero): " + nastri_acc_prod_numero + "
" : "")
+ (nastri_uso_alim != null ? "
Uso alimentare: " + nastri_uso_alim + "
" : "")
+ (nastri_tip_tap != null ? "
Tipologia di tappeto: " + nastri_tip_tap + "
" : "")
+ (input_altro != null ? "
Tipologia di tappeto (ALTRO): " + input_altro + "
" : "")
+ "
"
+ (nastri_sost != null ? "
Struttura di sostegno: " + nastri_sost + "
" : "")
+ (nastri_hi != null ? "
Altezza in ingresso: " + nastri_hi + "
" : "")
+ (nastri_hu != null ? "
Altezza in uscita: " + nastri_hu + "
" : "")
+ (nastri_terminali != null ? "
Appoggio gambe di sostegno: " + nastri_terminali + "
" : "")
+ (nastri_guida_lat != null ? "
Guida laterale di contenimento: " + nastri_guida_lat + "
" : "")
+ "
"
+ (note != null ? "
Messaggio: " + note + "" : "") + "
";
// @formatter:off
String html4admin = intro_for_admin + html_for_admin;
String html4user = intro_for_user + html;
// @formatter:on
ERMailDeliveryHTML newmail = new ERMailDeliveryHTML();
newmail.setFromAddress("tecnico@alutecsrl.it");
if (languageCode().equals("ita")) {
newmail.setSubject("Richiesta inviata a Alutec - Configuratore NASTRI DI TRASPORTO");
}
else if (languageCode().equals("eng")) {
newmail.setSubject("Request sent to Alutec - CONVEYOR BELTS Configurator");
}
else if (languageCode().equals("deu")) {
newmail.setSubject("Anfrage an Alutec - TRANSPORTGÜRTEL Configurator gesendet");
}
newmail.setReplyToAddress("tecnico@alutecsrl.it");
newmail.setToAddress(email);
newmail.setHTMLContent(html4user);
newmail.sendMail();
ERMailDeliveryHTML adminmail = new ERMailDeliveryHTML();
adminmail.setFromAddress("tecnico@alutecsrl.it");
adminmail.setReplyToAddress(email);
adminmail.setSubject("Richiesta dal sito Alutec - Configuratore NASTRI DI TRASPORTO");
adminmail.setToAddresses(AppSupport.AdminEmails());
adminmail.setHTMLContent(html4admin);
String filepath = request().stringFormValueForKey(PLUpload.filePathPrefix + "allegato");
if (filepath != null) {
String filename = request().stringFormValueForKey(PLUpload.fileNamePrefix + "allegato");
File f = new File(filepath);
if (f.exists()) {
ERMailFileAttachment attachment = new ERMailFileAttachment(filename, "001", f);
adminmail.addAttachment(attachment);
}
}
adminmail.sendMail();
respdict.setObjectForKey(true, "success");
String msg = null;
if (languageCode().equals("ita")) {
msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Richiesta inviata con successo");
} else if (languageCode().equals("eng")) {
msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Request sent successfully");
}
else if (languageCode().equals("deu")) {
msg = currentLanguageLocalizer().localizedStringForKeyWithDefault("Anfrage erfolgreich gesendet");
}
respdict.setObjectForKey(msg, "message");
} catch (Exception e) {
e.printStackTrace();
}
} else {
String error = null;
if (languageCode().equals("ita")) {
error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Assicurati di aver compilato correttamente tutti i campi");
} else {
error = ERXLocalizer.defaultLocalizer().localizedStringForKeyWithDefault("Make sure you have filled in all fields correctly");
}
respdict.setObjectForKey(false, "success");
respdict.setObjectForKey(error, "message");
}
JSONResponse resp = new JSONResponse(respdict);
return resp;
}
}