Jump to content

Need to change customfields and clientdetails for an invoice

Recommended Posts

Hi all

i need to solve a problem with a wrong invoice ( obv paid from my client ) due a wrong data insert in registration from client. in my 7.5 whmcs version there's checked "Store Client Data Snapshot" option and it's working correctly, i need so ( i think that is the only way ) modify wrong data from db table mod_invoicedata.customfields and mod_invoicedata.clientdetails but value that i need to change is into a big array and i don't know how touch correctly it.

Someone has some suggestions or workaround to solve this problem that i think could be really common after whmcs upgrade system and changing ?

Thank you so much.




Share this post

Link to post
Share on other sites

Data in mod_invoice data are stored serialized. First off open phpMyAdmin and run this query:

SELECT customfields FROM mod_invoicedata WHERE invoice = '{YOUR_INVOICE_ID}';

You'll get something like this:

a:2:{i:0;a:3:{s:2:"id";i:1;s:9:"fieldname";s:6:"VAT ID";s:5:"value";s:11:"I_LOVE_SARA";}i:1;a:3:{s:2:"id";i:4;s:9:"fieldname";s:6:"Tax ID";s:5:"value";s:6:"filler";}}

Copy & paste this mess in any online editor like this one in box 1 then edit values accordingly in box 2. For example change I_LOVE_SARA with I_LOVE_BERLUSCONI (I know, I'm grotesque 😞). Once finished copy the content of box 3 and use it to replace the old value with an UPDATE query:

UPDATE mod_invoicedata SET customfields = 'a:2:{i:0;a:3:{s:2:"id";i:1;s:9:"fieldname";s:6:"VAT ID";s:5:"value";s:17:"I_LOVE_BERLUSCONI";}i:1;a:3:{s:2:"id";i:4;s:9:"fieldname";s:6:"Tax ID";s:5:"value";s:6:"filler";}}' WHERE invoiceid = '{YOUR_INVOICE_ID}'

Now you no longer love Sara in PDF.

Edited by Kian

Share this post

Link to post
Share on other sites

Hi Kian,

thank you for your answer and to help me, unfortunately i can't reach goal with this query because  i have two problem, first that i need to make a change from your first query using below

SELECT clientsdetails FROM mod_invoicedata WHERE invoiceid = '{invoice_number}' 

then if i follow your guide ans suggestion and copy the content in box 3 for the new query i have a syntax error as below

Syntax error in SQL query near ''a:2:{i:0)' on line 1

the query is
UPDATE mod_invoicedata SET clientsdetails = "a:2:{i:0;s:16:"I_LOVE_SARA";i:1;s:16:"I_LOVE_BERLUSCA";}" WHERE invoiceid = '{invoice_number]'



Share this post

Link to post
Share on other sites

Ups, my bad. Use single quotes:

UPDATE mod_invoicedata SET clientsdetails = 'a:2:{i:0;s:16:"I_LOVE_SARA";i:1;s:16:"I_LOVE_BERLUSCA";}' WHERE invoiceid = '{invoice_number]'


Share this post

Link to post
Share on other sites

Hi Kian,

I have a different output from your query that from

SELECT customfields FROM mod_invoicedata WHERE invoice = '{YOUR_INVOICE_ID}';

need to be

SELECT clientdetails FROM mod_invoicedata WHERE invoice = '{YOUR_INVOICE_ID}';
anyway i changed data from db that i need. Thank you for your time and help that was very appreciated


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

  • Similar Content

    • By Screamfox
      Hello everyone, 

      Well i forget to put the Cron Job task in my Cpanel runing every 5 minutes so, and now after 2 month many invoices as not sent and not due or generated automatically ,the right question is how can i generate all the invoices the cron task usually create for all clients ?  Because now all the 2 month automatic invoices is not here only the transaction ID from PayPal and CoinGate, but the invoice is not created/generated by the automatic system and i have more than two thousand clients so how can i generate again all invoice and put all has payed marked pay and others unpaid if unpaid ? 
      I only found this issue after 2 month so now i many "automatic" invoice is not here, there is a way to generate all invoice again ? and mark payed if the transaction is on that month, or a smiliar way ? 

      Very Important
    • By WHMCS John
      An issue has been identified in the 7.4.2 release - published on 9th January, 2018 - that can result in tax being rounded down in certain circumstances when a negative line item is manually added to an invoice.
      This can result in the tax being calculated at 0.01 too little on some invoices.
    • By spartanza
      Quick question... in the backend/admin area of WHMCS, where can I edit the invoice and the invoice logo that is attached to an email that is sent.
      I have installed an Invoice Style add-on, however, it seems to not be affecting the attachment invoice that is sent to clients. Where can I edit that logo and where does it take the logo from?
      Thank you
    • By Frankc
      Original invoice amount is $100
      Payment of $50 applied
      But the invoice amount still stay $100 on notices, admin and client area etc even while the amount due is now $50 and correct in all calculations.
      While not a problem by itself it cause unnecessry support calls and misunderstandings when the invoice is still for $100 and not $50
      Even if the PDF invoice can't be changed, surely the notices and outstanding invoices can show the DUE AMOUNT for that invoice instead than original invoice amount?
    • By souzadavi
      Hello how do I get the customfields values in gateway modules? Can I get the value of customFields by name? I did a lot of tries, but I didn't figured out...  In Gateway config module I should set the ID of each customfield.
      ID Cutomer Field: 2 | Name: CPF ID Cutomer Field: 15 | Name: WhatsApp ID Cutomer Field: 19 | Name: moipCC print_r($params["clientdetails"]["customfields"]); Array (      [0] => Array (          [id] => 2          [value] => 222745448840 )      [1] => Array (          [id] => 15          [value] => 16994513223 )      [2] => Array (          [id] => 19          [value] => )  How do I get the value of ID Customer Field 15 without know the Array key.
  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

By using this site, you agree to our Terms of Use & Guidelines