Subversion Repositories eFlore/Applications.coel

Rev

Rev 1417 | Rev 1685 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1417 Rev 1513
Line 212... Line 212...
212
			fondationDate = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(fondationChaine);
212
			fondationDate = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(fondationChaine);
213
		}
213
		}
214
		return fondationDate;
214
		return fondationDate;
215
	}
215
	}
Line -... Line 216...
-
 
216
	
216
	
217
	/*
217
	public String getAnneeOuDateFondation()	{
218
	public String getAnneeOuDateFondation()	{
218
		 String valeurDateFondation = get("date_fondation");
219
		 String valeurDateFondation = get("date_fondation");
219
		 if (!UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.endsWith("00-00")) {
220
		 if (!UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.endsWith("00-00")) {
220
			 valeurDateFondation = valeurDateFondation.substring(0, 4);
221
			 valeurDateFondation = valeurDateFondation.substring(0, 4);
221
		 } else if (UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.equals("0000-00-00")) {
222
		 } else if (UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.equals("0000-00-00")) {
222
			 valeurDateFondation  = "";
223
			 valeurDateFondation  = "";
223
		 }
224
		 }
-
 
225
		 return valeurDateFondation;
-
 
226
	}*/
-
 
227
	
-
 
228
	public String getAnneeOuDateFondation()	{
-
 
229
		 String valeurDateFondation = get("date_fondation");
-
 
230
		 return getDateSouple(valeurDateFondation);
-
 
231
	}
-
 
232
	
-
 
233
	public String getDateSouple(String date) {
-
 
234
		String valeurDate = date;
-
 
235
		
-
 
236
		String jour = "";
-
 
237
		String mois = "";
-
 
238
		String annee = "";
-
 
239
 
-
 
240
		// pas de date dans la BD
-
 
241
		if (UtilString.isEmpty(valeurDate) || valeurDate.equals("0000-00-00")) {
-
 
242
			valeurDate  = "";
-
 
243
		
-
 
244
		// YYYY
-
 
245
		} else if (valeurDate.endsWith("00-00")) {
-
 
246
			valeurDate = valeurDate.substring(0, 4);
-
 
247
			if (valeurDate.matches("\\d{4}")) {
-
 
248
				jour = "";
-
 
249
				mois = "";
-
 
250
				annee = valeurDate.substring(0,4);
-
 
251
				valeurDate = annee;
-
 
252
			}
-
 
253
			
-
 
254
		// YYYY-MM
-
 
255
		} else if (valeurDate.endsWith("-00")) {
-
 
256
			valeurDate = valeurDate.substring(0, 7);
-
 
257
			if (valeurDate.matches("\\d{4}-\\d{2}")) {
-
 
258
				jour = "";
-
 
259
				mois = valeurDate.substring(5,7);
-
 
260
				annee = valeurDate.substring(0,4);
-
 
261
				valeurDate = mois+"/"+annee;
-
 
262
			}
-
 
263
		}
-
 
264
		
-
 
265
		// YYYY-MM-DD
-
 
266
		else if (valeurDate.matches("\\d{4}-\\d{2}-\\d{2}")) {
-
 
267
			Date objetDate = DateTimeFormat.getFormat("yyyy-MM-dd").parse(valeurDate);
-
 
268
			DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MM/yyyy");
-
 
269
			valeurDate = fmt.format(objetDate);
-
 
270
		}
-
 
271
		 
224
		 return valeurDateFondation;
272
		 return valeurDate;
Line 225... Line 273...
225
	}
273
	}
226
	
274
	
227
	public void setDateFondation(Date dateFondation) {
275
	public void setDateFondation(Date dateFondation) {