Jump to content

Recommended Posts

Posted

Hi,

I've just upgraded to 4.0.0 -- everything went smoothly, BUT... that annoying invoice downloading reappeared :)

So here is the patch. I really think there should be a "view" (= stream to browser) AND "download" links on the invoice row.

I've simply created a streamInvoices function and thats it.

*** ../_extract/blesta/app/controllers/admin_billing.php	2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/admin_billing.php	2017-03-18 12:22:23.230248000 +0100
***************
*** 282,288 ****
              // Print invoices
              if (!array_key_exists('mark_printed', $this->post)) {
                  $this->components(['InvoiceDelivery']);
!                 $this->InvoiceDelivery->downloadInvoices($invoice_ids);
                  exit;
              } else {
                  // Mark invoices printed
--- 282,288 ----
              // Print invoices
              if (!array_key_exists('mark_printed', $this->post)) {
                  $this->components(['InvoiceDelivery']);
!                 $this->InvoiceDelivery->streamInvoices($invoice_ids);
                  exit;
              } else {
                  // Mark invoices printed
diff -cr ../_extract/blesta/app/controllers/admin_clients.php ./blesta/app/controllers/admin_clients.php
*** ../_extract/blesta/app/controllers/admin_clients.php	2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/admin_clients.php	2017-03-18 12:21:51.650062000 +0100
***************
*** 4292,4298 ****
  
          // Download the invoice in the admin's language
          $this->components(['InvoiceDelivery']);
!         $this->InvoiceDelivery->downloadInvoices([$invoice->id], ['language' => Configure::get('Blesta.language')]);
          exit;
      }
  
--- 4292,4298 ----
  
          // Download the invoice in the admin's language
          $this->components(['InvoiceDelivery']);
!         $this->InvoiceDelivery->streamInvoices([$invoice->id], ['language' => Configure::get('Blesta.language')]);
          exit;
      }
  
diff -cr ../_extract/blesta/app/controllers/client_invoices.php ./blesta/app/controllers/client_invoices.php
*** ../_extract/blesta/app/controllers/client_invoices.php	2017-03-14 10:23:18.000000000 +0100
--- ./blesta/app/controllers/client_invoices.php	2017-03-18 12:22:45.823894000 +0100
***************
*** 114,120 ****
          }
  
          $this->components(['InvoiceDelivery']);
!         $this->InvoiceDelivery->downloadInvoices([$invoice->id]);
          exit;
      }
  }
--- 114,120 ----
          }
  
          $this->components(['InvoiceDelivery']);
!         $this->InvoiceDelivery->streamInvoices([$invoice->id]);
          exit;
      }
  }
diff -cr ../_extract/blesta/components/invoice_delivery/invoice_delivery.php ./blesta/components/invoice_delivery/invoice_delivery.php
*** ../_extract/blesta/components/invoice_delivery/invoice_delivery.php	2017-03-14 10:23:20.000000000 +0100
--- ./blesta/components/invoice_delivery/invoice_delivery.php	2017-03-18 12:20:53.422226000 +0100
***************
*** 310,315 ****
--- 310,320 ----
          $invoices = $this->getInvoices($invoice_ids, true);
          $this->buildInvoices($invoices, true, $options)->download();
      }
+     public function streamInvoices(array $invoice_ids, array $options = null) {
+         $invoices = $this->getInvoices($invoice_ids, true);
+         $this->buildInvoices($invoices, true, $options)->stream();
+     }
+ 
  
      /**
       * Returns an errors raised

 

  • 1 month later...
Posted
50 minutes ago, Daniel B said:

hopefully this isn't a stupid question...but where exactly does this need to be added? :)

I think the intent was to produce a patch file that you can run from the command line and fill in all the changes automatically, or fail if it can not. However it looks like @Hix posted an diff based on an older RCS format. Creating a diff with the 

diff -u

option would be better and easier to understand, IMO. 

-Adam

Posted

hehe.. okay, next time I'm gonna use the unified diff format :)

...the reason why I used that is that I've forgotten the diff's syntax and was too lazy to study the man page again...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...