Exemplo n.º 1
0
/**
 * Project finished update
 *
 * @param int $post_id
 */
function orbis_project_invoice_number_update($post_id, $invoice_number_old, $invoice_number_new)
{
    // Date
    update_post_meta($post_id, '_orbis_project_invoice_number_modified', time());
    // Comment
    $user = wp_get_current_user();
    $text = $invoice_number_new;
    $invoice_link = orbis_get_invoice_link($invoice_number_new);
    if (!empty($invoice_link)) {
        $text = sprintf('<a href="%s">%s</a>', esc_attr($invoice_link), $invoice_number_new);
    }
    $comment_content = sprintf(__("Invoice Number '%s' was registered on this project by %s.", 'orbis_finance'), $text, $user->display_name);
    $data = array('comment_post_ID' => $post_id, 'comment_content' => $comment_content, 'comment_author' => 'Orbis', 'comment_type' => 'orbis_comment');
    $comment_id = wp_insert_comment($data);
}
    echo $result->name;
    ?>
					</td>
					<td>
						<?php 
    echo date_i18n('D j M Y', strtotime($result->start_date));
    ?>
					</td>
					<td>
						<?php 
    echo date_i18n('D j M Y', strtotime($result->end_date));
    ?>
					</td>
					<td>
						<?php 
    $invoice_link = orbis_get_invoice_link($result->invoice_number);
    if (!empty($invoice_link)) {
        printf('<a href="%s" target="_blank">%s</a>', esc_attr($invoice_link), $result->invoice_number);
    } else {
        echo $result->invoice_number;
    }
    ?>
					</td>
				</tr>
			
			<?php 
}
?>

		</tbody>
	</table>
    }
    ?>
						</dd>
						
						<?php 
    $invoice_number = get_post_meta(get_the_ID(), '_orbis_project_invoice_number', true);
    if (!empty($invoice_number)) {
        ?>
						
							<dt><?php 
        _e('Invoice', 'orbis');
        ?>
</dt>
							<dd>
								<?php 
        $invoice_link = orbis_get_invoice_link($invoice_number);
        if (!empty($invoice_link)) {
            printf('<a href="%s" target="_blank">%s</a>', esc_attr($invoice_link), $invoice_number);
        } else {
            echo $invoice_number;
        }
        ?>
							</dd>

						<?php 
    }
    ?>

						<dt><?php 
    _e('Actions', 'orbis');
    ?>