Jump to content
ArtcoInc

Invoice Editor 1.0

Recommended Posts

@@benwijns
 
I installed this contrib in several shops (2.2.MS2, 2.3.1. 2.34 and 2.3.4BS) and it works fine with any of these osc versions. So, there's NO bug. If it does not work for you, you made a mistake during installation.

I guess that either the column "num_invoice" in table "orders" does not exist, or the invoice number is not correctly written into this column. Then you can not save the invoice and if the invoice is not saved, you can not attach it to a message. Is the file admin\includes\functions\invoice_num.php in place?

 

J.J.

 

Share this post


Link to post
Share on other sites

@@benwijns

 

And if you create a pdf invoice (button 'Invoice PDF' in edit_invoice or if you display a single order) - is the num_invoice stored properly in table orders?

Share this post


Link to post
Share on other sites

@@De Dokta

http://forums.oscommerce.com/topic/399753-table-edit-instructions-addon-invoice-editor-10-8885/#entry1713860

 

Dr.J ,I closed my post (above link) and now further on this thread.

 

Got 5 more questions, I hope you can help me on my way, allready thx :

 

1) The change you suggested works :

" drop table if exists invoice_orders;
create table invoice_orders LIKE orders;
drop table if exists invoice_orders_products;
create table invoice_orders_products LIKE orders_products;
drop table if exists invoice_orders_products_attributes;
create table invoice_orders_products_attributes LIKE orders_products_attributes;
drop table if exists invoice_orders_products_download;
create table invoice_orders_products_download LIKE orders_products_download;
drop table if exists invoice_orders_total;
create table invoice_orders_total LIKE orders_total
;"

 

So is that enough for the sql's needed to run at my live shop?

So I only import the invoice_en.sql file and I don't import new_tables.sql but instead type above suggested sql in phpmyadmin? Thats all? Y or N?

 

2) Where is the 3th sql file in your addon package used for: invoice.sql?

 

3) This section from your install.txt :

 

"NOTE: This function uses the column 'orders_date_finished' in the table 'orders', which

already exists but normally is not in use. If any of your contribs uses this column, you have

to create a new column:

ALTER TABLE `orders` ADD `any_name` YEAR(4) NULL default NULL;

Additionally you have to replace 'orders_date_finished' with 'any_name'  at all sites

in the two files "orders_message.php" and "invoice_num.php" !"

 

Should I do someting with this instruction or not?

Do you know if 1 of my 3 installed addon's uses this table?

 

4)

I made a new folder in my admin: invoices/ and I set the proper instructions in my shop admin:

 

Save invoices? true icon_info.gif Storage Directory testshop/admin/invoices/ icon_info.gif

 

But when I want to print my PDF invoice I know get this error message:

 

"Warning: fopen(testshop/admin/invoices/1.pdf) [function.fopen]: failed to open stream: Bestand of map bestaat niet in /home/sportmas/public_html/testshop/admin/fpdf/tfpdf.php on line 1228
FPDF error: Unable to create output file: testshop/admin/invoices/1.pdf"

 

What do you think did I do wrong?

 

 

5) My previous installed addon sppc (http://addons.oscommerce.com/info/716) also changes admin/includes/classes/order.php

Your addon also changes admin/includes/classes/order.php. But they both change the same text in this file. So what change do I need to make to this original text in order.php , so that both addons are going to work ?:

 

Original text in this file:

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

 

Changes from addon SPPC: 

// BOF add SPPC customers_group_name to the info
      $order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, o.customers_telephone, o.customers_email_address, customers_address_format_id, customers_group_name, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " o left join " . TABLE_CUSTOMERS . " using(customers_id) left join " . TABLE_CUSTOMERS_GROUPS . " using(customers_group_id) where orders_id = '" . (int)$order_id . "'");
      // EOF add SPPC customer_group_name to the info

 

Change in your invoice editor addon:

$order_query = tep_db_query("select customers_name, customers_id, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, num_invoice, pdf_invoice, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

Share this post


Link to post
Share on other sites

pffffffffffffff - a lot of questions.........
 
1) yes!
2) invoice.sql has the same content as invoice_en.sql, but in German!
3) Look into your DB. If the column orders_date_finished is empty or NULL, then must must do nothing. If it contains any dates do as is described in the install.txt.
4) Did you create a pdf invoice? If yes, is it stored in the folder testshop/admin/invoices/? If yes, can you open it (e.g. button View Invoice)?
5) Use the $order_query from SPPC and simply add to the query the two entries num_invoice and pdf_invoice which are needed for the invoice editor.

 

J.J.

Share this post


Link to post
Share on other sites

Hello There

 

Has installed Invoice Editor v 1.3 for osC 2.3.x dated 28th Jan

 

on 2.3.4BS

 

and having a few problems getting it working, I have gone over the install 3 times now and think i have everything as it should but getting the following problems

 

In orders  any comments put into box when update button is pressed 

 

Warning: fopen() [function.fopen]: Filename cannot be empty in /home/myserver/domains/mycomain.com/public_html/myadmin area/includes/functions/general.php on line 1196

Warning: fread(): supplied argument is not a valid stream resource in /home/myserver/domains/mydomain.com/public_html/myadminarea/includes/functions/general.php on line 1196

Warning: Cannot modify header information - headers already sent by (output started at /home/myserver/domains/mydomain.com/public_html/myadminarea/includes/functions/general.php:1196) in /home/batterycom/domains/mydomain.com/public_html/4cats2015/includes/functions/general.php on line 38

 

 

 

Line number 1196  is  $attachment = fread(fopen($file, "r"), filesize($file));

 

Although the comments are updated ok

 

 

 

Further if i try to edit a invoice it does not save the changes to the order which is what i expected it to do

 

and the order editor changes in admin do not seem to make any difference to the PDF Invoice, the old address  and information is still there

 

 

Now I assume i have done something wrong, i was hoping someone would be able to tell me from the above orders, i have read and re-read the instructions and think i have got it right

 

Thank you


David

Share this post


Link to post
Share on other sites

Hi,

 

to fix the error messages try this in admin/orders.php:

      case 'update_order':
        $oID = tep_db_prepare_input($_GET['oID']);
        $status = tep_db_prepare_input($_POST['status']);
        $comments = tep_db_prepare_input($_POST['comments']);

        $order_updated = false;
        $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased, pdf_invoice from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
        $check_status = tep_db_fetch_array($check_status_query);

  if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
          tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");

          $customer_notified = '0';
          $invoice_sent = '0';
          if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) {
            $notify_comments = '';
            if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on'))
{
              $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
            }

          $link = EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n";
          $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . $link . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
            
            if(tep_not_null($check_status['pdf_invoice']) && isset($_POST['notify_invoice']) &&
($_POST['notify_invoice'] == 'on')) {
            $file = SAVE_FOLDER . $check_status['pdf_invoice'];
            $filename = $check_status['pdf_invoice'];
            $filetype = 'application/pdf';
            $invoice_sent = '1';
          
           tep_mail_pdf_attach($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $file, $filename, $filetype);

           }else{
           
           tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
            }

            $customer_notified = '1';
          }
          tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments, invoice_sent) values ('" . (int)$oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments)  . "', '" . tep_db_input($invoice_sent) . "')");

          $order_updated = true;
        }

And no, changes made in invoice editor are NOT stored in table 'orders' (and related tables). The tool is an INVOICE editor, not an ORDER editor. In the install.txt is clearly stated: "In contrast to the Order Editor, the tool does not affect the table 'orders' (and related tables), since it works with temporary copies of the original order."

If you want to change orders, use the order editor!

 

J.J.

Share this post


Link to post
Share on other sites

@ De Dokta

 

two questions need your help please.

 

1. save message, it doesn't show anywhere.

 

2. can see the invoice/packingslip in html format, but error with pdf format

FPDF error: Interlacing not supported: images/store_logo.png

 

thanks!

Share this post


Link to post
Share on other sites

@ De Dokta

 

two questions need your help please.

 

1. save message, it doesn't show anywhere.

 

2. can see the invoice/packingslip in html format, but error with pdf format

FPDF error: Interlacing not supported: images/store_logo.png

 

tried png / gif / jpg format

 

thanks!

Share this post


Link to post
Share on other sites

@ De Dokta

 

two questions need your help please.

 

1. save message, it doesn't show anywhere.

 

2. can see the invoice/packingslip in html format, but error with pdf format

FPDF error: Interlacing not supported: images/store_logo.png

 

thanks!

 

@@ce7

 

1. No idea what went wrong. If you save the message and then generate a new pdf or html invoice/packingslip in the invoice editor the message should be displayed on your new invoice/packingslip. It does not work if you generate an invoice/packingslip in orders.php.

 

2. This has nothing to do with the invoice Editor, but that you have saved your logo with the "Interlaced" option. FPDF supports no "Interlaced" and for today's high-speed Internet connections, this option is also unnecessary!
Edited by De Dokta

Share this post


Link to post
Share on other sites

 

@@ce7

 

1. No idea what went wrong. If you save the message and then generate a new pdf or html invoice/packingslip in the invoice editor the message should be displayed on your new invoice/packingslip. It does not work if you generate an invoice/packingslip in orders.php.

 

2. This has nothing to do with the invoice Editor, but that you have saved your logo with the "Interlaced" option. FPDF supports no "Interlaced" and for today's high-speed Internet connections, this option is also unnecessary!

 

@@De Dokta

Thanks for quick reply again.

 

The message seems working now, I am not sure why is not working properly previously neither, but thanks :D .

 

 

I save the logo file with no interlaced option, and now the error message, is

FPDF error: Unable to create output file: admin/invoices1.pdf

 

and I found that if I point to the Invoice PDF button, the link will not show anything,

however if I point to the Packingslip PDF button, the link will show the path website.com/admin/packingslip_editor_pdf.php?oID=1

and the packingslip pdf actually working.

Which file I need to go to check if mis-spelling? Or paste the code wrongly?

 

Thank you!

Edited by ce7

Share this post


Link to post
Share on other sites

Hi Everyone,

 

I have found an curious error while editing an invoice of an order with cash on delivery fee: If I add an deposit to the invoice, the cod fee isn't added to the totals again  :wacko:

 

Example: I've got Goods for 50€, Shipping 5€, COD-Fee 4€. Total: 59€ everything wright.

 

BUT now I add the deposit of 20€.

 

The Invoice now says: Goods for 50€, Deposit 20€, Shipping 5€, COD-Fee 4€. Total: 35€  :(

 

I am using The Invoice Editor 1.3 and Simple COD-Fee. May anyone help me ? Thanks !
 

Denzel.

Share this post


Link to post
Share on other sites

Hi Dokta,

I updated your Addon 8885_Invoice Editor, to comply with 2.3.4BS Edge.

It is now 8885_Invoice_Editor_v.1.4_for_2.3.4_BS.

 

20170324 by Denkster  Changes in 1.4:

- adapted to OsC 2.3.4BS

- replaced <table.><tr><td> layout elements with <div> layout elements

- Removed admin/includes/filenames.php

- hard coded folder names and file names in code lines
- replaced tpdf (not maintained) by fpdf (is maintained)

- updated Install.txt

 

Complete package attached.

 

Eveline Bernard

8885_Invoice_Editor_v.1.4_for_2.3.4_BS.zip

Edited by Denkster

Share this post


Link to post
Share on other sites

@@Denkster  Eveline....sadly De Dokta passed away last year.  There is a thread here

 

Dan

Share this post


Link to post
Share on other sites

Hi Dan,

Thank you for that information, sad as it is.

I am sorry.

May he rest in peace.

He will live on in his work, I hope.

 

Unfortunately his add-on page is closed for others to post.

 

Eveline

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×