diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a0b39255837..4a64b30cd2a 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1417,7 +1417,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Other attributes. Fields from hook formObjectOptions and Extrafields. - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print ''; print dol_get_fiche_end(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0762ac75e62..bbae4e41ae3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2988,9 +2988,8 @@ if ($action == 'create' && $usercancreate) { $arrayforbutaction = array(); // Create a purchase order - - if (! getDolGlobalInt('COMMANDE_DISABLE_ADD_PURCHASE_ORDER')) { - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id); + if (!getDolGlobalInt('COMMANDE_DISABLE_ADD_PURCHASE_ORDER')) { + $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id)); } /*if (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 972031319b8..e51845f76f0 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -83,7 +83,6 @@ if (GETPOSTINT("id") || GETPOST("ref")) { $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); - /* * Actions */ @@ -243,6 +242,7 @@ if (empty($reshook)) { $object = new Account($db); $object->fetch(GETPOSTINT("id")); + $object->oldref = $object->ref; $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha'))); $object->label = trim(GETPOST("label", 'alphanohtml')); $object->type = GETPOSTINT("type"); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 09aca21d8bb..87c654a7047 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -298,6 +298,11 @@ class Account extends CommonObject */ public $ics_transfer; + /** + * @var string The previous ref in case of rename on update to rename attachment folders + */ + public $oldref; + /** * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') @@ -966,6 +971,28 @@ class Account extends CommonObject } } + if (!$error && !empty($this->oldref) && $this->oldref !== $this->ref) { + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'bank/".$this->db->escape($this->ref)."'"; + $sql .= " WHERE filepath = 'bank/".$this->db->escape($this->oldref)."' and src_object_type='bank_account' and entity = ".((int) $conf->entity); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error = $this->db->lasterror(); + } + + // We rename directory in order not to lose the attachments + $oldref = dol_sanitizeFileName($this->oldref); + $newref = dol_sanitizeFileName($this->ref); + $dirsource = $conf->bank->dir_output.'/'.$oldref; + $dirdest = $conf->bank->dir_output.'/'.$newref; + if (file_exists($dirsource)) { + dol_syslog(get_class($this)."::update rename dir ".$dirsource." into ".$dirdest, LOG_DEBUG); + if (@rename($dirsource, $dirdest)) { + dol_syslog("Rename ok", LOG_DEBUG); + } + } + } + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('BANKACCOUNT_MODIFY', $user); diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 203313deabe..6ef07a97011 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -95,29 +95,34 @@ print ''."\n"; print '
'; //print '
'; +// Define $multicompanyList +$multicompanyList = ''; $bookmarkList = ''; if (!isModEnabled('multicompany')) { $langs->load("admin"); - $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; - $bookmarkList .= '

'; + $multicompanyList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; + $multicompanyList .= '

'; +} elseif (!empty($user->entity) && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { // Should not be accessible if the option to centralize users on the main entity is not activated + $langs->load("errors"); + $multicompanyList .= '
'.$langs->trans("ErrorForbidden").''; + $multicompanyList .= '

'; } else { // Instantiate hooks of thirdparty module $hookmanager->initHooks(array('multicompany')); - // Define $bookmarks - $multicompanyList = ''; - $searchForm = ''; - - if (is_object($mc)) { - $listofentities = $mc->getEntitiesList($user->login, false, true); + $listofentities = $mc->getEntitiesList(true, false, true); } else { $listofentities = array(); } $multicompanyList .= ''; - $searchForm .= ''; - - // Execute hook printBookmarks $parameters = array('multicompany' => $multicompanyList); $reshook = $hookmanager->executeHooks('printMultiCompanyEntities', $parameters); // Note that $action and $object may have been modified by some hooks @@ -142,19 +144,18 @@ if (!isModEnabled('multicompany')) { } else { $multicompanyList = $hookmanager->resPrint; } - - - print "\n"; - print "\n"; - print '
'; - print ''; - print '
'."\n"; - print $multicompanyList; - print '
'."\n"; - print '
'; - print "\n\n"; } +print "\n"; +print "\n"; +print '
'; +print ''; +print '
'."\n"; +print $multicompanyList; +print '
'."\n"; +print '
'; +print "\n\n"; + print '
'; print ''."\n"; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7780b436fe5..38c55798abc 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2692,7 +2692,7 @@ class Product extends CommonObject $this->fk_default_bom = $obj->fk_default_bom; $this->duration = $obj->duration; - $this->duration_value = $obj->duration ? substr($obj->duration, 0, dol_strlen($obj->duration) - 1) : null; + $this->duration_value = $obj->duration ? (int) (substr($obj->duration, 0, dol_strlen($obj->duration) - 1)) : 0; $this->duration_unit = $obj->duration ? substr($obj->duration, -1) : null; $this->canvas = $obj->canvas; $this->net_measure = $obj->net_measure; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 16dc023c176..5f30b4fb118 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2021 Gauthier VERDOL +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Alexandre SPANGARO * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -151,9 +152,9 @@ print '';*/ // Date print ''; -print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datehourpicker'); +print $form->editfieldkey("Date", 'datep', $object->datepaye, $object, 1, 'datehourpicker'); print ''; -print $form->editfieldval("Date", 'datep', $object->datep, $object, 1, 'datehourpicker', '', null, null, '', 0, '', 'id', 'tzuserrel', array('addnowlink'=>1)); +print $form->editfieldval("Date", 'datep', $object->datepaye, $object, 1, 'datehourpicker', '', null, null, '', 0, '', 'id', 'tzuserrel', array('addnowlink'=>1)); print ""; print '';