Skip to content

Commit 8301700

Browse files
committed
allow use of code: by setMyKey()
1 parent 0bb7cd4 commit 8301700

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/AbraFlexi/RO.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,29 +2456,35 @@ public function getAbraFlexiURL() {
24562456
* @return boolean
24572457
*/
24582458
public function setMyKey($myKeyValue) {
2459-
if (is_string($myKeyValue) && substr($myKeyValue, 0, 4) == 'ext:') {
2460-
if (empty($this->evidenceInfo) || ($this->evidenceInfo['extIdSupported'] == 'false')) {
2461-
$msg = sprintf(_('Evidence %s does not support extIDs'), $this->getEvidence());
2462-
$this->addStatusMessage($msg, 'warning');
2463-
if ($this->throwException) {
2464-
throw new Exception($msg, $this);
2465-
}
2466-
$res = false;
2467-
} else {
2468-
$extIds = $this->getDataValue('external-ids');
2469-
if (!empty($extIds) && count($extIds)) {
2470-
$extIds = array_combine($extIds, $extIds);
2459+
$res = false;
2460+
if (is_string($myKeyValue)) {
2461+
if (substr($myKeyValue, 0, 4) == 'ext:') {
2462+
if (empty($this->evidenceInfo) || ($this->evidenceInfo['extIdSupported'] == 'false')) {
2463+
$msg = sprintf(_('Evidence %s does not support extIDs'), $this->getEvidence());
2464+
$this->addStatusMessage($msg, 'warning');
2465+
if ($this->throwException) {
2466+
throw new Exception($msg, $this);
2467+
}
2468+
} else {
2469+
$extIds = $this->getDataValue('external-ids');
2470+
if (!empty($extIds) && count($extIds)) {
2471+
$extIds = array_combine($extIds, $extIds);
2472+
}
2473+
$extIds[$myKeyValue] = $myKeyValue;
2474+
$res = $this->setDataValue('external-ids', $extIds);
24712475
}
2472-
$extIds[$myKeyValue] = $myKeyValue;
2473-
$res = $this->setDataValue('external-ids', $extIds);
2476+
}
2477+
if (substr($myKeyValue, 0, 5) == 'code:') {
2478+
$this->unsetDataValue($this->getKeyColumn());
2479+
$res = $this->setDataValue('kod', $myKeyValue);
24742480
}
24752481
} else {
24762482
$res = $this->setDataValue($this->getKeyColumn(), $myKeyValue);
24772483
}
24782484
$this->updateApiURL();
24792485
return $res;
24802486
}
2481-
2487+
24822488
/**
24832489
* Set or get ignore not found pages flag
24842490
*

0 commit comments

Comments
 (0)