Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2022-08-31 20:39:43 +02:00
commit 80067393f1
9 changed files with 32 additions and 23 deletions

View File

@ -242,6 +242,9 @@
- move attributes for documents and folders on search page into own accordion - move attributes for documents and folders on search page into own accordion
- search page uses conversion mgr for preview images - search page uses conversion mgr for preview images
- backport export of search result from seeddms 6.0.x - backport export of search result from seeddms 6.0.x
- ldap authentication used 'uid' instead 'cn' in distinguished name if
the initial bind failed and a second bind with the user's credentials
is done
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.26 Changes in version 5.1.26

View File

@ -2129,8 +2129,8 @@ class SeedDMS_Core_DMS {
if(is_string($attribute)) if(is_string($attribute))
$attribute = array($attribute); $attribute = array($attribute);
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblFolderAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
} elseif(is_string($attribute)) { } else {
$searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND `tblFolderAttributes`.`value`='".$attribute."' AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)"; $searchAttributes[] = "EXISTS (SELECT NULL FROM `tblFolderAttributes` WHERE `tblFolderAttributes`.`attrdef`=".$attrdefid." AND (`tblFolderAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblFolderAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblFolderAttributes`.`folder`=`tblFolders`.`id`)";
} }
} else { } else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
@ -2217,12 +2217,14 @@ class SeedDMS_Core_DMS {
$searchQuery .= " ORDER BY `tblFolders`.`name` DESC"; $searchQuery .= " ORDER BY `tblFolders`.`name` DESC";
break; break;
case 'na': case 'na':
case 'n':
$searchQuery .= " ORDER BY `tblFolders`.`name`"; $searchQuery .= " ORDER BY `tblFolders`.`name`";
break; break;
case 'id': case 'id':
$searchQuery .= " ORDER BY `tblFolders`.`id` DESC"; $searchQuery .= " ORDER BY `tblFolders`.`id` DESC";
break; break;
case 'ia': case 'ia':
case 'i':
$searchQuery .= " ORDER BY `tblFolders`.`id`"; $searchQuery .= " ORDER BY `tblFolders`.`id`";
break; break;
default: default:
@ -2326,7 +2328,7 @@ class SeedDMS_Core_DMS {
$attribute = array($attribute); $attribute = array($attribute);
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)"; $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
} else } else
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentAttributes`.`value`='".$attribute."' AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)"; $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentAttributes` WHERE `tblDocumentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblDocumentAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblDocumentAttributes`.`document` = `tblDocuments`.`id`)";
} else { } else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
$kkll = []; $kkll = [];
@ -2349,7 +2351,7 @@ class SeedDMS_Core_DMS {
$attribute = array($attribute); $attribute = array($attribute);
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`content` = `tblDocumentContent`.`id`)"; $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value` like '%".$valueset[0].implode("%' OR `tblDocumentContentAttributes`.`value` like '%".$valueset[0], $attribute)."%') AND `tblDocumentContentAttributes`.`content` = `tblDocumentContent`.`id`)";
} else { } else {
$lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND `tblDocumentContentAttributes`.`value`='".$attribute."' AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)"; $lsearchAttributes[] = "EXISTS (SELECT NULL FROM `tblDocumentContentAttributes` WHERE `tblDocumentContentAttributes`.`attrdef`=".$attrdefid." AND (`tblDocumentContentAttributes`.`value`='".(is_array($attribute) ? implode("' OR `tblDocumentContentAttributes`.`value` = '", $attribute) : $attribute)."') AND `tblDocumentContentAttributes`.content = `tblDocumentContent`.id)";
} }
} else { } else {
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) { if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date && is_array($attribute)) {
@ -2571,12 +2573,14 @@ class SeedDMS_Core_DMS {
$orderbyQuery = " ORDER BY `tblDocuments`.`name` DESC"; $orderbyQuery = " ORDER BY `tblDocuments`.`name` DESC";
break; break;
case 'na': case 'na':
case 'n':
$orderbyQuery = " ORDER BY `tblDocuments`.`name`"; $orderbyQuery = " ORDER BY `tblDocuments`.`name`";
break; break;
case 'id': case 'id':
$orderbyQuery = " ORDER BY `tblDocuments`.`id` DESC"; $orderbyQuery = " ORDER BY `tblDocuments`.`id` DESC";
break; break;
case 'ia': case 'ia':
case 'i':
$orderbyQuery = " ORDER BY `tblDocuments`.`id`"; $orderbyQuery = " ORDER BY `tblDocuments`.`id`";
break; break;
default: default:

View File

@ -170,7 +170,7 @@ class SeedDMS_Download_Mgr {
$col += 4; $col += 4;
if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) { if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) {
foreach($this->extracols[$item->getID()] as $column) foreach($this->extracols[$item->getID()] as $column)
$sheet->setCellValueByColumnAndRow($col++, $i, $column); $sheet->setCellValueByColumnAndRow($col++, $i, is_array($column) ? implode("\n", $column) : $column );
} }
$i = max($l, $k); $i = max($l, $k);
$i++; $i++;

View File

@ -55,7 +55,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
/* Check if ldap base dn is set, and use ldap server if it is */ /* Check if ldap base dn is set, and use ldap server if it is */
if (isset($settings->_ldapBaseDN)) { if (isset($settings->_ldapBaseDN)) {
$ldapSearchAttribut = "uid="; $ldapSearchAttribut = "uid=";
$tmpDN = "cn=".$username.",".$settings->_ldapBaseDN; $tmpDN = "uid=".$username.",".$settings->_ldapBaseDN;
} }
/* Active directory has a different base dn */ /* Active directory has a different base dn */
@ -127,6 +127,7 @@ class SeedDMS_LdapAuthentication extends SeedDMS_Authentication {
if (!is_bool($search)) { if (!is_bool($search)) {
$info = ldap_get_entries($ds, $search); $info = ldap_get_entries($ds, $search);
if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) { if (!is_bool($info) && $info["count"]==1 && $info[0]["count"]>0) {
$user = $dms->addUser($username, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "", 3); $user = $dms->addUser($username, null, $info[0]['cn'][0], $info[0]['mail'][0], $settings->_language, $settings->_theme, "", 3);
} }

View File

@ -93,6 +93,7 @@ $(document).ready( function() {
$content .= "<th>".getMLText("attribute_value")."</th>\n"; $content .= "<th>".getMLText("attribute_value")."</th>\n";
$content .= "<th>".getMLText("attribute_count")."</th>\n"; $content .= "<th>".getMLText("attribute_count")."</th>\n";
$content .= "<th></th>\n"; $content .= "<th></th>\n";
$content .= "<th></th>\n";
$content .= "</tr></thead>\n<tbody>\n"; $content .= "</tr></thead>\n<tbody>\n";
$separator = $selattrdef->getValueSetSeparator(); $separator = $selattrdef->getValueSetSeparator();
foreach($res['frequencies'][$type] as $entry) { foreach($res['frequencies'][$type] as $entry) {

View File

@ -1960,11 +1960,11 @@ $(document).ready(function() {
} }
} /* }}} */ } /* }}} */
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */
echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix); echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix, $alwaysmultiple);
} /* }}} */ } /* }}} */
function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$content = ''; $content = '';
switch($attrdef->getType()) { switch($attrdef->getType()) {
@ -2010,7 +2010,7 @@ $(document).ready(function() {
$users = $dms->getAllUsers(); $users = $dms->getAllUsers();
if($users) { if($users) {
$allowempty = $attrdef->getMinValues() == 0; $allowempty = $attrdef->getMinValues() == 0;
$allowmultiple = $attrdef->getMultipleValues(); $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple;
$content .= "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">"; $content .= "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">";
if($allowempty) if($allowempty)
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
@ -2030,7 +2030,7 @@ $(document).ready(function() {
$groups = $dms->getAllGroups(); $groups = $dms->getAllGroups();
if($groups) { if($groups) {
$allowempty = $attrdef->getMinValues() == 0; $allowempty = $attrdef->getMinValues() == 0;
$allowmultiple = $attrdef->getMultipleValues(); $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple;
$content .= "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_group")."\">"; $content .= "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_group")."\">";
if($allowempty) if($allowempty)
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
@ -2049,13 +2049,13 @@ $(document).ready(function() {
if($valueset = $attrdef->getValueSetAsArray()) { if($valueset = $attrdef->getValueSetAsArray()) {
$content .= "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\"/>"; $content .= "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\"/>";
$content .= "<select id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]"; $content .= "<select id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]";
if($attrdef->getMultipleValues()) { if($attrdef->getMultipleValues() || $alwaysmultiple) {
$content .= "[]\" multiple"; $content .= "[]\" multiple";
} else { } else {
$content .= "\" data-allow-clear=\"true\""; $content .= "\" data-allow-clear=\"true\"";
} }
$content .= "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." class=\"chzn-select\" data-placeholder=\"".getMLText("select_value")."\">"; $content .= "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." class=\"chzn-select\" data-placeholder=\"".getMLText("select_value")."\">";
if(!$attrdef->getMultipleValues()) { if(!$attrdef->getMultipleValues() && !$alwaysmultiple) {
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
} }
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array();

View File

@ -79,7 +79,7 @@ $('.folderselect').click(function(ev) {
$finfo = finfo_open(FILEINFO_MIME_TYPE); $finfo = finfo_open(FILEINFO_MIME_TYPE);
while (false !== ($entry = $d->read())) { while (false !== ($entry = $d->read())) {
if($entry != '..' && $entry != '.') { if($entry != '..' && $entry != '.') {
if($showfolders == 0 && !is_dir($dir.'/'.$entry)) { if($showfolders == 0 && !is_dir($dir.'/'.$entry) && is_readable($dir.'/'.$entry)) {
$c++; $c++;
$subitem = array('label'=>'', 'attributes'=>array(array('title', getMLText('menu_upload_from_dropfolder')))); $subitem = array('label'=>'', 'attributes'=>array(array('title', getMLText('menu_upload_from_dropfolder'))));
if($folder) if($folder)

View File

@ -617,7 +617,7 @@ function typeahead() { /* {{{ */
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
} else } else
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)); $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true, '', true));
} }
} }
} }
@ -651,7 +651,7 @@ function typeahead() { /* {{{ */
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to')); $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
} else } else
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)); $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true, '', true));
} }
} }
} }

View File

@ -1917,11 +1917,11 @@ $(document).ready(function() {
} }
} /* }}} */ } /* }}} */
function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ function printAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */
echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix); echo self::getAttributeEditField($attrdef, $attribute, $fieldname, $norequire, $namepostfix, $alwaysmultiple);
} /* }}} */ } /* }}} */
function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='') { /* {{{ */ function getAttributeEditField($attrdef, $attribute, $fieldname='attributes', $norequire=false, $namepostfix='', $alwaysmultiple=false) { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$content = ''; $content = '';
switch($attrdef->getType()) { switch($attrdef->getType()) {
@ -1977,7 +1977,7 @@ $(document).ready(function() {
$users = $dms->getAllUsers(); $users = $dms->getAllUsers();
if($users) { if($users) {
$allowempty = $attrdef->getMinValues() == 0; $allowempty = $attrdef->getMinValues() == 0;
$allowmultiple = $attrdef->getMultipleValues(); $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple;
$content .= "<select class=\"form-control chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">"; $content .= "<select class=\"form-control chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_user")."\">";
if($allowempty) if($allowempty)
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
@ -1997,7 +1997,7 @@ $(document).ready(function() {
$groups = $dms->getAllGroups(); $groups = $dms->getAllGroups();
if($groups) { if($groups) {
$allowempty = $attrdef->getMinValues() == 0; $allowempty = $attrdef->getMinValues() == 0;
$allowmultiple = $attrdef->getMultipleValues(); $allowmultiple = $attrdef->getMultipleValues() || $alwaysmultiple;
$content .= "<select class=\"form-control chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_group")."\">"; $content .= "<select class=\"form-control chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")."\" name=\"".$fieldname."[".$attrdef->getId()."]".($allowmultiple ? '[]' : '')."\"".($allowmultiple ? " multiple" : "")." data-placeholder=\"".getMLText("select_group")."\">";
if($allowempty) if($allowempty)
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
@ -2016,13 +2016,13 @@ $(document).ready(function() {
if($valueset = $attrdef->getValueSetAsArray()) { if($valueset = $attrdef->getValueSetAsArray()) {
$content .= "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\"/>"; $content .= "<input type=\"hidden\" name=\"".$fieldname."[".$attrdef->getId()."]\" value=\"\"/>";
$content .= "<select class=\"form-control\" id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]"; $content .= "<select class=\"form-control\" id=\"".$fieldname."_".$attrdef->getId()."\" name=\"".$fieldname."[".$attrdef->getId()."]";
if($attrdef->getMultipleValues()) { if($attrdef->getMultipleValues() || $alwaysmultiple) {
$content .= "[]\" multiple"; $content .= "[]\" multiple";
} else { } else {
$content .= "\" data-allow-clear=\"true\""; $content .= "\" data-allow-clear=\"true\"";
} }
$content .= "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." class=\"form-control chzn-select\" data-placeholder=\"".getMLText("select_value")."\">"; $content .= "".((!$norequire && $attrdef->getMinValues() > 0) ? ' required="required"' : '')." class=\"form-control chzn-select\" data-placeholder=\"".getMLText("select_value")."\">";
if(!$attrdef->getMultipleValues()) { if(!$attrdef->getMultipleValues() && !$alwaysmultiple) {
$content .= "<option value=\"\"></option>"; $content .= "<option value=\"\"></option>";
} }
$objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array(); $objvalue = $attribute ? (is_object($attribute) ? $attribute->getValueAsArray() : $attribute) : array();