/**
  * Delete one module if it's possible
  * @params array $arToDeleteModules array of all module which could be deleted
  * @params array $arInstalledModule array of all installed modules
  * @params string $module module to delete
  */
 function _deleteOneModule($moduleName, $arToDeleteModules, $arInstalledModule, &$arError)
 {
     //check if there is a module which need the module to delete
     if (in_array($moduleName, $arInstalledModule)) {
         $delete = true;
         foreach ($arInstalledModule as $installedModule) {
             $toCheck = CopixModule::getInformations($installedModule);
             foreach ((array) $toCheck->dependencies as $dependency) {
                 if ($dependency == $moduleName) {
                     if (in_array($installedModule, $arToDeleteModules)) {
                         /* replace $installedModule->name_imd  par $installed_module*/
                         if (!CopixModule::_deleteOneModule($installedModule, $arToDeleteModules, $arInstalledModule, $arError)) {
                             /* replace $installedModule->name_imd  par $installed_module*/
                             //one module need the deleted module so we can't delete it ....
                             $delete = false;
                             $arError[] = CopixI18N::get('copix:copixmodule.error.unableToDelete') . ' ' . $moduleName . ', ' . CopixI18N::get('copix:copixmodule.error.moduleIsNeededBy') . ' ' . $toCheck->name;
                         }
                     } else {
                         //one module need the deleted module so we can't delete it ....
                         $delete = false;
                         //die('kouik2 : '. implode($arToDeleteModules,' || ') . ' > ' .$installedModule );
                         $arError[] = CopixI18N::get('copix:copixmodule.error.unableToDelete') . ' ' . $moduleName . ', ' . CopixI18N::get('copix:copixmodule.error.moduleIsNeededBy') . ' ' . $toCheck->name;
                     }
                 }
             }
         }
         if ($delete) {
             $scriptFile = CopixModule::_getDeleteFile($moduleName);
             if ($scriptFile) {
                 $ct = CopixDBFactory::getConnection();
                 $ct->doSQLScript($scriptFile);
             }
             CopixModule::_deleteModuleInDatabase($moduleName);
             CopixModule::_deleteModuleInPHPCache($moduleName);
         }
         return $delete;
     } else {
         return true;
     }
 }