Merge branch 'master' into mirakl

This commit is contained in:
OpenXE 2024-08-25 20:16:38 +02:00
commit 4351fd7b9d
8 changed files with 473 additions and 450 deletions

View File

@ -270,7 +270,7 @@ class TOTPLoginService
$secret = $this->getTOTPSecret($userId);
}
$query = "otpauth://totp/{$label}?secret=" . $secret . '&issuer=Xentral&algorithm=SHA1&digits=6&period=30';
$query = "otpauth://totp/{$label}?secret=" . $secret . '&issuer=OpenXE&algorithm=SHA1&digits=6&period=30';
return $this->barcodeService->createQrCode($query);
}

View File

@ -148,8 +148,7 @@ $tables = [
'templatemessage',
'shopimport_auftraege',
'versandzentrum_log',
'api_request_response_log',
'shopimport_amazon_fees',
'api_request_response_log'
];
$minMemoryMb = 1;
$minMemory = $minMemoryMb * 1024 * 1024;
@ -623,34 +622,11 @@ if($shopExportLogCleanerActive && $tage > 0) {
$shopExportLogCleanerActive = $app->erp->Firmendaten('cleaner_shopexportlog');
$tage = (int)$app->erp->Firmendaten('cleaner_shopexportlog_tage');
$isToDelete = !empty($tableSchemaByTables['shopimport_amazon_fees'])
&& !empty($tableSchemaByTables['shopimport_amazon_fees']['todelete']);
if((!$shopExportLogCleanerActive || $tage <= 0 || $tage > 30) && $isToDelete) {
$shopExportLogCleanerActive = true;
if($tage <= 0 || $tage > 30) {
$tage = 30;
}
}
if($shopExportLogCleanerActive && $tage > 0) {
if($tage < 30) {
$tage = 30;
}
$app->DB->Delete(
sprintf(
"DELETE FROM `shopimport_amazon_fees`
WHERE DATE_SUB(NOW(), INTERVAL %d DAY) >= `zeitstempel` OR `zeitstempel` = '0000-00-00 00:00:00'",
$tage
)
);
$affectedRows = $app->DB->affected_rows();
if(!empty($tableSchemaByTables['shopimport_amazon_fees'])
&& ($tableSchemaByTables['shopimport_amazon_fees']['todelete'] > 0)) {
$tableSchemaByTables['shopimport_amazon_fees']['todelete'] -= $affectedRows;
}
if($affectedRows > 0 && !empty($optimize['shopimport_amazon_fees'])) {
$app->DB->Query('OPTIMIZE TABLE `shopimport_amazon_fees`');
unset($optimize['shopimport_amazon_fees']);
}
$app->DB->Update(
"UPDATE prozessstarter SET letzteausfuerhung=NOW(),mutex=1,mutexcounter=0 WHERE parameter = 'cleaner' AND aktiv = 1"
);

View File

@ -17873,6 +17873,23 @@ INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `ho
;
/* OpenXE 2024-02-03 für belegvorlagen */
/* OpenXE 2024-08-11 für TOTP */
INSERT INTO `hook`(`name`, `aktiv`, `parametercount`, `alias`, `description`) VALUES
('login_password_check_otp', 1, 3, '', '');
INSERT INTO `hook_register`(
`hook_action`, `function`, `aktiv`, `position`, `hook`, `module`, `module_parameter`) VALUES
( 0, 'TOTPCheckLogin', 1, 1, (SELECT id FROM hook WHERE NAME = 'login_password_check_otp' LIMIT 1), 'totp', 0);
/* OpenXE 2024-08-11 für TOTP */
/* OpenXE 2024-08-11 für Smarty shopimport */
INSERT INTO `hook` (`name`, `aktiv`, `parametercount`, `alias`, `description`) VALUES
('ImportAuftragBefore', 1, 4, '', '');
INSERT INTO `hook_register` (`hook_action`, `function`, `aktiv`, `position`, `hook`, `module`, `module_parameter`) VALUES
(0, 'ImportAuftragBeforeHook', 1, 1, (SELECT id FROM hook WHERE name = 'ImportAuftragBefore' LIMIT 1), 'onlineshops', 0);
/* OpenXE 2024-08-11 für Smarty shopimport */
/*
BelegPositionenButtons

View File

@ -616,7 +616,7 @@ class TemplateParser {
}
}
if(count($this->VARARRAY)>0)
if(!empty($this->VARARRAY))
foreach($this->VARARRAY as $key=>$value)
{
if($key!="")

View File

@ -36,7 +36,7 @@ class PLACEHOLDER_MODULECLASSNAME {
// columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8);
$findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS);
$findcols = array('PLACEHOLDER_ID_COLUMN','PLACEHOLDER_ID_COLUMN',PLACEHOLDER_SQL_COLUMNS); // use 'null' for non-searchable columns
$searchsql = array(PLACEHOLDER_SQL_COLUMNS);
$defaultorder = 1;
@ -60,6 +60,8 @@ class PLACEHOLDER_MODULECLASSNAME {
$count = "SELECT count(DISTINCT id) FROM PLACEHOLDER_MODULENAME WHERE $where";
// $groupby = "";
// echo($sql." WHERE ".$where." ".$groupby);
break;
}

View File

@ -62,7 +62,7 @@
{|Rechnungsdatum|}:
</td>
<td>
<input type="text" name="rechnungsdatum" id="rechnungsdatum" value="[RECHNUNGSDATUM]" size="20" [SAVEDISABLED]>
<input type="text" name="rechnungsdatum" id="rechnungsdatum" value="[RECHNUNGSDATUM]" size="20" [SAVEDISABLED] required>
</td>
</tr>
<tr>
@ -103,7 +103,7 @@
{|Zahlbar bis|}:
</td>
<td>
<input type="text" name="zahlbarbis" id="zahlbarbis" value="[ZAHLBARBIS]" size="20" [SAVEDISABLED]>
<input type="text" name="zahlbarbis" id="zahlbarbis" value="[ZAHLBARBIS]" size="20" [SAVEDISABLED]>&nbsp;<input type="number" name="zahlbarbis_tage" id="zahlbarbis_tage" size="4" [SAVEDISABLED]>&nbsp;Tage
</td>
</tr>
<tr>
@ -119,7 +119,7 @@
{|Skonto bis|}:
</td>
<td>
<input type="text" name="skontobis" id="skontobis" value="[SKONTOBIS]" size="20" [SAVEDISABLED]>
<input type="text" name="skontobis" id="skontobis" value="[SKONTOBIS]" size="20" [SAVEDISABLED]>&nbsp;<input type="number" name="skontobis_tage" id="skontobis_tage" size="4" [SAVEDISABLED]>&nbsp;Tage
</td>
</tr>
<tr>

View File

@ -104,7 +104,6 @@ class Totp
{
/** @var TOTPLoginService $totpLoginService */
$totpLoginService = $this->app->Container->get('TOTPLoginService');
if(!$totpLoginService->isTOTPEnabled($userID)){
return;
}
@ -120,7 +119,7 @@ class Totp
$secret = $tokenManager->generateBase32Secret();
$label = 'Xentral' . ' | ' . $this->app->erp->GetFirmaName();
$label = 'OpenXE' . ':' . $this->app->User->Getname();
$qr = $totpLoginService->generatePairingQrCode($this->app->User->GetID(), $label, $secret);

View File

@ -597,11 +597,26 @@ class Verbindlichkeit {
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$projekt,true);
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$kostenstelle."'");
} else {
$input['adresse'] = $this->app->erp->ReplaceLieferantennummer(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
$input['rechnungsdatum'] = $this->app->erp->ReplaceDatum(true,$input['rechnungsdatum'],true); // Parameters: Target db?, value, from form?
$input['eingangsdatum'] = $this->app->erp->ReplaceDatum(true,$input['eingangsdatum'],true); // Parameters: Target db?, value, from form?
$input['skontobis'] = $this->app->erp->ReplaceDatum(true,$input['skontobis'],true); // Parameters: Target db?, value, from form?
$input['zahlbarbis'] = $this->app->erp->ReplaceDatum(true,$input['zahlbarbis'],true); // Parameters: Target db?, value, from form?
if(!empty($input['zahlbarbis_tage'])) {
$zahlbarbis = date_create_from_format('Y-m-d', $input['rechnungsdatum']);
date_add($zahlbarbis,date_interval_create_from_date_string($input['zahlbarbis_tage']." days"));
$input['zahlbarbis'] = date_format($zahlbarbis, 'Y-m-d');
}
unset($input['zahlbarbis_tage']);
if(!empty($input['skontobis_tage'])) {
$skontobis = date_create_from_format('Y-m-d', $input['rechnungsdatum']);
date_add($skontobis,date_interval_create_from_date_string($input['skontobis_tage']." days"));
$input['skontobis'] = date_format($skontobis, 'Y-m-d');
}
unset($input['skontobis_tage']);
$input['adresse'] = $this->app->erp->ReplaceLieferantennummer(true,$input['adresse'],true); // Parameters: Target db?, value, from form?
$input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true);
$input['kostenstelle'] = $this->app->DB->Select("SELECT id FROM kostenstellen WHERE nummer = '".$input['kostenstelle']."'");
$input['bestellung'] = $this->app->erp->ReplaceBestellung(true,$input['bestellung'],true);
@ -1159,10 +1174,12 @@ class Verbindlichkeit {
$input['adresse'] = $this->app->Secure->GetPOST('adresse');
$input['rechnung'] = $this->app->Secure->GetPOST('rechnung');
$input['zahlbarbis'] = $this->app->Secure->GetPOST('zahlbarbis');
$input['zahlbarbis_tage'] = $this->app->Secure->GetPOST('zahlbarbis_tage');
$input['betrag'] = $this->app->Secure->GetPOST('betrag');
$input['waehrung'] = $this->app->Secure->GetPOST('waehrung');
$input['skonto'] = $this->app->Secure->GetPOST('skonto');
$input['skontobis'] = $this->app->Secure->GetPOST('skontobis');
$input['skontobis_tage'] = $this->app->Secure->GetPOST('skontobis_tage');
$input['projekt'] = $this->app->Secure->GetPOST('projekt');
$input['zahlungsweise'] = $this->app->Secure->GetPOST('zahlungsweise');
$input['eingangsdatum'] = $this->app->Secure->GetPOST('eingangsdatum');
@ -1739,6 +1756,7 @@ class Verbindlichkeit {
$betrag_brutto_pos_summe = 0;
$steuer_normal = 0;
$steuer_ermaessigt = 0;
$betrag_brutto_alternativ = 0;
/*
Normal: umsatzsteuer leer, steuersatz = leer
@ -1746,6 +1764,9 @@ class Verbindlichkeit {
Befreit: umsatzsteuer befreit, steursatz = -1
Individuell: umsatzsteuer leer, steuersatz = wert
*/
$betrag_brutto_pro_steuersatz = array();
foreach ($positionen as $position) {
$tmpsteuersatz = null;
@ -1758,23 +1779,31 @@ class Verbindlichkeit {
$position['steuertext_berechnet'] = $tmpsteuertext;
$position['steuererloes_berechnet'] = $erloes;
$betrag_netto += ($position['menge']*$position['preis']);
$betrag_brutto += ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100));
$betrag_brutto_pos_summe += round(($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100)),2);
$betrag_netto_pos = ($position['menge']*$position['preis']);
$betrag_netto += $betrag_netto_pos;
$betrag_brutto_pos = ($position['menge']*$position['preis'])*(1+($tmpsteuersatz/100));
$betrag_brutto += $betrag_brutto_pos;
$betrag_brutto_pos_summe += round($betrag_brutto_pos,2);
$betrag_netto_pro_steuersatz[$tmpsteuersatz] += round($betrag_netto_pos,2);
}
$result['betrag_netto'] = round($betrag_netto,2);
$result['betrag_brutto'] = round($betrag_brutto,2);
foreach ($betrag_netto_pro_steuersatz as $steuersatz => $betrag_netto) {
$betrag_brutto_alternativ += round($betrag_netto*(1+($steuersatz/100)),2);
}
if ($bruttobetrag_verbindlichkeit == round($betrag_brutto,2)) {
$result['pos_ok'] = true;
}
else if (round($bruttobetrag_verbindlichkeit,2) == round($betrag_brutto_pos_summe,2)) {
$result['pos_ok'] = true;
if (round($bruttobetrag_verbindlichkeit,2) != round($betrag_brutto_pos_summe,2)) {
$result['rundungsdifferenz'] = round(round($betrag_brutto,2) - $betrag_brutto_pos_summe,2);
}
$result['rundungsdifferenz'] = round($bruttobetrag_verbindlichkeit-$result['betrag_brutto'],2);
} else if (round($bruttobetrag_verbindlichkeit,2) == $betrag_brutto_alternativ) {
$result['pos_ok'] = true;
$result['rundungsdifferenz'] = round($bruttobetrag_verbindlichkeit-$result['betrag_brutto'],2);
}
}