Import current development version
authorJoey Schulze <joey@infodrom.org>
Wed, 28 Dec 2011 12:54:56 +0000 (13:54 +0100)
committerJoey Schulze <joey@infodrom.org>
Wed, 28 Dec 2011 12:54:56 +0000 (13:54 +0100)
abteilung.php [new file with mode: 0644]
artikel.php [new file with mode: 0644]
ordersatz.php [new file with mode: 0644]
ordersatz.tex [new file with mode: 0644]
ordersatz_pos.php [new file with mode: 0644]
utils.php [new file with mode: 0644]
vpe.php [new file with mode: 0644]

diff --git a/abteilung.php b/abteilung.php
new file mode 100644 (file)
index 0000000..0424da9
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+$mask = array(
+             'table' => 'metro_abteilung',
+             'title' => 'Abteilungen',
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'visible' => false,
+                                           ),
+                             'gang' => array(
+                                           'name' => 'Gang',
+                                           'width' => 50,
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'width' => 200,
+                                           ),
+                             ),
+             'edit' => array(
+                             'gang' => array(
+                                           'name' => 'Gang',
+                                           'type' => 'text',
+                                           'size' => 10,
+                                           'null' => true,
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             ),
+             );
+
+?>
diff --git a/artikel.php b/artikel.php
new file mode 100644 (file)
index 0000000..018a00f
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+
+$mask = array(
+             'table' => 'metro_artikel',
+             'title' => 'Artikelstammdaten',
+             'join' => array('metro_abteilung ON abteilung = metro_abteilung.id'),
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'visible' => false,
+                                           'sql' => 'metro_artikel.id',
+                                           ),
+                             'artnr' => array(
+                                           'name' => 'ArtNr',
+                                           'width' => 60,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'menge' => array(
+                                           'name' => 'Menge',
+                                           'width' => 60,
+                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           ),
+                             'bezeichnung' => array(
+                                           'name' => 'Bezeichnung',
+                                           'width' => 345,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'hersteller' => array(
+                                           'name' => 'Hersteller',
+                                           'width' => 100,
+                                           'specs' => "filterUI: 't'",
+                                           'visible' => false,
+                                           ),
+                             'abteilung' => array(
+                                           'name' => 'Abteilung',
+                                           'width' => 200,
+                                           'specs' => "filterUI: 's'",
+                                           'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_abteilung','id','name').", 0, '')",
+                                           'visible' => false,
+                                           ),
+                             'gang' => array(
+                                           'name' => 'Gang',
+                                           'width' => 50,
+                                           'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+                                           'visible' => false,
+                                           ),
+                             'vpe' => array(
+                                           'name' => 'Einheit',
+                                           'width' => 70,
+                                           'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+                                           'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_vpe','id','name').", 0, '')",
+                                           ),
+                             ),
+             'edit' => array(
+                             'artnr' => array(
+                                           'name' => 'Artikelnummer',
+                                           'type' => 'number',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             'abteilung' => array(
+                                           'name' => 'Abteilung',
+                                           'type' => 'select',
+                                           'options' => 'SELECT id,name AS text FROM metro_abteilung ORDER BY name',
+                                           'option_empty' => '-- select --',
+                                           'required' => true,
+                                           ),
+                             'vpe' => array(
+                                           'name' => 'Verpackungseinheit',
+                                           'type' => 'select',
+                                           'options' => 'SELECT id,name AS text FROM metro_vpe ORDER BY name',
+                                           'option_empty' => '-- select --',
+                                           'required' => true,
+                                           ),
+                             'menge' => array(
+                                           'name' => 'Menge',
+                                           'type' => 'text',
+                                           'size' => 15,
+                                           'null' => true,
+                                           ),
+                             'bezeichnung' => array(
+                                           'name' => 'Bezeichnung',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             'hersteller' => array(
+                                           'name' => 'Hersteller',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'null' => true,
+                                           ),
+                             ),
+             );
+
+?>
diff --git a/ordersatz.php b/ordersatz.php
new file mode 100644 (file)
index 0000000..1c2cc6f
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+  /*
+   Küchenbetreuer:
+   E-Mail-Adresse für Kopie
+   Telefonnr für Rückfragen:
+   Abholung am:
+   Abholung um Uhrzeit:
+
+   - Ordersatz auswählen || neuen Ordersatz erstellen || Ordersatz kopieren
+   - Ordersatz abschließen = PDF-Datei erzeugen, archivieren, per Mail, per Fax
+   */
+
+
+function get_title($id)
+{
+  global $db;
+
+  $query = sprintf('SELECT name FROM metro_ordersatz WHERE id = %d', $id);
+  $sth = $db->query($query);
+  $row = $sth->fetch();
+  if ($row) return 'Ordersatz für ' . $row['name'];
+  else return 'Unbekannter Ordersatz';
+}
+
+$href = "new Rico.TableColumn.link('./?mask=metro__ordersatz_pos&id={0}')";
+
+# INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT ORDERID,id,'joey',now() FROM metro_artikel;
+# DELETE FROM metro_ordersatz_pos WHERE ordersatz = ORDERID AND anzahl IS NULL
+$mask = array(
+             'table' => 'metro_ordersatz',
+             'title' => 'Ordersatz auswählen / erstellen',
+             'where' => sprintf('owner = %d AND done IS NULL', $_SESSION['sys']['uid']),
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'visible' => false,
+                                           ),
+                             'erstellt' => array(
+                                           'name' => 'Erstellt',
+                                           'width' => 70,
+                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'width' => 250,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'koch' => array(
+                                           'name' => 'Kochbetreuer',
+                                           'width' => 100,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'datum' => array(
+                                           'name' => 'Einkauf am',
+                                           'width' => 110,
+                                           'sql' => "datum || ' ' || uhrzeit || ' Uhr'",
+                                           ),
+                             'link' => array(
+                                           'name' => 'auswählen',
+                                           'width' => 90,
+                                           'control' => $href,
+                                           'specs' => "ClassName: 'aligncenter'",
+                                           'sql' => "'auswählen'",
+                                           ),
+                             ),
+             'edit' => array(
+                             'owner' => array(
+                                           'type' => 'hidden',
+                                           'default' => $_SESSION['sys']['uid'],
+                                           'required' => true,
+                                           ),
+                             'erstellt' => array(
+                                           'type' => 'hidden',
+                                           'subtype' => 'string',
+                                           'default' => date('Y-m-d'),
+                                           'required' => true,
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             'koch' => array(
+                                           'name' => 'Kochbetreuer',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             'email' => array(
+                                           'name' => 'E-Mail',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'null' => true,
+                                           ),
+                             'telefon' => array(
+                                           'name' => 'Telefon für Rückfragen',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             'datum' => array(
+                                           'name' => 'Abholdatum',
+                                           'type' => 'date',
+                                           'size' => 8,
+                                           'required' => true,
+                                           ),
+                             'uhrzeit' => array(
+                                           'name' => 'Ungefähre Uhrzeit der Abholung',
+                                           'type' => 'number',
+                                           'size' => 3,
+                                           'required' => true,
+                                           ),
+                             ),
+             'postinsert' => ordersatz_insert,
+             );
+
+function ordersatz_insert($id)
+{
+  global $db;
+
+  $sql = sprintf("INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT %d,id,%s,now() FROM metro_artikel",
+                $id, $db->quote($_SESSION['sys']['login']));
+  error_log($sql);
+
+  $sth = $db->query($sql);
+}
+
+?>
diff --git a/ordersatz.tex b/ordersatz.tex
new file mode 100644 (file)
index 0000000..a9ca8e3
--- /dev/null
@@ -0,0 +1,90 @@
+\documentclass{dinbrief}
+\usepackage[T1]{fontenc}
+\usepackage[latin1]{inputenc}
+\usepackage{german}
+\usepackage{times}
+\usepackage{supertabular}
+
+
+%
+% Per Fax an 0441-2002-364
+%
+
+
+\input ordersatz_vars
+
+\place{Oldenburg}
+
+\nowindowrules
+\nowindowtics
+\centeraddress
+
+\signature{\koch}
+\address{%
+\begin{flushright}
+  \koch\\
+  FIPS Sportfreizeiten\\
+  Tannenkampstr. 4\\
+  26\,129 Oldenburg\\[\medskipamount]
+  Tel: \telefon
+\end{flushright}
+}
+% \backaddress{J. Schulze $\bullet$ FIPS Sportfreizeiten $\bullet$ joey@infodrom.org}
+
+% \def\today{\tt 17. M"arz 1996}
+
+\newcommand{\order}[4]{%
+#2 & #3 & #4 & #1\\ \hline
+}
+
+
+\begin{document}
+
+\begin{letter}{An den\\
+               Metro Store Oldenburg\\
+               An der Schmiede\\[\medskipamount]
+               26\,135 Oldenburg}
+
+\concern{\textbf{Kundenordersatz (\reise)} \hfill Kunden Nr. 00074/88402}
+
+\opening{\hfill Waren zur Abholung am \datum, ca. \uhrzeit{} Uhr}
+
+Sehr geehrte Damen und Herren,
+
+hiermit möchten wir folgende Waren bestellen und Sie bitten, diese auf
+einem Einkaufswagen für unseren Einkauf am \datum{} um ca. \uhrzeit{} Uhr
+bereitzustellen.  Wir werden die Waren dort abholen und voraussichtlich
+noch weitere Artikel einkaufen.
+
+\vspace{1cm}
+\begin{sffamily}
+\renewcommand{\arraystretch}{1.4}
+
+\tablefirsthead{%
+\hline
+\textbf{ArtNr} & \textbf{Artikelbezeichnung} & \textbf{VPE}  & \textbf{Menge}\\
+\hline
+}
+
+\tablehead{%
+\hline
+\textbf{ArtNr} & \textbf{Artikelbezeichnung} & \textbf{VPE}  & \textbf{Menge}\\
+\hline
+}
+
+\tabletail{%
+\hline
+}
+
+\begin{supertabular}{|l|p{11.8cm}|r|r|}
+\input ordersatz_items
+
+\end{supertabular}
+
+\end{sffamily}
+
+\closing{Mit freundlichen Grüßen}
+
+\end{letter}
+
+\end{document}
diff --git a/ordersatz_pos.php b/ordersatz_pos.php
new file mode 100644 (file)
index 0000000..be16e98
--- /dev/null
@@ -0,0 +1,209 @@
+<?php
+  /*
+   Küchenbetreuer:
+   E-Mail-Adresse für Kopie
+   Telefonnr für Rückfragen:
+   Abholung am:
+   Abholung um Uhrzeit:
+
+   - Ordersatz auswählen || neuen Ordersatz erstellen || Ordersatz kopieren
+   - Ordersatz abschließen = PDF-Datei erzeugen, archivieren, per Mail, per Fax
+   */
+
+include_once($_SESSION['sys']['basedir'].'masks/metro/utils.php');
+include_once($_SESSION['sys']['basedir'].'lib/mail.php');
+
+if (substr($_SERVER["SCRIPT_FILENAME"],-10) == '/index.php' &&
+    !empty($_GET['id']))
+  $_SESSION['ordersatz'] = $_GET['id'];
+
+$jscode[] = <<<EOC
+grid_column_edit[1] = {
+    default_menu: false,
+    width: '9em',
+    values: [
+            ['löschen', '', 0],
+            ['1 mal bestellen', '1', 1],
+            ['2 mal bestellen', '2', 2],
+            ['3 mal bestellen', '3', 3],
+            ['4 mal bestellen', '4', 4],
+            ['5 mal bestellen', '5', 5],
+            ['6 mal bestellen', '6', 6],
+            ['7 mal bestellen', '7', 7],
+            ['8 mal bestellen', '8', 8],
+            ['10 mal bestellen', '10', 10],
+            ['12 mal bestellen', '12', 12],
+            ['14 mal bestellen', '14', 14]
+            ]
+};
+
+function build_pdf_callback(data)
+{
+    info('PDF erstellt');
+    window.open('ajax/ajax.php?tmpdir='+data.tmpdir+'&source=metro__ordersatz_pos&func=file&name=download','_blank');
+}
+
+function build_pdf()
+{
+  var source = document.getElementById('source');
+  if (!source) return false;
+
+  var parms = 'source=' + source.innerHTML + '&callback=pdf&';
+  ajax_request('function', parms, build_pdf_callback);
+  return false;
+}
+EOC;
+
+$buttons = <<<EOC
+<p style="margin-top: 0px; margin-bottom: 4px; text-align: center;">
+<button onclick="return build_pdf()">PDF erstellen</button>
+&nbsp;
+<button onclick="return finish()">Abschließen</button>
+<br>Bei Abschluß wird ein Fax zu Metro und eine Kopie per Mail an den Koch geschickt.
+</p>
+EOC;
+
+function get_title($id)
+{
+  global $db;
+
+  $query = sprintf('SELECT name FROM metro_ordersatz WHERE id = %d', $id);
+  $sth = $db->query($query);
+  $row = $sth->fetch();
+  if ($row) return 'Ordersatz für ' . $row['name'];
+  else return 'Unbekannter Ordersatz';
+}
+
+# INSERT INTO metro_ordersatz_pos (ordersatz,artikel,sys_user,sys_edit) SELECT ORDERID,id,'joey',now() FROM metro_artikel;
+# DELETE FROM metro_ordersatz_pos WHERE ordersatz = ORDERID AND anzahl IS NULL
+$mask = array(
+             'table' => 'metro_ordersatz',
+             'join' => array('metro_ordersatz_pos ON ordersatz = metro_ordersatz.id',
+                             'metro_artikel ON artikel = metro_artikel.id'),
+             'title' => get_title($_SESSION['ordersatz']),
+             'where' => sprintf('ordersatz = %d AND owner = %d AND done IS NULL', $_SESSION['ordersatz'], $_SESSION['sys']['uid']),
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'sql' => 'metro_artikel.id',
+                                           'visible' => false,
+                                           ),
+                             'anzahl' => array(
+                                           'name' => 'Anzahl',
+                                           'width' => 60,
+                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           ),
+                             'artnr' => array(
+                                           'name' => 'Artnr',
+                                           'width' => 60,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'menge' => array(
+                                           'name' => 'Menge',
+                                           'width' => 60,
+                                           'specs' => "ClassName: 'alignrightpad', filterUI: 't'",
+                                           ),
+                             'bezeichnung' => array(
+                                           'name' => 'Bezeichnung',
+                                           'width' => 260,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'hersteller' => array(
+                                           'name' => 'Hersteller',
+                                           'width' => 80,
+                                           'specs' => "filterUI: 't'",
+                                           ),
+                             'vpe' => array(
+                                           'name' => 'Einheit',
+                                           'width' => 70,
+                                           'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+                                           'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_vpe','id','name').", 0, '')",
+                                           ),
+                             'abteilung' => array(
+                                           'name' => 'Abteilung',
+                                           'width' => 80,
+                                           'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+                                           'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_abteilung','id','name').", 0, '')",
+                                           ),
+                             'gang' => array(
+                                           'name' => 'Gang',
+                                           'width' => 50,
+                                           'sql' => 'abteilung',
+                                           'specs' => "ClassName: 'aligncenter', filterUI: 's'",
+                                           'control' => "new Rico.TableColumn.lookup(".grid_lookup_sql('metro_abteilung','id','gang').", 0, '')",
+                                           ),
+                             ),
+             'edit' => array(
+                             'buttons' => array(
+                                           'type' => 'html',
+                                           'code' => $buttons,
+                                           'sql' => false,
+                                           ),
+                             ),
+             'callbacks' => array(
+                                  'cellsave' => cb_cellsave,
+                                  'pdf' => cb_pdf,
+                                  'send' => cb_send,
+                               ),
+             'files' => array(
+                              'download' => process_download,
+                              ),
+             );
+
+function cb_cellsave()
+{
+  global $db;
+
+  if ($_POST['value'] == 0)
+    $sql = sprintf("UPDATE metro_ordersatz_pos SET anzahl = NULL, sys_user = %s, sys_edit = now() WHERE ordersatz = %d AND artikel = %d",
+                  $db->quote($_SESSION['sys']['login']),
+                  $_SESSION['ordersatz'], $_POST['id']);
+  else
+    $sql = sprintf("UPDATE metro_ordersatz_pos SET anzahl = %d, sys_user = %s, sys_edit = now() WHERE ordersatz = %d AND artikel = %d",
+                  $_POST['value'], $db->quote($_SESSION['sys']['login']),
+                  $_SESSION['ordersatz'], $_POST['id']);
+
+  $sth = $db->query($sql);
+  error_log($sql);
+}
+
+
+function cb_pdf()
+{
+  $tmpdir = mk_tempdir();
+  $result = ordersatz_write($_SESSION['ordersatz'], $tmpdir, false);
+
+  if ($result !== true)
+    return array('error' => $result);
+
+  return array('tmpdir' => substr($tmpdir,strlen($_SESSION['sys']['basedir'])));
+}
+
+function process_download()
+{
+  if (strpos($_GET['tmpdir'], '..') !== false)
+    return false;
+
+  $fname = $_SESSION['sys']['basedir'] . $_GET['tmpdir'] . '/ordersatz.pdf';
+
+  if (!file_exists($fname) || !is_file($fname))
+    return 'File not found';
+
+  send_file($fname);
+  rm_tempdir($_SESSION['sys']['basedir'] . $_GET['tmpdir']);
+}
+
+function cb_send()
+{
+  $tmpdir = mk_tempdir();
+  $result = ordersatz_write($_SESSION['ordersatz'], $tmpdir, true);
+
+  if ($result !== true)
+    return array('error' => $result);
+
+  $fname = $tmpdir . '/ordersatz.pdf';
+
+  rm_tempdir($tmpdir);
+}
+
+?>
diff --git a/utils.php b/utils.php
new file mode 100644 (file)
index 0000000..1829a8d
--- /dev/null
+++ b/utils.php
@@ -0,0 +1,123 @@
+<?php
+
+define('MODULE', 'metro');
+define('TEMPLATE', 'ordersatz.tex');
+define('FNAME_VARS', 'ordersatz_vars.tex');
+define('FNAME_ITEMS', 'ordersatz_items.tex');
+define('FAXNUMBER','2002-364');
+
+function mk_tempdir()
+{
+  $tmpdir = sprintf("%sarchive/%s/%s",
+                   $_SESSION['sys']['basedir'],
+                   MODULE,
+                   md5(date('c')));
+  mkdir($tmpdir,0777);
+
+  error_log($tmpdir);
+  return $tmpdir;
+}
+
+function rm_tempdir($dir)
+{
+  system(sprintf("rm -rf %s", $dir));
+}
+
+function latex_encode($text)
+{
+  return str_replace(array("\\",'%'),
+                    array('\\','\%'),
+                    utf8_decode($text));
+}
+
+function ordersatz_write($id, $dir, $send)
+{
+  global $db;
+
+  $fname = sprintf("%smasks/%s/%s",
+                  $_SESSION['sys']['basedir'],
+                  MODULE,
+                  TEMPLATE);
+
+  if (!file_exists($fname))
+    return "Vorlage nicht gefunden";
+
+  copy($fname, $dir . '/ordersatz.tex');
+  chdir($dir);
+
+  $sql = sprintf("SELECT name,koch,email,telefon,datum,uhrzeit FROM metro_ordersatz WHERE id = %d",
+                $id);
+  $satz = query_db($sql);
+
+  $f = fopen(FNAME_VARS, 'w');
+  fwrite($f, sprintf('\newcommand{\koch}{%s}'."\n", latex_encode($satz[0]['koch'])));
+  fwrite($f, sprintf('\newcommand{\reise}{%s}'."\n", latex_encode($satz[0]['name'])));
+  fwrite($f, sprintf('\newcommand{\telefon}{%s}'."\n", latex_encode($satz[0]['telefon'])));
+  fwrite($f, sprintf('\newcommand{\uhrzeit}{%s}'."\n", latex_encode($satz[0]['uhrzeit'])));
+
+  $d = explode('-', $satz[0]['datum']);
+  fwrite($f, sprintf('\newcommand{\datum}{%d.%d.%d}'."\n", $d[2], $d[1], $d[0]));
+  fclose($f);
+
+  $sql = sprintf("SELECT artnr,gang,metro_vpe.short AS vpname,menge,bezeichnung,hersteller,anzahl " .
+                "FROM metro_ordersatz_pos " .
+                "JOIN metro_artikel ON artikel = metro_artikel.id " .
+                "JOIN metro_abteilung ON abteilung = metro_abteilung.id " .
+                "JOIN metro_vpe ON vpe = metro_vpe.id " .
+                "WHERE ordersatz = %d AND anzahl IS NOT NULL " .
+                "ORDER BY gang,metro_abteilung.name",
+                $id);
+
+#  error_log($sql);
+  $result = query_db($sql);
+
+  $f = fopen(FNAME_ITEMS, 'w');
+
+  foreach ($result as $row) {
+    $bez = $row['bezeichnung'];
+    if (strlen($row['hersteller']))
+      $bez .= ' (' . $row['hersteller'] . ')';
+
+    fwrite($f, sprintf('\order{%d}{%d}{%s %s}{%s}'."\n",
+                      $row['anzahl'],
+                      $row['artnr'],
+                      $row['menge'],
+                      latex_encode($bez),
+                      latex_encode($row['vpname'])));
+  }
+
+  fclose($f);
+
+  system("latex ordersatz > ordersatz.out 2>&1 && dvips ordersatz >> ordersatz.out 2>&1 && ps2pdf ordersatz.ps", $ret);
+
+  if ($ret !== 0)
+    return "Probleme beim Compilieren des Ordersatzes";
+
+  if (!file_exists('ordersatz.ps'))
+    return "Postscript-Datei nicht erstellt";
+
+  if ($send) {
+    $cmd = sprintf("faxspool -f joey@finlandia.infodrom.org %s %s > /dev/null 2>&1",
+                  FAXNUMBER,
+                  ordersatz.ps);
+    error_log($cmd);
+    # system($cmd);
+
+#      $fname = store_file($field, $info);
+
+
+    $message = sprintf("Hallo %s!\n\nDer angehänge Ordersatz wurde gerade an Metro Oldenburg verschickt.\n\n",
+                      $satz[0]['koch']);
+
+    mail_attach($satz[0]['email'],
+               'Ordersatz ' . $satz[0]['name'],
+               $satz[0]['email'],
+               'Infodrom ' . $satz[0]['koch'],
+               array($dir . '/ordersatz.pdf'),
+               $message);
+  }
+
+  return true;
+}
+
+?>
\ No newline at end of file
diff --git a/vpe.php b/vpe.php
new file mode 100644 (file)
index 0000000..c4e54a7
--- /dev/null
+++ b/vpe.php
@@ -0,0 +1,36 @@
+<?php
+
+$mask = array(
+             'table' => 'metro_vpe',
+             'title' => 'Verpackungseinheiten',
+             'list' => array(
+                             'id' => array(
+                                           'name' => 'ID',
+                                           'visible' => false,
+                                           ),
+                             'short' => array(
+                                           'name' => 'Kurz',
+                                           'width' => 50,
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'width' => 150,
+                                           ),
+                             ),
+             'edit' => array(
+                             'short' => array(
+                                           'name' => 'Kurzname',
+                                           'type' => 'text',
+                                           'size' => 5,
+                                           'required' => true,
+                                           ),
+                             'name' => array(
+                                           'name' => 'Name',
+                                           'type' => 'text',
+                                           'size' => 25,
+                                           'required' => true,
+                                           ),
+                             ),
+             );
+
+?>