From 8150cc615986cea0ffe7ed4c0e2658b1993bad51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Feb 2025 18:20:47 +0100 Subject: [PATCH 1/2] FIX wrong ODT path for multicompany --- htdocs/core/modules/modAdherent.class.php | 6 +++--- htdocs/core/modules/modBom.class.php | 4 ++-- htdocs/core/modules/modContrat.class.php | 4 ++-- htdocs/core/modules/modExpedition.class.php | 6 +++--- htdocs/core/modules/modFournisseur.class.php | 8 ++++---- htdocs/core/modules/modHoliday.class.php | 4 ++-- htdocs/core/modules/modMrp.class.php | 4 ++-- htdocs/core/modules/modProjet.class.php | 8 ++++---- htdocs/core/modules/modReception.class.php | 4 ++-- htdocs/core/modules/modSociete.class.php | 4 ++-- htdocs/core/modules/modStock.class.php | 6 +++--- htdocs/core/modules/modSupplierProposal.class.php | 4 ++-- htdocs/core/modules/modTicket.class.php | 4 ++-- .../template/core/modules/modMyModule.class.php | 2 +- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 51dd74cc117..2445000cee1 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -182,7 +182,7 @@ class modAdherent extends DolibarrModules $this->const[$r][0] = "MEMBER_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/members"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/members"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -438,8 +438,8 @@ class modAdherent extends DolibarrModules // ODT template /* - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/orders'; + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/members/template_member.odt'; + $dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/members'; $dest=$dirodt.'/template_order.odt'; if (file_exists($src) && ! file_exists($dest)) { diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index c08828442c9..748332a744c 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -127,7 +127,7 @@ class modBom extends DolibarrModules $this->const = array( 1 => array('BOM_ADDON_PDF', 'chaine', 'generic_bom_odt', 'Name of PDF model of BOM', 0), 2 => array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), - 3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) + 3 => array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms', '', 0) ); // Some keys to add into the overwriting translation tables @@ -479,7 +479,7 @@ class modBom extends DolibarrModules // ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/boms/template_bom.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/boms'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/boms'; $dest = $dirodt.'/template_bom.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index 8154c3f8902..a6bab80e3be 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -87,7 +87,7 @@ class modContrat extends DolibarrModules $this->const[$r][0] = "CONTRACT_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/contracts"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/contracts"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -230,7 +230,7 @@ class modContrat extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/contracts/template_contract.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/contracts'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/contracts'; $dest = $dirodt.'/template_contract.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 0448e1a8f11..aadfda78a18 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -99,7 +99,7 @@ class modExpedition extends DolibarrModules $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/shipments"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -120,7 +120,7 @@ class modExpedition extends DolibarrModules $this->const[$r][0] = "DELIVERY_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/deliveries"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -343,7 +343,7 @@ class modExpedition extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/shipments'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/shipments'; $dest = $dirodt.'/template_shipment.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 5e7a31b3d77..6a2dacb6bcc 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -117,7 +117,7 @@ class modFournisseur extends DolibarrModules // Add ability ODT for Supplier orders $this->const[$r][0] = "SUPPLIER_ORDER_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_orders"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_orders"; $this->const[$r][3] = ''; $this->const[$r][4] = 0; $r++; @@ -125,7 +125,7 @@ class modFournisseur extends DolibarrModules // Add ability ODT for Supplier Invoices $this->const[$r][0] = "SUPPLIER_INVOICE_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = ""; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_invoices"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -972,7 +972,7 @@ class modFournisseur extends DolibarrModules //ODT template for Supplier Orders $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_orders/template_supplier_order.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_orders'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_orders'; $dest = $dirodt.'/template_supplier_order.odt'; if (file_exists($src) && !file_exists($dest)) { @@ -993,7 +993,7 @@ class modFournisseur extends DolibarrModules //ODT template for Supplier Invoice $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_invoices/template_supplier_invoices.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_invoices'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_invoices'; $dest = $dirodt.'/template_supplier_invoices.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 5e4002b26a4..453bb966a06 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -111,7 +111,7 @@ class modHoliday extends DolibarrModules $this->const[$r][0] = "HOLIDAY_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/holiday"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/holiday"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -308,7 +308,7 @@ class modHoliday extends DolibarrModules //ODT template /*$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/holiday/template_holiday.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/holiday'; + $dirodt=DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/holiday'; $dest=$dirodt.'/template_order.odt'; if (file_exists($src) && ! file_exists($dest)) diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php index 08456a9f99c..5b6289c8f10 100644 --- a/htdocs/core/modules/modMrp.class.php +++ b/htdocs/core/modules/modMrp.class.php @@ -138,7 +138,7 @@ class modMrp extends DolibarrModules $this->const = array( //1=>array('MRP_MO_ADDON_PDF', 'chaine', 'vinci', 'Name of default PDF model of MO', 0), 2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0), - 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0) + 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps', '', 0) ); // Some keys to add into the overwriting translation tables @@ -442,7 +442,7 @@ class modMrp extends DolibarrModules // ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/mrps'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/mrps'; $dest = $dirodt.'/template_mo.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index bed2e414cc6..0508a540ce8 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -92,7 +92,7 @@ class modProjet extends DolibarrModules $this->const[$r][0] = "PROJECT_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/projects"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/projects"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -113,7 +113,7 @@ class modProjet extends DolibarrModules $this->const[$r][0] = "PROJECT_TASK_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/tasks"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/tasks"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -379,7 +379,7 @@ class modProjet extends DolibarrModules //ODT template for project $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/projects'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/projects'; $dest = $dirodt.'/template_project.odt'; if (file_exists($src) && !file_exists($dest)) { @@ -395,7 +395,7 @@ class modProjet extends DolibarrModules //ODT template for tasks $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/tasks'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tasks'; $dest = $dirodt.'/template_task_summary.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index e424325734e..e76ce8b8b78 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -91,7 +91,7 @@ class modReception extends DolibarrModules $this->const[$r][0] = "RECEPTION_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/receptions"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/receptions"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -266,7 +266,7 @@ class modReception extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/reception/template_reception.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/reception'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/reception'; $dest = $dirodt.'/template_reception.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 0c075298d3a..43d8a9ac94b 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -101,7 +101,7 @@ class modSociete extends DolibarrModules $this->const[$r][0] = "COMPANY_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/thirdparties"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/thirdparties"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -947,7 +947,7 @@ class modSociete extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/thirdparties'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/thirdparties'; $dest = $dirodt.'/template_thirdparty.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index c55ad96883c..640300b9479 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -96,14 +96,14 @@ class modStock extends DolibarrModules $r++; $this->const[$r][0] = "STOCK_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/stocks"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/stocks"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; $this->const[$r][0] = "MOUVEMENT_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/stocks/movements"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/stocks/movements"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; @@ -538,7 +538,7 @@ class modStock extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/stocks/template_warehouse.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/stocks'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/stocks'; $dest = $dirodt.'/template_warehouse.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index d7c7941d08b..4dacfc3ed09 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -92,7 +92,7 @@ class modSupplierProposal extends DolibarrModules $this->const[$r][0] = "SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposals"; + $this->const[$r][2] = "DOL_DATA_ROOT".($conf->entity > 1 ? '/'.$conf->entity : '')."/doctemplates/supplier_proposals"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; @@ -163,7 +163,7 @@ class modSupplierProposal extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposals/template_supplier_proposal.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/supplier_proposals'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/supplier_proposals'; $dest = $dirodt.'/template_supplier_proposal.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 17e6ecc9430..4fd1a842ed6 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -110,7 +110,7 @@ class modTicket extends DolibarrModules $this->const = array( 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), - 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), + 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT'.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0), 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0), @@ -414,7 +414,7 @@ class modTicket extends DolibarrModules //ODT template $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tickets/template_ticket.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/tickets'; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/tickets'; $dest = $dirodt.'/template_ticket.odt'; if (file_exists($src) && !file_exists($dest)) { diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index c79c226fc6f..f7f6805d64a 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -496,7 +496,7 @@ class modMyModule extends DolibarrModules } if ($myTmpObjectArray['includerefgeneration']) { $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir; + $dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/'.$moduledir; $dest = $dirodt.'/template_myobjects.odt'; if (file_exists($src) && !file_exists($dest)) { From cb18bebb87d06dc3ecbbf367ad645171ad85c70f Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sun, 16 Feb 2025 14:23:16 +0100 Subject: [PATCH 2/2] Fix warning on date --- htdocs/core/class/commonobject.class.php | 7 ++++--- htdocs/projet/class/task.class.php | 5 ++--- htdocs/projet/tasks/time.php | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 32796db2147..200c6222a3e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10059,9 +10059,9 @@ abstract class CommonObject /** * Create object in the database * - * @param User $user User that creates - * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers - * @return int<-1,max> Return integer <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int<-1,max> Return integer <0 if KO, Id of created object if OK */ public function createCommon(User $user, $notrigger = 0) { @@ -10080,6 +10080,7 @@ abstract class CommonObject if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) { $fieldvalues['date_creation'] = $this->db->idate($now); } + // For backward compatibility, if a property ->fk_user_creat exists and not filled. if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) { $fieldvalues['fk_user_creat'] = $user->id; $this->fk_user_creat = $user->id; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 83b9b1e55a8..9a32ee96f96 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -139,7 +139,7 @@ class Task extends CommonObjectLine public $timespent_old_duration; public $timespent_date; public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) - public $timespent_withhour; // 1 = we entered also start hours for timesheet line + public $timespent_withhour; // 0 or 1 = we have entered also start hours for timesheet line public $timespent_fk_user; public $timespent_thm; public $timespent_note; @@ -1467,10 +1467,9 @@ class Task extends CommonObjectLine $timespent->fk_user = $this->timespent_fk_user; $timespent->fk_product = $this->timespent_fk_product; $timespent->note = $this->timespent_note; - $timespent->datec = $this->db->idate($now); + $timespent->datec = $now; $result = $timespent->create($user); - if ($result > 0) { $ret = $result; $this->timespent_id = $result; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4f7541724fc..00c4a8e8053 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -175,7 +175,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_year = ''; $search_note = ''; $search_duration = ''; - $search_value = ''; $search_date_startday = ''; $search_date_startmonth = ''; $search_date_startyear = ''; @@ -249,6 +248,7 @@ if ($action == 'addtimespent' && $user->hasRight('projet', 'time')) { $object->timespent_withhour = 1; } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timemonth"), GETPOSTINT("timeday"), GETPOSTINT("timeyear")); + $object->timespent_withhour = 0; } $object->timespent_fk_user = GETPOSTINT("userid"); $object->timespent_fk_product = GETPOSTINT("fk_product"); @@ -299,6 +299,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_withhour = 1; } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_withhour = 0; } $object->timespent_fk_user = GETPOSTINT("userid_line"); $object->timespent_fk_product = GETPOSTINT("fk_product"); @@ -328,6 +329,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_withhour = 1; } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); + $object->timespent_withhour = 0; } $object->timespent_fk_user = GETPOSTINT("userid_line"); $object->timespent_fk_product = GETPOSTINT("fk_product");