Skip to content

Commit

Permalink
Fix: Can edit status of event.
Browse files Browse the repository at this point in the history
New: Onto event summary of elements, end date and status are visible.
  • Loading branch information
eldy committed Sep 15, 2014
1 parent 19e2bd8 commit 9ea3e33
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 12 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -6,6 +6,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
- New: PDF event report show project and status of event.
- New: Onto event summary of elements, end date and status are visible.
- New: Can filter on status on interventions.
- New: Add help info of field type into dictionary of payment types.
- New: Add proposals into referer page of thirdparty.
Expand Down
2 changes: 2 additions & 0 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -466,6 +466,8 @@ function update($user,$notrigger=0)
$sql.= ", fk_user_mod = '".$user->id."'";
$sql.= ", fk_user_action=".($this->usertodo->id > 0 ? "'".$this->usertodo->id."'":"null");
$sql.= ", fk_user_done=".($this->userdone->id > 0 ? "'".$this->userdone->id."'":"null");
if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null");
if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null");
$sql.= " WHERE id=".$this->id;

dol_syslog(get_class($this)."::update", LOG_DEBUG);
Expand Down
32 changes: 25 additions & 7 deletions htdocs/comm/action/document.php
Expand Up @@ -105,9 +105,14 @@
$author->fetch($object->author->id);
$object->author=$author;

if ($object->contact->id) $object->fetch_contact($object->contact->id);
if ($object->contact->id > 0) $object->fetch_contact($object->contact->id);
if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; }

$head=actions_prepare_head($object);

$now=dol_now();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;

dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action');

// Affichage fiche action en mode visu
Expand Down Expand Up @@ -138,15 +143,15 @@
else print dol_print_date($object->datep,'day');
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td>';
print '<td rowspan="4" align="center" valign="middle" width="180">'."\n";
print '<td rowspan="5" align="center" valign="middle" width="180">'."\n";
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_month">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
Expand All @@ -155,7 +160,7 @@
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
Expand All @@ -164,9 +169,18 @@
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n";
print '</td>';
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="show_peruser">';
print '<input type="hidden" name="year" value="'.dol_print_date($object->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';

// Date end
Expand All @@ -184,7 +198,11 @@
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$object->location.'</td></tr>';


// Assigned to
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1);
print '</td></tr>';

print '</table><br><br><table class="border" width="100%">';


Expand Down
7 changes: 4 additions & 3 deletions htdocs/comm/action/fiche.php
Expand Up @@ -101,7 +101,7 @@
$action='create';
}
// Add action
if ($action == 'add_action')
if ($action == 'add')
{
$error=0;

Expand Down Expand Up @@ -317,7 +317,7 @@
$apmin=GETPOST('apmin');
$p2hour=GETPOST('p2hour');
$p2min=GETPOST('p2min');
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status

// Clean parameters
if ($aphour == -1) $aphour='0';
Expand Down Expand Up @@ -345,6 +345,7 @@
$object->pnote = $_POST["note"];
$object->fk_element = $_POST["fk_element"];
$object->elementtype = $_POST["elementtype"];

if (! $datef && $percentage == 100)
{
$error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
Expand Down Expand Up @@ -512,7 +513,7 @@ function setdatefields()

print '<form name="formaction" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add_action">';
print '<input type="hidden" name="action" value="add">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';

if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
Expand Down
17 changes: 16 additions & 1 deletion htdocs/core/class/html.formactions.class.php
Expand Up @@ -187,6 +187,7 @@ function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
print '<th class="liste_titre">'.$langs->trans('Action').'</th>';
print '<th class="liste_titre">'.$langs->trans('Date').'</th>';
print '<th class="liste_titre">'.$langs->trans('By').'</th>';
print '<th class="liste_titre" align="right">'.$langs->trans('Status').'</th>';
print '</tr>';
print "\n";

Expand All @@ -204,7 +205,15 @@ function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
print '<tr '.$bc[$var].'>';
print '<td>'.$ref.'</td>';
print '<td>'.$label.'</td>';
print '<td>'.dol_print_date($action->datep,'day').'</td>';
print '<td>'.dol_print_date($action->datep,'dayhour');
if ($action->datef)
{
$tmpa=dol_getdate($action->datep);
$tmpb=dol_getdate($action->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) print '-'.dol_print_date($action->datef,'hour');
else print '-'.dol_print_date($action->datef,'dayhour');
}
print '</td>';
print '<td>';
if (! empty($action->author->id))
{
Expand All @@ -214,6 +223,12 @@ function showactions($object,$typeelement,$socid=0,$forceshowtitle=0)
print $userstatic->getNomUrl(1);
}
print '</td>';
print '<td align="right">';
if (! empty($action->author->id))
{
print $action->getLibStatut(3);
}
print '</td>';
print '</tr>';
}
print '</table>';
Expand Down
14 changes: 14 additions & 0 deletions htdocs/fichinter/fiche.php
Expand Up @@ -1643,6 +1643,20 @@
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a></div>';
}

// Event agenda
if (! empty($conf->global->FICHINTER_ADDLINK_TO_EVENT))
{
if (! empty($conf->agenda->enabled) && $object->statut > 0)
{
$langs->load("agenda");
if ($object->statut < 2)
{
if ($user->rights->agenda->myactions->create) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddEvent").'</a></div>';
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddEvent").'</a></div>';
}
}
}

// Proposal
if (! empty($conf->propal->enabled) && $object->statut > 0)
{
Expand Down
3 changes: 2 additions & 1 deletion htdocs/langs/en_US/agenda.lang
Expand Up @@ -87,4 +87,5 @@ AgendaExtNb=Calendar nb %s
ExtSiteUrlAgenda=URL to access .ical file
ExtSiteNoLabel=No Description
WorkingTimeRange=Working time range
WorkingDaysRange=Working days range
WorkingDaysRange=Working days range
AddEvent=Create event

0 comments on commit 9ea3e33

Please sign in to comment.