2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Laurent Destailleur
2021-03-04 15:57:03 +01:00
parent 98eb0fc969
commit dcff298c5f
3 changed files with 87 additions and 79 deletions

View File

@@ -4029,7 +4029,7 @@ function img_searchclear($titlealt = 'default', $other = '')
* @param string $text Text info * @param string $text Text info
* @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto * @param integer $infoonimgalt Info is shown only on alt of star picto, otherwise it is show on output after the star picto
* @param int $nodiv No div * @param int $nodiv No div
* @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error','xxx'=Other * @param string $admin '1'=Info for admin users. '0'=Info for standard users (change only the look), 'error', 'warning', 'xxx'=Other
* @param string $morecss More CSS ('', 'warning', 'error') * @param string $morecss More CSS ('', 'warning', 'error')
* @param string $textfordropdown Show a text to click to dropdown the info box. * @param string $textfordropdown Show a text to click to dropdown the info box.
* @return string String with info text * @return string String with info text

View File

@@ -280,12 +280,10 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
// Check parameters // Check parameters
if (!is_object($filterobj) && !is_object($objcon)) dol_print_error('', 'BadParameter'); if (!is_object($filterobj) && !is_object($objcon)) dol_print_error('', 'BadParameter');
$out = '';
$histo = array(); $histo = array();
$numaction = 0; $numaction = 0;
$now = dol_now(); $now = dol_now();
// Open DSI -- Fix order by -- Begin
$sortfield_list = explode(',', $sortfield); $sortfield_list = explode(',', $sortfield);
$sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent'); $sortfield_label_list = array('a.id' => 'id', 'a.datep' => 'dp', 'a.percent' => 'percent');
$sortfield_new_list = array(); $sortfield_new_list = array();
@@ -294,9 +292,8 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
} }
$sortfield_new = implode(',', $sortfield_new_list); $sortfield_new = implode(',', $sortfield_new_list);
if (!empty($conf->agenda->enabled)) if (!empty($conf->agenda->enabled)) {
{ // Search histo on actioncomm
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) { if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,"; $sql = "SELECT DISTINCT a.id, a.label as label,";
} else { } else {
@@ -443,85 +440,95 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
$sql = $sql2; $sql = $sql2;
} }
//TODO Add limit in nb of results // TODO Add limit in nb of results
$sql .= $db->order($sortfield_new, $sortorder); 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("company.lib::show_actions_done", LOG_DEBUG); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->type == 'action') { if ($obj->type == 'action') {
$contactaction = new ActionComm($db); $contactaction = new ActionComm($db);
$contactaction->id = $obj->id; $contactaction->id = $obj->id;
$result = $contactaction->fetchResources(); $result = $contactaction->fetchResources();
if ($result < 0) { if ($result < 0) {
dol_print_error($db); dol_print_error($db);
setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors'); setEventMessage("company.lib::show_actions_done 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
);
} }
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; $numaction++;
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; $i++;
$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
);
} }
} else {
$numaction++; dol_print_error($db);
$i++;
} }
} else { }
dol_print_error($db);
// Set $out to sow events
$out = '';
if (empty($conf->agenda->enabled)) {
$langs->loadLangs(array("admin", "errors"));
$out = info_admin($langs->trans("WarningModuleXDisabledSoYouMayMissEventHere", $langs->transnoentitiesnoconv("Module2400Name")), 0, 0, 'warning');
} }
if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) { if (!empty($conf->agenda->enabled) || (!empty($conf->mailing->enabled) && !empty($objcon->email))) {

View File

@@ -287,4 +287,5 @@ WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were re
WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into ECM database index table WarningFailedToAddFileIntoDatabaseIndex=Warning, failed to add file entry into ECM database index table
WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on. WarningTheHiddenOptionIsOn=Warning, the hidden option <b>%s</b> is on.
WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list WarningCreateSubAccounts=Warning, you can't create directly a sub account, you must create a third party or an user and assign them an accounting code to find them in this list
WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection. WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connection.
WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here.