OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 180
Line 359... Line 359...
359
        final String string = rowNum.getString("CODE_LETTRAGE");
359
        final String string = rowNum.getString("CODE_LETTRAGE");
360
        String s = (string == null) ? "" : string.trim().toUpperCase();
360
        String s = (string == null) ? "" : string.trim().toUpperCase();
361
        return getNextCodeLetrrage(s);
361
        return getNextCodeLetrrage(s);
362
    }
362
    }
363
 
363
 
-
 
364
    public final String getNextCodeLettragePartiel() {
-
 
365
        SQLRow rowNum = this.getTable().getRow(2);
-
 
366
        final String string = rowNum.getString("CODE_LETTRAGE_PARTIEL");
-
 
367
        String s = (string == null) ? "" : string.trim().toLowerCase();
-
 
368
        return getNextCodeLettragePartiel(s);
-
 
369
    }
-
 
370
 
364
    public static final String getNextCodeLetrrage(String code) {
371
    public static final String getNextCodeLetrrage(String code) {
365
        code = code.trim();
372
        code = code.trim();
366
        if (code == null || code.length() == 0) {
373
        if (code == null || code.length() == 0) {
367
            return "AAA";
374
            return "AAA";
368
        } else {
375
        } else {
Line 392... Line 399...
392
            return code;
399
            return code;
393
        }
400
        }
394
 
401
 
395
    }
402
    }
396
 
403
 
-
 
404
    public static final String getNextCodeLettragePartiel(String code) {
-
 
405
        code = code.trim();
-
 
406
        if (code == null || code.length() == 0) {
-
 
407
            return "aaa";
-
 
408
        } else {
-
 
409
            char[] charArray = code.toCharArray();
-
 
410
            char c = 'a';
-
 
411
            int i = charArray.length - 1;
-
 
412
            while (i >= 0 && (c = charArray[i]) == 'z') {
-
 
413
                i--;
-
 
414
            }
-
 
415
            if (i >= 0) {
-
 
416
                c++;
-
 
417
                charArray[i] = c;
-
 
418
                for (int j = i + 1; j < charArray.length; j++) {
-
 
419
                    charArray[j] = 'a';
-
 
420
                }
-
 
421
                code = String.valueOf(charArray);
-
 
422
            } else {
-
 
423
                // On ajoute une lettre
-
 
424
                final StringBuffer buf = new StringBuffer(code.length() + 1);
-
 
425
                final int nb = code.length() + 1;
-
 
426
                for (int j = 0; j < nb; j++) {
-
 
427
                    buf.append('a');
-
 
428
                }
-
 
429
                code = buf.toString();
-
 
430
            }
-
 
431
 
-
 
432
            return code;
-
 
433
        }
-
 
434
 
-
 
435
    }
-
 
436
 
397
    private static boolean isNumeroExist(SQLElement element, int num) {
437
    private static boolean isNumeroExist(SQLElement element, int num) {
-
 
438
 
398
        if (num < 0) {
439
        if (num < 0) {
399
            return true;
440
            return true;
400
        }
441
        }
401
 
442
 
402
        String s = map.get(element.getClass());
443
        String s = map.get(element.getClass());