Skip to content

Commit

Permalink
Merge branch 'support/2.13.0' into support/2.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed May 24, 2024
2 parents 33f4a67 + 06d9089 commit e53bd6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion inc/abstracttarget.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,12 @@ public function prepareInputForClone($input) {
}

protected static function getTemplateByName(string $name): int {
global $DB;

$targetTemplateType = (new static())->getTemplateItemtypeName();
$targetTemplate = new $targetTemplateType();
$targetTemplate->getFromDBByCrit([
'name' => $name,
'name' => $DB->escape($name),
]);

if ($targetTemplate->isNewItem()) {
Expand Down
17 changes: 13 additions & 4 deletions inc/target_actor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ public static function import(PluginFormcreatorLinker $linker, $input = [], $con
$input['actor_value'] = $question->getID();
break;

case self::ACTOR_TYPE_PERSON:
case self::ACTOR_TYPE_AUTHORS_SUPERVISOR:
$input['actor_value'] = 0;
break;

case self::ACTOR_TYPE_PERSON:
$user = new User;
$field = $idKey == 'id' ? 'id' : 'name';
$users_id = plugin_formcreator_getFromDBByField($user, $field, $input['actor_value']);
Expand Down Expand Up @@ -278,12 +281,18 @@ public function export(bool $remove_uuid = false) : array {
case self::ACTOR_TYPE_GROUP_FROM_OBJECT:
case self::ACTOR_TYPE_TECH_GROUP_FROM_OBJECT :
$question = new PluginFormcreatorQuestion;
if ($question->getFromDB($target_actor['actor_value'])) {
$target_actor['actor_value'] = $question->fields['uuid'];
$field = $idToRemove == 'uuid' ? 'id' : 'uuid';
$question->getFromDBByCrit([
$field => $target_actor['actor_value']
]);
if (!$question->isNewItem()) {
$target_actor['actor_value'] = $idToRemove == 'uuid' ? $question->getID() : $question->fields['uuid'];
}
break;
case self::ACTOR_TYPE_PERSON:
case self::ACTOR_TYPE_AUTHORS_SUPERVISOR:
$target_actor['actor_value'] = 0;
break;
case self::ACTOR_TYPE_PERSON:
$user = new User;
$field = $idToRemove == 'uuid' ? 'id' : 'completename';
if ($user->getFromDB($target_actor['actor_value'])) {
Expand Down

0 comments on commit e53bd6b

Please sign in to comment.