Пример #1
0
/**
 * Disable/Reenable features modules.
 * We must do this when internal menu of module or permissions has changed
 * or when triggers have moved.
 *
 * @param	DoliDB		$db				Database handler
 * @param	Translate	$langs			Object langs
 * @param	Conf		$conf			Object conf
 * @param	array		$listofmodule	List of modules
 * @return	void
 */
function migrate_reload_modules($db, $langs, $conf, $listofmodule = array())
{
    dolibarr_install_syslog("upgrade2::migrate_reload_modules");
    // If no info is provided, we reload all modules with mode newboxdefonly.
    if (count($listofmodule) == 0) {
        $listofmodule = array('MAIN_MODULE_AGENDA' => 'newboxdefonly', 'MAIN_MODULE_SOCIETE' => 'newboxdefonly', 'MAIN_MODULE_PRODUIT' => 'newboxdefonly', 'MAIN_MODULE_SERVICE' => 'newboxdefonly', 'MAIN_MODULE_COMMANDE' => 'newboxdefonly', 'MAIN_MODULE_FACTURE' => 'newboxdefonly', 'MAIN_MODULE_FOURNISSEUR' => 'newboxdefonly', 'MAIN_MODULE_HOLIDAY' => 'newboxdefonly', 'MAIN_MODULE_USER' => 'newboxdefonly', 'MAIN_MODULE_DEPLACEMENT' => 'newboxdefonly', 'MAIN_MODULE_DON' => 'newboxdefonly', 'MAIN_MODULE_ECM' => 'newboxdefonly', 'MAIN_MODULE_PAYBOX' => 'newboxdefonly', 'MAIN_MODULE_OPENSURVEY' => 'newboxdefonly');
    }
    foreach ($listofmodule as $moduletoreload => $reloadmode) {
        if (empty($moduletoreload) || empty($conf->global->{$moduletoreload})) {
            continue;
        }
        $mod = null;
        if ($moduletoreload == 'MAIN_MODULE_AGENDA') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Agenda module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modAgenda.class.php');
            if ($res) {
                $mod = new modAgenda($db);
                $mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_BARCODE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Barcode module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modBarcode.class.php');
            if ($res) {
                $mod = new modBarcode($db);
                $mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_CRON') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modCron.class.php');
            if ($res) {
                $mod = new modCron($db);
                $mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_SOCIETE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modSociete.class.php');
            if ($res) {
                $mod = new modSociete($db);
                $mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_PRODUIT') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Produit module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modProduct.class.php');
            if ($res) {
                $mod = new modProduct($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_SERVICE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Service module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modService.class.php');
            if ($res) {
                $mod = new modService($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_COMMANDE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Commande module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modCommande.class.php');
            if ($res) {
                $mod = new modCommande($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_FACTURE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Facture module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modFacture.class.php');
            if ($res) {
                $mod = new modFacture($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Fournisseur module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modFournisseur.class.php');
            if ($res) {
                $mod = new modFournisseur($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_HOLIDAY') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Leave Request module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modHoliday.class.php');
            if ($res) {
                $mod = new modHoliday($db);
                $mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Deplacement module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modDeplacement.class.php');
            if ($res) {
                $mod = new modDeplacement($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_DON') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Don module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modDon.class.php');
            if ($res) {
                $mod = new modDon($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_ECM') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ECM module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modECM.class.php');
            if ($res) {
                $mod = new modECM($db);
                $mod->remove('noboxes');
                // We need to remove because a permission id has been removed
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_PAYBOX') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modPaybox.class.php');
            if ($res) {
                $mod = new modPaybox($db);
                $mod->remove('noboxes');
                // We need to remove because id of module has changed
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Opensurvey module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modOpenSurvey.class.php');
            if ($res) {
                $mod = new modOpenSurvey($db);
                $mod->remove('noboxes');
                // We need to remove because menu entries has changed
                $mod->init($reloadmode);
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_USER') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate User module");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modUser.class.php');
            if ($res) {
                $mod = new modUser($db);
                //$mod->remove('noboxes');
                $mod->init($reloadmode);
            }
        }
        if (!empty($mod) && is_object($mod)) {
            print '<tr><td colspan="4">';
            print '<b>' . $langs->trans('Upgrade') . '</b>: ';
            print $langs->trans('MigrationReloadModule') . " " . $mod->getName();
            print "<!-- (" . $reloadmode . ") -->";
            print "<br>\n";
            print '</td></tr>';
        }
    }
}
Пример #2
0
/**
 * Disable/Reenable features modules.
 * We must do this when internal menu of module or permissions has changed
 * or when triggers have moved.
 *
 * @param	DoliDB		$db				Database handler
 * @param	Translate	$langs			Object langs
 * @param	Conf		$conf			Object conf
 * @param	array		$listofmodule	List of modules
 * @return	void
 */
function migrate_reload_modules($db, $langs, $conf, $listofmodule = array())
{
    dolibarr_install_syslog("upgrade2::migrate_reload_modules");
    // Module to reload if no info is provided
    if (count($listofmodule) == 0) {
        $listofmodule = array('MAIN_MODULE_AGENDA', 'MAIN_MODULE_SOCIETE', 'MAIN_MODULE_PRODUIT', 'MAIN_MODULE_SERVICE', 'MAIN_MODULE_COMMANDE', 'MAIN_MODULE_FACTURE', 'MAIN_MODULE_FOURNISSEUR', 'MAIN_MODULE_USER', 'MAIN_MODULE_DEPLACEMENT', 'MAIN_MODULE_DON', 'MAIN_MODULE_ECM', 'MAIN_MODULE_PAYBOX', 'MAIN_MODULE_OPENSURVEY');
    }
    foreach ($listofmodule as $moduletoreload) {
        if (empty($moduletoreload) || empty($conf->global->{$moduletoreload})) {
            continue;
        }
        if ($moduletoreload == 'MAIN_MODULE_AGENDA') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Agenda");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modAgenda.class.php');
            if ($res) {
                $mod = new modAgenda($db);
                $mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_BARCODE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Barcode");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modBarcode.class.php');
            if ($res) {
                $mod = new modBarcode($db);
                $mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_CRON') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Cron");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modCron.class.php');
            if ($res) {
                $mod = new modCron($db);
                $mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_SOCIETE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modSociete.class.php');
            if ($res) {
                $mod = new modSociete($db);
                $mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_PRODUIT') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Produit");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modProduct.class.php');
            if ($res) {
                $mod = new modProduct($db);
                //$mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_SERVICE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
            if ($res) {
                $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modService.class.php');
                $mod = new modService($db);
                //$mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_COMMANDE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
            if ($res) {
                $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modCommande.class.php');
                $mod = new modCommande($db);
                //$mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_FACTURE') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
            if ($res) {
                $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modFacture.class.php');
                $mod = new modFacture($db);
                //$mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modFournisseur.class.php');
            if ($res) {
                $mod = new modFournisseur($db);
                //$mod->remove('noboxes');
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modDeplacement.class.php');
            if ($res) {
                $mod = new modDeplacement($db);
                //$mod->remove('noboxes');	// We need to remove because a permission id has been removed
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_DON') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Don");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modDon.class.php');
            if ($res) {
                $mod = new modDon($db);
                //$mod->remove('noboxes');	// We need to remove because a permission id has been removed
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_ECM') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM");
            if ($res) {
                $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modECM.class.php');
                $mod = new modECM($db);
                $mod->remove('noboxes');
                // We need to remove because a permission id has been removed
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_PAYBOX') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Paybox");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modPaybox.class.php');
            if ($res) {
                $mod = new modPaybox($db);
                $mod->remove('noboxes');
                // We need to remove because id of module has changed
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Opensurvey");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modOpenSurvey.class.php');
            if ($res) {
                $mod = new modOpenSurvey($db);
                $mod->remove('noboxes');
                // We need to remove because menu entries has changed
                $mod->init('newboxdefonly');
            }
        }
        if ($moduletoreload == 'MAIN_MODULE_USER') {
            dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User");
            $res = @(include_once DOL_DOCUMENT_ROOT . '/core/modules/modUser.class.php');
            if ($res) {
                $mod = new modUser($db);
                //$mod->remove('noboxes');  // We need to remove because id of module has changed
                $mod->init('newboxdefonly');
            }
        }
    }
}
Пример #3
0
/**
 * Disable/Reenable features modules.
 * We must do this when internal menu of module or permissions has changed
 * or when triggers have moved.
 *
 * @param	DoliDB		$db			Database handler
 * @param	Translate	$langs		Object langs
 * @param	Conf		$conf		Object conf
 * @return	void
 */
function migrate_reload_modules($db,$langs,$conf)
{
    dolibarr_install_syslog("upgrade2::migrate_reload_modules");

    if (! empty($conf->global->MAIN_MODULE_AGENDA))
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Agenda");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php');
        if ($res) {
            $mod=new modAgenda($db);
            $mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_SOCIETE))
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php');
        if ($res) {
            $mod=new modSociete($db);
            $mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_PRODUIT))    // Permission has changed into 2.7
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Produit");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php');
        if ($res) {
            $mod=new modProduct($db);
            //$mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_SERVICE))    // Permission has changed into 2.7
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service");
        if ($res) {
            $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php');
            $mod=new modService($db);
            //$mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_COMMANDE))   // Permission has changed into 2.9
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
        if ($res) {
            $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php');
            $mod=new modCommande($db);
            //$mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_FACTURE))    // Permission has changed into 2.9
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
        if ($res) {
            $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php');
            $mod=new modFacture($db);
            //$mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_FOURNISSEUR))    // Permission has changed into 2.9
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php');
        if ($res) {
            $mod=new modFournisseur($db);
            //$mod->remove('noboxes');
            $mod->init('noboxes');
        }
    }

    if (! empty($conf->global->MAIN_MODULE_USER))    // Permission has changed into 3.0
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php');
        if ($res) {
            $mod=new modUser($db);
            //$mod->remove('noboxes');  // We need to remove because id of module has changed
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_DEPLACEMENT))    // Permission has changed into 3.0
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php');
        if ($res) {
            $mod=new modDeplacement($db);
            //$mod->remove('noboxes');	// We need to remove because a permission id has been removed
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_DON))    // Permission has changed into 3.0
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Don");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php');
        if ($res) {
            $mod=new modDon($db);
            //$mod->remove('noboxes');	// We need to remove because a permission id has been removed
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_ECM))    // Permission has changed into 3.0 and 3.1
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM");
        if ($res) {
            $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php');
            $mod=new modECM($db);
            $mod->remove('noboxes');	// We need to remove because a permission id has been removed
            $mod->init('noboxes');
        }
    }
    if (! empty($conf->global->MAIN_MODULE_PAYBOX))    // Permission has changed into 3.0
    {
        dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Paybox");
        $res=@include_once(DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php');
        if ($res) {
            $mod=new modPaybox($db);
            $mod->remove('noboxes');  // We need to remove because id of module has changed
            $mod->init('noboxes');
        }
    }

}