merge conflict

This commit is contained in:
jpb
2021-08-12 09:36:34 +02:00
80 changed files with 1237 additions and 472 deletions

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -47,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$action = GETPOST('action', 'aZ09'); // set or del
$name = GETPOST('name', 'alpha');
$entity = GETPOST('entity', 'int');
$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1);
/*
@@ -64,9 +67,6 @@ top_httphead();
// Registering the new value of constant
if (!empty($action) && !empty($name)) {
$entity = GETPOST('entity', 'int');
$value = (GETPOST('value') ?GETPOST('value') : 1);
if ($user->admin) {
if ($action == 'set') {
dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity);

View File

@@ -531,7 +531,7 @@ abstract class CommonDocGenerator
$totalUp += $line->subprice * $line->qty;
}
// @GS: Calculate total up and total discount percentage
// Calculate total up and total discount percentage
// Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object)
$resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);

View File

@@ -123,6 +123,12 @@ abstract class CommonObject
*/
protected $table_ref_field = '';
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
*/
public $restrictiononfksoc = 0;
// Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
@@ -4111,7 +4117,7 @@ abstract class CommonObject
$sql .= " SET ".$fieldstatus." = ".((int) $status);
// If status = 1 = validated, update also fk_user_valid
if ($status == 1 && $elementTable == 'expensereport') {
$sql .= ", fk_user_valid = ".$user->id;
$sql .= ", fk_user_valid = ".((int) $user->id);
}
$sql .= " WHERE rowid=".((int) $elementId);
@@ -4805,13 +4811,18 @@ abstract class CommonObject
if (!empty($this->lines)) {
foreach ($this->lines as $line) {
if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
$reshook = 0;
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
if (is_object($hookmanager)) { // Old code is commented on preceding line.
if (empty($line->fk_parent_line)) {
$parameters = array('line'=>$line, 'i'=>$i);
$action = '';
$hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} else {
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line);
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
} else {
}
if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
}

View File

@@ -958,7 +958,7 @@ class Form
if ($row['code_iso']) {
$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
if (empty($hideflags)) {
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"');
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
$labeltoshow = $tmpflag.' '.$labeltoshow;
}
}
@@ -969,7 +969,7 @@ class Form
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
}
$out .= $labeltoshow;
$out .= '</option>';
$out .= '</option>'."\n";
}
}
$out .= '</select>';
@@ -4724,7 +4724,7 @@ class Form
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
foreach ($formquestion as $key => $input) {
if (is_array($input) && !empty($input)) {
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : '');
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');

View File

@@ -981,13 +981,15 @@ class FormFile
* You may want to call this into a div like this:
* print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulepart 'propal', 'facture', 'facture_fourn', ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @param string $morecss Add more css to the download picto
* @param string $allfiles 0=Only generated docs, 1=All files
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = 'valignmiddle', $allfiles = 0)
{
global $conf, $langs;
@@ -1005,12 +1007,11 @@ class FormFile
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
}
// Get list of files starting with name of ref (but not followed by "-" to discard uploaded files and get only generated files)
// @todo Why not showing by default all files by just removing the '[^\-]+' at end of regex ?
if (!empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) {
$filterforfilesearch = preg_quote(basename($modulesubdir), '/');
// Get list of files starting with name of ref (Note: files with '^ref\.extension' are generated files, files with '^ref-...' are uploaded files)
if ($allfiles || !empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) {
$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/');
} else {
$filterforfilesearch = preg_quote(basename($modulesubdir), '/').'[^\-]+';
$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/').'\.';
}
$file_list = dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // We also discard .meta and .png preview
@@ -1019,7 +1020,7 @@ class FormFile
$out .= '<!-- html.formfile::getDocumentsLink -->'."\n";
if (!empty($file_list)) {
$out = '<dl class="dropdown inline-block">
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt>
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', $morecss).'</a></dt>
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
$tmpout = '';

View File

@@ -102,8 +102,7 @@ print "});\n";
// Wrapper to manage dropdown
if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) {
print "\n/* JS CODE TO ENABLE dropdown (hamburger, linkto, ...) */\n";
print '
jQuery(document).ready(function () {
print ' jQuery(document).ready(function () {
var lastopendropdown = null;
// Click onto the link "link to" or "hamburger", toggle dropdown
@@ -171,21 +170,19 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) {
// Wrapper to manage document_preview
if ($conf->browser->layout != 'phone') {
print "\n/* JS CODE TO ENABLE document_preview */\n"; // Function document_preview is into header
print '
jQuery(document).ready(function () {
print ' jQuery(document).ready(function () {
jQuery(".documentpreview").click(function () {
console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\');
return false;
});
});
' . "\n";
});'."\n";
}
// Code to manage reposition
print "\n/* JS CODE TO ENABLE reposition management (does not work if a redirect is done after action of submission) */\n";
print '
jQuery(document).ready(function() {
jQuery(document).ready(function() {
/* If page_y set, we set scollbar with it */
page_y=getParameterByName(\'page_y\', 0); /* search in GET parameter */
if (page_y == 0) page_y = jQuery("#page_y").text(); /* search in POST parameter that is filed at bottom of page */
@@ -216,96 +213,123 @@ print '
}
}
});
});'."\n";
});'."\n";
print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n";
print 'jQuery(\'.clipboardCPShowOnHover\').hover(
function() {
console.log("We hover a value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").show();
},
function() {
console.log("We hover out the value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").hide();
}
);';
print 'jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function() {
/* console.log(this.parentNode); */
console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class");
if (window.getSelection) {
selection = window.getSelection();
// Code to manage Copy To Clipboard click
print "\n/* JS CODE TO ENABLE ClipBoard copy paste */\n";
print '
jQuery(document).ready(function() {
jQuery(\'.clipboardCPShowOnHover\').hover(
function() {
console.log("We hover a value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").show();
},
function() {
console.log("We hover out the value with a copy paste feature");
$(this).children(".clipboardCPButton, .clipboardCPText").hide();
}
);
range = document.createRange();
range.selectNodeContents(this.parentNode.firstChild);
jQuery(\'.clipboardCPButton, .clipboardCPValueToPrint\').click(function() {
/* console.log(this.parentNode); */
console.log("We click on a clipboardCPButton or clipboardCPValueToPrint class");
if (window.getSelection) {
selection = window.getSelection();
selection.removeAllRanges();
selection.addRange( range );
}
document.execCommand( \'copy\' );
window.getSelection().removeAllRanges();
range = document.createRange();
range.selectNodeContents(this.parentNode.firstChild);
/* Show message */
var lastchild = this.parentNode.lastChild;
var tmp = lastchild.innerHTML
lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
})'."\n";
selection.removeAllRanges();
selection.addRange( range );
}
document.execCommand( \'copy\' );
window.getSelection().removeAllRanges();
/* Show message */
var lastchild = this.parentNode.lastChild;
var tmp = lastchild.innerHTML
lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\';
setTimeout(() => { lastchild.innerHTML = tmp; }, 1000);
});
});'."\n";
// Code to manage clicktodial
print "\n/* JS CODE TO ENABLE clicktodial call of an URL */\n";
print '
jQuery(document).ready(function() {
jQuery(".cssforclicktodial").click(function() {
event.preventDefault();
console.log("We click on a cssforclicktodial class with url="+this.href);
$.ajax({
url: this.href,
type: \'GET\',
data: { token: \''.newToken().'\' }
}).done(function(xhr, textStatus, errorThrown) {
/* do nothing */
}).fail(function(xhr, textStatus, errorThrown) {
alert("Error: "+textStatus);
});
return false;
});
});'."\n";
// Code to manage the confirm dialog box
print "\n/* JS CODE TO ENABLE DIALOG CONFIRM POPUP ON ACTION BUTTON */\n";
print '$( document ).ready(function() {
$(document).on("click", \'.butActionConfirm\', function(event) {
event.preventDefault();
print '
jQuery(document).ready(function() {
$(document).on("click", \'.butActionConfirm\', function(event) {
event.preventDefault();
// I don\'t use jquery $(this).data(\'confirm-url\'); to get $(this).attr(\'data-confirm-url\'); because .data() can doesn\'t work with ajax
var confirmUrl = $(this).attr(\'data-confirm-url\');
var confirmTitle = $(this).attr(\'data-confirm-title\');
var confirmContent = $(this).attr(\'data-confirm-content\');
var confirmActionBtnLabel = $(this).attr(\'data-confirm-action-btn-label\');
var confirmCancelBtnLabel = $(this).attr(\'data-confirm-cancel-btn-label\');
var confirmModal = $(this).attr(\'data-confirm-modal\');
if(confirmModal == undefined){ confirmModal = false; }
// I don\'t use jquery $(this).data(\'confirm-url\'); to get $(this).attr(\'data-confirm-url\'); because .data() can doesn\'t work with ajax
var confirmUrl = $(this).attr(\'data-confirm-url\');
var confirmTitle = $(this).attr(\'data-confirm-title\');
var confirmContent = $(this).attr(\'data-confirm-content\');
var confirmActionBtnLabel = $(this).attr(\'data-confirm-action-btn-label\');
var confirmCancelBtnLabel = $(this).attr(\'data-confirm-cancel-btn-label\');
var confirmModal = $(this).attr(\'data-confirm-modal\');
if(confirmModal == undefined){ confirmModal = false; }
var confirmId = \'confirm-dialog-box\';
if($(this).attr(\'id\') != undefined){ var confirmId = confirmId + "-" + $(this).attr(\'id\'); }
if($("#" + confirmId) != undefined) { $(\'#\' + confirmId).remove(); }
var confirmId = \'confirm-dialog-box\';
if($(this).attr(\'id\') != undefined){ var confirmId = confirmId + "-" + $(this).attr(\'id\'); }
if($("#" + confirmId) != undefined) { $(\'#\' + confirmId).remove(); }
// Create modal box
// Create modal box
var $confirmBox = $(\'<div/>\', {
id: confirmId,
title: confirmTitle
}).appendTo(\'body\');
var $confirmBox = $(\'<div/>\', {
id: confirmId,
title: confirmTitle
}).appendTo(\'body\');
$confirmBox.dialog({
autoOpen: true,
modal: confirmModal,
//width: Math.min($( window ).width() - 50, 1700),
width: \'auto\',
dialogClass: \'confirm-dialog-box\',
buttons: [
{
text: confirmActionBtnLabel,
"class": \'ui-state-information\',
click: function () {
window.location.replace(confirmUrl);
}
$confirmBox.dialog({
autoOpen: true,
modal: confirmModal,
//width: Math.min($( window ).width() - 50, 1700),
width: \'auto\',
dialogClass: \'confirm-dialog-box\',
buttons: [
{
text: confirmActionBtnLabel,
"class": \'ui-state-information\',
click: function () {
window.location.replace(confirmUrl);
}
},
{
text: confirmCancelBtnLabel,
"class": \'ui-state-information\',
click: function () {
$(this).dialog("close");
}
}
],
close: function( event, ui ) {
$(\'#\'+confirmBox).remove();
},
{
text: confirmCancelBtnLabel,
"class": \'ui-state-information\',
click: function () {
$(this).dialog("close");
open: function( event, ui ) {
$confirmBox.html(confirmContent);
}
}
],
close: function( event, ui ) {
$(\'#\'+confirmBox).remove();
},
open: function( event, ui ) {
$confirmBox.html(confirmContent);
}
});
});
});
});
'."\n";

View File

@@ -549,20 +549,27 @@ function hideMessage(fieldId,message) {
* @param int strict Strict
* @param int forcereload Force reload
* @param int userid User id
* @param int value Value to set
* @param string token Token
*/
function setConstant(url, code, input, entity, strict, forcereload, userid, token) {
function setConstant(url, code, input, entity, strict, forcereload, userid, token, value) {
var saved_url = url; /* avoid undefined url */
$.post( url, {
action: "set",
name: code,
entity: entity,
token: token
token: token,
value: value
},
function() { /* handler for success of post */
console.log("url request success forcereload="+forcereload);
$("#set_" + code).hide();
$("#del_" + code).show();
console.log("url request success forcereload="+forcereload+" value="+value);
if (value == 0) {
$("#set_" + code).show();
$("#del_" + code).hide();
} else {
$("#set_" + code).hide();
$("#del_" + code).show();
}
$.each(input, function(type, data) {
// Enable another element
if (type == "disabled" && strict != 1) {
@@ -610,7 +617,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
if (forcereload) {
location.reload();
}
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
}
/*
@@ -681,7 +688,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
if (forcereload) {
location.reload();
}
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMEssage in session visible */
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
}
/*
@@ -716,7 +723,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
text : yesButton,
click : function() {
if (action == "set") {
setConstant(url, code, input, entity, strict, 0, userid, token);
setConstant(url, code, input, entity, strict, 0, userid, token, 1);
} else if (action == "del") {
delConstant(url, code, input, entity, strict, 0, userid, token);
}

View File

@@ -123,6 +123,7 @@ function versioncompare($versionarray1, $versionarray2)
* Return version PHP
*
* @return array Tableau de version (vermajeur,vermineur,autre)
* @see versioncompare()
*/
function versionphparray()
{
@@ -133,6 +134,7 @@ function versionphparray()
* Return version Dolibarr
*
* @return array Tableau de version (vermajeur,vermineur,autre)
* @see versioncompare()
*/
function versiondolibarrarray()
{

View File

@@ -540,14 +540,15 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
* @param string $code Name of constant
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
* @param int $entity Entity. Current entity is used if null.
* @param int $revertonoff Revert on/off
* @param int $revertonoff 1=Revert on/off
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin. Works for fontawesome picto only.
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
* @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it
* @return string
*/
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0)
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0)
{
global $conf, $langs, $user;
@@ -593,9 +594,13 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
} else {
delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
}
} else {';
if (empty($setzeroinsteadofdel)) {
$out .=' delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);';
} else {
$out .=' setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token, 0);';
}
$out .= ' }
});
});
</script>'."\n";

View File

@@ -668,15 +668,16 @@ function getGMTEasterDatetime($year)
*
* @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0)
* @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0)
* @param string $country_code Country code
* @param int $lastday Last day is included, 0: no, 1:yes
* @param string $country_code Country code
* @param int $lastday Last day is included, 0: no, 1:yes
* @param int $includesaturday Include saturday as non working day (-1=use setup, 0=no, 1=yes)
* @param int $includesunday Include sunday as non working day (-1=use setup, 0=no, 1=yes)
* @param int $includefriday Include friday as non working day (-1=use setup, 0=no, 1=yes)
* @return int|string Number of non working days or error message string if error
* @param int $includemonday Include monday as non working day (-1=use setup, 0=no, 1=yes)
* @return int|string Number of non working days or error message string if error
* @see num_between_day(), num_open_day()
*/
function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1)
function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1)
{
global $db, $conf, $mysoc;
@@ -690,6 +691,9 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
if (empty($country_code)) {
$country_code = $mysoc->country_code;
}
if ($includemonday < 0) {
$includemonday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY : 0);
}
if ($includefriday < 0) {
$includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0);
}

View File

@@ -2242,7 +2242,7 @@ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(
* Security check when accessing to a document (used by document.php, viewimage.php and webservices to get documents).
* TODO Replace code that set $accesallowed by a call to restrictedArea()
*
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp')
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string $original_file Relative path with filename, relative to modulepart.
* @param string $entity Restrict onto entity (0=no restriction)
* @param User $fuser User object (forced)
@@ -2270,10 +2270,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$entity = 0;
}
}
// Fix modulepart
// Fix modulepart for backward compatibility
if ($modulepart == 'users') {
$modulepart = 'user';
}
if ($modulepart == 'tva') {
$modulepart = 'tax-vat';
}
//print 'dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity;
dol_syslog('dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity);
@@ -2443,7 +2446,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1;
}
$original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file;
} elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) {
} elseif (in_array($modulepart, array('tax', 'tax-vat', 'tva')) && !empty($conf->tax->dir_output)) {
// Wrapping for taxes
if ($fuser->rights->tax->charges->{$lire}) {
$accessallowed = 1;

View File

@@ -3054,11 +3054,18 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
'__PASS__'=>$clicktodial_password);
$url = make_substitutions($url, $substitarray);
$newphonesav = $newphone;
$newphone = '<a href="'.$url.'"';
if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) {
$newphone .= ' target="_blank"';
if (empty($conf->global->CLICKTODIAL_DO_NOT_USE_AJAX_CALL)) {
// Default and recommended: New method using ajax without submiting a page making a javascript history.go(-1) back
$newphone = '<a href="'.$url.'" class="cssforclicktodial"'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial'
$newphone .= '>'.$newphonesav.'</a>';
} else {
// Old method
$newphone = '<a href="'.$url.'"';
if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET)) {
$newphone .= ' target="_blank"';
}
$newphone .= '>'.$newphonesav.'</a>';
}
$newphone .= '>'.$newphonesav.'</a>';
}
//if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
@@ -3783,7 +3790,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
return $fullpathpicto;
}
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for blind people
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
return '<img src="'.$fullpathpicto.'"'.($notitle ? '' : ' alt="'.dol_escape_htmltag($alt).'"').(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
}
/**
@@ -3843,10 +3850,11 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
* @param string $moreatt Add more attribute on img tag
* @param int $pictoisfullpath If 1, image path is a full path
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @return string Return img tag
* @see img_object(), img_picto()
*/
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $notitle = 0)
{
global $conf;
@@ -3868,7 +3876,7 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
}
}
return img_picto($titlealt, $path, $moreatt, 1);
return img_picto($titlealt, $path, $moreatt, 1, 0, $notitle);
}
/**
@@ -8119,9 +8127,10 @@ function dol_validElement($element)
*
* @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR')
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"')
* @param int $notitlealt No title alt
* @return string HTML img string with flag.
*/
function picto_from_langcode($codelang, $moreatt = '')
function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
{
if (empty($codelang)) {
return '';
@@ -8154,7 +8163,7 @@ function picto_from_langcode($codelang, $moreatt = '')
$flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
}
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt);
}
/**

View File

@@ -1876,7 +1876,7 @@ function version_os($option = '')
* Return PHP version
*
* @return string PHP version
* @see versionphparray()
* @see versionphparray(), versioncompare()
*/
function version_php()
{
@@ -1887,7 +1887,7 @@ function version_php()
* Return Dolibarr version
*
* @return string Dolibarr version
* @see versiondolibarrarray()
* @see versiondolibarrarray(), versioncompare()
*/
function version_dolibarr()
{

View File

@@ -334,7 +334,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Accounting
$tmpentry = array(
'enabled'=>(!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled) || !empty($conf->asset->enabled) || !empty($conf->intracommreport->enabled)),
'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)),
'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->comptarapport->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)),
'module'=>'comptabilite|accounting|asset|intracommreport'
);
$menu_arr[] = array(
@@ -1206,7 +1206,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
// Accounting (Double entries)
if (!empty($conf->accounting->enabled)) {
$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
//$permtoshowmenu = (!empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
//$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Configuration
@@ -1343,7 +1343,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
}
// Accounting
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
// General Ledger
$newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire);

View File

@@ -127,7 +127,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->db = $db;
$this->name = "rouget";
$this->description = $langs->trans("DocumentModelStandardPDF");
$this->description = $langs->trans("DocumentModelStandardPDF").' ('.$langs->trans("OldImplementation").')';
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
$this->type = 'pdf';

View File

@@ -87,6 +87,7 @@ class modWorkflow extends DolibarrModules
0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0),
3=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0),
4=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
5=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0),
6=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),

View File

@@ -65,7 +65,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
if (is_array($crit)) {
$crit = implode(' ', $crit); // natural_search() expects a string
} elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) {
$sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey.' = "'.$db->escape($crit).'")';
$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." = '".$db->escape($crit)."')";
continue;
}
$sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search);

View File

@@ -256,15 +256,20 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
if ($action == 'SHIPPING_VALIDATE') {
if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) {
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) &&
(
(!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) ||
(!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED'))
)
) {
$qtyshipped = array();
$qtyordred = array();
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
//find all shippement on order origin
// Find all shipments on order origin
$order = new Commande($this->db);
$ret = $order->fetch($object->origin_id);
if ($ret < 0) {
@@ -309,15 +314,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$diff_array = array_diff_assoc($qtyordred, $qtyshipped);
if (count($diff_array) == 0) {
//No diff => mean everythings is shipped
$ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE');
$ret = $order->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE');
if ($ret < 0) {
$this->error = $object->error;
$this->errors = $object->errors;
$this->error = $order->error;
$this->errors = $order->errors;
return $ret;
}
}
}
}
// classify billed reception
if ($action == 'BILL_SUPPLIER_VALIDATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);