Ticket email notification is empty with custom fields

Hello everyone,

I have installed the ticket module with some custom fields.

The problem is that the custom fields are shown as “/custom” into the email

Is there any solution or php code to add to make it work properly ?

FYI: I have a programmer and I am willing to make it work, I just don’t know where to start about this issue thanks a lot for everyone telling me where to look …

Thanks

The solution is the code bellow in file “dolibarr\www\dolibarr\htdocs\public\ticket\create_ticket.php”

Add the code bellow and edit to fit your need at line 258 and success ! :slight_smile:

`// Send email to TICKET_NOTIFICATION_EMAIL_TO

            $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;

            if ($sendto)
            {
                $subject = '[' . $conf->global->MAIN_INFO_SOCIETE_NOM . '] ' . $langs->transnoentities('TicketNewEmailSubjectAdmin');
                $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id) . "\n\n";
                $message_admin .= '<ul><li>' . $langs->trans('Title') . ' : ' . $object->subject . '</li>';
                $message_admin .= '<li>' . $langs->trans('Type') . ' : ' . $object->type_label . '</li>';
                $message_admin .= '<li>' . $langs->trans('Category') . ' : ' . $object->category_label . '</li>';
                $message_admin .= '<li>' . $langs->trans('Severity') . ' : ' . $object->severity_label . '</li>';
                $message_admin .= '<li>' . $langs->trans('From') . ' : ' . $object->origin_email . '</li>';
				
				
				//SOLUTION
				$conn = mysqli_connect(localhost,dbuser,password,dbname);
				
				$querry = 'SELECT * FROM llx_ticket_extrafields WHERE fk_object = '. $id;
				$resultat = mysqli_query($conn,$querry);
				
				if ($resultat->num_rows > 0) {
					// output data of each row
					while($row = $resultat->fetch_assoc()) {
						 $message_admin .= "<li>Nom : ". $row['nom'] . "</li><li>Entreprise : ". $row['entreprise'] . "</li><li>Téléphone : ". $row['telephone'] . "</li><li>Poste : ". $row['poste']. "</li>";
					}
				}







                if (is_array($extrafields->attributes[$object->table_element]['label']))
                {
                	foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
					{
               		$enabled = 1;
                		if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key]))
                		{
              			$enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
                 		}
                 		$perms = 1;
                 		if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key]))
                 		{
                			$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
                		}

                		$qualified=true;
                		if (empty($enabled) || $enabled == 2) $qualified = false;
                		if (empty($perms)) $qualified = false;
                		if ($qualified) $message_admin .= '';
						// original = if ($qualified) $message_admin .= '<li>' . $langs->trans($key) . ' : ' . $value . '</li>';
                	}
                }

`

Does someone made this solution work in version 11.?
Because the code for this module is very different than version 10.

BTW Why is this problem not solved in version 11.*?

Hi,

Sorry, I am not using this feature, so I can’t tell whether this fix will be the solution. I see a discrepancy in the variable name $val and $value on lines 260 and 276 in the htdocs/public/ticket/create_ticket.php (numbers are those from the develop version). Try to change $value to $val on line 276.

Should that correct the behaviour, please let me know, I’ll submit a PR.

Regards,
Marc