Fix list of events for BOM module

This commit is contained in:
Laurent Destailleur 2019-06-12 19:32:29 +02:00
parent 2be5e9615d
commit 900e860f6d
4 changed files with 25 additions and 17 deletions

View File

@ -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);
}
}

View File

@ -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 '<br><hr><br>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border centpercent">';
if ($conf->societe->enabled)
{

View File

@ -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

View File

@ -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);
}
}