diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php
index a4bf134e3ce..d7d86c50543 100644
--- a/htdocs/bom/bom_agenda.php
+++ b/htdocs/bom/bom_agenda.php
@@ -196,7 +196,7 @@ if ($object->id > 0)
$objthirdparty=$object;
$objcon=new stdClass();
- $out='';
+ $out='&origin='.$object->element.'&originid='.$object->id;
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
@@ -227,9 +227,9 @@ if ($object->id > 0)
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
- $param='&socid='.$socid;
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+ $param='&id='.$object->id.'&socid='.$socid;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
//print load_fiche_titre($langs->trans("ActionsOnBom"), '', '');
@@ -239,7 +239,7 @@ if ($object->id > 0)
$filters['search_agenda_label']=$search_agenda_label;
// TODO Replace this with same code than into list.php
- //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
+ show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
}
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 9381b186582..8e8d21c51b1 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -238,8 +238,8 @@ if ($action == 'add')
$object->fulldayevent = (! empty($fulldayevent)?1:0);
$object->location = GETPOST("location");
$object->label = trim(GETPOST('label'));
- $object->fk_element = GETPOST("fk_element");
- $object->elementtype = GETPOST("elementtype");
+ $object->fk_element = GETPOST("fk_element", 'int');
+ $object->elementtype = GETPOST("elementtype", 'alpha');
if (! GETPOST('label'))
{
if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs))
@@ -349,7 +349,7 @@ if ($action == 'add')
{
$db->begin();
- // On cree l'action
+ // Creation of action/event
$idaction=$object->create($user);
if ($idaction > 0)
@@ -857,7 +857,7 @@ if ($action == 'create')
print '
';
- print '';
+ print '';
if ($conf->societe->enabled)
{
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 99344b12dc1..c3b9bcec2cf 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1188,7 +1188,8 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
/**
- * Show html area with actions (done or not, ignore the name of function)
+ * Show html area with actions (done or not, ignore the name of function).
+ * Note: Global parameter $param must be defined.
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
@@ -1208,7 +1209,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
global $user, $conf;
global $form;
- global $param;
+ global $param, $massactionbutton;
dol_include_once('/comm/action/class/actioncomm.class.php');
@@ -1251,6 +1252,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
@@ -1273,6 +1275,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", ".MAIN_DB_PREFIX."bom_bom as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if ($force_filter_contact === false) {
@@ -1298,6 +1301,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
+ elseif (is_object($filterobj) && get_class($filterobj) == 'BOM')
+ {
+ $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
+ if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ }
}
// Condition on actioncode
diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php
index 1f693282e5f..183781469ef 100644
--- a/htdocs/modulebuilder/template/myobject_agenda.php
+++ b/htdocs/modulebuilder/template/myobject_agenda.php
@@ -209,7 +209,7 @@ if ($object->id > 0)
$objthirdparty=$object;
$objcon=new stdClass();
- $out='';
+ $out='&origin='.$object->element.'&originid='.$object->id;
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
@@ -240,19 +240,19 @@ if ($object->id > 0)
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
- $param='&socid='.$socid;
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+ $param='&id='.$object->id.'&socid='.$socid;
+ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
+ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
- print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', '');
+ //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', '');
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
// TODO Replace this with same code than into list.php
- //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
+ //show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
}