This project is no longer maintained and will not function with newer versions of Sendy.
This repo is for archival purposes only. Newer forks of this project may function on newer versions of Sendy.
Invoicing add-on for Sendy email server - Bill brands via invoice
If your department or company can only do internal transactions via invoice or you need an alternative to PayPal, this simple, unofficial add-on provides customizable invoicing on a brand-by-brand basis.
This add-on is tested with Sendy version 2.0.2 and 2.0.3. If you are running an older or newer version of Sendy, please test first on a non-production server. The install script attempts to insert three blocks of code within Sendy's files, and there is no guarantee that the target locations will remain the same across versions. Some correction is done automatically with broad regular expressions, but any substantial change to the insertion points will cause the add-on to fail to install.
Unfortunately, updating your Sendy server may also break this add-on. If Sendy's send-to.php or edit-brand.php are overwritten in the update, the Sendy Invoicing add-on will no longer function. You can try re-running install_invoicing.sh to attempt reinsertion of the required code, but again, there is no guarantee the target locations have stayed the same. If you rely on the Sendy Invoicing add-on and need to update Sendy, please check this repository again to see if an update has been issued, or be familiar enough with Sendy and the Sendy Invoicing add-on to make (and if you're feeling nice, merge!) the necessary modifications.
Installing this add-on is as easy as cloning this repository into the right place and running a shell script. Simply do the following:
-
cd into your sendy/includes directory (this may be a different path on your server)
cd /var/www/html/sendy/includes/
-
clone this repository
git clone https://github.com/userexec/Sendy-Invoicing.git
-
cd into the new directory
cd Sendy-Invoicing
-
make install_invoicing.sh executable
chmod +x install_invoicing.sh
-
run the install script
./install_invoicing.sh
Once you have installed the Sendy Invoicing add-on, you will need to configure the wording of the invoices and the SMTP settings necessary to deliver new invoice notifications to you for recordkeeping. These settings are contained within Sendy-Invoicing/config.php.
Once the Sendy Invoicing add-on is in place, a "Charge via invoicing" checkbox will appear under the campaign fee settings on each brand. Check the box to enable invoicing for the brand.
Please note that invoicing is activated on a brand-by-brand basis, so some brands can be billed via PayPal while others receive invoices.
When brands using invoicing press the "Proceed to pay for campaign" or "Schedule and pay for campaign" buttons, they will be taken to an invoice page with details about their campaign and the applicable charges. After reviewing the invoice, they may choose "Accept charges and print invoice" or "Cancel."
Upon accepting the invoice, the browser's print function is automatically called and a print preview is shown.
If printing fails, the user has the opportunity to print again as many times as they need before sending the campaign.
Once a printed invoice is obtained, users may press "Send or schedule campaign" to complete the workflow.
Whenever a user presses the "Accept charges and print invoice" button, a record of the invoice is automatically emailed to you using the details specified in Sendy-Invoicing/config.php. This copy is for your billing and record-keeping use and contains all pertinent information found in the user's printed invoice.
With a normal install of this add-on the administrator account is allowed to send from any brand without going through invoicing. If you would like the administrator account to be able to view and print the invoice that would be generated for a brand when sending an email, follow the instructions in admin-invoice-preview-addition.html
. Adding this code block to send-to.php
will cause a "Generate invoice" button to appear for the admin above the send button for campaigns. This is particularly useful if the admin account is used to periodically create and send emails on the behalf of some brands.
Removing the Sendy Invoicing add-on is as simple as deleting the Sendy-Invoicing folder from your sendy/includes directory and removing the three blocks of code it placed in sendy/send-to.php, sendy/new-brand.php, and sendy/edit-brand.php. The blocks of code that were inserted can be found, in full, in send-to-addition.html, new-brand-addition.html, and edit-brand-addition.html.
To remove any trace of the Sendy Invoicing add-on from your database, drop the 'security_tokens' table and the 'invoice' column in the 'apps' table.