Add a line of filter in list of events related to thirdparty or projects

This commit is contained in:
Laurent Destailleur 2016-10-18 00:02:18 +02:00
parent b952df32bc
commit c1bf7c52f4
4 changed files with 118 additions and 105 deletions

View File

@ -203,7 +203,6 @@ dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action');
* Documents models for supplier orders * Documents models for supplier orders
*/ */
print load_fiche_titre($langs->trans("AgendaModelModule"),'','');
// Define array def of models // Define array def of models
$def = array(); $def = array();
@ -230,21 +229,25 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '<table class="noborder" width="100%">'."\n"; if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
print '</tr>'."\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{ {
print load_fiche_titre($langs->trans("AgendaModelModule"),'','');
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
print '<td>'.$langs->trans("Description").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Status").'</td>'."\n";
print '<td align="center" width="60">'.$langs->trans("Default").'</td>'."\n";
print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
print '</tr>'."\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/action/doc/"); $dir = dol_buildpath($reldir."core/modules/action/doc/");
if (is_dir($dir)) if (is_dir($dir))
@ -331,8 +334,9 @@ foreach ($dirmodels as $reldir)
closedir($handle); closedir($handle);
} }
} }
}
print '</table><br>';
} }
print '</table><br>';
$var=true; $var=true;

View File

@ -952,15 +952,16 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @param Conf $conf Object conf * @param Conf $conf Object conf
* @param Translate $langs Object langs * @param Translate $langs Object langs
* @param DoliDB $db Object db * @param DoliDB $db Object db
* @param Adherent|Societe $filterobj Object third party or member * @param Adherent|Societe|Project $filterobj Object third party or member or project
* @param Contact $objcon Object contact * @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it * @param int $noprint Return string but does not output it
* @param string $actioncode Filter on actioncode * @param string $actioncode Filter on actioncode
* @param string $donetodo Filter on avent 'done' or 'todo' or ''=nofilter. * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter.
* @param array $filters Filter on other fields
* @return mixed Return html part or void if noprint is 1 * @return mixed Return html part or void if noprint is 1
* TODO change function to be able to list event linked to an object. * TODO change function to be able to list event linked to an object.
*/ */
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done') function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array())
{ {
global $bc,$user,$conf; global $bc,$user,$conf;
global $form; global $form;
@ -1000,6 +1001,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (!empty($actioncode)) $sql.= " AND c.code='".$actioncode."' "; if (!empty($actioncode)) $sql.= " AND c.code='".$actioncode."' ";
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; if ($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']);
$sql.= " ORDER BY a.datep DESC, a.id DESC"; $sql.= " ORDER BY a.datep DESC, a.id DESC";
dol_syslog("company.lib::show_actions_done", LOG_DEBUG); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
@ -1144,7 +1146,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.='<td></td>'; $out.='<td></td>';
} }
$out.='<td></td>'; $out.='<td></td>';
$out.='<td></td>'; $out.='<td><input type="text" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out.='<td></td>'; $out.='<td></td>';
$out.='<td>'; $out.='<td>';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
@ -1216,11 +1218,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
} }
$out.="</td>\n"; $out.="</td>\n";
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.='<td>'; $out.='<td>';
$out.=$actionstatic->type; $out.=$actionstatic->type;
$out.='</td>'; $out.='</td>';
}
// Title of event // Title of event
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>'; //$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';

View File

@ -38,6 +38,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));
} }
$search_agenda_label=GETPOST('search_agenda_label');
// Security check // Security check
$socid=0; $socid=0;
@ -61,6 +62,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{ {
$actioncode=''; $actioncode='';
$search_agenda_label='';
} }
@ -163,7 +165,9 @@ if (!empty($object->id))
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// List of all actions // List of all actions
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, ''); $filters=array();
$filters['search_agenda_label']=$search_agenda_label;
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
} }

View File

@ -43,6 +43,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));
} }
$search_agenda_label=GETPOST('search_agenda_label');
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
@ -65,6 +66,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{ {
$actioncode=''; $actioncode='';
$search_agenda_label='';
} }
@ -189,7 +191,9 @@ if ($socid)
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// List of all actions // List of all actions
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, ''); $filters=array();
$filters['search_agenda_label']=$search_agenda_label;
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
} }
} }