SimpleInvoices Group Forum › Forums › Fearless359 SimpleInvoices Discussion Group › Master2023 PDO Error when saving new invoice
- This topic has 6 replies, 2 voices, and was last updated 2 weeks ago by
RRowley.
-
AuthorPosts
-
January 18, 2025 at 5:47 am #2107
ppmt
ParticipantHello,
I have been using SI for a long time now but have been stuck on a old version since I was happy with it.I decided to install the last Maste2023 from scratch to avoid update issue. All seems good except when I try to create an invoice. When I press save I get this error:
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'invoice-1-0-1' for key 'PRIMARY' in /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php:1291 Stack trace: #0 /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php(1291): PDOStatement->execute() #1 /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php(1246): Inc\Claz\PdoDb->query() #2 /var/www/html/simpleinvoices-master_2023/Inc/Claz/Index.php(39): Inc\Claz\PdoDb->request() #3 /var/www/html/simpleinvoices-master_2023/Inc/Claz/Invoice.php(665): Inc\Claz\Index::increment() #4 /var/www/html/simpleinvoices-master_2023/modules/invoices/save.php(55): Inc\Claz\Invoice::insert() #5 /var/www/html/simpleinvoices-master_2023/index.php(441): include('...') #6 {main} thrown in /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php on line 1291
The invoice is created but it has none of the product added to the invoice and if I edit there are no row for the product and I can’t add a row. It says there are no row to clone.
Checking phpmyadmin I see that the si_invoices is populated but the si_invoice_items is empty
January 19, 2025 at 6:50 am #2108ppmt
ParticipantI tried as well by installing the sample data and the issue is the same.
Question: Am I meant to be using that version?
January 27, 2025 at 6:22 am #2113RRowley
ParticipantWhen you say you tried this loading sample data, does this mean you started with an empty database, letting SI load default configuration data and then letting SI install sample data? If this is the case, the issue if perplexing indeed.
What version of SI are you trying to upgrade from? What version of PHP are you on?
If error persists, zip the
tmp/log/php.log
file and attach it to your response.-
This reply was modified 2 weeks, 4 days ago by
RRowley.
January 28, 2025 at 1:42 pm #2118ppmt
ParticipantThank you for the reply.
I am using PHP version 8.1.31 . The database is MariaDB version 10
It is installed on a Debian 12 with Apache2 as the server.I am installing a version from scratch so no upgrade. I tried to update in the past and I never got it to work.
So here is what I did.
1/ I created a new database and updated the custom.config.ini with the correct credentials
2/ I opened the website and it ask me to confirm to install the database.
3/ Then it asked me to install the essential data
4/ I declined to install the sample data and instead created a biller, a customer and a few products.All seemed good so I created an invoice. When I pressed saved I got the message above.
I also tried to do it again after emptying the database and this time installing the sample data. It gave me the same error while it was doing that.
The php.log attached is from a fresh install.
After installing the sample data I got this error:
Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while there are pending result sets. Consider unsetting the previous PDOStatement or calling PDOStatement::closeCursor() in /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php:713 Stack trace: #0 /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php(713): PDOStatement->execute() #1 /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php(1310): Inc\Claz\PdoDb->lastInsertId() #2 /var/www/html/simpleinvoices-master_2023/modules/install/sample_data.php(20): Inc\Claz\PdoDb->query() #3 /var/www/html/simpleinvoices-master_2023/index.php(441): include('...') #4 {main} thrown in /var/www/html/simpleinvoices-master_2023/Inc/Claz/PdoDb.php on line 713
This was the url listed in the browser at the time:
http://192.168.0.140/simpleinvoices-master_2023/index.php?module=install&view=sample_data
Hopefully this will be useful for you
Attachments:
January 30, 2025 at 11:26 am #2120RRowley
ParticipantConcerning latest message, SI with empty database. You need to let SI install essential data. Without it, you don’t have required information to use SI. After that step you can choose to install the test biller, customer, product info. Or you can enter these records for yourself with your data. In order to add an invoice, you must have a biller (you), a customer (the one the invoice is for) and at least one product to add to the invoice.
Now, back to your original problem. The reason 2019.2 is a required upgrade, it because that was the last version that maintained the same database changes that were required to bring original SI versions up to the fearless359 SI version, as the development of fearless359 SI diverged from previous SI versions on the maintenance path (the projects were physically separated on GITHUB.
Here is a possible way to move forward. I can make a PHP program that will simply apply the patches 2019.2 is trying to apply. However, trying to resolve any issues this program encounters becomes tricky by us having to communicate issues back and forth. If is easier if I had your data to convert. If you are up for that, I would need a full SQL extract of your starting database structure and your data. To protect your data, you can send it to me via email, in an encrypted, password protected zip file. The password could then be texted to my phone. If you are up for that, you can email it to me at
admin@simpleinvoices.group
. Include your email address along with the attached file and I will then send my cell number for the password to be texted to.January 30, 2025 at 12:10 pm #2121ppmt
ParticipantAgain thanks for your time.
I did install the Essential Data. I actually think you can’t move forward without doing it.
So if I understand you well it is not possible to install the Master2023 as a new install? and instead I must upgrade from 2019.2?
I so I will try to install 2019.2 from scratch and then update it to the Master2023.
The issue with my existing install is that it is very old.
version.update_date = 20181012 version.name
I have never been able to find a successful upgrade path and sort of gave up.
I am not too bothered about porting the database over and don’t mind starting from fresh.
Of course if you think you can upgrade it and you don’t mind spending the time doing it I can send you the files.
January 31, 2025 at 10:32 am #2122RRowley
ParticipantIf you start with an empty database, the structure is created using the most current structure version and then installs essential data required to start using SI. The only reason to insert sample data is if you don’t want to use the database for live purposes; just testing it out.
Once the essential data has been installed, you can begin using SI. Just create a biller, a customer and a product. The you can enter an invoice.
This is the approach to take if you are starting from scratch. On the other hand, if you need to preserve your current version’s data, you follow the upgrade path through master_2019.2. This however appears to be having problems for you. That is why I suggested letting me try and convert your current data from your historic SI to the most current level.
From what you say about your PHP version and such, you should be able to run the most current master_2023 version. However you want to proceed, let me know.
-
This reply was modified 2 weeks, 4 days ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
Recent Comments