Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0

Conflicts:
	htdocs/commande/card.php
	htdocs/core/multicompany_page.php
This commit is contained in:
Laurent Destailleur 2024-08-12 21:51:31 +02:00
commit 4f6643fe1e
7 changed files with 63 additions and 35 deletions

View File

@ -1417,7 +1417,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
// 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 '</table>';
print dol_get_fiche_end();

View File

@ -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&amp;origin='.$object->element.'&amp;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&amp;origin='.urlencode($object->element).'&amp;originid='.((int) $object->id));
}
/*if (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) {

View File

@ -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");

View File

@ -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);

View File

@ -95,29 +95,34 @@ print '<body>'."\n";
print '<div>';
//print '<br>';
// Define $multicompanyList
$multicompanyList = '';
$bookmarkList = '';
if (!isModEnabled('multicompany')) {
$langs->load("admin");
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).'</span>';
$bookmarkList .= '<br><br>';
$multicompanyList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).'</span>';
$multicompanyList .= '<br><br>';
} 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 .= '<br><span class="opacitymedium">'.$langs->trans("ErrorForbidden").'</span>';
$multicompanyList .= '<br><br>';
} 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 .= '<ul class="ullistonly left" style="list-style: none; padding: 0">';
foreach ($listofentities as $entityid => $entitycursor) {
// Check if the user has the right to access the entity
if (getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && !empty($user->entity) && $mc->checkRight($user->id, $entityid) < 0) {
continue;
}
$url = DOL_URL_ROOT.'/core/multicompany_page.php?action=switchentity&token='.newToken().'&entity='.((int) $entityid).($backtourl ? '&backtourl='.urlencode($backtourl) : '');
$multicompanyList .= '<li class="lilistonly" style="height: 2.5em; font-size: 1.15em;">';
$multicompanyList .= '<a class="dropdown-item multicompany-item paddingtopimp paddingbottomimp" id="multicompany-item-'.$entityid.'" data-id="'.$entityid.'" href="'.dol_escape_htmltag($url).'">';
@ -131,9 +136,6 @@ if (!isModEnabled('multicompany')) {
}
$multicompanyList .= '</ul>';
$searchForm .= '<input name="bookmark" id="top-multicompany-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Entity').'" autocomplete="off" >';
// 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 "<!-- Begin Multicompany list -->\n";
print '<div class="center"><div class="center" style="padding: 6px;">';
print '<style>.menu_titre { padding-top: 7px; }</style>';
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
print $multicompanyList;
print '</div>'."\n";
print '</div></div>';
print "\n<!-- End SearchForm -->\n";
}
print "\n";
print "<!-- Begin Multicompany list -->\n";
print '<div class="center"><div class="center" style="padding: 6px;">';
print '<style>.menu_titre { padding-top: 7px; }</style>';
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
print $multicompanyList;
print '</div>'."\n";
print '</div></div>';
print "\n<!-- End Multicompany list -->\n";
print '</div>';
print '</body></html>'."\n";

View File

@ -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;

View File

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 Alexandre SPANGARO <alexandre@inovea-conseil.com>
*
* 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 '</td></tr>';*/
// Date
print '<tr><td>';
print $form->editfieldkey("Date", 'datep', $object->datep, $object, 1, 'datehourpicker');
print $form->editfieldkey("Date", 'datep', $object->datepaye, $object, 1, 'datehourpicker');
print '</td><td>';
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 "</td>";
print '</tr>';