Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e68da2368 | |||
| 0d6aca4e8c | |||
| 2bb0cbe599 | |||
| 339487b4d4 | |||
| 3f90e2d4f1 | |||
| b238b52fbf | |||
| 545dd7783c | |||
| f4ce1cf3b4 | |||
| 7bd12bddaa | |||
| b8e23b94d2 |
+138
-3
@@ -25,6 +25,7 @@ from werkzeug.routing import BuildError
|
|||||||
from jinja2 import TemplateNotFound
|
from jinja2 import TemplateNotFound
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
# Ensure imports work regardless of whether gunicorn starts in /app or /app/Web.
|
# Ensure imports work regardless of whether gunicorn starts in /app or /app/Web.
|
||||||
_CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
_CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
@@ -4123,10 +4124,13 @@ def student_card_barcode_download():
|
|||||||
c.setLineWidth(2)
|
c.setLineWidth(2)
|
||||||
c.line(x_pos, y_pos - 10*mm, x_pos + card_width, y_pos - 10*mm)
|
c.line(x_pos, y_pos - 10*mm, x_pos + card_width, y_pos - 10*mm)
|
||||||
|
|
||||||
|
|
||||||
|
school_name = cfg.get_school_info()
|
||||||
|
school_name = school_name["name"]
|
||||||
# "SCHÜLERAUSWEIS" text in header
|
# "SCHÜLERAUSWEIS" text in header
|
||||||
c.setFont("Helvetica-Bold", 9)
|
c.setFont("Helvetica-Bold", 9)
|
||||||
c.setFillColor(white)
|
c.setFillColor(white)
|
||||||
c.drawString(x_pos + 3*mm, y_pos - 6.5*mm, "SCHÜLERAUSWEIS")
|
c.drawString(x_pos + 3*mm, y_pos - 6.5*mm, f"SCHÜLERAUSWEIS - {str(school_name)}")
|
||||||
|
|
||||||
# Student name - large and bold
|
# Student name - large and bold
|
||||||
c.setFillColor(text_dark)
|
c.setFillColor(text_dark)
|
||||||
@@ -4150,7 +4154,7 @@ def student_card_barcode_download():
|
|||||||
c.setFillColor(text_dark)
|
c.setFillColor(text_dark)
|
||||||
c.setFont("Helvetica-Bold", 9)
|
c.setFont("Helvetica-Bold", 9)
|
||||||
c.drawString(x_pos + 3*mm, y_pos - 28*mm, card['Klasse'])
|
c.drawString(x_pos + 3*mm, y_pos - 28*mm, card['Klasse'])
|
||||||
|
|
||||||
# Right barcode section with border highlight
|
# Right barcode section with border highlight
|
||||||
barcode_x_start = x_pos + info_width + 1*mm
|
barcode_x_start = x_pos + info_width + 1*mm
|
||||||
c.setFillColor(accent_color)
|
c.setFillColor(accent_color)
|
||||||
@@ -4290,10 +4294,12 @@ def student_card_single_barcode_download(card_id):
|
|||||||
c.setLineWidth(2.5)
|
c.setLineWidth(2.5)
|
||||||
c.line(x_pos, y_pos - 10*mm, x_pos + card_width, y_pos - 10*mm)
|
c.line(x_pos, y_pos - 10*mm, x_pos + card_width, y_pos - 10*mm)
|
||||||
|
|
||||||
|
school_name = cfg.get_school_info()
|
||||||
|
school_name = school_name["name"]
|
||||||
# "SCHÜLERAUSWEIS" text in header
|
# "SCHÜLERAUSWEIS" text in header
|
||||||
c.setFont("Helvetica-Bold", 11)
|
c.setFont("Helvetica-Bold", 11)
|
||||||
c.setFillColor(white)
|
c.setFillColor(white)
|
||||||
c.drawString(x_pos + 4*mm, y_pos - 6.5*mm, "SCHÜLERAUSWEIS")
|
c.drawString(x_pos + 4*mm, y_pos - 6.5*mm, f"SCHÜLERAUSWEIS - {str(school_name)}")
|
||||||
|
|
||||||
# Student name - large and prominent
|
# Student name - large and prominent
|
||||||
c.setFillColor(text_dark)
|
c.setFillColor(text_dark)
|
||||||
@@ -9539,6 +9545,134 @@ def _fetch_from_open_library(clean_isbn):
|
|||||||
print(f"OpenLibrary Search error: {e}")
|
print(f"OpenLibrary Search error: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _fetch_from_isbn_de(clean_isbn):
|
||||||
|
"""
|
||||||
|
Source 4: isbn.de (Maßgeschneidertes Scraping basierend auf realem HTML)
|
||||||
|
Extrahiert alle Buchdaten inklusive Preise aus den Meta-Tags und der Sidebar.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
url = f"https://www.isbn.de/buch/{clean_isbn}"
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.get(url, headers=headers, timeout=5)
|
||||||
|
if response.status_code != 200:
|
||||||
|
return None
|
||||||
|
|
||||||
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
|
|
||||||
|
# 1. Titel aus Meta-Tags extrahieren (extrem zuverlässig)
|
||||||
|
title_meta = soup.find('meta', property='og:title')
|
||||||
|
title = title_meta.get('content', '').strip() if title_meta else None
|
||||||
|
if not title:
|
||||||
|
h1_elem = soup.find('h1')
|
||||||
|
title = h1_elem.text.strip() if h1_elem else "Unknown Title"
|
||||||
|
|
||||||
|
# Falls Fehler- oder Suchseite
|
||||||
|
if "nicht gefunden" in title.lower() or "suche" in title.lower():
|
||||||
|
return None
|
||||||
|
|
||||||
|
# --- Hilfsfunktion zum Parsen der .infotab-Sidebar-Struktur ---
|
||||||
|
def get_sidebar_value(keyword):
|
||||||
|
infotab = soup.find(class_='infotab')
|
||||||
|
if infotab:
|
||||||
|
for d in infotab.find_all('div'):
|
||||||
|
if d.text.strip().lower() == keyword.lower():
|
||||||
|
parent = d.parent
|
||||||
|
# Label vom Gesamttext abziehen, um nur den Wert zu erhalten
|
||||||
|
return parent.text.replace(d.text, '', 1).strip()
|
||||||
|
return None
|
||||||
|
|
||||||
|
# 2. Verlag holen
|
||||||
|
publisher = get_sidebar_value('verlag')
|
||||||
|
if not publisher:
|
||||||
|
publisher = "Unknown Publisher"
|
||||||
|
|
||||||
|
# 3. Erscheinungsdatum (Aus Meta-Tag oder Sidebar)
|
||||||
|
date_meta = soup.find('meta', property='og:book:release_date')
|
||||||
|
if date_meta and date_meta.get('content'):
|
||||||
|
published_date = date_meta.get('content', '').strip()
|
||||||
|
else:
|
||||||
|
published_date = get_sidebar_value('erschienen am')
|
||||||
|
|
||||||
|
if not published_date:
|
||||||
|
published_date = "Unknown Date"
|
||||||
|
|
||||||
|
# 4. Autor (Da Schulbuch-Workbooks oft keinen Einzelautor haben, kluger Fallback)
|
||||||
|
author_meta = soup.find('meta', property='og:book:author')
|
||||||
|
author = author_meta.get('content', '').strip() if author_meta else ""
|
||||||
|
if not author:
|
||||||
|
author = get_sidebar_value('autor') or get_sidebar_value('herausgeber')
|
||||||
|
|
||||||
|
if not author:
|
||||||
|
author = f"{publisher} Redaktion" if publisher != "Unknown Publisher" else "Unknown Author"
|
||||||
|
|
||||||
|
# 5. Seitenanzahl
|
||||||
|
page_count = get_sidebar_value('seiten') or get_sidebar_value('umfang')
|
||||||
|
if page_count:
|
||||||
|
match = re.search(r'\d+', page_count)
|
||||||
|
page_count = match.group(0) if match else "Unknown"
|
||||||
|
else:
|
||||||
|
page_count = "Unknown"
|
||||||
|
|
||||||
|
# 6. Beschreibung aus ID 'bookdesc' holen und Whitespace-Fluss säubern
|
||||||
|
description = "Keine Beschreibung verfügbar"
|
||||||
|
desc_div = soup.find(id='bookdesc')
|
||||||
|
if desc_div:
|
||||||
|
# Holt den Text inklusive aller Listenpunkte (li) und formatiert ihn sauber
|
||||||
|
description = " ".join(desc_div.text.split())
|
||||||
|
|
||||||
|
# 7. Cover-Bild (Nutzt hochauflösenden Link aus den Metas)
|
||||||
|
thumbnail = ""
|
||||||
|
img_meta = soup.find('meta', property='og:image')
|
||||||
|
if img_meta:
|
||||||
|
thumbnail = img_meta.get('content', '').strip()
|
||||||
|
else:
|
||||||
|
img_tag = soup.find('img', id='ISBNcover')
|
||||||
|
if img_tag:
|
||||||
|
thumbnail = img_tag.get('data-big') or img_tag.get('src')
|
||||||
|
|
||||||
|
if thumbnail and thumbnail.startswith('/'):
|
||||||
|
thumbnail = "https://www.isbn.de" + thumbnail
|
||||||
|
|
||||||
|
# 8. PREIS EXTRAHIEREN (Neu integriert)
|
||||||
|
price = None
|
||||||
|
# Option A: Aus dem standardisierten Meta-Tag extrahieren (Ergibt z.B. 12.25)
|
||||||
|
price_meta = soup.find('meta', property='product:price:amount')
|
||||||
|
if price_meta and price_meta.get('content'):
|
||||||
|
try:
|
||||||
|
price = float(price_meta.get('content').strip())
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Option B: Fallback über die Infotab-Sidebar (Falls Meta fehlt, filtert "12,25 €*" zu Float)
|
||||||
|
if price is None:
|
||||||
|
price_str = get_sidebar_value('preis')
|
||||||
|
if price_str:
|
||||||
|
# Findet Zahlen wie "12,25" oder "12.25"
|
||||||
|
match = re.search(r'\d+([.,]\d+)?', price_str)
|
||||||
|
if match:
|
||||||
|
try:
|
||||||
|
price = float(match.group(0).replace(',', '.'))
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return {
|
||||||
|
"title": title,
|
||||||
|
"authors": author,
|
||||||
|
"publisher": publisher,
|
||||||
|
"publishedDate": published_date,
|
||||||
|
"description": description,
|
||||||
|
"pageCount": page_count,
|
||||||
|
"price": price, # Gibt nun z.B. 12.25 als float zurück
|
||||||
|
"thumbnail": thumbnail,
|
||||||
|
"source": "isbn-de"
|
||||||
|
}
|
||||||
|
except Exception as e:
|
||||||
|
print(f"isbn.de Scraping error: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
@app.route('/fetch_book_info/<isbn>')
|
@app.route('/fetch_book_info/<isbn>')
|
||||||
def fetch_book_info(isbn):
|
def fetch_book_info(isbn):
|
||||||
"""
|
"""
|
||||||
@@ -9562,6 +9696,7 @@ def fetch_book_info(isbn):
|
|||||||
providers = [
|
providers = [
|
||||||
_fetch_from_google_books,
|
_fetch_from_google_books,
|
||||||
_fetch_from_lobid_germany,
|
_fetch_from_lobid_germany,
|
||||||
|
_fetch_from_isbn_de,
|
||||||
_fetch_from_open_library
|
_fetch_from_open_library
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def _active_record_query(extra_query=None):
|
|||||||
return base_query
|
return base_query
|
||||||
|
|
||||||
|
|
||||||
def add(date_start: str, date_end: str, time_span: list, slots: int, slot_lenght: int, user: str, mail: list=[], note:str="", calendar_enabled: bool=False):
|
def add(date_start: str, date_end: str, time_span: list, slots: int, slot_lenght: int, user: str, mail: list=[], note:str="", calendar_enabled: bool=False, title: str=""):
|
||||||
try:
|
try:
|
||||||
client = MongoClient(cfg.MONGODB_HOST, cfg.MONGODB_PORT)
|
client = MongoClient(cfg.MONGODB_HOST, cfg.MONGODB_PORT)
|
||||||
db = _get_tenant_db(client)
|
db = _get_tenant_db(client)
|
||||||
@@ -53,6 +53,7 @@ def add(date_start: str, date_end: str, time_span: list, slots: int, slot_lenght
|
|||||||
'user': user,
|
'user': user,
|
||||||
'mail': mail,
|
'mail': mail,
|
||||||
'note': note,
|
'note': note,
|
||||||
|
'title': title,
|
||||||
'calendar_enabled': bool(calendar_enabled),
|
'calendar_enabled': bool(calendar_enabled),
|
||||||
'slots_booked': [], # -> [(start_time, name), ...]the list gets there indexes as the slot 1-defined so is can be counted without an extra variable
|
'slots_booked': [], # -> [(start_time, name), ...]the list gets there indexes as the slot 1-defined so is can be counted without an extra variable
|
||||||
'Created': datetime.datetime.now(),
|
'Created': datetime.datetime.now(),
|
||||||
|
|||||||
@@ -15,3 +15,4 @@ openpyxl
|
|||||||
cryptography>=42.0.0
|
cryptography>=42.0.0
|
||||||
pywebpush
|
pywebpush
|
||||||
py-vapid>=1.9.0
|
py-vapid>=1.9.0
|
||||||
|
beautifulsoup4
|
||||||
@@ -28,11 +28,10 @@
|
|||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" id="tab-legal" data-bs-toggle="tab" data-bs-target="#pane-legal"
|
<button class="nav-link" id="tab-legal" data-bs-toggle="tab" data-bs-target="#pane-legal"
|
||||||
type="button" role="tab">Rechtsgrundlage</button>
|
type="button" role="tab">Rechtsgrundlage</button>
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- ── NOTICE ────────────────────────────────────────────────────── -->
|
<!-- ── NOTICE ────────────────────────────────────────────────────── -->
|
||||||
<div class="tab-pane fade" id="pane-notice" role="tabpanel">
|
<div class="tab-pane" id="pane-notice" role="tabpanel">
|
||||||
<div class="license-content">
|
<div class="license-content">
|
||||||
<h2>NOTICE – Urheberrechtliche Hinweise</h2>
|
<h2>NOTICE – Urheberrechtliche Hinweise</h2>
|
||||||
<p><strong>Invario Modul Suite</strong><br>Copyright © 2026 Invario UG</p>
|
<p><strong>Invario Modul Suite</strong><br>Copyright © 2026 Invario UG</p>
|
||||||
@@ -59,14 +58,14 @@
|
|||||||
|
|
||||||
<h4>Frontend / Laufzeit-Assets</h4>
|
<h4>Frontend / Laufzeit-Assets</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>html5-qrcode (MIT) © 2020-2025 Manoj Brahmbhatt (mebjas)</li>
|
<li>quagga2 (MIT) © 2014 Christoph Oberhofer, © 2019 Eric Blade and contributors</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /#pane-notice -->
|
</div><!-- /#pane-notice -->
|
||||||
|
|
||||||
<!-- ── DATENSCHUTZ ───────────────────────────────────────────────── -->
|
<!-- ── DATENSCHUTZ ───────────────────────────────────────────────── -->
|
||||||
<div class="tab-pane fade" id="pane-privacy" role="tabpanel">
|
<div class="tab-pane" id="pane-privacy" role="tabpanel">
|
||||||
<div class="license-content">
|
<div class="license-content">
|
||||||
<h2>Datenschutzerklärung (Privacy Policy)</h2>
|
<h2>Datenschutzerklärung (Privacy Policy)</h2>
|
||||||
|
|
||||||
@@ -108,7 +107,7 @@
|
|||||||
</div><!-- /#pane-privacy -->
|
</div><!-- /#pane-privacy -->
|
||||||
|
|
||||||
<!-- ── SICHERHEIT ────────────────────────────────────────────────── -->
|
<!-- ── SICHERHEIT ────────────────────────────────────────────────── -->
|
||||||
<div class="tab-pane fade" id="pane-security" role="tabpanel">
|
<div class="tab-pane" id="pane-security" role="tabpanel">
|
||||||
<div class="license-content">
|
<div class="license-content">
|
||||||
<h2>Sicherheitsrichtlinie (Security Policy)</h2>
|
<h2>Sicherheitsrichtlinie (Security Policy)</h2>
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@
|
|||||||
</div><!-- /#pane-security -->
|
</div><!-- /#pane-security -->
|
||||||
|
|
||||||
<!-- ── DATENVERARBEITUNG ─────────────────────────────────────────── -->
|
<!-- ── DATENVERARBEITUNG ─────────────────────────────────────────── -->
|
||||||
<div class="tab-pane fade" id="pane-data" role="tabpanel">
|
<div class="tab-pane" id="pane-data" role="tabpanel">
|
||||||
<div class="license-content">
|
<div class="license-content">
|
||||||
<h2>Dokumentation der Datenverarbeitung (VVT)</h2>
|
<h2>Dokumentation der Datenverarbeitung (VVT)</h2>
|
||||||
|
|
||||||
@@ -157,7 +156,7 @@
|
|||||||
</div><!-- /#pane-data -->
|
</div><!-- /#pane-data -->
|
||||||
|
|
||||||
<!-- ── RECHTSGRUNDLAGE ───────────────────────────────────────────── -->
|
<!-- ── RECHTSGRUNDLAGE ───────────────────────────────────────────── -->
|
||||||
<div class="tab-pane fade" id="pane-legal" role="tabpanel">
|
<div class="tab-pane" id="pane-legal" role="tabpanel">
|
||||||
<div class="license-content">
|
<div class="license-content">
|
||||||
<h2>Rechtsgrundlage der Nutzung</h2>
|
<h2>Rechtsgrundlage der Nutzung</h2>
|
||||||
<p>Um das Inventarsystem DSGVO-konform zu betreiben, muss der Betreiber eine der folgenden Grundlagen festlegen:</p>
|
<p>Um das Inventarsystem DSGVO-konform zu betreiben, muss der Betreiber eine der folgenden Grundlagen festlegen:</p>
|
||||||
@@ -170,9 +169,6 @@
|
|||||||
Einwilligung vorliegen (Art. 6 Abs. 1 lit. a DSGVO).</li>
|
Einwilligung vorliegen (Art. 6 Abs. 1 lit. a DSGVO).</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /#pane-legal -->
|
|
||||||
|
|
||||||
</div><!-- /.tab-content -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<div class="card border-0 shadow-lg rounded-4 h-100">
|
<div class="card border-0 shadow-lg rounded-4 h-100">
|
||||||
<div class="card-body p-4 p-md-5">
|
<div class="card-body p-4 p-md-5">
|
||||||
<p class="text-uppercase text-muted fw-semibold mb-2">Terminplaner</p>
|
<p class="text-uppercase text-muted fw-semibold mb-2">Terminplaner</p>
|
||||||
<h1 class="h3 fw-bold mb-3">Termin buchen</h1>
|
<h1 class="h3 fw-bold mb-3">Termin buchen - {{ available.title }}</h1>
|
||||||
<p class="text-muted mb-4">Wählen Sie im Kalender einen freien Slot aus. Den gewählten Termin können Sie danach direkt wie in einem Kalender-Block verschieben.</p>
|
<p class="text-muted mb-4">Wählen Sie im Kalender einen freien Slot aus. Den gewählten Termin können Sie danach direkt wie in einem Kalender-Block verschieben.</p>
|
||||||
|
|
||||||
<div class="p-3 rounded-3 bg-light mb-3">
|
<div class="p-3 rounded-3 bg-light mb-3">
|
||||||
|
|||||||
@@ -1563,6 +1563,7 @@
|
|||||||
// Get form fields
|
// Get form fields
|
||||||
const nameField = document.getElementById('name');
|
const nameField = document.getElementById('name');
|
||||||
const descriptionField = document.getElementById('beschreibung');
|
const descriptionField = document.getElementById('beschreibung');
|
||||||
|
const priceField = document.getElementById('anschaffungskosten'); // <-- NEU
|
||||||
|
|
||||||
if (!nameField || !descriptionField) {
|
if (!nameField || !descriptionField) {
|
||||||
alert('Fehler: Formularfelder nicht gefunden.');
|
alert('Fehler: Formularfelder nicht gefunden.');
|
||||||
@@ -1600,6 +1601,13 @@
|
|||||||
nameField.value = bookTitle;
|
nameField.value = bookTitle;
|
||||||
descriptionField.value = description;
|
descriptionField.value = description;
|
||||||
|
|
||||||
|
// Preis in das Formularfeld eintragen
|
||||||
|
if (priceField && currentBookData.price !== null && currentBookData.price !== undefined) {
|
||||||
|
// Wandelt den Float (z.B. 12.25) in einen String mit Komma (12,25) um
|
||||||
|
let formattedPrice = currentBookData.price.toString().replace('.', ',');
|
||||||
|
priceField.value = formattedPrice;
|
||||||
|
}
|
||||||
|
|
||||||
// Download and import book cover image if available
|
// Download and import book cover image if available
|
||||||
if (currentBookData.thumbnail) {
|
if (currentBookData.thumbnail) {
|
||||||
downloadBookCover(currentBookData.thumbnail);
|
downloadBookCover(currentBookData.thumbnail);
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"dbg": true,
|
"dbg": false,
|
||||||
"key": "InventarsystemSecureKey2026XYZ789abcdef012",
|
"key": "InventarsystemSecureKey2026XYZ789abcdef012",
|
||||||
"ver": "0.7.20",
|
"ver": "0.7.20",
|
||||||
"host": "0.0.0.0",
|
"host": "0.0.0.0",
|
||||||
|
|||||||
@@ -15,3 +15,4 @@ openpyxl
|
|||||||
cryptography>=42.0.0
|
cryptography>=42.0.0
|
||||||
pywebpush
|
pywebpush
|
||||||
py-vapid>=1.9.0
|
py-vapid>=1.9.0
|
||||||
|
beautifulsoup4
|
||||||
Reference in New Issue
Block a user