/*
 * Copyright
 *   2009 axYus - www.axyus.com
 *   2009 C.Marchand - christop?e.marchand@axyus.com
 *
 * This file is part of XEMELIOS.
 *
 * XEMELIOS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * XEMELIOS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with XEMELIOS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package fr.gouv.finances.cp.xemelios.patches;

import fr.gouv.finances.dgfip.xemelios.data.DataImpl;
import fr.gouv.finances.dgfip.xemelios.data.DataLayerManager;
import fr.gouv.finances.cp.xemelios.updater.AbstractConfigurator;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author chm
 */
public class Core33130 extends AbstractConfigurator {
    public static final transient String PARAMETER_WARNING_BUG_33129_KEY = "warning.bug.33129";
    public static final transient String MESSAGE = "<html><p>Suite &agrave; une anomalie sur les imports, vous devez<br>" +
            "r&eacute;importer les donn&eacute;es que vous avez import&eacute; depuis <b><u>d&eacute;but avril 2009</u></b><br>" +
            "pour les documents suivants :</p>" +
            "<ul><li>Carte Achat</li><li>Paye</li><li>Facture D&eacute;pense</li><li>Facture recette</li><li>Quittancement</li></ul>" +
            "<p>Ainsi, les grosses recherches ne causeront plus d'erreur de m&eacute;moire.";

    public Core33130() {
        super();
    }

    public void run() throws Exception {
        DataImpl impl = DataLayerManager.getImplementation();
        String value = impl.getParameterValue(PARAMETER_WARNING_BUG_33129_KEY);
        if(!"displayed".equals(value)) {
            JFrame parent = null;
            if(mw!=null) {
                parent = mw;
            }
            JOptionPane.showMessageDialog(parent, MESSAGE, "Obligation d'import", JOptionPane.WARNING_MESSAGE);
            impl.setParameterValue(PARAMETER_WARNING_BUG_33129_KEY, "displayed");
        }
        setPreviousConfigurator(new Core33114());
    }

}
