Skip to content

Commit

Permalink
Change invoice header and footer text to just invoice reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Feb 1, 2024
1 parent ae5c5f2 commit 79031ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
15 changes: 3 additions & 12 deletions admin/meta-box-project-details.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
$seconds = get_post_meta( $post->ID, '_orbis_project_seconds_available', true );
$agreement_id = get_post_meta( $post->ID, '_orbis_project_agreement_id', true );

$invoice_header_text = get_post_meta( $post->ID, '_orbis_invoice_header_text', true );
$invoice_footer_text = get_post_meta( $post->ID, '_orbis_invoice_footer_text', true );
$invoice_reference = get_post_meta( $post->ID, '_orbis_invoice_reference', true );
$invoice_line_description = get_post_meta( $post->ID, '_orbis_invoice_line_description', true );

$price = $orbis_project->get_price();
Expand Down Expand Up @@ -150,18 +149,10 @@

<tr>
<th scope="row">
<label for="_orbis_invoice_header_text"><?php esc_html_e( 'Invoice Header Text', 'orbis-projects' ); ?></label>
<label for="_orbis_invoice_reference"><?php esc_html_e( 'Invoice reference', 'orbis-projects' ); ?></label>
</th>
<td>
<textarea id="_orbis_invoice_header_text" name="_orbis_invoice_header_text" rows="2" cols="60"><?php echo esc_textarea( $invoice_header_text ); ?></textarea>
</td>
</tr>
<tr>
<th scope="row">
<label for="_orbis_invoice_footer_text"><?php esc_html_e( 'Invoice Footer Text', 'orbis-projects' ); ?></label>
</th>
<td>
<textarea id="_orbis_invoice_footer_text" name="_orbis_invoice_footer_text" rows="2" cols="60"><?php echo esc_textarea( $invoice_footer_text ); ?></textarea>
<textarea id="_orbis_invoice_reference" name="_orbis_invoice_reference" rows="2" cols="60"><?php echo esc_textarea( $invoice_reference ); ?></textarea>
</td>
</tr>
<tr>
Expand Down
3 changes: 1 addition & 2 deletions classes/AdminProjectPostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ public function save_project( $post_id, $post ) {
'_orbis_project_is_finished' => FILTER_VALIDATE_BOOLEAN,
'_orbis_project_is_invoicable' => FILTER_VALIDATE_BOOLEAN,
'_orbis_project_invoice_number' => FILTER_SANITIZE_STRING,
'_orbis_invoice_header_text' => FILTER_SANITIZE_STRING,
'_orbis_invoice_footer_text' => FILTER_SANITIZE_STRING,
'_orbis_invoice_reference' => FILTER_SANITIZE_STRING,
'_orbis_invoice_line_description' => FILTER_SANITIZE_STRING,
];

Expand Down
29 changes: 7 additions & 22 deletions templates/projects-table-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,13 @@
<td>
<?php

$invoice_header_texts = [
get_post_meta( $project->principal_post_id, '_orbis_invoice_header_text', true ),
get_post_meta( $project->project_post_id, '_orbis_invoice_header_text', true ),
get_option( 'orbis_invoice_header_text' ),
$invoice_references = [
get_post_meta( $project->principal_post_id, '_orbis_invoice_reference', true ),
get_post_meta( $project->project_post_id, '_orbis_invoice_reference', true ),
];

$invoice_header_texts = array_filter( $invoice_header_texts );
$invoice_header_texts = array_unique( $invoice_header_texts );

$invoice_footer_texts = [
get_post_meta( $project->principal_post_id, '_orbis_invoice_footer_text', true ),
get_post_meta( $project->project_post_id, '_orbis_invoice_footer_text', true ),
get_option( 'orbis_invoice_footer_text' ),
];

$invoice_footer_texts = array_filter( $invoice_footer_texts );
$invoice_footer_texts = array_unique( $invoice_footer_texts );
$invoice_references = array_filter( $invoice_references );
$invoice_references = array_unique( $invoice_references );

$invoice_line_description = get_post_meta( $project->project_post_id, '_orbis_invoice_line_description', true );

Expand All @@ -112,14 +102,9 @@

?>
<dl>
<dt><?php esc_html_e( 'Header Text', 'orbis-projects' ); ?></dt>
<dd>
<?php echo nl2br( esc_html( implode( "\r\n", $invoice_header_texts ) ) ); ?>
</dd>

<dt><?php esc_html_e( 'Footer Text', 'orbis-projects' ); ?></dt>
<dt><?php esc_html_e( 'Invoice reference', 'orbis-projects' ); ?></dt>
<dd>
<?php echo nl2br( esc_html( implode( "\r\n", $invoice_footer_texts ) ) ); ?>
<?php echo nl2br( esc_html( implode( "\r\n", $invoice_references ) ) ); ?>
</dd>

<dt><?php esc_html_e( 'Line Description', 'orbis-projects' ); ?></dt>
Expand Down

0 comments on commit 79031ac

Please sign in to comment.