/**
  * setCatLang sets the idcatlang for the current item. Should
  * only be called by the create function.
  * @param int $idcatlang idcatlang to set.
  */
 function setCatLang($idcatlang)
 {
     global $cfg;
     $allocations = new WorkflowAllocations();
     $allocations->select("idcatlang = '{$idcatlang}'");
     if ($allocations->next() !== false) {
         $this->lasterror = i18n("Category already has a workflow assigned", "workflow");
         return false;
     }
     $db = new DB_Contenido();
     $sql = "SELECT idcatlang FROM " . $cfg["tab"]["cat_lang"] . " WHERE idcatlang = '" . Contenido_Security::toInteger($idcatlang) . "'";
     $db->query($sql);
     if (!$db->next_record()) {
         $this->lasterror = i18n("Category doesn't exist, assignment failed", "workflow");
         return false;
     }
     parent::setField("idcatlang", $idcatlang);
     parent::store();
     return true;
 }
 /**
  * setPosition Sets the position for an item. Should only be 
  * called by the "swap" function
  * @param int $idposition The new position ID
  */
 function setPosition($idposition)
 {
     parent::setField("position", $idposition);
     parent::store();
     return true;
 }