Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailgate "Missing type for Ticket template" #9013

Closed
AndreasGermany opened this issue Apr 28, 2021 · 17 comments
Closed

Mailgate "Missing type for Ticket template" #9013

AndreasGermany opened this issue Apr 28, 2021 · 17 comments
Labels
Milestone

Comments

@AndreasGermany
Copy link

AndreasGermany commented Apr 28, 2021

Hello,

I just updated from 9.3.0 to 9.5.5 and now there are some errors in the PHP log.
The mailgate is collecting mails and when there is text only and no attachments or embedded grafics, everything is fine.
When an email with an attchment or embedded grafic is collected it seems to work because incomming mails are converted to tickets but the log tells a diffrent story.

grafik
php.log

Best regards
Andreas

@btry
Copy link
Contributor

btry commented Apr 29, 2021

Hi

Might be related to #8418 (error seen with Formcreator)

@AndreasGermany
Copy link
Author

Hi,

Yes I think so. On GLPI 9.3.0 Formcreator 2.6.4-dev was installed but not activated. I also tried to delete and clean it before updating but still have the same error.
I still have the old GLPI 9.3.0 as a VM clone.
Is there a way to completely delete Formcreator 2.6.2-dev and all the changes it made and then try to update?

@trasher
Copy link
Contributor

trasher commented Apr 29, 2021

I close this one since it seems related to a plugin. I guess there is something that has not been stored correctly in your database, you should check tickets marked as template in the database.

@trasher trasher closed this as completed Apr 29, 2021
@cedric-anne cedric-anne reopened this May 4, 2021
@cedric-anne
Copy link
Member

cedric-anne commented May 4, 2021

Hi,

I take a look at the provided stacktrace, and, as ticket is created from a mail collector, it does not seems to be related to formcreator plugin.

@AndreasGermany

  1. What is the value, in database of glpi_entities.tickettype for the entity having ID 0 ?
  2. What is the value, in database of glpi_tickets.type for the ticket having ID 12127 ?

Regards

@stdglpi
Copy link

stdglpi commented May 6, 2021

Hi

Might be related to #8418 (error seen with Formcreator)

I did the update of the last version of Formcreator with the last GLPI 9.5.5 and the problem still occured.
After each solution or transfert entity I have the 500 web error and on GLPI : Missing type for ticket

For the moment I follow this discussion.

@cedric-anne
Copy link
Member

cedric-anne commented May 6, 2021

@stdglpi

  1. What is the value, in database, of glpi_entities.tickettype for the entity of the related ticket ?
  2. What is the value, in database, of glpi_tickets.type for the related ticket ?

@stdglpi
Copy link

stdglpi commented May 6, 2021

@stdglpi

  1. What is the value, in database, of glpi_entities.tickettype for the entity of the related ticket ?
  2. What is the value, in database, of glpi_tickets.type for the related ticket ?

from my side, the table doesn't exist in the database GLPI :(

ex : for glpi_entities.tickettype
image

@btry
Copy link
Contributor

btry commented May 6, 2021

Hi

The asked tables are glpi_entities and glpi_tickets. In the 1st table look at the column tickettype and in the 2nd look at the column type.

Find the rows using the ID of the entity and the ID of the ticket.

@stdglpi
Copy link

stdglpi commented May 6, 2021

Hi

The asked tables are glpi_entities and glpi_tickets. In the 1st table look at the column tickettype and in the 2nd look at the column type.

Find the rows using the ID of the entity and the ID of the ticket.

Thanks, see bellow :

What is the value, in database, of glpi_entities.tickettype for the entity of the related ticket ?
2
What is the value, in database, of glpi_tickets.type for the related ticket ?
2 or 1

@cedric-anne
Copy link
Member

Hi
The asked tables are glpi_entities and glpi_tickets. In the 1st table look at the column tickettype and in the 2nd look at the column type.
Find the rows using the ID of the entity and the ID of the ticket.

Thanks, see bellow :

What is the value, in database, of glpi_entities.tickettype for the entity of the related ticket ?
2
What is the value, in database, of glpi_tickets.type for the related ticket ?
2 or 1

So I do not understand why you have this error. We could not invastigate without a clear stacktrace. Please provide full logs.

Regards

@stdglpi
Copy link

stdglpi commented May 6, 2021

here my full log, I stay available if you need additional content.

image

Php-errors.log :

[2021-05-06 15:27:44] glpiphplog.WARNING: *** PHP User Warning (512): Missing type for Ticket template! in C:\inetpub\wwwroot\GLPI 9.5.5\inc\commonitilobject.class.php at line 7957
Backtrace :
inc\commonitilobject.class.php:7957 trigger_error()
inc\commonitilobject.class.php:7918 CommonITILObject->getTemplateFieldName()
inc\commonitilobject.class.php:792 CommonITILObject->getITILTemplateToUse()
inc\ticket.class.php:974 CommonITILObject->handleTemplateFields()
inc\commondbtm.class.php:1484 Ticket->prepareInputForUpdate()
inc\document_item.class.php:202 CommonDBTM->update()
inc\commondbtm.class.php:1173 Document_Item->post_addItem()
inc\commondbtm.class.php:5289 CommonDBTM->add()
inc\commonitilobject.class.php:1763 CommonDBTM->addFiles()
inc\ticket.class.php:1924 CommonITILObject->post_addItem()
inc\commondbtm.class.php:1173 Ticket->post_addItem()
inc\mailcollector.class.php:820 CommonDBTM->add()
front\mailcollector.form.php:88 MailCollector->collect()

[2021-05-06 15:28:50] glpiphplog.WARNING: *** PHP User Warning (512): Missing type for Ticket template! in C:\inetpub\wwwroot\GLPI 9.5.5\inc\commonitilobject.class.php at line 7957
Backtrace :
inc\commonitilobject.class.php:7957 trigger_error()
inc\commonitilobject.class.php:7918 CommonITILObject->getTemplateFieldName()
inc\commonitilobject.class.php:792 CommonITILObject->getITILTemplateToUse()
inc\ticket.class.php:974 CommonITILObject->handleTemplateFields()
inc\commondbtm.class.php:1484 Ticket->prepareInputForUpdate()
inc\transfer.class.php:1155 CommonDBTM->update()
inc\transfer.class.php:214 Transfer->transferItem()
front\transfer.action.php:46 Transfer->moveItems()

commonitilobject.class.php :

image

@cedric-anne cedric-anne added the bug label May 6, 2021
@DVOVVK
Copy link

DVOVVK commented Jun 29, 2021

This bug in GLPI in function getITILTemplateToUse

 if ($template_loaded) { // template loaded for profile or entity
     $newtype              = $type;
     $newitilcategories_id = $itilcategories_id;
     // Get predefined values for ticket template
     if (isset($tt->predefined['itilcategories_id']) && $tt->predefined['itilcategories_id']) {
        $newitilcategories_id = $tt->predefined['itilcategories_id'];
     }
     if (isset($tt->predefined['type']) && $tt->predefined['type']) {
        $newtype = $tt->predefined['type'];
     }
     if ($newtype
         && $newitilcategories_id) {

        $categ = new ITILCategory();
        if ($categ->getFromDB($newitilcategories_id)) {
           $field = $this->getTemplateFieldName($type); // ERROR IS HERE

           if (isset($categ->fields[$field]) && $categ->fields[$field]) {
              // without type and categ
              if ($tt->getFromDBWithData($categ->fields[$field], false)) {
                 $template_loaded = true;
              }
           }
        }
     }
  }

If $type is null an error occurs
In this line $field = $this->getTemplateFieldName($type); need change $type on $newtype
Should be $field = $this->getTemplateFieldName($newtype);

@trasher
Copy link
Contributor

trasher commented Jun 29, 2021

@DVOVVK maybe could you open a pull request with your fix proposal? Thanks!

@stdglpi
Copy link

stdglpi commented Jul 12, 2021

Hello all,

Any news on this issue ?

regards,

@cedric-anne
Copy link
Member

Hi @stdglpi @DVOVVK @AndreasGermany ,

Could you check if #9277 fixes your issue ?

Regards

@cedric-anne cedric-anne added this to the 9.5.6 milestone Jul 12, 2021
@stdglpi
Copy link

stdglpi commented Jul 12, 2021

Hi @stdglpi @DVOVVK @AndreasGermany ,

Could you check if #9277 fixes your issue ?

Regards

@cedric-anne @trasher Yes ! it is working for me right now !

Thank you !

@Riesuu
Copy link

Riesuu commented Aug 20, 2021

Hello,
I have the same problem since I applied the fix. 90% of my tickets are created via the collector

image

[2021-08-20 09:27:49] glpiphplog.WARNING:   *** PHP User Warning (512): Missing type for Ticket template! in /var/www/html/glpi/inc/commonitilobject.class.php at line 7957
  Backtrace :
  inc/commonitilobject.class.php:7957                trigger_error()
  inc/commonitilobject.class.php:7859                CommonITILObject->getTemplateFieldName()
  inc/ticket.class.php:4284                          CommonITILObject->getITILTemplateToUse()
  inc/commonglpi.class.php:627                       Ticket->showForm()
  ajax/common.tabs.php:106                           CommonGLPI::displayStandardTab()
  
[2021-08-20 09:28:07] glpiphplog.WARNING:   *** PHP Warning (2): Undefined variable $newtype in /var/www/html/glpi/inc/commonitilobject.class.php at line 7859
  Backtrace :
  inc/commonitilobject.class.php:792                 CommonITILObject->getITILTemplateToUse()
  inc/ticket.class.php:974                           CommonITILObject->handleTemplateFields()
  inc/commondbtm.class.php:1484                      Ticket->prepareInputForUpdate()
  front/ticket.form.php:72                           CommonDBTM->update()
  
[2021-08-20 09:28:07] glpiphplog.WARNING:   *** PHP User Warning (512): Missing type for Ticket template! in /var/www/html/glpi/inc/commonitilobject.class.php at line 7957
  Backtrace :
  inc/commonitilobject.class.php:7957                trigger_error()
  inc/commonitilobject.class.php:7859                CommonITILObject->getTemplateFieldName()
  inc/commonitilobject.class.php:792                 CommonITILObject->getITILTemplateToUse()
  inc/ticket.class.php:974                           CommonITILObject->handleTemplateFields()
  inc/commondbtm.class.php:1484                      Ticket->prepareInputForUpdate()
  front/ticket.form.php:72                           CommonDBTM->update()
  
[2021-08-20 09:28:07] glpiphplog.WARNING:   *** PHP Warning (2): Undefined variable $newtype in /var/www/html/glpi/inc/commonitilobject.class.php at line 7859
  Backtrace :
  inc/ticket.class.php:4284                          CommonITILObject->getITILTemplateToUse()
  inc/commonglpi.class.php:627                       Ticket->showForm()
  ajax/common.tabs.php:106                           CommonGLPI::displayStandardTab()
  
[2021-08-20 09:28:07] glpiphplog.WARNING:   *** PHP User Warning (512): Missing type for Ticket template! in /var/www/html/glpi/inc/commonitilobject.class.php at line 7957
  Backtrace :
  inc/commonitilobject.class.php:7957                trigger_error()
  inc/commonitilobject.class.php:7859                CommonITILObject->getTemplateFieldName()
  inc/ticket.class.php:4284                          CommonITILObject->getITILTemplateToUse()
  inc/commonglpi.class.php:627                       Ticket->showForm()
  ajax/common.tabs.php:106                           CommonGLPI::displayStandardTab()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants