OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 118 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
43 ilm 1
package org.openconcerto.modules.badge;
2
 
3
import java.awt.Component;
4
import java.io.File;
5
import java.io.IOException;
153 ilm 6
import java.sql.SQLException;
43 ilm 7
import java.text.DateFormat;
153 ilm 8
import java.text.Normalizer;
9
import java.text.Normalizer.Form;
43 ilm 10
import java.text.SimpleDateFormat;
11
import java.util.ArrayList;
79 ilm 12
import java.util.Arrays;
43 ilm 13
import java.util.Calendar;
14
import java.util.Date;
153 ilm 15
import java.util.HashMap;
43 ilm 16
import java.util.HashSet;
17
import java.util.List;
153 ilm 18
import java.util.Map;
43 ilm 19
import java.util.Set;
153 ilm 20
import java.util.regex.Matcher;
21
import java.util.regex.Pattern;
43 ilm 22
 
23
import javax.swing.Action;
98 ilm 24
import javax.swing.Icon;
43 ilm 25
import javax.swing.JFrame;
26
import javax.swing.JTable;
27
import javax.swing.table.DefaultTableCellRenderer;
28
 
29
import org.openconcerto.erp.action.CreateFrameAbstractAction;
79 ilm 30
import org.openconcerto.erp.action.PreferencesAction;
43 ilm 31
import org.openconcerto.erp.config.Gestion;
32
import org.openconcerto.erp.config.MainFrame;
153 ilm 33
import org.openconcerto.erp.core.common.element.AdresseSQLElement;
43 ilm 34
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
35
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
153 ilm 36
import org.openconcerto.erp.core.customerrelationship.customer.element.ContactSQLElement;
37
import org.openconcerto.erp.core.customerrelationship.customer.element.CustomerSQLElement;
43 ilm 38
import org.openconcerto.erp.modules.AbstractModule;
39
import org.openconcerto.erp.modules.ComponentsContext;
40
import org.openconcerto.erp.modules.DBContext;
79 ilm 41
import org.openconcerto.erp.modules.MenuContext;
43 ilm 42
import org.openconcerto.erp.modules.ModuleFactory;
43
import org.openconcerto.erp.modules.ModuleManager;
44
import org.openconcerto.erp.modules.ModulePackager;
79 ilm 45
import org.openconcerto.erp.modules.ModulePreferencePanel;
46
import org.openconcerto.erp.modules.ModulePreferencePanelDesc;
153 ilm 47
import org.openconcerto.erp.modules.ModuleVersion;
43 ilm 48
import org.openconcerto.erp.modules.RuntimeModuleFactory;
49
import org.openconcerto.sql.Configuration;
50
import org.openconcerto.sql.element.SQLComponent;
51
import org.openconcerto.sql.element.SQLElement;
52
import org.openconcerto.sql.element.SQLElementDirectory;
53
import org.openconcerto.sql.element.UISQLComponent;
54
import org.openconcerto.sql.model.SQLName;
153 ilm 55
import org.openconcerto.sql.model.SQLRow;
43 ilm 56
import org.openconcerto.sql.model.SQLRowAccessor;
153 ilm 57
import org.openconcerto.sql.model.SQLRowValues;
58
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
43 ilm 59
import org.openconcerto.sql.model.SQLSyntax;
153 ilm 60
import org.openconcerto.sql.model.SQLTable;
43 ilm 61
import org.openconcerto.sql.model.Where;
62
import org.openconcerto.sql.utils.SQLCreateTable;
63
import org.openconcerto.sql.view.FileDropHandler;
64
import org.openconcerto.sql.view.IListFrame;
65
import org.openconcerto.sql.view.IListPanel;
66
import org.openconcerto.sql.view.list.IListe;
67
import org.openconcerto.sql.view.list.RowAction;
68
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
69
import org.openconcerto.ui.PanelFrame;
153 ilm 70
import org.openconcerto.ui.group.Group;
71
import org.openconcerto.ui.group.LayoutHints;
43 ilm 72
import org.openconcerto.utils.FileUtils;
118 ilm 73
import org.openconcerto.utils.ListMap;
79 ilm 74
import org.openconcerto.utils.PrefType;
153 ilm 75
import org.openconcerto.utils.StringUtils;
43 ilm 76
import org.openconcerto.utils.cc.IClosure;
77
 
78
public final class Module extends AbstractModule {
79
 
153 ilm 80
    private static final String CLIENT_ADH_FIELDNAME = "ID_ADHERENT";
81
    private static final Pattern FIRST_NAME_PATTERN = Pattern.compile("([^0-9]*)([0-9]*).*");
82
    public static final boolean HAS_CODE_IN_FIRST_NAME = Boolean.getBoolean("adherent.hasCodeInFirstName");
83
 
43 ilm 84
    public Module(ModuleFactory f) throws IOException {
85
        super(f);
86
 
87
    }
88
 
89
    @Override
153 ilm 90
    protected void install(final DBContext ctxt) throws SQLException, IOException {
43 ilm 91
        super.install(ctxt);
153 ilm 92
        final AdresseSQLElement addrElem = ctxt.getElementDirectory().getElement(AdresseSQLElement.class);
43 ilm 93
 
153 ilm 94
        final ModuleVersion dbVersion = ctxt.getLastInstalledVersion() == null ? ModuleVersion.MIN : ctxt.getLastInstalledVersion();
95
        if (dbVersion.getMerged() > this.getFactory().getVersion().getMerged())
96
            throw new IllegalStateException("Cannot downgrade from " + dbVersion + " to " + this.getFactory());
97
        if (dbVersion.getMerged() < ModuleVersion.getMerged(1, 0)) {
43 ilm 98
            // ENTREE
99
            final SQLCreateTable createTableEntree = ctxt.getCreateTable("ENTREE");
100
            createTableEntree.addDateAndTimeColumn("DATE");
101
            createTableEntree.addVarCharColumn("NUMERO_CARTE", 256);
102
            createTableEntree.addVarCharColumn("ADHERENT", 512);
103
            createTableEntree.addVarCharColumn("MOTIF", 2048);
104
            createTableEntree.addColumn("ACCEPTE", "boolean");
153 ilm 105
 
43 ilm 106
            // PLAGE
107
            final SQLCreateTable createTablePlage = ctxt.getCreateTable("PLAGE_HORAIRE");
108
            createTablePlage.addVarCharColumn("NOM", 256);
109
            createTablePlage.addColumn("DEBUT_1_LUNDI", "time");
110
            createTablePlage.addColumn("DEBUT_1_MARDI", "time");
111
            createTablePlage.addColumn("DEBUT_1_MERCREDI", "time");
112
            createTablePlage.addColumn("DEBUT_1_JEUDI", "time");
113
            createTablePlage.addColumn("DEBUT_1_VENDREDI", "time");
114
            createTablePlage.addColumn("DEBUT_1_SAMEDI", "time");
115
            createTablePlage.addColumn("DEBUT_1_DIMANCHE", "time");
116
 
117
            createTablePlage.addColumn("DEBUT_2_LUNDI", "time");
118
            createTablePlage.addColumn("DEBUT_2_MARDI", "time");
119
            createTablePlage.addColumn("DEBUT_2_MERCREDI", "time");
120
            createTablePlage.addColumn("DEBUT_2_JEUDI", "time");
121
            createTablePlage.addColumn("DEBUT_2_VENDREDI", "time");
122
            createTablePlage.addColumn("DEBUT_2_SAMEDI", "time");
123
            createTablePlage.addColumn("DEBUT_2_DIMANCHE", "time");
124
 
125
            createTablePlage.addColumn("DEBUT_3_LUNDI", "time");
126
            createTablePlage.addColumn("DEBUT_3_MARDI", "time");
127
            createTablePlage.addColumn("DEBUT_3_MERCREDI", "time");
128
            createTablePlage.addColumn("DEBUT_3_JEUDI", "time");
129
            createTablePlage.addColumn("DEBUT_3_VENDREDI", "time");
130
            createTablePlage.addColumn("DEBUT_3_SAMEDI", "time");
131
            createTablePlage.addColumn("DEBUT_3_DIMANCHE", "time");
132
 
133
            createTablePlage.addColumn("FIN_1_LUNDI", "time");
134
            createTablePlage.addColumn("FIN_1_MARDI", "time");
135
            createTablePlage.addColumn("FIN_1_MERCREDI", "time");
136
            createTablePlage.addColumn("FIN_1_JEUDI", "time");
137
            createTablePlage.addColumn("FIN_1_VENDREDI", "time");
138
            createTablePlage.addColumn("FIN_1_SAMEDI", "time");
139
            createTablePlage.addColumn("FIN_1_DIMANCHE", "time");
140
 
141
            createTablePlage.addColumn("FIN_2_LUNDI", "time");
142
            createTablePlage.addColumn("FIN_2_MARDI", "time");
143
            createTablePlage.addColumn("FIN_2_MERCREDI", "time");
144
            createTablePlage.addColumn("FIN_2_JEUDI", "time");
145
            createTablePlage.addColumn("FIN_2_VENDREDI", "time");
146
            createTablePlage.addColumn("FIN_2_SAMEDI", "time");
147
            createTablePlage.addColumn("FIN_2_DIMANCHE", "time");
148
 
149
            createTablePlage.addColumn("FIN_3_LUNDI", "time");
150
            createTablePlage.addColumn("FIN_3_MARDI", "time");
151
            createTablePlage.addColumn("FIN_3_MERCREDI", "time");
152
            createTablePlage.addColumn("FIN_3_JEUDI", "time");
153
            createTablePlage.addColumn("FIN_3_VENDREDI", "time");
154
            createTablePlage.addColumn("FIN_3_SAMEDI", "time");
155
            createTablePlage.addColumn("FIN_3_DIMANCHE", "time");
156
 
157
            // ADHERENT
158
            final SQLCreateTable createTable = ctxt.getCreateTable("ADHERENT");
159
 
160
            createTable.addVarCharColumn("NUMERO_CARTE", 256);
161
            createTable.addVarCharColumn("NOM", 256);
162
 
163
            createTable.addVarCharColumn("TEL", 256);
164
            createTable.addColumn("ACTIF", "boolean default false");
165
            createTable.addColumn("ADMIN", "boolean default false");
166
            createTable.addVarCharColumn("MAIL", 256);
167
            createTable.addVarCharColumn("PRENOM", 256);
168
            createTable.addVarCharColumn("INFOS", 2048);
169
            createTable.addColumn("DATE_VALIDITE_INSCRIPTION", "date");
170
            createTable.addColumn("DATE_NAISSANCE", "date");
171
 
153 ilm 172
            createTable.addForeignColumn("ID_ADRESSE", addrElem.getTable());
43 ilm 173
            createTable.addForeignColumn("ID_PLAGE_HORAIRE", new SQLName("PLAGE_HORAIRE"), SQLSyntax.ID_NAME, null);
174
        }
153 ilm 175
        // at least v1.0
176
 
177
        if (dbVersion.getMerged() < ModuleVersion.getMerged(1, 1)) {
178
            // migrate from non-private
179
            final SQLTable adhT = ctxt.getRoot().getTable("ADHERENT");
180
            final CustomerSQLElement clientElem = ctxt.getElementDirectory().getElement(CustomerSQLElement.class);
181
            final SQLTable clientT = clientElem.getTable();
182
            ctxt.getAlterTable(clientT.getName()).addForeignColumn(CLIENT_ADH_FIELDNAME, adhT);
183
            // fill new field (no need to do anything in uninstall() since the field will be
184
            // dropped and new clients shouldn't be dropped)
185
            if (adhT.getRowCount(false) > 0) {
186
                ctxt.executeSQL();
187
                this.setupElements(ctxt.getElementDirectory());
188
                // 1. fetch all clients
189
                final ListMap<String, SQLRow> clientByName = new ListMap<>();
190
                final ListMap<String, SQLRow> clientByCode = new ListMap<>();
191
                for (final SQLRowValues clientR : SQLRowValuesListFetcher.create(new SQLRowValues(clientT).putNulls("NOM", "CODE")).fetch()) {
192
                    final String normalized = normalize(clientR.getString("NOM"));
193
                    clientByName.add(normalized, clientR.asRow());
194
                    clientByCode.add(clientR.getString("CODE"), clientR.asRow());
195
                }
196
                // 2. for each ADHERENT, link it to a single matching CLIENT, or create a
197
                // new one. Also fill CLIENT fields with duplicates from ADHERENT.
198
                // créer plutôt plus de clients : si besoin, fusion après coup.
199
                final SQLRowValues adhToFetch = new SQLRowValues(adhT).putNulls("NOM", "PRENOM", "MAIL", "TEL", "DATE_NAISSANCE");
200
                adhToFetch.putRowValues("ID_ADRESSE").setAllToNull();
201
                final Map<SQLRow, SQLRow> updatedClientsAndAdh = new HashMap<>();
202
 
203
                for (final SQLRowValues adhR : SQLRowValuesListFetcher.create(adhToFetch).fetch(null, true)) {
204
                    final String firstName;
205
                    final String code;
206
                    SQLRow existingClient = null;
207
                    if (HAS_CODE_IN_FIRST_NAME) {
208
                        final Matcher matcher = FIRST_NAME_PATTERN.matcher(adhR.getString("PRENOM"));
209
                        if (!matcher.matches())
210
                            throw new IllegalStateException("Couldn't match " + adhR);
211
                        firstName = matcher.group(1).trim();
212
                        code = matcher.group(2);
213
                    } else {
214
                        firstName = adhR.getString("PRENOM");
215
                        code = null;
216
                    }
217
                    if (!StringUtils.isEmpty(code)) {
218
                        existingClient = getUnique(clientByCode.get(code));
219
                    }
220
                    final String firstLastName = firstName + " " + adhR.getString("NOM");
221
                    if (existingClient == null) {
222
                        existingClient = getUnique(clientByName.get(normalize(firstLastName)));
223
                    }
224
                    final SQLRow newClient;
225
                    if (existingClient != null && !updatedClientsAndAdh.containsKey(existingClient)) {
226
                        updatedClientsAndAdh.put(existingClient, adhR.asRow());
227
                        // TODO use SQLElement.createFetcher()
228
                        final SQLRowValues clientToUpdateVals = SQLRowValuesListFetcher.create(clientElem.createGraph()).fetchOne(existingClient.getIDNumber(), true);
229
                        // TODO use new UpdateAction(SQLElement.createContext())
230
                        final SQLRowValues newVals = fillFields(clientToUpdateVals.deepCopy(), adhR, false, addrElem);
231
                        newClient = clientElem.update(clientToUpdateVals, newVals).exec();
232
                    } else {
233
                        // TODO use Logger
234
                        if (existingClient != null) {
235
                            System.err.println("While matching " + adhT + ", existing client " + existingClient + " already updated with " + updatedClientsAndAdh.get(existingClient)
236
                                    + " so creating new client for " + adhR);
237
                        } else {
238
                            System.err.println("While matching " + adhT + ", no client found for " + adhR);
239
                        }
240
                        // create new client row
241
                        // TODO use new InsertAction(SQLElement.createContext()) or at least
242
                        // SQLElement.insert()
243
                        final SQLRowValues vals = fillFields(new SQLRowValues(clientT).put("NOM", firstLastName), adhR, true, addrElem);
244
                        if (!StringUtils.isEmpty(code))
245
                            vals.put("CODE", code);
246
                        newClient = vals.insert();
247
                    }
248
                    final SQLRowValues contactVals = new SQLRowValues(ctxt.getElementDirectory().getElement(ContactSQLElement.class).getTable());
249
                    contactVals.putForeignID("ID_CLIENT", newClient);
250
                    contactVals.load(adhR.asRow(), Arrays.asList("NOM", "DATE_NAISSANCE"));
251
                    contactVals.put("PRENOM", firstName);
252
                    contactVals.put("EMAIL", adhR.getString("MAIL"));
253
                    contactVals.insert();
254
                }
255
 
256
                ctxt.getAlterTable(adhT.getName()).dropColumn("ID_ADRESSE");
257
            }
258
        }
43 ilm 259
    }
260
 
153 ilm 261
    protected SQLRow getUnique(final List<SQLRow> clientRows) {
262
        return clientRows != null && clientRows.size() == 1 ? clientRows.get(0) : null;
263
    }
264
 
265
    private final SQLRowValues fillFields(final SQLRowValues clientVals, final SQLRowValues adhVals, final boolean useAdhID, final SQLElement addrElem) {
266
        clientVals.put(CLIENT_ADH_FIELDNAME, useAdhID ? adhVals.getIDNumber() : adhVals.deepCopy());
267
        concatField(clientVals, adhVals, "MAIL");
268
        concatField(clientVals, adhVals, "TEL");
269
        final SQLRowValues adhAddr = (SQLRowValues) adhVals.getNonEmptyForeign("ID_ADRESSE");
270
        if (adhAddr != null && !StringUtils.isEmpty(adhAddr.getString("VILLE"), true)) {
271
            clientVals.put("ID_ADRESSE", addrElem.createCopy(adhAddr, true, null));
272
        }
273
        return clientVals;
274
    }
275
 
276
    private final void concatField(final SQLRowValues clientVals, final SQLRowValues adhVals, final String fieldName) {
277
        final String adhStr = adhVals.getString(fieldName);
278
        if (StringUtils.isEmpty(adhStr, true))
279
            return;
280
        final String clientStr = clientVals.getString(fieldName);
281
        if (StringUtils.isEmpty(clientStr, true)) {
282
            clientVals.put(fieldName, adhStr);
283
        } else {
284
            clientVals.put(fieldName, clientStr + ", " + adhStr);
285
        }
286
    }
287
 
288
    static private final Pattern diacriticalPattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
289
    static private final Pattern punctPattern = Pattern.compile("\\p{Punct}+");
290
    static private final Pattern spacePattern = Pattern.compile("\\p{Space}+");
291
 
292
    // remove punctation, multiple spaces and accents
293
    static private String normalize(final String s) {
294
        final String noMarks = diacriticalPattern.matcher(Normalizer.normalize(s, Form.NFD)).replaceAll("");
295
        final String noPunct = punctPattern.matcher(noMarks).replaceAll("_");
296
        return spacePattern.matcher(noPunct.trim()).replaceAll(" ").toLowerCase();
297
    }
298
 
43 ilm 299
    @Override
300
    protected void setupElements(SQLElementDirectory dir) {
301
        super.setupElements(dir);
302
 
303
        final ComptaSQLConfElement entreeElement = new ComptaSQLConfElement("ENTREE", "une entrée", "entrées") {
304
 
305
            @Override
306
            protected List<String> getListFields() {
307
                final List<String> l = new ArrayList<String>();
308
                l.add("DATE");
309
                l.add("NUMERO_CARTE");
310
                l.add("ADHERENT");
311
                l.add("MOTIF");
312
                l.add("ACCEPTE");
313
                return l;
314
            }
315
 
316
            @Override
317
            public Set<String> getReadOnlyFields() {
318
                Set<String> s = new HashSet<String>(super.getReadOnlyFields());
319
                s.add("NUMERO_CARTE");
320
                return s;
321
            }
322
 
323
            @Override
324
            protected List<String> getComboFields() {
325
                final List<String> l = new ArrayList<String>();
326
                l.add("NUMERO_CARTE");
327
                l.add("DATE");
328
                return l;
329
            }
330
 
331
            @Override
118 ilm 332
            public ListMap<String, String> getShowAs() {
333
                return ListMap.singleton(null, getComboFields());
43 ilm 334
            }
335
 
336
            @Override
337
            public SQLComponent createComponent() {
338
                return new UISQLComponent(this) {
339
                    @Override
340
                    protected void addViews() {
341
                        this.addView("NUMERO_CARTE");
342
                        this.addView("DATE");
343
                    }
344
                };
345
            }
346
        };
347
        dir.addSQLElement(entreeElement);
348
        dir.addSQLElement(new PlageHoraireSQLElement());
349
        dir.addSQLElement(new AdherentSQLElement());
350
    }
351
 
352
    private IListPanel getPanelEntree(boolean filtered) {
353
        final SQLElement element = Configuration.getInstance().getDirectory().getElement("ENTREE");
354
 
355
        final SQLTableModelSourceOnline tableModelEntree = element.getTableSource(true);
356
 
357
        if (filtered) {
358
            Calendar cal = Calendar.getInstance();
359
            cal.add(Calendar.DAY_OF_MONTH, -15);
360
            Where wAttente = new Where(element.getTable().getField("DATE"), ">=", cal.getTime());
361
            tableModelEntree.getReq().setWhere(wAttente);
362
        }
363
        tableModelEntree.getColumn(element.getTable().getField("DATE")).setRenderer(new DefaultTableCellRenderer() {
364
 
365
            DateFormat format = new SimpleDateFormat("EEEE dd MMMM yyyy HH:mm:ss");
366
 
367
            @Override
368
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
369
                final String format2 = format.format((Date) value);
370
                return super.getTableCellRendererComponent(table, format2, isSelected, hasFocus, row, column);
371
 
372
            }
373
        });
374
 
375
        final IListPanel panel = new ListeViewPanel(element, new IListe(tableModelEntree));
376
 
98 ilm 377
        final Action createAction = RowAction.createAction("Assigner à", (Icon) null, new IClosure<List<? extends SQLRowAccessor>>() {
43 ilm 378
            @Override
98 ilm 379
            public void executeChecked(List<? extends SQLRowAccessor> input) {
43 ilm 380
                SQLRowAccessor row = input.get(0);
381
                PanelFrame frame = new PanelFrame(new AssignationPanel(row.getString("NUMERO_CARTE")), "Assignation d'une carte");
382
                frame.setLocationRelativeTo(null);
383
                frame.setVisible(true);
384
 
385
            }
386
        });
387
 
388
        panel.getListe().addRowAction(createAction);
389
 
390
        return panel;
391
    }
392
 
393
    @Override
394
    protected void setupComponents(ComponentsContext ctxt) {
153 ilm 395
        final Group g = new Group("customerrelationship.customer.adherent", LayoutHints.DEFAULT_SEPARATED_GROUP_HINTS);
396
        ctxt.getElement("CLIENT").getDefaultGroup().add(g);
397
        g.addItem(CLIENT_ADH_FIELDNAME, new LayoutHints(true, true, true, true, true, true));
43 ilm 398
        ctxt.addFileDropHandler("ADHERENT", new FileDropHandler() {
399
 
400
            @Override
401
            public boolean handle(File f, Component source) {
402
                AdherentImporter importer;
403
                try {
404
                    importer = new AdherentImporter(f);
405
                    importer.importAdherent();
406
                } catch (Exception e) {
407
                    e.printStackTrace();
408
                }
409
                return true;
410
            }
411
 
412
            @Override
413
            public boolean canHandle(File f) {
414
                String n = f.getName().toLowerCase();
415
                return n.endsWith(".xls") || n.endsWith(".ods");
416
            }
417
        });
79 ilm 418
    }
419
 
420
    @Override
421
    protected void setupMenu(MenuContext ctxt) {
43 ilm 422
        ctxt.addMenuItem(new CreateFrameAbstractAction("Liste des entrées") {
423
 
424
            @Override
425
            public JFrame createFrame() {
426
 
427
                return new IListFrame(getPanelEntree(false));
428
            }
429
        }, MainFrame.LIST_MENU);
79 ilm 430
        ctxt.addMenuItem(new PreferencesAction(), MainFrame.FILE_MENU);
43 ilm 431
    }
432
 
433
    @Override
434
    protected void start() {
435
        MainFrame.getInstance().getTabbedPane().addTab("Liste des entrées", getPanelEntree(true));
436
    }
437
 
438
    @Override
439
    protected void stop() {
440
    }
441
 
442
    public static void main(String[] args) throws IOException {
118 ilm 443
        final File propsFile = new File("module.properties");
43 ilm 444
 
445
        final ModuleFactory factory = new RuntimeModuleFactory(propsFile);
446
 
447
        final File distDir = new File("dist");
448
        FileUtils.mkdir_p(distDir);
449
        new ModulePackager(propsFile, new File("bin/")).writeToDir(distDir);
450
        new ModulePackager(propsFile, new File("bin/")).writeToDir(new File("../OpenConcerto/Modules"));
451
 
452
        ModuleManager.getInstance().addFactoryAndStart(factory, false);
453
 
454
        Gestion.main(args);
455
 
456
    }
79 ilm 457
 
458
    public final static String ENTREE_PREF = "entreeAdmin";
459
 
460
    @Override
461
    public List<ModulePreferencePanelDesc> getPrefDescriptors() {
462
        return Arrays.<ModulePreferencePanelDesc> asList(new ModulePreferencePanelDesc("Gestion des entrées") {
463
            @Override
464
            protected ModulePreferencePanel createPanel() {
465
                return new ModulePreferencePanel("Gestion des entrées") {
466
                    @Override
467
                    protected void addViews() {
468
 
469
                        this.addView(new SQLPrefView<Boolean>(PrefType.BOOLEAN_TYPE, "N'autoriser que les administrateurs à entrer ", ENTREE_PREF));
470
                    }
471
                };
472
            }
473
        }.setLocal(false).setKeywords("entrée"));
474
    }
475
 
43 ilm 476
}