Creates new article variant.

@param array  $aParams   assigned parameters
@param string $sParentId parent article id

@return null
179399
protected function _createNewVariant($aParams = null, $sParentId = null)
    {
        // checkbox handling
        $aParams['oxarticles__oxactive'] = 0;

        // shopid
        $sShopID = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("actshop");
        $aParams['oxarticles__oxshopid'] = $sShopID;

        // varianthandling
        $aParams['oxarticles__oxparentid'] = $sParentId;

        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $oArticle->setEnableMultilang(false);
        $oArticle->assign($aParams);
        $oArticle->save();

        return $oArticle->getId();
    }
836834
public function replaceBy($aParams = array()) 
	{
		if (!isset($aParams['start'])) { $aParams['start'] = 0; }
		if (!isset($aParams['step'])) { $aParams['step'] = 1; }

		if (isset($aParams['name']) && isset($aParams['loop'])) {

			return '<?php for ('.$aParams['name'].' = '.$aParams['start'].' ; '.$aParams['name'].' <= '.$aParams['loop'].' ; '.$aParams['name'].' += '.$aParams['step'].') { ?>';
		}
	}
748091
protected function appendPsForUniqueClauseTo(&$sb, array &$params)
    {
        if ($this->value !== null) {
            $params[] = ['table' => $this->realtable, 'column' => $this->column, 'value' => $this->value];
            $bindParam = ':p' . count($params);
            $sb .= str_replace('?', $bindParam, $this->clause);
        } else {
            $sb .= (stripos($this->clause, '= 0') !== false) ? '1=1' : '1<>1';
        }
    }
603172
static function replaceParameters(array $paramsInfo, array $params): array {
        if(\count($params) !== \count($paramsInfo)) {
            throw new \Plasma\Exception('Insufficient amount of parameters passed, expected '.\count($paramsInfo).', got '.\count($params));
        }
        
        $realParams = array();
        $pos = (\array_key_exists(0, $params) ? 0 : 1);
        
        foreach($paramsInfo as $param) {
            $key = ($param[0] === ':' ? $param : ($pos++));
            
            if(!\array_key_exists($key, $params)) {
                throw new \Plasma\Exception('Missing parameter with key "'.$key.'"');
            }
            
            $realParams[] = $params[$key];
        }
        
        return $realParams;
    }
320458
function setRdate( $rdates, $params=FALSE ) {
    $input = array();
    $input['params'] = $this->_setParams( $params, array( 'VALUE' => 'DATE-TIME' ));
    $this->_existRem( $input['params'], 'VALUE', 'PERIOD' );
    $parno = ( isset( $input['params']['TZID'] )) ? 6 : null;
    $parno = ( !$parno ) ? $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME', 7 ) : null;
    $parno = ( !$parno ) ? $this->_existRem( $input['params'], 'VALUE', 'DATE', 3 ) : 6;
    $this->_existRem( $input['params'], 'VALUE', 'DATE-TIME' );
    foreach( $rdates as $theRdate ) {
 //   echo 'setRdate in '; print_r ( $theRdate ); echo "<br />\n"; // test ##
      $inputa = null;
      if( is_array( $theRdate )) {
        if(( 2 == count( $theRdate )) &&
             array_key_exists( '0', $theRdate ) &&
             array_key_exists( '1', $theRdate ) &&
            !array_key_exists( 'timestamp', $theRdate )) { // PERIOD
          foreach( $theRdate as $rix => $rPeriod ) {
 //   echo 'setRdate i2 '; print_r ( $rPeriod ); echo "<br />\n"; // test ##
            if( is_array( $rPeriod )) {
 //   echo 'setRdate i3 '; print_r ( $rPeriod ); echo "<br />\n"; // test ##
              if (( 1 == count( $rPeriod )) &&
                  ( 8 <= strlen( reset( $rPeriod )))) { // text-date
 //   echo 'setRdate i4 '; print_r ( $rPeriod ); echo "<br />\n"; // test ##
                $inputab       = $this->_date_time_string( reset( $rPeriod ), $parno );
                if ( isset( $input['params']['TZID'] ))
                  $inputab['tz'] = (string) $input['params']['TZID'];
                elseif( isset( $inputab['tz'] ))
                  $inputab['tz'] = (string) $inputab['tz'];
                else
                  unset( $inputab['tz'] );
                $parno         = ( !isset( $parno )) ? count( $inputab ) : $parno;
                if(( 7 == $parno ) && !isset( $inputab['tz'] ))
                  $inputab['tz'] = 'Z';
                if( isset( $inputab['tz'] ))
                  $inputab['tz'] = (string) $inputab['tz'];
                $inputa[] = $inputab;
              }
              elseif (((3 == count( $rPeriod )) && ( $rix < 1 )) ||
                      ( 6 == count( $rPeriod )) ||
                      ( 7 == count( $rPeriod )) ||
                      ( array_key_exists( 'year', $rPeriod ))) { // date[-time] (only 1st rperiod)
                if( !isset( $parno ) && 3 < count( $rPeriod ))
                  $parno = 7;
                $inputab       = $this->_date_time_array( $rPeriod, $parno );
                if ( isset( $input['params']['TZID'] ))
                  $inputab['tz'] = (string) $input['params']['TZID'];
                elseif( isset( $inputab['tz'] ))
                  $inputab['tz'] = (string) $inputab['tz'];
                else
                  unset( $inputab['tz'] );
                $parno         = ( !isset( $parno )) ? count( $inputab ) : $parno;
                if(( 7 == $parno ) && !isset( $inputab['tz'] ))
                  $inputab['tz'] = 'Z';
                if( isset( $inputab['tz'] ))
                  $inputab['tz'] = (string) $inputab['tz'];
                $inputa[] = $inputab;
              }
              elseif( isset( $rPeriod['timestamp'] )) {   // timestamp
                $tz    = ( isset( $rPeriod['tz'] ))           ? ' '.$rPeriod['tz']           : null;
                $tz    = ( isset( $input['params']['TZID'] )) ? ' '.$input['params']['TZID'] : $tz;
                if( !isset( $parno )) $parno = ( !empty( $tz )) ? 7 : 6;
                $inputab = $this->_date_time_string( date( 'Y-m-d H:i:s', $rPeriod['timestamp'] ).$tz, $parno );
                if(( 7 == $parno ) && !isset( $inputab['tz'] ))
                  $inputab['tz'] = 'Z';
                if( isset( $inputab['tz'] ))
                  $inputab['tz'] = (string) $inputab['tz'];
                $inputa[] = $inputab;
              }
              else {                                       // array format duration
                $inputa[] = $this->_duration_array( $rPeriod );
              }
            }
            elseif(( 3 <= strlen( trim( $rPeriod ))) &&    // string format duration
                   ( in_array( $rPeriod{0}, array( 'P', '+', '-' )))) {
              if( 'P' != $rPeriod{0} )
                $rPeriod = substr( $rPeriod, 1 );
              $inputa[] = $this->_duration_string( $rPeriod );
            }
            elseif( 8 <= strlen( trim( $rPeriod ))) { // ex. 2006-08-03 10:12:18
              $tz    = ( isset( $input['params']['TZID'] )) ? ' '.$input['params']['TZID'] : '';
              $inputab       = $this->_date_time_string( $rPeriod.$tz, $parno );
              if ( isset( $input['params']['TZID'] ))
                $inputab['tz'] = (string) $input['params']['TZID'];
              elseif( isset( $inputab['tz'] ))
                $inputab['tz'] = (string) $inputab['tz'];
              else
                unset( $inputab['tz'] );
              $inputa[]      = $inputab;
              $parno         = ( !isset( $parno )) ? count( $inputab ) : $parno;
            }
          }
        }
        elseif ( array_key_exists( 'timestamp', $theRdate )) {   // timestamp
          $tz    = ( isset( $theRdate['tz'] ))          ? ' '.$theRdate['tz']          : null;
          $tz    = ( isset( $input['params']['TZID'] )) ? ' '.$input['params']['TZID'] : $tz;
          if( !isset( $parno )) $parno = ( !empty( $tz )) ? 7 : 6;
          $inputab = $this->_date_time_string( date( 'Y-m-d H:i:s', $theRdate['timestamp'] ).$tz, $parno );
          if(( 7 == $parno ) && !isset( $inputab['tz'] ))
            $inputab['tz'] = 'Z';
          if( isset( $inputab['tz'] ))
            $inputab['tz'] = (string) $inputab['tz'];
          $inputa = $inputab;
        }
        elseif (( in_array( count( $theRdate ), array( 3, 4, 6, 7 ))) ||
                ( array_key_exists( 'year', $theRdate ))) {  // date[-time]
          if( isset( $input['params']['TZID'] ))
            $theRdate['tz'] = $input['params']['TZID'];
          elseif( !isset( $theRdate['tz'] )) {
            if(( 7 == count( $theRdate )) && isset( $theRdate[6] )) {
              $theRdate['tz'] = $theRdate[6];
              unset( $theRdate[6] );
            }
            elseif(( 4 == count( $theRdate )) && isset( $theRdate[3] )) {
              $theRdate['tz'] = $theRdate[3];
              unset( $theRdate[3] );
            }
          }
          if( !isset( $parno ) && 3 < count( $theRdate ))
            $parno = ( isset( $theRdate['tz'] )) ? 7 : count( $theRdate );
          elseif( !isset( $parno ))
            $parno = 3;
          $inputa = $this->_date_time_array( $theRdate, $parno );
          if(( 7 == $parno ) && !isset( $inputa['tz'] ))
            $inputa['tz'] = 'Z';
          if( isset( $inputa['tz'] ))
            $inputa['tz'] = (string) $inputa['tz'];
        }
      }
      elseif( 8 <= strlen( trim( $theRdate ))) { // ex. 2006-08-03 10:12:18
        $inputa       = $this->_date_time_string( $theRdate, $parno );
        if( isset( $input['params']['TZID'] ))
          $inputa['tz'] = (string) $input['params']['TZID'];
        elseif( isset( $inputa['tz'] ))
          $inputa['tz'] = (string) $inputa['tz'];
        else
          unset( $inputa['tz'] );
        $parno = ( !isset( $parno )) ? count( $inputa ) : $parno;
        if(( 7 == $parno ) && !isset( $inputa['tz'] ))
          $inputa['tz'] = 'Z';
        if( isset( $inputa['tz'] ))
          $inputa['tz'] = (string) $inputa['tz'];
 //         echo 'setRdate inputa single string '; print_r ( $inputa ); echo "<br />\n"; // test ##
      }
      $input['value'][] = $inputa;
    }
    if( 0 < count( $input['value'] )) {
 //     echo 'setRdate ut 1 '; print_r ( $input ); echo "<br />\n"; // test ##
      if( 3 == $parno ) {
        $input['params']['VALUE'] = 'DATE';
        foreach( $input['value'] as $eix => $inputa )
          unset( $input['value'][$eix]['tz'] );
        unset( $input['params']['TZID'] );
      }
      if( empty( $input['value'][0]['tz'] ) ||
         ( $input['value'][0]['tz'] == 'Z' ))
        $dummy = TRUE;
      elseif( in_array($input['value'][0]['tz']{0}, array( '+', '-' )) &&
               ctype_digit( substr( $input['value'][0]['tz'], 1 )))
        $dummy = TRUE;
      elseif( ctype_digit( $input['value'][0]['tz'] ))
        $dummy = TRUE;
      elseif( isset( $input['value'][0]['tz'] )) {
        $input['params']['TZID'] = $input['value'][0]['tz'];
        foreach( $input['value'] as $eix => $inputa ) {
          if( !empty( $input['value'][0]['tz'] )   &&
               ( $input['value'][0]['tz'] != 'Z' ) &&
            ( !( in_array( $input['value'][0]['tz']{0}, array( '+', '-' )) &&
                 ctype_digit( substr( $input['value'][0]['tz'], 1 ))) &&
              !ctype_digit( $input['value'][0]['tz'] ) ) )
            unset( $input['value'][$eix]['tz'] );
        }
      }
      elseif( isset( $input['params']['TZID'] ))
        unset( $input['params']['TZID'] );

      $this->rdate[] = $input;
 //    echo 'setRdate ut 2 '; print_r ( $input ); echo "<br />\n"; // test ##
    }
  }
91062
public function setStatus(array $params)
	{
		if (!isset($params['identifier'])) {
			throw new MissingArgumentException('identifier');
		}

		if (!isset($params['status'])) {
			throw new MissingArgumentException('status');
		}

		return $this->post('set_status', $params);
	}
1308738
public static function GetRegisteredActiveVariantForCurrentSpot($sParentId)
    {
        $sShopVariantArticleId = false;
        if (array_key_exists(TdbShop::SESSION_ACTIVE_VARIANT_ARRAY, $_SESSION)) {
            $oGlobal = TGlobal::instance();
            $oExecutingModuleSpot = $oGlobal->GetExecutingModulePointer();
            if ($oExecutingModuleSpot) {
                $sSpotName = $oExecutingModuleSpot->sModuleSpotName;
                if (array_key_exists($sSpotName, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY]) && array_key_exists($sParentId, $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName])) {
                    $sShopVariantArticleId = $_SESSION[TdbShop::SESSION_ACTIVE_VARIANT_ARRAY][$sSpotName][$sParentId];
                }
            }
        }

        return $sShopVariantArticleId;
    }
292459
public function create($params = array())
    {
        $path = "/mandate_pdfs";
        if(isset($params['params'])) { 
            $params['body'] = json_encode(array($this->envelope_key => (object)$params['params']));
        
            unset($params['params']);
        }

        
        $response = $this->api_client->post($path, $params);
        

        return $this->getResourceForResponse($response);
    }
556869
public function createVariant(ParameterSet $parameterSet, $revolutions, $warmup, array $computedStats = [])
    {
        $variant = new Variant(
            $this,
            $parameterSet,
            $revolutions,
            $warmup,
            $computedStats
        );
        $this->variants[] = $variant;

        return $variant;
    }
42932
protected function save(array $parameters, $foreignId, $namespace = null)
    {

        if (empty($parameters)) {
            return true;
        }
        $where = ['user_id' => $this->userId, 'foreign_id' => $foreignId, 'namespace' => $namespace];

        foreach ($parameters as $fieldId => $fieldValue) {
            array_set($where, 'field_id', $fieldId);

            if ($this->isTabular($fieldValue)) {
                foreach ($fieldValue as $optionId) {
                    array_set($where, 'option_id', $optionId);
                    $model = $this->resolveModel($where);
                    $model->save();
                }
            } else {
                $model       = $this->resolveModel($where);
                $model->data = $fieldValue;
                $model->save();
            }
        }
    }
471206
public function administre($parametres = array(), $modeAffichage = 'liste')
    {
        $html          = "";
        $liensExternes = array();
        $nomTable      = '';
        if (isset($parametres['tableName']) && $parametres['tableName']!='') {
            $nomTable = $parametres['tableName'];
        }
        $dependances = array();
        switch ($nomTable) {
        case "rue":
            $liensExternes = array('idSousQuartier'=>array('externalLink'=>true, 'externalFieldPrimaryKey'=>'idSousQuartier', 'externalTable'=>'sousQuartier', 'externalFieldToDisplay'=>'nom'));
            break;

        case "ville":
            $liensExternes = array('idPays'=>array('externalLink'=>true, 'externalFieldPrimaryKey'=>'idPays', 'externalTable'=>'pays', 'externalFieldToDisplay'=>'nom'));
            break;

        case "quartier":
            $liensExternes = array('idVille'=>array('externalLink'=>true, 'externalFieldPrimaryKey'=>'idVille', 'externalTable'=>'ville', 'externalFieldToDisplay'=>'nom'));
            break;

        case "sousQuartier":
            $liensExternes = array('idQuartier'=>array('externalLink'=>true, 'externalFieldPrimaryKey'=>'idQuartier', 'externalTable'=>'quartier', 'externalFieldToDisplay'=>'nom'));
            break;

        case "source":
            $liensExternes  = array('idTypeSource'=>array('externalLink'=>true, 'externalFieldPrimaryKey'=>'idTypeSource', 'externalTable'=>'typeSource', 'externalFieldToDisplay'=>'nom'));
            $parametres     = array_merge($parametres, array('afficheMiseEnFormeLongText'=>true, 'displayWithBBCode'=>true, 'fieldsNotInBdd'=>array(0=>array('name'=>'uploadLogo', 'type'=>'uploadImageLiee', 'redimFilesAndSizesConfig'=>array(0=>array('taille'=>0, 'nomFichierDestinationParametre'=>"###bddField[idSource]###_original.jpg", 'repertoireDestination'=>$this->getCheminPhysique()."images/logosSources/"), 1=>array('taille'=>200, 'nomFichierDestinationParametre'=>"###bddField[idSource]###.jpg", 'repertoireDestination'=>$this->getCheminPhysique()."images/logosSources/")), 'valueParametrable'=>array('affichageParametre'=>"<img src='".$this->getUrlImage()."logosSources/###bddField[idSource]###.jpg' border=0>", "cheminFichierATesterPourAffichage"=>$this->getCheminPhysique()."images/logosSources/###bddField[idSource]###.jpg"))), 'afficheDependancesInIFrameUrl'=>$this->creerUrl('', 'listeAdressesFromSource', array('source'=>'###currentId###', 'submit'=>'Rechercher', 'noHeaderNoFooter'=>1, 'noDescription'=>1, 'modeAdmin'=>1))));
            $dependances[0] = array('table'=>'historiqueEvenement', 'champLie'=>'idSource', 'message'=>"il existe des dépendances au niveau de la table des évènements");
            $dependances[1] = array('table'=>'historiqueImage', 'champLie'=>'idSource', 'message'=>"il existe des dépendances au niveau de la table des images");
            break;

        case 'typeSource':
            $dependances[0] = array('table'=>'source', 'champLie'=>'idTypeSource', 'message'=>"il existe des dépendances au niveau de la table des sources");
            $parametres = array_merge($parametres, array('afficheDependancesInIFrameUrl'=>$this->creerUrl('', 'listeTypeSourceDependancesSourcesAdmin', array('idTypeSource'=>'###currentId###', 'noHeaderNoFooter'=>1))));
            break;
        }
        $generateur = new formGenerator();

        // est ce que l'on effectue d'abord une action ? (ajout modif suppression ?)
        if (isset($this->variablesPost['validationFormulaireAdministration'])) {

            // si le formulaire a ete validé
            // actions
            switch ($this->variablesPost['validationFormulaireAdministration']) {
            case 'modification':
                $generateur->modifier($parametres, $liensExternes);
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes, $dependances);
                break;
            case 'ajout':
                $generateur->ajouter($parametres, $liensExternes);
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes);
                break;
            case 'suppression':
                $generateur->supprimer($parametres, $liensExternes, $dependances);
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes, $dependances);
                break;
            case 'rechercheAdministration':
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes);
                break;
            case 'suppressionFromModifForm':
                $generateur->supprimerFromModifForm($parametres, $liensExternes, $dependances);
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes, $dependances);
                break;
            }
        } else {
            // affichage des formulaires
            switch ($modeAffichage) {
            case 'liste':
                $html .= $generateur->afficheFormulaireListe($parametres, $liensExternes, $dependances);
                break;

            case 'modification':
                $adresse = new archiAdresse();

                //$html.=$adresse->afficheFormulaireModificationElementAdresse($parametres);
                $html .= $generateur->afficheFormulaireModification($parametres, $liensExternes, $dependances);
                break;

            case 'ajout':
                $html .= $generateur->afficheFormulaireAjout($parametres, $liensExternes);
                break;
            }
        }
        return $html;
    }
1077212
protected function addAdditionData(array $params, array $options)
    {
        if (isset($options['application']) && ctype_digit((string) $options['application'])) {
            $params['sponsor_id'] = (int) $options['application'];
        }

        if (isset($options['notify_url'])) {
            $params['notification_url'] = $options['notify_url'];
        }

        return $params;
    }
185158
public function create(array $params)
	{
		if (!isset($params['email'])) {
			throw new MissingArgumentException('email');
		}

		if (!isset($params['name'])) {
			throw new MissingArgumentException('name');
		}

		if (!isset($params['domain'])) {
			throw new MissingArgumentException('domain');
		}

		return $this->post('app/create', $params);
	}
114860
public function ajouterEtapeParcours($params = array())
    {
        if (isset($this->variablesPost['idEvenementGroupeAdresse']) && $this->variablesPost['idEvenementGroupeAdresse']!='') {
            // recuperation de la position courante
            $reqPos    = "SELECT idEtape FROM etapesParcoursArt WHERE idParcours = '".$this->variablesPost['idParcours']."'";
            $resPos    = $this->connexionBdd->requete($reqPos);
            $nbEtapes  = mysql_num_rows($resPos);
            $position  = $nbEtapes+1;
            $reqInsert = "INSERT INTO etapesParcoursArt (idParcours,idEvenementGroupeAdresse,position,commentaireEtape) VALUES ('".$this->variablesPost['idParcours']."','".$this->variablesPost['idEvenementGroupeAdresse']."','".$position."',\"".mysql_real_escape_string($this->variablesPost['commentaireEtape'])."\")";
            $resInsert = $this->connexionBdd->requete($reqInsert);
            $this->enregistrerOrdresEtapes();
        }
    }
900220
public function create($issueId, array $params = [])
    {
        $defaults = [
            'relation_type' => 'relates',
            'issue_to_id' => null,
            'delay' => null,
        ];

        $params = $this->sanitizeParams($defaults, $params);

        $params = json_encode(['relation' => $params]);

        return json_decode($this->post('/issues/'.urlencode($issueId).'/relations.json', $params), true);
    }
823545
public function copyArticle($sOldId = null, $sNewId = null, $sParentId = null)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $sOldId = $sOldId ? $sOldId : $this->getEditObjectId();
        $sNewId = $sNewId ? $sNewId : \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID();

        $oArticle = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
        $oArticle->init('oxarticles');
        if ($oArticle->load($sOldId)) {
            if ($myConfig->getConfigParam('blDisableDublArtOnCopy')) {
                $oArticle->oxarticles__oxactive->setValue(0);
                $oArticle->oxarticles__oxactivefrom->setValue(0);
                $oArticle->oxarticles__oxactiveto->setValue(0);
            }

            // setting parent id
            if ($sParentId) {
                $oArticle->oxarticles__oxparentid->setValue($sParentId);
            }

            // setting oxinsert/oxtimestamp
            $iNow = date('Y-m-d H:i:s', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime());
            $oArticle->oxarticles__oxinsert = new \OxidEsales\Eshop\Core\Field($iNow);

            // mantis#0001590: OXRATING and OXRATINGCNT not set to 0 when copying article
            $oArticle->oxarticles__oxrating = new \OxidEsales\Eshop\Core\Field(0);
            $oArticle->oxarticles__oxratingcnt = new \OxidEsales\Eshop\Core\Field(0);

            $oArticle->setId($sNewId);
            $oArticle->save();

            //copy categories
            $this->_copyCategories($sOldId, $sNewId);

            //atributes
            $this->_copyAttributes($sOldId, $sNewId);

            //sellist
            $this->_copySelectlists($sOldId, $sNewId);

            //crossseling
            $this->_copyCrossseling($sOldId, $sNewId);

            //accessoire
            $this->_copyAccessoires($sOldId, $sNewId);

            // #983A copying staffelpreis info
            $this->_copyStaffelpreis($sOldId, $sNewId);

            //copy article extends (longdescription)
            $this->_copyArtExtends($sOldId, $sNewId);

            //files
            $this->_copyFiles($sOldId, $sNewId);

            $this->resetContentCache();

            $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject();
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

            //copy variants
            $sQ = "select oxid from oxarticles where oxparentid = " . $oDb->quote($sOldId);
            $oRs = $oDb->select($sQ);
            if ($oRs !== false && $oRs->count() > 0) {
                while (!$oRs->EOF) {
                    $this->copyArticle($oRs->fields[0], $myUtilsObject->generateUid(), $sNewId);
                    $oRs->fetchRow();
                }
            }

            // only for top articles
            if (!$sParentId) {
                $this->setEditObjectId($oArticle->getId());

                //article number handling, warns for artnum duplicates
                $sFncParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('fnc');
                $sArtNumField = 'oxarticles__oxartnum';
                if ($myConfig->getConfigParam('blWarnOnSameArtNums') &&
                    $oArticle->$sArtNumField->value && $sFncParameter == 'copyArticle'
                ) {
                    $sSelect = "select oxid from " . $oArticle->getCoreTableName() .
                               " where oxartnum = " . $oDb->quote($oArticle->$sArtNumField->value) .
                               " and oxid != " . $oDb->quote($sNewId);

                    if ($oArticle->assignRecord($sSelect)) {
                        $this->_aViewData["errorsavingatricle"] = 1;
                    }
                }
            }
        }
    }
17428
protected function appendPsForUniqueClauseTo(&$sb, array &$params)
    {
        if (1 !== substr_count($this->column, '?')) {
            throw new InvalidClauseException(sprintf('Could not build SQL for expression "%s" because Criteria::RAW works only with a clause containing a single question mark placeholder', $this->column));
        }
        $params[] = ['table' => null, 'type' => $this->type, 'value' => $this->value];
        $sb .= str_replace('?', ':p' . count($params), $this->column);
    }