Erstellen einer ODT-Dokumentvorlage: Difference between revisions
Gschratzer (talk | contribs) No edit summary Tag: 2017 source edit |
Gschratzer (talk | contribs) No edit summary Tag: 2017 source edit |
||
| Line 8: | Line 8: | ||
<!-- END interlang links --> | <!-- END interlang links --> | ||
[[Category:Admin | [[Category:Admin de]] | ||
{{TemplateDocUsuario}} | {{TemplateDocUsuario}} | ||
Diese Seite beschreibt, wie man eine ODT-Dokumentvorlage erstellt, um Dokumente mit der ODT-Generierung zu erstellen. | |||
Wenn Sie wissen möchten, wie man eine PDF-Vorlage erstellt, sehen Sie sich die Seite [[Create a PDF document template]] an. Zum Erstellen einer PDF-Vorlage sind PHP-Entwicklungskenntnisse erforderlich, aber nicht zum Erstellen einer ODT-Vorlage. | |||
== | == Voraussetzung == | ||
*Dolibarr: 3.1+ *OpenOffice: 3.2+, LibreOffice, ... | |||
*Dolibarr: | == Erstellen Sie Ihr Dokument == | ||
*Erstellen Sie von Grund auf ein leeres OpenOffice-Dokument oder nehmen Sie ein bereitgestelltes Beispiel. Sie finden sie installiert in einem Unterverzeichnis von Verzeichnis '''documents/doctemplates''' *Bearbeiten Sie Ihr Dokument mit allen Funktionen Ihrer Office-Suite. | |||
Fügen Sie die Tags in Ihr Dokument ein, die Sie sehen möchten. Tags werden während der Dokumentengenerierung automatisch von Dolibarr ersetzt. Eine Liste aller verfügbaren Tags wird im nächsten Kapitel bereitgestellt. | |||
[[File:warning.png]] Warnung: Tags müssen mit {} oder [] für Arrays umschlossen werden (siehe später) und dürfen in der Office-Suite nicht gestoppt werden (kein Backspace und kein Copy-Paste). Wenn dies nicht geschieht, fügt die Office-Suite unsichtbare Informationen hinzu, die die Erkennung/Ersetzung unmöglich machen. Mit LibreOffice können Sie auch die Tastenkombination Ctrl+M verwenden, um die Direktformatierung von Tags zu entfernen. | |||
==Tags== | ==Tags== | ||
Revision as of 07:56, 17 March 2023
Diese Seite beschreibt, wie man eine ODT-Dokumentvorlage erstellt, um Dokumente mit der ODT-Generierung zu erstellen. Wenn Sie wissen möchten, wie man eine PDF-Vorlage erstellt, sehen Sie sich die Seite Create a PDF document template an. Zum Erstellen einer PDF-Vorlage sind PHP-Entwicklungskenntnisse erforderlich, aber nicht zum Erstellen einer ODT-Vorlage.
Voraussetzung
- Dolibarr: 3.1+ *OpenOffice: 3.2+, LibreOffice, ...
Erstellen Sie Ihr Dokument
- Erstellen Sie von Grund auf ein leeres OpenOffice-Dokument oder nehmen Sie ein bereitgestelltes Beispiel. Sie finden sie installiert in einem Unterverzeichnis von Verzeichnis documents/doctemplates *Bearbeiten Sie Ihr Dokument mit allen Funktionen Ihrer Office-Suite.
Fügen Sie die Tags in Ihr Dokument ein, die Sie sehen möchten. Tags werden während der Dokumentengenerierung automatisch von Dolibarr ersetzt. Eine Liste aller verfügbaren Tags wird im nächsten Kapitel bereitgestellt.
Warnung: Tags müssen mit {} oder [] für Arrays umschlossen werden (siehe später) und dürfen in der Office-Suite nicht gestoppt werden (kein Backspace und kein Copy-Paste). Wenn dies nicht geschieht, fügt die Office-Suite unsichtbare Informationen hinzu, die die Erkennung/Ersetzung unmöglich machen. Mit LibreOffice können Sie auch die Tastenkombination Ctrl+M verwenden, um die Direktformatierung von Tags zu entfernen.
Tags
He aquí la lista de los tags que serán reemplazados por la información apropiada:
Información empresa/institución
{mycompany_logo} : Your company logo
{mycompany_name} : Your company name
{mycompany_address} : Your company address
{mycompany_zip} : Your company zip
{mycompany_town} : Your company town
{mycompany_country} : Your company country (label)
{mycompany_country_code} : Your company country (code: FR, US, IT...)
{mycompany_state} : Your company state (label)
{mycompany_state_code} : Your company state (code)
{mycompany_managers} : Your managers/director/president
{mycompany_phone}
{mycompany_fax}
{mycompany_email}
{mycompany_web}
{mycompany_barcode}
{mycompany_capital}
{mycompany_juridicalstatus}
{mycompany_managers}
{mycompany_idprof1}
{mycompany_idprof2}
{mycompany_idprof3}
{mycompany_idprof4}
{mycompany_idprof5}
{mycompany_idprof6}
{mycompany_vatnumber} : Your company VAT number
{mycompany_object}
{mycompany_note_private} : Your company private note
Información clientes, clientes potenciales o proveedores
{company_name} : Customer or Supplier company name
{company_name_alias}
{company_address}
{company_zip}
{company_town}
{company_country} : Customer or Supplier company country (label)
{company_country_code} : Customer or Supplier company country (code: FR, US, IT...)
{company_state}
{company_state_code}
{company_phone}
{company_fax}
{company_email}
{company_web}
{company_barcode}
{company_customercode} : Company customer code
{company_suppliercode} : Company supplier code
{company_customeraccountancycode} : Company customer accountancy code
{company_supplieraccountancycode} : Company supplier accountancy code
{company_capital}
{company_juridicalstatus}
{company_outstanding_limit}
{company_idprof1}
{company_idprof2}
{company_idprof3}
{company_idprof4}
{company_idprof5}
{company_idprof6}
{company_vatnumber} : Customer or Supplier company VAT number
{company_note_public} : Customer or Supplier company public note
{company_note_private} : Customer or Supplier company private note
{company_default_bank_iban}
{company_default_bank_bic}
Extra fields:
{company_options_xxx} : Value of extra field (where xxx is code of extra field)
Información usuario
{myuser_lastname}
{myuser_firstname}
{myuser_fullname}
{myuser_phone}
{myuser_fax}
{myuser_mobile}
{myuser_address}
{myuser_login}
{myuser_email}
{myuser_zip}
{myuser_town}
{myuser_country}
{myuser_country_code}
{myuser_state}
{myuser_state_code}
{myuser_logo}
{myuser_job}
{myuser_web}
Extra fields:
{myuser_options_xxx} : Value of extra field (where xxx is code of extra field)
Información del objeto (factura, presupuesto, pedido, ...)
{object_id}
{object_ref}
{object_ref_ext}
{object_label}
{object_ref_customer}
{object_ref_supplier}
{object_note_private}
{object_note_public}
or
{object_note}
Dates
{object_hour}
{object_date}
{object_date_rfc}
{object_date_creation}
{object_date_modification}
{object_date_validation}
{object_date_limit} : Specific to invoices
{object_date_end} : Specific to proposals : End date of validity of proposal
{object_date_delivery_planed} : Specific to order
{object_date_close}
Amounts (numeric data):
{object_total_ht}
{object_total_vat}
{object_total_localtax1}
{object_total_localtax2}
{object_total_ttc}
{object_total_discount_ht}
{object_total_vat_x} (is vat total for rate x. x can be for example 20, 8.5, 5.99 ... See also note*}
Amounts (in output language format):
{object_total_ht_locale}
{object_total_vat_locale}
{object_total_localtax1_locale}
{object_total_localtax2_locale}
{object_total_ttc_locale}
{object_total_discount_ht_locale}
{object_total_vat_locale_x} (is vat total for rate x. x can be for example 20, 8.5, 5.99 ... See also note*}
Multicurrency:
{object_multicurrency_code}
{object_multicurrency_tx}
{object_multicurrency_total_ht}
{object_multicurrency_total_tva}
{object_multicurrency_total_ttc}
{object_multicurrency_total_ht_locale}
{object_multicurrency_total_tva_locale}
{object_multicurrency_total_ttc_locale}
Specific to proposals :
{object_availability_id}
{object_availability_code}
{object_availability}
Specific to invoices :
{object_payment_mode}
{object_payment_mode_code}
{object_payment_term}
{object_payment_term_code}
{object_incoterms}
{object_bank_iban}
{object_bank_bic}
{object_bank_label}
{object_bank_number}
{object_bank_proprio}
{object_source_invoice_ref}
{object_already_payed} : Amount already payed (numeric)
{object_already_deposit}
{object_already_creditnote}
{object_already_payed_all}
{object_remain_to_pay} : Remaining to pay amount (numeric)
{object_already_payed_locale} : Amount already payed (output language format)
{object_already_deposit_locale}
{object_already_creditnote_locale}
{object_already_payed_all_locale}
{object_remain_to_pay_locale} : Remaining to pay amount (output language format)
Specific to Shipments :
{object_date_delivery}
{object_hour_delivery}
{object_tracking_number}
{object_tracking_url}
{object_shipping_method}
{object_weight}
{object_width}
{object_height}
{object_depth}
{object_size}
{order_ref} : Ref of origin order used to generate the shipment
{order_ref_customer} : Ref on customer side of origin order used to generate the shipment
Specific to the Project linked to the object (if applicable):
{object_project_ref}
{object_project_title}
{object_project_description}
{object_project_date_start}
{object_project_date_end}
Specific to the Product directly linked to the object (if applicable):
{object_product_ref}
{object_product_label}
Extra fields:
{object_options_xxx} : Value of extra field (where xxx is code of extra field)
For ODT with supplier prices, you may need also to surround the substitutions variables with
[!-- BEGIN supplierprices--][!-- END supplierprices--]
Líneas de los objetos
Le explicaremos como usar las tablas de líneas de los objetos (líneas de facturas, pedidos, etc...). Deberá crear una tabla en el documento y usar las balizas "begin" y "end" para definir la línea de la tabla. Esta línea se repitirá tantas veces como sea necesario en el momento de la generación.
[!-- BEGIN row.lines --] ... [!-- END row.lines --]
A continuación, añada los tags de líneas entre las dos balizas:
{line_pos}
{line_desc}
{line_product_ref}
{line_product_ref_fourn}
{line_product_label}
{line_product_type}
{line_product_barcode}
{line_vatrate}
{line_localtax1_rate}
{line_localtax2_rate}
{line_up}
{line_up_locale}
{line_qty}
{line_discount_percent}
{line_price_ht}
{line_price_ht_locale}
{line_price_vat}
{line_price_vat_locale}
{line_price_ttc}
{line_price_ttc_locale}
{line_date_start}
{line_date_start_locale}
{line_date_start_rfc}
{line_date_end}
{line_date_end_locale}
{line_date_end_rfc}
{line_unit} : Needs PRODUCT_USE_UNITS to 1
{line_unit_short} : Needs PRODUCT_USE_UNITS to 1
{line_fulldesc} : contains both line_desc and line_product_ref and line_product_label
Multicurrency :
{line_multicurrency_code}
{line_multicurrency_subprice}
{line_multicurrency_total_ht}
{line_multicurrency_total_tva}
{line_multicurrency_total_ttc}
{line_multicurrency_subprice_locale}
{line_multicurrency_total_ht_locale}
{line_multicurrency_total_tva_locale}
{line_multicurrency_total_ttc_locale}
Specific to Shipments :
{line_qty_shipped}
{line_qty_asked}
{line_weight}
{line_length}
{line_surface}
{line_volume}
Extra fields:
{line_options_xxx} : Value of extra field (where xxx is code of extra field)
{line_product_options_xxx} : If the line is a product, Value of the Product extra filed (where xxx is code of Product extra field)
Este es un ejemplo de como puede quedar en su procesador de textos:
Otros tags personalizados
Si quiere añadir un campo de sustitución no predefenido:
- Añadir un archivo en htdocs/mimodulo/core/substitutions/functions_mymodule.lib.php
- En este archivo, escribir una función como esta:
/** Function called to complete substitution array (before generating on ODT, or a personalized email)
* functions xxx_completesubstitutionarray are called by make_substitutions() if file
* is inside directory htdocs/core/substitutions
*
* @param array $substitutionarray Array with substitution key=>val
* @param Translate $langs Output langs
* @param Object $object Object to use to get values
* @return void The entry parameter $substitutionarray is modified
*/
function mymodule_completesubstitutionarray(&$substitutionarray,$langs,$object)
{
global $conf,$db;
$myvalue='Put here calculated value to insert';
$substitutionarray['myowntag']=$myvalue;
}
La función será llamada antes de la generación del documento para completar la tabla de sustituciones que reemplazará el tag myowntag por el valor definido en $myvalue. Puede añadir tantos tags como necesite y meter el código que quiera pare definir los valores (sacados de la base de datos, calculados, a partir de variables recibidas o globales, etc.).
Atención: El primer parámetro de la declaración de la función debe empezar por & ya que es modificado por el código y debe devolverse modificado.
Creado un módulo (Ver la página Desarrollo de un módulo), puede emplazar el archivo de substititución en un directorio de su módulo llamado htdocs/mimodulo/core/substitutions. Sin embargo, la función sólo será llamada si el descriptor de módulo contiene una entrada
$this->module_parts = array('substitutions' => 1)
y que el módulo haya sido activado.
Guardar su documento
Para ver su modelo de documento en la lista de modelos disponibles, guarde lo en el subdirectorio adecuado que se encuentra en el directorio documents/doctemplates