You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-07-25 14:00:50

WebGreg
Member
Registered: 2020-02-27
Posts: 771

More reporting - duplicate entry

Hi

I got such an error:

SQL Error "1062": Duplicate entry '12-0' for key 'glpi_plugin_mreporting_profiles.profiles_id_reports' in query "INSERT INTO `glpi_plugin_mreporting_profiles` (`profiles_id`) VALUES ('12')"

I'm getting this error after installing the plugin > going to any profile > clicking on the save button (without any configuration of profile permissions).

How can I solve it?

GLPI 10.0.7

Last edited by WebGreg (2023-07-25 14:03:39)


--
GLPI 10.0.18
GLPI-Inventory 1.5.0
Ubuntu Server 20.04 LTS

Offline

#2 2023-07-26 03:32:47

cconard96
Moderator
Registered: 2018-07-31
Posts: 3,237
Website

Re: More reporting - duplicate entry

Which version of the mreporting plugin do you have installed?


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2023-07-26 07:33:01

WebGreg
Member
Registered: 2020-02-27
Posts: 771

Re: More reporting - duplicate entry

1.8.2


--
GLPI 10.0.18
GLPI-Inventory 1.5.0
Ubuntu Server 20.04 LTS

Offline

#4 2023-07-26 12:27:44

cconard96
Moderator
Registered: 2018-07-31
Posts: 3,237
Website

Re: More reporting - duplicate entry

Do you have the full stacktrace from the files/_log/sql-errors.log log?


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2023-07-26 19:01:16

WebGreg
Member
Registered: 2020-02-27
Posts: 771

Re: More reporting - duplicate entry

[2023-07-26 18:58:19] glpisqllog.ERROR: DBmysql::query() in /var/www/html/glpi/src/DBmysql.php line 370
  *** MySQL query error:
  SQL: INSERT INTO `glpi_plugin_mreporting_profiles` (`profiles_id`) VALUES ('12')
  Error: Duplicate entry '12-0' for key 'glpi_plugin_mreporting_profiles.profiles_id_reports'
  Backtrace :
  src/DBmysql.php:1320
  src/CommonDBTM.php:722                             DBmysql->insert()
  src/CommonDBTM.php:1317                            CommonDBTM->addToDB()
  marketplace/mreporting/inc/profile.class.php:184   CommonDBTM->add()
  marketplace/mreporting/inc/profile.class.php:86    PluginMreportingProfile->createAccess()
  src/CommonGLPI.php:689                             PluginMreportingProfile::displayTabContentForItem()
  ajax/common.tabs.php:116                           CommonGLPI::displayStandardTab()
  public/index.php:73                                require()


--
GLPI 10.0.18
GLPI-Inventory 1.5.0
Ubuntu Server 20.04 LTS

Offline

#6 2023-07-27 02:21:00

cconard96
Moderator
Registered: 2018-07-31
Posts: 3,237
Website

Re: More reporting - duplicate entry

I confirm the issue, although I don't really know that much about the plugin so making a fix may take a while.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#7 2023-07-27 09:33:24

WebGreg
Member
Registered: 2020-02-27
Posts: 771

Re: More reporting - duplicate entry

Hi.

I don't know if I did the right thing, but I opened an issue on guthub, but there is only the option to report vulnerabilities.

https://github.com/pluginsGLPI/mreporti … -fjxg-gf3w


--
GLPI 10.0.18
GLPI-Inventory 1.5.0
Ubuntu Server 20.04 LTS

Offline

#8 2023-07-27 20:37:26

cconard96
Moderator
Registered: 2018-07-31
Posts: 3,237
Website

Re: More reporting - duplicate entry

More Reporting is one of the plugins that only has community support on the forums, or support through GLPI Network, so bug reports aren't open on GitHub for it.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#9 2024-06-28 17:29:24

J2C99
Member
Registered: 2020-08-11
Posts: 112

Re: More reporting - duplicate entry

Sorry for the speleologic work, but the problem persists with the last version


I can give more informations.

The problem is on the mreporting  tab on all profiles (https://*****/front/profile.form.php?id=21%20&formoptions=%20data-track-changes%3D%27true%27)
In the code, the problem is (for mreporting 1.8.6)


   public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
    {
        global $CFG_GLPI;

        if ($item->getType() == 'Profile' && $item->getField('interface') != 'helpdesk') {
            $ID = $item->getField('id');                         
            $prof = new self();
                                                                             
            if (!$prof->getFromDBByProfile($item->getField('id'))) {   
              $prof->createAccess($item->getField('id'));                     
            }
            $prof->showForm($item->getField('id'));                             
        } else if ($item->getType() == 'PluginMreportingConfig') {
            $reportProfile = new self();
            $reportProfile->showFormForManageProfile($item);
        }
        return true;
    }

My explication for this code is  the following:
   With the  mreporting tab , you can change the accesses for the current profile , and  you can switch to an another.
But if the profile is a new,  none access has been created , and you can 't change the access for the reports.
It's the role    $prof->createAccess($item->getField('id'));   .

The problem  is the test condition.
   !$prof->getFromDBByProfile($item->getField('id')))    is always true   and it's problematic
   The condition  must be check in the glpi_plugin_mreporting_profiles  if  none row  contains  an entry for the given profile (id here)




Regards,

Offline

Board footer

Powered by FluxBB