lurim
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
@mohamad,
thank you for your advice. I made the change in the code of snippets and it works now fine.
Maybe somebody is interested/**
- PDF Invoices & Packing Slips: Erweiterte Platzhalter für Rechnungsnummern
- [yy] = 2-stelliges Jahr (z. B. 25 für 2025)
- [invoice_year] = 4-stellig (z. B. 2025)
- [number] = fortlaufende Rechnungsnummer mit führenden Nullen
- Fehlerfrei, auch wenn $document mal kein Objekt ist
/ /add_filter( ‘wpo_wcpdf_invoice_number’, function( $number, $type, $document ) { */
add_filter( ‘wpo_wcpdf_format_document_number’, function( $number, $type, $document ) { // 1. Standard-Jahr 4-stellig
$invoice_year = date_i18n(‘Y’); // Default
$yy = date_i18n(‘y’); // 2-stelliges Jahr Default // 2. Prüfen, ob $document ein Objekt ist
if ( is_object( $document ) && method_exists( $document, ‘get_date’ ) ) {
$date = $document->get_date();
if ( $date ) {
$invoice_year = date_i18n( ‘Y’, strtotime( $date ) );
$yy = date_i18n( ‘y’, strtotime( $date ) );
}
} // 3. Platzhalter ersetzen
$number = str_replace( ‘[invoice_year]’, $invoice_year, $number );
$number = str_replace( ‘[yy]’, $yy, $number ); // [number] bleibt unverändert (wird vom Plugin gesetzt)
return $number;
}, 10, 3 );
best regards
LutzHi Mohamad,
I sent you an email just nowbest regards
Lutz
Hi Yordan, I hope you got my email. Just to be sure – the error isn’t fixed .
Do you have an idea when it’s solved – wordpress sends me daily an email with this contentFehler-Details
==============
Ein Fehler vom Typ E_ERROR wurde in der Zeile 1018 der Datei /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/Admin.php verursacht. Fehlermeldung: Uncaught Error: Call to a member function get_prefix() on string in /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/Admin.php:1018
Stack trace:
#0 /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/Admin.php(1152): WPO\IPS\Admin->get_current_values_for_document_data(Object(WPO\IPS\Documents\Invoice), Array)
#1 /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/Admin.php(992): WPO\IPS\Admin->output_number_date_edit_fields(Object(WPO\IPS\Documents\Invoice), Array)
#2 /www/htdocs/w0204759/connywolf.com/wp-admin/includes/template.php(1453): WPO\IPS\Admin->data_input_box_content(Object(Automattic\WooCommerce\Admin\Overrides\Order), Array)
#3 /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php(506): do_meta_boxes(Object(WP_Screen), 'normal', Object(Automattic\WooCommerce\Admin\Overrides\Order))
#4 /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php(410): Automattic\WooCommerce\Internal\Admin\Orders\Edit->render_meta_boxes()
#5 /www/htdocs/w0204759/connywolf.com/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php(295): Automattic\WooCommerce\Internal\Admin\Orders\Edit->display()
#6 /www/htdocs/w0204759/connywolf.com/wp-includes/class-wp-hook.php(341): Automattic\WooCommerce\Internal\Admin\Orders\PageController->output('')
#7 /www/htdocs/w0204759/connywolf.com/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters('', Array)
#8 /www/htdocs/w0204759/connywolf.com/wp-includes/plugin.php(522): WP_Hook->do_action(Array)
#9 /www/htdocs/w0204759/connywolf.com/wp-admin/admin.php(264): do_action('woocommerce_pag...')
#10 {main}
thrown
Viewing 3 replies - 1 through 3 (of 3 total)