New: Add a button to jump to calendar from action card

This commit is contained in:
Laurent Destailleur 2010-11-20 18:41:09 +00:00
parent e59ccde5b0
commit bac318240c
3 changed files with 87 additions and 65 deletions

View File

@ -597,7 +597,7 @@ class ActionComm extends CommonObject
/**
* Export events from database into a cal file.
* @param format 'ical' or 'vcal'
* @param format 'vcal', 'ical/ics', 'rss'
* @param type 'event' or 'journal'
* @param cachedelay Do not rebuild file if date older than cachedelay seconds
* @param filename Force filename
@ -782,8 +782,8 @@ class ActionComm extends CommonObject
}
// Write file
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($result >= 0)

View File

@ -491,9 +491,6 @@ if (GETPOST('action') == 'create')
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td><input type="text" name="location" size="60" value="'.GETPOST('location').'"></td></tr>';
// Full day
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
@ -510,7 +507,7 @@ if (GETPOST('action') == 'create')
else $html->select_date($actioncomm->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
print '</td></tr>';
// Avancement
// Status
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
print '<td>';
$percent=0;
@ -526,8 +523,13 @@ if (GETPOST('action') == 'create')
print $htmlactions->form_select_status_action('formaction',$percent,1);
print '</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$act->location.'"></td></tr>';
print '</table>';
print '<br>';
print '<table class="border" width="100%">';
// Affected by
@ -594,12 +596,12 @@ if (GETPOST('action') == 'create')
add_row_for_calendar_link();
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',($_POST["note"]?$_POST["note"]:$actioncomm->note),280,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
$doleditor->Create();
print '</td></tr>';
// Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',($_POST["note"]?$_POST["note"]:$actioncomm->note),280,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
$doleditor->Create();
print '</td></tr>';
print '</table>';
@ -723,9 +725,6 @@ if ($id)
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$act->location.'"></td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="true"':'').'></td></tr>';
@ -748,6 +747,9 @@ if ($id)
print $htmlactions->form_select_status_action('formaction',$percent,1);
print '</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.$act->location.'"></td></tr>';
print '</table><br><table class="border" width="100%">';
// Input by
@ -807,13 +809,13 @@ if ($id)
print '<td colspan="3">'.$act->objet_url.'</td></tr>';
}
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
// Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$act->note,240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90);
$doleditor->Create();
print '</td></tr>';
// Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('note',$act->note,240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
$doleditor->Create();
print '</td></tr>';
print '</table>';
@ -839,21 +841,28 @@ if ($id)
// Title
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3">'.$act->location.'</td></tr>';
// Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($act->fulldayevent).'</td></tr>';
// Date debut
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
// Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour');
else print dol_print_date($act->datep,'day');
if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
print '</td></tr>';
print '</td>';
print '<td rowspan="2" align="center" valign="middle" width="140">'."\n";
print '<form name="listactionsfilter" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n";
print '</td>';
print '</tr>';
// Date fin
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
// Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour');
else print dol_print_date($act->datef,'day');
if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
@ -864,6 +873,9 @@ if ($id)
print $act->getLibStatut(4);
print '</td></tr>';
// Location
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3">'.$act->location.'</td></tr>';
print '</table><br><table class="border" width="100%">';
// Input by
@ -884,7 +896,7 @@ if ($id)
print '</table><br><table class="border" width="100%">';
// Societe - contact
// Third party - Contact
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None"));
if ($act->societe->id && $act->type_code == 'AC_TEL')
{
@ -939,8 +951,8 @@ if ($id)
print '<td colspan="3">'.$act->objet_url.'</td></tr>';
}
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">';
// Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">';
print dol_htmlentitiesbr($act->note);
print '</td></tr>';

View File

@ -179,6 +179,7 @@ $sql.= ' a.datea,';
$sql.= ' a.datea2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
$sql.= ' a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code';
$sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
@ -252,6 +253,10 @@ if ($resql)
$action->usertodo->id=$obj->fk_user_action;
$action->userdone->id=$obj->fk_user_done;
$action->priority=$obj->priority;
$action->fulldayevent=$obj->fulldayevent;
$action->location=$obj->location;
$action->societe->id=$obj->fk_soc;
$action->contact->id=$obj->fk_contact;
@ -558,38 +563,43 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$action
print '<td nowrap="nowrap">';
if ($action->type_code != 'BIRTHDAY')
{
$tmpyearstart = date('Y',$action->date_start_in_calendar);
$tmpmonthstart = date('m',$action->date_start_in_calendar);
$tmpdaystart = date('d',$action->date_start_in_calendar);
$tmpyearend = date('Y',$action->date_end_in_calendar);
$tmpmonthend = date('m',$action->date_end_in_calendar);
$tmpdayend = date('d',$action->date_end_in_calendar);
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{
print dol_print_date($action->date_start_in_calendar,'%H:%M');
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
print '-';
//else
//print '...';
}
}
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend)
{
print '...';
}
}
// Hour end
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
print dol_print_date($action->date_end_in_calendar,'%H:%M');
}
print '<br>';
if (empty($action->fulldayevent))
{
// Show hours (start ... end)
$tmpyearstart = date('Y',$action->date_start_in_calendar);
$tmpmonthstart = date('m',$action->date_start_in_calendar);
$tmpdaystart = date('d',$action->date_start_in_calendar);
$tmpyearend = date('Y',$action->date_end_in_calendar);
$tmpmonthend = date('m',$action->date_end_in_calendar);
$tmpdayend = date('d',$action->date_end_in_calendar);
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
{
print dol_print_date($action->date_start_in_calendar,'%H:%M');
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
print '-';
//else
//print '...';
}
}
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend)
{
print '...';
}
}
// Hour end
if ($action->date_end_in_calendar && $action->date_start_in_calendar != $action->date_end_in_calendar)
{
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
print dol_print_date($action->date_end_in_calendar,'%H:%M');
}
print '<br>';
}
// If action related to company / contact
$linerelatedto='';$length=16;
if (! empty($action->societe->id) && ! empty($action->contact->id)) $length=8;