Skip to content

Commit

Permalink
Merge branch '20.0' of [email protected]:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 30, 2024
2 parents 333ba5c + 4a86964 commit 7eb375d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
23 changes: 19 additions & 4 deletions htdocs/accountancy/admin/fiscalyear_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@
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");
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'add') {
} elseif ($action == 'add' && $permissiontoadd) {
if (!GETPOST('cancel', 'alpha')) {
$error = 0;

Expand Down Expand Up @@ -144,7 +144,7 @@
header("Location: ./fiscalyear.php");
exit();
}
} elseif ($action == 'update') {
} elseif ($action == 'update' && $permissiontoadd) {
// Update record
if (!GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
Expand All @@ -166,8 +166,19 @@
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');

Check warning on line 172 in htdocs/accountancy/admin/fiscalyear_card.php

View workflow job for this annotation

GitHub Actions / phan / Run phan

fiscalyear_card.php: PhanTypeMismatchProperty: Assigning GETPOST('status', 'int') of type array|string to property but \Fiscalyear->status is int

Check failure on line 172 in htdocs/accountancy/admin/fiscalyear_card.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

Property Fiscalyear::$status (int) does not accept array|string.
$result = $object->update($user);

if ($result > 0) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}


/*
Expand Down Expand Up @@ -364,6 +375,10 @@
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);
Expand Down
9 changes: 4 additions & 5 deletions htdocs/accountancy/closure/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@
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');
}
}

Expand Down Expand Up @@ -406,7 +405,7 @@
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);

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/lib/website.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '')
{
Expand Down Expand Up @@ -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)
{
Expand Down
12 changes: 12 additions & 0 deletions htdocs/core/lib/xcal.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/errors.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7eb375d

Please sign in to comment.