diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php index 8b9a07ea..9dd3d631 100644 --- a/phpwf/plugins/class.yui.php +++ b/phpwf/plugins/class.yui.php @@ -4215,14 +4215,14 @@ url:strUrl, success:function(html){strReturn = html;}, async:false $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','Beschreibung','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','d.beschreibungbemerkung','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 = "
app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"> app->Conf->WFconf['defaulttheme']}/images/download.svg\" border=\"0\"> app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\" >
"; - $menucol = 11; - $alignright=array(6,7,11); + $menucol = 12; + $alignright=array(6,7,11,12); if(!function_exists('imagejpeg')) { @@ -4232,10 +4232,21 @@ url:strUrl, success:function(html){strReturn = html;}, async:false } // SQL statement - $sql = "SELECT SQL_CALC_FOUND_ROWS d.id,'app->Conf->WFconf['defaulttheme']}/images/details_open.png class=details>' as open,concat(''), - $img, - - if(d.titel!='',CONCAT(d.titel,'
',v.dateiname,''),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")." + $sql = "SELECT SQL_CALC_FOUND_ROWS + d.id, + 'app->Conf->WFconf['defaulttheme']}/images/details_open.png class=details>' as open, + CONCAT(''), + $img, + if(d.titel!='',CONCAT(d.titel,'
',v.dateiname,''),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, + d.beschreibung, + ".$this->app->erp->FormatDate("v.datum").", + 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 ( @@ -14156,30 +14167,7 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl } $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->Parse($parsetarget, "datei_neudirekt.tpl"); - } + } function DateiUpload($parsetarget, $objekt, $parameter, $optionen = null) { $speichern = $this->app->Secure->GetPOST("speichern"); diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json index 302ee6d6..df80f65f 100644 --- a/upgrade/data/db_schema.json +++ b/upgrade/data/db_schema.json @@ -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", diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 02d59d24..817644f9 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -36386,23 +36386,6 @@ function Firmendaten($field,$projekt="") 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); @@ -36500,7 +36483,7 @@ function Firmendaten($field,$projekt="") } } - 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 @@ -36536,12 +36519,12 @@ function Firmendaten($field,$projekt="") } } } - $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); @@ -36553,13 +36536,15 @@ function Firmendaten($field,$projekt="") 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 { @@ -36568,13 +36553,15 @@ function Firmendaten($field,$projekt="") 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."' ) "); } @@ -36771,6 +36758,12 @@ function Firmendaten($field,$projekt="") 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) diff --git a/www/objectapi/mysql/_gen/object.gen.datei.php b/www/objectapi/mysql/_gen/object.gen.datei.php index edb25b1c..04e491dc 100644 --- a/www/objectapi/mysql/_gen/object.gen.datei.php +++ b/www/objectapi/mysql/_gen/object.gen.datei.php @@ -1,155 +1,155 @@ -app = $app; - } - - public function Select($id) - { - if(is_numeric($id)) - $result = $this->app->DB->SelectArr("SELECT * FROM datei WHERE (id = '$id')"); - else - return -1; - -$result = $result[0]; - - $this->id=$result[id]; - $this->titel=$result[titel]; - $this->beschreibung=$result[beschreibung]; - $this->nummer=$result[nummer]; - $this->geloescht=$result[geloescht]; - $this->logdatei=$result[logdatei]; - $this->firma=$result[firma]; - } - - public function Create() - { - $sql = "INSERT INTO datei (id,titel,beschreibung,nummer,geloescht,logdatei,firma) - VALUES('','{$this->titel}','{$this->beschreibung}','{$this->nummer}','{$this->geloescht}','{$this->logdatei}','{$this->firma}')"; - - $this->app->DB->Insert($sql); - $this->id = $this->app->DB->GetInsertID(); - } - - public function Update() - { - if(!is_numeric($this->id)) - return -1; - - $sql = "UPDATE datei SET - titel='{$this->titel}', - beschreibung='{$this->beschreibung}', - nummer='{$this->nummer}', - geloescht='{$this->geloescht}', - logdatei='{$this->logdatei}', - firma='{$this->firma}' - WHERE (id='{$this->id}')"; - - $this->app->DB->Update($sql); - } - - public function Delete($id="") - { - if(is_numeric($id)) - { - $this->id=$id; - } - else - return -1; - - $sql = "DELETE FROM datei WHERE (id='{$this->id}')"; - $this->app->DB->Delete($sql); - - $this->id=""; - $this->titel=""; - $this->beschreibung=""; - $this->nummer=""; - $this->geloescht=""; - $this->logdatei=""; - $this->firma=""; - } - - public function Copy() - { - $this->id = ""; - $this->Create(); - } - - /** - Mit dieser Funktion kann man einen Datensatz suchen - dafuer muss man die Attribute setzen nach denen gesucht werden soll - dann kriegt man als ergebnis den ersten Datensatz der auf die Suche uebereinstimmt - zurueck. Mit Next() kann man sich alle weiteren Ergebnisse abholen - **/ - - public function Find() - { - //TODO Suche mit den werten machen - } - - public function FindNext() - { - //TODO Suche mit den alten werten fortsetzen machen - } - - /** Funktionen um durch die Tabelle iterieren zu koennen */ - - public function Next() - { - //TODO: SQL Statement passt nach meiner Meinung nach noch nicht immer - } - - public function First() - { - //TODO: SQL Statement passt nach meiner Meinung nach noch nicht immer - } - - /** dank dieser funktionen kann man die tatsaechlichen werte einfach - ueberladen (in einem Objekt das mit seiner klasse ueber dieser steht)**/ - - function SetId($value) { $this->id=$value; } - function GetId() { return $this->id; } - function SetTitel($value) { $this->titel=$value; } - function GetTitel() { return $this->titel; } - function SetBeschreibung($value) { $this->beschreibung=$value; } - function GetBeschreibung() { return $this->beschreibung; } - function SetNummer($value) { $this->nummer=$value; } - function GetNummer() { return $this->nummer; } - function SetGeloescht($value) { $this->geloescht=$value; } - function GetGeloescht() { return $this->geloescht; } - function SetLogdatei($value) { $this->logdatei=$value; } - function GetLogdatei() { return $this->logdatei; } - function SetFirma($value) { $this->firma=$value; } - function GetFirma() { return $this->firma; } - -} - -?> \ No newline at end of file +app = $app; + } + + public function Select($id) + { + if(is_numeric($id)) + $result = $this->app->DB->SelectArr("SELECT * FROM datei WHERE (id = '$id')"); + else + return -1; + +$result = $result[0]; + + $this->id=$result[id]; + $this->titel=$result[titel]; + $this->beschreibung=$result[beschreibung]; + $this->nummer=$result[nummer]; + $this->geloescht=$result[geloescht]; + $this->logdatei=$result[logdatei]; + $this->firma=$result[firma]; + } + + public function Create() + { + $sql = "INSERT INTO datei (id,titel,beschreibung,nummer,geloescht,logdatei,firma) + VALUES('','{$this->titel}','{$this->beschreibung}','{$this->nummer}','{$this->geloescht}','{$this->logdatei}','{$this->firma}')"; + + $this->app->DB->Insert($sql); + $this->id = $this->app->DB->GetInsertID(); + } + + public function Update() + { + if(!is_numeric($this->id)) + return -1; + + $sql = "UPDATE datei SET + titel='{$this->titel}', + beschreibung='{$this->beschreibung}', + nummer='{$this->nummer}', + geloescht='{$this->geloescht}', + logdatei='{$this->logdatei}', + firma='{$this->firma}' + WHERE (id='{$this->id}')"; + + $this->app->DB->Update($sql); + } + + public function Delete($id="") + { + if(is_numeric($id)) + { + $this->id=$id; + } + else + return -1; + + $sql = "DELETE FROM datei WHERE (id='{$this->id}' AND geloescht <> 1)"; + $this->app->DB->Delete($sql); + + $this->id=""; + $this->titel=""; + $this->beschreibung=""; + $this->nummer=""; + $this->geloescht=""; + $this->logdatei=""; + $this->firma=""; + } + + public function Copy() + { + $this->id = ""; + $this->Create(); + } + + /** + Mit dieser Funktion kann man einen Datensatz suchen + dafuer muss man die Attribute setzen nach denen gesucht werden soll + dann kriegt man als ergebnis den ersten Datensatz der auf die Suche uebereinstimmt + zurueck. Mit Next() kann man sich alle weiteren Ergebnisse abholen + **/ + + public function Find() + { + //TODO Suche mit den werten machen + } + + public function FindNext() + { + //TODO Suche mit den alten werten fortsetzen machen + } + + /** Funktionen um durch die Tabelle iterieren zu koennen */ + + public function Next() + { + //TODO: SQL Statement passt nach meiner Meinung nach noch nicht immer + } + + public function First() + { + //TODO: SQL Statement passt nach meiner Meinung nach noch nicht immer + } + + /** dank dieser funktionen kann man die tatsaechlichen werte einfach + ueberladen (in einem Objekt das mit seiner klasse ueber dieser steht)**/ + + function SetId($value) { $this->id=$value; } + function GetId() { return $this->id; } + function SetTitel($value) { $this->titel=$value; } + function GetTitel() { return $this->titel; } + function SetBeschreibung($value) { $this->beschreibung=$value; } + function GetBeschreibung() { return $this->beschreibung; } + function SetNummer($value) { $this->nummer=$value; } + function GetNummer() { return $this->nummer; } + function SetGeloescht($value) { $this->geloescht=$value; } + function GetGeloescht() { return $this->geloescht; } + function SetLogdatei($value) { $this->logdatei=$value; } + function GetLogdatei() { return $this->logdatei; } + function SetFirma($value) { $this->firma=$value; } + function GetFirma() { return $this->firma; } + +} + +?> diff --git a/www/pages/ajax.php b/www/pages/ajax.php index 87a764b3..7dc3993d 100644 --- a/www/pages/ajax.php +++ b/www/pages/ajax.php @@ -438,8 +438,11 @@ class Ajax { $objekt = $this->app->YUI->dateien_module_objekt_map($module); $ersteller = $this->app->DB->real_escape_string($this->app->User->GetName()); + + $geschuetzt = $this->app->DB->Select("SELECT geschuetzt FROM datei WHERE id = '".$id."'"); + $datei = $this->app->DB->SelectArr("SELECT d.id, s.id as sid FROM datei d LEFT JOIN datei_stichwoerter s ON d.id=s.datei LEFT JOIN datei_version v ON v.datei=d.id WHERE s.objekt LIKE '$objekt' AND s.parameter='$parameter' AND d.geloescht=0 AND d.id = '$id' LIMIT 1"); - if($datei) + if($datei && !$geschuetzt) { $sid = $datei[0]['sid']; if($subjekt && $sid) diff --git a/www/pages/content/datei.tpl b/www/pages/content/datei.tpl index 48bf4374..608c59b0 100644 --- a/www/pages/content/datei.tpl +++ b/www/pages/content/datei.tpl @@ -20,7 +20,7 @@ diff --git a/www/pages/dateien.php b/www/pages/dateien.php index f4c96cbd..aa5523e7 100644 --- a/www/pages/dateien.php +++ b/www/pages/dateien.php @@ -145,8 +145,7 @@ class Dateien { $this->app->ActionHandler("zahlung","DateienZahlung"); $this->app->ActionHandler("protokoll","DateienProtokoll"); $this->app->ActionHandler("abschicken","DateienAbschicken"); - $this->app->ActionHandler("freigabe","DateienFreigabe"); - $this->app->ActionHandler("delete","DateienDelete"); + $this->app->ActionHandler("freigabe","DateienFreigabe"); $this->app->ActionHandler("listfreigegebene","DateienListFreigegebene"); $this->app->ActionHandler("kundeuebernehmen","DateienKundeuebernehmen"); $this->app->ActionHandler("versand","DateienVersand"); @@ -185,10 +184,18 @@ class Dateien { function DateienMinidetail() { - $id = (int)$this->app->Secure->GetGET('id'); - echo "

Beschreibung:

"; - echo nl2br($this->app->DB->Select("SELECT beschreibung FROM datei WHERE id = '$id' LIMIT 1")); - $this->app->ExitXentral(); + $id = (int)$this->app->Secure->GetGET('id'); + $table = new EasyTable($this->app); + $table->Query("SELECT version,dateiname,datum,ersteller,bemerkung,id FROM datei_version WHERE datei='$id'",0,""); + $table->DisplayNew('VERSIONEN'," + + "); + + $table = new EasyTable($this->app); + $table->Query("SELECT subjekt,objekt,parameter FROM datei_stichwoerter WHERE datei='$id'",0,""); + $table->DisplayNew('STICHWOERTER',"Parameter","noAction"); + $this->app->Tpl->Output('datei_minidetail.tpl'); + $this->app->ExitXentral(); } function DateienHauptMenu() @@ -307,16 +314,21 @@ class Dateien { $id = $this->app->Secure->GetGET("id"); $this->DateienHauptMenu(); - $this->app->YUI->DateiUploadNeuVersion('NEUEVERSION',$id); - $speichern = $this->app->Secure->GetPOST("speichern"); - if($speichern !="") - { - $titel= $this->app->Secure->GetPOST("titel"); - $beschreibung= $this->app->Secure->GetPOST("beschreibung"); - - $this->app->DB->Update("UPDATE datei SET titel='$titel', beschreibung='$beschreibung' WHERE id='$id' LIMIT 1"); + $geschuetzt = $this->app->DB->Select("SELECT geschuetzt FROM datei WHERE id = '".$id."' LIMIT 1"); + if (!$geschuetzt) { + $this->DateiUploadNeuVersion('NEUEVERSION',$id); + $speichern = $this->app->Secure->GetPOST("titel_beschreibung_speichern"); + if($titel_beschreibung_speichern !="") + { + $titel= $this->app->Secure->GetPOST("titel"); + $beschreibung= $this->app->Secure->GetPOST("beschreibung"); + $this->app->DB->Update("UPDATE datei SET titel='$titel', beschreibung='$beschreibung' WHERE id='$id' LIMIT 1"); + } } + $this->app->Tpl->Set('STARTDISABLE', ""); + $this->app->Tpl->Parse('NEUEVERSION', "datei_neudirekt.tpl"); $titel = $this->app->DB->Select("SELECT titel FROM datei WHERE id='$id' LIMIT 1"); $beschreibung = $this->app->DB->Select("SELECT beschreibung FROM datei WHERE id='$id' LIMIT 1"); @@ -369,7 +381,7 @@ class Dateien { // Deletion of files removed, they only get marketd - $this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id'"); + $this->app->DB->Update("UPDATE datei SET geloescht=1 WHERE id='$id' AND NOT geschuetzt"); $refer = $_SERVER['HTTP_REFERER']; $this->app->Location->execute($refer); } @@ -382,5 +394,24 @@ class Dateien { $this->app->Tpl->Set('HEADING',"Dateien (Protokoll)"); $this->app->Tpl->Parse('PAGE',"dateien_protokoll.tpl"); } + + 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->app->YUI->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"); + } + } + } } diff --git a/www/pages/rechnung.php b/www/pages/rechnung.php index e6402373..39b986b4 100644 --- a/www/pages/rechnung.php +++ b/www/pages/rechnung.php @@ -240,7 +240,8 @@ class Rechnung extends GenRechnung ersteller: $this->app->User->GetName(), subjekt: 'rechnung', objekt: 'rechnung', - parameter: $id + parameter: $id, + geschuetzt: true ); } } else { diff --git a/www/pages/shopimporter_shopware.php b/www/pages/shopimporter_shopware.php index e042139b..3a32338a 100644 --- a/www/pages/shopimporter_shopware.php +++ b/www/pages/shopimporter_shopware.php @@ -2274,6 +2274,9 @@ class Shopimporter_Shopware extends ShopimporterBase return $anzahl; } +/* + Dysfunctional code: column `datei` does not exist in table `datei` + public function ImportDeleteFile() { $tmp = $this->CatchRemoteCommand('data'); @@ -2303,7 +2306,7 @@ class Shopimporter_Shopware extends ShopimporterBase } return 'ok'; } - +*/ public function ImportAddFileSubjekt() { @@ -2320,7 +2323,6 @@ class Shopimporter_Shopware extends ShopimporterBase return 'ok'; } - // delete an article public function ImportDeleteArticle() {
- +