Skip to content

Commit

Permalink
DMS geschuetzt WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenXE committed Dec 11, 2024
1 parent 4522de9 commit 4642d05
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 222 deletions.
37 changes: 7 additions & 30 deletions phpwf/plugins/class.yui.php
Original file line number Diff line number Diff line change
Expand Up @@ -4215,14 +4215,14 @@ function TableSearch($parsetarget, $name, $callback = "show", $generic_sql = "",

$sortmodus = $this->TableSearchFilter($name, 1, 'sortmodus', 0,0, 'checkbox');
// headings
$heading = array('','','','Titel', 'Stichwort', 'Version','Größe', 'Ersteller','Version','Datum','Sortierung','Menü');
$width = array('1%','1%','10','40%', '15%', '5%','10%','15%', '10%', '10%','15%', '10%','5%','1%');
$findcols = array('open','d.id','d.id',"CONCAT(d.titel,' ',v.dateiname)", 's.subjekt', 'v.version',"if(v.size!='',if(v.size > 1024*1024,CONCAT(ROUND(v.size/1024/1024,2),' MB'),CONCAT(ROUND(v.size/1024,2),' KB')),'')", 'v.ersteller','v.bemerkung','v.datum', 's.sort','s.id');
$heading = array('','','','Titel', 'Stichwort', 'Version','Größe', 'Ersteller','Version','Datum','Sortierung','Geschützt','Menü');
$width = array('1%','1%','10','40%', '15%', '5%','10%','15%', '10%', '10%','15%', '10%','5%','1%','1%');
$findcols = array('open','d.id','d.id',"CONCAT(d.titel,' ',v.dateiname)", 's.subjekt', 'v.version',"if(v.size!='',if(v.size > 1024*1024,CONCAT(ROUND(v.size/1024/1024,2),' MB'),CONCAT(ROUND(v.size/1024,2),' KB')),'')", 'v.ersteller','v.bemerkung','v.datum', 's.sort','d.geschuetzt','s.id');
$searchsql = array('d.titel', 's.subjekt', 'v.version',"if(v.size!='',if(v.size > 1024*1024,CONCAT(ROUND(v.size/1024/1024,2),' MB'),CONCAT(ROUND(v.size/1024,2),' KB')),'')", 'v.ersteller','v.bemerkung','v.dateiname',"DATE_FORMAT(v.datum, '%d.%m.%Y')");

$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap><a href=\"#\" onclick=editdatei(%value%,\"$cmd\")><img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a>&nbsp;<a href=\"index.php?module=dateien&action=send&id=%value%\"><img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/download.svg\" border=\"0\"></a>&nbsp;<a href=\"#\" onclick=DeleteDialog(\"index.php?module=dateien&action=delete&cmd=".urlencode($objekt)."&id=%value%\")><img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\" ></a></td></tr></table>";
$menucol = 11;
$alignright=array(6,7,11);
$menucol = 12;
$alignright=array(6,7,11,12);

if(!function_exists('imagejpeg'))
{
Expand All @@ -4235,7 +4235,7 @@ function TableSearch($parsetarget, $name, $callback = "show", $generic_sql = "",
$sql = "SELECT SQL_CALC_FOUND_ROWS d.id,'<img src=./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/details_open.png class=details>' as open,concat('<input type=\"checkbox\" id=\"auswahl_',d.id,'\" onchange=\"chauswahl();\" value=\"1\" />'),
$img,

if(d.titel!='',CONCAT(d.titel,'<br><i style=color:#999>',v.dateiname,'</i>'),v.dateiname), s.subjekt, v.version, if(v.size!='',if(v.size > 1024*1024,CONCAT(ROUND(v.size/1024/1024,2),' MB'),CONCAT(ROUND(v.size/1024,2),' KB')),''), v.ersteller, v.bemerkung, DATE_FORMAT(v.datum, '%d.%m.%Y'),s.sort,".($sortmodus?"s.id": "d.id")."
if(d.titel!='',CONCAT(d.titel,'<br><i style=color:#999>',v.dateiname,'</i>'),v.dateiname), s.subjekt, v.version, if(v.size!='',if(v.size > 1024*1024,CONCAT(ROUND(v.size/1024/1024,2),' MB'),CONCAT(ROUND(v.size/1024,2),' KB')),''), v.ersteller, v.bemerkung, DATE_FORMAT(v.datum, '%d.%m.%Y'),s.sort,d.geschuetzt,".($sortmodus?"s.id": "d.id")."
FROM `datei` AS `d`
INNER JOIN `datei_stichwoerter` AS `s` ON d.id=s.datei
LEFT JOIN (
Expand Down Expand Up @@ -14156,30 +14156,7 @@ function ChartAdd($color, $values) {
}
$werte = $werte . $values[$i + 1];
$this->app->Tpl->Add('CHARTS', "c.add('', '$color', [ $werte]);");
}

function DateiUploadNeuVersion($parsetarget, $datei) {
$speichern = $this->app->Secure->GetPOST("speichern");
$module = $this->app->Secure->GetGET("module");
$action = $this->app->Secure->GetGET("action");
$id = $this->app->Secure->GetGET("id");
if($id)$this->app->Tpl->Set('ID',$id);

// Get files here
if ($speichern != "") {
$retval = $this->FilesFromUploadtoDMS(null, null, $datei);
if ($retval !== true) {
$this->app->Tpl->Set('ERROR', implode(', ',$retval));
$this->app->erp->EnableTab("tabs-2");
} else {
header("Location: index.php?module=$module&action=$action&id=$id");
}
}

$this->app->Tpl->Set('STARTDISABLE', "<!--");
$this->app->Tpl->Set('ENDEDISABLE', "-->");
$this->app->Tpl->Parse($parsetarget, "datei_neudirekt.tpl");
}
}

function DateiUpload($parsetarget, $objekt, $parameter, $optionen = null) {
$speichern = $this->app->Secure->GetPOST("speichern");
Expand Down
11 changes: 11 additions & 0 deletions upgrade/data/db_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -31192,6 +31192,17 @@
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "geschuetzt",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "logdatei",
"Type": "timestamp",
Expand Down
41 changes: 17 additions & 24 deletions www/lib/class.erpapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -36386,23 +36386,6 @@ function DownloadFile($url,$label="tmp",$ending="")
return $tmpname;
}

function CreateDateiOhneInitialeVersion($titel,$beschreibung,$nummer,$ersteller,$without_log=false)
{
if(!$without_log)
{
$this->app->DB->Insert("INSERT INTO datei (id,titel,beschreibung,nummer,firma) VALUES
('','$titel','$beschreibung','$nummer','".$this->app->User->GetFirma()."')");
} else {
$this->app->DB->InsertWithoutLog("INSERT INTO datei (id,titel,beschreibung,nummer,firma) VALUES
('','$titel','$beschreibung','$nummer',1)");
}

$fileid = $this->app->DB->GetInsertID();
//$this->AddDateiVersion($fileid,$ersteller,$name,"Initiale Version",$datei,$without_log);

return $fileid;
}

function GetDMSPath($id, $path = '', $cache = false)
{
$ids = explode('_', $id, 2);
Expand Down Expand Up @@ -36500,7 +36483,7 @@ public function CheckFileSort($objekt, $parameter)
}
}

function CreateDateiWithStichwort($name, $titel,$beschreibung,$nummer,$datei, $ersteller ,$subjekt,$objekt,$parameter, $path = "",$without_log=false)
function CreateDateiWithStichwort($name, $titel,$beschreibung,$nummer,$datei, $ersteller ,$subjekt,$objekt,$parameter, $path = "",$without_log=false,$geschuetzt=null)
{
$dateien = $this->app->DB->SelectArr("SELECT dv.datei, dv.id FROM datei_stichwoerter ds
INNER JOIN datei d ON ds.datei = d.id AND ifnull(d.geloescht,0) = 0
Expand Down Expand Up @@ -36536,12 +36519,12 @@ function CreateDateiWithStichwort($name, $titel,$beschreibung,$nummer,$datei, $e
}
}
}
$fileid = $this->CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$without_log,$path);
$fileid = $this->CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$without_log,$path,$geschuetzt);
$this->AddDateiStichwort($fileid,$subjekt,$objekt,$parameter,$without_log);
return $fileid;
}

function CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$without_log=false,$path="")
function CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$without_log=false,$path="",$geschuetzt=null)
{
// Anführungszeichen in Unterstriche wandeln
$name = str_replace(['\\\'', '\\"', '\'', '"'], '_', $name);
Expand All @@ -36553,13 +36536,15 @@ function CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$witho
titel,
beschreibung,
nummer,
firma
firma,
geschuetzt
) VALUES (
'',
'".$this->app->DB->real_escape_string($titel)."',
'".$this->app->DB->real_escape_string($beschreibung)."',
'".$this->app->DB->real_escape_string($nummer)."',
'".$this->app->User->GetFirma()."'
'".$this->app->User->GetFirma()."',
'".$geschuetzt."'
)"
);
} else {
Expand All @@ -36568,13 +36553,15 @@ function CreateDatei($name,$titel,$beschreibung,$nummer,$datei,$ersteller,$witho
titel,
beschreibung,
nummer,
firma
firma,
geschuetzt
) VALUES (
'',
'".$this->app->DB->real_escape_string($titel)."',
'".$this->app->DB->real_escape_string($beschreibung)."',
'".$this->app->DB->real_escape_string($nummer)."',
1
1,
'".$geschuetzt."'
)
");
}
Expand Down Expand Up @@ -36771,6 +36758,12 @@ function DeleteDatei($id)
if(!$id){
return false;
}

$geschuetzt = $this->app->DB->SelectArr("SELECT geschuetzt FROM datei WHERE datei = '".$id."'");
if ($geschuetzt) {
return false;
}

$error = false;
$versionen = $this->app->DB->SelectArr("SELECT * FROM datei_version WHERE datei = '".$id."'");
if($versionen)
Expand Down
Loading

0 comments on commit 4642d05

Please sign in to comment.