NEW Better filtering of automatic/manually inserted events.
This commit is contained in:
parent
341e014a3d
commit
7a94cfc994
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,7 +28,7 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
@ -370,6 +370,7 @@ print '</td></tr>'."\n";
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
@ -384,7 +385,7 @@ print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right" class="nowrap">'."\n";
|
||||
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1);
|
||||
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_FILTER_STATUS
|
||||
@ -393,7 +394,7 @@ print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2);
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
|
||||
@ -1113,15 +1113,26 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
$result='';
|
||||
|
||||
// Set label of typ
|
||||
$labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
||||
}
|
||||
|
||||
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
if (! empty($label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label;
|
||||
if (! empty($labeltype))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype;
|
||||
if (! empty($this->location))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
@ -1129,11 +1140,11 @@ class ActionComm extends CommonObject
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
||||
|
||||
if (empty($notooltip) && $user->rights->propal->lire)
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowSupplierProposal");
|
||||
$label=$langs->trans("ShowAction");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
@ -1166,13 +1177,13 @@ class ActionComm extends CommonObject
|
||||
if ($withpicto == 2)
|
||||
{
|
||||
$libelle=$label;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code);
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$labeltype;
|
||||
$libelleshort='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:''));
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=$labeltype;
|
||||
if ($maxlength < 0) $libelleshort=$this->ref;
|
||||
else $libelleshort=dol_trunc($libelle,$maxlength);
|
||||
}
|
||||
|
||||
@ -105,9 +105,9 @@ class CActionComm
|
||||
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
|
||||
* @param string $idorcode 'id' or 'code'
|
||||
* @param string $excludetype Type to exclude ('system' or 'systemauto')
|
||||
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
|
||||
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
|
||||
* @param string $morefilter Add more SQL filter
|
||||
* @return mixed Array of all event types if OK, <0 if KO
|
||||
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
|
||||
*/
|
||||
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='')
|
||||
{
|
||||
@ -123,7 +123,7 @@ class CActionComm
|
||||
if ($active != '') $sql.=" AND active=".$active;
|
||||
if (! empty($excludetype)) $sql.=" AND type <> '".$excludetype."'";
|
||||
if ($morefilter) $sql.=" AND ".$morefilter;
|
||||
$sql.= " ORDER BY module, position";
|
||||
$sql.= " ORDER BY module, position, type";
|
||||
|
||||
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -140,7 +140,7 @@ class CActionComm
|
||||
$qualified=1;
|
||||
|
||||
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
|
||||
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
if ($qualified && $onlyautoornot > 0 && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
|
||||
if ($qualified && $obj->module)
|
||||
{
|
||||
@ -155,12 +155,19 @@ class CActionComm
|
||||
if ($qualified)
|
||||
{
|
||||
$code=$obj->code;
|
||||
if ($onlyautoornot && $code == 'AC_OTH') $code='AC_MANUAL';
|
||||
if ($onlyautoornot && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
||||
if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL';
|
||||
if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
||||
$transcode=$langs->trans("Action".$code);
|
||||
$repid[$obj->id] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
$repcode[$obj->code] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
if ($onlyautoornot && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
||||
$label = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
if ($onlyautoornot == -1 && ! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/auto/i', $code))
|
||||
{
|
||||
$label=' '.$label;
|
||||
$repid[-99]=$langs->trans("ActionAC_MANUAL");
|
||||
$repcode['AC_NON_AUTO']=$langs->trans("ActionAC_MANUAL");
|
||||
}
|
||||
$repid[$obj->id] = $label;
|
||||
$repcode[$obj->code] = $label;
|
||||
if ($onlyautoornot > 0 && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -450,7 +450,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -194,7 +194,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND c.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
@ -402,6 +424,7 @@ if ($resql)
|
||||
{
|
||||
if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto);
|
||||
else {
|
||||
if ($actionstatic->type_code == 'AC_RDV') print img_picto('', 'object_group').' ';
|
||||
if ($actionstatic->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' ';
|
||||
if ($actionstatic->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' ';
|
||||
if ($actionstatic->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' ';
|
||||
|
||||
@ -365,7 +365,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -96,7 +96,6 @@ 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));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
||||
if ($dateselect > 0)
|
||||
{
|
||||
@ -373,7 +372,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -250,13 +250,13 @@ class FormActions
|
||||
* @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too.
|
||||
* @param string $htmlname Name of select field
|
||||
* @param string $excludetype A type to exclude ('systemauto', 'system', '')
|
||||
* @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
|
||||
* @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
|
||||
* @param int $hideinfohelp 1=Do not show info help, 0=Show, -1=Show+Add info to tell how to set default value
|
||||
* @param int $multiselect 1=Allow multiselect of action type
|
||||
* @param int $nooutput 1=No output
|
||||
* @return string
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode',$excludetype='',$onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0)
|
||||
function select_type_actions($selected='', $htmlname='actioncode', $excludetype='', $onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0)
|
||||
{
|
||||
global $langs,$user,$form,$conf;
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
|
||||
{
|
||||
$multiselect=(!empty($conf->global->AGENDA_USE_EVENT_TYPE));
|
||||
}
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), 0, $multiselect);
|
||||
print $formactions->select_type_actions($actioncode, "actioncode", $excludetype, (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1), 0, $multiselect);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1002,7 +1002,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if (get_class($filterobj) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if (get_class($filterobj) == 'Adherent' && $filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
if (!empty($actioncode)) $sql.= " AND c.code='".$actioncode."' ";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else $sql.= " AND c.code = '".$db->escape($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']);
|
||||
@ -1160,7 +1179,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
$out.='<td><input type="text" name="search_agenda_label" value="'.$filters['search_agenda_label'].'"></td>';
|
||||
$out.='<td></td>';
|
||||
$out.='<td>';
|
||||
$out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0, 0, 0, 1);
|
||||
$out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1);
|
||||
$out.='</td>';
|
||||
$out.='<td></td>';
|
||||
$out.='<td></td>';
|
||||
@ -1235,8 +1254,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
|
||||
if ($histo[$key]['acode'] == 'AC_FAX') $out.=img_picto('', 'object_phoning_fax').' ';
|
||||
if ($histo[$key]['acode'] == 'AC_EMAIL') $out.=img_picto('', 'object_email').' ';
|
||||
}
|
||||
$out.=$actionstatic->type;
|
||||
}
|
||||
else {
|
||||
$typelabel = $actionstatic->type;
|
||||
if ($histo[$key]['acode'] != 'AC_OTH_AUTO') $typelabel = $langs->trans("ActionAC_MANUAL");
|
||||
$out.=$typelabel;
|
||||
}
|
||||
$out.=$actionstatic->type;
|
||||
$out.='</td>';
|
||||
|
||||
// Title of event
|
||||
|
||||
@ -62,7 +62,7 @@ ActionAC_SHIP=Send shipping by mail
|
||||
ActionAC_SUP_ORD=Send supplier order by mail
|
||||
ActionAC_SUP_INV=Send supplier invoice by mail
|
||||
ActionAC_OTH=Other
|
||||
ActionAC_OTH_AUTO=Other (automatically inserted events)
|
||||
ActionAC_OTH_AUTO=Automatically inserted events
|
||||
ActionAC_MANUAL=Manually inserted events
|
||||
ActionAC_AUTO=Automatically inserted events
|
||||
Stats=Sales statistics
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("projects");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
$socid = GETPOST('socid','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
if (GETPOST('actioncode','array'))
|
||||
{
|
||||
$actioncode=GETPOST('actioncode','array',3);
|
||||
@ -73,16 +78,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$object = new Project($db);
|
||||
|
||||
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
|
||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
llxHeader("",$title,$help_url);
|
||||
|
||||
$object = new Project($db);
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$object->info($id);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch($id, $ref);
|
||||
$object->fetch_thirdparty();
|
||||
$object->info($object->id);
|
||||
}
|
||||
|
||||
$head = project_prepare_head($object);
|
||||
|
||||
@ -141,7 +149,7 @@ if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user