diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cc3c697e032..fcdb643a006 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -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); } diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 5e1db1233b8..33c93704b80 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -226,7 +226,7 @@ if ($action == 'edit') { print ''; print ''; print ''; print ''; @@ -289,7 +289,7 @@ if ($action == 'create' && $user->rights->adherent->configurer) { print ''; print ''; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index eeeb5035e16..f43ddb281bd 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -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 ''."\n"; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 8aecdde63ea..f0f40b4401b 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -267,7 +267,7 @@ if ($action == 'edit') { // Desc $desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']); print ''; @@ -327,7 +327,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bd573539df3..0d560d741ce 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -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 .= ''; } $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 '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $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 '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $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 '
'.img_object("", $picto[$const]).''.$langs->trans($desc).''; + print $langs->trans($desc); + if ($const == 'DETAILS') { + print '
'.$langs->trans("FCKeditorForProductDetails2").''; + } + print '
'; $value = (isset($conf->global->$constante) ? $conf->global->$constante : 0); if ($value == 0) { @@ -185,6 +190,7 @@ if (empty($conf->use_javascript_ajax)) { print '
'."\n"; print ''; + print ''; // Skins show_skin(null, 1); @@ -219,7 +225,7 @@ if (empty($conf->use_javascript_ajax)) { print $conf->global->FCKEDITOR_TEST; print ''; } - print $form->buttonsSaveCancel("Save", ''); + print $form->buttonsSaveCancel("Save", '', null, 0, 'reposition'); print '
'; print '
'."\n"; diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 84186e4e226..05938e27d49 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -419,7 +419,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print '
'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").''; print ''; 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 ''; @@ -431,7 +431,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print '
'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ''; 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 ''; diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 7f04c6d1005..c94e464a762 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -247,7 +247,7 @@ if ($user->rights->categorie->creer) { // Description print '
'.$langs->trans("Description").''; 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 '
'.$langs->trans('Description').''; - $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 '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $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 '
'."\n"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 349ee1b0b6c..455420ce90a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -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 .= ''; } $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 ''."\n"; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index c53117a6821..1f4fc60397e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -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'])) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9b92e9e018e..b5b9687686b 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -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 .= ''; } $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 ''."\n"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e8267f85d58..c1b97e65e98 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -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 ''; diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b89d5bf6cb0..4e2cd2873b6 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -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 { diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 6138664db2d..df8e51f348f 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -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); diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index edaf088e949..53a20d6dadd 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -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 diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index daff55c7615..0a1f5f16d6d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6299,7 +6299,7 @@ class Form } if (!$options_only) { - $return .= ''; } $selectedfound = false; @@ -6346,6 +6346,7 @@ class Form if (!$options_only) { $return .= ''; + //$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; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 216644876ba..0e5e6ff9e7c 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -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 ''; 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 ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 86a64084532..46a61e60a61 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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 = ''."\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 .= ''.$img_picto.''."\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 .= '
'; + $out .= '
'; + $out .= ''; + + if ($objcon && get_class($objcon) == 'Contact' && + (is_null($filterobj) || get_class($filterobj) == 'Societe')) { + $out .= ''; + } else { + $out .= ''; + } + if ($filterobj && get_class($filterobj) == 'Societe') { + $out .= ''; + } + + $out .= "\n"; + + $out .= '
'; + $out .= ''; + + $out .= ''; + + $out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n"; + + $out .= ''; + if ($donetodo) { + $out .= ''; + } + $out .= ''; + $out .= ''; + + $out .= ''; + $out .= ''; + + + $out .= '
'.$langs->trans("Search").' : '; + $out .= ''; + //$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 .= ''; + $out .= ''; + $out .= ''; + $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); + $out .= $searchpicto; + $out .= '
'; + + $out .= ''; + $out .= '
'; + + $out .= "\n"; + + $out .= '\n"; + + if (empty($histo)) { + $out .= ''.$langs->trans("NoRecordFound").''; + } + } + + if ($noprint) { + return $out; + } else { + print $out; + } +} diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a7cd6520abb..d427f87189a 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -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] .= '/'; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 42fbc9786cb..5d0d691228e 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -268,719 +268,3 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - - - -/** - * 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 .= '
'; - $out .= '
'; - $out .= ''; - - if ($objcon && get_class($objcon) == 'Contact' && - (is_null($filterobj) || get_class($filterobj) == 'Societe')) { - $out .= ''; - } else { - $out .= ''; - } - if ($filterobj && get_class($filterobj) == 'Societe') { - $out .= ''; - } - - $out .= "\n"; - - $out .= '
'; - $out .= ''; - - $out .= ''; - - $out .= getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', '', $param, '', $sortfield, $sortorder, '')."\n"; - - $out .= ''; - if ($donetodo) { - $out .= ''; - } - $out .= ''; - $out .= ''; - - $out .= ''; - $out .= ''; - - - $out .= '
'.$langs->trans("Search").' : '; - $out .= ''; - //$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 .= ''; - $out .= ''; - $out .= ''; - $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); - $out .= $searchpicto; - $out .= '
'; - - $out .= ''; - $out .= '
'; - - $out .= "\n"; - - $out .= '\n"; - - if (empty($histo)) { - $out .= ''.$langs->trans("NoRecordFound").''; - } - } - - 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 = ''."\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 .= ''.$img_picto.''."\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; -} diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 868a5af0d51..273e7285273 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -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; diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 8c30d8a0a51..fa3a66c37cc 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -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"); diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 9a9c5866023..a81c95251f4 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -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 { diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 4ec5fcc02c6..381683cf62c 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -413,13 +413,14 @@ if ($nolinesbefore) { $coldisplay++; ?> - "> + "> - "> + + "> global->PRODUCT_USE_UNITS)) { @@ -434,11 +435,12 @@ if ($nolinesbefore) { } $coldisplay++; ?> - ">% + + ">% situation_cycle_ref) && $this->situation_cycle_ref) { $coldisplay++; - print '%'; + print '%'; $coldisplay++; print ''; } @@ -456,11 +458,11 @@ if ($nolinesbefore) { global->DISPLAY_MARGIN_RATES)) { - echo '%'; + echo '%'; $coldisplay++; } if (!empty($conf->global->DISPLAY_MARK_RATES)) { - echo '%'; + echo '%'; $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("").trigger('change'); - $('#date_end').val("").trigger('change'); + $('#date_start').val("").trigger('change'); + $('#date_end').val("").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=socid; ?>"); $.post('/product/ajax/products.php?action=fetch', - { 'id': $(this).val(), 'socid': socid; ?> }, + { 'id': $(this).val(), 'socid': socid; ?>, 'token': '' }, 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 += ''; }); - options += ''; + options += ''; console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index c8188c82bb8..8c786e7a041 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -198,11 +198,15 @@ $coldisplay++; ?> fk_fournprice.'">'; } + // VAT Rate $coldisplay++; if (!$situationinvoicelinewithparent) { - 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 ''; + 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 ''; } else { print '%'; } @@ -266,24 +270,29 @@ $coldisplay++; ?> - info_bits & 2) != 2) { - print '%'; + print '>%'; } else { ?>   + situation_cycle_ref) { $coldisplay++; print '%'; $coldisplay++; print ''; } + 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 ''.$margin_rate.'%'; + echo ''.$margin_rate.'%'; } else { - echo '%'; + echo '%'; } $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 ''.$mark_rate.'%'; + echo ''.$mark_rate.'%'; } else { - echo '%'; + echo '%'; } $coldisplay++; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f002dc8fe27..ab8c4a28cbc 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -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; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 10df6a29137..1d7149cdb10 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -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 .= '
'; } $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 "\n"; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index d98840379a9..24ac0e37ff5 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -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) diff --git a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql index f13fff71a6f..4119e7aac08 100644 --- a/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql +++ b/htdocs/install/mysql/tables/llx_emailcollector_emailcollector.sql @@ -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, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e8f8f5bac6d..90ca6c15362 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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...). 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. +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) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 3f45fc1643d..8edc331780b 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -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...). 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. +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) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 7c51da5d02a..c1be61741bb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1444,9 +1444,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Description (used in invoice, propal...) print ''.$langs->trans("Description").''; - $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 ""; if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { @@ -1620,7 +1619,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("NoteNotVisibleOnBill").''; // 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 ""; @@ -2007,7 +2006,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("Description").''; // 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 ""; @@ -2198,7 +2197,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { print ''.$langs->trans("NoteNotVisibleOnBill").''; - $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 ""; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 034fa97f86f..2ccdc7409f3 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -821,7 +821,7 @@ END; print ''.$langs->trans('ProductSupplierDescription').''; print ''; - $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 ''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 31e66796a48..282f09e276e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -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); } } diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 3f536b6761a..ba4dc956d08 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -265,12 +265,12 @@ if ($action == 'edit') { print ''; print ''; print ''; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { print ''; @@ -336,13 +336,13 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; // Other field (not used) if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { print ''; } diff --git a/htdocs/projet/info.php b/htdocs/projet/agenda.php similarity index 75% rename from htdocs/projet/info.php rename to htdocs/projet/agenda.php index e6aaca355e1..a3c120d0a23 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/agenda.php @@ -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 '
'; -$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 '
'; if (!empty($object->id)) { print '
'; + //print '
'; + $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; diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php new file mode 100644 index 00000000000..7fe5b4a0b9d --- /dev/null +++ b/htdocs/projet/messaging.php @@ -0,0 +1,221 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * + * 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 . + */ + +/** + * \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ó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 = ''.$langs->trans("BackToList").''; + +$morehtmlref = '
'; +// Title +$morehtmlref .= $object->title; +// Thirdparty +if (!empty($object->thirdparty->id) && $object->thirdparty->id > 0) { + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'project'); +} +$morehtmlref .= '
'; + +// 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 '
'; +print '
'; + +dol_print_object_info($object, 1); + +print '
'; + +print '
'; + +print dol_get_fiche_end(); + + +// Actions buttons + +$out = ''; +$permok = $user->rights->agenda->myactions->create; +if ($permok) { + $out .= '&projectid='.$object->id; +} + + + +//print '
'; + +if (!empty($object->id)) { + print '
'; + + //print '
'; + $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(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 18a75449f24..951406b4275 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -774,18 +774,14 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print '
'; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 331b29acb96..8b19c8c0519 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -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 ''; print ''; print ''; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 550d8ca772d..9e6c10a0ccd 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -160,10 +160,26 @@ if ($socid > 0) { $out .= '&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(); diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php new file mode 100644 index 00000000000..c73d6ffe0b1 --- /dev/null +++ b/htdocs/societe/messaging.php @@ -0,0 +1,211 @@ + + * Copyright (C) 2005 Brice Davoleau + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2006-2019 Laurent Destailleur + * Copyright (C) 2007 Patrick Raguin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2015 Marcos García + * + * 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 . + */ + +/** + * \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 = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + + print '
'; + + print '
'; + + $object->info($socid); + dol_print_object_info($object, 1); + + print '
'; + + 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 .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); + } + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&percentage=-1'; + $out .= '&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 '
'; + + $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(); diff --git a/htdocs/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index d2a87a4a4d8..6dce53be431 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize'], ['Find'], + ['Image'], ['Source'] ]; }; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 05f00488123..f2cea00230d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -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 { diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index e463e6db9a3..c7e10f9a123 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -100,6 +100,7 @@ CKEDITOR.editorConfig = function( config ) [ ['Maximize'], ['Find'], + ['Image'], ['Source'] ]; }; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index df1bd11dc4f..002166968cd 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -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 { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1290a9a9a9b..20cee1a2cfa 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -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') { diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 35e01a74f0d..e7930569bdd 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -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); } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4a03098b57c..3a6adeb6c20 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -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').' : '.$this->track_id.''."\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').' : '.$this->track_id.''."\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 { diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index f1fd631234b..bd06bd32e94 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -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 diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a539dad3505..905be457810 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -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 '
\n"; - // Signature print ''; print ''; + // Note private + print '\n"; + + // Note private + print '\n"; print '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $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 '
'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')'; - $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 '
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $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 '
'.$langs->trans('Other').' ('.$langs->trans("NotUsed").''; - $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 '
'.$langs->trans("Description").''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } 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 '
'.$langs->trans("Description").''; - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { - print ''; - } 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 '
'.$langs->trans("Budget").'
'; - print $langs->trans("Note"); - print ''; - 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 "
'.$langs->trans("Signature").''; @@ -1222,6 +1213,23 @@ if ($action == 'create' || $action == 'adduserldap') { print $doleditor->Create(1); print '
'; + print $langs->trans("NotePublic"); + print ''; + 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 "
'; + print $langs->trans("NotePrivate"); + print ''; + 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 "

';