Dolibarrize module ticket

This commit is contained in:
Laurent Destailleur 2018-03-22 10:46:42 +01:00
parent 3b55049895
commit 6e52c896f2
4 changed files with 44 additions and 37 deletions

View File

@ -32,10 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$langs->load("users"); $langs->loadLangs(array("users","companies","agenda","commercial"));
$langs->load("companies");
$langs->load("agenda");
$langs->load("commercial");
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("resourceid","int");
@ -57,6 +54,7 @@ else
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$search_id=GETPOST('search_id','alpha');
$search_title=GETPOST('search_title','alpha'); $search_title=GETPOST('search_title','alpha');
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int')); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
@ -170,7 +168,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
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 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=''; //$actioncode='';
$search_title=''; $search_id='';
$search_title='';
$datestart=''; $datestart='';
$dateend=''; $dateend='';
$status=''; $status='';
@ -199,24 +198,25 @@ llxHeader('',$langs->trans("Agenda"),$help_url);
$listofextcals=array(); $listofextcals=array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($actioncode != '') { if ($actioncode != '') {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; foreach($actioncode as $str_action) $param.="&actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".$actioncode; } else $param.="&actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($resourceid > 0) $param.="&resourceid=".urlencode($resourceid);
if ($status != '' && $status > -1) $param.="&status=".$status; if ($status != '' && $status > -1) $param.="&status=".urlencode($status);
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&filtert=".urlencode($filtert);
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".urlencode($socid);
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid; if ($pid) $param.="&projectid=".urlencode($pid);
if ($type) $param.="&type=".$type; if ($type) $param.="&type=".urlencode($type);
if ($usergroup) $param.="&usergroup=".$usergroup; if ($usergroup) $param.="&usergroup=".urlencode($usergroup);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_title != '') $param.='&search_title='.$search_title; if ($search_id != '') $param.='&search_title='.urlencode($search_id);
if ($search_title != '') $param.='&search_title='.urlencode($search_title);
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int'); if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
if (GETPOST('datestartmonth','int')) $param.='&datestartmonth='.GETPOST('datestartmonth','int'); if (GETPOST('datestartmonth','int')) $param.='&datestartmonth='.GETPOST('datestartmonth','int');
if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestartyear','int'); if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestartyear','int');
@ -293,6 +293,7 @@ if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // R
if ($status == '100') { $sql.= " AND a.percent = 100"; } if ($status == '100') { $sql.= " AND a.percent = 100"; }
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
if ($search_id) $sql.=natural_search("a.id", $search_id, 1);
if ($search_title) $sql.=natural_search("a.label", $search_title); if ($search_title) $sql.=natural_search("a.label", $search_title);
// We must filter on assignement table // We must filter on assignement table
if ($filtert > 0 || $usergroup > 0) if ($filtert > 0 || $usergroup > 0)
@ -421,7 +422,7 @@ if ($resql)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['a.id']['checked'])) print '<td class="liste_titre"></td>'; if (! empty($arrayfields['a.id']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
if (! empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>'; if (! empty($arrayfields['owner']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>'; if (! empty($arrayfields['c.libelle']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>'; if (! empty($arrayfields['a.label']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth75" name="search_title" value="'.$search_title.'"></td>';
@ -492,7 +493,6 @@ if ($resql)
$caction=new CActionComm($db); $caction=new CActionComm($db);
$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1); $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
$var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -1530,10 +1530,17 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); $out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
$out.='</tr>'; $out.='</tr>';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
$caction=new CActionComm($db);
$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
foreach ($histo as $key=>$value) foreach ($histo as $key=>$value)
{ {
$actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo
$actionstatic->type_picto=$histo[$key]['apicto'];
$actionstatic->type_code=$histo[$key]['acode'];
$out.='<tr class="oddeven">'; $out.='<tr class="oddeven">';
// Done or todo // Done or todo
@ -1564,26 +1571,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.='<td>'; $out.='<td>';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
if ($histo[$key]['apicto']) $out.=img_picto('', $histo[$key]['apicto']); if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto);
else { else {
if ($histo[$key]['acode'] == 'AC_TEL') $out.=img_picto('', 'object_phoning').' '; if ($actionstatic->type_code == 'AC_RDV') $out.= img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' ';
if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' '; elseif ($actionstatic->type_code == 'AC_TEL') $out.= img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' ';
if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' '; elseif ($actionstatic->type_code == 'AC_FAX') $out.= img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_EMAIL') $out.= img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright').' ';
elseif ($actionstatic->type_code == 'AC_INT') $out.= img_picto('', 'object_intervention', '', false, 0, 0, '', 'paddingright').' ';
elseif (! preg_match('/_AUTO/', $actionstatic->type_code)) $out.= img_picto('', 'object_action', '', false, 0, 0, '', 'paddingright').' ';
} }
$out.=$actionstatic->type;
}
else {
$typelabel = $actionstatic->type;
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
$out.=$typelabel;
} }
$labeltype=$actionstatic->type_code;
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) $labeltype='AC_OTH';
if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype];
$out.= dol_trunc($labeltype,28);
$out.='</td>'; $out.='</td>';
// Title // Title
$out.='<td>'; $out.='<td>';
if (isset($histo[$key]['type']) && $histo[$key]['type']=='action') if (isset($histo[$key]['type']) && $histo[$key]['type']=='action')
{ {
$actionstatic->type_code=$histo[$key]['acode'];
$transcode=$langs->trans("Action".$histo[$key]['acode']); $transcode=$langs->trans("Action".$histo[$key]['acode']);
$libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:$histo[$key]['alabel']); $libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:$histo[$key]['alabel']);
//$actionstatic->libelle=$libelle; //$actionstatic->libelle=$libelle;
@ -1635,7 +1642,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$propalstatic->type=$histo[$key]['ftype']; $propalstatic->type=$histo[$key]['ftype'];
$out.=$propalstatic->getNomUrl(1); $out.=$propalstatic->getNomUrl(1);
} else { } else {
$out.= $langs->trans("ProposalDeleted"); //$out.= '<span class="opacitymedium">'.$langs->trans("ProposalDeleted").'</span>';
} }
} }
elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled)) elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled))
@ -1646,7 +1653,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$orderstatic->type=$histo[$key]['ftype']; $orderstatic->type=$histo[$key]['ftype'];
$out.=$orderstatic->getNomUrl(1); $out.=$orderstatic->getNomUrl(1);
} else { } else {
$out.= $langs->trans("OrderDeleted"); //$out.= '<span class="opacitymedium">'.$langs->trans("OrderDeleted").'<span>';
} }
} }
elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled)) elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled))
@ -1657,7 +1664,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$facturestatic->type=$histo[$key]['ftype']; $facturestatic->type=$histo[$key]['ftype'];
$out.=$facturestatic->getNomUrl(1,'compta'); $out.=$facturestatic->getNomUrl(1,'compta');
} else { } else {
$out.= $langs->trans("InvoiceDeleted"); //$out.= '<span class="opacitymedium">'.$langs->trans("InvoiceDeleted").'</span>';
} }
} }
else $out.='&nbsp;'; else $out.='&nbsp;';

View File

@ -104,7 +104,7 @@ function ticketsup_prepare_head($object)
// History // History
$head[$h][0] = DOL_URL_ROOT.'/ticketsup/history.php?track_id=' . $object->track_id; $head[$h][0] = DOL_URL_ROOT.'/ticketsup/history.php?track_id=' . $object->track_id;
$head[$h][1] = $langs->trans('TicketHistory'); $head[$h][1] = $langs->trans('Events');
$head[$h][2] = 'tabTicketLogs'; $head[$h][2] = 'tabTicketLogs';
$h++; $h++;

View File

@ -545,7 +545,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
} }
if (! empty($conf->global->TICKETSUP_SHOW_CONTACT_ON_MAIN_TAB)) if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png');