Skip to content

feat(sccm): Works with multiple configurations#120

Open
tolemac wants to merge 11 commits into
pluginsGLPI:mainfrom
tolemac:multi
Open

feat(sccm): Works with multiple configurations#120
tolemac wants to merge 11 commits into
pluginsGLPI:mainfrom
tolemac:multi

Conversation

@tolemac
Copy link
Copy Markdown
Contributor

@tolemac tolemac commented Feb 23, 2024

Hi again!

I have fear about #109, this PR have serious changes and we are working in production with code that is not in this repository, after #109 has been merged I think it will be more difficult for us to add this change, due to it we would like to make a effort to add this PR to the repo.

This PR is the same as #102, we think that it's a good feature and it has been working all days in the last year in our GLPI installation.

The feature is fully functional the only thing missing is a button to add a new SCCM Configuration.

I would like to add this but I haven't been able to...

Can you help me?

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Feb 23, 2024

Yeah! :D

I have fix some odd things that made that menu didn't work at expected.
I have been able to do it looking at #109 changes!!!

I will prepare the commit and push here.

@tolemac tolemac force-pushed the multi branch 2 times, most recently from 3829d0e to b71492f Compare February 23, 2024 12:34
@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Feb 23, 2024

Done! it's ready for review.

It has add button and the configs can be purged, config form use standard form html with navigation and historical log.

Comment thread inc/sccmdb.class.php Outdated
Comment thread inc/sccmdb.class.php Outdated
Comment thread inc/sccmdb.class.php Outdated
Comment thread inc/sccmdb.class.php Outdated
Comment thread inc/config.class.php Outdated
. "<br />" . $DB->error());

} else {
if (!self::isIdAutoIncrement())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you alter ID column from autoincrement to autoincrement ?

for me, you just need to test whether the name and collection fields are present, otherwise add them

Comment thread inc/config.class.php Outdated
Comment thread inc/config.class.php Outdated
Comment thread inc/config.class.php Outdated
Comment thread inc/config.class.php Outdated
@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Mar 13, 2024

@stonebuzz how to have the commits to keep your commits?
If I commit and push changes on my repo/branch will we lose your 2 commits?
Or can I checkout your changes? (don't know how)

@stonebuzz
Copy link
Copy Markdown
Contributor

git fetch my_repo (yours)

git pull --rebase my_repo my_branch (multi)

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Mar 13, 2024

@stonebuzz I have a question, what is the showtable.php file for?

@stonebuzz
Copy link
Copy Markdown
Contributor

I have a question, what is the showtable.php file for?

an old thing that's about to blow up ^^

don't worry about it now, I'll clean up later

@stonebuzz
Copy link
Copy Markdown
Contributor

Let me know when you've finished so I can do another review

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Mar 13, 2024

Let me know when you've finished so I can do another review

I think the only thing missing is the autoincrement issue, I have answered the review, I'm waiting for your response.

@stonebuzz
Copy link
Copy Markdown
Contributor

Hi @tolemac

I've corrected and refactored the code. Can you try this new version?

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Apr 5, 2024

Hi @tolemac

I've corrected and refactored the code. Can you try this new version?

I have pushed the code to production.

I have deactivate de plugin, and reactivate it.
Create a new configuration, enter on edition change several fields save changes, exit to list page, enter on details again, delete permanently ...

I have execute on demand Collect and Push automatic actions.

All work as expected, no errors on php-errors.log and sccm.log files.

It's ok for me.

@stonebuzz
Copy link
Copy Markdown
Contributor

Thanks, @tolemac,

I'll have it tested by a few people who use it before I merge it.

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Apr 5, 2024

Thanks, @tolemac,

I'll have it tested by a few people who use it before I merge it.

Totally agree!

Thanks in advance. I will stay tunned.

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Jul 23, 2024

@stonebuzz some news about that? still in testing?

Best regards!

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Jun 6, 2025

Hi again! :)

Something about that?

@stonebuzz

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented Oct 1, 2025

Hi again! ...

I don't know what to think ...

We want to upgrade to version 11, I will try to resolve conflicts and try to make work fine this PR.

I would appreciate some news from you, and know what you think about that.

@stonebuzz
Copy link
Copy Markdown
Contributor

Hi @tolemac

I might be a bit busy with the release of GLPI version 11, but I promise to keep an eye on this PR to support you.

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented May 18, 2026

I'm going to update my GLPI to last version and test it. I tell you when I have tested it.

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented May 18, 2026

GLPI updated.

First problem:

[2026-05-18 17:57:02] glpi.CRITICAL:   *** Uncaught PHP Exception Exception: "Executing direct queries is not allowed!" at DBmysql.php line 388
  Backtrace :
  ./src/DBmysql.php:388                              
  ./plugins/sccm/inc/config.class.php:201            DBmysql->query()
  ./plugins/sccm/inc/config.class.php:254            PluginSccmConfig::isIdAutoIncrement()
  ./plugins/sccm/hook.php:49                         PluginSccmConfig::install()
  ./src/Plugin.php:1249                              plugin_sccm_install()
  :                                                  Plugin->install()
  ./src/Glpi/Marketplace/Controller.php:688          call_user_func()
  ./src/Glpi/Marketplace/Controller.php:578          Glpi\Marketplace\Controller->setPluginState()
  ./ajax/marketplace.php:62                          Glpi\Marketplace\Controller->installPlugin()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:208        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:71                              Symfony\Component\HttpKernel\Kernel->handle()

I have this function:

    public static function isIdAutoIncrement()
    {
        global $DB;
        $columns = $DB->query("SHOW COLUMNS FROM glpi_plugin_sccm_configs WHERE FIELD = 'id'");
        $data = $columns->fetch_assoc();        
        return str_contains($data["Extra"], "auto_increment");
    }

we can't execute a query using global $DB ?? how to do now?

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented May 19, 2026

Ok, I have solved some issues. I have it working with 11.0.7

I would like to squash the commits to leave it in only one commit, but I will wait for your review.

@stonebuzz
Copy link
Copy Markdown
Contributor

stonebuzz commented May 19, 2026

Hi @tolemac,

Thank you for your feedback.

GLPI 11 has now been officially released and, as promised, I finally had the opportunity to take a look at this topic 😊

I would like to suggest testing the following PR:

#169

This PR reintroduces the requested feature (support for multiple SCCM configurations) while following GLPI development best practices as closely as possible and simplifying the data migration process.

At the moment, this version does not yet support specifying SCCM collections.

This will be addressed in a second step in order to keep the scope of the PR focused and easier to review.

Could you please test this new version and share your feedback? Unfortunately, we do not currently have an SCCM environment available for testing on our side.

Thank you in advance, and thank you as well for your work — it has been very helpful to me.

Best regards,

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented May 19, 2026

Hi @stonebuzz !! thanks for your support!!

Unfortunately, I can't run the test without specifying the collection name. We belong to a very large group of groups, and if I don't filter by collection name, thousands and thousands of computers that don't belong to my group would be created... we put it in to limit this ...

I can download the code and add collection name support and test it.

Are you agree?

@stonebuzz
Copy link
Copy Markdown
Contributor

Yes, that sounds good.

However, I’d like the current PR to be finalized and merged before adding this feature.

@tolemac
Copy link
Copy Markdown
Contributor Author

tolemac commented May 19, 2026

Ok, I will try to test the new PR without run the collect method.

See you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants