Debug posting message from ticket page

This commit is contained in:
Laurent Destailleur 2020-08-21 01:11:22 +02:00
parent 0390111132
commit ad0625b6ec
8 changed files with 84 additions and 49 deletions

View File

@ -134,8 +134,8 @@ $arrayfields = array(
'a.datep'=>array('label'=>"DateStart", 'checked'=>1),
'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1),
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1),
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
@ -694,7 +694,7 @@ if ($resql)
if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_EMAIL') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_EMAIL' || $actioncomm->type_code == 'AC_EMAIL_IN') $imgpicto = img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_INT') $imgpicto = img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright').' ';
elseif (!preg_match('/_AUTO/', $actioncomm->type_code)) $imgpicto = img_picto('', 'object_other', '', false, 0, 0, '', 'paddingright').' ';
@ -706,7 +706,10 @@ if ($resql)
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype = 'AC_OTH';
if ($actioncomm->type_code == 'AC_OTH' && $actioncomm->code == 'TICKET_MSG') {
$labeltype = $langs->trans("Message");
} elseif (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
} else {
if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
}
print dol_trunc($labeltype, 28);
print '</td>';
}
@ -727,6 +730,7 @@ if ($resql)
}
$formatToUse = $obj->fulldayevent ? 'day' : 'dayhour';
// Start date
if (!empty($arrayfields['a.datep']['checked'])) {
print '<td class="center nowraponall">';

View File

@ -884,12 +884,12 @@ class FormTicket
$modelmail_array[$line->id] = $line->label;
}
print '<table class="border" width="'.$width.'">';
print '<table class="border" width="'.$width.'">';
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid)
{
print '<tr><td width="30%"></td><td colspan="2">';
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : '');
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
@ -904,28 +904,27 @@ class FormTicket
}
print ' &nbsp; ';
print '<input class="button" type="submit" value="'.$langs->trans('Use').'" name="modelselected" id="modelselected">';
print ' &nbsp; ';
print '</div></td>';
}
// Private message (not visible by customer/external user)
if (!$user->socid) {
print '<tr><td width="30%"></td><td>';
print '<tr><td></td><td>';
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
print '<label for="private_message">'.$langs->trans('MarkMessageAsPrivate').'</label>';
print '</td><td class="center">';
print $form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print ' '.$form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print '</td></tr>';
}
// Subject
print '<tr class="email_line"><td class="titlefieldcreate">'.$langs->trans('Subject').'</td>';
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
print '<td colspan="2"><input type="text" class="text" size="80" name="subject" value="['.$label_title.' - '.$langs->trans("Ticket").' #'.$this->ref.'] '.$langs->trans('TicketNewMessage').'" />';
print '<td><input type="text" class="text" size="80" name="subject" value="['.$label_title.' - '.$langs->trans("Ticket").' #'.$this->ref.'] '.$langs->trans('TicketNewMessage').'" />';
print '</td></tr>';
// Destinataires
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients').'</td><td colspan="2">';
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients').'</td><td>';
$ticketstat = new Ticket($this->db);
$res = $ticketstat->fetch('', '', $this->track_id);
if ($res) {
@ -973,7 +972,9 @@ class FormTicket
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
$mail_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO;
print '<tr class="email_line"><td><label for="mail_intro">'.$langs->trans("TicketMessageMailIntro").'</label>';
print '<tr class="email_line"><td><label for="mail_intro">';
print $form->textwithpicto($langs->trans("TicketMessageMailIntro"), $langs->trans("TicketMessageMailIntroHelp"), 1, 'help');
print '</label>';
print '</td><td>';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -982,8 +983,6 @@ class FormTicket
$doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td><td class="center">';
print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelp"), 1, 'help');
print '</td></tr>';
}
@ -1009,17 +1008,16 @@ class FormTicket
$defaultmessage = preg_replace("/^\n+/", "", $defaultmessage);
}
print '<tr><td class="tdtop"><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span></label></td><td>';
print '<tr><td class="tdtop"><label for="message"><span class="fieldrequired">'.$langs->trans("Message").'</span>';
if ($user->rights->ticket->write && !$user->socid) {
print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help');
}
print '</label></td><td>';
//$toolbarname = 'dolibarr_details';
$toolbarname = 'dolibarr_notes';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70);
$doleditor->Create();
print '</td><td class="center">';
if ($user->rights->ticket->write && !$user->socid) {
print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help');
}
print '</td></tr>';
// Signature
@ -1027,13 +1025,11 @@ class FormTicket
if ($user->rights->ticket->write && !$user->socid) {
$mail_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE;
print '<tr class="email_line"><td><label for="mail_intro">'.$langs->trans("TicketMessageMailSignature").'</label>';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelp"), 1, 'help');
print '</td><td>';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td><td class="center">';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelp"), 1, 'help');
print '</td></tr>';
}
@ -1041,7 +1037,7 @@ class FormTicket
if (!empty($this->withfile)) {
$out = '<tr>';
$out .= '<td width="180">'.$langs->trans("MailFile").'</td>';
$out .= '<td colspan="2">';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';

View File

@ -1647,21 +1647,32 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
// Type
$out .= '<td>';
// TODO Code common with code into showactions
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto);
if ($actionstatic->type_picto) {
$imgpicto .= img_picto('', $actionstatic->type_picto);
}
else {
if ($actionstatic->type_code == 'AC_RDV') $out .= img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_TEL') $out .= img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_FAX') $out .= img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_EMAIL') $out .= img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_INT') $out .= img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) $out .= img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
if ($actionstatic->type_code == 'AC_RDV') $imgpicto .= img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_TEL') $imgpicto .= img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_FAX') $imgpicto .= img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_EMAIL' || $actionstatic->type_code == 'AC_EMAIL_IN') $imgpicto .= img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_INT') $imgpicto .= img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') $imgpicto = img_picto('', 'object_conversation', '', false, 0, 0, '', 'paddingright').' ';
elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) $imgpicto .= img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
}
}
$out .= $imgpicto;
$labeltype = $actionstatic->type_code;
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype = 'AC_OTH';
if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
if ($actionstatic->type_code == 'AC_OTH' && $actionstatic->code == 'TICKET_MSG') {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
if ($actionstatic->type_code == 'AC_OTH_AUTO' && ($actionstatic->type_code != $actionstatic->code) && $labeltype && !empty($arraylist[$actionstatic->code])) $labeltype .= ' - '.$arraylist[$actionstatic->code]; // Use code in priority on type_code
}
$out .= dol_trunc($labeltype, 28);
$out .= '</td>';

View File

@ -1136,6 +1136,7 @@ class EmailCollector extends CommonObject
$thirdpartyfoundby = '';
$contactfoundby = '';
$projectfoundby = '';
$ticketfoundby = '';
$this->db->begin();
@ -1250,7 +1251,7 @@ class EmailCollector extends CommonObject
}
$fk_element_id = 0; $fk_element_type = '';
$contactid = 0; $thirdpartyid = 0; $projectid = 0;
$contactid = 0; $thirdpartyid = 0; $projectid = 0; $ticketid = 0;
// Analyze TrackId in field References. For example:
// References: <1542377954.SMTPs-dolibarr-thi649@8f6014fde11ec6cdec9a822234fc557e>
@ -1263,10 +1264,10 @@ class EmailCollector extends CommonObject
$reg = array();
if (!empty($headers['References']))
{
$arrayofreferences = preg_explode('/\s+/', $headers['References']);
$arrayofreferences = preg_split('/\s+/', $headers['References']);
foreach($arrayofreferences as $reference) {
print "Process reference ".$reference."<br>\n";
//print "Process reference ".dol_escape_htmltag($reference)."<br>\n";
if (preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg)) {
// This is a Dolibarr reference
$trackid = $reg[1].$reg[2];
@ -1310,6 +1311,7 @@ class EmailCollector extends CommonObject
$obj = $this->db->fetch_object($resql);
$objectid = $obj->rowid;
$objectemail = new Ticket($this->db);
$ticketfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')';
} else {
$errorforemail++;
}
@ -1322,12 +1324,14 @@ class EmailCollector extends CommonObject
$obj = $this->db->fetch_object($resql);
$objectid = $obj->rowid;
$objectemail = new Project($this->db);
$projectfoundby = $langs->transnoentitiesnoconv("EmailMsgID").' ('.$reg[1].')';
} else {
$errorforemail++;
}
}
}
// Load object linked to email
if (is_object($objectemail))
{
$result = $objectemail->fetch($objectid);
@ -1338,9 +1342,14 @@ class EmailCollector extends CommonObject
// Fix fk_element_type
if ($fk_element_type == 'facture') $fk_element_type = 'invoice';
$thirdpartyid = $objectemail->fk_soc;
$contactid = $objectemail->fk_socpeople;
$projectid = isset($objectemail->fk_project) ? $objectemail->fk_project : $objectemail->fk_projet;
if (get_class($objectemail) != 'Societe') $thirdpartyid = $objectemail->fk_soc;
else $thirdpartyid = $objectemail->id;
if (get_class($objectemail) != 'Contact') $contactid = $objectemail->fk_socpeople;
else $contactid = $objectemail->id;
if (get_class($objectemail) != 'Project') $projectid = isset($objectemail->fk_project) ? $objectemail->fk_project : $objectemail->fk_projet;
else $projectid = $objectemail->id;
}
}
@ -1351,7 +1360,7 @@ class EmailCollector extends CommonObject
if ($result <= 0) $projectstatic->id = 0;
else {
$projectid = $projectstatic->id;
$projectfoundby = 'trackid ('.$trackid.')';
if ($trackid) $projectfoundby = 'trackid ('.$trackid.')';
if (empty($contactid)) $contactid = $projectstatic->fk_contact;
if (empty($thirdpartyid)) $thirdpartyid = $projectstatic->fk_soc;
}
@ -1363,7 +1372,7 @@ class EmailCollector extends CommonObject
if ($result <= 0) $contactstatic->id = 0;
else {
$contactid = $contactstatic->id;
$contactfoundby = 'trackid ('.$trackid.')';
if ($trackid) $contactfoundby = 'trackid ('.$trackid.')';
if (empty($thirdpartyid)) $thirdpartyid = $contactstatic->fk_soc;
}
}
@ -1374,7 +1383,7 @@ class EmailCollector extends CommonObject
if ($result <= 0) $thirdpartystatic->id = 0;
else {
$thirdpartyid = $thirdpartystatic->id;
$thirdpartyfoundby = 'trackid ('.$trackid.')';
if ($trackid) $thirdpartyfoundby = 'trackid ('.$trackid.')';
}
}
@ -1558,7 +1567,6 @@ class EmailCollector extends CommonObject
$alreadycreated = 0;
// TODO Check if $msg ID already in database for $conf->entity
if (!$alreadycreated)
{
if ($projectstatic->id > 0)
@ -1619,7 +1627,7 @@ class EmailCollector extends CommonObject
// Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header);
var_dump($actioncomm);
if ($errorforthisaction)
{
$errorforactions++;
@ -1669,6 +1677,7 @@ class EmailCollector extends CommonObject
$projecttocreate->description = dol_concatdesc(dolGetFirstLineOfText(dol_string_nohtmltag($description, 2), 10), '...'.$langs->transnoentities("SeePrivateNote").'...');
$projecttocreate->note_private = $descriptionfull;
$projecttocreate->entity = $conf->entity;
$projecttocreate->email_msgid = $msgid;
// Overwrite values with values extracted from source email.
// This may overwrite any $projecttocreate->xxx properties.
@ -1778,6 +1787,7 @@ class EmailCollector extends CommonObject
$tickettocreate->notify_tiers_at_create = 0;
$tickettocreate->note_private = $descriptionfull;
$tickettocreate->entity = $conf->entity;
$tickettocreate->email_msgid = $msgid;
//$tickettocreate->fk_contact = $contactstatic->id;
// Overwrite values with values extracted from source email.
@ -1847,8 +1857,6 @@ class EmailCollector extends CommonObject
'actionparam'=> $operation['actionparam'],
'thirdpartyid' => $thirdpartyid,
'objectid'=> $objectid,
'objectemail'=> $objectemail,

View File

@ -36,6 +36,7 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position)
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 4,'AC_EMAIL','system','Send Email',NULL, 1, 4);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 5,'AC_RDV','system','Rendez-vous',NULL, 1, 1);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4);
-- Code kept for backward compatibility < 3.3
--insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 3,'AC_PROP','systemauto', 'Send commercial proposal by email','propal',0,10);

View File

@ -101,6 +101,7 @@ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNA
PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n
PredefinedMailContentTicket_send=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection)

View File

@ -114,6 +114,8 @@ class Project extends CommonObject
public $opp_status; // opportunity status, into table llx_c_lead_status
public $opp_percent; // opportunity probability
public $email_msgid;
public $oldcopy;
public $weekWorkLoad; // Used to store workload details of a projet
@ -187,6 +189,7 @@ class Project extends CommonObject
'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'Opp amount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
'usage_bill_time' =>array('type'=>'integer', 'label'=>'Usage bill time', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
@ -265,6 +268,7 @@ class Project extends CommonObject
$sql .= ", usage_task";
$sql .= ", usage_bill_time";
$sql .= ", usage_organize_event";
$sql .= ", email_msgid";
$sql .= ", note_private";
$sql .= ", note_public";
$sql .= ", entity";
@ -287,6 +291,7 @@ class Project extends CommonObject
$sql .= ", ".($this->usage_task ? 1 : 0);
$sql .= ", ".($this->usage_bill_time ? 1 : 0);
$sql .= ", ".($this->usage_organize_event ? 1 : 0);
$sql .= ", ".($this->email_msgid ? "'".$this->db->escape($this->email_msgid)."'" : 'null');
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null');
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null');
$sql .= ", ".$conf->entity;
@ -474,9 +479,9 @@ class Project extends CommonObject
if (empty($id) && empty($ref)) return -1;
$sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,";
$sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,";
$sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,";
$sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, entity";
$sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, email_msgid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet";
if (!empty($id))
{
@ -498,6 +503,7 @@ class Project extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->title = $obj->title;
$this->description = $obj->description;
@ -527,7 +533,7 @@ class Project extends CommonObject
$this->usage_task = (int) $obj->usage_task;
$this->usage_bill_time = (int) $obj->usage_bill_time;
$this->usage_organize_event = (int) $obj->usage_organize_event;
$this->entity = $obj->entity;
$this->email_msgid = $obj->email_msgid;
$this->db->free($resql);

View File

@ -171,6 +171,8 @@ class Ticket extends CommonObject
*/
public $notify_tiers_at_create;
public $email_msgid;
public $lines;
/**
@ -238,6 +240,7 @@ class Ticket extends CommonObject
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1),
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1),
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1),
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')),
@ -375,6 +378,7 @@ class Ticket extends CommonObject
$sql .= "origin_email,";
$sql .= "fk_user_create,";
$sql .= "fk_user_assign,";
$sql .= "email_msgid,";
$sql .= "subject,";
$sql .= "message,";
$sql .= "fk_statut,";
@ -397,6 +401,7 @@ class Ticket extends CommonObject
$sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").",";
$sql .= " ".($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')).",";
$sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').",";
$sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").",";
$sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").",";
$sql .= " ".(!isset($this->message) ? 'NULL' : "'".$this->db->escape($this->message)."'").",";
$sql .= " ".(!isset($this->fk_statut) ? '0' : "'".$this->db->escape($this->fk_statut)."'").",";
@ -483,6 +488,7 @@ class Ticket extends CommonObject
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.entity,";
$sql .= " t.ref,";
$sql .= " t.track_id,";
$sql .= " t.fk_soc,";
@ -490,6 +496,7 @@ class Ticket extends CommonObject
$sql .= " t.origin_email,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_assign,";
$sql .= " t.email_msgid,";
$sql .= " t.subject,";
$sql .= " t.message,";
$sql .= " t.fk_statut as status,";
@ -536,6 +543,7 @@ class Ticket extends CommonObject
$this->origin_email = $obj->origin_email;
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_assign = $obj->fk_user_assign;
$this->email_msgid = $obj->email_msgid;
$this->subject = $obj->subject;
$this->message = $obj->message;