Skip to content

Commit

Permalink
Fatturazione elettronica gestione mail di avviso
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Mar 30, 2015
1 parent ef57ead commit a750995
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 5 deletions.
Expand Up @@ -34,6 +34,8 @@
import it.cnr.contab.docamm00.tabrif.bulk.Voce_ivaHome;
import it.cnr.contab.service.SpringUtil;
import it.cnr.contab.utenze00.bp.CNRUserContext;
import it.cnr.contab.utenze00.bulk.Utente_indirizzi_mailBulk;
import it.cnr.contab.utenze00.bulk.Utente_indirizzi_mailHome;
import it.cnr.jada.UserContext;
import it.cnr.jada.bulk.BulkList;
import it.cnr.jada.bulk.BusyResourceException;
Expand All @@ -46,6 +48,7 @@
import it.cnr.jada.persistency.sql.FindClause;
import it.cnr.jada.persistency.sql.Query;
import it.cnr.jada.persistency.sql.SQLBuilder;
import it.cnr.jada.util.SendMail;

import java.io.IOException;
import java.io.Serializable;
Expand All @@ -57,6 +60,8 @@
import java.util.Map;

import javax.mail.PasswordAuthentication;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;

import org.apache.commons.lang.StringUtils;

Expand Down Expand Up @@ -128,12 +133,36 @@ public void completaDocumento(UserContext usercontext, DocumentoEleTrasmissioneB
List<TerzoBulk> terzoUOS = terzoHome.fetchAll(sql);
if (terzoUOS != null && !terzoUOS.isEmpty()) {
documentoEleTrasmissioneBulk.setUnitaOrganizzativa(terzoUOS.get(0).getUnita_organizzativa());
documentoEleTrasmissioneBulk.setCommittente(terzoUOS.get(0));
documentoEleTrasmissioneBulk.setCommittente(terzoUOS.get(0));
} else {
TerzoBulk terzoEnte = terzoHome.findTerzoEnte();
documentoEleTrasmissioneBulk.setUnitaOrganizzativa(terzoEnte.getUnita_organizzativa());
documentoEleTrasmissioneBulk.setCommittente(terzoEnte);
}
/**
* Invio mail di notifica Ricezione
*/
try {
String subject= "[SIGLA] Notifica ricezione fattura passiva con Identificativo SdI:" + documentoEleTrasmissioneBulk.getIdentificativoSdi();
String text = "E' pervenuta la fattura dal trasmittente: <b>" +documentoEleTrasmissioneBulk.getIdCodice() + "</b><br>"+
"Prestatore: " + documentoEleTrasmissioneBulk.getDenominzionePrestatore() +"<br>" +
"Il documento è presente nell'area temporanea di SIGLA.";
String addressTO = null;
Utente_indirizzi_mailHome utente_indirizzi_mailHome = (Utente_indirizzi_mailHome)getHome(usercontext,Utente_indirizzi_mailBulk.class);
for (java.util.Iterator<Utente_indirizzi_mailBulk> i = utente_indirizzi_mailHome.findUtenteNotificaRicezioneFatturaElettronica(
documentoEleTrasmissioneBulk.getUnitaOrganizzativa()).iterator();i.hasNext();){
Utente_indirizzi_mailBulk utente_indirizzi = (Utente_indirizzi_mailBulk)i.next();
if (addressTO == null)
addressTO = new String();
else
addressTO = addressTO + ",";
addressTO = addressTO+utente_indirizzi.getIndirizzo_mail();
}
if (addressTO != null){
SendMail.sendMail(subject, text, InternetAddress.parse(addressTO));
}
}catch (Exception _ex) {
}
if (documentoEleTrasmissioneBulk.getPrestatoreCodicefiscale() != null ||
documentoEleTrasmissioneBulk.getPrestatoreCodice() != null) {
List<AnagraficoBulk> anagraficoBulks = anagraficoHome.findByCodiceFiscaleOrPartitaIVA(
Expand Down
Expand Up @@ -17,6 +17,8 @@ public class Utente_indirizzi_mailBase extends Utente_indirizzi_mailKey implemen
private java.lang.Boolean flEsitoPosFattElettr;
// FL_ESITO_NEG_FATT_ELETTR CHAR(1) NOT NULL
private java.lang.Boolean flEsitoNegFattElettr;
// FL_FEP_NOTIFICA_RICEZIONE CHAR(1) NOT NULL
private java.lang.Boolean flFepNotificaRicezione;

public Utente_indirizzi_mailBase() {
super();
Expand Down Expand Up @@ -64,5 +66,10 @@ public java.lang.Boolean getFlEsitoNegFattElettr() {
public void setFlEsitoNegFattElettr(java.lang.Boolean flEsitoNegFattElettr) {
this.flEsitoNegFattElettr = flEsitoNegFattElettr;
}

public java.lang.Boolean getFlFepNotificaRicezione() {
return flFepNotificaRicezione;
}
public void setFlFepNotificaRicezione(java.lang.Boolean flFepNotificaRicezione) {
this.flFepNotificaRicezione = flFepNotificaRicezione;
}
}
Expand Up @@ -3,6 +3,9 @@
* Date 23/02/2006
*/
package it.cnr.contab.utenze00.bulk;
import it.cnr.contab.config00.sto.bulk.CdrBulk;
import it.cnr.contab.config00.sto.bulk.CdrHome;
import it.cnr.contab.config00.sto.bulk.Unita_organizzativaBulk;
import it.cnr.contab.pdg00.bulk.Pdg_variazioneBulk;
import it.cnr.contab.pdg00.cdip.bulk.Ass_pdg_variazione_cdrBulk;
import it.cnr.contab.varstanz00.bulk.Ass_var_stanz_res_cdrBulk;
Expand Down Expand Up @@ -59,4 +62,18 @@ public java.util.Collection findUtenteApprovaVariazioniBilancio(Pdg_variazioneBu
sql.addSQLExistsClause("AND",sqlUtente);
return fetchAll(sql);
}

public java.util.Collection findUtenteNotificaRicezioneFatturaElettronica(Unita_organizzativaBulk bulk) throws IntrospectionException, PersistencyException
{
SQLBuilder sql = createSQLBuilder();
sql.addClause("AND","flFepNotificaRicezione",SQLBuilder.EQUALS,Boolean.TRUE);
SQLBuilder sqlUtente = getHomeCache().getHome(UtenteBulk.class).createSQLBuilder();
SQLBuilder sqlCdR = ((CdrHome)getHomeCache().getHome(CdrBulk.class)).createSQLBuilderEsteso();
sqlCdR.addClause("AND","cd_unita_organizzativa",SQLBuilder.EQUALS, bulk.getCd_unita_organizzativa());
sqlCdR.addSQLJoin("CDR.CD_CENTRO_RESPONSABILITA","UTENTE.CD_CDR");
sqlUtente.addSQLExistsClause("AND",sqlCdR);
sqlUtente.addSQLJoin("UTENTE.CD_UTENTE","UTENTE_INDIRIZZI_MAIL.CD_UTENTE");
sql.addSQLExistsClause("AND",sqlUtente);
return fetchAll(sql);
}
}
Expand Up @@ -47,6 +47,14 @@
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />
<columnMapping
columnName="FL_FEP_NOTIFICA_RICEZIONE"
propertyName="flFepNotificaRicezione"
sqlTypeName="CHAR"
columnSize="1"
nullable="false"
converterClassName="it.cnr.jada.persistency.sql.CHARToBooleanConverter" />

<columnMapping
columnName="UTUV"
propertyName="utuv"
Expand Down Expand Up @@ -90,6 +98,8 @@
name="flEsitoNegFattElettr" />
<persistentProperty
name="flEsitoPosFattElettr" />
<persistentProperty
name="flFepNotificaRicezione" />
<persistentProperty
name="utuv" />
<persistentProperty
Expand Down
Expand Up @@ -55,7 +55,14 @@
inputType="CHECKBOX"
nullable="false"
label="Comunica avvenuta approvazione Variazioni Competenza" />


<fieldProperty
name="flFepNotificaRicezione"
property="flFepNotificaRicezione"
inputType="CHECKBOX"
nullable="false"
label="Comunica ricezione Fattura Elettronica Passiva" />

<formFieldProperty
name="cd_utente" />
<formFieldProperty
Expand All @@ -72,7 +79,9 @@
name="fl_err_appr_var_bil_cnr_comp" />
<formFieldProperty
name="fl_com_app_var_stanz_comp" />

<formFieldProperty
name="flFepNotificaRicezione" />

<columnFieldProperty
name="indirizzo_mail" />
<columnFieldProperty
Expand All @@ -99,7 +108,11 @@
name="flEsitoNegFattElettr"
label="Comunica esiti negativi"
headerLabel="Fatturazione Elettronica" />

<columnFieldProperty
name="flFepNotificaRicezione"
label="Comunica ricezione"
headerLabel="Fatturazione Elettronica" />

<findFieldProperty
name="cd_utente" />
<findFieldProperty
Expand All @@ -116,4 +129,7 @@
name="fl_err_appr_var_bil_cnr_comp" />
<findFieldProperty
name="fl_com_app_var_stanz_comp" />
<findFieldProperty
name="flFepNotificaRicezione" />

</bulkInfo>
4 changes: 4 additions & 0 deletions sigla-web/src/main/webapp/utenze00/tab_mail.jsp
Expand Up @@ -44,4 +44,8 @@
<td colspan=2><% bp.getCrudUtente_indirizzi_mail().writeFormLabel( out, "flEsitoNegFattElettr"); %>
<% bp.getCrudUtente_indirizzi_mail().writeFormInput( out, "flEsitoNegFattElettr"); %></td>
</tr>
<tr>
<td colspan=2><% bp.getCrudUtente_indirizzi_mail().writeFormLabel( out, "flFepNotificaRicezione"); %>
<% bp.getCrudUtente_indirizzi_mail().writeFormInput( out, "flFepNotificaRicezione"); %></td>
</tr>
</table>

0 comments on commit a750995

Please sign in to comment.