Merge branch 'xmlrechnung'

This commit is contained in:
OpenXE 2025-01-04 13:38:12 +01:00
commit 234eb35c42
9 changed files with 258 additions and 229 deletions

View File

@ -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 = "<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'))
{
@ -4232,10 +4232,21 @@ url:strUrl, success:function(html){strReturn = html;}, async:false
}
// SQL statement
$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\" />'),
$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,
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 (
@ -14158,29 +14169,6 @@ source: "index.php?module=ajax&action=filter&filtername=' . $filter . $extendurl
$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");
$module = $this->app->Secure->GetGET("module");

View File

@ -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",

View File

@ -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)

View File

@ -85,7 +85,7 @@ $result = $result[0];
else
return -1;
$sql = "DELETE FROM datei WHERE (id='{$this->id}')";
$sql = "DELETE FROM datei WHERE (id='{$this->id}' AND geloescht <> 1)";
$this->app->DB->Delete($sql);
$this->id="";

View File

@ -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)

View File

@ -20,7 +20,7 @@
<table border="0" width="100%">
<tr>
<td width="" valign="" height="" bgcolor="" align="right" bordercolor="" classname="orange2" class="orange2">
<input type="submit" name="speichern" value="Speichern" />
<input type="submit" name="titel_beschreibung_speichern" value="Speichern" />
</td>
</tr>
<tr>

View File

@ -146,7 +146,6 @@ class Dateien {
$this->app->ActionHandler("protokoll","DateienProtokoll");
$this->app->ActionHandler("abschicken","DateienAbschicken");
$this->app->ActionHandler("freigabe","DateienFreigabe");
$this->app->ActionHandler("delete","DateienDelete");
$this->app->ActionHandler("listfreigegebene","DateienListFreigegebene");
$this->app->ActionHandler("kundeuebernehmen","DateienKundeuebernehmen");
$this->app->ActionHandler("versand","DateienVersand");
@ -186,8 +185,16 @@ class Dateien {
function DateienMinidetail()
{
$id = (int)$this->app->Secure->GetGET('id');
echo "<h2>Beschreibung:</h2>";
echo nl2br($this->app->DB->Select("SELECT beschreibung FROM datei WHERE id = '$id' LIMIT 1"));
$table = new EasyTable($this->app);
$table->Query("SELECT version,dateiname,datum,ersteller,bemerkung,id FROM datei_version WHERE datei='$id'",0,"");
$table->DisplayNew('VERSIONEN',"
<a href=\"index.php?module=dateien&action=send&fid=%value%&id=$id\"><img src=\"./themes/new/images/download.svg\" border=\"0\"></a>
");
$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();
}
@ -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 !="")
$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->Set('ENDEDISABLE', "-->");
$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");
}
}
}
}

View File

@ -240,7 +240,8 @@ class Rechnung extends GenRechnung
ersteller: $this->app->User->GetName(),
subjekt: 'rechnung',
objekt: 'rechnung',
parameter: $id
parameter: $id,
geschuetzt: true
);
}
} else {

View File

@ -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()
{