* Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/comm/action/fiche.php * \ingroup agenda * \brief Page for event card */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("companies"); $langs->load("commercial"); $langs->load("other"); $langs->load("bills"); $langs->load("orders"); $langs->load("agenda"); $action=GETPOST('action','alpha'); $cancel=GETPOST('cancel','alpha'); $backtopage=GETPOST('backtopage','alpha'); $contactid=GETPOST('contactid','int'); $origin=GETPOST('origin','alpha'); $originid=GETPOST('originid','int'); // Security check $socid = GETPOST('socid','int'); $id = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid); $error=GETPOST("error"); $cactioncomm = new CActionComm($db); $object = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); //var_dump($_POST); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('actioncard')); /* * Actions */ // Add action if ($action == 'add_action') { $error=0; if (empty($backtopage)) { if ($socid > 0) $backtopage = DOL_URL_ROOT.'/societe/agenda.php?socid='.$socid; else $backtopage=DOL_URL_ROOT.'/comm/action/index.php'; } if ($contactid) { $result=$contact->fetch($contactid); } if ($cancel) { header("Location: ".$backtopage); exit; } $fulldayevent=GETPOST('fullday'); $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 // Clean parameters $datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); // Check parameters if (! $datef && $percentage == 100) { $error++; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label')) { $error++; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors'); } // Initialisation objet cactioncomm if (! GETPOST('actioncode')) { $error++; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); } else { $result=$cactioncomm->fetch(GETPOST('actioncode')); } // Initialisation objet actioncomm $object->type_id = $cactioncomm->id; $object->type_code = $cactioncomm->code; $object->priority = GETPOST("priority")?GETPOST("priority"):0; $object->fulldayevent = (! empty($fulldayevent)?1:0); $object->location = GETPOST("location"); $object->transparency = (GETPOST("transparency")=='on'?1:0); $object->label = trim(GETPOST('label')); $object->fk_element = GETPOST("fk_element"); $object->elementtype = GETPOST("elementtype"); if (! GETPOST('label')) { if (GETPOST('actioncode') == 'AC_RDV' && $contact->getFullName($langs)) { $object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); } else { if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) { $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; } else $object->label = $cactioncomm->libelle; } } $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; $usertodo=new User($db); if ($_POST["affectedto"] > 0) { $usertodo->fetch($_POST["affectedto"]); } $object->usertodo = $usertodo; $userdone=new User($db); if ($_POST["doneby"] > 0) { $userdone->fetch($_POST["doneby"]); } $object->userdone = $userdone; $object->note = trim($_POST["note"]); if (isset($_POST["contactid"])) $object->contact = $contact; if (GETPOST('socid','int') > 0) { $societe = new Societe($db); $societe->fetch(GETPOST('socid','int')); $object->societe = $societe; } // Special for module webcal and phenix // TODO external modules if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $object->use_webcal=1; if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; // Check parameters if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { $error++; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (! GETPOST('apyear') && ! GETPOST('adyear')) { $error++; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); } // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $db->begin(); // On cree l'action $idaction=$object->add($user); if ($idaction > 0) { if (! $object->error) { $db->commit(); if (! empty($backtopage)) { dol_syslog("Back to ".$backtopage); header("Location: ".$backtopage); } elseif($idaction) { header("Location: ".DOL_URL_ROOT.'/comm/action/fiche.php?id='.$idaction); } else { header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); } exit; } else { // If error $db->rollback(); $langs->load("errors"); $error=$langs->trans($object->error); setEventMessage($error,'errors'); $action = 'create'; } } else { $db->rollback(); $langs->load("errors"); if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors'); if (count($object->errors)) setEventMessage($object->errors, 'errors'); $action = 'create'; } } } /* * Action suppression de l'action */ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') { $object->fetch($id); if ($user->rights->agenda->myactions->delete || $user->rights->agenda->allactions->delete) { $result=$object->delete(); if ($result >= 0) { header("Location: index.php"); exit; } else { setEventMessage($object->error,'errors'); } } } /* * Action update event */ if ($action == 'update') { if (empty($cancel)) { $fulldayevent=GETPOST('fullday'); $aphour=GETPOST('aphour'); $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 // Clean parameters if ($aphour == -1) $aphour='0'; if ($apmin == -1) $apmin='0'; if ($p2hour == -1) $p2hour='0'; if ($p2min == -1) $p2min='0'; $object->fetch($id); $datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]); $datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]); $object->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm'); $object->label = $_POST["label"]; $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; $object->priority = $_POST["priority"]; $object->fulldayevent= $_POST["fullday"]?1:0; $object->location = GETPOST('location'); $object->societe->id = $_POST["socid"]; $object->contact->id = $_POST["contactid"]; $object->fk_project = $_POST["projectid"]; $object->note = $_POST["note"]; $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")); $action = 'edit'; } // Users $usertodo=new User($db); if ($_POST["affectedto"]) { $usertodo->fetch($_POST["affectedto"]); } $object->usertodo = $usertodo; $object->transparency=(GETPOST("transparency")=='on'?1:0); $userdone=new User($db); if ($_POST["doneby"]) { $userdone->fetch($_POST["doneby"]); } $object->userdone = $userdone; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $db->begin(); $result=$object->update($user); if ($result > 0) { $db->commit(); } else { $db->rollback(); } } } if ($result < 0) { setEventMessage($object->error,'errors'); setEventMessage($object->errors,'errors'); } else { if (! empty($backtopage)) { header("Location: ".$backtopage); exit; } } } /* * Action move update, used when user move an event in calendar by drag'n drop */ if ($action == 'mupdate') { $object->fetch($id); $shour = dol_print_date($object->datep,"%H"); $smin = dol_print_date($object->datep, "%M"); $newdate=GETPOST('newdate','alpha'); if (empty($newdate) || strpos($newdate,'dayevent_') != 0 ) { header("Location: ".$backtopage); exit; } $datep=dol_mktime($shour, $smin, 0, substr($newdate,13,2), substr($newdate,15,2), substr($newdate,9,4)); if ($datep!=$object->datep) { if (!empty($object->datef)) { $object->datef+=$datep-$object->datep; } $object->datep=$datep; $result=$object->update($user); if ($result < 0) { setEventMessage($object->error,'errors'); setEventMessage($object->errors,'errors'); } } if (! empty($backtopage)) { header("Location: ".$backtopage); exit; } else { $action=''; } } /* * View */ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); $form = new Form($db); $formactions = new FormActions($db); if ($action == 'create') { $contact = new Contact($db); if (GETPOST("contactid")) { $result=$contact->fetch(GETPOST("contactid")); if ($result < 0) dol_print_error($db,$contact->error); } dol_set_focus("#label"); if (! empty($conf->use_javascript_ajax)) { print "\n".''."\n"; } print '
'; print ''; print ''; if ($backtopage) print ''; if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); else print_fiche_titre($langs->trans("AddAnAction")); print ''; // Type d'action actifs if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } else print ''; // Title print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; // Full day print ''; // Date start $datep=$object->datep; if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0); print ''; // Date end $datef=$object->datef; if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0); print ''; // Status print ''; print ''; // Location print ''; // Assigned to $var=false; print ''; print '
'.$langs->trans("Type").''; $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
'.$langs->trans("EventOnFullDay").'
'.$langs->trans("DateActionStart").''; if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend'); else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend'); else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); print '
'.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); else if (GETPOST("afaire") == 2) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); else $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $percent=-1; if (isset($_GET['status']) || isset($_POST['status'])) { $percent=GETPOST('status'); } else if (isset($_GET['percentage']) || isset($_POST['percentage'])) { $percent=GETPOST('percentage'); } else { if (GETPOST("afaire") == 1) $percent=0; else if (GETPOST("afaire") == 2) $percent=100; } $formactions->form_select_status_action('formaction',$percent,1,'complete'); print '
'.$langs->trans("Location").'
'.$langs->trans("ActionAffectedTo").''; $form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); print '
'; print '

'; print ''; // Busy print ''; // Realised by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } print '
'.$langs->trans("Busy").''; print ''; print '
'.$langs->trans("ActionDoneBy").''; $form->select_users(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); print '
'; print '

'; print ''; // Societe, contact print ''; print ''; // Project if (! empty($conf->projet->enabled)) { $formproject=new FormProjets($db); // Projet associe $langs->load("projects"); print ''; } if(!empty($origin) && !empty($originid)) { print ''; print ''; } if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg)) { $object->datep=dol_mktime(0,0,0,$reg[2],$reg[3],$reg[1]); } // Priority print ''; // Description print ''; // Other attributes $parameters=array('id'=>$object->id); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); } print '
'.$langs->trans("ActionOnCompany").''; if (GETPOST('socid','int') > 0) { $societe = new Societe($db); $societe->fetch(GETPOST('socid','int')); print $societe->getNomUrl(1); print ''; } else { $events=array(); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company if (!empty($user->societe_id)) { print $form->select_company($user->societe_id,'socid','',1,1,0,$events); } else { print $form->select_company('','socid','',1,1,0,$events); } } print '
'.$langs->trans("ActionOnContact").''; $form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1); print '
'.$langs->trans("Project").''; $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); if ($numproject==0) { print '   '.$langs->trans("AddProject").''; } print '
'.$langs->trans("Priority").''; print ''; print '
'.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90); $doleditor->Create(); print '
'; print '

'; print ''; print '     '; print ''; print '
'; print "
"; } // View or edit if ($id > 0) { if ($error) { dol_htmloutput_errors($error); } $result=$object->fetch($id); $object->fetch_optionals($id,$extralabels); if ($result < 0) { dol_print_error($db,$object->error); exit; } $societe = new Societe($db); if ($object->societe->id) { $result=$societe->fetch($object->societe->id); } $object->societe = $societe; if ($object->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->author->id); $object->author=$tmpuser; } if ($object->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermod->id); $object->usermod=$tmpuser; } if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } if ($object->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdone->id); $object->userdone=$tmpuser; } $contact = new Contact($db); if ($object->contact->id) { $result=$contact->fetch($object->contact->id,$user); } $object->contact = $contact; /* * Affichage onglets */ $head=actions_prepare_head($object); $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; // Confirmation suppression action if ($action == 'delete') { print $form->formconfirm("fiche.php?id=".$id,$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete",'','',1); } if ($action == 'edit') { if (! empty($conf->use_javascript_ajax)) { print "\n".''."\n"; } // Fiche action en mode edition print '
'; print ''; print ''; print ''; print ''; if ($backtopage) print ''; dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); print ''; // Ref print ''; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } // Title print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; // Full day event print ''; // Date start print ''; // Date end print ''; // Status print ''; // Location print ''; // Assigned to print ''; print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Type").''; $formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
'.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>
'.$langs->trans("DateActionStart").''; if (GETPOST("afaire") == 1) $form->select_date($object->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart'); else if (GETPOST("afaire") == 2) $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); else $form->select_date($object->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); print '
'.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); else if (GETPOST("afaire") == 2) $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); else $form->select_date($object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; $percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage; $formactions->form_select_status_action('formaction',$percent,1); print '
'.$langs->trans("Location").'
'.$langs->trans("ActionAffectedTo").''; print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); print '


'; // Busy print ''; // Realised by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } print '
'.$langs->trans("Busy").''; print 'transparency?' checked="checked"':'').'">'; print '
'.$langs->trans("ActionDoneBy").''; print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); print '


'; print ''; // Thirdparty - Contact if ($conf->societe->enabled) { print ''; print ''; // Contact print ''; } // Project if (! empty($conf->projet->enabled)) { $formproject=new FormProjets($db); // Projet associe $langs->load("project"); print ''; } // Priority print ''; // Object linked if (! empty($object->fk_element) && ! empty($object->elementtype)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; print ''; } // Description print ''; // Other attributes $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { print $object->showOptionals($extrafields,'edit'); } print '
'.$langs->trans("ActionOnCompany").''; $events=array(); $events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); print $form->select_company($object->societe->id,'socid','',1,1,0,$events); print ''.$langs->trans("Contact").''; $form->select_contacts($object->societe->id, $object->contact->id,'contactid',1); print '
'.$langs->trans("Project").''; $numprojet=$formproject->select_projects($object->societe->id,$object->fk_project,'projectid'); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; } print '
'.$langs->trans("Priority").''; print ''; print '
'.$langs->trans("LinkedObject").''.dolGetElementUrl($object->fk_element,$object->elementtype,1).'
'.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); $doleditor->Create(); print '
'; dol_fiche_end(); print '
'; print '     '; print '
'; print '
'; } else { dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); // Affichage fiche action en mode visu print ''; $linkback = ''.$langs->trans("BackToList").''; // Ref print ''; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } // Title print ''; // Full day event print ''; // Date start print ''; print ''; print ''; // Date end print ''; // Status print ''; // Location print ''; // Assigned to print ''; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); print '
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).'
'.$langs->trans("DateActionStart").''; if (! $object->fulldayevent) print dol_print_date($object->datep,'dayhour'); 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 ''."\n"; print '
'; print ''; print ''; print ''; print ''; print ''; //print ''; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; print ''; print ''; print ''; print ''; //print ''; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; print ''; print ''; print ''; print ''; //print ''; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; print '
'."\n"; print '
'.$langs->trans("DateActionEnd").''; if (! $object->fulldayevent) print dol_print_date($object->datef,'dayhour'); else print dol_print_date($object->datef,'day'); if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print '
'.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print $object->getLibStatut(4); print '
'.$langs->trans("Location").''.$object->location.'
'.$langs->trans("ActionAffectedTo").''; if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); print '


'; // Busy print ''; // Done by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } print '
'.$langs->trans("Busy").''; if ($object->usertodo->id > 0) print yn(($object->transparency > 0)?1:0); // We show nothing if event is assigned to nobody print '
'.$langs->trans("ActionDoneBy").''; if ($object->userdone->id > 0) print $object->userdone->getNomUrl(1); print '


'; // Third party - Contact if ($conf->societe->enabled) { print ''; print ''; print ''; } // Project if (! empty($conf->projet->enabled)) { print ''; } // Priority print ''; // Object linked if (! empty($object->fk_element) && ! empty($object->elementtype)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; print ''; } // Description print ''; // Other attributes $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$object->id); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'.$langs->trans("ActionOnCompany").''.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); if ($object->societe->id && $object->type_code == 'AC_TEL') { if ($object->societe->fetch($object->societe->id)) { print "
".dol_print_phone($object->societe->phone); } } print '
'.$langs->trans("Contact").''; if ($object->contact->id > 0) { print $object->contact->getNomUrl(1); if ($object->contact->id && $object->type_code == 'AC_TEL') { if ($object->contact->fetch($object->contact->id)) { print "
".dol_print_phone($object->contact->phone_pro); } } } else { print $langs->trans("None"); } print '
'.$langs->trans("Project").''; if ($object->fk_project) { $project=new Project($db); $project->fetch($object->fk_project); print $project->getNomUrl(1,'',1); } print '
'.$langs->trans("Priority").''; print ($object->priority?$object->priority:''); print '
'.$langs->trans("LinkedObject").''.dolGetElementUrl($object->fk_element,$object->elementtype,1).'
'.$langs->trans("Description").''; print dol_htmlentitiesbr($object->note); print '
'; //Extra field if (empty($reshook) && ! empty($extrafields->attribute_label)) { print '

'; foreach($extrafields->attribute_label as $key=>$label) { $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); print '\n"; } print '
'.$label.''; print $extrafields->showOutputField($key,$value); print "
'; } dol_fiche_end(); } /* * Barre d'actions */ print '
'; $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if ($action != 'edit') { if ($user->rights->agenda->allactions->create || (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) { print ''; } else { print ''; } if ($user->rights->agenda->allactions->delete || (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) { print ''; } else { print ''; } } } print '
'; } llxFooter(); $db->close();