From 94b6684903ced3d8b112830780ecde323795315f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 28 Mar 2007 17:17:28 +0000 Subject: [PATCH] io.pl print_options auf templateing umgeschireben. Soweit ich weiss ist das eine der ersten frontend Funktionen aus SQL Ledger die auf templating umgeschrieben wurde. Funktionalitaet wurde eins zu eins erhalten, die einzige gewollte Aenderung betrifft die Moeglichkeit nicht direkt auf den Bildschirm auszugeben sondern die Optionen in einer Variable zurueckzugeben. Ansonsten kleinere Aenderungen bedingt durch Programmierstil und Beschraenkungen von HTML::Template: - der Check ob einige Selects angezeigt werden funktioniert jetzt ueber einen Referenzcheck, da languages und printers aus irgendeinem Grund als hashref initialisiert werden und dann als array gespeichert werden - die Auswahl zwischen form und myconfigvariablen funktioniert leicht anders und wird vermutlich noch geaendert werden. --- bin/mozilla/io.pl | 307 ++++++------------ locale/de/all | 3 - locale/de/dn | 6 - locale/de/ic | 6 - locale/de/io | 6 - locale/de/ir | 6 - locale/de/is | 6 - locale/de/oe | 6 - .../webpages/generic/print_options_de.html | 29 ++ .../generic/print_options_master.html | 29 ++ 10 files changed, 149 insertions(+), 255 deletions(-) create mode 100644 templates/webpages/generic/print_options_de.html create mode 100644 templates/webpages/generic/print_options_master.html diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index f20d4e5d2..c0b8856e6 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -1474,233 +1474,108 @@ sub send_email { $lxdebug->leave_sub(); } +# generate the printing options displayed at the bottom of oe and is forms. +# this function will attempt to guess what type of form is displayed, and will generate according options +# +# about the coding: +# this version builds the arrays of options pretty directly. if you have trouble understanding how, +# the opthash function builds hashrefs which are then pieced together for the template arrays. +# unneeded options are "undef"ed out, and then grepped out. +# +# the inline options is untested, but intended to be used later in metatemplating sub print_options { - $lxdebug->enter_sub(); - $form->{sendmode} = "attachment"; + $lxdebug->enter_sub() and my ($inline) = @_; - $form->{"format"} = - $form->{"format"} ? $form->{"format"} : - $myconfig{"template_format"} ? $myconfig{"template_format"} : - "pdf"; + # names 3 parameters and returns a hashref, for use in templates + sub opthash { +{ value => shift, selected => shift, oname => shift } } - $form->{"copies"} = - $form->{"copies"} ? $form->{"copies"} : - $myconfig{"copies"} ? $myconfig{"copies"} : - 3; - - $form->{"media"} = - $form->{"media"} ? $form->{"media"} : - $myconfig{"default_media"} ? $myconfig{"default_media"} : - "screen"; - - $form->{"printer_id"} = - defined($form->{"printer_id"}) ? $form->{"printer_id"} : - $myconfig{"default_printer_id"} ? $myconfig{"default_printer_id"} : - ""; + # note: "||"-selection is only correct for values where "0" is _not_ a correct entry + $form->{sendmode} = "attachment"; + $form->{format} = $form->{format} || $myconfig{template_format} || "pdf"; + $form->{copies} = $form->{copies} || $myconfig{copies} || 3; + $form->{media} = $form->{media} || $myconfig{default_media} || "screen"; + $form->{printer_id} = $form->{printer_id} || $myconfig{default_printer_id} || ""; $form->{PD}{ $form->{formname} } = "selected"; $form->{DF}{ $form->{format} } = "selected"; $form->{OP}{ $form->{media} } = "selected"; - $form->{SM}{ $form->{sendmode} } = "selected"; - - if ($form->{type} eq 'purchase_order') { - $type = qq| - |; - } - - if ($latex_templates) { - $format .= qq||; - } - - $format .= qq||; - - if ($latex_templates) { - $format .= qq||; + print $print_options; $lxdebug->leave_sub(); } - - if ($opendocument_templates) { - $format .= qq||; - } - $format .= qq||; - - if (scalar(keys (%{ $form->{languages} })) !=0) { - $language_select = qq| - |; - foreach $item (@{ $form->{printers} }) { - $selected = $item->{"id"} == $form->{"printer_id"} ? "selected" : ""; - $printer_select .= qq||; - } - } - - - - print qq| - - - - - -
- - - |; - if (scalar(keys (%{ $form->{languages} })) !=0) { - print qq| - |; - } - print qq| - - |; - if (scalar(keys (%{ $form->{printers} })) !=0) { - print qq| - -|; - } - - if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates && $form->{media} ne 'email') { - print qq| - -|; - } - - $form->{groupitems} = "checked" if $form->{groupitems}; - $form->{remove_draft} = "checked" if $form->{remove_draft}; - - print qq| - - |; - - print qq| - - | if (!$form->{id} && $form->{draft_id}); - print qq| - -
$type${language_select}$format$media$printer_select| . $locale->text('Copies') . qq| - {copies}>| . $locale->text('Group Items') . qq|{groupitems}>| . $locale->text('Remove Draft') . qq|{remove_draft}>
-
- - -|; - - if ($form->{printed} =~ /$form->{formname}/) { - print qq| - -|; - } - - if ($form->{emailed} =~ /$form->{formname}/) { - print qq| - -|; - } - - if ($form->{queued} =~ /$form->{formname}/) { - print qq| - -|; - } - - print qq| - -
\|| . $locale->text('Printed') . qq|\|\|| . $locale->text('E-mailed') . qq|\|\|| . $locale->text('Queued') . qq|\|
-
-|; - - $lxdebug->leave_sub(); } sub print { diff --git a/locale/de/all b/locale/de/all index dcd498d55..4da9db1b2 100644 --- a/locale/de/all +++ b/locale/de/all @@ -394,7 +394,6 @@ gestartet', 'E-mail' => 'eMail', 'E-mail Statement to' => 'Fälligkeitsabrechnung als eMail an', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'EAN' => 'EAN', 'EAN-Code' => 'EAN-Code', 'ELSE' => 'Zusatz', @@ -815,7 +814,6 @@ gestartet', 'Print' => 'Drucken', 'Print and Post' => 'Drucken und Buchen', 'Print options' => 'Druckoptionen', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Printer Command' => 'Druckbefehl', 'Printer Command missing!' => 'Druckbefehl fehlt', @@ -851,7 +849,6 @@ gestartet', 'Quarter' => 'Quartal', 'Quarterly' => 'quartalsweise', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date' => 'Angebotsdatum', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', diff --git a/locale/de/dn b/locale/de/dn index 9c5eb6a0a..4b4d1e857 100644 --- a/locale/de/dn +++ b/locale/de/dn @@ -26,7 +26,6 @@ $self->{texts} = { 'Confirmation' => 'Auftragsbestätigung', 'Contact' => 'Kontakt', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Could not create dunning copy!' => 'Could not create dunning copy!', 'Country' => 'Land', 'Credit Note' => 'Gutschrift', @@ -60,7 +59,6 @@ gestartet', 'Dunning overview' => 'Mahnungsübersicht', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'ELSE' => 'Zusatz', 'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten', 'Enter longdescription' => 'Langtext eingeben', @@ -73,7 +71,6 @@ gestartet', 'Fristsetzung' => 'Fristsetzung', 'Group' => 'Warengruppe', 'Group Invoices' => 'Rechnungen zusammenfassen', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'In-line' => 'im Text', 'Interest Rate' => 'Zinssatz', @@ -146,7 +143,6 @@ gestartet', 'Postscript' => 'Postscript', 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -156,12 +152,10 @@ gestartet', 'Purchase Order' => 'Lieferantenauftrag', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', 'Quotation Number missing!' => 'Angebotsnummer fehlt!', 'RFQ' => 'Anfrage', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Required by' => 'Lieferdatum', 'SAVED' => 'Gespeichert', diff --git a/locale/de/ic b/locale/de/ic index e9edee620..dc4e862ba 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -40,7 +40,6 @@ aktualisieren wollen?', 'Confirmation' => 'Auftragsbestätigung', 'Contact' => 'Kontakt', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Could not update prices!' => 'Preise konnten nicht aktualisiert werden!', 'Country' => 'Land', 'Credit Note' => 'Gutschrift', @@ -59,7 +58,6 @@ aktualisieren wollen?', 'Drawing' => 'Zeichnung', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'EAN' => 'EAN', 'EAN-Code' => 'EAN-Code', 'ELSE' => 'Zusatz', @@ -78,7 +76,6 @@ aktualisieren wollen?', 'From' => 'Von', 'Geschäftsvolumen' => 'Geschäftsvolumen', 'Group' => 'Warengruppe', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'If you see this message, you most likely just setup your LX-Office and haven\'t added any entry types. If this is the case, the option is accessible for administrators in the System menu.' => 'Wenn Sie diese Meldung sehen haben Sie wahrscheinlich ein frisches LX-Office Setup und noch keine Buchungsgruppen eingerichtet. Ein Administrator kann dies im Systemmenü erledigen.', 'Image' => 'Grafik', @@ -171,7 +168,6 @@ aktualisieren wollen?', 'Preisklasse' => 'Preisgruppe', 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -181,14 +177,12 @@ aktualisieren wollen?', 'Purchase Order' => 'Lieferantenauftrag', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', 'Quotation Number missing!' => 'Angebotsnummer fehlt!', 'Quoted' => 'Angeboten', 'RFQ' => 'Anfrage', 'ROP' => 'Mindestlagerbestand', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Required by' => 'Lieferdatum', 'Revenue' => 'Erlöskonto', diff --git a/locale/de/io b/locale/de/io index 9f3b1830e..ff55bf7d2 100644 --- a/locale/de/io +++ b/locale/de/io @@ -23,7 +23,6 @@ $self->{texts} = { 'Confirmation' => 'Auftragsbestätigung', 'Contact' => 'Kontakt', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Country' => 'Land', 'Credit Note' => 'Gutschrift', 'Customer Number' => 'Kundennummer', @@ -38,7 +37,6 @@ $self->{texts} = { 'Discount' => 'Rabatt', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'ELSE' => 'Zusatz', 'Enter longdescription' => 'Langtext eingeben', 'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s', @@ -47,7 +45,6 @@ $self->{texts} = { 'Feb' => 'Feb', 'February' => 'Februar', 'Group' => 'Warengruppe', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'In-line' => 'im Text', 'Invoice' => 'Rechnung', @@ -106,7 +103,6 @@ $self->{texts} = { 'Postscript' => 'Postscript', 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -115,12 +111,10 @@ $self->{texts} = { 'Purchase Order' => 'Lieferantenauftrag', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', 'Quotation Number missing!' => 'Angebotsnummer fehlt!', 'RFQ' => 'Anfrage', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Required by' => 'Lieferdatum', 'SAVED' => 'Gespeichert', diff --git a/locale/de/ir b/locale/de/ir index 2e8226d8f..57adf4b2e 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -36,7 +36,6 @@ $self->{texts} = { 'Contact' => 'Kontakt', 'Contact Person' => 'Ansprechpartner', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Country' => 'Land', 'Credit Limit' => 'Kreditlimit', 'Credit Note' => 'Gutschrift', @@ -61,7 +60,6 @@ $self->{texts} = { 'Due Date' => 'Fälligkeitsdatum', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'ELSE' => 'Zusatz', 'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten', 'Enter longdescription' => 'Langtext eingeben', @@ -75,7 +73,6 @@ $self->{texts} = { 'Feb' => 'Feb', 'February' => 'Februar', 'Group' => 'Warengruppe', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'In-line' => 'im Text', 'Internal Notes' => 'interne Bemerkungen', @@ -147,7 +144,6 @@ $self->{texts} = { 'Postscript' => 'Postscript', 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -157,7 +153,6 @@ $self->{texts} = { 'Purchase Order' => 'Lieferantenauftrag', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date' => 'Angebotsdatum', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', @@ -166,7 +161,6 @@ $self->{texts} = { 'Rechnungsnummer' => 'Rechnungsnummer', 'Record in' => 'Buchen auf', 'Remaining' => 'Rest', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Required by' => 'Lieferdatum', 'SAVED' => 'Gespeichert', diff --git a/locale/de/is b/locale/de/is index e4e058f57..868c6e88c 100644 --- a/locale/de/is +++ b/locale/de/is @@ -41,7 +41,6 @@ $self->{texts} = { 'Contact' => 'Kontakt', 'Contact Person' => 'Ansprechpartner', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Country' => 'Land', 'Credit Limit' => 'Kreditlimit', 'Credit Limit exceeded!!!' => 'Kreditlimit überschritten!', @@ -73,7 +72,6 @@ $self->{texts} = { 'Dunning Amount' => 'gemahnter Betrag', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'ELSE' => 'Zusatz', 'Edit Credit Note' => 'Gutschrift bearbeiten', 'Edit Sales Invoice' => 'Rechnung bearbeiten', @@ -91,7 +89,6 @@ $self->{texts} = { 'Feb' => 'Feb', 'February' => 'Februar', 'Group' => 'Warengruppe', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'In-line' => 'im Text', 'Incoming Payments' => 'Zahlungseingänge', @@ -170,7 +167,6 @@ $self->{texts} = { 'Pricegroup' => 'Preisgruppe', 'Print' => 'Drucken', 'Print and Post' => 'Drucken und Buchen', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -180,7 +176,6 @@ $self->{texts} = { 'Purchase Order' => 'Lieferantenauftrag', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date' => 'Angebotsdatum', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', @@ -189,7 +184,6 @@ $self->{texts} = { 'RFQ' => 'Anfrage', 'Record in' => 'Buchen auf', 'Remaining' => 'Rest', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Required by' => 'Lieferdatum', 'SAVED' => 'Gespeichert', diff --git a/locale/de/oe b/locale/de/oe index cfcdab354..cab452e08 100644 --- a/locale/de/oe +++ b/locale/de/oe @@ -43,7 +43,6 @@ $self->{texts} = { 'Contact' => 'Kontakt', 'Contact Person' => 'Ansprechpartner', 'Continue' => 'Weiter', - 'Copies' => 'Kopien', 'Country' => 'Land', 'Credit Limit' => 'Kreditlimit', 'Credit Limit exceeded!!!' => 'Kreditlimit überschritten!', @@ -72,7 +71,6 @@ $self->{texts} = { 'Dunning Amount' => 'gemahnter Betrag', 'E-mail' => 'eMail', 'E-mail address missing!' => 'E-Mail-Adresse fehlt!', - 'E-mailed' => 'eMail gesendet.', 'ELSE' => 'Zusatz', 'Edit Purchase Order' => 'Lieferantenaufrag bearbeiten', 'Edit Quotation' => 'Angebot bearbeiten', @@ -93,7 +91,6 @@ $self->{texts} = { 'February' => 'Februar', 'From' => 'Von', 'Group' => 'Warengruppe', - 'Group Items' => 'Waren gruppieren', 'History' => 'Historie', 'ID' => 'Buchungsnummer', 'In-line' => 'im Text', @@ -167,7 +164,6 @@ $self->{texts} = { 'Price' => 'Preis', 'Pricegroup' => 'Preisgruppe', 'Print' => 'Drucken', - 'Printed' => 'gedruckt.', 'Printer' => 'Drucker', 'Proforma Invoice' => 'Proformarechnung', 'Project' => 'Projekt', @@ -178,7 +174,6 @@ $self->{texts} = { 'Purchase Orders' => 'Lieferantenaufträge', 'Qty' => 'Menge', 'Queue' => 'Warteschlange', - 'Queued' => 'In Warteschlange eingereiht.', 'Quotation' => 'Angebot', 'Quotation Date' => 'Angebotsdatum', 'Quotation Date missing!' => 'Angebotsdatum fehlt!', @@ -189,7 +184,6 @@ $self->{texts} = { 'RFQ' => 'Anfrage', 'RFQ Number' => 'Anfragenummer', 'Remaining' => 'Rest', - 'Remove Draft' => 'Entwurf löschen', 'Reqdate' => 'Lieferdatum', 'Request for Quotation' => 'Anfrage', 'Request for Quotations' => 'Anfragen', diff --git a/templates/webpages/generic/print_options_de.html b/templates/webpages/generic/print_options_de.html new file mode 100644 index 000000000..352450951 --- /dev/null +++ b/templates/webpages/generic/print_options_de.html @@ -0,0 +1,29 @@ + + + + + +
+ + + + + + + + + + + + + +
+ + + + Kopien >Waren gruppieren>Entwurf löschen>
+
+
+
+ diff --git a/templates/webpages/generic/print_options_master.html b/templates/webpages/generic/print_options_master.html new file mode 100644 index 000000000..a9fe1eecd --- /dev/null +++ b/templates/webpages/generic/print_options_master.html @@ -0,0 +1,29 @@ + + + + + +
+ + + + + + + + + + + + + +
+ + + + Copies >Group Items>Remove Draft>
+
+
+
+ -- 2.20.1