In version v8.3.0 I cannot import Work for a Ticket item, because in the Import Result field it says "ERROR idAssignment mandatory". (By the way I can import real work to Activities the same way.)
My csv look like this:
id;resource;project;type of item;element id;name;work;date;cost;
;"Username";"Projectname";"Ticket";197;RE: DI Oracle minus alternatíva;0.06;2020-01-27;0.00;
;"Username";"Projectname";"Activity";166;Megvalósítási koncepció elkészítése;1.25;2020-01-28;0.00;
If I dispatch work from the Ticket itself, then in the database table 'work' the idassignment will be null, which is ok, in my opinion.
Is it possible to somehow import real Work to Ticket from Import Data?
I think Work-->saveWork() doesn't handle this scenario. I mean adding new real work to a new ticket.
I am not sure what I have done doesn't make planning(calculating remaining work) wrong, but I added a few lines of code to saveWork to handle adding real work to a ticket, see below. I am also not sure if updateAssignment needs to be changed as well or not. Sorry if I am on the wrong track.
public function saveWork() {
if ($this->id) { // update existing work
$old=$this->getOld();
$result=$this->save();
$this->updateAssignment($this->work-$old->work);
return $result;
} else { // add new work
if (! $this->idResource and ! $this->idAssignment) { // idResource Mandatory
return "ERROR idResouce mandatory";
}
if (! $this->workDate) {
if ($this->day) {
$this->workDate=substr($this->day,0,4).'-'.substr($this->day,4,2).'-'.substr($this->day,6,2);
} else { // Work Date is mandatory
return "ERROR workDate mandatory";
}
}
if (!$this->idAssignment) { // unknown assignment
if ($this->refType and $this->refId) {
$crit=array('refType'=>$this->refType,'refId'=>$this->refId,'idResource'=>$this->idResource);
$ass=SqlElement::getSingleSqlElementFromCriteria('Assignment', $crit);
if ($ass->id) {
$this->idAssignment=$ass->id;
} else {
$crit=array('refType'=>$this->refType,'refId'=>$this->refId);
$tick=SqlElement::getSingleSqlElementFromCriteria('WorkElement', $crit);
if ($tick->id) {
$this->idWorkElement=$tick->id;
} else {
return "ERROR either idAssignment or idWorkElement is mandatory"; // could not retrieve assignment, so is mandatory
}
}
}
} else { // refType & refId can be retreived from assignment
$ass=new Assignment($this->idAssignment);
$this->refType=$ass->refType;
$this->refId=$ass->refId;
$this->idResource=$ass->idResource;
}
if ($this->idAssignment) {
$crit=array('idAssignment'=>$this->idAssignment,'workDate'=>$this->workDate); // retreive work for this assignment & day (assignment includes resource)
$work=SqlElement::getSingleSqlElementFromCriteria('Work', $crit);
}
else {
$crit=array('idWorkElement'=>$this->idWorkElement,'workDate'=>$this->workDate); // retreive work for this assignment & day (assignment includes resource)
$work=SqlElement::getSingleSqlElementFromCriteria('Work', $crit);
}
if ($work->id) {
$work->work+=$this->work;
$result=$work->save();
$work->updateAssignment($this->work);
return $result;
} else {
$this->setDates($this->workDate);
$result=$this->save();
$work->updateAssignment($this->work);
return $result;
}
}
}
En poursuivant votre navigation, vous acceptez le dépôt de cookies tiers destinés au bon fonctionnement et à la sécurisation du site (gestion de session, reCaptcha) et à une analyse statistique anonymisée des accès sur notre site (Google Analytics). Si vous vous inscrivez, les informations que vous fournirez ne seront jamais divulguées à un tiers sous quelque forme que ce soit. En savoir plus
Cookies settings
×
Functional Cookies
Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.
Session
Please login to see yours activities!
Other cookies
Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.