Esempio n. 1
0
 public function render_invoice_actions(org_openpsa_invoices_invoice_dba $invoice)
 {
     $action = '';
     $next_marker = array();
     // unsent invoices
     if ($invoice->sent == 0) {
         // sending per mail enabled in billing data?
         $billing_data = $invoice->get_billing_data();
         // only show if mail was chosen as option
         if (intval($billing_data->sendingoption) == 2) {
             $next_marker[] = 'sent_per_mail';
         } else {
             $next_marker[] = 'sent';
         }
     } else {
         if (!$invoice->paid) {
             $next_marker[] = 'paid';
         } else {
             $action .= strftime('%Y-%m-%d', $invoice->paid);
         }
     }
     // generate next action buttons
     if ($invoice->can_do('midgard:update') && count($next_marker) > 0) {
         foreach ($next_marker as $mark) {
             $action .= '<button id="invoice_' . $invoice->guid . '" class="yes mark_' . $mark . '">';
             $action .= $this->_l10n->get('mark ' . $mark);
             $action .= '</button>';
         }
     }
     return $action;
 }