forked from Wavyzz/dolibarr
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
|
// 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
|
// Full day
|
||||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
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 $filter Other filter
|
||||||
* @param string $sortfield Sort on this field
|
* @param string $sortfield Sort on this field
|
||||||
* @param string $sortorder ASC or DESC
|
* @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
|
* @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;
|
global $conf, $langs;
|
||||||
|
|
||||||
@@ -879,6 +880,7 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
if (! empty($filter)) $sql.= $filter;
|
if (! empty($filter)) $sql.= $filter;
|
||||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) $sql.=$db->plimit($limit);
|
||||||
|
|
||||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@@ -155,16 +155,18 @@ class FormActions
|
|||||||
* @param int $socid socid of user
|
* @param int $socid socid of user
|
||||||
* @param int $forceshowtitle Show title even if there is no actions to show
|
* @param int $forceshowtitle Show title even if there is no actions to show
|
||||||
* @param string $morecss More css on table
|
* @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
|
* @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 $langs,$conf,$user;
|
||||||
global $bc;
|
global $bc;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
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');
|
if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions');
|
||||||
|
|
||||||
$num = count($listofactions);
|
$num = count($listofactions);
|
||||||
@@ -177,12 +179,15 @@ class FormActions
|
|||||||
elseif ($typeelement == 'supplier_proposal') $title=$langs->trans('ActionsOnSupplierProposal');
|
elseif ($typeelement == 'supplier_proposal') $title=$langs->trans('ActionsOnSupplierProposal');
|
||||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_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 == 'shipping') $title=$langs->trans('ActionsOnShipping');
|
||||||
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
|
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.= $langs->trans("AddEvent");
|
||||||
$buttontoaddnewevent.= '</a>';
|
$buttontoaddnewevent.= '</a>';
|
||||||
print load_fiche_titre($title, $buttontoaddnewevent, '');
|
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('Ref', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||||
print_liste_field_titre('Action', $_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('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('By', $_SERVER["PHP_SELF"], '', $page, $param, '');
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"');
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@@ -205,8 +210,11 @@ class FormActions
|
|||||||
|
|
||||||
$userstatic = new User($this->db);
|
$userstatic = new User($this->db);
|
||||||
|
|
||||||
|
$cursorevent = 0;
|
||||||
foreach($listofactions as $action)
|
foreach($listofactions as $action)
|
||||||
{
|
{
|
||||||
|
if ($max && $cursorevent >= $max) break;
|
||||||
|
|
||||||
$ref=$action->getNomUrl(1,-1);
|
$ref=$action->getNomUrl(1,-1);
|
||||||
$label=$action->getNomUrl(0,38);
|
$label=$action->getNomUrl(0,38);
|
||||||
|
|
||||||
@@ -226,7 +234,7 @@ class FormActions
|
|||||||
}
|
}
|
||||||
print $action->type;
|
print $action->type;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.dol_print_date($action->datep,'dayhour');
|
print '<td align="center">'.dol_print_date($action->datep,'dayhour');
|
||||||
if ($action->datef)
|
if ($action->datef)
|
||||||
{
|
{
|
||||||
$tmpa=dol_getdate($action->datep);
|
$tmpa=dol_getdate($action->datep);
|
||||||
@@ -254,7 +262,15 @@ class FormActions
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
$cursorevent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($max && $num > $max)
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven"><td colspan="6">'.$langs->trans("More").'...</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1780,6 +1780,11 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
|
|||||||
$module='ficheinter';
|
$module='ficheinter';
|
||||||
$subelement='fichinter';
|
$subelement='fichinter';
|
||||||
}
|
}
|
||||||
|
if ($objecttype == 'task') {
|
||||||
|
$classpath = 'projet/class';
|
||||||
|
$module='projet';
|
||||||
|
$subelement='task';
|
||||||
|
}
|
||||||
|
|
||||||
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
//print "objecttype=".$objecttype." module=".$module." subelement=".$subelement;
|
||||||
|
|
||||||
@@ -2212,3 +2217,4 @@ function getModuleDirForApiClass($module)
|
|||||||
|
|
||||||
return $moduledirforclass;
|
return $moduledirforclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -747,6 +747,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
|||||||
// Set societeforaction.
|
// Set societeforaction.
|
||||||
if ($object->socid > 0) $societeforaction->fetch($object->socid);
|
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
|
// Insertion action
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
$actioncomm = new ActionComm($this->db);
|
$actioncomm = new ActionComm($this->db);
|
||||||
@@ -754,7 +757,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
|||||||
$actioncomm->code = 'AC_'.$action;
|
$actioncomm->code = 'AC_'.$action;
|
||||||
$actioncomm->label = $object->actionmsg2;
|
$actioncomm->label = $object->actionmsg2;
|
||||||
$actioncomm->note = $object->actionmsg; // TODO Replace with $actioncomm->email_msgid ? $object->email_content : $object->actionmsg
|
$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->datep = $now;
|
||||||
$actioncomm->datef = $now;
|
$actioncomm->datef = $now;
|
||||||
$actioncomm->durationp = 0;
|
$actioncomm->durationp = 0;
|
||||||
|
|||||||
@@ -406,6 +406,7 @@ ActionRunningNotStarted=To start
|
|||||||
ActionRunningShort=In progress
|
ActionRunningShort=In progress
|
||||||
ActionDoneShort=Finished
|
ActionDoneShort=Finished
|
||||||
ActionUncomplete=Uncomplete
|
ActionUncomplete=Uncomplete
|
||||||
|
LatestLinkedEvents=Latest %s linked events
|
||||||
CompanyFoundation=Company/Organisation
|
CompanyFoundation=Company/Organisation
|
||||||
ContactsForCompany=Contacts for this third party
|
ContactsForCompany=Contacts for this third party
|
||||||
ContactsAddressesForCompany=Contacts/addresses 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">';
|
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>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -588,6 +588,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
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>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user