*/
public class ControlUtils {
// MESSAGES
+
public static final String MGENPJ02 = "Tous les champs obligatoires ne sont pas valorisés";
public static final String MGENPJ04 = "Le format du codique n'est pas correct (6 caract sans espace)";
public static final String MGENPJ05 = "Les 3 premiers chiffres du codique ne sont pas cohérent avec la table de référencement";
public static final String MGENPJ09 = "Le code budget n'est pas au format attendu (2 caractères num. sans espace)";
public static final String MGENPJ10 = "Le FINESS n'est pas au format attendu (9 caractères num.)";
public static final String MGENPJ11 = "Le libellé de la collectivité est trop long (<= 38 caractères)";
+ public static final String MGENPJ111 = "Le libellé de la collectivité est obligatoire";
public static final String MGENPJ12 = "Le nom de la PJ est trop long (<= 100 caractères)";
+ public static final String MGENPJ121 = "Le nom de la PJ doit se terminer par une extension de fichier";
public static final String MGENPJ13 = "L'IdUnique est trop long (<= 50 caractères)";
public static final String MGENPJ14 = "L'exercice n'est pas au format attendu (AAAA)";
public static final String MGENPJ15 = "Tous les champs de le réf compta doivent être valorisés";
public static final String MGENPJ20 = "La valeur du N° de ligne de mandat saisie n'est pas conforme au format attendu (20 car alphanum)";
public static final String MGENPJ21 = "Les champs N° de mandat et N° de ligne doivent être renseignés";
public static final String MGENPJ22 = "La valeur du N° de décision saisie n'est pas conforme au format attendu (10 car alphanum)";
-
public static final String OBLIGATOIRE_NOM_PJ = "Le nom de la pj est obligatoire";
public static final String OBLIGATOIRE_ID_UNIQUE = "L'identifiant unique est obligatoire";
public static final String OBLIGATOIRE_FICHIER = "Le fichier est obligatoire";
-
// PATERNS
public static final String PATERN_ID_POST_LENGTH = "^[a-zA-Z0-9]{6}$";
public static final String PATERN_ID_POST_END = "^[a-zA-Z0-9]{3}[0-9]{3}$";
public static final String PATERN_CODE_COLL = "^[a-zA-Z0-9]{3}$";
public static final String PATERN_CODE_BUDG = "^[0-9]{2}$";
public static final String PATERN_FINESS = "^[0-9]{9}$";
-
public static final String PATERN_EXERCICE = "^[0-9]{4}$";
public static final String PATERN_NUM_PIECE = "^[a-zA-Z0-9]*$";
public static final String PATERN_NUM_LIGNE_PIECE = "^[a-zA-Z0-9]*$";
-
+ public static final String PATERN_NOM_PJ = ".+\\.[A-Za-z0-9]{2,4}";
// VARIABLES
public static final String DOMAINE_DEPENSE = "01";
public static final String DOMAINE_RECETTE = "02";
public static final String DOMAINE_BUDGET = "04";
-
+
public static String validateAccueilStep(ConfigHandler config, String idPost, String idColl, String codeColl, String codeBudg,
String finess, String libelleBudgetCollectivite) {
StringBuilder retour = new StringBuilder("");
StringUtils.ammend(retour, MGENPJ10);
}
- // TODO: A terme, il faudra rechercher dans le referentiel collectivite
- // pour verifier la cohhérence de la saisie du siret
- if (!libelleBudgetCollectivite.isEmpty() && libelleBudgetCollectivite.length() > 38) {
+ if (libelleBudgetCollectivite.isEmpty()) {
+ StringUtils.ammend(retour, MGENPJ111);
+ } else if (libelleBudgetCollectivite.length() > 38) {
StringUtils.ammend(retour, MGENPJ11);
}
public static String validatePJ(String typePjCode, String nomPj, String idUnique, String fichier) {
StringBuilder retour = new StringBuilder("");
-
+
if (fichier.isEmpty()) {
- StringUtils.ammend(retour, OBLIGATOIRE_FICHIER);
+ StringUtils.ammend(retour, OBLIGATOIRE_FICHIER);
}
+
+ if(!nomPj.isEmpty() && !nomPj.matches(PATERN_NOM_PJ)){
+ StringUtils.ammend(retour, MGENPJ121);
+ }
- if (!GeneratorUtils.isFacture(typePjCode)) {
- if (nomPj.length() > 100) {
- StringUtils.ammend(retour, MGENPJ12);
- } else if (nomPj.length() == 0) {
- StringUtils.ammend(retour, OBLIGATOIRE_NOM_PJ);
- }
-
- if (idUnique.length() > 50) {
- StringUtils.ammend(retour, MGENPJ13);
- } else if (idUnique.length() == 0) {
- StringUtils.ammend(retour, OBLIGATOIRE_ID_UNIQUE);
- }
+ if (nomPj.length() > 100) {
+ StringUtils.ammend(retour, MGENPJ12);
+ } else if (nomPj.length() == 0) {
+ StringUtils.ammend(retour, OBLIGATOIRE_NOM_PJ);
+ }
-
+ if (idUnique.length() > 50) {
+ StringUtils.ammend(retour, MGENPJ13);
+ } else if (idUnique.length() == 0) {
+ StringUtils.ammend(retour, OBLIGATOIRE_ID_UNIQUE);
}
return retour.toString();
}
-
+
public static String validateRefCompta(Pair domaine, String exercice, String numPiece, String numLignePiece) {
StringBuilder retour = new StringBuilder("");
if (exercice.isEmpty() && numPiece.isEmpty() && numLignePiece.isEmpty()) {
StringUtils.ammend(retour, MGENPJ15);
} else {
- if(!exercice.matches(PATERN_EXERCICE)){
+ if (!exercice.matches(PATERN_EXERCICE)) {
StringUtils.ammend(retour, MGENPJ14);
}
- if(isDomaineDepense(domaine.key)){
+ if (isDomaineDepense(domaine.key)) {
validateRefComptaDomaineDepense(retour, numPiece, numLignePiece);
- } else if(isDomaineRecette(domaine.key)){
+ } else if (isDomaineRecette(domaine.key)) {
validateRefComptaDomaineRecette(retour, numPiece, numLignePiece);
- } else if(isDomaineBudget(domaine.key)){
+ } else if (isDomaineBudget(domaine.key)) {
validateRefComptaDomaineBudget(retour, numPiece, numLignePiece);
}
}
return retour.toString();
}
-
- private static void validateRefComptaDomaineRecette(StringBuilder retour, String numPiece, String numLignePiece){
- if((!numPiece.isEmpty() && numPiece.length() > 20) || !numPiece.matches(PATERN_NUM_PIECE)){
+ private static void validateRefComptaDomaineRecette(StringBuilder retour, String numPiece, String numLignePiece) {
+ if ((!numPiece.isEmpty() && numPiece.length() > 20) || !numPiece.matches(PATERN_NUM_PIECE)) {
StringUtils.ammend(retour, MGENPJ16);
}
if ((!numLignePiece.isEmpty() && numLignePiece.length() > 20) || !numLignePiece.matches(PATERN_NUM_LIGNE_PIECE)) {
StringUtils.ammend(retour, MGENPJ18);
}
}
-
- private static void validateRefComptaDomaineDepense(StringBuilder retour, String numPiece, String numLignePiece){
- if((!numPiece.isEmpty() && numPiece.length() > 20) || !numPiece.matches(PATERN_NUM_PIECE)){
+
+ private static void validateRefComptaDomaineDepense(StringBuilder retour, String numPiece, String numLignePiece) {
+ if ((!numPiece.isEmpty() && numPiece.length() > 20) || !numPiece.matches(PATERN_NUM_PIECE)) {
StringUtils.ammend(retour, MGENPJ19);
}
if ((!numLignePiece.isEmpty() && numLignePiece.length() > 20) || !numLignePiece.matches(PATERN_NUM_LIGNE_PIECE)) {
StringUtils.ammend(retour, MGENPJ21);
}
}
-
- private static void validateRefComptaDomaineBudget(StringBuilder retour, String numPiece, String numLignePiece){
- if((!numPiece.isEmpty() && numPiece.length() > 10) || !numPiece.matches(PATERN_NUM_PIECE)){
+
+ private static void validateRefComptaDomaineBudget(StringBuilder retour, String numPiece, String numLignePiece) {
+ if ((!numPiece.isEmpty() && numPiece.length() > 10) || !numPiece.matches(PATERN_NUM_PIECE)) {
StringUtils.ammend(retour, MGENPJ22);
}
}
-
- private static boolean isDomaineDepense(String domaine){
- if(DOMAINE_DEPENSE.equals(domaine)){
+
+ private static boolean isDomaineDepense(String domaine) {
+ if (DOMAINE_DEPENSE.equals(domaine)) {
return true;
}
return false;
}
- private static boolean isDomaineRecette(String domaine){
- if(DOMAINE_RECETTE.equals(domaine)){
+
+ private static boolean isDomaineRecette(String domaine) {
+ if (DOMAINE_RECETTE.equals(domaine)) {
return true;
}
return false;
}
- private static boolean isDomaineBudget(String domaine){
- if(DOMAINE_BUDGET.equals(domaine)){
+
+ private static boolean isDomaineBudget(String domaine) {
+ if (DOMAINE_BUDGET.equals(domaine)) {
return true;
}
return false;
}
-
+
public static String validateIdUniquePJ(String idUnique) {
StringBuilder retour = new StringBuilder();
if (idUnique.length() > 50) {
}
return retour.toString();
}
-
+
public static boolean verifPremiersCaracteresIdPost(ConfigHandler config, String idpost) {
return config.getCodiquesPremiersCaracteres().contains(idpost.substring(0, 3));
}
return sb.toString();
}
- public static boolean isFacture(String typePjCode){
- String PES_RECETTE = "002";
- String PES_DEPENSE = "003";
- if(PES_RECETTE.equals(typePjCode) || PES_DEPENSE.equals(typePjCode)){
- return true;
- }
- return false;
- }
}
public void validate() throws StepValidationException {
boolean isValid = false;
StringBuilder retour = new StringBuilder();
- if (((TableModelPJ) this.pjPanelUI.getTablePjs().getModel()).getPjs().size() == 0 && ((TableModelPJ) this.pjPanelUI.getTablePjs().getModel()).getFactures().size() == 0) {
+ if (((TableModelPJ) this.pjPanelUI.getTablePjs().getModel()).getPjs().size() == 0) {
retour.append("Au moins une PJ doit être ajoutée pour poursuivre la génération");
} else {
isValid = true;
public List<PJfile> getPjs(){
return ((TableModelPJ) this.pjPanelUI.getTablePjs().getModel()).getPjs();
}
-
+ /*
public List<PJfile> getFactures(){
return ((TableModelPJ) this.pjPanelUI.getTablePjs().getModel()).getFactures();
- }
+ }*/
}
}
@Override
- public void validate() throws StepValidationException {
- TPESFactureOld factureObj = null;
- if(!getWizardProcess().getPjStep().getFactures().isEmpty()){
- try {
- JAXBContext jc = JAXBContext.newInstance(TPESFactureOld.class);
- Unmarshaller u = jc.createUnmarshaller();
- factureObj = (TPESFactureOld)u.unmarshal(new File(getWizardProcess().getPjStep().getFactures().get(0).getUrlFile()) );
- } catch (Exception e){
- logger.error("Probleme de unmarshaller",e);
- throw new StepValidationException("Probleme de generation de PES Facture.");
- }
- }
-
+ public void validate() throws StepValidationException {
String directoryPath = PropertiesUtils.getDiretoryByProperty(getWizardProcess().getProperties(), Constants.PROPERTIES_LAST_DIRECTORY_SAVE, System.getProperty("user.home"));
JFileChooser chooseFileDialog = new JFileChooser(new File(directoryPath));
FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter("xml files (*.xml)", "xml");
PESAller pesAller = getWizardProcess().getPesAller();
// Ajout du nom de fichier et de la date de création
GeneratePesUtils.setNomFicAndDatStr(pesAller, pesPjFile.getName());
-
- if(factureObj != null){
- pesAller.setPESFacture(factureObj);
- }
+
pesAller.setPESPJ(GeneratePesUtils.generatePesPj(pesAller, getWizardProcess().getPjStep().getPjs()));
FileOutputStream fos = new FileOutputStream(pesPjFile);
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="libelleCollectiviteBudget" alignment="0" max="32767" attributes="0"/>
- <Component id="finess" pref="185" max="32767" attributes="1"/>
+ <Component id="finess" pref="171" max="32767" attributes="1"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
</Component>
<Component class="javax.swing.JLabel" name="libelleCollectiviteBudgetLabel">
<Properties>
- <Property name="text" type="java.lang.String" value="Libellé collectivite budget"/>
+ <Property name="text" type="java.lang.String" value="<html>Libellé collectivite budget (<font color='red'>*</font>)</html>"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="libelleCollectiviteBudget">
idCollLabel = new javax.swing.JLabel();
codCollLabel = new javax.swing.JLabel();
- idColl = new com.axyus.swing.components.JTextFieldLimit(14);
- codColl = new com.axyus.swing.components.JTextFieldLimit(3);
- finess = new com.axyus.swing.components.JTextFieldLimit(9);
- idPost = new com.axyus.swing.components.JTextFieldLimit(6);
+ idColl = new JTextFieldLimit(14);
+ codColl = new JTextFieldLimit(3);;
+ finess = new JTextFieldLimit(9);;
+ idPost = new JTextFieldLimit(6);;
finessLabel = new javax.swing.JLabel();
codBudgLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel8 = new javax.swing.JLabel();
- codBudg = new com.axyus.swing.components.JTextFieldLimit(2);
+ codBudg = new JTextFieldLimit(2);;
idPostLabel = new javax.swing.JLabel();
libelleCollectiviteBudgetLabel = new javax.swing.JLabel();
libelleCollectiviteBudget = new javax.swing.JComboBox();
idPostLabel.setText("<html>Identifiant du poste (<font color='red'>*</font>)</html>");
- libelleCollectiviteBudgetLabel.setText("Libellé collectivite budget");
+ libelleCollectiviteBudgetLabel.setText("<html>Libellé collectivite budget (<font color='red'>*</font>)</html>");
libelleCollectiviteBudget.setEditable(true);
.addComponent(codCollLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(finessLabel, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(idCollLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(libelleCollectiviteBudgetLabel, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addComponent(libelleCollectiviteBudgetLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(libelleCollectiviteBudget, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(finess, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE))
+ .addComponent(finess, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(jLabel8))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(libelleCollectiviteBudgetLabel)
+ .addComponent(libelleCollectiviteBudgetLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(libelleCollectiviteBudget, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(66, 66, 66))
);
// Variables declaration - do not modify//GEN-BEGIN:variables
- private com.axyus.swing.components.JTextFieldLimit codBudg;
+ private JTextFieldLimit codBudg;
private javax.swing.JLabel codBudgLabel;
- private com.axyus.swing.components.JTextFieldLimit codColl;
+ private JTextFieldLimit codColl;
private javax.swing.JLabel codCollLabel;
- private com.axyus.swing.components.JTextFieldLimit finess;
+ private JTextFieldLimit finess;
private javax.swing.JLabel finessLabel;
- private com.axyus.swing.components.JTextFieldLimit idColl;
+ private JTextFieldLimit idColl;
private javax.swing.JLabel idCollLabel;
- private com.axyus.swing.components.JTextFieldLimit idPost;
+ private JTextFieldLimit idPost;
private javax.swing.JLabel idPostLabel;
private javax.swing.JLabel jLabel8;
private javax.swing.JSeparator jSeparator1;
PJfile pj = tableModel.getDatas().get(tablePjs.getSelectedRow());
pieceJustificative.setText(pj.getUrlFile());
- if(!GeneratorUtils.isFacture(pj.getPj().getTypePJ().getV())){
- nomPj.setText(pj.getPj().getNomPJ().getV());
- idUnique.setText(pj.getPj().getIdUnique().getV());
- description.setText(pj.getPj().getDescription().getV());
- }
+ nomPj.setText(pj.getPj().getNomPJ().getV());
+ idUnique.setText(pj.getPj().getIdUnique().getV());
+ description.setText(pj.getPj().getDescription().getV());
for (int i = 0; i < typePj.getItemCount(); i++) {
String value = ((Pair) typePj.getItemAt(i)).key;
if (value.startsWith(pj.getPj().getTypePJ().getV())) {
((GeneratorPesPjWizardProcess) getWizardDialog().getWizardProcess()).getProperties().setProperty(Constants.PROPERTIES_LAST_DIRECTORY_PJ, selectedFile.getParent());
if (selectedFile != null) {
pieceJustificative.setText(selectedFile.getAbsolutePath());
- if(!GeneratorUtils.isFacture(((Pair) typePj.getSelectedItem()).key)){
- description.setText(selectedFile.getName());
- }
+ description.setText(selectedFile.getName());
+ nomPj.setText(selectedFile.getName());
}
try {
((GeneratorPesPjWizardProcess) getWizardDialog().getWizardProcess()).storeInPropertiesFile();
}//GEN-LAST:event_idUniqueActionPerformed
private void typePjItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_typePjItemStateChanged
- if (evt.getStateChange() == ItemEvent.SELECTED) {
+ /*if (evt.getStateChange() == ItemEvent.SELECTED) {
if(GeneratorUtils.isFacture(((Pair) evt.getItem()).key)){
resetChampsForFacture();
//nomPj.setEnabled(false);
}
} else if(evt.getStateChange() == ItemEvent.DESELECTED){
oldTypePjKey=((Pair) evt.getItem()).key;
- }
+ }*/
}//GEN-LAST:event_typePjItemStateChanged
private void genCheckboxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_genCheckboxItemStateChanged
public Object getValueAt(int row, int col) {
PJfile pj = data.get(row);
switch (col){
- case 0 : if(GeneratorUtils.isFacture(pj.getPj().getTypePJ().getV())){ return FilenameUtils.getName(pj.getUrlFile());} return pj.getPj().getNomPJ().getV();
+ case 0 : return pj.getPj().getNomPJ().getV();
case 1 : return config.getPjLibelleFromTypePj(pj.getPj().getTypePJ().getV());
case 2 : return pj.getPj().getIdUnique()!=null?pj.getPj().getIdUnique().getV():"-";
case 3 : return pj.getPj().getRefCompta()!=null?pj.getPj().getRefCompta().size():"-";
}
public List<PJfile> getPjs() {
- List<PJfile> pjs = new ArrayList<PJfile>();
- for(PJfile pj:data){
- if(!GeneratorUtils.isFacture(pj.getPj().getTypePJ().getV())){
- pjs.add(pj);
- }
- }
- return pjs;
- }
-
- public List<PJfile> getFactures() {
- List<PJfile> pjs = new ArrayList<PJfile>();
- for(PJfile pj:data){
- if(GeneratorUtils.isFacture(pj.getPj().getTypePJ().getV())){
- pjs.add(pj);
- }
- }
- return pjs;
+ return data;
}
public void replacePJs(List<PJfile> pjs){
<name>${artifactId}</name>
<url>http://axyus.com</url>
<properties>
- <applicationVersion>2.4.0</applicationVersion>
+ <applicationVersion>2.5.0</applicationVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<prerequisites>
xsi:noNamespaceSchemaLocation="../../defs/technical-component-definition.xsd">
<name>generator-pes-pj</name>
<description>Générateur de PES PJ</description>
- <release>5.2.4.0</release>
+ <release>5.2.5.0</release>
<url>http://xemelios.org/updatesV5/generator-pes-pj</url>
<type>COMPOSANT</type>
<destination>
<file>${xemelios.tools.directory}/generator-pes-pj.jar</file>
</deletes>
<release-notes>
+ <release v="5.2.5.0">
+ <note visibility="public">Le libellé de la collectivité est désormais obligatoire</note>
+ <note visibility="public">Le nom de chaque PJ doit contenir l'extension du fichier</note>
+ <note visibility="public">Les factures sont dorénavant incluses dans le PES PJ</note>
+ </release>
<release v="5.2.4.0">
<note visibility="public">Correction du format des dates (AAAA-MM-JJ)</note>
</release>