From d6c4fa5fe334e5130f44b0d6ca415f523c37f896 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2014 00:40:00 +0100 Subject: [PATCH] Qual: Normalize code --- htdocs/comm/action/fiche.php | 329 +++++++++++++++++------------------ 1 file changed, 163 insertions(+), 166 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index dd9cd857bf5..8d1a4c20ac9 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -65,12 +65,12 @@ $error=GETPOST("error"); $mesg=''; $cactioncomm = new CActionComm($db); -$actioncomm = new ActionComm($db); +$object = new ActionComm($db); $contact = new Contact($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label($actioncomm->table_element); +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); //var_dump($_POST); @@ -139,65 +139,65 @@ if ($action == 'add_action') } // Initialisation objet actioncomm - $actioncomm->type_id = $cactioncomm->id; - $actioncomm->type_code = $cactioncomm->code; - $actioncomm->priority = GETPOST("priority")?GETPOST("priority"):0; - $actioncomm->fulldayevent = (! empty($fulldayevent)?1:0); - $actioncomm->location = GETPOST("location"); - $actioncomm->transparency = (GETPOST("transparency")=='on'?1:0); - $actioncomm->label = trim(GETPOST('label')); - $actioncomm->fk_element = GETPOST("fk_element"); - $actioncomm->elementtype = GETPOST("elementtype"); + $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)) { - $actioncomm->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); + $object->label = $langs->transnoentitiesnoconv("TaskRDVWith",$contact->getFullName($langs)); } else { - if ($langs->trans("Action".$actioncomm->type_code) != "Action".$actioncomm->type_code) + if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) { - $actioncomm->label = $langs->transnoentitiesnoconv("Action".$actioncomm->type_code)."\n"; + $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; } - else $actioncomm->label = $cactioncomm->libelle; + else $object->label = $cactioncomm->libelle; } } - $actioncomm->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; - $actioncomm->datep = $datep; - $actioncomm->datef = $datef; - $actioncomm->percentage = $percentage; - $actioncomm->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; + $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"]); } - $actioncomm->usertodo = $usertodo; + $object->usertodo = $usertodo; $userdone=new User($db); if ($_POST["doneby"] > 0) { $userdone->fetch($_POST["doneby"]); } - $actioncomm->userdone = $userdone; + $object->userdone = $userdone; - $actioncomm->note = trim($_POST["note"]); - if (isset($_POST["contactid"])) $actioncomm->contact = $contact; + $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')); - $actioncomm->societe = $societe; + $object->societe = $societe; } // Special for module webcal and phenix // TODO external modules - if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $actioncomm->use_webcal=1; - if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $actioncomm->use_phenix=1; + 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 ($actioncomm->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) + if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { $error++; $action = 'create'; @@ -218,18 +218,18 @@ if ($action == 'add_action') } // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $db->begin(); // On cree l'action - $idaction=$actioncomm->add($user); + $idaction=$object->add($user); if ($idaction > 0) { - if (! $actioncomm->error) + if (! $object->error) { $db->commit(); if (! empty($backtopage)) @@ -252,7 +252,7 @@ if ($action == 'add_action') // If error $db->rollback(); $langs->load("errors"); - $error=$langs->trans($actioncomm->error); + $error=$langs->trans($object->error); setEventMessage($error,'errors'); $action = 'create'; } @@ -261,7 +261,7 @@ if ($action == 'add_action') { $db->rollback(); $langs->load("errors"); - $error=$langs->trans($actioncomm->error); + $error=$langs->trans($object->error); setEventMessage($error,'errors'); $action = 'create'; } @@ -273,13 +273,12 @@ if ($action == 'add_action') */ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') { - $actioncomm = new ActionComm($db); - $actioncomm->fetch($id); + $object->fetch($id); if ($user->rights->agenda->myactions->delete || $user->rights->agenda->allactions->delete) { - $result=$actioncomm->delete(); + $result=$object->delete(); if ($result >= 0) { @@ -288,7 +287,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') } else { - $mesg=$actioncomm->error; + $mesg=$object->error; setEventMessage($mesg,'errors'); } } @@ -314,27 +313,26 @@ if ($action == 'update') if ($p2hour == -1) $p2hour='0'; if ($p2min == -1) $p2min='0'; - $actioncomm = new Actioncomm($db); - $actioncomm->fetch($id); + $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"]); - $actioncomm->fk_action = dol_getIdFromCode($db, $_POST["actioncode"], 'c_actioncomm'); - $actioncomm->label = $_POST["label"]; - $actioncomm->datep = $datep; - $actioncomm->datef = $datef; - $actioncomm->percentage = $percentage; - $actioncomm->priority = $_POST["priority"]; - $actioncomm->fulldayevent= $_POST["fullday"]?1:0; - $actioncomm->location = GETPOST('location'); - $actioncomm->societe->id = $_POST["socid"]; - $actioncomm->contact->id = $_POST["contactid"]; - $actioncomm->fk_project = $_POST["projectid"]; - $actioncomm->note = $_POST["note"]; - $actioncomm->pnote = $_POST["note"]; - $actioncomm->fk_element = $_POST["fk_element"]; - $actioncomm->elementtype = $_POST["elementtype"]; + $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")); @@ -347,24 +345,24 @@ if ($action == 'update') { $usertodo->fetch($_POST["affectedto"]); } - $actioncomm->usertodo = $usertodo; - $actioncomm->transparency=(GETPOST("transparency")=='on'?1:0); + $object->usertodo = $usertodo; + $object->transparency=(GETPOST("transparency")=='on'?1:0); $userdone=new User($db); if ($_POST["doneby"]) { $userdone->fetch($_POST["doneby"]); } - $actioncomm->userdone = $userdone; + $object->userdone = $userdone; // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels,$actioncomm); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); if (! $error) { $db->begin(); - $result=$actioncomm->update($user); + $result=$object->update($user); if ($result > 0) { @@ -379,8 +377,8 @@ if ($action == 'update') if ($result < 0) { - setEventMessage($actioncomm->error,'errors'); - setEventMessage($actioncomm->errors,'errors'); + setEventMessage($object->error,'errors'); + setEventMessage($object->errors,'errors'); } else { @@ -473,7 +471,7 @@ if ($action == 'create') if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("Type").''; - $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$actioncomm->type_code, "actioncode","systemauto"); + $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print ''; } else print ''; @@ -485,7 +483,7 @@ if ($action == 'create') print ''.$langs->trans("EventOnFullDay").''; // Date start - $datep=$actioncomm->datep; + $datep=$object->datep; if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0); print ''.$langs->trans("DateActionStart").''; if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend'); @@ -493,7 +491,7 @@ if ($action == 'create') else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); print ''; // Date end - $datef=$actioncomm->datef; + $datef=$object->datef; if (GETPOST('datef','int',1)) $datef=dol_stringtotime(GETPOST('datef','int',1),0); print ''.$langs->trans("DateActionEnd").''; if (GETPOST("afaire") == 1) $form->select_date($datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); @@ -522,7 +520,7 @@ if ($action == 'create') print ''; // Location - print ''.$langs->trans("Location").''; + print ''.$langs->trans("Location").''; print ''; @@ -533,19 +531,19 @@ if ($action == 'create') // Assigned to $var=false; print ''.$langs->trans("ActionAffectedTo").''; - $form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($actioncomm->usertodo->id) && $actioncomm->usertodo->id > 0 ? $actioncomm->usertodo->id : $user->id),'affectedto',1); + $form->select_users(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); print ''; // Busy print ''.$langs->trans("Busy").''; - print ''; + print ''; print ''; // Realised by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''.$langs->trans("ActionDoneBy").''; - $form->select_users(GETPOST("doneby")?GETPOST("doneby"):(! empty($actioncomm->userdone->id) && $percent==100?$actioncomm->userdone->id:0),'doneby',1); + $form->select_users(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); print ''; } @@ -608,30 +606,30 @@ if ($action == 'create') if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg)) { - $actioncomm->datep=dol_mktime(0,0,0,$reg[2],$reg[3],$reg[1]); + $object->datep=dol_mktime(0,0,0,$reg[2],$reg[3],$reg[1]); } // Priority print ''.$langs->trans("Priority").''; - print ''; + print ''; print ''; // Description print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$actioncomm->note),'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_7,90); + $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 ''; // Other attributes - $parameters=array('id'=>$actioncomm->id); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook + $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 $actioncomm->showOptionals($extrafields,'edit'); + print $object->showOptionals($extrafields,'edit'); } print ''; @@ -657,40 +655,39 @@ if ($id > 0) dol_htmloutput_mesg($mesg); } - $act = new ActionComm($db); - $result=$act->fetch($id); - $act->fetch_optionals($id,$extralabels); + $result=$object->fetch($id); + $object->fetch_optionals($id,$extralabels); if ($result < 0) { - dol_print_error($db,$act->error); + dol_print_error($db,$object->error); exit; } $societe = new Societe($db); - if ($act->societe->id) + if ($object->societe->id) { - $result=$societe->fetch($act->societe->id); + $result=$societe->fetch($object->societe->id); } - $act->societe = $societe; + $object->societe = $societe; - if ($act->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->author->id); $act->author=$tmpuser; } - if ($act->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->usermod->id); $act->usermod=$tmpuser; } - if ($act->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->usertodo->id); $act->usertodo=$tmpuser; } - if ($act->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->userdone->id); $act->userdone=$tmpuser; } + 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 ($act->contact->id) + if ($object->contact->id) { - $result=$contact->fetch($act->contact->id,$user); + $result=$contact->fetch($object->contact->id,$user); } - $act->contact = $contact; + $object->contact = $contact; /* * Affichage onglets */ - $head=actions_prepare_head($act); + $head=actions_prepare_head($object); $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; @@ -734,7 +731,7 @@ if ($id > 0) print ''; print ''; print ''; - print ''; + print ''; if ($backtopage) print ''; dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); @@ -742,61 +739,61 @@ if ($id > 0) print ''; // Ref - print ''; + print ''; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''; } // Title - print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; + print 'global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").''; // Full day event - print ''; + print ''; // Date start print ''; // Date end print ''; // Status print ''; // Location - print ''; + print ''; print '
'.$langs->trans("Ref").''.$act->id.'
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Type").''; - $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$act->type_code, "actioncode","systemauto"); + $htmlactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):$object->type_code, "actioncode","systemauto"); print '
'.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>
'.$langs->trans("EventOnFullDay").'fulldayevent?' checked="checked"':'').'>
'.$langs->trans("DateActionStart").''; - if (GETPOST("afaire") == 1) $form->select_date($act->datep,'ap',1,1,0,"action",1,1,0,0,'fulldaystart'); - else if (GETPOST("afaire") == 2) $form->select_date($act->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); - else $form->select_date($act->datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart'); + 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($act->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - else if (GETPOST("afaire") == 2) $form->select_date($act->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); - else $form->select_date($act->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend'); + 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"):$act->percentage; + $percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage; $htmlactions->form_select_status_action('formaction',$percent,1); print '
'.$langs->trans("Location").'
'.$langs->trans("Location").'


'; // Assigned to print ''; // Busy print ''; // Realised by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } @@ -811,12 +808,12 @@ if ($id > 0) print ''; // Contact print ''; } @@ -830,7 +827,7 @@ if ($id > 0) $langs->load("project"); print ''; // Object linked - if (! empty($act->fk_element) && ! empty($act->elementtype)) + if (! empty($object->fk_element) && ! empty($object->elementtype)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; - print ''; + print ''; } // Description print ''; // Other attributes - $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$act->id); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook + $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 $actioncomm->showOptionals($extrafields,'edit'); + print $object->showOptionals($extrafields,'edit'); } @@ -889,53 +886,53 @@ if ($id > 0) // Ref print ''; // Type if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; } // Title - print ''; + print ''; // Full day event - print ''; + print ''; // Date start print ''; print ''; @@ -943,36 +940,36 @@ if ($id > 0) // Date end print ''; // Status print ''; // Location - print ''; + print ''; print '
'.$langs->trans("ActionAffectedTo").''; - print $form->select_dolusers($act->usertodo->id>0?$act->usertodo->id:-1,'affectedto',1); + print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); print '
'.$langs->trans("Busy").''; - print 'transparency?' checked="checked"':'').'">'; + print 'transparency?' checked="checked"':'').'">'; print '
'.$langs->trans("ActionDoneBy").''; - print $form->select_dolusers($act->userdone->id> 0?$act->userdone->id:-1,'doneby',1); + print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); print '
'; $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($act->societe->id,'socid','',1,1,0,$events); + print $form->select_company($object->societe->id,'socid','',1,1,0,$events); print ''.$langs->trans("Contact").''; - $form->select_contacts($act->societe->id, $act->contact->id,'contactid',1); + $form->select_contacts($object->societe->id, $object->contact->id,'contactid',1); print '
'.$langs->trans("Project").''; - $numprojet=$formproject->select_projects($act->societe->id,$act->fk_project,'projectid'); + $numprojet=$formproject->select_projects($object->societe->id,$object->fk_project,'projectid'); if ($numprojet==0) { print '   '.$langs->trans("AddProject").''; @@ -840,31 +837,31 @@ if ($id > 0) // Priority print '
'.$langs->trans("Priority").''; - print ''; + print ''; print '
'.$langs->trans("LinkedObject").''.dolGetElementUrl($act->fk_element,$act->elementtype,1).'
'.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',$act->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); + $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); $doleditor->Create(); print '
'.$langs->trans("Ref").''; - print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); + print $form->showrefnav($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', ''); print '
'.$langs->trans("Type").''.$act->type.'
'.$langs->trans("Type").''.$object->type.'
'.$langs->trans("Title").''.$act->label.'
'.$langs->trans("Title").''.$object->label.'
'.$langs->trans("EventOnFullDay").''.yn($act->fulldayevent).'
'.$langs->trans("EventOnFullDay").''.yn($object->fulldayevent).'
'.$langs->trans("DateActionStart").''; - 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")); + 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 ''; + print ''; + print ''; + //print ''; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' '; print '
'."\n"; print '
'; print ''; print ''; - print ''; - 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 ''; + print ''; + print ''; + //print ''; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' '; print '
'."\n"; print '
'.$langs->trans("DateActionEnd").''; - 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")); + 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 $act->getLibStatut(4); + print $object->getLibStatut(4); print '
'.$langs->trans("Location").''.$act->location.'
'.$langs->trans("Location").''.$object->location.'


'; // Assigned to print ''; // Busy print ''; // Done by if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''; } @@ -981,25 +978,25 @@ if ($id > 0) // Third party - Contact if ($conf->societe->enabled) { - print ''; print ''; print ''; @@ -1025,25 +1022,25 @@ if ($id > 0) // Priority print ''; // Object linked - if (! empty($act->fk_element) && ! empty($act->elementtype)) + if (! empty($object->fk_element) && ! empty($object->elementtype)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; - print ''; + print ''; } // Description print ''; // Other attributes - $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$act->id); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook + $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("ActionAffectedTo").''; - if ($act->usertodo->id > 0) print $act->usertodo->getNomUrl(1); + if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); print '
'.$langs->trans("Busy").''; - if ($act->usertodo->id > 0) print yn(($act->transparency > 0)?1:0); // We show nothing if event is assigned to nobody + 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 ($act->userdone->id > 0) print $act->userdone->getNomUrl(1); + if ($object->userdone->id > 0) print $object->userdone->getNomUrl(1); print '
'.$langs->trans("ActionOnCompany").''.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None")); - if ($act->societe->id && $act->type_code == 'AC_TEL') + print '
'.$langs->trans("ActionOnCompany").''.($object->societe->id?$object->societe->getNomUrl(1):$langs->trans("None")); + if ($object->societe->id && $object->type_code == 'AC_TEL') { - if ($act->societe->fetch($act->societe->id)) + if ($object->societe->fetch($object->societe->id)) { - print "
".dol_print_phone($act->societe->phone); + print "
".dol_print_phone($object->societe->phone); } } print '
'.$langs->trans("Contact").''; - if ($act->contact->id > 0) + if ($object->contact->id > 0) { - print $act->contact->getNomUrl(1); - if ($act->contact->id && $act->type_code == 'AC_TEL') + print $object->contact->getNomUrl(1); + if ($object->contact->id && $object->type_code == 'AC_TEL') { - if ($act->contact->fetch($act->contact->id)) + if ($object->contact->fetch($object->contact->id)) { - print "
".dol_print_phone($act->contact->phone_pro); + print "
".dol_print_phone($object->contact->phone_pro); } } } @@ -1014,10 +1011,10 @@ if ($id > 0) if (! empty($conf->projet->enabled)) { print '
'.$langs->trans("Project").''; - if ($act->fk_project) + if ($object->fk_project) { $project=new Project($db); - $project->fetch($act->fk_project); + $project->fetch($object->fk_project); print $project->getNomUrl(1,'',1); } print '
'.$langs->trans("Priority").''; - print ($act->priority?$act->priority:''); + print ($object->priority?$object->priority:''); print '
'.$langs->trans("LinkedObject").''.dolGetElementUrl($act->fk_element,$act->elementtype,1).'
'.dolGetElementUrl($object->fk_element,$object->elementtype,1).'
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($act->note); + print dol_htmlentitiesbr($object->note); print '
'; @@ -1053,7 +1050,7 @@ if ($id > 0) print '

'; foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($act->array_options['options_'.$key])?$act->array_options['options_'.$key]:'')); + $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); print '\n"; @@ -1078,19 +1075,19 @@ if ($id > 0) if ($action != 'edit') { if ($user->rights->agenda->allactions->create || - (($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) + (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->create)) { - print '
'.$langs->trans("Modify").'
'; + print '
'.$langs->trans("Modify").'
'; } else { print '
'.$langs->trans("Modify").'
'; } - + if ($user->rights->agenda->allactions->delete || - (($act->author->id == $user->id || $act->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) + (($object->author->id == $user->id || $object->usertodo->id == $user->id) && $user->rights->agenda->myactions->delete)) { - print '
'.$langs->trans("Delete").'
'; + print '
'.$langs->trans("Delete").'
'; } else { @@ -1098,7 +1095,7 @@ if ($id > 0) } } } - + print ''; }
'.$label.''; print $extrafields->showOutputField($key,$value); print "