예제 #1
0
 public function get_payments()
 {
     $payment_ids = SI_Payment::get_payments(array('invoices' => $this->ID));
     return $payment_ids;
 }
예제 #2
0
 /**
  * If an invoice was deleted also delete the payments associated
  * @param  integer $post_id
  * @return null
  */
 public static function maybe_delete_payment($post_id = 0)
 {
     if (get_post_type($post_id) == SI_Invoice::POST_TYPE) {
         $payment_ids = SI_Payment::get_payments(array('invoices' => $post_id));
         foreach ($payment_ids as $payment_id) {
             wp_delete_post($payment_id);
         }
     }
 }