NEW filter actiontype on thirdparty tab

This commit is contained in:
Alexis Algoud 2016-09-08 10:26:38 +02:00
parent 7bce5a354f
commit 74d495c192
2 changed files with 35 additions and 8 deletions

View File

@ -902,9 +902,10 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
* @param Adherent|Societe $object Object third party or member
* @param Contact $objcon Object contact
* @param int $noprint Return string but does not output it
* @param int $actioncode Filter on actioncode
* @return mixed Return html part or void if noprint is 1
*/
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0,$actioncode='')
{
global $bc,$user,$conf;
@ -966,6 +967,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
}
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
if (! empty($objcon->id)) $sql.= " AND a.fk_contact = ".$objcon->id;
if (! empty($actioncode)) $sql.= " AND c.code='".$actioncode."' ";
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
$sql.= " ORDER BY a.datep DESC, a.id DESC";
@ -1085,7 +1087,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
* @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,$object,$objcon='',$noprint=0)
function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0,$actioncode='')
{
global $bc,$user,$conf;
@ -1120,6 +1122,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
if (!empty($actioncode)) $sql.= " AND c.code='".$actioncode."' ";
$sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$sql.= " ORDER BY a.datep DESC, a.id DESC";

View File

@ -162,15 +162,39 @@ if ($socid)
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
print '<br>';
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
$actioncode = '';
if(!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
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)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
print '<input type="hidden" name="socid" value="'.$objthirdparty->id.'" />';
$formactions->select_type_actions($actioncode, "actioncode", '', 0, 0, 0);
print '<input type="submit" class="button" name="refresh" value="' . $langs->trans("Refresh") . '">';
print '</form><br />' ;
}
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
// List of todo actions
show_actions_todo($conf,$langs,$db,$object,null,0,1);
show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
show_actions_done($conf,$langs,$db,$object);
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
}
}