function si_redirect_if_expired()
{
    if (current_user_can('edit_sprout_invoices')) {
        return;
    }
    $expiration = 'invoice' === si_get_doc_context() ? si_get_invoice_due_date() : si_get_estimate_expiration_date();
    if (!$expiration) {
        return;
    }
    if ($expiration < current_time('timestamp')) {
        $redirect_url = home_url();
        wp_redirect($redirect_url);
        exit;
    }
}
Esempio n. 2
0
			<b><?php 
    self::_e('Overdue &amp; Unpaid');
    ?>
</b> 
			<ul>
				<?php 
    foreach ($invoices as $invoice_id) {
        ?>
					<li><a href="<?php 
        echo get_edit_post_link($invoice_id);
        ?>
"><?php 
        echo get_the_title($invoice_id);
        ?>
</a> &mdash; <?php 
        printf(self::__('Due: %s'), date_i18n(get_option('date_format'), si_get_invoice_due_date($invoice_id)));
        ?>
</li>
				<?php 
    }
    ?>
			</ul>
		<?php 
} else {
    ?>
			<p>
				<b><?php 
    self::_e('Overdue &amp; Unpaid');
    ?>
</b><br/>
				<?php 
Esempio n. 3
0
								<dl class="invoice_po_number">
									<dt><span class="dt_heading"><?php 
    _e('PO Number', 'sprout-invoices');
    ?>
</span></dt>
									<dd><?php 
    si_invoice_po_number();
    ?>
</dd>
								</dl>
							<?php 
}
?>

							<?php 
if (si_get_invoice_due_date()) {
    ?>
								<dl class="date">
									<dt><span class="dt_heading"><?php 
    _e('Invoice Due', 'sprout-invoices');
    ?>
</span></dt>
									<dd><?php 
    si_invoice_due_date();
    ?>
</dd>
								</dl>
							<?php 
}
?>
			<b><?php 
    _e('Overdue &amp; Unpaid', 'sprout-invoices');
    ?>
</b> 
			<ul>
				<?php 
    foreach ($invoices as $invoice_id) {
        ?>
					<li><a href="<?php 
        echo get_edit_post_link($invoice_id);
        ?>
"><?php 
        echo get_the_title($invoice_id);
        ?>
</a> &mdash; <?php 
        printf(__('Due: %s', 'sprout-invoices'), date_i18n(get_option('date_format'), si_get_invoice_due_date($invoice_id)));
        ?>
</li>
				<?php 
    }
    ?>
			</ul>
		<?php 
} else {
    ?>
			<p>
				<b><?php 
    _e('Overdue &amp; Unpaid', 'sprout-invoices');
    ?>
</b><br/>
				<?php 
 /**
  * Echo the invoice due_date
  * @param  integer $id
  * @return string
  */
 function si_invoice_due_date($id = 0)
 {
     if (!$id) {
         $id = get_the_ID();
     }
     echo apply_filters('si_invoice_due_date', date_i18n(get_option('date_format'), si_get_invoice_due_date($id)), $id);
 }
            } elseif (si_get_invoice_balance($invoice_id)) {
                ?>
  	<!-- Invoice has a balance -->
									<span class="badge balance_badge"><?php 
                si_invoice_balance($invoice_id);
                ?>
</span>
									<br/>
									<?php 
                if (si_get_invoice_due_date($invoice_id)) {
                    ?>
										<small><time datetime="<?php 
                    si_invoice_due_date($invoice_id);
                    ?>
"><?php 
                    printf(__('<b>Due:</b> %s', 'sprout-invoices'), date_i18n(apply_filters('si_client_dash_date_format', 'M. jS'), si_get_invoice_due_date($invoice_id)));
                    ?>
</time></small>
									<?php 
                }
                ?>
								<?php 
            } else {
                ?>
 <!-- Invoice is paid -->
									<span class="badge"><?php 
                si_invoice_payments_total($invoice_id);
                ?>
</span>
									<br/>
									<small><?php 
Esempio n. 7
0
 /**
  * Echo the invoice due_date
  * @param  integer $id 
  * @return string      
  */
 function si_invoice_due_date($id = 0)
 {
     if (!$id) {
         global $post;
         $id = $post->ID;
     }
     echo apply_filters('si_invoice_due_date', date_i18n(get_option('date_format'), si_get_invoice_due_date($id)), $id);
 }
 public static function due_date($atts = array())
 {
     $time = time() * 60 * 60 * 24 * 7;
     if (si_get_doc_context() == 'estimate') {
         $time = si_get_estimate_expiration_date();
     } else {
         $time = si_get_invoice_due_date();
     }
     return date_i18n('Y', $time);
 }