#!/usr/bin/env php ***** create_invoice.php (1.7) ***** DolibarrHasDetectedError.
InformationToHelpDiagnose:
Date: 20250918102328
Dolibarr: 22.0.1 - https://www.dolibarr.org
LevelOfFeature: 0
Login: admin
PHP: 7.4.33
Server: Apache
OS: Linux webm003.cluster020.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
UserAgent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)

RequestedUrl: /dolibarrlr/dev/examples/code/create_invoice.php
Referer:
MenuManager:

Modules: user, agenda, import, export, societe, propal, commande, fournisseur, reception, facture, tax, banque, product, service, projet, categorie, bookmark, expedition, abricot, subtotal, accounting
DatabaseTypeManager: mysqli
RequestLastAccessInError: INSERT INTO llx_facture ( ref, entity, ref_ext, type, subtype, fk_soc, datec, datef, date_pointoftax, note_private, note_public, ref_client, fk_account, module_source, pos_source, fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet, fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf, fk_input_reason, situation_cycle_ref, situation_counter, situation_final, fk_incoterms, location_incoterms, fk_multicurrency, multicurrency_code, multicurrency_tx, retained_warranty, retained_warranty_date_limit, retained_warranty_fk_cond_reglement) VALUES ('(PROV)', 1, null, '0', null, 4, '2025-09-18 10:23:28', '2025-09-18 10:23:28', null, 'A private comment', 'A public comment', null, NULL, null, null, null, null, 1, null, 1, 0, '2025-09-19 10:23:28', null, null, null, null, 0, 0, '', 0, 'EUR', 1, 0, NULL, 0)
ReturnCodeLastAccessInError: DB_ERROR_1452
InformationLastAccessInError: Cannot add or update a child row: a foreign key constraint fails (`aqtispluddolilr`.`llx_facture`, CONSTRAINT `fk_facture_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`))

Message: Cannot add or update a child row: a foreign key constraint fails (`aqtispluddolilr`.`llx_facture`, CONSTRAINT `fk_facture_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`))
--- end error code=1