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

This commit is contained in:
Laurent Destailleur 2024-09-30 16:21:37 +02:00
commit 7eb375d398
5 changed files with 38 additions and 10 deletions

View file

@ -94,7 +94,7 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if ($action == 'confirm_delete' && $confirm == "yes") {
if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontoadd) {
$result = $object->delete($user);
if ($result >= 0) {
header("Location: fiscalyear.php");
@ -102,7 +102,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'add') {
} elseif ($action == 'add' && $permissiontoadd) {
if (!GETPOST('cancel', 'alpha')) {
$error = 0;
@ -144,7 +144,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
header("Location: ./fiscalyear.php");
exit();
}
} elseif ($action == 'update') {
} elseif ($action == 'update' && $permissiontoadd) {
// Update record
if (!GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
@ -166,8 +166,19 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
}
}
} elseif ($action == 'reopen' && $permissiontoadd && getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD')) {
$result = $object->fetch($id);
$object->status = GETPOST('status', 'int');
$result = $object->update($user);
if ($result > 0) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
/*
@ -364,6 +375,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($user->hasRight('accounting', 'fiscalyear', 'write')) {
print '<div class="tabsAction">';
if (getDolGlobalString('ACCOUNTING_CAN_REOPEN_CLOSED_PERIOD') && $object->status == $object::STATUS_CLOSED) {
print dolGetButtonAction($langs->trans("ReOpen"), '', 'reopen', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), 'reopen', $permissiontoadd);
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
//print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);

View file

@ -152,11 +152,10 @@ if (empty($reshook)) {
if ($generate_bookkeeping_records) {
if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_BALANCE_SHEET_ACCOUNT')) {
$error++;
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
}
if (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
setEventMessages($langs->trans("ErrorAccountingClosureSetupNotComplete"), null, 'errors');
} elseif (!getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT')) {
$error++;
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
setEventMessages($langs->trans("ErrorAccountingClosureSetupNotComplete"), null, 'errors');
}
}
@ -406,7 +405,7 @@ if (empty($current_fiscal_period)) {
if (empty($count_by_month['total']) && empty($current_fiscal_period['status'])) {
$button = '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=step_2&fiscal_period_id=' . $current_fiscal_period['id'] . '">' . $langs->trans("AccountancyClosureClose") . '</a>';
} else {
$button = '<a class="butActionRefused classfortooltip" href="#">' . $langs->trans("AccountancyClosureClose") . '</a>';
$button = '<a class="butActionRefused classfortooltip" href="#" title="This fiscal period already has the status Closed. Feature disabled.">' . $langs->trans("AccountancyClosureClose") . '</a>';
}
print_barre_liste('', '', '', '', '', '', '', -1, '', '', 0, $button, '', 0, 1, 0);

View file

@ -1033,7 +1033,7 @@ function getNbOfImagePublicURLOfObject($object)
* @param int $no Numero of image (if there is several images. 1st one by default)
* @param string $extName Extension to differentiate thumb file name ('', '_small', '_mini')
* @return string HTML img content or '' if no image found
* @see getNbOfImagePublicURLOfObject(), getPublicFilesOfObject()
* @see getNbOfImagePublicURLOfObject(), getPublicFilesOfObject(), getImageFromHtmlContent()
*/
function getImagePublicURLOfObject($object, $no = 1, $extName = '')
{
@ -1334,6 +1334,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
* @param string $htmlContent HTML content
* @param int $imageNumber The position of image. 1 by default = first image found
* @return string URL of image or '' if not foud
* @see getImagePublicURLOfObject()
*/
function getImageFromHtmlContent($htmlContent, $imageNumber = 1)
{

View file

@ -397,6 +397,18 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
$tmpevent['desc'] = $event->description;
if (!empty($event->image)) {
$tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$event->image;
} else {
include_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
$tmpimage = getImageFromHtmlContent($event->content);
if ($tmpimage) {
if (strpos($tmpimage, '/') === 0) { // If $tmpimage is an absolute path
$tmpevent['image'] = $GLOBALS['website']->virtualhost.$tmpimage;
} elseif (stripos($tmpimage, 'http') === 0) { // If $tmpimage is a full URI
$tmpevent['image'] = $tmpimage;
} else {
$tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$tmpimage;
} // TODO If $tmpimage is "data:..."
}
}
$tmpevent['content'] = $event->content;

View file

@ -60,6 +60,7 @@ ErrorInAddAttachmentsImageBaseIsSrcData=Error in creating image files (found as
ErrorFailedToCreateDir=Failed to create a directory. Check that Web server user has permissions to write into Dolibarr documents directory. If parameter <b>safe_mode</b> is enabled on this PHP, check that Dolibarr php files owns to web server user (or group).
ErrorNoMailDefinedForThisUser=No mail defined for this user
ErrorSetupOfEmailsNotComplete=Setup of emails is not complete
ErrorAccountingClosureSetupNotComplete=Setup of closure accounts not complete
ErrorFeatureNeedJavascript=This feature needs JavaScript to be activated to work. Change this in setup - display.
ErrorTopMenuMustHaveAParentWithId0=A menu of type 'Top' can't have a parent menu. Put 0 in parent menu or choose a menu of type 'Left'.
ErrorLeftMenuMustHaveAParentId=A menu of type 'Left' must have a parent id.