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

This commit is contained in:
Uwe Steinmann 2025-02-14 08:23:47 +01:00
commit ae34e29fed
2 changed files with 35 additions and 12 deletions

View File

@ -93,6 +93,12 @@ class SeedDMS_Download_Mgr {
*/
protected $filenames;
/**
* @var boolean $skipdefaultcols skip default columns, will only export extracols
* @access protected
*/
protected $skipdefaultcols;
function __construct($tmpdir = '') {
$this->tmpdir = $tmpdir;
$this->items = array();
@ -105,8 +111,13 @@ class SeedDMS_Download_Mgr {
$this->extraheader = array();
$this->folder_extraheader = array();
$this->filenames = array();
$this->skipdefaultcols = false;
}
public function setSkipDefaultCols($v) { /* {{{ */
$this->skipdefaultcols = (bool) $v;
} /* }}} */
public function addHeader($extraheader) { /* {{{ */
$this->extraheader = $extraheader;
} /* }}} */
@ -137,6 +148,7 @@ class SeedDMS_Download_Mgr {
$i = 1;
$col = 1;
if(!$this->skipdefaultcols)
foreach($this->header as $h)
$sheet->setCellValue([$col++, $i], $h);
foreach($this->extraheader as $h)
@ -151,13 +163,14 @@ class SeedDMS_Download_Mgr {
$approvalStatus = $item->getApprovalStatus();
$col = 1;
$l = $i; // Number of reviewers
$k = $i; // Number of approvers
if(!$this->skipdefaultcols) {
$sheet->setCellValue([$col++, $i], $document->getID());
$sheet->setCellValue([$col++, $i], $document->getName());
$sheet->setCellValue([$col++, $i], $document->getID()."-".$item->getOriginalFileName());
$sheet->setCellValue([$col++, $i], getOverallStatusText($status['status']));
$sheet->setCellValue([$col++, $i], $item->getVersion());
$l = $i;
$k = $i;
if($reviewStatus) {
foreach ($reviewStatus as $r) {
switch ($r["type"]) {
@ -181,7 +194,7 @@ class SeedDMS_Download_Mgr {
$tcol = $col;
$sheet->setCellValue([$tcol++, $l], $reqName);
$sheet->setCellValue([$tcol, $l], ($r['status']==1 || $r['status']==-1) ? \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(new DateTime($r['date'])) : null);
$sheet->getStyleByColumnAndRow($tcol++, $l)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
$sheet->getStyle([$tcol++, $l])->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
$sheet->setCellValue([$tcol++, $l], $r['comment']);
$sheet->setCellValue([$tcol++, $l], getReviewStatusText($r["status"]));
$l++;
@ -212,7 +225,7 @@ class SeedDMS_Download_Mgr {
$tcol = $col;
$sheet->setCellValue([$tcol++, $k], $reqName);
$sheet->setCellValue([$tcol, $k], ($r['status']==1 || $r['status']==-1) ? \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel(new DateTime($r['date'])) : null);
$sheet->getStyleByColumnAndRow($tcol++, $k)->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
$sheet->getStyle([$tcol++, $k])->getNumberFormat()->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME);
$sheet->setCellValue([$tcol++, $k], $r['comment']);
$sheet->setCellValue([$tcol++, $k], getApprovalStatusText($r["status"]));
$k++;
@ -220,6 +233,7 @@ class SeedDMS_Download_Mgr {
$k--;
}
$col += 4;
}
if(isset($this->extracols[$item->getID()]) && $this->extracols[$item->getID()]) {
foreach($this->extracols[$item->getID()] as $column)
$sheet->setCellValue([$col++, $i], is_array($column) ? implode("\n", $column) : $column );
@ -239,6 +253,7 @@ class SeedDMS_Download_Mgr {
$i = 1;
$col = 1;
if(!$this->skipdefaultcols)
foreach($this->folder_header as $h)
$sheet->setCellValue([$col++, $i], $h);
foreach($this->folder_extraheader as $h)
@ -251,8 +266,10 @@ class SeedDMS_Download_Mgr {
$dms = $folder->_dms;
$col = 1;
if(!$this->skipdefaultcols) {
$sheet->setCellValue([$col++, $i], $folder->getID());
$sheet->setCellValue([$col++, $i], $folder->getName());
}
if(isset($this->folder_extracols[$item->getID()]) && $this->folder_extracols[$item->getID()]) {
foreach($this->folder_extracols[$item->getID()] as $column)
$sheet->setCellValue([$col++, $i], is_array($column) ? implode("\n", $column) : $column );

View File

@ -729,9 +729,10 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
case 'select':
$allowempty = empty($conf['allow_empty']) ? false : $conf['allow_empty'];
$multiple = empty($conf['multiple']) ? false : $conf['multiple'];
$order = empty($conf['order']) ? '' : $conf['order'];
if(!empty($conf['options'])) {
$selections = empty($settings->_extensions[$extname][$confkey]) ? array() : explode(",", $settings->_extensions[$extname][$confkey]);
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".($multiple ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_option")."\" style=\"width: 100%;\">";
echo "<select class=\"chzn-select\"".($allowempty ? " data-allow-clear=\"true\"" : "").($order ? " order=\"".$order."\"" : "")." name=\"extensions[".$extname."][".$confkey."][]\"".($multiple ? " multiple" : "").(!empty($conf['size']) ? " size=\"".$conf['size']."\"" : "")." data-placeholder=\"".getMLText("select_option")."\" style=\"width: 100%;\">";
if(is_array($conf['options'])) {
$options = $conf['options'];
} elseif(is_string($conf['options']) && $conf['options'] == 'hook') {
@ -745,7 +746,12 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
echo "<option value=\"".$key."\"";
if(in_array($key, $selections))
echo " selected";
echo ">".htmlspecialchars(getMLText($extname.'_'.$opt, array(), $opt))."</option>";
if(is_array($opt)) {
echo " data-subtitle=\"".htmlspecialchars($opt['subtitle'])."\">".htmlspecialchars($opt['value']);
} else {
echo ">".htmlspecialchars(getMLText($extname.'_'.$opt, array(), $opt));
}
echo "</option>";
}
echo "</select>";
} elseif(!empty($conf['internal'])) {