Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.47k stars 2.8k forks source link

SQL error with recurring invoices #12337

Closed thom4parisot closed 3 years ago

thom4parisot commented 5 years ago

Bug

An SQL error happens with compta/facture/class/facture-rec.class.php. I have either a code 5 (when run automatically via a cronjob) or a code 4, when I run the job manually.

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' 0, '2019-11-01 00:00:00', 'crabe', null, null, 0, 0, '', 0, 'EUR', 1)' at line 1

Environment

Expected and actual behavior

I expected the cronjob to transform the elected (monthly) recurring invoices into regular invoices.

When I create an invoice from each recurring invoice, they are generated successfully.

Steps to reproduce the behavior

Attached files

image

image

eldy commented 5 years ago

Can you try after upgrading to 10.0.3 ?

thom4parisot commented 5 years ago

@eldy will do :-)

thom4parisot commented 5 years ago

I did the upgrade but I can't experience the problem until December 1st. Therefore I close the issue and will reopen it if the same problem happens around this period of time.

Thanks for your prompt answer!

thom4parisot commented 4 years ago

Sadly the problem happened again, ever after having upgraded to v10.0.3 in the meantime.

image

When I launch it manually, this message appears:

image

And error code is now set to 4 instead of 5, and the qualified invoices changed from 22 to 12.

image

And now even though I launch the task manually, the qualified invoices remains at 12.

image

thom4parisot commented 4 years ago

I have been able to pull out the database transaction out of the dolibarr.log file. It is one of the multiple failing transactions (other templates for other customers involved in the same cronjob ID):

2020-01-07 19:11:51 DEBUG   80.215.71.118   BEGIN Transaction
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise, f.date_lim_reglement as dlr, f.note_private, f.note_public, f.fk_user_author, f.modelpdf, f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.fk_account, f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate, f.generate_pdf, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc, p.code as mode_reglement_code, p.libelle as mode_reglement_libelle, c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc FROM llxz8_facture_rec as f LEFT JOIN llxz8_c_payment_term as c ON f.fk_cond_reglement = c.rowid LEFT JOIN llxz8_c_paiement as p ON f.fk_mode_reglement = p.id WHERE f.entity IN (1) AND f.rowid=56
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=facture_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facture_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118    FactureRec::fetch_lines
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,  l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice, l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.special_code, l.fk_unit, l.fk_contract_line, l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc, p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc FROM llxz8_facturedet_rec as l LEFT JOIN llxz8_product as p ON l.fk_product = p.rowid WHERE l.fk_facture = 56 ORDER BY l.rang
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118    createRecurringInvoices Process invoice template id=56, ref=Coworking Chloé Bonniel, entity=1
2020-01-07 19:11:51 DEBUG   80.215.71.118    MultiCurrency::getIdFromCode
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid FROM llxz8_multicurrency WHERE code = '' AND entity = 1
2020-01-07 19:11:51 INFO    80.215.71.118    Facture::create user=5 date=1577964660
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm, s.status, s.price_level, s.tms as date_modification, s.fk_user_creat, s.fk_user_modif, s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.linkedin, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6, s.capital, s.tva_intra, s.fk_typent as typent_id, s.fk_effectif as effectif_id, s.fk_forme_juridique as forme_juridique_code, s.webservices_url, s.webservices_key, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode, s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.fk_account, s.tva_assuj, s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.fk_shipping_method, s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms, s.order_min_amount, s.supplier_order_min_amount, s.fk_multicurrency, s.multicurrency_code, fj.libelle as forme_juridique, e.libelle as effectif, c.code as country_code, c.label as country, d.code_departement as state_code, d.nom as state, st.libelle as stcomm, te.code as typent_code, i.libelle as libelle_incoterms, sr.remise_client FROM llxz8_societe as s LEFT JOIN llxz8_c_effectif as e ON s.fk_effectif = e.id LEFT JOIN llxz8_c_country as c ON s.fk_pays = c.rowid LEFT JOIN llxz8_c_stcomm as st ON s.fk_stcomm = st.id LEFT JOIN llxz8_c_forme_juridique as fj ON s.fk_forme_juridique = fj.code LEFT JOIN llxz8_c_departements as d ON s.fk_departement = d.rowid LEFT JOIN llxz8_c_typent as te ON s.fk_typent = te.id LEFT JOIN llxz8_c_incoterms as i ON s.fk_incoterms = i.rowid LEFT JOIN llxz8_societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM llxz8_societe_remise WHERE fk_soc = s.rowid AND entity = 1) WHERE s.entity IN (1) AND s.rowid = 132
2020-01-07 19:11:51 INFO    80.215.71.118    fetch_name_optionals_label elementtype=societe
2020-01-07 19:11:51 DEBUG   80.215.71.118    sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'societe' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.remise_percent, f.remise_absolue, f.remise, f.date_lim_reglement as dlr, f.note_private, f.note_public, f.fk_user_author, f.modelpdf, f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.fk_account, f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.usenewprice, f.auto_validate, f.generate_pdf, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc, p.code as mode_reglement_code, p.libelle as mode_reglement_libelle, c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc FROM llxz8_facture_rec as f LEFT JOIN llxz8_c_payment_term as c ON f.fk_cond_reglement = c.rowid LEFT JOIN llxz8_c_paiement as p ON f.fk_mode_reglement = p.id WHERE f.entity IN (1) AND f.rowid=56
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=facture_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facture_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     FactureRec::fetch_lines
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,  l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice, l.info_bits, l.date_start_fill, l.date_end_fill, l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.special_code, l.fk_unit, l.fk_contract_line, l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc, p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc FROM llxz8_facturedet_rec as l LEFT JOIN llxz8_product as p ON l.fk_product = p.rowid WHERE l.fk_facture = 56 ORDER BY l.rang
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=facturedet_rec
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'facturedet_rec' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     FactureRec::fetchObjectLink
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, fk_source, sourcetype, fk_target, targettype FROM llxz8_element_element WHERE (fk_source = 56 AND sourcetype = 'facturerec') OR (fk_target = 56 AND targettype = 'facturerec') ORDER BY sourcetype
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::calculate_date_lim_reglement
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT c.type_cdr, c.nbjour, c.decalage FROM llxz8_c_payment_term as c WHERE c.rowid=1
2020-01-07 19:11:51 INFO    80.215.71.118     This is a recurring invoice so we set date_last_gen and next date_when
2020-01-07 19:11:51 DEBUG   80.215.71.118      FactureRec::setValueFrom
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=UPDATE llxz8_facture_rec SET date_last_gen = '2020-01-07 19:11:51', fk_user_modif = 5 WHERE rowid = 56
2020-01-07 19:11:51 DEBUG   80.215.71.118     FactureRec::setNextDate
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=UPDATE llxz8_facture_rec SET date_when = '2020-02-02 12:31:00', nb_gen_done = nb_gen_done + 1 WHERE rowid = 56
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=INSERT INTO llxz8_facture ( ref, entity, ref_ext, type, fk_soc, datec, remise_absolue, remise_percent, datef, date_pointoftax, note_private, note_public, ref_client, ref_int, 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, situation_cycle_ref, situation_counter, situation_final, fk_incoterms, location_incoterms, fk_multicurrency, multicurrency_code, multicurrency_tx) VALUES ('(PROV)', 1, null, '0', '132', '2020-01-07 19:11:51', NULL, NULL, '2020-01-02 12:31:00', null, 'Généré depuis la facture modèle récurrente Coworking Chloé Bonniel', null, null, null, 1, null, null, '56', null, '5', null, 1, 2, '2020-01-03 12:31:00', 'crabe', null, null, 0, 0, '', 0, 'EUR', 1)
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=UPDATE llxz8_facture SET ref='(PROV2093)' WHERE rowid=2093
2020-01-07 19:11:51 INFO    80.215.71.118     Product::fetch id=17 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 17
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     ProductFournisseur::fetch id=17 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 17
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     ProductFournisseur::find_min_price_product_fournisseur
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT s.nom as supplier_name, s.rowid as fourn_id, pfp.rowid as product_fourn_price_id, pfp.ref_fourn, pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code FROM llxz8_societe as s, llxz8_product_fournisseur_price as pfp WHERE s.entity IN (1) AND pfp.entity = 1 AND pfp.fk_product = 17 AND pfp.fk_soc = s.rowid AND s.status = 1
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::addline id=2093,desc=Location d'un poste de travail, pour 1 personne et pour 1 mois.,pu_ht=75.00000000,qty=1,txtva=20.000, txlocaltax1=0.000, txlocaltax2=0.000, fk_product=17,remise_percent=0,date_start=,date_end=,ventil=0,info_bits=0,fk_remise_except=,price_base_type=HT,pu_ttc=0,type=1, fk_unit=
2020-01-07 19:11:51 INFO    80.215.71.118      Product::fetch id=17 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 17
2020-01-07 19:11:51 INFO    80.215.71.118      fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118      getLocalTaxesFromRate vatrate=20 local=0
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy FROM llxz8_c_tva as t, llxz8_c_country as c WHERE t.fk_pays = c.rowid AND c.code = 'FR' AND t.taux = 20 AND t.active = 1
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=1 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=2 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=75 remise_percent_ligne=0 txtva=20 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=75 qty=1 price_base_type=HT total_ht=75-total_vat=15-total_ttc=90
2020-01-07 19:11:51 DEBUG   80.215.71.118      FactureLigne::insert rang=1
2020-01-07 19:11:51 DEBUG   80.215.71.118      CommonObject::isExistingObject
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext FROM llxz8_product WHERE entity IN (1) AND rowid = 17
2020-01-07 19:11:51 DEBUG   80.215.71.118       FactureLigne::insert
2020-01-07 19:11:51 DEBUG   80.215.71.118       sql=INSERT INTO llxz8_facturedet (fk_facture, fk_parent_line, label, description, qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, fk_product, product_type, remise_percent, subprice, fk_remise_except, date_start, date_end, fk_code_ventilation,  rang, special_code, fk_product_fournisseur_price, buy_price_ht, info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2, situation_percent, fk_prev_id, fk_unit, fk_user_author, fk_user_modif, fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc) VALUES (2093, null, null, 'Location d\'un poste de travail, pour 1 personne et pour 1 mois.', 1, '', 20, 0, 0, '0', '0', 17, 1, 0, 75, null, null, null, 0, 1, 0, null, 0, '0', 75, 15, 90, 0, 0, 100, null, NULL, 5, 5, 0, 'EUR', 75, 75, 15, 90)
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, qty, subprice as up, remise_percent, total_ht, total_tva as total_tva, total_ttc, total_localtax1 as total_localtax1, total_localtax2 as total_localtax2, tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type, situation_percent, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc FROM llxz8_facturedet WHERE fk_facture = 2093 AND product_type <> 9 ORDER by rowid
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=75.00000000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=75.00000000 qty=1 price_base_type=HT total_ht=75-total_vat=15-total_ttc=90
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=UPDATE llxz8_facture SET total='75', tva='15', localtax1='0', localtax2='0', total_ttc='90', multicurrency_total_ht='75', multicurrency_total_tva='15', multicurrency_total_ttc='90' WHERE rowid = 2093
2020-01-07 19:11:51 INFO    80.215.71.118     Product::fetch id=19 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 19
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     ProductFournisseur::fetch id=19 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 19
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     ProductFournisseur::find_min_price_product_fournisseur
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT s.nom as supplier_name, s.rowid as fourn_id, pfp.rowid as product_fourn_price_id, pfp.ref_fourn, pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code FROM llxz8_societe as s, llxz8_product_fournisseur_price as pfp WHERE s.entity IN (1) AND pfp.entity = 1 AND pfp.fk_product = 19 AND pfp.fk_soc = s.rowid AND s.status = 1
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::addline id=2093,desc=Charges de la nouvelle politique tarifaire,pu_ht=25.00000000,qty=1,txtva=20.000, txlocaltax1=0.000, txlocaltax2=0.000, fk_product=19,remise_percent=0,date_start=,date_end=,ventil=0,info_bits=0,fk_remise_except=,price_base_type=HT,pu_ttc=0,type=1, fk_unit=
2020-01-07 19:11:51 INFO    80.215.71.118      Product::fetch id=19 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 19
2020-01-07 19:11:51 INFO    80.215.71.118      fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118      getLocalTaxesFromRate vatrate=20 local=0
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy FROM llxz8_c_tva as t, llxz8_c_country as c WHERE t.fk_pays = c.rowid AND c.code = 'FR' AND t.taux = 20 AND t.active = 1
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=1 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=2 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=25 remise_percent_ligne=0 txtva=20 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=25 qty=1 price_base_type=HT total_ht=25-total_vat=5-total_ttc=30
2020-01-07 19:11:51 DEBUG   80.215.71.118      FactureLigne::insert rang=2
2020-01-07 19:11:51 DEBUG   80.215.71.118      CommonObject::isExistingObject
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext FROM llxz8_product WHERE entity IN (1) AND rowid = 19
2020-01-07 19:11:51 DEBUG   80.215.71.118       FactureLigne::insert
2020-01-07 19:11:51 DEBUG   80.215.71.118       sql=INSERT INTO llxz8_facturedet (fk_facture, fk_parent_line, label, description, qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, fk_product, product_type, remise_percent, subprice, fk_remise_except, date_start, date_end, fk_code_ventilation,  rang, special_code, fk_product_fournisseur_price, buy_price_ht, info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2, situation_percent, fk_prev_id, fk_unit, fk_user_author, fk_user_modif, fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc) VALUES (2093, null, null, 'Charges de la nouvelle politique tarifaire', 1, '', 20, 0, 0, '0', '0', 19, 1, 0, 25, null, null, null, 0, 2, 0, null, 0, '0', 25, 5, 30, 0, 0, 100, null, NULL, 5, 5, 0, 'EUR', 25, 25, 5, 30)
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, qty, subprice as up, remise_percent, total_ht, total_tva as total_tva, total_ttc, total_localtax1 as total_localtax1, total_localtax2 as total_localtax2, tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type, situation_percent, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc FROM llxz8_facturedet WHERE fk_facture = 2093 AND product_type <> 9 ORDER by rowid
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=75.00000000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=75.00000000 qty=1 price_base_type=HT total_ht=75-total_vat=15-total_ttc=90
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=25.00000000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=25.00000000 qty=1 price_base_type=HT total_ht=25-total_vat=5-total_ttc=30
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=UPDATE llxz8_facture SET total='100', tva='20', localtax1='0', localtax2='0', total_ttc='120', multicurrency_total_ht='100', multicurrency_total_tva='20', multicurrency_total_ttc='120' WHERE rowid = 2093
2020-01-07 19:11:51 INFO    80.215.71.118     Product::fetch id=18 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 18
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118     ProductFournisseur::fetch id=18 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 18
2020-01-07 19:11:51 INFO    80.215.71.118     fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 DEBUG   80.215.71.118     ProductFournisseur::find_min_price_product_fournisseur
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT s.nom as supplier_name, s.rowid as fourn_id, pfp.rowid as product_fourn_price_id, pfp.ref_fourn, pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code FROM llxz8_societe as s, llxz8_product_fournisseur_price as pfp WHERE s.entity IN (1) AND pfp.entity = 1 AND pfp.fk_product = 18 AND pfp.fk_soc = s.rowid AND s.status = 1
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::addline id=2093,desc=Contribution Résident.e, pour bureau partagé et bureau entier.,pu_ht=16.66667000,qty=1,txtva=20.000, txlocaltax1=0.000, txlocaltax2=0.000, fk_product=18,remise_percent=0,date_start=,date_end=,ventil=0,info_bits=0,fk_remise_except=,price_base_type=HT,pu_ttc=0,type=1, fk_unit=
2020-01-07 19:11:51 INFO    80.215.71.118      Product::fetch id=18 ref= ref_ext=
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc, price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell, tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units, length, length_units, width, width_units, height, height_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp, datec, tms, import_key, entity, desiredstock, tobatch, fk_unit, fk_price_expression, price_autogen FROM llxz8_product WHERE rowid = 18
2020-01-07 19:11:51 INFO    80.215.71.118      fetch_name_optionals_label elementtype=product
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,totalizable,fielddefault,fieldcomputed,entity,enabled,help FROM llxz8_extrafields WHERE elementtype = 'product' ORDER BY pos
2020-01-07 19:11:51 INFO    80.215.71.118      getLocalTaxesFromRate vatrate=20 local=0
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy FROM llxz8_c_tva as t, llxz8_c_country as c WHERE t.fk_pays = c.rowid AND c.code = 'FR' AND t.taux = 20 AND t.active = 1
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=1 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      get_localtax tva=20 local=2 thirdparty_buyer id=/country_code= thirdparty_seller id=0/country_code=FR thirdparty_seller localtax1_assuj=0  thirdparty_seller localtax2_assuj=0
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=16.66667 remise_percent_ligne=0 txtva=20 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=16.66667 qty=1 price_base_type=HT total_ht=16.67-total_vat=3.33-total_ttc=20
2020-01-07 19:11:51 DEBUG   80.215.71.118      FactureLigne::insert rang=3
2020-01-07 19:11:51 DEBUG   80.215.71.118      CommonObject::isExistingObject
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, ref, ref_ext FROM llxz8_product WHERE entity IN (1) AND rowid = 18
2020-01-07 19:11:51 DEBUG   80.215.71.118       FactureLigne::insert
2020-01-07 19:11:51 DEBUG   80.215.71.118       sql=INSERT INTO llxz8_facturedet (fk_facture, fk_parent_line, label, description, qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, fk_product, product_type, remise_percent, subprice, fk_remise_except, date_start, date_end, fk_code_ventilation,  rang, special_code, fk_product_fournisseur_price, buy_price_ht, info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2, situation_percent, fk_prev_id, fk_unit, fk_user_author, fk_user_modif, fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc) VALUES (2093, null, null, 'Contribution Résident.e, pour bureau partagé et bureau entier.', 1, '', 20, 0, 0, '0', '0', 18, 1, 0, 16.66667, null, null, null, 0, 3, 0, null, 0, '0', 16.67, 3.33, 20, 0, 0, 100, null, NULL, 5, 5, 0, 'EUR', 16.66667, 16.67, 3.33, 20)
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=SELECT rowid, qty, subprice as up, remise_percent, total_ht, total_tva as total_tva, total_ttc, total_localtax1 as total_localtax1, total_localtax2 as total_localtax2, tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type, situation_percent, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc FROM llxz8_facturedet WHERE fk_facture = 2093 AND product_type <> 9 ORDER by rowid
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=75.00000000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=75.00000000 qty=1 price_base_type=HT total_ht=75-total_vat=15-total_ttc=90
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=25.00000000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=25.00000000 qty=1 price_base_type=HT total_ht=25-total_vat=5-total_ttc=30
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total qty=1 pu=16.66667000 remise_percent_ligne=0 txtva=20.000 uselocaltax1_rate=0 uselocaltax2_rate=0 remise_percent_global=0 price_base_type=HT type=1 progress=100
2020-01-07 19:11:51 INFO    80.215.71.118      Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT= pu=16.66667000 qty=1 price_base_type=HT total_ht=16.67-total_vat=3.33-total_ttc=20
2020-01-07 19:11:51 DEBUG   80.215.71.118      Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118      sql=UPDATE llxz8_facture SET total='116.67', tva='23.33', localtax1='0', localtax2='0', total_ttc='140', multicurrency_total_ht='116.67', multicurrency_total_tva='23.33', multicurrency_total_ttc='140' WHERE rowid = 2093
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=SELECT rowid, qty, subprice as up, remise_percent, total_ht, total_tva as total_tva, total_ttc, total_localtax1 as total_localtax1, total_localtax2 as total_localtax2, tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type, situation_percent, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc FROM llxz8_facturedet WHERE fk_facture = 2093 AND product_type <> 9 ORDER by rowid
2020-01-07 19:11:51 DEBUG   80.215.71.118     Facture::update_price
2020-01-07 19:11:51 DEBUG   80.215.71.118     sql=UPDATE llxz8_facture SET total='116.67', tva='23.33', localtax1='0', localtax2='0', total_ttc='140', multicurrency_total_ht='116.67', multicurrency_total_tva='23.33', multicurrency_total_ttc='140' WHERE rowid = 2093
2020-01-07 19:11:51 INFO    80.215.71.118     Trigger 'ActionsBlockedLog' for action 'BILL_CREATE' launched by /home/usinevivante/dolibarr/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php. id=2093
2020-01-07 19:11:51 DEBUG   80.215.71.118   ROLLBACK Transaction createRecurringInvoices Process invoice template id=56, ref=Coworking Chloé Bonniel
2020-01-07 19:11:51 ERR     80.215.71.118   Cronjob::run_jobs END result=19 error=You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' 2, '2020-01-01 00:00:00', 'crabe', null, null, 0, 0, '', 0, 'EUR', 1)' at line 1
thom4parisot commented 4 years ago

Ah interesting, although this transaction fails, I can't see any problem with the queries. By inspecting the logs a bit more, I found out one which is dubious:

2020-01-07 19:04:17 DEBUG   80.215.71.118     sql=INSERT INTO llxz8_facture ( ref, entity, ref_ext, type, fk_soc, datec, remise_absolue, remise_percent, datef, date_pointoftax, note_private, note_public, ref_client, ref_int, 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, situation_cycle_ref, situation_counter, situation_final, fk_incoterms, location_incoterms, fk_multicurrency, multicurrency_code, multicurrency_tx) VALUES ('(PROV)', 1, null, '0', '161', '2020-01-07 19:04:17', NULL, NULL, '2020-01-01 00:00:00', null, 'G&eacute;n&eacute;r&eacute; depuis la facture mod&egrave;le r&eacute;currente Coworking Ecole Nationale des Travaux Publics de l&rsquo;Etat (ENTPE)', null, null, null, 1, null, null, '35', null, '5', null, , 2, '2020-01-01 00:00:00', 'crabe', null, null, 0, 0, '', 0, 'EUR', 1)

One field is empty.

thom4parisot commented 4 years ago

Aaaaand I found the root of the issue!

The payment condition was not set for some reason.

Screenshot_2020-01-07 Factures modèles

I changed it for all the templates qualified for the scheduled invoices.

Screenshot 2020-01-07 at 18 51 39

And all of them were successfully generated!

atm-arnaud commented 4 years ago

@eldy i think this issue could be closed

thom4parisot commented 4 years ago

My understanding is the problem happened because a mandatory field (during the cronjob) is not made mandatory during the submission of an invoice template — and/or it does not follow the same "default value" principles as in the rest of the interface.

If you think what led to this SQL error has been fixed, indeed the issue can be closed.

Which might be the case with 323f31d8323f8e80b1d33d224b5130119f93efe9 and/or f91b98d326f6a2f591e6538f1dba9e7ba22ff338?

thom4parisot commented 3 years ago

It can be closed. I faced the issue later on, but after upgrading to a further relaese of Dolibarr, it did not surface anymore.

Thanks for helping in the first place, and for fixing it down the line 🙂