Compare commits

...

1 Commits

Author SHA1 Message Date
v-dumas
fcea589a35 N°9699 - Enable AddMeToContact without write access on Ticket 2026-06-17 09:06:24 +02:00

View File

@@ -300,7 +300,7 @@
* *
* Add the current contact associated Person to the contacts_list of this Ticket * Add the current contact associated Person to the contacts_list of this Ticket
* No error if there is no associated Person or if the Person is already in the list * No error if there is no associated Person or if the Person is already in the list
* @return bool Return true on success * @return bool Return true if link was created, false otherwise
*/ */
</comment> </comment>
<static>false</static> <static>false</static>
@@ -314,12 +314,11 @@
$oLnk = MetaModel::NewObject('lnkContactToTicket'); $oLnk = MetaModel::NewObject('lnkContactToTicket');
$oLnk->Set('contact_id', $iPersonId); $oLnk->Set('contact_id', $iPersonId);
$oLnk->Set('ticket_id', $this->GetKey()); $oLnk->Set('ticket_id', $this->GetKey());
$oContactsSet->AddItem($oLnk); $oLnk->DBInsert();
$this->Set('contacts_list', $oContactsSet); return true;
$this->DBUpdate();
} }
} }
return true; return false;
}]]></code> }]]></code>
<arguments/> <arguments/>
</method> </method>
@@ -328,7 +327,7 @@
* *
* Remove the current user associated Person from the contacts_list of this Ticket * Remove the current user associated Person from the contacts_list of this Ticket
* No error if there is no associated Person or if the Person is not in the list * No error if there is no associated Person or if the Person is not in the list
* @return bool Return true * @return bool Return true if link was deleted, false otherwise
*/ */
</comment> </comment>
<static>false</static> <static>false</static>
@@ -340,14 +339,12 @@
$oContactsSet = $this->Get('contacts_list'); $oContactsSet = $this->Get('contacts_list');
foreach ($oContactsSet as $oLnk) { foreach ($oContactsSet as $oLnk) {
if ($oLnk->Get('contact_id') == $iPersonId) { if ($oLnk->Get('contact_id') == $iPersonId) {
$oContactsSet->RemoveItem($oLnk->GetKey()); $oLnk->DBDelete();
$this->Set('contacts_list', $oContactsSet);
$this->DBUpdate();
return true; return true;
} }
} }
} }
return true; return false;
}]]></code> }]]></code>
<arguments/> <arguments/>
</method> </method>