• Resolved Marcus Karlos

    (@power2009)


    Hello, you code have a bug in 2 latest versions..
    I fixed him before but i can’t do that again and again.

    Please fix that:
    You Code
    `/**
    * Get formatted company address.
    *
    * @return string
    */
    public function get_formatted_company_address() {
    $company_phone = self::get_option( ‘template’, ‘company_phone’ );
    $company_email_address = self::get_option( ‘template’, ‘company_email_address’ );
    $company_registration_number = self::get_option( ‘template’, ‘company_registration_number’ );
    $company_vat_id = self::get_option( ‘template’, ‘company_vat_id’ );

    if ( BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ) {
    $formatted_company_address = self::get_formatted_base_address();
    } else {
    $formatted_company_address = nl2br( self::get_option( ‘template’, ‘company_address’ ) ) . ‘<br>’;
    }

    if ( ! empty( $company_phone ) ) {
    $formatted_company_address .= sprintf( __( ‘Phone: %s’, ‘woocommerce-pdf-invoices’ ), $company_phone ) . ‘<br>’;
    }

    if ( ! empty( $company_email_address ) ) {
    $formatted_company_address .= sprintf( __( ‘Email: %s’, ‘woocommerce-pdf-invoices’ ), $company_email_address ) . ‘<br>’;
    }

    if ( ! empty( $company_registration_number ) ) {
    $formatted_company_address .= sprintf( __( ‘CRN: %s’, ‘woocommerce-pdf-invoices’ ), $company_registration_number ) . ‘<br>’;
    }

    if ( ! empty( $company_vat_id ) ) {
    $formatted_company_address .= sprintf( __( ‘VAT ID: %s’, ‘woocommerce-pdf-invoices’ ), $company_vat_id );
    }

    return $formatted_company_address;
    }

    MY CODE
    /**
    * Formatted company details.
    *
    * @return string
    */
    public function get_formatted_company_details() {
    $formatted_company_details = ”;
    $company_phone = self::get_option( ‘template’, ‘company_phone’ );
    $company_email_address = self::get_option( ‘template’, ‘company_email_address’ );
    $company_registration_number = self::get_option( ‘template’, ‘company_registration_number’ );
    $company_vat_id = self::get_option( ‘template’, ‘company_vat_id’ );

    if ( ! empty( $company_phone ) ) {
    $formatted_company_details .= sprintf( __( ‘%s’, ‘woocommerce-pdf-invoices’ ), $company_phone ) . ‘<br>’;
    }

    if ( ! empty( $company_email_address ) ) {
    $formatted_company_details .= sprintf( __( ‘%s’, ‘woocommerce-pdf-invoices’ ), $company_email_address ) . ‘<br>’;
    }

    if ( ! empty( $company_registration_number ) ) {
    $formatted_company_details .= sprintf( __( ‘CRN: %s’, ‘woocommerce-pdf-invoices’ ), $company_registration_number ) . ‘<br>’;
    }

    if ( ! empty( $company_vat_id ) ) {
    $formatted_company_details .= sprintf( __( ‘VAT ID: %s’, ‘woocommerce-pdf-invoices’ ), $company_vat_id );
    }

    return $formatted_company_details;
    }

    READ THAT
    https://www.ads-software.com/support/topic/roll-back-to-version-3-0-11/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Marcus Karlos

    (@power2009)

    after
    public function get_formatted_company_address() {
    $company_phone = self::get_option( ‘template’, ‘company_phone’ );

    You lost
    $formatted_company_details = ”;

    Thread Starter Marcus Karlos

    (@power2009)

    Ok. I fixed that
    https://www99.zippyshare.com/v/C4cMVZqK/file.html

    What i fixed?
    Added

    /**
    * Get formatted company address.
    *
    * @return string
    */
    public function get_formatted_company_address() {

    if ( BEWPI_WC_Core_Compatibility::is_wc_version_gte_3_0() ) {
    $formatted_company_address = self::get_formatted_base_address();
    } else {
    $formatted_company_address = nl2br( self::get_option( ‘template’, ‘company_address’ ) ) . ‘<br>’;
    }

    return $formatted_company_address;
    }

    and

    replaced

    if ( ! empty( $company_phone ) ) {
    $formatted_company_details .= sprintf( __( ‘Phone: %s’, ‘woocommerce-pdf-invoices’ ), $company_phone ) . ‘<br>’;
    }

    if ( ! empty( $company_email_address ) ) {
    $formatted_company_details .= sprintf( __( ‘Email: %s’, ‘woocommerce-pdf-invoices’ ), $company_email_address ) . ‘<br>’;

    Author, please fixed that in update
    Before

    After

    Plugin Author Bas Elbers

    (@baaaaas)

    Thank you for your contributions.

    Feel free to send us and email and we will be happy to provide you with a free license for our premium plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hello. Back again with bug’ is closed to new replies.