Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into pr/bb2a/21596

This commit is contained in:
Anthony Berton 2022-10-26 14:11:54 +02:00
commit 7b3ab23dca
49 changed files with 1403 additions and 1054 deletions

View File

@ -145,6 +145,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
$result = $db->query($sql);
$num = null;
if ($result) {
$num = $db->num_rows($result);
}

View File

@ -226,7 +226,7 @@ if ($action == 'edit') {
print '<table class="border centpercent">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" class="minwidth300" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
print '</td></tr>';
@ -289,7 +289,7 @@ if ($action == 'create' && $user->rights->adherent->configurer) {
print '</td></tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" class="minwidth300" value="'.dol_escape_htmltag(GETPOST("libelle", 'alphanohtml')).'"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -51,7 +51,7 @@ $modules = array(
'NOTE_PUBLIC' => 'FCKeditorForNotePublic',
'NOTE_PRIVATE' => 'FCKeditorForNotePrivate',
'SOCIETE' => 'FCKeditorForCompany',
'PRODUCTDESC' => 'FCKeditorForProduct',
//'PRODUCTDESC' => 'FCKeditorForProduct',
'DETAILS' => 'FCKeditorForProductDetails',
'USERSIGN' => 'FCKeditorForUserSignature',
'MAILING' => 'FCKeditorForMailing',
@ -166,7 +166,12 @@ if (empty($conf->use_javascript_ajax)) {
print '<!-- constant = '.$constante.' -->'."\n";
print '<tr class="oddeven">';
print '<td width="16">'.img_object("", $picto[$const]).'</td>';
print '<td>'.$langs->trans($desc).'</td>';
print '<td>';
print $langs->trans($desc);
if ($const == 'DETAILS') {
print '<br><span class="warning">'.$langs->trans("FCKeditorForProductDetails2").'</span>';
}
print '</td>';
print '<td class="center" width="100">';
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
if ($value == 0) {
@ -185,6 +190,7 @@ if (empty($conf->use_javascript_ajax)) {
print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page_y" value="">';
// Skins
show_skin(null, 1);
@ -219,7 +225,7 @@ if (empty($conf->use_javascript_ajax)) {
print $conf->global->FCKEDITOR_TEST;
print '</div>';
}
print $form->buttonsSaveCancel("Save", '');
print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition');
print '<div id="divforlog"></div>';
print '</form>'."\n";

View File

@ -419,7 +419,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td class="center">';
@ -431,7 +431,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td class="center">';

View File

@ -247,7 +247,7 @@ if ($user->rights->categorie->creer) {
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('description', $description, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_5, '90%');
$doleditor = new DolEditor('description', $description, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_5, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -267,7 +267,7 @@ if ($action == 'edit') {
// Desc
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
@ -327,7 +327,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td>';
print '<td><input name="libelle" class="minwidth200 maxwidth300" value="'.GETPOST('libelle', 'alpha').'"></td></tr>';
print '<tr><td>'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@ -578,7 +578,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql = preg_replace('/, $/', '', $sql);
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
@ -755,12 +755,12 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Add HAVING from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
@ -987,7 +987,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
@ -1104,7 +1104,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -1362,7 +1362,7 @@ if ($resql) {
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['p.datec']['checked'])) {
@ -1543,7 +1543,7 @@ if ($resql) {
'totalarray' => &$totalarray,
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
@ -2140,7 +2140,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['p.datec']['checked'])) {
@ -2232,7 +2232,7 @@ if ($resql) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -823,7 +823,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
@ -857,7 +857,7 @@ if ($search_user > 0) {
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' WHERE c.fk_soc = s.rowid';
@ -1012,12 +1012,12 @@ if ($search_fk_input_reason > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// Add HAVING from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
@ -1224,7 +1224,7 @@ if ($resql) {
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
@ -1393,7 +1393,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -1621,7 +1621,7 @@ if ($resql) {
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -1826,7 +1826,7 @@ if ($resql) {
'sortorder' => $sortorder,
'totalarray' => &$totalarray,
);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) {
print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
@ -2372,7 +2372,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -2595,7 +2595,7 @@ if ($resql) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -190,7 +190,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
@ -242,7 +242,7 @@ if (!empty($searchCategoryBankList)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
@ -308,7 +308,7 @@ if ($optioncss != '') {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
@ -366,7 +366,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire) {
// Bank accounts
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -438,7 +438,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['b.datec']['checked'])) {
@ -502,7 +502,7 @@ if (!empty($arrayfields['toreconcile']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['b.datec']['checked'])) {
print_liste_field_titre($arrayfields['b.datec']['label'], $_SERVER["PHP_SELF"], "b.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
@ -684,7 +684,7 @@ foreach ($accounts as $key => $type) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp, $action); // Note that $action and $objecttmpect may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['b.datec']['checked'])) {

View File

@ -595,7 +595,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
@ -859,7 +859,7 @@ if (!empty($searchCategoryCustomerList)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles.
@ -1147,7 +1147,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
$arrayofmassactions = array(
@ -1265,7 +1265,7 @@ if ($resql) {
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -1552,7 +1552,7 @@ if ($resql) {
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['f.datec']['checked'])) {
@ -1737,7 +1737,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['f.datec']['checked'])) {
print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
@ -1793,7 +1793,6 @@ if ($resql) {
$total_margin = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
@ -2438,7 +2437,7 @@ if ($resql) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['f.datec']['checked'])) {
@ -2551,7 +2550,7 @@ if ($resql) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>'."\n";

View File

@ -251,7 +251,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
@ -329,7 +329,7 @@ if ($search_user > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.status, s.logo,';
@ -347,7 +347,7 @@ $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $obj
$sql .= $hookmanager->resPrint;
// Add HAVING from hooks
$parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df);
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
if ($search_dfyear > 0 && $search_op2df) {
if ($search_op2df == '<=') {
@ -582,7 +582,7 @@ if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->right
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -674,7 +674,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['c.datec']['checked'])) {
@ -748,7 +748,7 @@ if (!empty($arrayfields['c.date_contrat']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) {
print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
@ -943,7 +943,7 @@ while ($i < min($num, $limit)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['c.datec']['checked'])) {
@ -1011,7 +1011,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</table>';

View File

@ -160,7 +160,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto
}
if (is_object($object) && $object->id > 0) {
if ($backtopage) {
if (!empty($backtopage)) {
header('Location: '.$backtopage);
exit;
} else {

View File

@ -104,7 +104,6 @@ class box_birthdays_members extends ModeleBoxes
$memberstatic->id = $objp->rowid;
$memberstatic->firstname = $objp->firstname;
$memberstatic->lastname = $objp->lastname;
$memberstatic->email = $objp->email;
$dateb = $this->db->jdate($objp->birth);
$age = date('Y', dol_now()) - date('Y', $dateb);

View File

@ -60,7 +60,7 @@ class DolEditor
* 'In' = each window has its own toolbar
* 'Out:name' = share toolbar into the div called 'name'
* @param boolean $toolbarstartexpanded Bar is visible or not at start
* @param int $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param boolean $uselocalbrowser Enabled to add links to local object with local browser. If false, only external images can be added in content.
* @param boolean|string $okforextendededitor True=Allow usage of extended editor tool if qualified (like ckeditor). If 'textarea', force use of simple textarea. If 'ace', force use of Ace.
* Warning: If you use 'ace', don't forget to also include ace.js in page header. Also, the button "save" must have class="buttonforacesave".
* @param int $rows Size of rows for textarea tool

View File

@ -6299,7 +6299,7 @@ class Form
}
if (!$options_only) {
$return .= '<select class="flat minwidth75imp" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
$return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
}
$selectedfound = false;
@ -6346,6 +6346,7 @@ class Form
if (!$options_only) {
$return .= '</select>';
//$return .= ajax_combobox($htmlname); // This break for the moment dynamic autoselection of a value when selecting a product in object lines
}
} else {
$return .= $this->error;

View File

@ -670,7 +670,7 @@ class FormTicket
/**
* Return html list of tickets type
*
* @param string|array $selected Id du type pre-selectionne
* @param string|array $selected Id of preselected field or array of Ids
* @param string $htmlname Nom de la zone select
* @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz))
* @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
@ -685,7 +685,7 @@ class FormTicket
{
global $langs, $user;
$selected = is_array($selected) ? $selected : (!empty($selected) ? implode(',', $selected) : array());
$selected = is_array($selected) ? $selected : (!empty($selected) ? array($selected) : array());
$ticketstat = new Ticket($this->db);
dol_syslog(get_class($this) . "::select_types_tickets " . implode(';', $selected) . ", " . $htmlname . ", " . $filtertype . ", " . $format . ", " . $multiselect, LOG_DEBUG);
@ -1501,7 +1501,7 @@ class FormTicket
print '</td><td>';
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_2, 70);
$doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, getDolGlobalInt('FCKEDITOR_ENABLE_TICKET'), ROWS_2, 70);
$doleditor->Create();
print '</td></tr>';

View File

@ -11372,3 +11372,721 @@ function dolForgeCriteriaCallback($matches)
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
}
/**
* Get timeline icon
* @param ActionComm $actionstatic actioncomm
* @param array $histo histo
* @param int $key key
* @return string
*/
function getTimelineIcon($actionstatic, &$histo, $key)
{
global $conf, $langs;
$out = '<!-- timeline icon -->'."\n";
$iconClass = 'fa fa-comments';
$img_picto = '';
$colorClass = '';
$pictoTitle = '';
if ($histo[$key]['percent'] == -1) {
$colorClass = 'timeline-icon-not-applicble';
$pictoTitle = $langs->trans('StatusNotApplicable');
} elseif ($histo[$key]['percent'] == 0) {
$colorClass = 'timeline-icon-todo';
$pictoTitle = $langs->trans('StatusActionToDo').' (0%)';
} elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) {
$colorClass = 'timeline-icon-in-progress';
$pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)';
} elseif ($histo[$key]['percent'] >= 100) {
$colorClass = 'timeline-icon-done';
$pictoTitle = $langs->trans('StatusActionDone').' (100%)';
}
if ($actionstatic->code == 'AC_TICKET_CREATE') {
$iconClass = 'fa fa-ticket';
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
$iconClass = 'fa fa-pencilxxx';
} elseif ($actionstatic->code == 'TICKET_MSG') {
$iconClass = 'fa fa-comments';
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
$iconClass = 'fa fa-mask';
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($actionstatic->type_picto) {
$img_picto = img_picto('', $actionstatic->type_picto);
} else {
if ($actionstatic->type_code == 'AC_RDV') {
$iconClass = 'fa fa-handshake';
} elseif ($actionstatic->type_code == 'AC_TEL') {
$iconClass = 'fa fa-phone';
} elseif ($actionstatic->type_code == 'AC_FAX') {
$iconClass = 'fa fa-fax';
} elseif ($actionstatic->type_code == 'AC_EMAIL') {
$iconClass = 'fa fa-envelope';
} elseif ($actionstatic->type_code == 'AC_INT') {
$iconClass = 'fa fa-shipping-fast';
} elseif ($actionstatic->type_code == 'AC_OTH_AUTO') {
$iconClass = 'fa fa-robot';
} elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) {
$iconClass = 'fa fa-robot';
}
}
}
$out .= '<i class="'.$iconClass.' '.$colorClass.'" title="'.$pictoTitle.'">'.$img_picto.'</i>'."\n";
return $out;
}
/**
* getActionCommEcmList
*
* @param ActionComm $object Object ActionComm
* @return array Array of documents in index table
*/
function getActionCommEcmList($object)
{
global $conf, $db;
$documents = array();
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
$sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
$sql .= " WHERE ecm.filepath = 'agenda/".((int) $object->id)."'";
//$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload
$sql .= ' ORDER BY ecm.position ASC';
$resql = $db->query($sql);
if ($resql) {
if ($db->num_rows($resql)) {
while ($obj = $db->fetch_object($resql)) {
$documents[$obj->id] = $obj;
}
}
}
return $documents;
}
/**
* Show html area with actions in messaging format.
* Note: Global parameter $param must be defined.
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object
* @param Contact $objcon Filter on object contact to filter events on a contact
* @param int $noprint Return string but does not output it
* @param string $actioncode Filter on actioncode
* @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
* @param array $filters Filter on other fields
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @return string|void Return html part or void if noprint is 1
*/
function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC')
{
global $user, $conf;
global $form;
global $param, $massactionbutton;
dol_include_once('/comm/action/class/actioncomm.class.php');
// Check parameters
if (!is_object($filterobj) && !is_object($objcon)) {
dol_print_error('', 'BadParameter');
}
$histo = array();
$numaction = 0;
$now = dol_now();
$sortfield_list = explode(',', $sortfield);
$sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent');
$sortfield_new_list = array();
foreach ($sortfield_list as $sortfield_value) {
$sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)];
}
$sortfield_new = implode(',', $sortfield_new_list);
if (isModEnabled('agenda')) {
// Search histo on actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
} else {
$sql = "SELECT a.id, a.label as label,";
}
$sql .= " a.datep as dp,";
$sql .= " a.note as message,";
$sql .= " a.datep2 as dp2,";
$sql .= " a.percent as percent, 'action' as type,";
$sql .= " a.fk_element, a.elementtype,";
$sql .= " a.fk_contact,";
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql .= ", sp.lastname, sp.firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= ", m.lastname, m.firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", o.ref";
}
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
$force_filter_contact = false;
if (is_object($objcon) && $objcon->id > 0) {
$force_filter_contact = true;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
}
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
$sql .= " ON er.resource_type = 'dolresource'";
$sql .= " AND er.element_id = a.id";
$sql .= " AND er.resource_id = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= ", ".MAIN_DB_PREFIX."adherent as m";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= ", ".MAIN_DB_PREFIX."product as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= ", ".MAIN_DB_PREFIX."ticket as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
}
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
if ($force_filter_contact === false) {
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
$sql .= " AND a.fk_soc = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) {
$sql .= " AND a.fk_project = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
}
}
// Condition on actioncode
if (!empty($actioncode)) {
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($actioncode == 'AC_NON_AUTO') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND c.type = 'systemauto'";
} else {
if ($actioncode == 'AC_OTH') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_OTH_AUTO') {
$sql .= " AND c.type = 'systemauto'";
}
}
} else {
if ($actioncode == 'AC_NON_AUTO') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND c.type = 'systemauto'";
} else {
$sql .= " AND c.code = '".$db->escape($actioncode)."'";
}
}
}
if ($donetodo == 'todo') {
$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
} elseif ($donetodo == 'done') {
$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
}
if (is_array($filters) && $filters['search_agenda_label']) {
$sql .= natural_search('a.label', $filters['search_agenda_label']);
}
}
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
if (isModEnabled('mailing') && !empty($objcon->email)
&& (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) {
$langs->load("mails");
$sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
$sql2 .= ", null as fk_element, '' as elementtype, null as contact_id";
$sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
$sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql2 .= ", '' as lastname, '' as firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql2 .= ", '' as lastname, '' as firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql2 .= ", '' as ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql2 .= ", '' as ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql2 .= ", '' as ref";
}
$sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
$sql2 .= " AND mc.statut = 1";
$sql2 .= " AND u.rowid = m.fk_user_valid";
$sql2 .= " AND mc.fk_mailing=m.rowid";
}
if (!empty($sql) && !empty($sql2)) {
$sql = $sql." UNION ".$sql2;
} elseif (empty($sql) && !empty($sql2)) {
$sql = $sql2;
}
// TODO Add limit in nb of results
if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("function.lib::show_actions_messaging", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->type == 'action') {
$contactaction = new ActionComm($db);
$contactaction->id = $obj->id;
$result = $contactaction->fetchResources();
if ($result < 0) {
dol_print_error($db);
setEventMessage("actions.lib::show_actions_messaging Error fetch ressource", 'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
$tododone = 'todo';
}
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>$tododone,
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype,
// Type of event
'acode'=>$obj->acode,
'alabel'=>$obj->alabel,
'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
} else {
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>'done',
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'acode'=>$obj->acode,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo
);
}
$numaction++;
$i++;
}
} else {
dol_print_error($db);
}
}
// Set $out to show events
$out = '';
if (!isModEnabled('agenda')) {
$langs->loadLangs(array("admin", "errors"));
$out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning');
}
if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) {
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$formactions = new FormActions($db);
$actionstatic = new ActionComm($db);
$userstatic = new User($db);
$contactstatic = new Contact($db);
$userGetNomUrlCache = array();
$out .= '<div class="filters-container" >';
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
if ($objcon && get_class($objcon) == 'Contact' &&
(is_null($filterobj) || get_class($filterobj) == 'Societe')) {
$out .= '<input type="hidden" name="id" value="'.$objcon->id.'" />';
} else {
$out .= '<input type="hidden" name="id" value="'.$filterobj->id.'" />';
}
if ($filterobj && get_class($filterobj) == 'Societe') {
$out .= '<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
}
$out .= "\n";
$out .= '<div class="div-table-responsive-no-min">';
$out .= '<table class="noborder borderbottom centpercent">';
$out .= '<tr class="liste_titre">';
$out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n";
$out .= '<th class="liste_titre"><strong class="hideonsmartphone">'.$langs->trans("Search").' : </strong></th>';
if ($donetodo) {
$out .= '<th class="liste_titre"></th>';
}
$out .= '<th class="liste_titre">';
$out .= '<span class="fas fa-square inline-block fawidth30" style=" color: #ddd;" title="'.$langs->trans("ActionType").'"></span>';
//$out .= img_picto($langs->trans("Type"), 'type');
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1, 'minwidth200imp');
$out .= '</th>';
$out .= '<th class="liste_titre maxwidth100onsmartphone">';
$out .= '<input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'" placeholder="'.$langs->trans("Label").'">';
$out .= '</th>';
$out .= '<th class="liste_titre width50 middle">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
$out .= $searchpicto;
$out .= '</th>';
$out .= '</tr>';
$out .= '</table>';
$out .= '</form>';
$out .= '</div>';
$out .= "\n";
$out .= '<ul class="timeline">';
if ($donetodo) {
$tmp = '';
if (get_class($filterobj) == 'Societe') {
$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&socid='.$filterobj->id.'&status=done">';
}
$tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
$tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
$tmp .= ($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
//$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
if (get_class($filterobj) == 'Societe') {
$tmp .= '</a>';
}
$out .= getTitleFieldOfList($tmp);
}
//require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
//$caction=new CActionComm($db);
//$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
$actualCycleDate = false;
// Loop on each event to show it
foreach ($histo as $key => $value) {
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
$actionstatic->type_picto = $histo[$key]['apicto'];
$actionstatic->type_code = $histo[$key]['acode'];
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$histo[$key]['id'];
$tmpa = dol_getdate($histo[$key]['datestart'], false);
if ($actualCycleDate !== $tmpa['year'].'-'.$tmpa['yday']) {
$actualCycleDate = $tmpa['year'].'-'.$tmpa['yday'];
$out .= '<!-- timeline time label -->';
$out .= '<li class="time-label">';
$out .= '<span class="timeline-badge-date">';
$out .= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzuserrel', $langs);
$out .= '</span>';
$out .= '</li>';
$out .= '<!-- /.timeline-label -->';
}
$out .= '<!-- timeline item -->'."\n";
$out .= '<li class="timeline-code-'.strtolower($actionstatic->code).'">';
$out .= getTimelineIcon($actionstatic, $histo, $key);
$out .= '<div class="timeline-item">'."\n";
$out .= '<span class="timeline-header-action">';
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a class="timeline-btn" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$out .= $histo[$key]['id'];
$out .= '</a> ';
} else {
$out .= $actionstatic->getNomUrl(1, -1, 'valignmiddle').' ';
}
if (!empty($user->rights->agenda->allactions->create) ||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && !empty($user->rights->agenda->myactions->create))) {
$out .= '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/card.php?action=edit&token='.newToken().'&id='.$actionstatic->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>';
}
$out .= '</span>';
// Date
$out .= '<span class="time"><i class="fa fa-clock-o"></i> ';
$out .= dol_print_date($histo[$key]['datestart'], 'dayhour', 'tzuserrel');
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
$tmpa = dol_getdate($histo[$key]['datestart'], true);
$tmpb = dol_getdate($histo[$key]['dateend'], true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour', 'tzuserrel');
} else {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour', 'tzuserrel');
}
}
$late = 0;
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] == 0 && !$histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && !$histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($late) {
$out .= img_warning($langs->trans("Late")).' ';
}
$out .= "</span>\n";
// Ref
$out .= '<h3 class="timeline-header">';
// Author of event
$out .= '<span class="messaging-author">';
if ($histo[$key]['userid'] > 0) {
if (!isset($userGetNomUrlCache[$histo[$key]['userid']])) { // is in cache ?
$userstatic->fetch($histo[$key]['userid']);
$userGetNomUrlCache[$histo[$key]['userid']] = $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
$out .= $userGetNomUrlCache[$histo[$key]['userid']];
}
$out .= '</span>';
// Title
$out .= ' <span class="messaging-title">';
if ($actionstatic->code == 'TICKET_MSG') {
$out .= $langs->trans('TicketNewMessage');
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
} else {
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
$libelle = $histo[$key]['note'];
$actionstatic->id = $histo[$key]['id'];
$out .= dol_trunc($libelle, 120);
}
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
$out .= dol_trunc($libelle, 120);
}
}
$out .= '</span>';
$out .= '</h3>';
if (!empty($histo[$key]['message'])
&& $actionstatic->code != 'AC_TICKET_CREATE'
&& $actionstatic->code != 'AC_TICKET_MODIFY'
) {
$out .= '<div class="timeline-body">';
$out .= $histo[$key]['message'];
$out .= '</div>';
}
// Timeline footer
$footer = '';
// Contact for this action
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$contactList = '';
foreach ($histo[$key]['socpeopleassigned'] as $cid => $Tab) {
$contact = new Contact($db);
$result = $contact->fetch($cid);
if ($result < 0) {
dol_print_error($db, $contact->error);
}
if ($result > 0) {
$contactList .= !empty($contactList) ? ', ' : '';
$contactList .= $contact->getNomUrl(1);
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (!empty($contact->phone_pro)) {
$contactList .= '('.dol_print_phone($contact->phone_pro).')';
}
}
}
}
$footer .= $langs->trans('ActionOnContact').' : '.$contactList;
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
$contact = new Contact($db);
$result = $contact->fetch($histo[$key]['contact_id']);
if ($result < 0) {
dol_print_error($db, $contact->error);
}
if ($result > 0) {
$footer .= $contact->getNomUrl(1);
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (!empty($contact->phone_pro)) {
$footer .= '('.dol_print_phone($contact->phone_pro).')';
}
}
}
}
$documents = getActionCommEcmList($actionstatic);
if (!empty($documents)) {
$footer .= '<div class="timeline-documents-container">';
foreach ($documents as $doc) {
$footer .= '<span id="document_'.$doc->id.'" class="timeline-documents" ';
$footer .= ' data-id="'.$doc->id.'" ';
$footer .= ' data-path="'.$doc->filepath.'"';
$footer .= ' data-filename="'.dol_escape_htmltag($doc->filename).'" ';
$footer .= '>';
$filePath = DOL_DATA_ROOT.'/'.$doc->filepath.'/'.$doc->filename;
$mime = dol_mimetype($filePath);
$file = $actionstatic->id.'/'.$doc->filename;
$thumb = $actionstatic->id.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename, '.')).'_mini'.substr($doc->filename, strrpos($doc->filename, '.'));
$doclink = dol_buildpath('document.php', 1).'?modulepart=actions&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
$viewlink = dol_buildpath('viewimage.php', 1).'?modulepart=actions&file='.urlencode($thumb).'&entity='.$conf->entity;
$mimeAttr = ' mime="'.$mime.'" ';
$class = '';
if (in_array($mime, array('image/png', 'image/jpeg', 'application/pdf'))) {
$class .= ' documentpreview';
}
$footer .= '<a href="'.$doclink.'" class="btn-link '.$class.'" target="_blank" rel="noopener noreferrer" '.$mimeAttr.' >';
$footer .= img_mime($filePath).' '.$doc->filename;
$footer .= '</a>';
$footer .= '</span>';
}
$footer .= '</div>';
}
if (!empty($footer)) {
$out .= '<div class="timeline-footer">'.$footer.'</div>';
}
$out .= '</div>'."\n"; // end timeline-item
$out .= '</li>';
$out .= '<!-- END timeline item -->';
$i++;
}
$out .= "</ul>\n";
if (empty($histo)) {
$out .= '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
}
}
if ($noprint) {
return $out;
} else {
print $out;
}
}

View File

@ -311,7 +311,7 @@ function project_prepare_head(Project $project, $moreparam = '')
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id;
$head[$h][0] = DOL_URL_ROOT.'/projet/messaging.php?id='.$project->id;
$head[$h][1] = $langs->trans("Events");
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
$head[$h][1] .= '/';

View File

@ -268,719 +268,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '<div class="ticketlargemargin">';
}
/**
* Show html area with actions for ticket messaging.
* Note: Global parameter $param must be defined.
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
* @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object
* @param Contact $objcon Filter on object contact to filter events on a contact
* @param int $noprint Return string but does not output it
* @param string $actioncode Filter on actioncode
* @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
* @param array $filters Filter on other fields
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @return string|void Return html part or void if noprint is 1
*/
function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC')
{
global $user, $conf;
global $form;
global $param, $massactionbutton;
dol_include_once('/comm/action/class/actioncomm.class.php');
// Check parameters
if (!is_object($filterobj) && !is_object($objcon)) {
dol_print_error('', 'BadParameter');
}
$histo = array();
$numaction = 0;
$now = dol_now();
$sortfield_list = explode(',', $sortfield);
$sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent');
$sortfield_new_list = array();
foreach ($sortfield_list as $sortfield_value) {
$sortfield_new_list[] = $sortfield_label_list[trim($sortfield_value)];
}
$sortfield_new = implode(',', $sortfield_new_list);
if (isModEnabled('agenda')) {
// Search histo on actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
} else {
$sql = "SELECT a.id, a.label as label,";
}
$sql .= " a.datep as dp,";
$sql .= " a.note as message,";
$sql .= " a.datep2 as dp2,";
$sql .= " a.percent as percent, 'action' as type,";
$sql .= " a.fk_element, a.elementtype,";
$sql .= " a.fk_contact,";
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql .= ", sp.lastname, sp.firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= ", m.lastname, m.firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= ", o.ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", o.ref";
}
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
$force_filter_contact = false;
if (is_object($objcon) && $objcon->id > 0) {
$force_filter_contact = true;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
}
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er";
$sql .= " ON er.resource_type = 'dolresource'";
$sql .= " AND er.element_id = a.id";
$sql .= " AND er.resource_id = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= ", ".MAIN_DB_PREFIX."adherent as m";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= ", ".MAIN_DB_PREFIX."product as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= ", ".MAIN_DB_PREFIX."ticket as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= ", ".MAIN_DB_PREFIX."bom_bom as o";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= ", ".MAIN_DB_PREFIX."contrat as o";
}
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
if ($force_filter_contact === false) {
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
$sql .= " AND a.fk_soc = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) {
$sql .= " AND a.fk_project = ".((int) $filterobj->id);
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
} elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
if ($filterobj->id) {
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
}
}
// Condition on actioncode
if (!empty($actioncode)) {
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($actioncode == 'AC_NON_AUTO') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND c.type = 'systemauto'";
} else {
if ($actioncode == 'AC_OTH') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_OTH_AUTO') {
$sql .= " AND c.type = 'systemauto'";
}
}
} else {
if ($actioncode == 'AC_NON_AUTO') {
$sql .= " AND c.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND c.type = 'systemauto'";
} else {
$sql .= " AND c.code = '".$db->escape($actioncode)."'";
}
}
}
if ($donetodo == 'todo') {
$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
} elseif ($donetodo == 'done') {
$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
}
if (is_array($filters) && $filters['search_agenda_label']) {
$sql .= natural_search('a.label', $filters['search_agenda_label']);
}
}
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
if (isModEnabled('mailing') && !empty($objcon->email)
&& (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) {
$langs->load("mails");
$sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
$sql2 .= ", null as fk_element, '' as elementtype, null as contact_id";
$sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
$sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
$sql2 .= ", '' as lastname, '' as firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') {
$sql2 .= ", '' as lastname, '' as firstname";
} elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') {
$sql2 .= ", '' as ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Product') {
$sql2 .= ", '' as ref";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') {
$sql2 .= ", '' as ref";
}
$sql2 .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u";
$sql2 .= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email.
$sql2 .= " AND mc.statut = 1";
$sql2 .= " AND u.rowid = m.fk_user_valid";
$sql2 .= " AND mc.fk_mailing=m.rowid";
}
if (!empty($sql) && !empty($sql2)) {
$sql = $sql." UNION ".$sql2;
} elseif (empty($sql) && !empty($sql2)) {
$sql = $sql2;
}
// TODO Add limit in nb of results
if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too
$sql .= $db->order($sortfield_new, $sortorder);
dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj->type == 'action') {
$contactaction = new ActionComm($db);
$contactaction->id = $obj->id;
$result = $contactaction->fetchResources();
if ($result < 0) {
dol_print_error($db);
setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors');
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
$tododone = 'todo';
}
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>$tododone,
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo,
'contact_id'=>$obj->fk_contact,
'socpeopleassigned' => $contactaction->socpeopleassigned,
'lastname'=>$obj->lastname,
'firstname'=>$obj->firstname,
'fk_element'=>$obj->fk_element,
'elementtype'=>$obj->elementtype,
// Type of event
'acode'=>$obj->acode,
'alabel'=>$obj->alabel,
'libelle'=>$obj->alabel, // deprecated
'apicto'=>$obj->apicto
);
} else {
$histo[$numaction] = array(
'type'=>$obj->type,
'tododone'=>'done',
'id'=>$obj->id,
'datestart'=>$db->jdate($obj->dp),
'dateend'=>$db->jdate($obj->dp2),
'note'=>$obj->label,
'message'=>$obj->message,
'percent'=>$obj->percent,
'acode'=>$obj->acode,
'userid'=>$obj->user_id,
'login'=>$obj->user_login,
'userfirstname'=>$obj->user_firstname,
'userlastname'=>$obj->user_lastname,
'userphoto'=>$obj->user_photo
);
}
$numaction++;
$i++;
}
} else {
dol_print_error($db);
}
}
// Set $out to show events
$out = '';
if (!isModEnabled('agenda')) {
$langs->loadLangs(array("admin", "errors"));
$out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning');
}
if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) {
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$formactions = new FormActions($db);
$actionstatic = new ActionComm($db);
$userstatic = new User($db);
$contactstatic = new Contact($db);
$userGetNomUrlCache = array();
$out .= '<div class="filters-container" >';
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
if ($objcon && get_class($objcon) == 'Contact' &&
(is_null($filterobj) || get_class($filterobj) == 'Societe')) {
$out .= '<input type="hidden" name="id" value="'.$objcon->id.'" />';
} else {
$out .= '<input type="hidden" name="id" value="'.$filterobj->id.'" />';
}
if ($filterobj && get_class($filterobj) == 'Societe') {
$out .= '<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
}
$out .= "\n";
$out .= '<div class="div-table-responsive-no-min">';
$out .= '<table class="noborder borderbottom centpercent">';
$out .= '<tr class="liste_titre">';
$out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n";
$out .= '<th class="liste_titre"><strong class="hideonsmartphone">'.$langs->trans("Search").' : </strong></th>';
if ($donetodo) {
$out .= '<th class="liste_titre"></th>';
}
$out .= '<th class="liste_titre">';
$out .= '<span class="fas fa-square inline-block fawidth30" style=" color: #ddd;" title="'.$langs->trans("ActionType").'"></span>';
//$out .= img_picto($langs->trans("Type"), 'type');
$out .= $formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1, 0, 0, 1, 'minwidth200imp');
$out .= '</th>';
$out .= '<th class="liste_titre maxwidth100onsmartphone">';
$out .= '<input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="'.$filters['search_agenda_label'].'" placeholder="'.$langs->trans("Label").'">';
$out .= '</th>';
$out .= '<th class="liste_titre width50 middle">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
$out .= $searchpicto;
$out .= '</th>';
$out .= '</tr>';
$out .= '</table>';
$out .= '</form>';
$out .= '</div>';
$out .= "\n";
$out .= '<ul class="timeline">';
if ($donetodo) {
$tmp = '';
if (get_class($filterobj) == 'Societe') {
$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&socid='.$filterobj->id.'&status=done">';
}
$tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
$tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
$tmp .= ($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
//$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
if (get_class($filterobj) == 'Societe') {
$tmp .= '</a>';
}
$out .= getTitleFieldOfList($tmp);
}
//require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
//$caction=new CActionComm($db);
//$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
$actualCycleDate = false;
// Loop on each event to show it
foreach ($histo as $key => $value) {
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
$actionstatic->type_picto = $histo[$key]['apicto'];
$actionstatic->type_code = $histo[$key]['acode'];
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$histo[$key]['id'];
$tmpa = dol_getdate($histo[$key]['datestart'], false);
if ($actualCycleDate !== $tmpa['year'].'-'.$tmpa['yday']) {
$actualCycleDate = $tmpa['year'].'-'.$tmpa['yday'];
$out .= '<!-- timeline time label -->';
$out .= '<li class="time-label">';
$out .= '<span class="timeline-badge-date">';
$out .= dol_print_date($histo[$key]['datestart'], 'daytext', 'tzuserrel', $langs);
$out .= '</span>';
$out .= '</li>';
$out .= '<!-- /.timeline-label -->';
}
$out .= '<!-- timeline item -->'."\n";
$out .= '<li class="timeline-code-'.strtolower($actionstatic->code).'">';
$out .= getTicketTimelineIcon($actionstatic, $histo, $key);
$out .= '<div class="timeline-item">'."\n";
$out .= '<span class="timeline-header-action">';
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a class="timeline-btn" href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$out .= $histo[$key]['id'];
$out .= '</a> ';
} else {
$out .= $actionstatic->getNomUrl(1, -1, 'valignmiddle').' ';
}
if (!empty($user->rights->agenda->allactions->create) ||
(($actionstatic->authorid == $user->id || $actionstatic->userownerid == $user->id) && !empty($user->rights->agenda->myactions->create))) {
$out .= '<a class="timeline-btn" href="'.DOL_MAIN_URL_ROOT.'/comm/action/card.php?action=edit&token='.newToken().'&id='.$actionstatic->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$param).'"><i class="fa fa-pencil" title="'.$langs->trans("Modify").'" ></i></a>';
}
$out .= '</span>';
// Date
$out .= '<span class="time"><i class="fa fa-clock-o"></i> ';
$out .= dol_print_date($histo[$key]['datestart'], 'dayhour', 'tzuserrel');
if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) {
$tmpa = dol_getdate($histo[$key]['datestart'], true);
$tmpb = dol_getdate($histo[$key]['dateend'], true);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'hour', 'tzuserrel');
} else {
$out .= '-'.dol_print_date($histo[$key]['dateend'], 'dayhour', 'tzuserrel');
}
}
$late = 0;
if ($histo[$key]['percent'] == 0 && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] == 0 && !$histo[$key]['datestart'] && $histo[$key]['dateend'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && $histo[$key]['dateend'] && $histo[$key]['dateend'] < ($now - $delay_warning)) {
$late = 1;
}
if ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100 && !$histo[$key]['dateend'] && $histo[$key]['datestart'] && $histo[$key]['datestart'] < ($now - $delay_warning)) {
$late = 1;
}
if ($late) {
$out .= img_warning($langs->trans("Late")).' ';
}
$out .= "</span>\n";
// Ref
$out .= '<h3 class="timeline-header">';
// Author of event
$out .= '<span class="messaging-author">';
if ($histo[$key]['userid'] > 0) {
if (!isset($userGetNomUrlCache[$histo[$key]['userid']])) { // is in cache ?
$userstatic->fetch($histo[$key]['userid']);
$userGetNomUrlCache[$histo[$key]['userid']] = $userstatic->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
$out .= $userGetNomUrlCache[$histo[$key]['userid']];
}
$out .= '</span>';
// Title
$out .= ' <span class="messaging-title">';
if ($actionstatic->code == 'TICKET_MSG') {
$out .= $langs->trans('TicketNewMessage');
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
$out .= $langs->trans('TicketNewMessage').' <em>('.$langs->trans('Private').')</em>';
} else {
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'action') {
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
$libelle = $histo[$key]['note'];
$actionstatic->id = $histo[$key]['id'];
$out .= dol_trunc($libelle, 120);
}
if (isset($histo[$key]['type']) && $histo[$key]['type'] == 'mailing') {
$out .= '<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.img_object($langs->trans("ShowEMailing"), "email").' ';
$transcode = $langs->trans("Action".$histo[$key]['acode']);
$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : 'Send mass mailing');
$out .= dol_trunc($libelle, 120);
}
}
$out .= '</span>';
$out .= '</h3>';
if (!empty($histo[$key]['message'])
&& $actionstatic->code != 'AC_TICKET_CREATE'
&& $actionstatic->code != 'AC_TICKET_MODIFY'
) {
$out .= '<div class="timeline-body">';
$out .= $histo[$key]['message'];
$out .= '</div>';
}
// Timeline footer
$footer = '';
// Contact for this action
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$contactList = '';
foreach ($histo[$key]['socpeopleassigned'] as $cid => $Tab) {
$contact = new Contact($db);
$result = $contact->fetch($cid);
if ($result < 0) {
dol_print_error($db, $contact->error);
}
if ($result > 0) {
$contactList .= !empty($contactList) ? ', ' : '';
$contactList .= $contact->getNomUrl(1);
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (!empty($contact->phone_pro)) {
$contactList .= '('.dol_print_phone($contact->phone_pro).')';
}
}
}
}
$footer .= $langs->trans('ActionOnContact').' : '.$contactList;
} elseif (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) {
$contact = new Contact($db);
$result = $contact->fetch($histo[$key]['contact_id']);
if ($result < 0) {
dol_print_error($db, $contact->error);
}
if ($result > 0) {
$footer .= $contact->getNomUrl(1);
if (isset($histo[$key]['acode']) && $histo[$key]['acode'] == 'AC_TEL') {
if (!empty($contact->phone_pro)) {
$footer .= '('.dol_print_phone($contact->phone_pro).')';
}
}
}
}
$documents = getTicketActionCommEcmList($actionstatic);
if (!empty($documents)) {
$footer .= '<div class="timeline-documents-container">';
foreach ($documents as $doc) {
$footer .= '<span id="document_'.$doc->id.'" class="timeline-documents" ';
$footer .= ' data-id="'.$doc->id.'" ';
$footer .= ' data-path="'.$doc->filepath.'"';
$footer .= ' data-filename="'.dol_escape_htmltag($doc->filename).'" ';
$footer .= '>';
$filePath = DOL_DATA_ROOT.'/'.$doc->filepath.'/'.$doc->filename;
$mime = dol_mimetype($filePath);
$file = $actionstatic->id.'/'.$doc->filename;
$thumb = $actionstatic->id.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename, '.')).'_mini'.substr($doc->filename, strrpos($doc->filename, '.'));
$doclink = dol_buildpath('document.php', 1).'?modulepart=actions&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
$viewlink = dol_buildpath('viewimage.php', 1).'?modulepart=actions&file='.urlencode($thumb).'&entity='.$conf->entity;
$mimeAttr = ' mime="'.$mime.'" ';
$class = '';
if (in_array($mime, array('image/png', 'image/jpeg', 'application/pdf'))) {
$class .= ' documentpreview';
}
$footer .= '<a href="'.$doclink.'" class="btn-link '.$class.'" target="_blank" rel="noopener noreferrer" '.$mimeAttr.' >';
$footer .= img_mime($filePath).' '.$doc->filename;
$footer .= '</a>';
$footer .= '</span>';
}
$footer .= '</div>';
}
if (!empty($footer)) {
$out .= '<div class="timeline-footer">'.$footer.'</div>';
}
$out .= '</div>'."\n"; // end timeline-item
$out .= '</li>';
$out .= '<!-- END timeline item -->';
$i++;
}
$out .= "</ul>\n";
if (empty($histo)) {
$out .= '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
}
}
if ($noprint) {
return $out;
} else {
print $out;
}
}
/**
* Get timeline icon
* @param ActionComm $actionstatic actioncomm
* @param array $histo histo
* @param int $key key
* @return string
*/
function getTicketTimelineIcon($actionstatic, &$histo, $key)
{
global $conf, $langs;
$out = '<!-- timeline icon -->'."\n";
$iconClass = 'fa fa-comments';
$img_picto = '';
$colorClass = '';
$pictoTitle = '';
if ($histo[$key]['percent'] == -1) {
$colorClass = 'timeline-icon-not-applicble';
$pictoTitle = $langs->trans('StatusNotApplicable');
} elseif ($histo[$key]['percent'] == 0) {
$colorClass = 'timeline-icon-todo';
$pictoTitle = $langs->trans('StatusActionToDo').' (0%)';
} elseif ($histo[$key]['percent'] > 0 && $histo[$key]['percent'] < 100) {
$colorClass = 'timeline-icon-in-progress';
$pictoTitle = $langs->trans('StatusActionInProcess').' ('.$histo[$key]['percent'].'%)';
} elseif ($histo[$key]['percent'] >= 100) {
$colorClass = 'timeline-icon-done';
$pictoTitle = $langs->trans('StatusActionDone').' (100%)';
}
if ($actionstatic->code == 'AC_TICKET_CREATE') {
$iconClass = 'fa fa-ticket';
} elseif ($actionstatic->code == 'AC_TICKET_MODIFY') {
$iconClass = 'fa fa-pencilxxx';
} elseif ($actionstatic->code == 'TICKET_MSG') {
$iconClass = 'fa fa-comments';
} elseif ($actionstatic->code == 'TICKET_MSG_PRIVATE') {
$iconClass = 'fa fa-mask';
} elseif (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if ($actionstatic->type_picto) {
$img_picto = img_picto('', $actionstatic->type_picto);
} else {
if ($actionstatic->type_code == 'AC_RDV') {
$iconClass = 'fa fa-handshake';
} elseif ($actionstatic->type_code == 'AC_TEL') {
$iconClass = 'fa fa-phone';
} elseif ($actionstatic->type_code == 'AC_FAX') {
$iconClass = 'fa fa-fax';
} elseif ($actionstatic->type_code == 'AC_EMAIL') {
$iconClass = 'fa fa-envelope';
} elseif ($actionstatic->type_code == 'AC_INT') {
$iconClass = 'fa fa-shipping-fast';
} elseif ($actionstatic->type_code == 'AC_OTH_AUTO') {
$iconClass = 'fa fa-robot';
} elseif (!preg_match('/_AUTO/', $actionstatic->type_code)) {
$iconClass = 'fa fa-robot';
}
}
}
$out .= '<i class="'.$iconClass.' '.$colorClass.'" title="'.$pictoTitle.'">'.$img_picto.'</i>'."\n";
return $out;
}
/**
* getTicketActionCommEcmList
*
* @param ActionComm $object Object ActionComm
* @return array Array of documents in index table
*/
function getTicketActionCommEcmList($object)
{
global $conf, $db;
$documents = array();
$sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
$sql .= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
$sql .= " WHERE ecm.filepath = 'agenda/".((int) $object->id)."'";
//$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload
$sql .= ' ORDER BY ecm.position ASC';
$resql = $db->query($sql);
if ($resql) {
if ($db->num_rows($resql)) {
while ($obj = $db->fetch_object($resql)) {
$documents[$obj->id] = $obj;
}
}
}
return $documents;
}

View File

@ -157,7 +157,10 @@ function user_prepare_head(User $object)
if (empty($user->socid)) {
// Notes
$nbNote = 0;
if (!empty($object->note)) {
if (!empty($object->note_public)) {
$nbNote++;
}
if (!empty($object->note_private)) {
$nbNote++;
}
$head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id;

View File

@ -70,10 +70,9 @@ class modFckeditor extends DolibarrModules
// Constants
$this->const = array();
$this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for the fields descriptions of elements (except products/services)");
$this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for the fields description of products/services");
$this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings");
$this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities");
$this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature");
$this->const[2] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities");
$this->const[3] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature");
$this->const[4] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings");
$this->const[5] = array("FCKEDITOR_ENABLE_MAIL", "yesno", "1", "WYSIWIG for products details lines for all entities");
$this->const[6] = array("FCKEDITOR_SKIN", "string", "moono-lisa", "Skin by default for fckeditor");

View File

@ -96,11 +96,6 @@ if ($module == 'propal') {
}
//else dol_print_error('','Bad value '.$module.' for param module');
if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
$typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
} else {
$typeofdata = 'textarea:12:95%';
}
if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC)) {
$typeofdatapub = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
} else {

View File

@ -413,13 +413,14 @@ if ($nolinesbefore) {
$coldisplay++;
?>
<td class="nobottom linecoluttc right">
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (GETPOSTISSET("price_ttc") ? GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat right" value="<?php echo (GETPOSTISSET("price_ttc") ? GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
</td>
<?php
}
$coldisplay++;
?>
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1); ?>">
<td class="nobottom linecolqty right">
<input type="text" name="qty" id="qty" class="flat width40 right" value="<?php echo (GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1); ?>">
</td>
<?php
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -434,11 +435,12 @@ if ($nolinesbefore) {
}
$coldisplay++;
?>
<td class="nobottom nowrap linecoldiscount right"><input type="text" size="1" name="remise_percent" id="remise_percent" class="flat right" value="<?php echo (GETPOSTISSET("remise_percent") ? GETPOST("remise_percent", 'alpha', 2) : $remise_percent); ?>"><span class="hideonsmartphone">%</span></td>
<td class="nobottom nowrap linecoldiscount right"><input type="text" name="remise_percent" id="remise_percent" class="flat width40 right" value="<?php echo (GETPOSTISSET("remise_percent") ? GETPOST("remise_percent", 'alpha', 2) : ($remise_percent ? $remise_percent : '')); ?>"><span class="opacitymedium hideonsmartphone">%</span></td>
<?php
if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
$coldisplay++;
print '<td class="nobottom nowrap right"><input class="falt right" type="text" size="1" value="0" name="progress">%</td>';
print '<td class="nobottom nowrap right"><input class="falt right" type="text" size="1" value="" name="progress"><span class="opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
print '<td></td>';
}
@ -456,11 +458,11 @@ if ($nolinesbefore) {
</td>
<?php
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right" type="text" size="2" id="np_marginRate" name="np_marginRate" value="'.(GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", 'alpha', 2) : '').'"><span class="np_marginRate hideonsmartphone">%</span></td>';
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_marginRate" name="np_marginRate" value="'.(GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", 'alpha', 2) : '').'"><span class="np_marginRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right" type="text" size="2" id="np_markRate" name="np_markRate" value="'.(GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : '').'"><span class="np_markRate hideonsmartphone">%</span></td>';
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_markRate" name="np_markRate" value="'.(GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : '').'"><span class="np_markRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
}
@ -498,7 +500,6 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto
}
}
if (!empty($object->element) && $object->element == 'contrat') {
print $langs->trans("DateStartPlanned").' ';
print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct");
@ -521,8 +522,8 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto
?>
function prefill_service_dates()
{
$('#date_start').val("<?php echo dol_escape_js(dol_print_date($date_start_prefill, '%d/%m/%Y')); ?>").trigger('change');
$('#date_end').val("<?php echo dol_escape_js(dol_print_date($date_end_prefill, '%d/%m/%Y')); ?>").trigger('change');
$('#date_start').val("<?php echo dol_escape_js(dol_print_date($date_start_prefill, 'day')); ?>").trigger('change');
$('#date_end').val("<?php echo dol_escape_js(dol_print_date($date_end_prefill, 'day')); ?>").trigger('change');
return false; // Prevent default link behaviour (which is go to href URL)
}
@ -735,7 +736,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
// Get the HT price for the product and display it
console.log("Load unit price without tax and set it into #price_ht for product id="+$(this).val()+" socid=<?php print $object->socid; ?>");
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?> },
{ 'id': $(this).val(), 'socid': <?php print $object->socid; ?>, 'token': '<?php print currentToken(); ?>' },
function(data) {
console.log("objectline_create.tpl Load unit price end, we got value ht="+data.price_ht+" ttc="+data.price_ttc+" pricebasetype="+data.pricebasetype);
@ -875,7 +876,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice").'...'; ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice);

View File

@ -198,11 +198,15 @@ $coldisplay++;
?>
<td class="right linecolrefsupplier"><input id="fourn_ref" name="fourn_ref" class="flat minwidth50 maxwidth125 maxwidth125onsmartphone" value="<?php echo GETPOSTISSET('fourn_ref') ? GETPOST('fourn_ref') : ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
<?php
print '<input type="hidden" id="fournprice" name="fournprice" class="" value="'.$line->fk_fournprice.'">';
}
// VAT Rate
$coldisplay++;
if (!$situationinvoicelinewithparent) {
print '<td class="right">'.$form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).'</td>';
print '<td class="right">';
print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : ($line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : '')), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1);
print '</td>';
} else {
print '<td class="right"><input size="1" type="text" class="flat right" name="tva_tx" value="'.price($line->tva_tx).'" readonly />%</td>';
}
@ -266,24 +270,29 @@ $coldisplay++;
?>
<td class="nowraponall right linecoldiscount">
<?php $coldisplay++;
<?php
// Discount
$coldisplay++;
if (($line->info_bits & 2) != 2) {
print '<input size="1" type="text" class="flat right" name="remise_percent" id="remise_percent" value="'.(GETPOSTISSET('remise_percent') ? GETPOST('remise_percent') : $line->remise_percent).'"';
print '<input type="text" class="flat right width40" name="remise_percent" id="remise_percent" value="'.(GETPOSTISSET('remise_percent') ? GETPOST('remise_percent') : ($line->remise_percent ? $line->remise_percent : '')).'"';
if ($situationinvoicelinewithparent) {
print ' readonly';
}
print '>%';
print '><span class="hideonsmartphone opacitymedium">%</span>';
} else { ?>
&nbsp;
<?php } ?>
</td>
<?php
// Progession for situation invoices
if ($this->situation_cycle_ref) {
$coldisplay++;
print '<td class="nowrap right linecolcycleref"><input class="right" type="text" size="1" value="'.(GETPOSTISSET('progress') ? GETPOST('progress') : $line->situation_percent).'" name="progress">%</td>';
$coldisplay++;
print '<td></td>';
}
if (!empty($usemargins)) {
if (!empty($user->rights->margins->creer)) {
$coldisplay++;
@ -303,9 +312,9 @@ $coldisplay++;
$margin_rate = (GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", "alpha", 2) : (($line->pa_ht == 0) ? '' : price($line->marge_tx)));
// if credit note, dont allow to modify margin
if ($line->subprice < 0) {
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos">'.$margin_rate.'<span class="opacitymedium hideonsmartphone">%</span></td>';
} else {
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_marginRate" value="'.$margin_rate.'"><span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos"><input class="right maxwidth40" type="text" name="np_marginRate" value="'.$margin_rate.'"><span class="opacitymedium hideonsmartphone">%</span></td>';
}
$coldisplay++;
}
@ -313,9 +322,9 @@ $coldisplay++;
$mark_rate = (GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : price($line->marque_tx));
// if credit note, dont allow to modify margin
if ($line->subprice < 0) {
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos">'.$mark_rate.'<span class="opacitymedium hideonsmartphone">%</span></td>';
} else {
echo '<td class="right nowrap margininfos"><input class="right maxwidth75" type="text" name="np_markRate" value="'.$mark_rate.'"><span class="hideonsmartphone">%</span></td>';
echo '<td class="right nowrap margininfos"><input class="right maxwidth40" type="text" name="np_markRate" value="'.$mark_rate.'"><span class="opacitymedium hideonsmartphone">%</span></td>';
}
$coldisplay++;
}

View File

@ -224,6 +224,8 @@ if (empty($reshook)) {
$object->size_units = GETPOST('size_units', 'int');
$object->weight_units = GETPOST('weight_units', 'int');
$product = new Product($db);
// We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver
$classname = ucfirst($object->origin);
$objectsrc = new $classname($db);
@ -259,7 +261,17 @@ if (empty($reshook)) {
$stockLocation = "ent1".$i."_0";
$qty = "qtyl".$i;
if (isModEnabled('productbatch') && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number
$is_batch_or_serial=0;
if (!empty($objectsrc->lines[$i]->fk_product)) {
$resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product, '', '', '', 1, 1, 1);
if ($resultFetch < 0) {
setEventMessages($product->error, $product->errors, 'errors');
}
$is_batch_or_serial = $product->status_batch;
}
// If product need a batch or serial number
if (isModEnabled('productbatch') && $objectsrc->lines[$i]->product_tobatch) {
if (GETPOSTISSET($batch)) {
//shipment line with batch-enable product
$qty .= '_'.$j;
@ -274,6 +286,12 @@ if (empty($reshook)) {
//var_dump($sub_qty[$j]['q']);
//var_dump($sub_qty[$j]['id_batch']);
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
if ($is_batch_or_serial==2 && $sub_qty[$j]['q']>1) {
setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors');
$totalqty=0;
break 2;
}
$j++;
$batch = "batchl".$i."_".$j;
$qty = "qtyl".$i.'_'.$j;
@ -328,7 +346,6 @@ if (empty($reshook)) {
}
//var_dump($batch_line[2]);
if ($totalqty > 0 && !$error) { // There is at least one thing to ship and no error
for ($i = 0; $i < $num; $i++) {
$qty = "qtyl".$i;

View File

@ -433,7 +433,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
}
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
@ -656,7 +656,7 @@ if ($search_user > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if (!$search_all) {
@ -680,7 +680,7 @@ if (!$search_all) {
}
// Add GroupBy from hooks
$parameters = array('all' => $search_all, 'fieldstosearchall' => $fieldstosearchall);
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
} else {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@ -688,7 +688,7 @@ if (!$search_all) {
// Add HAVING from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
@ -860,7 +860,7 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
@ -950,7 +950,7 @@ if (isModEnabled('categorie')) {
$moreforfilter .= '</div>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$moreforfilter .= $hookmanager->resPrint;
} else {
@ -1174,7 +1174,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['f.datec']['checked'])) {
@ -1302,7 +1302,7 @@ if (!empty($arrayfields['multicurrency_rtp']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['f.datec']['checked'])) {
print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
@ -1725,7 +1725,7 @@ if ($num > 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
@ -1793,7 +1793,7 @@ if ($num == 0) {
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";

View File

@ -195,7 +195,8 @@ ALTER TABLE llx_bank_url ADD INDEX idx_bank_url_url_id (url_id);
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) NULL;
ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL;
ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer;
-- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer;
-- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer;
-- Rename const to hide public and private notes (fix allow notes const was used to hide)

View File

@ -28,7 +28,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
acces_type integer DEFAULT 0,
oauth_service varchar(128),
password varchar(128),
source_directory varchar(255) NOT NULL,
source_directory varchar(255) DEFAULT 'Inbox' NOT NULL,
target_directory varchar(255),
maxemailpercollect integer DEFAULT 100,
datelastresult datetime,

View File

@ -1747,8 +1747,8 @@ ActivateFCKeditor=Activate advanced editor for:
FCKeditorForNotePublic=WYSIWIG creation/edition of the field "public notes" of elements
FCKeditorForNotePrivate=WYSIWIG creation/edition of the field "private notes" of elements
FCKeditorForCompany=WYSIWIG creation/edition of the field description of elements (except products/services)
FCKeditorForProduct=WYSIWIG creation/edition of the field description of products/services
FCKeditorForProductDetails=WYSIWIG creation/edition of products details lines for all entities (proposals, orders, invoices, etc...). <span class="warning">Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files.</span>
FCKeditorForProductDetails=WYSIWIG creation/edition of products description or lines for objects (lines of proposals, orders, invoices, etc...).
FCKeditorForProductDetails2=Warning: Using this option for this case is seriously not recommended as it can create problems with special characters and page formatting when building PDF files.
FCKeditorForMailing= WYSIWIG creation/edition for mass eMailings (Tools->eMailing)
FCKeditorForUserSignature=WYSIWIG creation/edition of user signature
FCKeditorForMail=WYSIWIG creation/edition for all mail (except Tools->eMailing)

View File

@ -1747,7 +1747,8 @@ FCKeditorForNotePublic=Création/édition WYSIWIG du champ notes publiques des
FCKeditorForNotePrivate=Création/édition WYSIWIG du champ notes privées des éléments
FCKeditorForCompany=Création/édition WYSIWIG de la description des éléments (autre que produits/services)
FCKeditorForProduct=Création/édition WYSIWIG du champ description des produits/services
FCKeditorForProductDetails=Création/édition WYSIWYG des lignes de détails produits sur tous les éléments (commandes, propales, factures, etc...). <span class="warning">Attention: L'utilisation pour ce cas est fortement déconseillée car peut créer des problèmes dans la gestion de caractères et mise en page des fichiers PDF générés.</span>
FCKeditorForProductDetails=Création/édition WYSIWYG des lignes de détails produits sur tous les éléments (commandes, propales, factures, etc...).
FCKeditorForProductDetails2=Attention: L'utilisation pour ce cas est fortement déconseillée car peut créer des problèmes dans la gestion de caractères et mise en page des fichiers PDF générés.
FCKeditorForMailing= Création/édition WYSIWIG des emailings (Outils->Emailings)
FCKeditorForUserSignature=Création/édition WYSIWIG de la signature des utilisateurs
FCKeditorForMail=Création/édition WYSIWIG tous les emails (sauf Outils->Emailings)

View File

@ -1444,9 +1444,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Description (used in invoice, propal...)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%');
$doleditor->Create();
print "</td></tr>";
if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) {
@ -1620,7 +1619,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_8, '90%');
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%');
$doleditor->Create();
print "</td></tr>";
@ -2007,7 +2006,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
$doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%');
$doleditor->Create();
print "</td></tr>";
@ -2198,7 +2197,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
$doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4, '90%');
$doleditor->Create();
print "</td></tr>";

View File

@ -821,7 +821,7 @@ END;
print '<td>'.$langs->trans('ProductSupplierDescription').'</td>';
print '<td>';
$doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_4, '90%');
$doleditor = new DolEditor('supplier_description', $object->desc_supplier, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%');
$doleditor->Create();
print '</td>';

View File

@ -977,10 +977,9 @@ class MouvementStock extends CommonObject
// Separate originetype with "@" : left part is class name, right part is module name
$origin_type_array = explode('@', $origin_type);
$classname = ucfirst($origin_type_array[0]);
$modulename = empty($origin_type_array[1]) ? $classname : $origin_type_array[1];
$modulename = empty($origin_type_array[1]) ? strtolower($classname) : $origin_type_array[1];
$result = dol_include_once('/'.$modulename.'/class/'.strtolower($classname).'.class.php');
if ($result) {
$classname = ucfirst($classname);
$origin = new $classname($this->db);
}
}

View File

@ -265,12 +265,12 @@ if ($action == 'edit') {
print '<table class="border centpercent">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($object->multilangs[$key]["label"]).'"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) {
print '<tr><td class="tdtop">'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>';
$doleditor = new DolEditor("other-$key", $object->multilangs[$key]["other"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor("other-$key", $object->multilangs[$key]["other"], '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%');
$doleditor->Create();
}
print '</td></tr>';
@ -336,13 +336,13 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '</td></tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
// Other field (not used)
if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) {
print '<tr><td class="tdtop">'.$langs->trans('Other').' ('.$langs->trans("NotUsed").'</td><td>';
$doleditor = new DolEditor('other', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_PRODUCTDESC'), ROWS_3, '90%');
$doleditor = new DolEditor('other', '', '', 160, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
}

View File

@ -17,7 +17,7 @@
*/
/**
* \file htdocs/projet/info.php
* \file htdocs/projet/agenda.php
* \ingroup project
* \brief Page with events on project
*/
@ -166,18 +166,40 @@ if ($permok) {
}
//print '<div class="tabsAction">';
$morehtmlcenter = '';
if (isModEnabled('agenda')) {
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
//print '</div>';
if (!empty($object->id)) {
print '<br>';
//print '<div class="tabsAction">';
$morehtmlcenter = '';
// Show link to change view in message
$messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id;
$morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
// Show link to change view in agenda
$messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
$morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
// // Show link to send an email (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// // Show link to add a private message (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event
if (isModEnabled('agenda')) {
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
$param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage;

221
htdocs/projet/messaging.php Normal file
View File

@ -0,0 +1,221 @@
<?php
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/projet/messaging.php
* \ingroup project
* \brief Page with events on project
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->load("projects");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", "aZ09comma");
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) {
$sortfield = "a.datep,a.id";
}
if (!$sortorder) {
$sortorder = "DESC";
}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label = GETPOST('search_agenda_label');
$hookmanager->initHooks(array('projectcardinfo'));
// Security check
$id = GETPOST("id", 'int');
$socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, 'projet&project');
if (!$user->rights->projet->lire) {
accessforbidden();
}
/*
* Actions
*/
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
/*
* View
*/
$form = new Form($db);
$object = new Project($db);
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
$object->fetch_thirdparty();
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) {
$object->fetchComments();
}
$object->info($object->id);
}
$agenda = (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) ? '/'.$langs->trans("Agenda") : '';
$title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
}
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("", $title, $help_url);
$head = project_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Title
$morehtmlref .= $object->title;
// Thirdparty
if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (empty($user->rights->projet->all->lire)) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid IN (".$db->sanitize(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
dol_print_object_info($object, 1);
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
// Actions buttons
$out = '';
$permok = $user->rights->agenda->myactions->create;
if ($permok) {
$out .= '&projectid='.$object->id;
}
//print '</div>';
if (!empty($object->id)) {
print '<br>';
//print '<div class="tabsAction">';
$morehtmlcenter = '';
// Show link to change view in message
$messagingUrl = DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id;
$morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2);
// Show link to change view in agenda
$messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id;
$morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
// // Show link to send an email (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// // Show link to add a private message (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event
if (isModEnabled('agenda')) {
$addActionBtnRight = !empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create);
$morehtmlcenter .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight);
}
$param = '&id='.$object->id;
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage;
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
}
print_barre_liste($langs->trans("ActionsOnProject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlcenter, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
// End of page
llxFooter();
$db->close();

View File

@ -774,18 +774,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_4.'">'.$description.'</textarea>';
} else {
// WYSIWYG editor
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
$nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
}
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows);
print $doleditor->Create();
// WYSIWYG editor
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0);
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
$nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
}
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows);
print $doleditor->Create();
print '</td></tr>';

View File

@ -100,8 +100,11 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) {
$object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2);
$object->label = GETPOST("label", "alphanohtml");
if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $object->description = GETPOST('description', "alphanohtml");
else $object->description = GETPOST('description', "restricthtml");
if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
$object->description = GETPOST('description', "alphanohtml");
} else {
$object->description = GETPOST('description', "restricthtml");
}
$object->fk_task_parent = $task_parent;
$object->planned_workload = $planned_workload;
$object->date_start = dol_mktime(GETPOST('dateohour', 'int'), GETPOST('dateomin', 'int'), 0, GETPOST('dateomonth', 'int'), GETPOST('dateoday', 'int'), GETPOST('dateoyear', 'int'));
@ -491,18 +494,14 @@ if ($id > 0 || !empty($ref)) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>';
if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_4.'">'.$object->description.'</textarea>';
} else {
// WYSIWYG editor
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
$nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
}
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows);
print $doleditor->Create();
// WYSIWYG editor
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0);
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
$nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
}
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows);
print $doleditor->Create();
print '</td></tr>';
print '<tr><td>'.$langs->trans("Budget").'</td>';

View File

@ -160,10 +160,26 @@ if ($socid > 0) {
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog');
}
$newcardbutton = '';
$morehtmlright = '';
$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
// // Show link to send an email (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// // Show link to add a private message (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
@ -178,8 +194,8 @@ if ($socid > 0) {
$param .= '&limit='.urlencode($limit);
}
print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
// print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();

View File

@ -0,0 +1,211 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/societe/messaging.php
* \ingroup societe
* \brief Page of third party events
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label = GETPOST('search_agenda_label');
// Security check
$socid = GETPOST('socid', 'int');
if ($user->socid) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'societe', $socid, '&societe');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('agendathirdparty'));
/*
* Actions
*/
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
if ($socid > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$object = new Societe($db);
$result = $object->fetch($socid);
$title = $langs->trans("Agenda");
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
$title = $object->name." - ".$title;
}
llxHeader('', $title);
if (isModEnabled('notification')) {
$langs->load("mails");
}
$head = societe_prepare_head($object);
print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company');
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
$object->info($socid);
dol_print_object_info($object, 1);
print '</div>';
print dol_get_fiche_end();
// Actions buttons
$objthirdparty = $object;
$objcon = new stdClass();
$out = '';
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') {
$out .= '&amp;originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&amp;socid='.$objthirdparty->id : '').'&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : ''));
}
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;percentage=-1';
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog');
}
$morehtmlright = '';
$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 2);
$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
// // Show link to send an email (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus);
// // Show link to add a private message (if read and not closed)
// $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage";
// $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle';
// $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
if (isModEnabled('agenda')) {
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
print '<br>';
$param = '&socid='.urlencode($socid);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
// print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
}
// End of page
llxFooter();
$db->close();

View File

@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config )
[
['Maximize'],
['Find'],
['Image'],
['Source']
];
};

View File

@ -1583,6 +1583,7 @@ table[summary="list_of_modules"] .fa-cog {
.widthauto { width: auto; }
.width20 { width: 20px; }
.width25 { width: 25px; }
.width40 { width: 40px; }
.width50 { width: 50px; }
.width75 { width: 75px; }
.width100 { width: 100px; }
@ -5617,7 +5618,9 @@ a.cke_dialog_ui_button
.cke_dialog_ui_hbox_first {
vertical-align: middle !important;
}
.cke_combo_text {
width: 40px !important;
}
/*
.cke_editable
{

View File

@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config )
[
['Maximize'],
['Find'],
['Image'],
['Source']
];
};

View File

@ -1677,6 +1677,7 @@ tr.nobottom td {
.widthauto { width: auto; }
.width20 { width: 20px; }
.width25 { width: 25px; }
.width40 { width: 40px; }
.width50 { width: 50px; }
.width75 { width: 75px; }
.width100 { width: 100px; }
@ -5460,6 +5461,9 @@ a.cke_dialog_ui_button
{
vertical-align: bottom !important;
}
.cke_combo_text {
width: 40px !important;
}
/*
.cke_editable
{

View File

@ -126,6 +126,8 @@ $permissiontoadd = $user->rights->ticket->write;
$actionobject = new ActionsTicket($db);
$upload_dir = $conf->ticket->dir_output;
$now = dol_now();
@ -682,7 +684,6 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Actions to build doc
$upload_dir = $conf->ticket->dir_output;
$permissiontoadd = $user->rights->ticket->write;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
//var_dump($action);exit;
@ -1555,7 +1556,7 @@ if ($action == 'create' || $action == 'presend') {
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
if ($action != 'presend' && $action != 'presend_addmessage' && $action != 'add_message') {

View File

@ -181,36 +181,6 @@ class Tickets extends DolibarrApi
$this->ticket->messages = $messages;
}
// History
$history = array();
$this->ticket->loadCacheLogsTicket();
if (is_array($this->ticket->cache_logs_ticket) && count($this->ticket->cache_logs_ticket) > 0) {
$num = count($this->ticket->cache_logs_ticket);
$i = 0;
$user_action = new User($this->db);
while ($i < $num) {
$userstring = '';
if ($this->ticket->cache_logs_ticket[$i]['fk_user_create'] > 0) {
$user_action->fetch($this->ticket->cache_logs_ticket[$i]['fk_user_create']);
$userstring = dolGetFirstLastname($user_action->firstname, $user_action->lastname);
}
// Now define messages
$history[] = array(
'id' => $this->ticket->cache_logs_ticket[$i]['id'],
'fk_user_author' => $this->ticket->cache_msgs_ticket[$i]['fk_user_author'],
'fk_user_action' => $this->ticket->cache_logs_ticket[$i]['fk_user_create'],
'fk_user_action_string' => $userstring,
'message' => $this->ticket->cache_logs_ticket[$i]['message'],
'datec' => $this->ticket->cache_logs_ticket[$i]['datec'],
);
$i++;
}
$this->ticket->history = $history;
}
if (!DolibarrApi::_checkAccessToResource('ticket', $this->ticket->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}

View File

@ -1580,144 +1580,6 @@ class Ticket extends CommonObject
}
}
/**
* Send notification of changes by email
*
* @param User $user User that create
* @param string $message Log message
* @return int <0 if KO, >0 if OK (number of emails sent)
*/
private function sendLogByEmail($user, $message)
{
global $conf, $langs;
$nb_sent = 0;
$langs->load('ticket');
// Retrieve email of all contacts (internal and external)
$contacts = $this->listeContact(-1, 'internal');
$contacts = array_merge($contacts, $this->listeContact(-1, 'external'));
/* If origin_email and no socid, we add email to the list * */
if (!empty($this->origin_email) && empty($this->fk_soc)) {
$array_ext = array(array('firstname' => '', 'lastname' => '', 'email' => $this->origin_email, 'libelle' => $langs->transnoentities('TicketEmailOriginIssuer'), 'socid' => "-1"));
$contacts = array_merge($contacts, $array_ext);
}
if (!empty($this->fk_soc)) {
$this->fetch_thirdparty($this->fk_soc);
$array_company = array(array('firstname' => '', 'lastname' => $this->client->name, 'email' => $this->client->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->client->id));
$contacts = array_merge($contacts, $array_company);
}
// foreach contact send email with notification message
if (count($contacts) > 0) {
foreach ($contacts as $key => $info_sendto) {
$tmpmessage = '';
$subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNotificationEmailSubject', $this->track_id);
$tmpmessage .= $langs->transnoentities('TicketNotificationEmailBody', $this->track_id)."\n\n";
$tmpmessage .= $langs->transnoentities('Title').' : '.$this->subject."\n";
$recipient_name = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1');
$recipient = (!empty($recipient_name) ? $recipient_name : $info_sendto['email']).' ('.strtolower($info_sendto['libelle']).')';
$tmpmessage .= $langs->transnoentities('TicketNotificationRecipient').' : '.$recipient."\n";
$tmpmessage .= "\n";
$tmpmessage .= '* '.$langs->transnoentities('TicketNotificationLogMessage').' *'."\n";
$tmpmessage .= dol_html_entity_decode($message, ENT_QUOTES | ENT_HTML5)."\n";
if ($info_sendto['source'] == 'internal') {
$url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$this->track_id;
$tmpmessage .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : <a href="'.$url_internal_ticket.'">'.$this->track_id.'</a>'."\n";
} else {
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$this->track_id;
$tmpmessage .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$this->track_id.'</a>'."\n";
}
$tmpmessage .= "\n";
$tmpmessage .= $langs->transnoentities('TicketEmailPleaseDoNotReplyToThisEmail')."\n";
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
$replyto = $from;
// Init to avoid errors
$filepath = array();
$filename = array();
$mimetype = array();
$tmpmessage = dol_nl2br($tmpmessage);
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$sendtocc = '';
$deliveryreceipt = 0;
$mailfile = new CMailFile($subject, $info_sendto['email'], $from, $tmpmessage, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0);
if ($mailfile->error || !empty($mailfile->errors)) {
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
} else {
$result = $mailfile->sendfile();
if ($result > 0) {
$nb_sent++;
}
}
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO;
}
}
setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs');
}
return $nb_sent;
}
/**
* Charge la liste des actions sur le ticket
*
* @return int Number of lines loaded, 0 if already loaded, <0 if KO
*/
public function loadCacheLogsTicket()
{
global $langs;
if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) {
return 0;
}
// Cache deja charge
// TODO Read the table llx_actioncomm
/*
$sql = "SELECT rowid, fk_user_create, datec, message";
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs";
$sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'";
$sql .= " ORDER BY datec DESC";
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
$this->cache_logs_ticket[$i]['id'] = $obj->rowid;
$this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create;
$this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
$this->cache_logs_ticket[$i]['message'] = $obj->message;
$i++;
}
return $num;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR);
return -1;
}*/
return 0;
}
/**
* Add message into database
*
@ -2869,9 +2731,11 @@ class Ticket extends CommonObject
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
$upload_dir_tmp = $conf->user->dir_output."/".$user->id.'/temp';
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$trackid = "tic".$this->id;
$mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, '', 'ticket');
$mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, '', 'ticket', '', $upload_dir_tmp);
if ($mailfile->error) {
setEventMessages($mailfile->error, null, 'errors');
} else {

View File

@ -258,7 +258,7 @@ if (!empty($object->id)) {
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
show_ticket_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
// End of page

View File

@ -276,8 +276,8 @@ if (empty($reshook)) {
$object->job = GETPOST("job", 'alphanohtml');
$object->signature = GETPOST("signature", 'restricthtml');
$object->accountancy_code = GETPOST("accountancy_code", 'alphanohtml');
$object->note = GETPOST("note", 'restricthtml');
$object->note_private = GETPOST("note", 'restricthtml');
$object->note_public = GETPOST("note_public", 'restricthtml');
$object->note_private = GETPOST("note_private", 'restricthtml');
$object->ldap_sid = GETPOST("ldap_sid", 'alphanohtml');
$object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", 'int') : 0;
$object->fk_user_expense_validator = GETPOST("fk_user_expense_validator", 'int') > 0 ? GETPOST("fk_user_expense_validator", 'int') : 0;
@ -1205,15 +1205,6 @@ if ($action == 'create' || $action == 'adduserldap') {
$parameters = array();
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
// Note
print '<tr><td class="tdtop">';
print $langs->trans("Note");
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note', GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : '', '', 120, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE'), ROWS_3, '90%');
$doleditor->Create();
print "</td></tr>\n";
// Signature
print '<tr><td class="tdtop">'.$langs->trans("Signature").'</td>';
print '<td class="wordbreak">';
@ -1222,6 +1213,23 @@ if ($action == 'create' || $action == 'adduserldap') {
print $doleditor->Create(1);
print '</td></tr>';
// Note private
print '<tr><td class="tdtop">';
print $langs->trans("NotePublic");
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note_public', GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC'), ROWS_3, '90%');
$doleditor->Create();
print "</td></tr>\n";
// Note private
print '<tr><td class="tdtop">';
print $langs->trans("NotePrivate");
print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('note_private', GETPOSTISSET('note_private') ? GETPOST('note_private', 'restricthtml') : '', '', 100, 'dolibarr_notes', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_3, '90%');
$doleditor->Create();
print "</td></tr>\n";
print '</table><hr><table class="border centpercent">';