mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
FIX Several problem with the last event box on project/tasks
Conflicts: htdocs/core/lib/functions2.lib.php
This commit is contained in:
@@ -670,7 +670,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
||||
|
||||
@@ -860,9 +860,10 @@ class ActionComm extends CommonObject
|
||||
* @param string $filter Other filter
|
||||
* @param string $sortfield Sort on this field
|
||||
* @param string $sortorder ASC or DESC
|
||||
* @param string $limit Limit number of answers
|
||||
* @return array or string Error string if KO, array with actions if OK
|
||||
*/
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='', $sortorder='')
|
||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='datep', $sortorder='DESC', $limit=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -879,6 +880,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
if (! empty($filter)) $sql.= $filter;
|
||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||
if ($limit) $sql.=$db->plimit($limit);
|
||||
|
||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
|
||||
@@ -155,16 +155,18 @@ class FormActions
|
||||
* @param int $socid socid of user
|
||||
* @param int $forceshowtitle Show title even if there is no actions to show
|
||||
* @param string $morecss More css on table
|
||||
* @param int $max Max number of record
|
||||
* @param string $moreparambacktopage More param for the backtopage
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0,$forceshowtitle=0,$morecss='listactions')
|
||||
function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='')
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
global $bc;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement);
|
||||
$listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', '', '', ($max?($max+1):0));
|
||||
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
|
||||
|
||||
$num = count($listofactions);
|
||||
@@ -177,12 +179,15 @@ class FormActions
|
||||
elseif ($typeelement == 'supplier_proposal') $title=$langs->trans('ActionsOnSupplierProposal');
|
||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||
elseif ($typeelement == 'shipping') $title=$langs->trans('ActionsOnShipping');
|
||||
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
|
||||
else $title=$langs->trans("Actions");
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
|
||||
elseif ($typeelement == 'task') $title=$langs->trans('LatestLinkedEvents', $max?$max:'');
|
||||
else $title=$langs->trans("Actions");
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">';
|
||||
$urlbacktopage=$_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage?'&'.$moreparambacktopage:'');
|
||||
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.'&socid='.$object->socid.'&projectid='.$object->fk_project.'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
||||
@@ -197,7 +202,7 @@ class FormActions
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, 'align="center"');
|
||||
print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
|
||||
print '</tr>';
|
||||
@@ -205,8 +210,11 @@ class FormActions
|
||||
|
||||
$userstatic = new User($this->db);
|
||||
|
||||
$cursorevent = 0;
|
||||
foreach($listofactions as $action)
|
||||
{
|
||||
if ($max && $cursorevent >= $max) break;
|
||||
|
||||
$ref=$action->getNomUrl(1,-1);
|
||||
$label=$action->getNomUrl(0,38);
|
||||
|
||||
@@ -226,7 +234,7 @@ class FormActions
|
||||
}
|
||||
print $action->type;
|
||||
print '</td>';
|
||||
print '<td>'.dol_print_date($action->datep,'dayhour');
|
||||
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
|
||||
if ($action->datef)
|
||||
{
|
||||
$tmpa=dol_getdate($action->datep);
|
||||
@@ -254,7 +262,15 @@ class FormActions
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$cursorevent++;
|
||||
}
|
||||
|
||||
if ($max && $num > $max)
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="6">'.$langs->trans("More").'...</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@@ -1780,6 +1780,11 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
|
||||
$module='ficheinter';
|
||||
$subelement='fichinter';
|
||||
}
|
||||
if ($objecttype == 'task') {
|
||||
$classpath = 'projet/class';
|
||||
$module='projet';
|
||||
$subelement='task';
|
||||
}
|
||||
|
||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
||||
|
||||
@@ -2212,3 +2217,4 @@ function getModuleDirForApiClass($module)
|
||||
|
||||
return $moduledirforclass;
|
||||
}
|
||||
|
||||
|
||||
@@ -747,6 +747,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
// Set societeforaction.
|
||||
if ($object->socid > 0) $societeforaction->fetch($object->socid);
|
||||
|
||||
$projectid = isset($object->fk_project)?$object->fk_project:0;
|
||||
if ($object->element == 'project') $projectid = $object->id;
|
||||
|
||||
// Insertion action
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
@@ -754,7 +757,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->code = 'AC_'.$action;
|
||||
$actioncomm->label = $object->actionmsg2;
|
||||
$actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg
|
||||
$actioncomm->fk_project = isset($object->fk_project)?$object->fk_project:0;
|
||||
$actioncomm->fk_project = $projectid;
|
||||
$actioncomm->datep = $now;
|
||||
$actioncomm->datef = $now;
|
||||
$actioncomm->durationp = 0;
|
||||
|
||||
@@ -406,6 +406,7 @@ ActionRunningNotStarted=To start
|
||||
ActionRunningShort=In progress
|
||||
ActionDoneShort=Finished
|
||||
ActionUncomplete=Uncomplete
|
||||
LatestLinkedEvents=Latest %s linked events
|
||||
CompanyFoundation=Company/Organisation
|
||||
ContactsForCompany=Contacts for this third party
|
||||
ContactsAddressesForCompany=Contacts/addresses for this third party
|
||||
|
||||
@@ -1198,6 +1198,10 @@ elseif ($object->id > 0)
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'project', $socid, 1, '', 10);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
@@ -588,6 +588,11 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'task', $socid, 1, '', 10, 'withproject='.$withproject);
|
||||
|
||||
print '</div></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user