Skip to content
Snippets Groups Projects
Commit c1bf7c52 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

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

parent b952df32
No related branches found
No related tags found
No related merge requests found
......@@ -203,7 +203,6 @@ dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action');
* Documents models for supplier orders
*/
print load_fiche_titre($langs->trans("AgendaModelModule"),'','');
// Define array def of models
$def = array();
......@@ -230,109 +229,114 @@ else
dol_print_error($db);
}
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)
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$dir = dol_buildpath($reldir."core/modules/action/doc/");
if (is_dir($dir))
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)
{
$handle=opendir($dir);
if (is_resource($handle))
$dir = dol_buildpath($reldir."core/modules/action/doc/");
if (is_dir($dir))
{
while (($file = readdir($handle))!==false)
$handle=opendir($dir);
if (is_resource($handle))
{
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
while (($file = readdir($handle))!==false)
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));
$var=!$var;
print "<tr ".$bc[$var].">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
$module = new $classname($db,$specimenthirdparty);
if (method_exists($module,'info'))
print $module->info($langs);
else
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'switch_on');
}
print "</td>";
}
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));
$var=!$var;
print "<tr ".$bc[$var].">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";
print "<td>\n";
require_once $dir.$file;
$module = new $classname($db,$specimenthirdparty);
if (method_exists($module,'info'))
print $module->info($langs);
else
print $module->description;
print "</td>\n";
// Active
if (in_array($name, $def))
{
print '<td align="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
}
else
{
print img_picto($langs->trans("Enabled"),'switch_on');
}
print "</td>";
}
else
{
print '<td align="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"),'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
print '</td>';
print "</tr>\n";
}
}
closedir($handle);
}
closedir($handle);
}
}
print '</table><br>';
}
print '</table><br>';
$var=true;
......
......@@ -952,15 +952,16 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @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 int $noprint Return string but does not output it
* @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
* 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 $form;
......@@ -1000,6 +1001,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
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 == '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";
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><input type="text" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
$out.='<td></td>';
$out.='<td>';
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";
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.='<td>';
$out.=$actionstatic->type;
$out.='</td>';
}
$out.='<td>';
$out.=$actionstatic->type;
$out.='</td>';
// Title of event
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
......
......@@ -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));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check
$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
{
$actioncode='';
$search_agenda_label='';
}
......@@ -163,7 +165,9 @@ if (!empty($object->id))
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// 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);
}
......
......@@ -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));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check
$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
{
$actioncode='';
$search_agenda_label='';
}
......@@ -189,7 +191,9 @@ if ($socid)
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// 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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment