Clean deprecated code.
This commit is contained in:
parent
0dc82cddf1
commit
cd8936a224
@ -218,13 +218,7 @@ if ($action == 'add')
|
||||
{
|
||||
if ($i == 0) // First entry
|
||||
{
|
||||
$usertodo=new User($db);
|
||||
if ($value['id'] > 0)
|
||||
{
|
||||
$usertodo->fetch($value['id']);
|
||||
$object->userownerid = $usertodo->id;
|
||||
}
|
||||
$object->usertodo = $usertodo;
|
||||
if ($value['id'] > 0) $usertodo->fetch($value['id']);
|
||||
$object->transparency = (GETPOST("transparency")=='on'?1:0);
|
||||
}
|
||||
|
||||
@ -236,13 +230,7 @@ if ($action == 'add')
|
||||
|
||||
if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||
{
|
||||
$userdone=new User($db);
|
||||
if ($_POST["doneby"] > 0)
|
||||
{
|
||||
$userdone->fetch($_POST["doneby"]);
|
||||
$object->userdoneid = $userdone->id;
|
||||
}
|
||||
$object->userdone = $userdone;
|
||||
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int");
|
||||
}
|
||||
|
||||
$object->note = trim($_POST["note"]);
|
||||
@ -263,7 +251,7 @@ if ($action == 'add')
|
||||
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
|
||||
|
||||
// Check parameters
|
||||
if (empty($object->usertodo))
|
||||
if (empty($object->userownerid))
|
||||
{
|
||||
$error++; $donotclearsession=1;
|
||||
$action = 'create';
|
||||
@ -409,12 +397,7 @@ if ($action == 'update')
|
||||
|
||||
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||
{
|
||||
$userdone=new User($db);
|
||||
if ($_POST["doneby"])
|
||||
{
|
||||
$userdone->fetch($_POST["doneby"]);
|
||||
}
|
||||
$object->userdone = $userdone;
|
||||
if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int");
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@ -428,7 +411,7 @@ if ($action == 'update')
|
||||
{
|
||||
$result=$cactioncomm->fetch(GETPOST('actioncode'));
|
||||
}
|
||||
if (empty($object->usertodo))
|
||||
if (empty($object->userownerid))
|
||||
{
|
||||
$error++; $donotclearsession=1;
|
||||
$action = 'edit';
|
||||
@ -812,9 +795,6 @@ if ($id > 0)
|
||||
if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
|
||||
if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
|
||||
|
||||
if ($object->userownerid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userownerid); $object->usertodo=$tmpuser; }
|
||||
if ($object->userdoneid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdoneid); $object->userdone=$tmpuser; }
|
||||
|
||||
|
||||
/*
|
||||
* Show tabs
|
||||
@ -1088,7 +1068,7 @@ if ($id > 0)
|
||||
$listofuserid=array();
|
||||
if (empty($donotclearsession))
|
||||
{
|
||||
if (is_object($object->usertodo)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
||||
if (is_object($object->userownerid)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
|
||||
if (! empty($object->userassigned)) // Now concat assigned users
|
||||
{
|
||||
// Restore array with key with same value than param 'id'
|
||||
@ -1115,7 +1095,12 @@ if ($id > 0)
|
||||
if ($conf->global->AGENDA_ENABLE_DONEBY)
|
||||
{
|
||||
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
|
||||
if ($object->userdoneid > 0) print $object->userdone->getNomUrl(1);
|
||||
if ($object->userdoneid > 0)
|
||||
{
|
||||
$tmpuser=new User($db);
|
||||
$tmpuser->fetch($object->userdoneid);
|
||||
print $tmpuser->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -99,10 +99,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
//$this->author = new stdClass();
|
||||
//$this->usermod = new stdClass();
|
||||
//$this->usertodo = new stdClass();
|
||||
//$this->userdone = new stdClass();
|
||||
$this->societe = new stdClass(); // deprecated
|
||||
$this->contact = new stdClass(); // deprecated
|
||||
}
|
||||
@ -142,8 +138,8 @@ class ActionComm extends CommonObject
|
||||
if ($this->elementtype=='commande') $this->elementtype='order';
|
||||
if ($this->elementtype=='contrat') $this->elementtype='contract';
|
||||
|
||||
$userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility
|
||||
$userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility
|
||||
$userownerid=$this->userownerid;
|
||||
$userdoneid=$this->userdoneid;
|
||||
|
||||
if (! $this->type_id || ! $this->type_code)
|
||||
{
|
||||
@ -371,10 +367,6 @@ class ActionComm extends CommonObject
|
||||
|
||||
$this->userownerid = $obj->fk_user_action;
|
||||
$this->userdoneid = $obj->fk_user_done;
|
||||
if (!is_object($this->usertodo)) $this->usertodo = new stdClass(); // For avoid warning
|
||||
$this->usertodo->id = $obj->fk_user_action; // deprecated
|
||||
if (!is_object($this->userdone)) $this->userdone = new stdClass(); // For avoid warning
|
||||
$this->userdone->id = $obj->fk_user_done; // deprecated
|
||||
$this->priority = $obj->priority;
|
||||
$this->fulldayevent = $obj->fulldayevent;
|
||||
$this->location = $obj->location;
|
||||
@ -530,7 +522,7 @@ class ActionComm extends CommonObject
|
||||
if ($this->fk_project < 0) $this->fk_project = 0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->percentage == 0 && $this->userdone->id > 0)
|
||||
if ($this->percentage == 0 && $this->userdoneid > 0)
|
||||
{
|
||||
$this->error="ErrorCantSaveADoneUserWithZeroPercentage";
|
||||
return -1;
|
||||
@ -538,8 +530,8 @@ class ActionComm extends CommonObject
|
||||
|
||||
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
|
||||
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
|
||||
$userownerid=($this->userownerid?$this->userownerid:((isset($this->usertodo->id) && $this->usertodo->id > 0) ? $this->usertodo->id : 0));
|
||||
$userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0));
|
||||
$userownerid=($this->userownerid?$this->userownerid:0);
|
||||
$userdoneid=($this->userdoneid?$this->userdoneid:0);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -100,8 +100,7 @@ if ($object->id > 0)
|
||||
$author->fetch($object->author->id);
|
||||
$object->author=$author;
|
||||
|
||||
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; }
|
||||
$object->fetch_contact();
|
||||
|
||||
$head=actions_prepare_head($object);
|
||||
|
||||
@ -195,7 +194,11 @@ if ($object->id > 0)
|
||||
|
||||
// Assigned to
|
||||
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||
if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1);
|
||||
if ($object->userownerid > 0)
|
||||
{
|
||||
$tmpuser=new User($object->userownerid);
|
||||
print $tmpuser->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
@ -491,12 +491,9 @@ if ($resql)
|
||||
$event->type_code=$obj->code;
|
||||
$event->libelle=$obj->label;
|
||||
$event->percentage=$obj->percent;
|
||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
//$event->usertodo->id=$obj->fk_user_action; // user id of owner
|
||||
//$event->userdone->id=$obj->fk_user_done; // deprecated
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
|
||||
@ -409,7 +409,6 @@ if ($resql)
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
//$event->userdone->id=$obj->fk_user_done; // deprecated
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
|
||||
@ -580,11 +580,14 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->durationp = 0;
|
||||
$actioncomm->punctual = 1;
|
||||
$actioncomm->percentage = -1; // Not applicable
|
||||
$actioncomm->contact = $contactforaction;
|
||||
$actioncomm->societe = $societeforaction;
|
||||
$actioncomm->author = $user; // User saving action
|
||||
$actioncomm->usertodo = $user; // User action is assigned to (owner of action)
|
||||
//$actioncomm->userdone = $user; // User doing action (deprecated, not used anymore)
|
||||
$actioncomm->contact = $contactforaction;
|
||||
$actioncomm->socid = $societeforaction->id;
|
||||
$actioncomm->contactid = $contactforaction->id;
|
||||
$actioncomm->authorid = $user->id; // User saving action
|
||||
$actioncomm->userownerid = $user->id; // Owner of action
|
||||
//$actioncomm->userdone = $user; // User doing action (not used anymore)
|
||||
//$actioncomm->userdoneid = $user->id; // User doing action (not used anymore)
|
||||
|
||||
$actioncomm->fk_element = $object->id;
|
||||
$actioncomm->elementtype = $object->element;
|
||||
|
||||
@ -289,15 +289,15 @@ function getActionComm($authentication,$id)
|
||||
'datem'=> dol_print_date($actioncomm->datem,'dayhourrfc'),
|
||||
'note'=> $actioncomm->note,
|
||||
'percentage'=> $actioncomm->percentage,
|
||||
'author'=> $actioncomm->author->id,
|
||||
'usermod'=> $actioncomm->usermod->id,
|
||||
'usertodo'=> $actioncomm->usertodo->id,
|
||||
'userdone'=> $actioncomm->userdone->id,
|
||||
'author'=> $actioncomm->authorid,
|
||||
'usermod'=> $actioncomm->usermodid,
|
||||
'usertodo'=> $actioncomm->userownerid,
|
||||
'userdone'=> $actioncomm->userdoneid,
|
||||
'priority'=> $actioncomm->priority,
|
||||
'fulldayevent'=> $actioncomm->fulldayevent,
|
||||
'location'=> $actioncomm->location,
|
||||
'socid'=> $actioncomm->societe->id,
|
||||
'contactid'=> $actioncomm->contact->id,
|
||||
'socid'=> $actioncomm->socid,
|
||||
'contactid'=> $actioncomm->contactid,
|
||||
'projectid'=> $actioncomm->fk_project,
|
||||
'fk_element'=> $actioncomm->fk_element,
|
||||
'elementtype'=> $actioncomm->elementtype);
|
||||
@ -437,8 +437,8 @@ function createActionComm($authentication,$actioncomm)
|
||||
$newobject->fk_project=$actioncomm['projectid'];
|
||||
$newobject->note=$actioncomm['note'];
|
||||
$newobject->contactid=$actioncomm['contactid'];
|
||||
$newobject->usertodo->id=$actioncomm['usertodo'];
|
||||
$newobject->userdone->id=$actioncomm['userdone'];
|
||||
$newobject->userownerid=$actioncomm['usertodo'];
|
||||
$newobject->userdoneid=$actioncomm['userdone'];
|
||||
$newobject->label=$actioncomm['label'];
|
||||
$newobject->percentage=$actioncomm['percentage'];
|
||||
$newobject->priority=$actioncomm['priority'];
|
||||
@ -532,8 +532,8 @@ function updateActionComm($authentication,$actioncomm)
|
||||
$object->contactid=$actioncomm['contactid'];
|
||||
$object->fk_project=$actioncomm['projectid'];
|
||||
$object->note=$actioncomm['note'];
|
||||
$object->usertodo->id=$actioncomm['usertodo'];
|
||||
$object->userdone->id=$actioncomm['userdone'];
|
||||
$object->userownerid=$actioncomm['usertodo'];
|
||||
$object->userdoneid=$actioncomm['userdone'];
|
||||
$object->label=$actioncomm['label'];
|
||||
$object->percentage=$actioncomm['percentage'];
|
||||
$object->priority=$actioncomm['priority'];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user